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. After this there is no need for having a remove
callback, so remote it.
No functional change intended.
Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: David Lechner <dlechner@baylibe.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
v4->v5: Add RB from Andy.
---
drivers/iio/accel/sca3000.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
index cfc3353f7ffd..49abe4ece233 100644
--- a/drivers/iio/accel/sca3000.c
+++ b/drivers/iio/accel/sca3000.c
@@ -1510,18 +1510,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;
-}
-
-static void sca3000_remove(struct spi_device *spi)
-{
- struct iio_dev *indio_dev = spi_get_drvdata(spi);
-
- iio_device_unregister(indio_dev);
+ return devm_iio_device_register(dev, indio_dev);
}
static const struct spi_device_id sca3000_id[] = {
@@ -1538,7 +1527,6 @@ static struct spi_driver sca3000_driver = {
.name = "sca3000",
},
.probe = sca3000_probe,
- .remove = sca3000_remove,
.id_table = sca3000_id,
};
module_spi_driver(sca3000_driver);
--
2.47.3
On Thu, Feb 05, 2026 at 05:12:13AM -0800, Harshit Mogalapalli 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. After this there is no need for having a remove > callback, so remote it. > > No functional change intended. ... > - struct iio_dev *indio_dev = spi_get_drvdata(spi); Do you still need spi_set_drvdata() or analogue in the ->probe()? -- With Best Regards, Andy Shevchenko
Hi Andy, On 05/02/26 21:59, Andy Shevchenko wrote: > On Thu, Feb 05, 2026 at 05:12:13AM -0800, Harshit Mogalapalli 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. After this there is no need for having a remove >> callback, so remote it. >> >> No functional change intended. > > ... > >> - struct iio_dev *indio_dev = spi_get_drvdata(spi); > > Do you still need spi_set_drvdata() or analogue in the ->probe()? > That's a great catch, I don't see spi_get_drvdata() anymore after this series, so yes I think we should get rid of this. Should I fold that into this patch in v6, as spi_get_drvdata() is also removed in this patch ? Thanks, Harshit
On Thu, Feb 5, 2026 at 6:51 PM Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> wrote: > On 05/02/26 21:59, Andy Shevchenko wrote: > > On Thu, Feb 05, 2026 at 05:12:13AM -0800, Harshit Mogalapalli wrote: ... > >> - struct iio_dev *indio_dev = spi_get_drvdata(spi); > > > > Do you still need spi_set_drvdata() or analogue in the ->probe()? > > > > That's a great catch, I don't see spi_get_drvdata() anymore after this > series, so yes I think we should get rid of this. > > Should I fold that into this patch in v6, as spi_get_drvdata() is also > removed in this patch ? Ideally it should be done in this patch, but let's wait for Jonathan. He usually may tweak these small things when applying. -- With Best Regards, Andy Shevchenko
Hi Andy, On 05/02/26 22:26, Andy Shevchenko wrote: > On Thu, Feb 5, 2026 at 6:51 PM Harshit Mogalapalli > <harshit.m.mogalapalli@oracle.com> wrote: >> On 05/02/26 21:59, Andy Shevchenko wrote: >>> On Thu, Feb 05, 2026 at 05:12:13AM -0800, Harshit Mogalapalli wrote: > > ... > >>>> - struct iio_dev *indio_dev = spi_get_drvdata(spi); >>> >>> Do you still need spi_set_drvdata() or analogue in the ->probe()? >>> >> >> That's a great catch, I don't see spi_get_drvdata() anymore after this >> series, so yes I think we should get rid of this. >> >> Should I fold that into this patch in v6, as spi_get_drvdata() is also >> removed in this patch ? > > Ideally it should be done in this patch, but let's wait for Jonathan. > He usually may tweak these small things when applying. > Also, while checking the patch now, I see I copied a wrong tag(RB with missing r in baylibre from [1]) So that's one more thing to fix. Let me know if v6 would be a preferred approach, I can do it. Thanks, Harshit [1] https://lore.kernel.org/all/a5fa2f97-9ba3-4085-bfaf-a255d24a81f0@baylibre.com/
On Thu, Feb 05, 2026 at 10:30:31PM +0530, Harshit Mogalapalli wrote: > On 05/02/26 22:26, Andy Shevchenko wrote: > > On Thu, Feb 5, 2026 at 6:51 PM Harshit Mogalapalli > > <harshit.m.mogalapalli@oracle.com> wrote: > > > On 05/02/26 21:59, Andy Shevchenko wrote: > > > > On Thu, Feb 05, 2026 at 05:12:13AM -0800, Harshit Mogalapalli wrote: ... > > > > > - struct iio_dev *indio_dev = spi_get_drvdata(spi); > > > > > > > > Do you still need spi_set_drvdata() or analogue in the ->probe()? > > > > > > > > > > That's a great catch, I don't see spi_get_drvdata() anymore after this > > > series, so yes I think we should get rid of this. > > > > > > Should I fold that into this patch in v6, as spi_get_drvdata() is also > > > removed in this patch ? > > > > Ideally it should be done in this patch, but let's wait for Jonathan. > > He usually may tweak these small things when applying. > > > > Also, while checking the patch now, I see I copied a wrong tag(RB with > missing r in baylibre from [1]) > > So that's one more thing to fix. Let me know if v6 would be a preferred > approach, I can do it. Let's not hurry, wait for Jonathan to decide. > [1] https://lore.kernel.org/all/a5fa2f97-9ba3-4085-bfaf-a255d24a81f0@baylibre.com/ -- With Best Regards, Andy Shevchenko
On Thu, 5 Feb 2026 19:12:50 +0200 Andy Shevchenko <andriy.shevchenko@intel.com> wrote: > On Thu, Feb 05, 2026 at 10:30:31PM +0530, Harshit Mogalapalli wrote: > > On 05/02/26 22:26, Andy Shevchenko wrote: > > > On Thu, Feb 5, 2026 at 6:51 PM Harshit Mogalapalli > > > <harshit.m.mogalapalli@oracle.com> wrote: > > > > On 05/02/26 21:59, Andy Shevchenko wrote: > > > > > On Thu, Feb 05, 2026 at 05:12:13AM -0800, Harshit Mogalapalli wrote: > > ... > > > > > > > - struct iio_dev *indio_dev = spi_get_drvdata(spi); > > > > > > > > > > Do you still need spi_set_drvdata() or analogue in the ->probe()? > > > > > > > > > > > > > That's a great catch, I don't see spi_get_drvdata() anymore after this > > > > series, so yes I think we should get rid of this. > > > > > > > > Should I fold that into this patch in v6, as spi_get_drvdata() is also > > > > removed in this patch ? > > > > > > Ideally it should be done in this patch, but let's wait for Jonathan. > > > He usually may tweak these small things when applying. I removed it. > > > > > > > Also, while checking the patch now, I see I copied a wrong tag(RB with > > missing r in baylibre from [1]) Fixed that up. > > > > So that's one more thing to fix. Let me know if v6 would be a preferred > > approach, I can do it. > > Let's not hurry, wait for Jonathan to decide. > > > [1] https://lore.kernel.org/all/a5fa2f97-9ba3-4085-bfaf-a255d24a81f0@baylibre.com/ > And applied to the testing branch of iio.git. Note this will be rebased after rc1 is out before I push it out as a branch linux-next picks up. thanks, Jonathan
Hi Jonathan, On 06/02/26 01:28, Jonathan Cameron wrote: > And applied to the testing branch of iio.git. Note this will be > rebased after rc1 is out before I push it out as a branch linux-next picks > up. > Thanks a lot ! Regards, Harshit > thanks, > > Jonathan
© 2016 - 2026 Red Hat, Inc.