mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: wm8580: Simplify probe()
@ 2023-08-28 17:40 Biju Das
  2023-08-29 15:18 ` Andy Shevchenko
  2023-09-11 23:57 ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Biju Das @ 2023-08-28 17:40 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai
  Cc: Biju Das, Liam Girdwood, Mark Brown, Charles Keepax,
	Uwe Kleine-König, patches, alsa-devel, linux-kernel,
	Andy Shevchenko

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>
---
Note:
 This patch is only compile tested.

v1->v2:
 * Added Ack from Charles Keepax.
 * Removed comma in the terminator entry.
 * Restored original error code -EINVAL
---
 sound/soc/codecs/wm8580.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
index 6d22f7d40ec2..28c0ba348634 100644
--- a/sound/soc/codecs/wm8580.c
+++ b/sound/soc/codecs/wm8580.c
@@ -988,16 +988,8 @@ static const struct wm8580_driver_data wm8581_data = {
 	.num_dacs = 4,
 };
 
-static const struct of_device_id wm8580_of_match[] = {
-	{ .compatible = "wlf,wm8580", .data = &wm8580_data },
-	{ .compatible = "wlf,wm8581", .data = &wm8581_data },
-	{ },
-};
-MODULE_DEVICE_TABLE(of, wm8580_of_match);
-
 static int wm8580_i2c_probe(struct i2c_client *i2c)
 {
-	const struct of_device_id *of_id;
 	struct wm8580_priv *wm8580;
 	int ret, i;
 
@@ -1022,14 +1014,9 @@ static int wm8580_i2c_probe(struct i2c_client *i2c)
 
 	i2c_set_clientdata(i2c, wm8580);
 
-	of_id = of_match_device(wm8580_of_match, &i2c->dev);
-	if (of_id)
-		wm8580->drvdata = of_id->data;
-
-	if (!wm8580->drvdata) {
-		dev_err(&i2c->dev, "failed to find driver data\n");
-		return -EINVAL;
-	}
+	wm8580->drvdata = i2c_get_match_data(i2c);
+	if (!wm8580->drvdata)
+		return dev_err_probe(&i2c->dev, -EINVAL, "failed to find driver data\n");
 
 	ret = devm_snd_soc_register_component(&i2c->dev,
 			&soc_component_dev_wm8580, wm8580_dai, ARRAY_SIZE(wm8580_dai));
@@ -1037,6 +1024,13 @@ static int wm8580_i2c_probe(struct i2c_client *i2c)
 	return ret;
 }
 
+static const struct of_device_id wm8580_of_match[] = {
+	{ .compatible = "wlf,wm8580", .data = &wm8580_data },
+	{ .compatible = "wlf,wm8581", .data = &wm8581_data },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, wm8580_of_match);
+
 static const struct i2c_device_id wm8580_i2c_id[] = {
 	{ "wm8580", (kernel_ulong_t)&wm8580_data },
 	{ "wm8581", (kernel_ulong_t)&wm8581_data },
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ASoC: wm8580: Simplify probe()
  2023-08-28 17:40 [PATCH v2] ASoC: wm8580: Simplify probe() Biju Das
@ 2023-08-29 15:18 ` Andy Shevchenko
  2023-08-29 18:05   ` Biju Das
  2023-09-11 23:57 ` Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2023-08-29 15:18 UTC (permalink / raw)
  To: Biju Das
  Cc: Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Charles Keepax, Uwe Kleine-König, patches, alsa-devel,
	linux-kernel

On Mon, Aug 28, 2023 at 06:40:19PM +0100, Biju Das wrote:
> 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().

dev_err() --> dev_err_probe()

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

...

> -static const struct of_device_id wm8580_of_match[] = {
> -	{ .compatible = "wlf,wm8580", .data = &wm8580_data },
> -	{ .compatible = "wlf,wm8581", .data = &wm8581_data },
> -	{ },
> -};
> -MODULE_DEVICE_TABLE(of, wm8580_of_match);

This doesn't change anything functional, please do it in a separate change.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v2] ASoC: wm8580: Simplify probe()
  2023-08-29 15:18 ` Andy Shevchenko
@ 2023-08-29 18:05   ` Biju Das
  0 siblings, 0 replies; 4+ messages in thread
From: Biju Das @ 2023-08-29 18:05 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Charles Keepax, Uwe Kleine-König, patches, alsa-devel,
	linux-kernel

Hi Andy,

> Subject: Re: [PATCH v2] ASoC: wm8580: Simplify probe()
> 
> On Mon, Aug 28, 2023 at 06:40:19PM +0100, Biju Das wrote:
> > 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().
> 
> dev_err() --> dev_err_probe()
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> ...
> 
> > -static const struct of_device_id wm8580_of_match[] = {
> > -	{ .compatible = "wlf,wm8580", .data = &wm8580_data },
> > -	{ .compatible = "wlf,wm8581", .data = &wm8581_data },
> > -	{ },
> > -};
> > -MODULE_DEVICE_TABLE(of, wm8580_of_match);
> 
> This doesn't change anything functional, please do it in a separate change.

Agreed.

Cheers,
Biju

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ASoC: wm8580: Simplify probe()
  2023-08-28 17:40 [PATCH v2] ASoC: wm8580: Simplify probe() Biju Das
  2023-08-29 15:18 ` Andy Shevchenko
@ 2023-09-11 23:57 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2023-09-11 23:57 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Biju Das
  Cc: Liam Girdwood, Charles Keepax, Uwe Kleine-König, patches,
	alsa-devel, linux-kernel, Andy Shevchenko

On Mon, 28 Aug 2023 18:40:19 +0100, Biju Das wrote:
> 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().
> 
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: wm8580: Simplify probe()
      commit: 26eacb98ca7dd3ba5a6845028a13d13a7f03123f

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-12  2:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-28 17:40 [PATCH v2] ASoC: wm8580: Simplify probe() Biju Das
2023-08-29 15:18 ` Andy Shevchenko
2023-08-29 18:05   ` Biju Das
2023-09-11 23:57 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®