Commit 877cdf91 authored by Ioana Ciornei's avatar Ioana Ciornei Committed by Greg Kroah-Hartman

staging: iio: resolver: replace iio_device_register by devm_iio_device_register

Use devm_iio_device_register instead of iio_device_register when the remove
function is only used to call iio_device_unregister in order to ease the error path.
Since resource managed functions implicitly call unregister at driver detach also remove
iio_device_unregister
Signed-off-by: default avatarIoana Ciornei <ciorneiioana@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 86727e30
......@@ -79,7 +79,7 @@ static int ad2s90_probe(struct spi_device *spi)
indio_dev->num_channels = 1;
indio_dev->name = spi_get_device_id(spi)->name;
ret = iio_device_register(indio_dev);
ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev);
if (ret)
return ret;
......@@ -91,13 +91,6 @@ static int ad2s90_probe(struct spi_device *spi)
return 0;
}
static int ad2s90_remove(struct spi_device *spi)
{
iio_device_unregister(spi_get_drvdata(spi));
return 0;
}
static const struct spi_device_id ad2s90_id[] = {
{ "ad2s90" },
{}
......@@ -110,7 +103,6 @@ static struct spi_driver ad2s90_driver = {
.owner = THIS_MODULE,
},
.probe = ad2s90_probe,
.remove = ad2s90_remove,
.id_table = ad2s90_id,
};
module_spi_driver(ad2s90_driver);
......
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