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

authored by

Biju Das and committed by
Mark Brown
26eacb98 43f2d432

+10 -16
+10 -16
sound/soc/codecs/wm8580.c
··· 988 988 .num_dacs = 4, 989 989 }; 990 990 991 - static const struct of_device_id wm8580_of_match[] = { 992 - { .compatible = "wlf,wm8580", .data = &wm8580_data }, 993 - { .compatible = "wlf,wm8581", .data = &wm8581_data }, 994 - { }, 995 - }; 996 - MODULE_DEVICE_TABLE(of, wm8580_of_match); 997 - 998 991 static int wm8580_i2c_probe(struct i2c_client *i2c) 999 992 { 1000 - const struct of_device_id *of_id; 1001 993 struct wm8580_priv *wm8580; 1002 994 int ret, i; 1003 995 ··· 1014 1022 1015 1023 i2c_set_clientdata(i2c, wm8580); 1016 1024 1017 - of_id = of_match_device(wm8580_of_match, &i2c->dev); 1018 - if (of_id) 1019 - wm8580->drvdata = of_id->data; 1020 - 1021 - if (!wm8580->drvdata) { 1022 - dev_err(&i2c->dev, "failed to find driver data\n"); 1023 - return -EINVAL; 1024 - } 1025 + wm8580->drvdata = i2c_get_match_data(i2c); 1026 + if (!wm8580->drvdata) 1027 + return dev_err_probe(&i2c->dev, -EINVAL, "failed to find driver data\n"); 1025 1028 1026 1029 ret = devm_snd_soc_register_component(&i2c->dev, 1027 1030 &soc_component_dev_wm8580, wm8580_dai, ARRAY_SIZE(wm8580_dai)); 1028 1031 1029 1032 return ret; 1030 1033 } 1034 + 1035 + static const struct of_device_id wm8580_of_match[] = { 1036 + { .compatible = "wlf,wm8580", .data = &wm8580_data }, 1037 + { .compatible = "wlf,wm8581", .data = &wm8581_data }, 1038 + { } 1039 + }; 1040 + MODULE_DEVICE_TABLE(of, wm8580_of_match); 1031 1041 1032 1042 static const struct i2c_device_id wm8580_i2c_id[] = { 1033 1043 { "wm8580", (kernel_ulong_t)&wm8580_data },