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

From: Erikas Bitovtas

Date: Fri Apr 10 2026 - 12:34:02 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 | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index b08cb6b33d33..c2d3121be687 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -2059,8 +2059,8 @@ static int vcnl4000_probe(struct i2c_client *client)
if (ret)
return ret;

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

pm_runtime_set_autosuspend_delay(dev, VCNL4000_SLEEP_DELAY_MS);
@@ -2082,13 +2082,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 +2121,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