[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260131163218.2a4b93e5@jic23-huawei>
Date: Sat, 31 Jan 2026 16:32:18 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
Cc: David Lechner <dlechner@...libre.com>, Nuno Sá
<nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>, Andrew Ijano
<andrew.ijano@...il.com>, linux-iio@...r.kernel.org (open list:IIO
SUBSYSTEM AND DRIVERS), linux-kernel@...r.kernel.org (open list),
kernel-janitors@...r.kernel.org, Andy Shevchenko
<andriy.shevchenko@...el.com>
Subject: Re: [PATCH next 3/4] iio: sca3000: manage device registration with
devm helper
On Fri, 30 Jan 2026 13:43:10 -0800
Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com> wrote:
> Convert the iio registration to use devm_* helpers so the probe no
> longer needs a separate cleanup path and remove callback can also drop
> the unregister.
>
> No functional change intended.
>
> Suggested-by: Andy Shevchenko <andriy.shevchenko@...el.com>
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
This results in the order of two bits of tear down being reversed.
It might be your intent but if so you need a clear description of
why it is fine to do this and why it is not a functional change.
Jonathan
> ---
> drivers/iio/accel/sca3000.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
> index 0210c716cf38..bf1957c7bc77 100644
> --- a/drivers/iio/accel/sca3000.c
> +++ b/drivers/iio/accel/sca3000.c
> @@ -1489,11 +1489,7 @@ static int sca3000_probe(struct spi_device *spi)
> if (ret)
> return ret;
>
> - ret = iio_device_register(indio_dev);
> - if (ret)
> - return ret;
> -
> - return 0;
> + return devm_iio_device_register(dev, indio_dev);
> }
>
> static int sca3000_stop_all_interrupts(struct sca3000_state *st)
> @@ -1519,8 +1515,6 @@ static void sca3000_remove(struct spi_device *spi)
> struct iio_dev *indio_dev = spi_get_drvdata(spi);
> struct sca3000_state *st = iio_priv(indio_dev);
>
> - iio_device_unregister(indio_dev);
> -
> /* Must ensure no interrupts can be generated after this! */
> sca3000_stop_all_interrupts(st);
This changes the ordering. Now we stop interrupts before removing the
userspace interfaces. You probably need to reorder this and the next
patch so there is no intermediate broken point.
> }
Powered by blists - more mailing lists