Skip to contentSkip to conversation

staging: iio: ad9951: Use devm_iio_device_register

PATCH Applied Himangi Saraogi 2 participants 2 messages Aug 3, 2014 – Aug 7, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: iio: ad9951: Use devm_iio_device_register

This patch introduces the use of devm_iio_device_register and does away with the unregister in the remove function. The remove function is no longer required and is completely removed.

---
 drivers/staging/iio/frequency/ad9951.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/staging/iio/frequency/ad9951.c +1 -9
index 5e8990a..d465db0 100644
@@ -175,7 +175,7 @@ static int ad9951_probe(struct spi_device *spi)
 	idev->info = &ad9951_info;
 	idev->modes = INDIO_DIRECT_MODE;
 
-	ret = iio_device_register(idev);
+	ret = devm_iio_device_register(&spi->dev, idev);
 	if (ret)
 		return ret;
 	spi->max_speed_hz = 2000000;
@@ -186,20 +186,12 @@ static int ad9951_probe(struct spi_device *spi)
 	return 0;
 }
 
-static int ad9951_remove(struct spi_device *spi)
-{
-	iio_device_unregister(spi_get_drvdata(spi));
-
-	return 0;
-}
-
 static struct spi_driver ad9951_driver = {
 	.driver = {
 		.name = DRV_NAME,
 		.owner = THIS_MODULE,
 	},
 	.probe = ad9951_probe,
-	.remove = ad9951_remove,
 };
 module_spi_driver(ad9951_driver);
 
Signature · 1 line
1.9.1
maintainer Applied
#1 lore raw
Quoted 6 lines · Himangi Saraogi

This patch introduces the use of devm_iio_device_register and does away with the unregister in the remove function. The remove function is no longer required and is completely removed.

Applied to the togreg branch of iio.git

Thanks,

J

Quoted 39 lines
---
 drivers/staging/iio/frequency/ad9951.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/staging/iio/frequency/ad9951.c +1 -9
index 5e8990a..d465db0 100644
@@ -175,7 +175,7 @@ static int ad9951_probe(struct spi_device *spi)
 	idev->info = &ad9951_info;
 	idev->modes = INDIO_DIRECT_MODE;
 
-	ret = iio_device_register(idev);
+	ret = devm_iio_device_register(&spi->dev, idev);
 	if (ret)
 		return ret;
 	spi->max_speed_hz = 2000000;
@@ -186,20 +186,12 @@ static int ad9951_probe(struct spi_device *spi)
 	return 0;
 }
 
-static int ad9951_remove(struct spi_device *spi)
-{
-	iio_device_unregister(spi_get_drvdata(spi));
-
-	return 0;
-}
-
 static struct spi_driver ad9951_driver = {
 	.driver = {
 		.name = DRV_NAME,
 		.owner = THIS_MODULE,
 	},
 	.probe = ad9951_probe,
-	.remove = ad9951_remove,
 };
 module_spi_driver(ad9951_driver);