From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@cam.ac.uk>
Cc: linux-iio@vger.kernel.org, drivers@analog.com,
Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 6/7] staging:iio:ad7887: Use passed in chan spec in ad7887_read_raw
Date: Mon, 5 Nov 2012 10:56:45 +0100 [thread overview]
Message-ID: <1352109406-7206-6-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1352109406-7206-1-git-send-email-lars@metafoo.de>
Use the passed in chan spec in ad7887_read_raw instead of alawys using the first
chan spec entry from the chip info data. Since all channels have the same shift
and realbits from a functional point of view it does not matter which chan spec
is used, but the patch makes the a bit more clear.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
drivers/staging/iio/adc/ad7887.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/iio/adc/ad7887.c b/drivers/staging/iio/adc/ad7887.c
index 3ac0c30..72cfe19 100644
--- a/drivers/staging/iio/adc/ad7887.c
+++ b/drivers/staging/iio/adc/ad7887.c
@@ -177,8 +177,8 @@ static int ad7887_read_raw(struct iio_dev *indio_dev,
if (ret < 0)
return ret;
- *val = (ret >> st->chip_info->channel[0].scan_type.shift) &
- RES_MASK(st->chip_info->channel[0].scan_type.realbits);
+ *val = ret >> chan->scan_type.shift;
+ *val &= RES_MASK(chan->scan_type.realbits);
return IIO_VAL_INT;
case IIO_CHAN_INFO_SCALE:
if (st->reg) {
@@ -190,7 +190,7 @@ static int ad7887_read_raw(struct iio_dev *indio_dev,
*val = st->chip_info->int_vref_mv;
}
- *val2 = st->chip_info->channel[0].scan_type.realbits;
+ *val2 = chan->scan_type.realbits;
return IIO_VAL_FRACTIONAL_LOG2;
}
--
1.8.0
next prev parent reply other threads:[~2012-11-05 9:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-05 9:56 [PATCH 1/7] staging:iio:ad7887: Preallocate sample buffer Lars-Peter Clausen
2012-11-05 9:56 ` [PATCH 2/7] staging:iio:ad7887: Rework regulator handling Lars-Peter Clausen
2012-11-05 9:56 ` [PATCH 3/7] staging:iio:ad7887: Squash everything into one file Lars-Peter Clausen
2012-11-05 9:56 ` [PATCH 4/7] staging:iio:ad7887: Use proper kernel doc Lars-Peter Clausen
2012-11-05 9:56 ` [PATCH 5/7] staging:iio:ad7887: Allow to use internal ref in two channel mode Lars-Peter Clausen
2012-11-05 9:56 ` Lars-Peter Clausen [this message]
2012-11-05 9:56 ` [PATCH 7/7] staging:iio: Move the ad7887 driver out of staging Lars-Peter Clausen
2012-11-10 10:07 ` [PATCH 1/7] staging:iio:ad7887: Preallocate sample buffer 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=1352109406-7206-6-git-send-email-lars@metafoo.de \
--to=lars@metafoo.de \
--cc=drivers@analog.com \
--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).