]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: sca3000: manage device registration with devm helper
authorHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Thu, 5 Feb 2026 13:12:13 +0000 (05:12 -0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 3 Mar 2026 21:20:01 +0000 (21:20 +0000)
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>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/sca3000.c

index 9d6a3101390925e21f3608e12bd01d2e7492d3b2..573831199bbaaf64c78041d2a131af4b68e0eca7 100644 (file)
@@ -1459,7 +1459,6 @@ static int sca3000_probe(struct spi_device *spi)
                return -ENOMEM;
 
        st = iio_priv(indio_dev);
-       spi_set_drvdata(spi, indio_dev);
        st->us = spi;
        mutex_init(&st->lock);
        st->info = spi_get_device_match_data(spi);
@@ -1501,18 +1500,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[] = {
@@ -1529,7 +1517,6 @@ static struct spi_driver sca3000_driver = {
                .name = "sca3000",
        },
        .probe = sca3000_probe,
-       .remove = sca3000_remove,
        .id_table = sca3000_id,
 };
 module_spi_driver(sca3000_driver);