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: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
86727e30d1
commit
877cdf9115
|
@ -79,7 +79,7 @@ static int ad2s90_probe(struct spi_device *spi)
|
||||||
indio_dev->num_channels = 1;
|
indio_dev->num_channels = 1;
|
||||||
indio_dev->name = spi_get_device_id(spi)->name;
|
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)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -91,13 +91,6 @@ static int ad2s90_probe(struct spi_device *spi)
|
||||||
return 0;
|
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[] = {
|
static const struct spi_device_id ad2s90_id[] = {
|
||||||
{ "ad2s90" },
|
{ "ad2s90" },
|
||||||
{}
|
{}
|
||||||
|
@ -110,7 +103,6 @@ static struct spi_driver ad2s90_driver = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
},
|
},
|
||||||
.probe = ad2s90_probe,
|
.probe = ad2s90_probe,
|
||||||
.remove = ad2s90_remove,
|
|
||||||
.id_table = ad2s90_id,
|
.id_table = ad2s90_id,
|
||||||
};
|
};
|
||||||
module_spi_driver(ad2s90_driver);
|
module_spi_driver(ad2s90_driver);
|
||||||
|
|
Loading…
Reference in a new issue