linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: cs42l56: fix DT probe
@ 2023-01-26 13:55 Arnd Bergmann
  2023-01-26 14:03 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2023-01-26 13:55 UTC (permalink / raw)
  To: James Schulman, David Rhodes, Lucas Tanure, Richard Fitzgerald
  Cc: linux-gpio, Arnd Bergmann, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Charles Keepax, Wolfram Sang,
	alsa-devel, patches, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

While looking through legacy platform data users, I noticed that
this one could never be used with DT based probing as the
platform_data structure gets overwritten directly after it
is initialized.

There have never been any boards defining the platform_data in
the mainline kernel either, so this driver so far only worked
with patched kernels.

For the benefit of possible downstream users, fix the DT probe
by no longer overwriting the data.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/soc/codecs/cs42l56.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/sound/soc/codecs/cs42l56.c b/sound/soc/codecs/cs42l56.c
index 26066682c983..3b0e715549c9 100644
--- a/sound/soc/codecs/cs42l56.c
+++ b/sound/soc/codecs/cs42l56.c
@@ -1191,18 +1191,12 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client)
 	if (pdata) {
 		cs42l56->pdata = *pdata;
 	} else {
-		pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata),
-				     GFP_KERNEL);
-		if (!pdata)
-			return -ENOMEM;
-
 		if (i2c_client->dev.of_node) {
 			ret = cs42l56_handle_of_data(i2c_client,
 						     &cs42l56->pdata);
 			if (ret != 0)
 				return ret;
 		}
-		cs42l56->pdata = *pdata;
 	}
 
 	if (cs42l56->pdata.gpio_nreset) {
-- 
2.39.0


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

* Re: [PATCH] ASoC: cs42l56: fix DT probe
  2023-01-26 13:55 [PATCH] ASoC: cs42l56: fix DT probe Arnd Bergmann
@ 2023-01-26 14:03 ` Mark Brown
  2023-01-26 14:46   ` Charles Keepax
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2023-01-26 14:03 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: James Schulman, David Rhodes, Lucas Tanure, Richard Fitzgerald,
	linux-gpio, Arnd Bergmann, Liam Girdwood, Jaroslav Kysela,
	Takashi Iwai, Charles Keepax, Wolfram Sang, alsa-devel, patches,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 600 bytes --]

On Thu, Jan 26, 2023 at 02:55:29PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> While looking through legacy platform data users, I noticed that
> this one could never be used with DT based probing as the
> platform_data structure gets overwritten directly after it
> is initialized.
> 
> There have never been any boards defining the platform_data in
> the mainline kernel either, so this driver so far only worked
> with patched kernels.

Or there is no mandatory properties/platform data and the
defaults are fine for most systems (which is a common case).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] ASoC: cs42l56: fix DT probe
  2023-01-26 14:03 ` Mark Brown
@ 2023-01-26 14:46   ` Charles Keepax
  2023-01-26 15:32     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Charles Keepax @ 2023-01-26 14:46 UTC (permalink / raw)
  To: Mark Brown
  Cc: Arnd Bergmann, James Schulman, David Rhodes, Lucas Tanure,
	Richard Fitzgerald, linux-gpio, Arnd Bergmann, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, Wolfram Sang, alsa-devel, patches,
	linux-kernel

On Thu, Jan 26, 2023 at 02:03:35PM +0000, Mark Brown wrote:
> On Thu, Jan 26, 2023 at 02:55:29PM +0100, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > While looking through legacy platform data users, I noticed that
> > this one could never be used with DT based probing as the
> > platform_data structure gets overwritten directly after it
> > is initialized.
> > 
> > There have never been any boards defining the platform_data in
> > the mainline kernel either, so this driver so far only worked
> > with patched kernels.
> 
> Or there is no mandatory properties/platform data and the
> defaults are fine for most systems (which is a common case).

I think Arnd is right here, the driver appears to allocate a big
block of zeros and then blat that over the top of everything it
read from device tree. So you can literally never use any of the
DT properties as it stands.

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

* Re: [PATCH] ASoC: cs42l56: fix DT probe
  2023-01-26 14:46   ` Charles Keepax
@ 2023-01-26 15:32     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2023-01-26 15:32 UTC (permalink / raw)
  To: Charles Keepax
  Cc: Arnd Bergmann, James Schulman, David Rhodes, Lucas Tanure,
	Richard Fitzgerald, linux-gpio, Arnd Bergmann, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, Wolfram Sang, alsa-devel, patches,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]

On Thu, Jan 26, 2023 at 02:46:35PM +0000, Charles Keepax wrote:
> On Thu, Jan 26, 2023 at 02:03:35PM +0000, Mark Brown wrote:

> > Or there is no mandatory properties/platform data and the
> > defaults are fine for most systems (which is a common case).

> I think Arnd is right here, the driver appears to allocate a big
> block of zeros and then blat that over the top of everything it
> read from device tree. So you can literally never use any of the
> DT properties as it stands.

Oh, the fix is fixing a real issue - it's the claim in the commit
log that the driver could never have worked that's not obviously
correct.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2023-01-26 15:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-26 13:55 [PATCH] ASoC: cs42l56: fix DT probe Arnd Bergmann
2023-01-26 14:03 ` Mark Brown
2023-01-26 14:46   ` Charles Keepax
2023-01-26 15:32     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).