diff mbox series

[07/11] iio: dac ad8801: drop driver remove function

Message ID 20241120-iio-regulator-cleanup-round-6-v1-7-d5a5360f7ec3@baylibre.com (mailing list archive)
State Accepted
Headers show
Series iio: use devm_regulator_get_enable_read_voltage round 6 | expand

Commit Message

David Lechner Nov. 20, 2024, 9:33 p.m. UTC
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>
---
 drivers/iio/dac/ad8801.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

Comments

Jonathan Cameron Nov. 23, 2024, 3:52 p.m. UTC | #1
On Wed, 20 Nov 2024 15:33:30 -0600
David Lechner <dlechner@baylibre.com> wrote:

> 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>
Applied.
diff mbox series

Patch

diff --git a/drivers/iio/dac/ad8801.c b/drivers/iio/dac/ad8801.c
index bd857754fc11..8a362fae2eca 100644
--- a/drivers/iio/dac/ad8801.c
+++ b/drivers/iio/dac/ad8801.c
@@ -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);