]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iio: dac ad8801: drop driver remove function
authorDavid Lechner <dlechner@baylibre.com>
Wed, 20 Nov 2024 21:33:30 +0000 (15:33 -0600)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 7 Dec 2024 17:47:57 +0000 (17:47 +0000)
Remove driver remove callback in the ad8801 driver.

By making use of devm_iio_device_register(), we no longer need a driver
remove callback. Also since this was the last user of spi_get_drvdata(),
we can drop the call to spi_set_drvdata().

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241120-iio-regulator-cleanup-round-6-v1-7-d5a5360f7ec3@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/dac/ad8801.c

index bd857754fc112d74c7f0e8fb67cdef934c7dc2bd..8a362fae2ecac109d0c7ac3abeacf946b4d55882 100644 (file)
@@ -136,14 +136,13 @@ static int ad8801_probe(struct spi_device *spi)
                state->vrefl_mv = ret / 1000;
        }
 
-       spi_set_drvdata(spi, indio_dev);
        indio_dev->info = &ad8801_info;
        indio_dev->modes = INDIO_DIRECT_MODE;
        indio_dev->channels = ad8801_channels;
        indio_dev->num_channels = ARRAY_SIZE(ad8801_channels);
        indio_dev->name = id->name;
 
-       ret = iio_device_register(indio_dev);
+       ret = devm_iio_device_register(&spi->dev, indio_dev);
        if (ret)
                return dev_err_probe(&spi->dev, ret,
                                     "Failed to register iio device\n");
@@ -151,13 +150,6 @@ static int ad8801_probe(struct spi_device *spi)
        return 0;
 }
 
-static void ad8801_remove(struct spi_device *spi)
-{
-       struct iio_dev *indio_dev = spi_get_drvdata(spi);
-
-       iio_device_unregister(indio_dev);
-}
-
 static const struct spi_device_id ad8801_ids[] = {
        {"ad8801", ID_AD8801},
        {"ad8803", ID_AD8803},
@@ -170,7 +162,6 @@ static struct spi_driver ad8801_driver = {
                .name   = "ad8801",
        },
        .probe          = ad8801_probe,
-       .remove         = ad8801_remove,
        .id_table       = ad8801_ids,
 };
 module_spi_driver(ad8801_driver);