[PATCH v2 2/3] iio: adc: twl6030-gpadc: switch to devm_iio_device_register()
From: Wanhui Fu
Date: Sun Nov 22 2026 - 22:55:05 EST
Convert iio_device_register() to devm_iio_device_register().
This allows dropping the now-empty twl6030_gpadc_remove() and
the unused platform_set_drvdata() call.
Signed-off-by: Wanhui Fu <fuwh1120@xxxxxxx>
---
drivers/iio/adc/twl6030-gpadc.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c
index 786059cf7513..591c7b3322c7 100644
--- a/drivers/iio/adc/twl6030-gpadc.c
+++ b/drivers/iio/adc/twl6030-gpadc.c
@@ -904,7 +904,6 @@ static int twl6030_gpadc_probe(struct platform_device *pdev)
gpadc->dev = dev;
gpadc->pdata = pdata;
- platform_set_drvdata(pdev, indio_dev);
mutex_init(&gpadc->lock);
init_completion(&gpadc->irq_complete);
@@ -967,14 +966,7 @@ static int twl6030_gpadc_probe(struct platform_device *pdev)
indio_dev->channels = pdata->iio_channels;
indio_dev->num_channels = pdata->nchannels;
- return iio_device_register(indio_dev);
-}
-
-static void twl6030_gpadc_remove(struct platform_device *pdev)
-{
- struct iio_dev *indio_dev = platform_get_drvdata(pdev);
-
- iio_device_unregister(indio_dev);
+ return devm_iio_device_register(dev, indio_dev);
}
static int twl6030_gpadc_suspend(struct device *pdev)
@@ -1006,7 +998,6 @@ static DEFINE_SIMPLE_DEV_PM_OPS(twl6030_gpadc_pm_ops, twl6030_gpadc_suspend,
static struct platform_driver twl6030_gpadc_driver = {
.probe = twl6030_gpadc_probe,
- .remove = twl6030_gpadc_remove,
.driver = {
.name = DRIVER_NAME,
.pm = pm_sleep_ptr(&twl6030_gpadc_pm_ops),
--
2.25.1