Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: ak4613: Simplify probe()

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>

authored by

Biju Das and committed by
Mark Brown
b39eee27 446b31e8

+1 -10
+1 -10
sound/soc/codecs/ak4613.c
··· 880 880 static int ak4613_i2c_probe(struct i2c_client *i2c) 881 881 { 882 882 struct device *dev = &i2c->dev; 883 - struct device_node *np = dev->of_node; 884 883 const struct regmap_config *regmap_cfg; 885 884 struct regmap *regmap; 886 885 struct ak4613_priv *priv; 887 886 888 - regmap_cfg = NULL; 889 - if (np) 890 - regmap_cfg = of_device_get_match_data(dev); 891 - else { 892 - const struct i2c_device_id *id = 893 - i2c_match_id(ak4613_i2c_id, i2c); 894 - regmap_cfg = (const struct regmap_config *)id->driver_data; 895 - } 896 - 887 + regmap_cfg = i2c_get_match_data(i2c); 897 888 if (!regmap_cfg) 898 889 return -EINVAL; 899 890