From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: device-drivers-devel@blackfin.uclinux.org, lars@metafoo.de,
Jonathan Cameron <jic23@kernel.org>
Subject: [PATCH V2] staging:iio:adc:ad7476 unwind use of IIO_CHAN macro.
Date: Wed, 11 Apr 2012 18:41:29 +0100 [thread overview]
Message-ID: <1334166089-29534-1-git-send-email-jic23@kernel.org> (raw)
In-Reply-To: <4F85534B.6000809@metafoo.de>
This macro is being removed to simplify ongoing maintenance
so we need to unwind and remaining users.
V2 has the cleanup Lars-Peter suggested.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
Basically this now makes use of the fact that the shift + bits = 12 in
all cases.
drivers/staging/iio/adc/ad7476_core.c | 45 +++++++++++++++------------------
1 file changed, 21 insertions(+), 24 deletions(-)
diff --git a/drivers/staging/iio/adc/ad7476_core.c b/drivers/staging/iio/adc/ad7476_core.c
index 0c064d1..694b508 100644
--- a/drivers/staging/iio/adc/ad7476_core.c
+++ b/drivers/staging/iio/adc/ad7476_core.c
@@ -66,53 +66,50 @@ static int ad7476_read_raw(struct iio_dev *indio_dev,
return -EINVAL;
}
+#define AD7476_CHAN(bits) \
+ { \
+ .type = IIO_VOLTAGE, \
+ .indexed = 1, \
+ .info_mask = IIO_CHAN_INFO_SCALE_SHARED_BIT, \
+ .scan_type = { \
+ .sign = 'u', \
+ .realbits = bits, \
+ .storagebits = 16, \
+ .shift = 12 - bits, \
+ }, \
+}
+
static const struct ad7476_chip_info ad7476_chip_info_tbl[] = {
[ID_AD7466] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 0, 0,
- IIO_CHAN_INFO_SCALE_SHARED_BIT,
- 0, 0, IIO_ST('u', 12, 16, 0), 0),
+ .channel[0] = AD7476_CHAN(12),
.channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
},
[ID_AD7467] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 0, 0,
- IIO_CHAN_INFO_SCALE_SHARED_BIT,
- 0, 0, IIO_ST('u', 10, 16, 2), 0),
+ .channel[0] = AD7476_CHAN(10),
.channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
},
[ID_AD7468] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1 , 0, NULL, 0, 0,
- IIO_CHAN_INFO_SCALE_SHARED_BIT,
- 0, 0, IIO_ST('u', 8, 16, 4), 0),
+ .channel[0] = AD7476_CHAN(8),
.channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
},
[ID_AD7475] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 0, 0,
- IIO_CHAN_INFO_SCALE_SHARED_BIT,
- 0, 0, IIO_ST('u', 12, 16, 0), 0),
+ .channel[0] = AD7476_CHAN(12),
.channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
},
[ID_AD7476] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 0, 0,
- IIO_CHAN_INFO_SCALE_SHARED_BIT,
- 0, 0, IIO_ST('u', 12, 16, 0), 0),
+ .channel[0] = AD7476_CHAN(12),
.channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
},
[ID_AD7477] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 0, 0,
- IIO_CHAN_INFO_SCALE_SHARED_BIT,
- 0, 0, IIO_ST('u', 10, 16, 2), 0),
+ .channel[0] = AD7476_CHAN(10),
.channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
},
[ID_AD7478] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 0, 0,
- IIO_CHAN_INFO_SCALE_SHARED_BIT,
- 0, 0, IIO_ST('u', 8, 16, 4), 0),
+ .channel[0] = AD7476_CHAN(8),
.channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
},
[ID_AD7495] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 0, 0,
- IIO_CHAN_INFO_SCALE_SHARED_BIT,
- 0, 0, IIO_ST('u', 12, 16, 0), 0),
+ .channel[0] = AD7476_CHAN(12),
.channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
.int_vref_mv = 2500,
},
--
1.7.9.4
next prev parent reply other threads:[~2012-04-11 17:41 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-10 20:21 [PATCH 00/14] IIO: Kill off IIO_CHAN macro Jonathan Cameron
2012-04-10 20:21 ` [PATCH 01/14] staging:iio:accel:adis16201 unwind use of " Jonathan Cameron
2012-04-11 11:39 ` Lars-Peter Clausen
2012-04-10 20:21 ` [PATCH 02/14] staging:iio:accel:adis16203 " Jonathan Cameron
2012-04-11 11:39 ` Lars-Peter Clausen
2012-04-10 20:21 ` [PATCH 03/14] staging:iio:accel:adis16204 " Jonathan Cameron
2012-04-11 11:40 ` Lars-Peter Clausen
2012-04-10 20:21 ` [PATCH 04/14] staging:iio:accel:adis16209 " Jonathan Cameron
2012-04-11 11:42 ` Lars-Peter Clausen
2012-04-10 20:21 ` [PATCH 05/14] staging:iio:accel:adis16240 " Jonathan Cameron
2012-04-11 11:25 ` Lars-Peter Clausen
2012-04-11 17:46 ` [PATCH V2] " Jonathan Cameron
2012-04-13 8:26 ` Lars-Peter Clausen
2012-04-13 8:26 ` Lars-Peter Clausen
2012-04-10 20:21 ` [PATCH 06/14] staging:iio:accel:lis3l02dq " Jonathan Cameron
2012-04-10 20:21 ` [PATCH 07/14] staging:iio:accel:sca3000 " Jonathan Cameron
2012-04-10 20:21 ` [PATCH 08/14] staging:iio:adc:ad7298 " Jonathan Cameron
2012-04-11 11:44 ` Lars-Peter Clausen
2012-04-10 20:21 ` [PATCH 09/14] staging:iio:adc:ad7476 " Jonathan Cameron
2012-04-11 9:47 ` Lars-Peter Clausen
2012-04-11 17:41 ` Jonathan Cameron [this message]
2012-04-13 8:22 ` [PATCH V2] " Lars-Peter Clausen
2012-04-10 20:21 ` [PATCH 10/14] staging:iio:accel:ad7780 " Jonathan Cameron
2012-04-11 11:49 ` Lars-Peter Clausen
2012-04-10 20:21 ` [PATCH 11/14] staging:iio:gyro:adis16260 " Jonathan Cameron
2012-04-11 11:52 ` Lars-Peter Clausen
2012-04-10 20:21 ` [PATCH 12/14] staging:iio:impedance-analyzer:ad5933 " Jonathan Cameron
2012-04-11 11:46 ` Lars-Peter Clausen
2012-04-10 20:21 ` [PATCH 13/14] staging:iio:meter:ade7758 " Jonathan Cameron
2012-04-11 11:47 ` Lars-Peter Clausen
2012-04-10 20:21 ` [PATCH 14/14] staging:iio:core drop the IIO_CHAN macro for ease of maintenance Jonathan Cameron
2012-04-11 11:21 ` [PATCH 00/14] IIO: Kill off IIO_CHAN macro Lars-Peter Clausen
2012-04-11 11:20 ` Jonathan Cameron
2012-04-11 11:55 ` Lars-Peter Clausen
2012-04-11 11:53 ` 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=1334166089-29534-1-git-send-email-jic23@kernel.org \
--to=jic23@kernel.org \
--cc=device-drivers-devel@blackfin.uclinux.org \
--cc=lars@metafoo.de \
--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).