From: Alexandru Ardelean Date: Mon, 13 Sep 2021 11:53:08 +0000 (+0300) Subject: iio: gyro: adis16080: use devm_iio_device_register() in probe X-Git-Tag: v6.6.17~8913^2~23^2~105 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=da6fd2590940803aae1426a30a64c95da8157cf8;p=platform%2Fkernel%2Flinux-rpi.git iio: gyro: adis16080: use devm_iio_device_register() in probe There is nothing else that needs to be done for this driver. The remove hook calls only the iio_device_unregister() hook. So this driver can use devm_iio_device_register() directly. Signed-off-by: Alexandru Ardelean Link: https://lore.kernel.org/r/20210913115308.301877-1-aardelean@deviqon.com Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/gyro/adis16080.c b/drivers/iio/gyro/adis16080.c index e2f4d94..acef59d 100644 --- a/drivers/iio/gyro/adis16080.c +++ b/drivers/iio/gyro/adis16080.c @@ -195,8 +195,6 @@ static int adis16080_probe(struct spi_device *spi) if (!indio_dev) return -ENOMEM; st = iio_priv(indio_dev); - /* this is only used for removal purposes */ - spi_set_drvdata(spi, indio_dev); mutex_init(&st->lock); @@ -210,13 +208,7 @@ static int adis16080_probe(struct spi_device *spi) indio_dev->info = &adis16080_info; indio_dev->modes = INDIO_DIRECT_MODE; - return iio_device_register(indio_dev); -} - -static int adis16080_remove(struct spi_device *spi) -{ - iio_device_unregister(spi_get_drvdata(spi)); - return 0; + return devm_iio_device_register(&spi->dev, indio_dev); } static const struct spi_device_id adis16080_ids[] = { @@ -231,7 +223,6 @@ static struct spi_driver adis16080_driver = { .name = "adis16080", }, .probe = adis16080_probe, - .remove = adis16080_remove, .id_table = adis16080_ids, }; module_spi_driver(adis16080_driver);