From 86727e30d1d6485b5f8b4a84790ac659dc002d27 Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Fri, 2 Oct 2015 13:37:49 +0300 Subject: [PATCH] staging: iio: light: 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 the remove function since there is no need after this change. Signed-off-by: Ioana Ciornei Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/light/isl29028.c | 11 +---------- drivers/staging/iio/light/tsl2583.c | 10 +--------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/drivers/staging/iio/light/isl29028.c b/drivers/staging/iio/light/isl29028.c index cd6f2727aa58..32ae1127da33 100644 --- a/drivers/staging/iio/light/isl29028.c +++ b/drivers/staging/iio/light/isl29028.c @@ -513,7 +513,7 @@ static int isl29028_probe(struct i2c_client *client, indio_dev->name = id->name; indio_dev->dev.parent = &client->dev; 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 < 0) { dev_err(chip->dev, "iio registration fails with error %d\n", ret); @@ -522,14 +522,6 @@ static int isl29028_probe(struct i2c_client *client, return 0; } -static int isl29028_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 isl29028_id[] = { {"isl29028", 0}, {} @@ -550,7 +542,6 @@ static struct i2c_driver isl29028_driver = { .of_match_table = isl29028_of_match, }, .probe = isl29028_probe, - .remove = isl29028_remove, .id_table = isl29028_id, }; diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c index b5e1b8b0a6f0..df602038a4bd 100644 --- a/drivers/staging/iio/light/tsl2583.c +++ b/drivers/staging/iio/light/tsl2583.c @@ -862,7 +862,7 @@ static int taos_probe(struct i2c_client *clientp, indio_dev->dev.parent = &clientp->dev; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->name = chip->client->name; - ret = iio_device_register(indio_dev); + ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev); if (ret) { dev_err(&clientp->dev, "iio registration failed\n"); return ret; @@ -917,13 +917,6 @@ static SIMPLE_DEV_PM_OPS(taos_pm_ops, taos_suspend, taos_resume); #define TAOS_PM_OPS NULL #endif -static int taos_remove(struct i2c_client *client) -{ - iio_device_unregister(i2c_get_clientdata(client)); - - return 0; -} - static struct i2c_device_id taos_idtable[] = { { "tsl2580", 0 }, { "tsl2581", 1 }, @@ -940,7 +933,6 @@ static struct i2c_driver taos_driver = { }, .id_table = taos_idtable, .probe = taos_probe, - .remove = taos_remove, }; module_i2c_driver(taos_driver); -- 2.30.2