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 <ciorneiioana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Ioana Ciornei 2015-10-02 13:37:48 +03:00 committed by Greg Kroah-Hartman
parent a305cf3162
commit 252fb58ceb
3 changed files with 3 additions and 33 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);