ASoC: ak4613: Simplify probe()
authorBiju Das <biju.das.jz@bp.renesas.com>
Sun, 13 Aug 2023 07:34:58 +0000 (08:34 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 14 Aug 2023 12:10:36 +0000 (13:10 +0100)
Simpilfy probe() by replacing of_device_get_match_data() and id lookup for
retrieving match data by i2c_get_match_data().

While at it, drop unused local variable np from probe().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230813073458.59606-1-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/ak4613.c

index ad56caec9dac309e4945c7ee0c975d1c7d9711b3..619a817ee91cb8fc0f06362aedb3e9ba317d47cb 100644 (file)
@@ -880,20 +880,11 @@ static void ak4613_parse_of(struct ak4613_priv *priv,
 static int ak4613_i2c_probe(struct i2c_client *i2c)
 {
        struct device *dev = &i2c->dev;
-       struct device_node *np = dev->of_node;
        const struct regmap_config *regmap_cfg;
        struct regmap *regmap;
        struct ak4613_priv *priv;
 
-       regmap_cfg = NULL;
-       if (np)
-               regmap_cfg = of_device_get_match_data(dev);
-       else {
-               const struct i2c_device_id *id =
-                       i2c_match_id(ak4613_i2c_id, i2c);
-               regmap_cfg = (const struct regmap_config *)id->driver_data;
-       }
-
+       regmap_cfg = i2c_get_match_data(i2c);
        if (!regmap_cfg)
                return -EINVAL;