linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jonathan Cameron <jic23@cam.ac.uk>,
	devel@driverdev.osuosl.org, linux-iio@vger.kernel.org,
	Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 10/23] staging:iio:adis16400_ring: Pass IIO device directly
Date: Sat, 12 May 2012 15:39:41 +0200	[thread overview]
Message-ID: <1336829994-7857-10-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1336829994-7857-1-git-send-email-lars@metafoo.de>

When calling adis16350_spi_read_all and adis16400_spi_read_burst we pass the
device struct of embedded in the IIO device only to look up the IIO device from
the device struct again right away. This patch changes the code to pass the IIO
device directly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/staging/iio/imu/adis16400_ring.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/iio/imu/adis16400_ring.c b/drivers/staging/iio/imu/adis16400_ring.c
index e43c0e2..809e2c4 100644
--- a/drivers/staging/iio/imu/adis16400_ring.c
+++ b/drivers/staging/iio/imu/adis16400_ring.c
@@ -13,13 +13,12 @@
 
 /**
  * adis16400_spi_read_burst() - read all data registers
- * @dev: device associated with child of actual device (iio_dev or iio_trig)
+ * @indio_dev: the IIO device
  * @rx: somewhere to pass back the value read (min size is 24 bytes)
  **/
-static int adis16400_spi_read_burst(struct device *dev, u8 *rx)
+static int adis16400_spi_read_burst(struct iio_dev *indio_dev, u8 *rx)
 {
 	struct spi_message msg;
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct adis16400_state *st = iio_priv(indio_dev);
 	u32 old_speed_hz = st->us->max_speed_hz;
 	int ret;
@@ -71,9 +70,8 @@ static const u16 read_all_tx_array[] = {
 	cpu_to_be16(ADIS16400_READ_REG(ADIS16400_AUX_ADC)),
 };
 
-static int adis16350_spi_read_all(struct device *dev, u8 *rx)
+static int adis16350_spi_read_all(struct iio_dev *indio_dev, u8 *rx)
 {
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct adis16400_state *st = iio_priv(indio_dev);
 
 	struct spi_message msg;
@@ -132,13 +130,13 @@ static irqreturn_t adis16400_trigger_handler(int irq, void *p)
 
 	if (scan_count) {
 		if (st->variant->flags & ADIS16400_NO_BURST) {
-			ret = adis16350_spi_read_all(&indio_dev->dev, st->rx);
+			ret = adis16350_spi_read_all(indio_dev, st->rx);
 			if (ret < 0)
 				goto err;
 			for (; i < scan_count; i++)
 				data[i]	= *(s16 *)(st->rx + i*2);
 		} else {
-			ret = adis16400_spi_read_burst(&indio_dev->dev, st->rx);
+			ret = adis16400_spi_read_burst(indio_dev, st->rx);
 			if (ret < 0)
 				goto err;
 			for (; i < scan_count; i++) {
-- 
1.7.10

  parent reply	other threads:[~2012-05-12 13:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-12 13:39 [PATCH 01/23] iio: Add dev_to_iio_dev() helper function Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 02/23] iio: Use dev_to_iio_dev() Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 03/23] staging:iio:adis16203_read_ring_data: Pass IIO device directly Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 04/23] staging:iio:adis16204_read_ring_data: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 05/23] staging:iio:adis16209_read_ring_data: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 06/23] staging:iio:adis16240_read_ring_data: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 07/23] staging:iio:__lis3l02dq_write_data_ready_config: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 08/23] staging:iio:adis16260_read_ring_data: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 09/23] staging:iio:ade7758_spi_read_burst: " Lars-Peter Clausen
2012-05-12 13:39 ` Lars-Peter Clausen [this message]
2012-05-12 13:39 ` [PATCH 11/23] staging:iio:adc: Use dev_to_iio_dev() Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 12/23] staging:iio:accel: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 13/23] staging:iio:addac: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 14/23] staging:iio:cdc: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 15/23] staging:iio:dac: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 16/23] staging:iio:frequency: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 17/23] staging:iio:gyro: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 18/23] staging:iio:impedance-analyzer: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 19/23] staging:iio:imu: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 20/23] staging:iio:light: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 21/23] staging:iio:magnetometer: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 22/23] staging:iio:resolver: " Lars-Peter Clausen
2012-05-12 13:39 ` [PATCH 23/23] staging:iio:meter: " Lars-Peter Clausen

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=1336829994-7857-10-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@vger.kernel.org \
    /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).