Commit a04b4e50 authored by Alison Schofield's avatar Alison Schofield Committed by Greg Kroah-Hartman

staging: iio: ade7854: use devm_iio_device_register

Replace iio_device_register with the device managed version.
This change is safe because it does not change the order of
any device removal actions. Unregistering the device was the
only removal action. The newly emptied .remove functions are
deleted.
Signed-off-by: default avatarAlison Schofield <amsfield22@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8f27f732
......@@ -227,11 +227,6 @@ static int ade7854_i2c_probe(struct i2c_client *client,
return ade7854_probe(indio_dev, &client->dev);
}
static int ade7854_i2c_remove(struct i2c_client *client)
{
return ade7854_remove(i2c_get_clientdata(client));
}
static const struct i2c_device_id ade7854_id[] = {
{ "ade7854", 0 },
{ "ade7858", 0 },
......@@ -246,7 +241,6 @@ static struct i2c_driver ade7854_i2c_driver = {
.name = "ade7854",
},
.probe = ade7854_i2c_probe,
.remove = ade7854_i2c_remove,
.id_table = ade7854_id,
};
module_i2c_driver(ade7854_i2c_driver);
......
......@@ -296,12 +296,6 @@ static int ade7854_spi_probe(struct spi_device *spi)
return ade7854_probe(indio_dev, &spi->dev);
}
static int ade7854_spi_remove(struct spi_device *spi)
{
ade7854_remove(spi_get_drvdata(spi));
return 0;
}
static const struct spi_device_id ade7854_id[] = {
{ "ade7854", 0 },
{ "ade7858", 0 },
......@@ -316,7 +310,6 @@ static struct spi_driver ade7854_driver = {
.name = "ade7854",
},
.probe = ade7854_spi_probe,
.remove = ade7854_spi_remove,
.id_table = ade7854_id,
};
module_spi_driver(ade7854_driver);
......
......@@ -548,31 +548,15 @@ int ade7854_probe(struct iio_dev *indio_dev, struct device *dev)
indio_dev->info = &ade7854_info;
indio_dev->modes = INDIO_DIRECT_MODE;
ret = iio_device_register(indio_dev);
ret = devm_iio_device_register(dev, indio_dev);
if (ret)
return ret;
/* Get the device into a sane initial state */
ret = ade7854_initial_setup(indio_dev);
if (ret)
goto error_unreg_dev;
return 0;
error_unreg_dev:
iio_device_unregister(indio_dev);
return ret;
return ade7854_initial_setup(indio_dev);
}
EXPORT_SYMBOL(ade7854_probe);
int ade7854_remove(struct iio_dev *indio_dev)
{
iio_device_unregister(indio_dev);
return 0;
}
EXPORT_SYMBOL(ade7854_remove);
MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
MODULE_DESCRIPTION("Analog Devices ADE7854/58/68/78 Polyphase Energy Meter");
MODULE_LICENSE("GPL v2");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment