iio: light: vcnl4000: register an IIO device with a device-managed function

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.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Erikas Bitovtas 2026-04-14 15:37:22 +03:00 committed by Jonathan Cameron
parent de1839edfe
commit de1cbc4b21

View File

@ -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);