[PATCH v2 6/6] iio: light: vcnl4000: register an IIO device with a device-managed function

From: Erikas Bitovtas

Date: Sun Apr 05 2026 - 12:12:35 EST


Use a device-managed counterpart of iio_device_register() and remove the
redundant iio_device_unregister() call in driver remove function,
allowing us to remove vcnl4000_remove() function altogether.

Signed-off-by: Erikas Bitovtas <xerikasxx@xxxxxxxxx>
---
drivers/iio/light/vcnl4000.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index 556dc9afa82c..0813639b5ac1 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -2062,11 +2062,7 @@ static int vcnl4000_probe(struct i2c_client *client)
pm_runtime_set_autosuspend_delay(dev, VCNL4000_SLEEP_DELAY_MS);
pm_runtime_use_autosuspend(dev);

- ret = iio_device_register(indio_dev);
- if (ret < 0)
- return ret;
-
- return 0;
+ return devm_iio_device_register(dev, indio_dev);
}

static const struct of_device_id vcnl_4000_of_match[] = {
@@ -2082,13 +2078,6 @@ static const struct of_device_id vcnl_4000_of_match[] = {
};
MODULE_DEVICE_TABLE(of, vcnl_4000_of_match);

-static void vcnl4000_remove(struct i2c_client *client)
-{
- struct iio_dev *indio_dev = i2c_get_clientdata(client);
-
- iio_device_unregister(indio_dev);
-}
-
static int vcnl4000_runtime_suspend(struct device *dev)
{
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -2128,7 +2117,6 @@ static struct i2c_driver vcnl4000_driver = {
},
.probe = vcnl4000_probe,
.id_table = vcnl4000_id,
- .remove = vcnl4000_remove,
};

module_i2c_driver(vcnl4000_driver);

--
2.53.0