mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 9/8] iio: adc: ad7124: Benefit of dev = indio_dev->dev.parent in ad7124_parse_channel_config()
@ 2025-03-04  9:41 Uwe Kleine-König
  2025-03-06  0:10 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2025-03-04  9:41 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Andy Shevchenko, Cosmin Tanislav, Dumitru Ceclan,
	Guillaume Ranquet, Lars-Peter Clausen, Michael Hennerich,
	Michael Walle, Nuno Sa, linux-iio, linux-kernel

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

Since commit a6eaf02b8274 ("iio: adc: ad7124: Switch from of specific to
fwnode based property handling") the function
ad7124_parse_channel_config() has a parameter `dev` that holds
the value `indio_dev->dev.parent`. Make use of that to shorten two code
lines.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
Hello,

this is a patch opportunity I noticed while backporting my original
series to an older kernel to please my customer.
I chose to sneak it into the series in the hope to not offend maintainer
tools :-)

Best regards
Uwe

 drivers/iio/adc/ad7124.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c
index 5ab0d3e48c43..53b274ca42ac 100644
--- a/drivers/iio/adc/ad7124.c
+++ b/drivers/iio/adc/ad7124.c
@@ -1061,12 +1061,12 @@ static int ad7124_parse_channel_config(struct iio_dev *indio_dev,
 	/* Add one for temperature */
 	st->num_channels = min(num_channels + 1, AD7124_MAX_CHANNELS);
 
-	chan = devm_kcalloc(indio_dev->dev.parent, st->num_channels,
+	chan = devm_kcalloc(dev, st->num_channels,
 			    sizeof(*chan), GFP_KERNEL);
 	if (!chan)
 		return -ENOMEM;
 
-	channels = devm_kcalloc(indio_dev->dev.parent, st->num_channels, sizeof(*channels),
+	channels = devm_kcalloc(dev, st->num_channels, sizeof(*channels),
 				GFP_KERNEL);
 	if (!channels)
 		return -ENOMEM;
-- 
2.47.1


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

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

* Re: [PATCH v4 9/8] iio: adc: ad7124: Benefit of dev = indio_dev->dev.parent in ad7124_parse_channel_config()
  2025-03-04  9:41 [PATCH v4 9/8] iio: adc: ad7124: Benefit of dev = indio_dev->dev.parent in ad7124_parse_channel_config() Uwe Kleine-König
@ 2025-03-06  0:10 ` Jonathan Cameron
  2025-03-06  8:31   ` Uwe Kleine-König
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2025-03-06  0:10 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Andy Shevchenko, Cosmin Tanislav, Dumitru Ceclan,
	Guillaume Ranquet, Lars-Peter Clausen, Michael Hennerich,
	Michael Walle, Nuno Sa, linux-iio, linux-kernel

On Tue, 4 Mar 2025 10:41:09 +0100
Uwe Kleine-König <u.kleine-koenig@baylibre.com> wrote:

> Since commit a6eaf02b8274 ("iio: adc: ad7124: Switch from of specific to
> fwnode based property handling") the function
> ad7124_parse_channel_config() has a parameter `dev` that holds
> the value `indio_dev->dev.parent`. Make use of that to shorten two code
> lines.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> Hello,
> 
> this is a patch opportunity I noticed while backporting my original
> series to an older kernel to please my customer.
> I chose to sneak it into the series in the hope to not offend maintainer
> tools :-)
Leads to b4 getting rather confused, but doing the right thing in the end.

Applied.

Thanks,

Jonathan

> 
> Best regards
> Uwe
> 
>  drivers/iio/adc/ad7124.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c
> index 5ab0d3e48c43..53b274ca42ac 100644
> --- a/drivers/iio/adc/ad7124.c
> +++ b/drivers/iio/adc/ad7124.c
> @@ -1061,12 +1061,12 @@ static int ad7124_parse_channel_config(struct iio_dev *indio_dev,
>  	/* Add one for temperature */
>  	st->num_channels = min(num_channels + 1, AD7124_MAX_CHANNELS);
>  
> -	chan = devm_kcalloc(indio_dev->dev.parent, st->num_channels,
> +	chan = devm_kcalloc(dev, st->num_channels,
>  			    sizeof(*chan), GFP_KERNEL);
>  	if (!chan)
>  		return -ENOMEM;
>  
> -	channels = devm_kcalloc(indio_dev->dev.parent, st->num_channels, sizeof(*channels),
> +	channels = devm_kcalloc(dev, st->num_channels, sizeof(*channels),
>  				GFP_KERNEL);
>  	if (!channels)
>  		return -ENOMEM;


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

* Re: [PATCH v4 9/8] iio: adc: ad7124: Benefit of dev = indio_dev->dev.parent in ad7124_parse_channel_config()
  2025-03-06  0:10 ` Jonathan Cameron
@ 2025-03-06  8:31   ` Uwe Kleine-König
  0 siblings, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2025-03-06  8:31 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Andy Shevchenko, Cosmin Tanislav, Dumitru Ceclan,
	Guillaume Ranquet, Lars-Peter Clausen, Michael Hennerich,
	Michael Walle, Nuno Sa, linux-iio, linux-kernel

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

On Thu, Mar 06, 2025 at 12:10:13AM +0000, Jonathan Cameron wrote:
> On Tue, 4 Mar 2025 10:41:09 +0100
> Uwe Kleine-König <u.kleine-koenig@baylibre.com> wrote:
> > this is a patch opportunity I noticed while backporting my original
> > series to an older kernel to please my customer.
> > I chose to sneak it into the series in the hope to not offend maintainer
> > tools :-)
> Leads to b4 getting rather confused, but doing the right thing in the end.

Oh, I failed to pass
`--in-reply-to 20250303114659.1672695-10-u.kleine-koenig@baylibre.com`
to really do what I intended. 🙄

Anyhow, good that it didn't confuse b4 enough to refuse application even
the way I did it.

Thanks
Uwe

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

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

end of thread, other threads:[~2025-03-06  8:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-04  9:41 [PATCH v4 9/8] iio: adc: ad7124: Benefit of dev = indio_dev->dev.parent in ad7124_parse_channel_config() Uwe Kleine-König
2025-03-06  0:10 ` Jonathan Cameron
2025-03-06  8:31   ` Uwe Kleine-König

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®