From: Ioana Ciornei Date: Fri, 2 Oct 2015 10:37:50 +0000 (+0300) Subject: staging: iio: resolver: replace iio_device_register by devm_iio_device_register X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=877cdf9115122e068245326da519a848d2387221;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/iio/resolver/ad2s90.c b/drivers/staging/iio/resolver/ad2s90.c index e24c5890652f..c57a29616223 100644 --- a/drivers/staging/iio/resolver/ad2s90.c +++ b/drivers/staging/iio/resolver/ad2s90.c @@ -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);