Commit bc07df94 authored by Biju Das's avatar Biju Das Committed by Mark Brown

ASoC: wm8580: Simplify probe()

Simplify probe() by replacing of_match_device->i2c_get_match_data()
and extend matching support for ID table.

While at it, remove comma in the terminator entry and simplify probe()
by replacing dev_err()->dev_err_probe().
Signed-off-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230901065952.18760-2-biju.das.jz@bp.renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0bb80ecc
...@@ -997,7 +997,6 @@ MODULE_DEVICE_TABLE(of, wm8580_of_match); ...@@ -997,7 +997,6 @@ MODULE_DEVICE_TABLE(of, wm8580_of_match);
static int wm8580_i2c_probe(struct i2c_client *i2c) static int wm8580_i2c_probe(struct i2c_client *i2c)
{ {
const struct of_device_id *of_id;
struct wm8580_priv *wm8580; struct wm8580_priv *wm8580;
int ret, i; int ret, i;
...@@ -1022,14 +1021,9 @@ static int wm8580_i2c_probe(struct i2c_client *i2c) ...@@ -1022,14 +1021,9 @@ static int wm8580_i2c_probe(struct i2c_client *i2c)
i2c_set_clientdata(i2c, wm8580); i2c_set_clientdata(i2c, wm8580);
of_id = of_match_device(wm8580_of_match, &i2c->dev); wm8580->drvdata = i2c_get_match_data(i2c);
if (of_id) if (!wm8580->drvdata)
wm8580->drvdata = of_id->data; return dev_err_probe(&i2c->dev, -EINVAL, "failed to find driver data\n");
if (!wm8580->drvdata) {
dev_err(&i2c->dev, "failed to find driver data\n");
return -EINVAL;
}
ret = devm_snd_soc_register_component(&i2c->dev, ret = devm_snd_soc_register_component(&i2c->dev,
&soc_component_dev_wm8580, wm8580_dai, ARRAY_SIZE(wm8580_dai)); &soc_component_dev_wm8580, wm8580_dai, ARRAY_SIZE(wm8580_dai));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment