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

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: cs42xx8-i2c: Simplify probe()

Simplify probe() by replacing of_match_device->i2c_get_match_data() and
extend matching support for ID table. Also replace
dev_err()->dev_err_probe() to simplify the code.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230828174856.122559-1-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Biju Das and committed by
Mark Brown
ad191992 26eacb98

+4 -10
+4 -10
sound/soc/codecs/cs42xx8-i2c.c
··· 18 18 19 19 #include "cs42xx8.h" 20 20 21 - static const struct of_device_id cs42xx8_of_match[]; 22 - 23 21 static int cs42xx8_i2c_probe(struct i2c_client *i2c) 24 22 { 25 23 int ret; 26 24 struct cs42xx8_driver_data *drvdata; 27 - const struct of_device_id *of_id; 28 25 29 - of_id = of_match_device(cs42xx8_of_match, &i2c->dev); 30 - if (!of_id) { 31 - dev_err(&i2c->dev, "failed to find driver data\n"); 32 - return -EINVAL; 33 - } 34 - 35 - drvdata = (struct cs42xx8_driver_data *)of_id->data; 26 + drvdata = (struct cs42xx8_driver_data *)i2c_get_match_data(i2c); 27 + if (!drvdata) 28 + return dev_err_probe(&i2c->dev, -EINVAL, 29 + "failed to find driver data\n"); 36 30 37 31 ret = cs42xx8_probe(&i2c->dev, 38 32 devm_regmap_init_i2c(i2c, &cs42xx8_regmap_config), drvdata);