From: Erikas Bitovtas Date: Tue, 14 Apr 2026 12:37:22 +0000 (+0300) Subject: iio: light: vcnl4000: register an IIO device with a device-managed function X-Git-Tag: v7.2-rc1~67^2~5^2~212 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=de1cbc4b213d034d76164ebbfd4172ffbc5f618d;p=thirdparty%2Flinux.git 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 Signed-off-by: Erikas Bitovtas Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index 3d0287799ba51..c08927e34b4e1 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);