From 252fb58ceb42d82931c971b11f5ea1323caa8a35 Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Fri, 2 Oct 2015 13:37:48 +0300 Subject: [PATCH] staging: iio: cdc: use devm_iio_device_register instead iio_device_register Replace iio_device_register with resource managed devm_iio_device_register in order to ease the error path. Also delete de remove function since there is no need after this change. Signed-off-by: Ioana Ciornei Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/cdc/ad7150.c | 12 +----------- drivers/staging/iio/cdc/ad7152.c | 12 +----------- drivers/staging/iio/cdc/ad7746.c | 12 +----------- 3 files changed, 3 insertions(+), 33 deletions(-) diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c index a2b7ae3329c0..ff833949591c 100644 --- a/drivers/staging/iio/cdc/ad7150.c +++ b/drivers/staging/iio/cdc/ad7150.c @@ -636,7 +636,7 @@ static int ad7150_probe(struct i2c_client *client, return ret; } - ret = iio_device_register(indio_dev); + ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev); if (ret) return ret; @@ -646,15 +646,6 @@ static int ad7150_probe(struct i2c_client *client, return 0; } -static int ad7150_remove(struct i2c_client *client) -{ - struct iio_dev *indio_dev = i2c_get_clientdata(client); - - iio_device_unregister(indio_dev); - - return 0; -} - static const struct i2c_device_id ad7150_id[] = { { "ad7150", 0 }, { "ad7151", 0 }, @@ -669,7 +660,6 @@ static struct i2c_driver ad7150_driver = { .name = "ad7150", }, .probe = ad7150_probe, - .remove = ad7150_remove, .id_table = ad7150_id, }; module_i2c_driver(ad7150_driver); diff --git a/drivers/staging/iio/cdc/ad7152.c b/drivers/staging/iio/cdc/ad7152.c index 87110d940e9a..c3d5531f73c2 100644 --- a/drivers/staging/iio/cdc/ad7152.c +++ b/drivers/staging/iio/cdc/ad7152.c @@ -502,7 +502,7 @@ static int ad7152_probe(struct i2c_client *client, indio_dev->num_channels = ARRAY_SIZE(ad7152_channels); indio_dev->modes = INDIO_DIRECT_MODE; - ret = iio_device_register(indio_dev); + ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev); if (ret) return ret; @@ -511,15 +511,6 @@ static int ad7152_probe(struct i2c_client *client, return 0; } -static int ad7152_remove(struct i2c_client *client) -{ - struct iio_dev *indio_dev = i2c_get_clientdata(client); - - iio_device_unregister(indio_dev); - - return 0; -} - static const struct i2c_device_id ad7152_id[] = { { "ad7152", 0 }, { "ad7153", 1 }, @@ -533,7 +524,6 @@ static struct i2c_driver ad7152_driver = { .name = KBUILD_MODNAME, }, .probe = ad7152_probe, - .remove = ad7152_remove, .id_table = ad7152_id, }; module_i2c_driver(ad7152_driver); diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c index 10fa372a4182..999c4fa0499d 100644 --- a/drivers/staging/iio/cdc/ad7746.c +++ b/drivers/staging/iio/cdc/ad7746.c @@ -749,7 +749,7 @@ static int ad7746_probe(struct i2c_client *client, if (ret < 0) return ret; - ret = iio_device_register(indio_dev); + ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev); if (ret) return ret; @@ -758,15 +758,6 @@ static int ad7746_probe(struct i2c_client *client, return 0; } -static int ad7746_remove(struct i2c_client *client) -{ - struct iio_dev *indio_dev = i2c_get_clientdata(client); - - iio_device_unregister(indio_dev); - - return 0; -} - static const struct i2c_device_id ad7746_id[] = { { "ad7745", 7745 }, { "ad7746", 7746 }, @@ -781,7 +772,6 @@ static struct i2c_driver ad7746_driver = { .name = KBUILD_MODNAME, }, .probe = ad7746_probe, - .remove = ad7746_remove, .id_table = ad7746_id, }; module_i2c_driver(ad7746_driver); -- 2.30.2