]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iio: light: vcnl4000: register an IIO device with a device-managed function
authorErikas Bitovtas <xerikasxx@gmail.com>
Tue, 14 Apr 2026 12:37:22 +0000 (15:37 +0300)
committerJonathan Cameron <jic23@kernel.org>
Mon, 27 Apr 2026 08:58:21 +0000 (09:58 +0100)
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>
drivers/iio/light/vcnl4000.c

index 3d0287799ba51d4e13abcab201df1765cac734e3..c08927e34b4e1b686a0e3756e4e22e2ccc8d2b28 100644 (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);