linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 10/13] staging:iio:ad7606: Let common remove function take a struct device *
Date: Wed, 19 Oct 2016 19:07:05 +0200	[thread overview]
Message-ID: <1476896828-10544-11-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1476896828-10544-1-git-send-email-lars@metafoo.de>

Currently the common remove function takes a struct iio_dev *. This
parameter is retrieved by the individual driver remove functions by calling
get_drvdata() on their device. To simplify the code let the common remove
function directly take a struct dev * and do the IIO device in retrieval
the common remove function.

This also aligns the interface with the common probe function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/staging/iio/adc/ad7606.h      | 2 +-
 drivers/staging/iio/adc/ad7606_core.c | 3 ++-
 drivers/staging/iio/adc/ad7606_par.c  | 6 +-----
 drivers/staging/iio/adc/ad7606_spi.c  | 4 +---
 4 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7606.h b/drivers/staging/iio/adc/ad7606.h
index b4b25a2..6dde987 100644
--- a/drivers/staging/iio/adc/ad7606.h
+++ b/drivers/staging/iio/adc/ad7606.h
@@ -81,7 +81,7 @@ struct ad7606_bus_ops {
 int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
 		 const char *name, unsigned int id,
 		 const struct ad7606_bus_ops *bops);
-int ad7606_remove(struct iio_dev *indio_dev, int irq);
+int ad7606_remove(struct device *dev, int irq);
 int ad7606_reset(struct ad7606_state *st);
 int ad7606_read_samples(struct ad7606_state *st);
 
diff --git a/drivers/staging/iio/adc/ad7606_core.c b/drivers/staging/iio/adc/ad7606_core.c
index 1ee7a29..670caa2 100644
--- a/drivers/staging/iio/adc/ad7606_core.c
+++ b/drivers/staging/iio/adc/ad7606_core.c
@@ -535,8 +535,9 @@ error_disable_reg:
 }
 EXPORT_SYMBOL_GPL(ad7606_probe);
 
-int ad7606_remove(struct iio_dev *indio_dev, int irq)
+int ad7606_remove(struct device *dev, int irq)
 {
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct ad7606_state *st = iio_priv(indio_dev);
 
 	iio_device_unregister(indio_dev);
diff --git a/drivers/staging/iio/adc/ad7606_par.c b/drivers/staging/iio/adc/ad7606_par.c
index 42eb9e0..cd6c410c 100644
--- a/drivers/staging/iio/adc/ad7606_par.c
+++ b/drivers/staging/iio/adc/ad7606_par.c
@@ -76,11 +76,7 @@ static int ad7606_par_probe(struct platform_device *pdev)
 
 static int ad7606_par_remove(struct platform_device *pdev)
 {
-	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
-
-	ad7606_remove(indio_dev, platform_get_irq(pdev, 0));
-
-	return 0;
+	return ad7606_remove(&pdev->dev, platform_get_irq(pdev, 0));
 }
 
 static const struct platform_device_id ad7606_driver_ids[] = {
diff --git a/drivers/staging/iio/adc/ad7606_spi.c b/drivers/staging/iio/adc/ad7606_spi.c
index 064c4c2..c9b1f266 100644
--- a/drivers/staging/iio/adc/ad7606_spi.c
+++ b/drivers/staging/iio/adc/ad7606_spi.c
@@ -51,9 +51,7 @@ static int ad7606_spi_probe(struct spi_device *spi)
 
 static int ad7606_spi_remove(struct spi_device *spi)
 {
-	struct iio_dev *indio_dev = dev_get_drvdata(&spi->dev);
-
-	return ad7606_remove(indio_dev, spi->irq);
+	return ad7606_remove(&spi->dev, spi->irq);
 }
 
 static const struct spi_device_id ad7606_id[] = {
-- 
2.1.4

  parent reply	other threads:[~2016-10-19 17:07 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19 17:06 [PATCH 00/13] staging:iio:ad7606: Towards moving out of staging Lars-Peter Clausen
2016-10-19 17:06 ` [PATCH 01/13] staging:iio:ad7606: Remove unused int_vref_mv field Lars-Peter Clausen
2016-10-22 15:22   ` Jonathan Cameron
2016-10-19 17:06 ` [PATCH 02/13] staging:iio:ad7606: Remove redundant name field from ad7606_chip_info Lars-Peter Clausen
2016-10-22 15:23   ` Jonathan Cameron
2016-10-19 17:06 ` [PATCH 03/13] staging:iio:ad7606: Remove default device configuration from platform data Lars-Peter Clausen
2016-10-22 15:24   ` Jonathan Cameron
2016-10-19 17:06 ` [PATCH 04/13] staging:iio:ad7606: Remove out-of-band error reporting Lars-Peter Clausen
2016-10-22 15:27   ` Jonathan Cameron
2016-10-19 17:07 ` [PATCH 05/13] staging:iio:ad7606: Use oversampling ratio of 1 for no oversampling Lars-Peter Clausen
2016-10-22 15:28   ` Jonathan Cameron
2016-10-19 17:07 ` [PATCH 06/13] staging:iio:ad7606: Avoid allocating buffer for each data capture Lars-Peter Clausen
2016-10-22 15:28   ` Jonathan Cameron
2016-10-19 17:07 ` [PATCH 07/13] staging:iio:ad7606: Factor out common code between periodic and one-shot capture Lars-Peter Clausen
2016-10-22 17:01   ` Jonathan Cameron
2016-10-22 17:02   ` Jonathan Cameron
2016-10-22 17:20     ` Lars-Peter Clausen
2016-10-22 17:33       ` Jonathan Cameron
2016-10-19 17:07 ` [PATCH 08/13] staging:iio:ad7606: Move set_drvdata() into common code Lars-Peter Clausen
2016-10-22 16:59   ` Jonathan Cameron
2016-10-19 17:07 ` [PATCH 09/13] staging:iio:ad7606: Let the common probe function return int Lars-Peter Clausen
2016-10-22 17:02   ` Jonathan Cameron
2016-10-19 17:07 ` Lars-Peter Clausen [this message]
2016-10-22 17:09   ` [PATCH 10/13] staging:iio:ad7606: Let common remove function take a struct device * Jonathan Cameron
2016-10-19 17:07 ` [PATCH 11/13] staging:iio:ad7606: Run trigger handler only once per trigger event Lars-Peter Clausen
2016-10-22 17:04   ` Jonathan Cameron
2016-10-19 17:07 ` [PATCH 12/13] staging:iio:ad7606: Use GPIO descriptor API Lars-Peter Clausen
2016-10-22 17:09   ` Jonathan Cameron
2016-10-19 17:07 ` [PATCH 13/13] staging:iio:ad7606: Move buffer code to main source file Lars-Peter Clausen
2016-10-22 17:11   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476896828-10544-11-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.de \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).