diff options
author | Biju Das <biju.das.jz@bp.renesas.com> | 2023-08-31 21:47:34 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-09-11 01:24:03 +0100 |
commit | d9e6a80a2c7bea4cc2edc87fa43b876a64b13074 (patch) | |
tree | e7e9ba1a1bffc299839837d3f6bc918350f7004f /sound/soc/codecs/ak4642.c | |
parent | a157d07d029be5b72ee3bce3ac44dab7b967bc9b (diff) |
ASoC: ak4642: Simplify probe()
Simpilfy probe() by replacing of_device_get_match_data() and id lookup for
retrieving match data by i2c_get_match_data().
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230831204734.104954-3-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/ak4642.c')
-rw-r--r-- | sound/soc/codecs/ak4642.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 901014909c0f..8a40c6b3f4d8 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -628,32 +628,21 @@ static struct clk *ak4642_of_parse_mcko(struct device *dev) #define ak4642_of_parse_mcko(d) 0 #endif -static const struct of_device_id ak4642_of_match[]; -static const struct i2c_device_id ak4642_i2c_id[]; static int ak4642_i2c_probe(struct i2c_client *i2c) { struct device *dev = &i2c->dev; - const struct ak4642_drvdata *drvdata = NULL; + const struct ak4642_drvdata *drvdata; struct regmap *regmap; struct ak4642_priv *priv; struct clk *mcko = NULL; if (dev_fwnode(dev)) { - const struct of_device_id *of_id; - mcko = ak4642_of_parse_mcko(dev); if (IS_ERR(mcko)) mcko = NULL; - - of_id = of_match_device(ak4642_of_match, dev); - if (of_id) - drvdata = of_id->data; - } else { - const struct i2c_device_id *id = - i2c_match_id(ak4642_i2c_id, i2c); - drvdata = (const struct ak4642_drvdata *)id->driver_data; } + drvdata = i2c_get_match_data(i2c); if (!drvdata) return dev_err_probe(dev, -EINVAL, "Unknown device type\n"); |