linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: iio: ad2s1210: Use device-managed API
@ 2019-07-26 11:07 Chuhong Yuan
  2019-07-26 12:36 ` Ardelean, Alexandru
  0 siblings, 1 reply; 3+ messages in thread
From: Chuhong Yuan @ 2019-07-26 11:07 UTC (permalink / raw)
  Cc: Lars-Peter Clausen, Michael Hennerich, Stefan Popa,
	Jonathan Cameron, Greg Kroah-Hartman, linux-iio, devel,
	linux-kernel, Chuhong Yuan

Use device-managed API to simplify the code.
The remove function is redundant now and can
be deleted.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 drivers/staging/iio/resolver/ad2s1210.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index 0c1bd108c386..4b25a3a314ed 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -671,7 +671,7 @@ static int ad2s1210_probe(struct spi_device *spi)
 	indio_dev->num_channels = ARRAY_SIZE(ad2s1210_channels);
 	indio_dev->name = spi_get_device_id(spi)->name;
 
-	ret = iio_device_register(indio_dev);
+	ret = devm_iio_device_register(&spi->dev, indio_dev);
 	if (ret)
 		return ret;
 
@@ -683,15 +683,6 @@ static int ad2s1210_probe(struct spi_device *spi)
 	return 0;
 }
 
-static int ad2s1210_remove(struct spi_device *spi)
-{
-	struct iio_dev *indio_dev = spi_get_drvdata(spi);
-
-	iio_device_unregister(indio_dev);
-
-	return 0;
-}
-
 static const struct of_device_id ad2s1210_of_match[] = {
 	{ .compatible = "adi,ad2s1210", },
 	{ }
@@ -710,7 +701,6 @@ static struct spi_driver ad2s1210_driver = {
 		.of_match_table = of_match_ptr(ad2s1210_of_match),
 	},
 	.probe = ad2s1210_probe,
-	.remove = ad2s1210_remove,
 	.id_table = ad2s1210_id,
 };
 module_spi_driver(ad2s1210_driver);
-- 
2.20.1


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

* Re: [PATCH] staging: iio: ad2s1210: Use device-managed API
  2019-07-26 11:07 [PATCH] staging: iio: ad2s1210: Use device-managed API Chuhong Yuan
@ 2019-07-26 12:36 ` Ardelean, Alexandru
  2019-07-27 14:01   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Ardelean, Alexandru @ 2019-07-26 12:36 UTC (permalink / raw)
  To: hslester96
  Cc: Popa, Stefan Serban, devel, gregkh, linux-iio, jic23,
	linux-kernel, Hennerich, Michael, lars

On Fri, 2019-07-26 at 19:07 +0800, Chuhong Yuan wrote:
> [External]
> 
> Use device-managed API to simplify the code.
> The remove function is redundant now and can
> be deleted.

Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

> 
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> ---
>  drivers/staging/iio/resolver/ad2s1210.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
> index 0c1bd108c386..4b25a3a314ed 100644
> --- a/drivers/staging/iio/resolver/ad2s1210.c
> +++ b/drivers/staging/iio/resolver/ad2s1210.c
> @@ -671,7 +671,7 @@ static int ad2s1210_probe(struct spi_device *spi)
>  	indio_dev->num_channels = ARRAY_SIZE(ad2s1210_channels);
>  	indio_dev->name = spi_get_device_id(spi)->name;
>  
> -	ret = iio_device_register(indio_dev);
> +	ret = devm_iio_device_register(&spi->dev, indio_dev);
>  	if (ret)
>  		return ret;
>  
> @@ -683,15 +683,6 @@ static int ad2s1210_probe(struct spi_device *spi)
>  	return 0;
>  }
>  
> -static int ad2s1210_remove(struct spi_device *spi)
> -{
> -	struct iio_dev *indio_dev = spi_get_drvdata(spi);
> -
> -	iio_device_unregister(indio_dev);
> -
> -	return 0;
> -}
> -
>  static const struct of_device_id ad2s1210_of_match[] = {
>  	{ .compatible = "adi,ad2s1210", },
>  	{ }
> @@ -710,7 +701,6 @@ static struct spi_driver ad2s1210_driver = {
>  		.of_match_table = of_match_ptr(ad2s1210_of_match),
>  	},
>  	.probe = ad2s1210_probe,
> -	.remove = ad2s1210_remove,
>  	.id_table = ad2s1210_id,
>  };
>  module_spi_driver(ad2s1210_driver);

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

* Re: [PATCH] staging: iio: ad2s1210: Use device-managed API
  2019-07-26 12:36 ` Ardelean, Alexandru
@ 2019-07-27 14:01   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2019-07-27 14:01 UTC (permalink / raw)
  To: Ardelean, Alexandru
  Cc: hslester96, Popa, Stefan Serban, devel, gregkh, linux-iio,
	linux-kernel, Hennerich, Michael, lars

On Fri, 26 Jul 2019 12:36:08 +0000
"Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:

> On Fri, 2019-07-26 at 19:07 +0800, Chuhong Yuan wrote:
> > [External]
> > 
> > Use device-managed API to simplify the code.
> > The remove function is redundant now and can
> > be deleted.  
> 
> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
The end of this probe function is rather odd and probably needs sorting
out as I imagine that needs to happen before the device is exposed to
userspace.

Nothing to do with this patch though which is great.

Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan

> 
> > 
> > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> > ---
> >  drivers/staging/iio/resolver/ad2s1210.c | 12 +-----------
> >  1 file changed, 1 insertion(+), 11 deletions(-)
> > 
> > diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
> > index 0c1bd108c386..4b25a3a314ed 100644
> > --- a/drivers/staging/iio/resolver/ad2s1210.c
> > +++ b/drivers/staging/iio/resolver/ad2s1210.c
> > @@ -671,7 +671,7 @@ static int ad2s1210_probe(struct spi_device *spi)
> >  	indio_dev->num_channels = ARRAY_SIZE(ad2s1210_channels);
> >  	indio_dev->name = spi_get_device_id(spi)->name;
> >  
> > -	ret = iio_device_register(indio_dev);
> > +	ret = devm_iio_device_register(&spi->dev, indio_dev);
> >  	if (ret)
> >  		return ret;
> >  
> > @@ -683,15 +683,6 @@ static int ad2s1210_probe(struct spi_device *spi)
> >  	return 0;
> >  }
> >  
> > -static int ad2s1210_remove(struct spi_device *spi)
> > -{
> > -	struct iio_dev *indio_dev = spi_get_drvdata(spi);
> > -
> > -	iio_device_unregister(indio_dev);
> > -
> > -	return 0;
> > -}
> > -
> >  static const struct of_device_id ad2s1210_of_match[] = {
> >  	{ .compatible = "adi,ad2s1210", },
> >  	{ }
> > @@ -710,7 +701,6 @@ static struct spi_driver ad2s1210_driver = {
> >  		.of_match_table = of_match_ptr(ad2s1210_of_match),
> >  	},
> >  	.probe = ad2s1210_probe,
> > -	.remove = ad2s1210_remove,
> >  	.id_table = ad2s1210_id,
> >  };
> >  module_spi_driver(ad2s1210_driver);  


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

end of thread, other threads:[~2019-07-27 14:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-26 11:07 [PATCH] staging: iio: ad2s1210: Use device-managed API Chuhong Yuan
2019-07-26 12:36 ` Ardelean, Alexandru
2019-07-27 14:01   ` Jonathan Cameron

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).