diff mbox series

[1/3] iio:adc:ad7476: Fix remove handling

Message ID 20210401171759.318140-2-jic23@kernel.org (mailing list archive)
State New, archived
Headers show
Series iio:adc:ad7476: Fix, regulator support and binding doc. | expand

Commit Message

Jonathan Cameron April 1, 2021, 5:17 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

This driver was in an odd half way state between devm based cleanup
and manual cleanup (most of which was missing).
I would guess something went wrong with a rebase or similar.
Anyhow, this basially finishes the job as a precusor to improving
the regulator handling.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fixes: 4bb2b8f94ace3 ("iio: adc: ad7476: implement devm_add_action_or_reset")
Cc: Michael Hennerich <michael.hennerich@analog.com>
---
 drivers/iio/adc/ad7476.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

Comments

Alexandru Ardelean April 2, 2021, 7:34 a.m. UTC | #1
On Thu, Apr 1, 2021 at 8:47 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> This driver was in an odd half way state between devm based cleanup
> and manual cleanup (most of which was missing).
> I would guess something went wrong with a rebase or similar.
> Anyhow, this basially finishes the job as a precusor to improving

2 typos in this commit description

> the regulator handling.
>

I was pretty surprised about this patch [before reading through it].
Anyhow:

Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>

> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Fixes: 4bb2b8f94ace3 ("iio: adc: ad7476: implement devm_add_action_or_reset")
> Cc: Michael Hennerich <michael.hennerich@analog.com>
> ---
>  drivers/iio/adc/ad7476.c | 18 ++++--------------
>  1 file changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
> index 17402714b387..9e9ff07cf972 100644
> --- a/drivers/iio/adc/ad7476.c
> +++ b/drivers/iio/adc/ad7476.c
> @@ -321,25 +321,15 @@ static int ad7476_probe(struct spi_device *spi)
>         spi_message_init(&st->msg);
>         spi_message_add_tail(&st->xfer, &st->msg);
>
> -       ret = iio_triggered_buffer_setup(indio_dev, NULL,
> -                       &ad7476_trigger_handler, NULL);
> +       ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev, NULL,
> +                                             &ad7476_trigger_handler, NULL);
>         if (ret)
> -               goto error_disable_reg;
> +               return ret;
>
>         if (st->chip_info->reset)
>                 st->chip_info->reset(st);
>
> -       ret = iio_device_register(indio_dev);
> -       if (ret)
> -               goto error_ring_unregister;
> -       return 0;
> -
> -error_ring_unregister:
> -       iio_triggered_buffer_cleanup(indio_dev);
> -error_disable_reg:
> -       regulator_disable(st->reg);
> -
> -       return ret;
> +       return devm_iio_device_register(&spi->dev, indio_dev);
>  }
>
>  static const struct spi_device_id ad7476_id[] = {
> --
> 2.31.1
>
Jonathan Cameron April 5, 2021, 3:01 p.m. UTC | #2
On Fri, 2 Apr 2021 10:34:42 +0300
Alexandru Ardelean <ardeleanalex@gmail.com> wrote:

> On Thu, Apr 1, 2021 at 8:47 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > This driver was in an odd half way state between devm based cleanup
> > and manual cleanup (most of which was missing).
> > I would guess something went wrong with a rebase or similar.
> > Anyhow, this basially finishes the job as a precusor to improving  
> 
> 2 typos in this commit description

One day I'll learn how to type /spell or at least to remember to use
a spell checker on commit descriptions.
> 
> > the regulator handling.
> >  
> 
> I was pretty surprised about this patch [before reading through it].
Yup. This one definitely got a wtf followed by a groan that it had snuck
through.  Has that look of a rebase going horribly wrong to me and
I missed it completely in the original reviews :(


> Anyhow:
> 
> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Thanks,

Applied to the togreg branch of iio.git and marked for stable.
Bit late in cycle to do another fixes pull request so this one
can wait for the merge window.

> 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Fixes: 4bb2b8f94ace3 ("iio: adc: ad7476: implement devm_add_action_or_reset")
> > Cc: Michael Hennerich <michael.hennerich@analog.com>
> > ---
> >  drivers/iio/adc/ad7476.c | 18 ++++--------------
> >  1 file changed, 4 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
> > index 17402714b387..9e9ff07cf972 100644
> > --- a/drivers/iio/adc/ad7476.c
> > +++ b/drivers/iio/adc/ad7476.c
> > @@ -321,25 +321,15 @@ static int ad7476_probe(struct spi_device *spi)
> >         spi_message_init(&st->msg);
> >         spi_message_add_tail(&st->xfer, &st->msg);
> >
> > -       ret = iio_triggered_buffer_setup(indio_dev, NULL,
> > -                       &ad7476_trigger_handler, NULL);
> > +       ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev, NULL,
> > +                                             &ad7476_trigger_handler, NULL);
> >         if (ret)
> > -               goto error_disable_reg;
> > +               return ret;
> >
> >         if (st->chip_info->reset)
> >                 st->chip_info->reset(st);
> >
> > -       ret = iio_device_register(indio_dev);
> > -       if (ret)
> > -               goto error_ring_unregister;
> > -       return 0;
> > -
> > -error_ring_unregister:
> > -       iio_triggered_buffer_cleanup(indio_dev);
> > -error_disable_reg:
> > -       regulator_disable(st->reg);
> > -
> > -       return ret;
> > +       return devm_iio_device_register(&spi->dev, indio_dev);
> >  }
> >
> >  static const struct spi_device_id ad7476_id[] = {
> > --
> > 2.31.1
> >
diff mbox series

Patch

diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
index 17402714b387..9e9ff07cf972 100644
--- a/drivers/iio/adc/ad7476.c
+++ b/drivers/iio/adc/ad7476.c
@@ -321,25 +321,15 @@  static int ad7476_probe(struct spi_device *spi)
 	spi_message_init(&st->msg);
 	spi_message_add_tail(&st->xfer, &st->msg);
 
-	ret = iio_triggered_buffer_setup(indio_dev, NULL,
-			&ad7476_trigger_handler, NULL);
+	ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev, NULL,
+					      &ad7476_trigger_handler, NULL);
 	if (ret)
-		goto error_disable_reg;
+		return ret;
 
 	if (st->chip_info->reset)
 		st->chip_info->reset(st);
 
-	ret = iio_device_register(indio_dev);
-	if (ret)
-		goto error_ring_unregister;
-	return 0;
-
-error_ring_unregister:
-	iio_triggered_buffer_cleanup(indio_dev);
-error_disable_reg:
-	regulator_disable(st->reg);
-
-	return ret;
+	return devm_iio_device_register(&spi->dev, indio_dev);
 }
 
 static const struct spi_device_id ad7476_id[] = {