Linux-IIO Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] iio: max5487: use devres for iio device registration
@ 2019-08-14  9:22 Martin Kaiser
  0 siblings, 0 replies; only message in thread
From: Martin Kaiser @ 2019-08-14  9:22 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Peter Meerwald-Stadler,
	Lars-Peter Clausen
  Cc: linux-iio, linux-kernel, Martin Kaiser

Replace iio_device_register with the devres variant and drop the
explicit function call to unregister the iio device.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/iio/potentiometer/max5487.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/iio/potentiometer/max5487.c b/drivers/iio/potentiometer/max5487.c
index 68ff806d4668..a6c92050d397 100644
--- a/drivers/iio/potentiometer/max5487.c
+++ b/drivers/iio/potentiometer/max5487.c
@@ -110,15 +110,11 @@ static int max5487_spi_probe(struct spi_device *spi)
 	if (ret < 0)
 		return ret;
 
-	return iio_device_register(indio_dev);
+	return devm_iio_device_register(&spi->dev, indio_dev);
 }
 
 static int max5487_spi_remove(struct spi_device *spi)
 {
-	struct iio_dev *indio_dev = dev_get_drvdata(&spi->dev);
-
-	iio_device_unregister(indio_dev);
-
 	/* save both wiper regs to NV regs */
 	return max5487_write_cmd(spi, MAX5487_COPY_AB_TO_NV);
 }
-- 
2.11.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-14  9:22 [PATCH] iio: max5487: use devres for iio device registration Martin Kaiser

Linux-IIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-iio/0 linux-iio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iio linux-iio/ https://lore.kernel.org/linux-iio \
		linux-iio@vger.kernel.org linux-iio@archiver.kernel.org
	public-inbox-index linux-iio


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-iio


AGPL code for this site: git clone https://public-inbox.org/ public-inbox