diff options
author | Mugilraj Dhavachelvan <dmugil2000@gmail.com> | 2021-03-14 23:27:09 +0530 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-03-25 19:13:52 +0000 |
commit | 2662e81745fc00cafcbbb532018013607cae84e0 (patch) | |
tree | 902b929773195b6c002a5d0e493d595eba76af84 | |
parent | 85ece364065eb068439ca3fe4f11d096575d3074 (diff) | |
download | linux-2662e81745fc00cafcbbb532018013607cae84e0.tar.bz2 |
iio:dac:max517.c: Use devm_iio_device_register()
Use devm_iio_device_register() to avoid remove function and
drop explicit call to iio_device_unregister().
Signed-off-by: Mugilraj Dhavachelvan <dmugil2000@gmail.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20210314175709.34301-1-dmugil2000@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r-- | drivers/iio/dac/max517.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c index daa60386bf0c..a6ef555153f4 100644 --- a/drivers/iio/dac/max517.c +++ b/drivers/iio/dac/max517.c @@ -153,7 +153,6 @@ static int max517_probe(struct i2c_client *client, if (!indio_dev) return -ENOMEM; data = iio_priv(indio_dev); - i2c_set_clientdata(client, indio_dev); data->client = client; switch (id->driver_data) { @@ -186,13 +185,7 @@ static int max517_probe(struct i2c_client *client, data->vref_mv[chan] = platform_data->vref_mv[chan]; } - return iio_device_register(indio_dev); -} - -static int max517_remove(struct i2c_client *client) -{ - iio_device_unregister(i2c_get_clientdata(client)); - return 0; + return devm_iio_device_register(&client->dev, indio_dev); } static const struct i2c_device_id max517_id[] = { @@ -211,7 +204,6 @@ static struct i2c_driver max517_driver = { .pm = &max517_pm_ops, }, .probe = max517_probe, - .remove = max517_remove, .id_table = max517_id, }; module_i2c_driver(max517_driver); |