Linux kernel staging patches
 help / color / mirror / Atom feed
* [PATCH] staging: iio: adc: ad7816: Use spi_set_drvdata() for clarity
@ 2025-08-19 11:39 Salah Triki
  2025-08-19 14:12 ` David Lechner
  0 siblings, 1 reply; 2+ messages in thread
From: Salah Triki @ 2025-08-19 11:39 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Greg Kroah-Hartman,
	linux-iio, linux-staging, linux-kernel
  Cc: salah.triki

Replace the use of `dev_set_drvdata()` with the `spi_set_drvdata()`
helper. This is functionally identical, but improves readability.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/staging/iio/adc/ad7816.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 4774df778de9..599f75103cb0 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -360,7 +360,7 @@ static int ad7816_probe(struct spi_device *spi_dev)
 		return -ENOMEM;
 	chip = iio_priv(indio_dev);
 	/* this is only used for device removal purposes */
-	dev_set_drvdata(&spi_dev->dev, indio_dev);
+	spi_set_drvdata(spi_dev, indio_dev);
 
 	chip->spi_dev = spi_dev;
 	for (i = 0; i <= AD7816_CS_MAX; i++)
-- 
2.43.0


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

* Re: [PATCH] staging: iio: adc: ad7816: Use spi_set_drvdata() for clarity
  2025-08-19 11:39 [PATCH] staging: iio: adc: ad7816: Use spi_set_drvdata() for clarity Salah Triki
@ 2025-08-19 14:12 ` David Lechner
  0 siblings, 0 replies; 2+ messages in thread
From: David Lechner @ 2025-08-19 14:12 UTC (permalink / raw)
  To: Salah Triki, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, Nuno Sá, Andy Shevchenko,
	Greg Kroah-Hartman, linux-iio, linux-staging, linux-kernel

On 8/19/25 6:39 AM, Salah Triki wrote:
> Replace the use of `dev_set_drvdata()` with the `spi_set_drvdata()`
> helper. This is functionally identical, but improves readability.
> 
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
>  drivers/staging/iio/adc/ad7816.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
> index 4774df778de9..599f75103cb0 100644
> --- a/drivers/staging/iio/adc/ad7816.c
> +++ b/drivers/staging/iio/adc/ad7816.c
> @@ -360,7 +360,7 @@ static int ad7816_probe(struct spi_device *spi_dev)
>  		return -ENOMEM;
>  	chip = iio_priv(indio_dev);
>  	/* this is only used for device removal purposes */

This comment is no longer true. The driver does not have a .remove
callback. So we can just remove the comment and the dev_set_drvdata().

> -	dev_set_drvdata(&spi_dev->dev, indio_dev);
> +	spi_set_drvdata(spi_dev, indio_dev);
>  
>  	chip->spi_dev = spi_dev;
>  	for (i = 0; i <= AD7816_CS_MAX; i++)


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

end of thread, other threads:[~2025-08-19 14:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19 11:39 [PATCH] staging: iio: adc: ad7816: Use spi_set_drvdata() for clarity Salah Triki
2025-08-19 14:12 ` David Lechner

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