提交 86727e30 编写于 作者: I Ioana Ciornei 提交者: Greg Kroah-Hartman

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: NIoana Ciornei <ciorneiioana@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 252fb58c
...@@ -513,7 +513,7 @@ static int isl29028_probe(struct i2c_client *client, ...@@ -513,7 +513,7 @@ static int isl29028_probe(struct i2c_client *client,
indio_dev->name = id->name; indio_dev->name = id->name;
indio_dev->dev.parent = &client->dev; indio_dev->dev.parent = &client->dev;
indio_dev->modes = INDIO_DIRECT_MODE; 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) { if (ret < 0) {
dev_err(chip->dev, "iio registration fails with error %d\n", dev_err(chip->dev, "iio registration fails with error %d\n",
ret); ret);
...@@ -522,14 +522,6 @@ static int isl29028_probe(struct i2c_client *client, ...@@ -522,14 +522,6 @@ static int isl29028_probe(struct i2c_client *client,
return 0; 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[] = { static const struct i2c_device_id isl29028_id[] = {
{"isl29028", 0}, {"isl29028", 0},
{} {}
...@@ -550,7 +542,6 @@ static struct i2c_driver isl29028_driver = { ...@@ -550,7 +542,6 @@ static struct i2c_driver isl29028_driver = {
.of_match_table = isl29028_of_match, .of_match_table = isl29028_of_match,
}, },
.probe = isl29028_probe, .probe = isl29028_probe,
.remove = isl29028_remove,
.id_table = isl29028_id, .id_table = isl29028_id,
}; };
......
...@@ -862,7 +862,7 @@ static int taos_probe(struct i2c_client *clientp, ...@@ -862,7 +862,7 @@ static int taos_probe(struct i2c_client *clientp,
indio_dev->dev.parent = &clientp->dev; indio_dev->dev.parent = &clientp->dev;
indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->name = chip->client->name; 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) { if (ret) {
dev_err(&clientp->dev, "iio registration failed\n"); dev_err(&clientp->dev, "iio registration failed\n");
return ret; return ret;
...@@ -917,13 +917,6 @@ static SIMPLE_DEV_PM_OPS(taos_pm_ops, taos_suspend, taos_resume); ...@@ -917,13 +917,6 @@ static SIMPLE_DEV_PM_OPS(taos_pm_ops, taos_suspend, taos_resume);
#define TAOS_PM_OPS NULL #define TAOS_PM_OPS NULL
#endif #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[] = { static struct i2c_device_id taos_idtable[] = {
{ "tsl2580", 0 }, { "tsl2580", 0 },
{ "tsl2581", 1 }, { "tsl2581", 1 },
...@@ -940,7 +933,6 @@ static struct i2c_driver taos_driver = { ...@@ -940,7 +933,6 @@ static struct i2c_driver taos_driver = {
}, },
.id_table = taos_idtable, .id_table = taos_idtable,
.probe = taos_probe, .probe = taos_probe,
.remove = taos_remove,
}; };
module_i2c_driver(taos_driver); module_i2c_driver(taos_driver);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册