All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements.
@ 2013-12-11 18:45 Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 01/24] staging:iio:mag:hmc5843 fix incorrect endianness of channel as a result of missuse of the IIO_ST macro Jonathan Cameron
                   ` (24 more replies)
  0 siblings, 25 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

This macro is no longer fit for purpose given it doesn't allow the endianness
of the element to be set. Missuse of the macro has also been responsible for
a couple of bugs including some fixed in this series.

If everyone is happy I'll be apply the fixes through the fixes-togreg branch
and follow up with the others after those have worked their way through.

Please do check the fixes in particular as I'm not entirely sure they are
correct (particularly the ad7887 which gave me a headache on a train last
night at the end of a very long day).

Thanks,

Jonathan

Jonathan Cameron (24):
  staging:iio:mag:hmc5843 fix incorrect endianness of channel as a
    result of missuse of the IIO_ST macro.
  iio:imu:adis16400 fix pressure channel scan type
  iio:adc:ad7887 Fix channel reported endianness from cpu to big endian
  iio:accel:bma180 replaces IIO_ST macro with explicit entries to struct
    scan_type
  iio:mag:mag3110 replaces IIO_ST macro with explicit entries to struct
    scan_type
  iio:dac:ad5064 replaces IIO_ST macro with explicit entries to struct
    scan_type
  iio:dac:ad5360 replaces IIO_ST macro with explicit entries to struct
    scan_type
  iio:dac:ad5380 replaces IIO_ST macro with explicit entries to struct
    scan_type
  iio:dac:ad5421 replaces IIO_ST macro with explicit entries to struct
    scan_type
  iio:dac:ad5446 replaces IIO_ST macro with explicit entries to struct
    scan_type
  iio:dac:ad5449 replaces IIO_ST macro with explicit entries to struct
    scan_type
  iio:dac:ad5504 replaces IIO_ST macro with explicit entries to struct
    scan_type
  iio:dac:ad5624r replaces IIO_ST macro with explicit entries to struct
    scan_type
  iio:dac:ad5686 replaces IIO_ST macro with explicit entries to struct
    scan_type
  iio:dac:ad5755 replaces IIO_ST macro with explicit entries to struct
    scan_type
  iio:dac:ad5764 replaces IIO_ST macro with explicit entries to struct
    scan_type
  iio:dac:ad5791 replaces IIO_ST macro with explicit entries to struct
    scan_type
  iio:dac:max517 drop specification of scan type as unused in this
    driver.
  iio:dac:mcp4725 drop specification of scan type as unused in this
    driver.
  iio:light:adjd_s311 replaces IIO_ST macro with explicit entries to
    struct scan_type
  iio:light:tcs3472 replaces IIO_ST macro with explicit entries to
    struct scan_type
  staging:iio:ad7606 replaces IIO_ST macro with explicit entries to
    struct scan_type
  staging:iio:ad799x replaces IIO_ST macro with explicit entries to
    struct scan_type
  iio:drop IIO_ST macro

 drivers/iio/accel/bma180.c                 |  7 ++++++-
 drivers/iio/adc/ad7887.c                   | 16 ++++++++++++++--
 drivers/iio/dac/ad5064.c                   |  7 ++++++-
 drivers/iio/dac/ad5360.c                   |  7 ++++++-
 drivers/iio/dac/ad5380.c                   |  7 ++++++-
 drivers/iio/dac/ad5421.c                   |  6 +++++-
 drivers/iio/dac/ad5446.c                   |  9 +++++++--
 drivers/iio/dac/ad5449.c                   |  7 ++++++-
 drivers/iio/dac/ad5504.c                   |  6 +++++-
 drivers/iio/dac/ad5624r_spi.c              |  7 ++++++-
 drivers/iio/dac/ad5686.c                   |  9 +++++++--
 drivers/iio/dac/ad5755.c                   |  7 ++++++-
 drivers/iio/dac/ad5764.c                   |  7 ++++++-
 drivers/iio/dac/ad5791.c                   |  9 +++++++--
 drivers/iio/dac/max517.c                   |  1 -
 drivers/iio/dac/mcp4725.c                  |  1 -
 drivers/iio/imu/adis16400_core.c           |  7 ++++++-
 drivers/iio/light/adjd_s311.c              |  7 ++++++-
 drivers/iio/light/tcs3472.c                |  7 ++++++-
 drivers/iio/magnetometer/mag3110.c         |  6 +++++-
 drivers/staging/iio/adc/ad7606_core.c      |  7 ++++++-
 drivers/staging/iio/adc/ad799x_core.c      |  8 +++++++-
 drivers/staging/iio/magnetometer/hmc5843.c |  7 ++++++-
 include/linux/iio/iio.h                    | 16 ++++++++++------
 24 files changed, 145 insertions(+), 33 deletions(-)

-- 
1.8.4.2


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 01/24] staging:iio:mag:hmc5843 fix incorrect endianness of channel as a result of missuse of the IIO_ST macro.
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-17 20:35   ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 02/24] iio:imu:adis16400 fix pressure channel scan type Jonathan Cameron
                   ` (23 subsequent siblings)
  24 siblings, 1 reply; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

This driver sets the shift value equal to IIO_BE (or 1) rather than setting
that to 0 and specificying the endianness.  This means the channel type is
missreported as
[be|le]:u16/16>>1 where the be|le is dependent on the cpu native endianness,
rather than
be:u16/16>>0 resulting in any userspace code using this information, miss
converting the channel and generating thoroughly trashed data.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/staging/iio/magnetometer/hmc5843.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c
index bdb018878296..680eb743df9a 100644
--- a/drivers/staging/iio/magnetometer/hmc5843.c
+++ b/drivers/staging/iio/magnetometer/hmc5843.c
@@ -451,7 +451,12 @@ done:
 		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) |	\
 			BIT(IIO_CHAN_INFO_SAMP_FREQ),			\
 		.scan_index = idx,					\
-		.scan_type = IIO_ST('s', 16, 16, IIO_BE),		\
+		.scan_type = {						\
+			.sign = 's',					\
+			.realbits = 16,				\
+			.storagebits = 16,				\
+			.endianness = IIO_BE,				\
+			},						\
 	}
 
 static const struct iio_chan_spec hmc5843_channels[] = {
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 02/24] iio:imu:adis16400 fix pressure channel scan type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 01/24] staging:iio:mag:hmc5843 fix incorrect endianness of channel as a result of missuse of the IIO_ST macro Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-17 20:38   ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 03/24] iio:adc:ad7887 Fix channel reported endianness from cpu to big endian Jonathan Cameron
                   ` (22 subsequent siblings)
  24 siblings, 1 reply; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

A single channel in this driver was using the IIO_ST macro.
This does not provide a parameter for setting the endianness of
the channel.  Thus this channel will have been reported as whatever
is the native endianness of the cpu rather than big endian. This
means it would be incorrect on little endian platforms.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/imu/adis16400_core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c
index 3fb7757a1028..368660dfe135 100644
--- a/drivers/iio/imu/adis16400_core.c
+++ b/drivers/iio/imu/adis16400_core.c
@@ -651,7 +651,12 @@ static const struct iio_chan_spec adis16448_channels[] = {
 		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
 		.address = ADIS16448_BARO_OUT,
 		.scan_index = ADIS16400_SCAN_BARO,
-		.scan_type = IIO_ST('s', 16, 16, 0),
+		.scan_type = {
+			.sign = 's',
+			.realbits = 16,
+			.storagebits = 16,
+			.endianness = IIO_BE,
+		},
 	},
 	ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12),
 	IIO_CHAN_SOFT_TIMESTAMP(11)
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 03/24] iio:adc:ad7887 Fix channel reported endianness from cpu to big endian
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 01/24] staging:iio:mag:hmc5843 fix incorrect endianness of channel as a result of missuse of the IIO_ST macro Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 02/24] iio:imu:adis16400 fix pressure channel scan type Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-17 20:38   ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 04/24] iio:accel:bma180 replaces IIO_ST macro with explicit entries to struct scan_type Jonathan Cameron
                   ` (21 subsequent siblings)
  24 siblings, 1 reply; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

Note this also sets the endianness to big endian whereas it would
previously have defaulted to the cpu endian.  Hence technically
this is a bug fix on LE platforms.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/adc/ad7887.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c
index acb7f90359a3..3ce0160b6398 100644
--- a/drivers/iio/adc/ad7887.c
+++ b/drivers/iio/adc/ad7887.c
@@ -200,7 +200,13 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = {
 			.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
 			.address = 1,
 			.scan_index = 1,
-			.scan_type = IIO_ST('u', 12, 16, 0),
+			.scan_type = {
+				.sign = 'u',
+				.realbits = 12,
+				.storagebits = 16,
+				.shift = 0,
+				.endianness = IIO_BE,
+				},
 		},
 		.channel[1] = {
 			.type = IIO_VOLTAGE,
@@ -210,7 +216,13 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = {
 			.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
 			.address = 0,
 			.scan_index = 0,
-			.scan_type = IIO_ST('u', 12, 16, 0),
+			.scan_type = {
+				.sign = 'u',
+				.realbits = 12,
+				.storagebits = 16,
+				.shift = 0,
+				.endianness = IIO_BE,
+				},
 		},
 		.channel[2] = IIO_CHAN_SOFT_TIMESTAMP(2),
 		.int_vref_mv = 2500,
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 04/24] iio:accel:bma180 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (2 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 03/24] iio:adc:ad7887 Fix channel reported endianness from cpu to big endian Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 05/24] iio:mag:mag3110 " Jonathan Cameron
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

The IIO_ST macro no longer covers all the elements of struct scan_type
and has this has lead to some bugs being introduced.

The drivers are easier to follow with this structure being directly
filled so that is now preferred.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/accel/bma180.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index 28b39283bccf..9104f436e0eb 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -455,7 +455,12 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
 		BIT(IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY),	\
 	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),		\
 	.scan_index = (_index),						\
-	.scan_type = IIO_ST('s', 14, 16, 2),				\
+	.scan_type = {							\
+		.sign = 's',						\
+		.realbits = 14,					\
+		.storagebits = 16,					\
+		.shift = 2,						\
+		},							\
 	.ext_info = bma180_ext_info,					\
 }
 
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 05/24] iio:mag:mag3110 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (3 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 04/24] iio:accel:bma180 replaces IIO_ST macro with explicit entries to struct scan_type Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 06/24] iio:dac:ad5064 " Jonathan Cameron
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

The IIO_ST macro no longer covers all the elements of struct scan_type
and has this has lead to some bugs being introduced.

The drivers are easier to follow with this structure being directly
filled so that is now preferred.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/magnetometer/mag3110.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c
index becf54496967..4b65b6d3bdb1 100644
--- a/drivers/iio/magnetometer/mag3110.c
+++ b/drivers/iio/magnetometer/mag3110.c
@@ -266,7 +266,11 @@ static const struct iio_chan_spec mag3110_channels[] = {
 		.type = IIO_TEMP,
 		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
 		.scan_index = 3,
-		.scan_type = IIO_ST('s', 8, 8, 0),
+		.scan_type = {
+			.sign = 's',
+			.realbits = 8,
+			.storagebits = 8,
+			},
 	},
 	IIO_CHAN_SOFT_TIMESTAMP(4),
 };
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 06/24] iio:dac:ad5064 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (4 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 05/24] iio:mag:mag3110 " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 07/24] iio:dac:ad5360 " Jonathan Cameron
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/dac/ad5064.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index cb9c6366032c..997b82a5ce61 100644
--- a/drivers/iio/dac/ad5064.c
+++ b/drivers/iio/dac/ad5064.c
@@ -299,7 +299,12 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
 	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |		\
 	BIT(IIO_CHAN_INFO_SCALE),					\
 	.address = addr,					\
-	.scan_type = IIO_ST('u', (bits), 16, 20 - (bits)),	\
+	.scan_type = {						\
+		.sign = 'u',					\
+		.realbits = (bits),				\
+		.storagebits = 16,				\
+		.shift = 20 - bits,				\
+		},						\
 	.ext_info = ad5064_ext_info,				\
 }
 
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 07/24] iio:dac:ad5360 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (5 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 06/24] iio:dac:ad5064 " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 08/24] iio:dac:ad5380 " Jonathan Cameron
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/dac/ad5360.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5360.c b/drivers/iio/dac/ad5360.c
index b968af50db0a..92b92bcdf86d 100644
--- a/drivers/iio/dac/ad5360.c
+++ b/drivers/iio/dac/ad5360.c
@@ -107,7 +107,12 @@ enum ad5360_type {
 		BIT(IIO_CHAN_INFO_OFFSET) |				\
 		BIT(IIO_CHAN_INFO_CALIBSCALE) |			\
 		BIT(IIO_CHAN_INFO_CALIBBIAS),			\
-	.scan_type = IIO_ST('u', (bits), 16, 16 - (bits))	\
+	.scan_type = {						\
+		.sign = 'u',					\
+		.realbits = (bits),				\
+		.storagebits = 16,				\
+		.shift = 16 - (bits),				\
+		},						\
 }
 
 static const struct ad5360_chip_info ad5360_chip_info_tbl[] = {
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 08/24] iio:dac:ad5380 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (6 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 07/24] iio:dac:ad5360 " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 09/24] iio:dac:ad5421 " Jonathan Cameron
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/dac/ad5380.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5380.c b/drivers/iio/dac/ad5380.c
index a59ff0e7b888..90c9bf63d30b 100644
--- a/drivers/iio/dac/ad5380.c
+++ b/drivers/iio/dac/ad5380.c
@@ -261,7 +261,12 @@ static struct iio_chan_spec_ext_info ad5380_ext_info[] = {
 		BIT(IIO_CHAN_INFO_CALIBSCALE) |			\
 		BIT(IIO_CHAN_INFO_CALIBBIAS),			\
 	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),	\
-	.scan_type = IIO_ST('u', (_bits), 16, 14 - (_bits)),	\
+	.scan_type = {						\
+		.sign = 'u',					\
+		.realbits = (_bits),				\
+		.storagebits =  16,				\
+		.shift = 14 - (_bits),				\
+		},						\
 	.ext_info = ad5380_ext_info,				\
 }
 
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 09/24] iio:dac:ad5421 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (7 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 08/24] iio:dac:ad5380 " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 10/24] iio:dac:ad5446 " Jonathan Cameron
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/dac/ad5421.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5421.c b/drivers/iio/dac/ad5421.c
index 1cb15d8e94b7..904c3024c93b 100644
--- a/drivers/iio/dac/ad5421.c
+++ b/drivers/iio/dac/ad5421.c
@@ -114,7 +114,11 @@ static const struct iio_chan_spec ad5421_channels[] = {
 			BIT(IIO_CHAN_INFO_CALIBBIAS),
 		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) |
 			BIT(IIO_CHAN_INFO_OFFSET),
-		.scan_type = IIO_ST('u', 16, 16, 0),
+		.scan_type = {
+			.sign = 'u',
+			.realbits = 16,
+			.storagebits = 16,
+			},
 		.event_spec = ad5421_current_event,
 		.num_event_specs = ARRAY_SIZE(ad5421_current_event),
 	},
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 10/24] iio:dac:ad5446 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (8 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 09/24] iio:dac:ad5421 " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 11/24] iio:dac:ad5449 " Jonathan Cameron
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/dac/ad5446.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c
index 1263b0e5ad84..46bb62a5c1d4 100644
--- a/drivers/iio/dac/ad5446.c
+++ b/drivers/iio/dac/ad5446.c
@@ -139,14 +139,19 @@ static const struct iio_chan_spec_ext_info ad5446_ext_info_powerdown[] = {
 	{ },
 };
 
-#define _AD5446_CHANNEL(bits, storage, shift, ext) { \
+#define _AD5446_CHANNEL(bits, storage, _shift, ext) { \
 	.type = IIO_VOLTAGE, \
 	.indexed = 1, \
 	.output = 1, \
 	.channel = 0, \
 	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
 	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
-	.scan_type = IIO_ST('u', (bits), (storage), (shift)), \
+	.scan_type = { \
+		.sign = 'u', \
+		.realbits = (bits), \
+		.storagebits = (storage), \
+		.shift = (_shift), \
+		}, \
 	.ext_info = (ext), \
 }
 
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 11/24] iio:dac:ad5449 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (9 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 10/24] iio:dac:ad5446 " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 12/24] iio:dac:ad5504 " Jonathan Cameron
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/dac/ad5449.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5449.c b/drivers/iio/dac/ad5449.c
index 82e208f6cde2..49d8c4767309 100644
--- a/drivers/iio/dac/ad5449.c
+++ b/drivers/iio/dac/ad5449.c
@@ -204,7 +204,12 @@ static const struct iio_info ad5449_info = {
 	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |		\
 		BIT(IIO_CHAN_INFO_SCALE),			\
 	.address = (chan),					\
-	.scan_type = IIO_ST('u', (bits), 16, 12 - (bits)),	\
+	.scan_type = {						\
+		.sign = 'u',					\
+		.realbits = (bits),				\
+		.storagebits = 16,				\
+		.shift = 12 - (bits),				\
+		},					\
 }
 
 #define DECLARE_AD5449_CHANNELS(name, bits) \
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 12/24] iio:dac:ad5504 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (10 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 11/24] iio:dac:ad5449 " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 13/24] iio:dac:ad5624r " Jonathan Cameron
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/dac/ad5504.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
index d44c8f5fadee..257eb16b5f73 100644
--- a/drivers/iio/dac/ad5504.c
+++ b/drivers/iio/dac/ad5504.c
@@ -261,7 +261,11 @@ static const struct iio_chan_spec_ext_info ad5504_ext_info[] = {
 	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
 	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
 	.address = AD5504_ADDR_DAC(_chan), \
-	.scan_type = IIO_ST('u', 12, 16, 0), \
+	.scan_type = { \
+		.sign = 'u', \
+		.realbits = 12, \
+		.storagebits = 16, \
+		}, \
 	.ext_info = ad5504_ext_info, \
 }
 
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 13/24] iio:dac:ad5624r replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (11 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 12/24] iio:dac:ad5504 " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 14/24] iio:dac:ad5686 " Jonathan Cameron
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/dac/ad5624r_spi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c
index 774dd968145b..40c7f6dbcb5b 100644
--- a/drivers/iio/dac/ad5624r_spi.c
+++ b/drivers/iio/dac/ad5624r_spi.c
@@ -176,7 +176,12 @@ static const struct iio_chan_spec_ext_info ad5624r_ext_info[] = {
 	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
 	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
 	.address = (_chan), \
-	.scan_type = IIO_ST('u', (_bits), 16, 16 - (_bits)), \
+	.scan_type = { \
+		.sign = 'u', \
+		.realbits = (_bits), \
+		.storagebits = 16, \
+		.shift = 16 - (_bits), \
+		}, \
 	.ext_info = ad5624r_ext_info, \
 }
 
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 14/24] iio:dac:ad5686 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (12 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 13/24] iio:dac:ad5624r " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 15/24] iio:dac:ad5755 " Jonathan Cameron
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/dac/ad5686.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index e56ec0abb509..faf363f45675 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -267,7 +267,7 @@ static const struct iio_chan_spec_ext_info ad5686_ext_info[] = {
 	{ },
 };
 
-#define AD5868_CHANNEL(chan, bits, shift) {			\
+#define AD5868_CHANNEL(chan, bits, _shift) {			\
 		.type = IIO_VOLTAGE,				\
 		.indexed = 1,					\
 		.output = 1,					\
@@ -275,7 +275,12 @@ static const struct iio_chan_spec_ext_info ad5686_ext_info[] = {
 		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),	\
 		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),\
 		.address = AD5686_ADDR_DAC(chan),		\
-		.scan_type = IIO_ST('u', bits, 16, shift),	\
+		.scan_type = {					\
+			.sign = 'u',				\
+			.realbits = (bits),			\
+			.storagebits = 16,			\
+			.shift = (_shift),			\
+			},					\
 		.ext_info = ad5686_ext_info,			\
 }
 
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 15/24] iio:dac:ad5755 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (13 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 14/24] iio:dac:ad5686 " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 16/24] iio:dac:ad5764 " Jonathan Cameron
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/dac/ad5755.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
index c494276da4b0..b9719f19d4cd 100644
--- a/drivers/iio/dac/ad5755.c
+++ b/drivers/iio/dac/ad5755.c
@@ -392,7 +392,12 @@ static const struct iio_chan_spec_ext_info ad5755_ext_info[] = {
 		BIT(IIO_CHAN_INFO_OFFSET) |			\
 		BIT(IIO_CHAN_INFO_CALIBSCALE) |			\
 		BIT(IIO_CHAN_INFO_CALIBBIAS),			\
-	.scan_type = IIO_ST('u', (_bits), 16, 16 - (_bits)),	\
+	.scan_type = {						\
+		.sign = 'u',					\
+		.realbits = (_bits),				\
+		.storagebits = 16,				\
+		.shift = 16 - (_bits),				\
+		},						\
 	.ext_info = ad5755_ext_info,				\
 }
 
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 16/24] iio:dac:ad5764 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (14 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 15/24] iio:dac:ad5755 " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 17/24] iio:dac:ad5791 " Jonathan Cameron
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/dac/ad5764.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5764.c b/drivers/iio/dac/ad5764.c
index a8ff5b2ed13e..efc1472a4116 100644
--- a/drivers/iio/dac/ad5764.c
+++ b/drivers/iio/dac/ad5764.c
@@ -83,7 +83,12 @@ enum ad5764_type {
 		BIT(IIO_CHAN_INFO_CALIBSCALE) |			\
 		BIT(IIO_CHAN_INFO_CALIBBIAS),			\
 	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET),	\
-	.scan_type = IIO_ST('u', (_bits), 16, 16 - (_bits))	\
+	.scan_type = {						\
+		.sign = 'u',					\
+		.realbits = (_bits),				\
+		.storagebits = 16,				\
+		.shift = 16 - (_bits),				\
+		},						\
 }
 
 #define DECLARE_AD5764_CHANNELS(_name, _bits) \
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 17/24] iio:dac:ad5791 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (15 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 16/24] iio:dac:ad5764 " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 18/24] iio:dac:max517 drop specification of scan type as unused in this driver Jonathan Cameron
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/dac/ad5791.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/dac/ad5791.c b/drivers/iio/dac/ad5791.c
index 79bf19945747..d4f64196d000 100644
--- a/drivers/iio/dac/ad5791.c
+++ b/drivers/iio/dac/ad5791.c
@@ -293,7 +293,7 @@ static const struct iio_chan_spec_ext_info ad5791_ext_info[] = {
 	{ },
 };
 
-#define AD5791_CHAN(bits, shift) {			\
+#define AD5791_CHAN(bits, _shift) {			\
 	.type = IIO_VOLTAGE,				\
 	.output = 1,					\
 	.indexed = 1,					\
@@ -302,7 +302,12 @@ static const struct iio_chan_spec_ext_info ad5791_ext_info[] = {
 	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),	\
 	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) |	\
 		BIT(IIO_CHAN_INFO_OFFSET),		\
-	.scan_type = IIO_ST('u', bits, 24, shift),	\
+	.scan_type = {					\
+		.sign = 'u',				\
+		.realbits = (bits),			\
+		.storagebits = 24,			\
+		.shift = (_shift),			\
+		},					\
 	.ext_info = ad5791_ext_info,			\
 }
 
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 18/24] iio:dac:max517 drop specification of scan type as unused in this driver.
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (16 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 17/24] iio:dac:ad5791 " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 19/24] iio:dac:mcp4725 " Jonathan Cameron
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain so the simplest path with
this driver is to not specify the unused scan type.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/dac/max517.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c
index 6e1903537950..de76e6a34c1e 100644
--- a/drivers/iio/dac/max517.c
+++ b/drivers/iio/dac/max517.c
@@ -146,7 +146,6 @@ static const struct iio_info max517_info = {
 	.channel = (chan),				\
 	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |	\
 	BIT(IIO_CHAN_INFO_SCALE),			\
-	.scan_type = IIO_ST('u', 8, 8, 0),		\
 }
 
 static const struct iio_chan_spec max517_channels[] = {
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 19/24] iio:dac:mcp4725 drop specification of scan type as unused in this driver.
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (17 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 18/24] iio:dac:max517 drop specification of scan type as unused in this driver Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 20/24] iio:light:adjd_s311 replaces IIO_ST macro with explicit entries to struct scan_type Jonathan Cameron
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain so the simplest path with
this driver is to not specify the unused scan type.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/dac/mcp4725.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c
index 9f57ae84ab89..7d9f5c31d2fc 100644
--- a/drivers/iio/dac/mcp4725.c
+++ b/drivers/iio/dac/mcp4725.c
@@ -209,7 +209,6 @@ static const struct iio_chan_spec mcp4725_channel = {
 	.channel	= 0,
 	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
 	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
-	.scan_type	= IIO_ST('u', 12, 16, 0),
 	.ext_info	= mcp4725_ext_info,
 };
 
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 20/24] iio:light:adjd_s311 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (18 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 19/24] iio:dac:mcp4725 " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 21/24] iio:light:tcs3472 " Jonathan Cameron
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/light/adjd_s311.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/light/adjd_s311.c b/drivers/iio/light/adjd_s311.c
index 83d15c5baf64..90e676ef2a8a 100644
--- a/drivers/iio/light/adjd_s311.c
+++ b/drivers/iio/light/adjd_s311.c
@@ -155,7 +155,12 @@ done:
 		BIT(IIO_CHAN_INFO_INT_TIME), \
 	.channel2 = (IIO_MOD_LIGHT_##_color), \
 	.scan_index = (_scan_idx), \
-	.scan_type = IIO_ST('u', 10, 16, 0), \
+	.scan_type = { \
+		.sign = 'u', \
+		.realbits = 10, \
+		.storagebits = 16, \
+		.endianness = IIO_CPU, \
+		}, \
 }
 
 static const struct iio_chan_spec adjd_s311_channels[] = {
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 21/24] iio:light:tcs3472 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (19 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 20/24] iio:light:adjd_s311 replaces IIO_ST macro with explicit entries to struct scan_type Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 22/24] staging:iio:ad7606 " Jonathan Cameron
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/light/tcs3472.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/light/tcs3472.c b/drivers/iio/light/tcs3472.c
index 45df2204614a..40d12f7d1056 100644
--- a/drivers/iio/light/tcs3472.c
+++ b/drivers/iio/light/tcs3472.c
@@ -67,7 +67,12 @@ struct tcs3472_data {
 	.channel2 = IIO_MOD_LIGHT_##_color, \
 	.address = _addr, \
 	.scan_index = _si, \
-	.scan_type = IIO_ST('u', 16, 16, 0), \
+	.scan_type = { \
+		.sign = 'u', \
+		.realbits = 16, \
+		.storagebits = 16, \
+		.endianness = IIO_CPU, \
+		}, \
 }
 
 static const int tcs3472_agains[] = { 1, 4, 16, 60 };
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 22/24] staging:iio:ad7606 replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (20 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 21/24] iio:light:tcs3472 " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-11 18:45 ` [PATCH 23/24] staging:iio:ad799x " Jonathan Cameron
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain. Note that this driver
currently ensures all fields are converted to the native endianness
to keep things consistent across the different bus types.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/staging/iio/adc/ad7606_core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/adc/ad7606_core.c b/drivers/staging/iio/adc/ad7606_core.c
index 2083673a79ca..7a83cc5eef4c 100644
--- a/drivers/staging/iio/adc/ad7606_core.c
+++ b/drivers/staging/iio/adc/ad7606_core.c
@@ -239,7 +239,12 @@ static const struct attribute_group ad7606_attribute_group_range = {
 		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),	\
 		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),\
 		.scan_index = num,				\
-		.scan_type = IIO_ST('s', 16, 16, 0),		\
+		.scan_type = {					\
+			.sign = 's',				\
+			.realbits = 16,			\
+			.storagebits = 16,			\
+			.endianness = IIO_CPU,			\
+			},					\
 	}
 
 static const struct iio_chan_spec ad7606_8_channels[] = {
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 23/24] staging:iio:ad799x replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (21 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 22/24] staging:iio:ad7606 " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2013-12-16  8:53   ` Lars-Peter Clausen
  2013-12-11 18:45 ` [PATCH 24/24] iio:drop IIO_ST macro Jonathan Cameron
  2013-12-16  8:55 ` [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Lars-Peter Clausen
  24 siblings, 1 reply; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

IIO_ST is going away as it is a pain to maintain. As an i2c driver, multi byte
words will be read by the driver in the native cpu endianness.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/staging/iio/adc/ad799x_core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c
index 5ea36410f716..45e64d8bf29b 100644
--- a/drivers/staging/iio/adc/ad799x_core.c
+++ b/drivers/staging/iio/adc/ad799x_core.c
@@ -409,7 +409,13 @@ static const struct iio_event_spec ad799x_events[] = {
 	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
 	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
 	.scan_index = (_index), \
-	.scan_type = IIO_ST('u', _realbits, 16, 12 - (_realbits)), \
+	.scan_type = { \
+		.sign = 'u', \
+		.realbits = (_realbits), \
+		.storagebits = 16, \
+		.shift = 12 - (_realbits), \
+		.endianness = IIO_CPU, \
+		}, \
 	.event_spec = _ev_spec, \
 	.num_event_specs = _num_ev_spec, \
 }
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 24/24] iio:drop IIO_ST macro
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (22 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 23/24] staging:iio:ad799x " Jonathan Cameron
@ 2013-12-11 18:45 ` Jonathan Cameron
  2014-02-15 10:58   ` Jonathan Cameron
  2013-12-16  8:55 ` [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Lars-Peter Clausen
  24 siblings, 1 reply; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-11 18:45 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

This macro no longer allows all the elements of the scan_type structure
to be set.  Missinterpretation of the parameters also caused a couple of
recent bugs.  No mainline drivers now use this macro so drop it.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 include/linux/iio/iio.h | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 75a8a20c8179..5f2d00e7e488 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -254,12 +254,16 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
 		(chan->info_mask_shared_by_all & BIT(type));
 }
 
-#define IIO_ST(si, rb, sb, sh)						\
-	{ .sign = si, .realbits = rb, .storagebits = sb, .shift = sh }
-
-#define IIO_CHAN_SOFT_TIMESTAMP(_si)					\
-	{ .type = IIO_TIMESTAMP, .channel = -1,				\
-			.scan_index = _si, .scan_type = IIO_ST('s', 64, 64, 0) }
+#define IIO_CHAN_SOFT_TIMESTAMP(_si) {					\
+	.type = IIO_TIMESTAMP,						\
+	.channel = -1,							\
+	.scan_index = _si,						\
+	.scan_type = {							\
+		.sign = 's',						\
+		.realbits = 64,					\
+		.storagebits = 64,					\
+		},							\
+}
 
 /**
  * iio_get_time_ns() - utility function to get a time stamp for events etc
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* Re: [PATCH 23/24] staging:iio:ad799x replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-11 18:45 ` [PATCH 23/24] staging:iio:ad799x " Jonathan Cameron
@ 2013-12-16  8:53   ` Lars-Peter Clausen
  2013-12-17 20:29     ` Jonathan Cameron
  0 siblings, 1 reply; 33+ messages in thread
From: Lars-Peter Clausen @ 2013-12-16  8:53 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, pmeerw, o.v.kravchenko, stigge

On 12/11/2013 07:45 PM, Jonathan Cameron wrote:
> IIO_ST is going away as it is a pain to maintain. As an i2c driver, multi byte
> words will be read by the driver in the native cpu endianness.

Are you sure about this? As far as I understand it the I2C message will be
read byte by byte. The device sends the MSB first, so I think it should be
IIO_BE.

> 
> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
> ---
>  drivers/staging/iio/adc/ad799x_core.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c
> index 5ea36410f716..45e64d8bf29b 100644
> --- a/drivers/staging/iio/adc/ad799x_core.c
> +++ b/drivers/staging/iio/adc/ad799x_core.c
> @@ -409,7 +409,13 @@ static const struct iio_event_spec ad799x_events[] = {
>  	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
>  	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
>  	.scan_index = (_index), \
> -	.scan_type = IIO_ST('u', _realbits, 16, 12 - (_realbits)), \
> +	.scan_type = { \
> +		.sign = 'u', \
> +		.realbits = (_realbits), \
> +		.storagebits = 16, \
> +		.shift = 12 - (_realbits), \
> +		.endianness = IIO_CPU, \
> +		}, \
>  	.event_spec = _ev_spec, \
>  	.num_event_specs = _num_ev_spec, \
>  }
> 


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements.
  2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
                   ` (23 preceding siblings ...)
  2013-12-11 18:45 ` [PATCH 24/24] iio:drop IIO_ST macro Jonathan Cameron
@ 2013-12-16  8:55 ` Lars-Peter Clausen
  2013-12-17 21:53   ` Jonathan Cameron
  24 siblings, 1 reply; 33+ messages in thread
From: Lars-Peter Clausen @ 2013-12-16  8:55 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, pmeerw, o.v.kravchenko, stigge

On 12/11/2013 07:45 PM, Jonathan Cameron wrote:
> This macro is no longer fit for purpose given it doesn't allow the endianness
> of the element to be set. Missuse of the macro has also been responsible for
> a couple of bugs including some fixed in this series.
> 
> If everyone is happy I'll be apply the fixes through the fixes-togreg branch
> and follow up with the others after those have worked their way through.
> 
> Please do check the fixes in particular as I'm not entirely sure they are
> correct (particularly the ad7887 which gave me a headache on a train last
> night at the end of a very long day).
> 

Looks all good to me, except for the ad799x.

Acked-by: Lars-Peter Clausen <lars@metafoo.de>

One minor nitpick though. I think the proper indention is

	{
		.foo = bar,
	}

instead of

	{
		.foo = bar,
		}
- Lars

> Thanks,
> 
> Jonathan
> 
> Jonathan Cameron (24):
>   staging:iio:mag:hmc5843 fix incorrect endianness of channel as a
>     result of missuse of the IIO_ST macro.
>   iio:imu:adis16400 fix pressure channel scan type
>   iio:adc:ad7887 Fix channel reported endianness from cpu to big endian
>   iio:accel:bma180 replaces IIO_ST macro with explicit entries to struct
>     scan_type
>   iio:mag:mag3110 replaces IIO_ST macro with explicit entries to struct
>     scan_type
>   iio:dac:ad5064 replaces IIO_ST macro with explicit entries to struct
>     scan_type
>   iio:dac:ad5360 replaces IIO_ST macro with explicit entries to struct
>     scan_type
>   iio:dac:ad5380 replaces IIO_ST macro with explicit entries to struct
>     scan_type
>   iio:dac:ad5421 replaces IIO_ST macro with explicit entries to struct
>     scan_type
>   iio:dac:ad5446 replaces IIO_ST macro with explicit entries to struct
>     scan_type
>   iio:dac:ad5449 replaces IIO_ST macro with explicit entries to struct
>     scan_type
>   iio:dac:ad5504 replaces IIO_ST macro with explicit entries to struct
>     scan_type
>   iio:dac:ad5624r replaces IIO_ST macro with explicit entries to struct
>     scan_type
>   iio:dac:ad5686 replaces IIO_ST macro with explicit entries to struct
>     scan_type
>   iio:dac:ad5755 replaces IIO_ST macro with explicit entries to struct
>     scan_type
>   iio:dac:ad5764 replaces IIO_ST macro with explicit entries to struct
>     scan_type
>   iio:dac:ad5791 replaces IIO_ST macro with explicit entries to struct
>     scan_type
>   iio:dac:max517 drop specification of scan type as unused in this
>     driver.
>   iio:dac:mcp4725 drop specification of scan type as unused in this
>     driver.
>   iio:light:adjd_s311 replaces IIO_ST macro with explicit entries to
>     struct scan_type
>   iio:light:tcs3472 replaces IIO_ST macro with explicit entries to
>     struct scan_type
>   staging:iio:ad7606 replaces IIO_ST macro with explicit entries to
>     struct scan_type
>   staging:iio:ad799x replaces IIO_ST macro with explicit entries to
>     struct scan_type
>   iio:drop IIO_ST macro
> 
>  drivers/iio/accel/bma180.c                 |  7 ++++++-
>  drivers/iio/adc/ad7887.c                   | 16 ++++++++++++++--
>  drivers/iio/dac/ad5064.c                   |  7 ++++++-
>  drivers/iio/dac/ad5360.c                   |  7 ++++++-
>  drivers/iio/dac/ad5380.c                   |  7 ++++++-
>  drivers/iio/dac/ad5421.c                   |  6 +++++-
>  drivers/iio/dac/ad5446.c                   |  9 +++++++--
>  drivers/iio/dac/ad5449.c                   |  7 ++++++-
>  drivers/iio/dac/ad5504.c                   |  6 +++++-
>  drivers/iio/dac/ad5624r_spi.c              |  7 ++++++-
>  drivers/iio/dac/ad5686.c                   |  9 +++++++--
>  drivers/iio/dac/ad5755.c                   |  7 ++++++-
>  drivers/iio/dac/ad5764.c                   |  7 ++++++-
>  drivers/iio/dac/ad5791.c                   |  9 +++++++--
>  drivers/iio/dac/max517.c                   |  1 -
>  drivers/iio/dac/mcp4725.c                  |  1 -
>  drivers/iio/imu/adis16400_core.c           |  7 ++++++-
>  drivers/iio/light/adjd_s311.c              |  7 ++++++-
>  drivers/iio/light/tcs3472.c                |  7 ++++++-
>  drivers/iio/magnetometer/mag3110.c         |  6 +++++-
>  drivers/staging/iio/adc/ad7606_core.c      |  7 ++++++-
>  drivers/staging/iio/adc/ad799x_core.c      |  8 +++++++-
>  drivers/staging/iio/magnetometer/hmc5843.c |  7 ++++++-
>  include/linux/iio/iio.h                    | 16 ++++++++++------
>  24 files changed, 145 insertions(+), 33 deletions(-)
> 


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 23/24] staging:iio:ad799x replaces IIO_ST macro with explicit entries to struct scan_type
  2013-12-16  8:53   ` Lars-Peter Clausen
@ 2013-12-17 20:29     ` Jonathan Cameron
  0 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-17 20:29 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: linux-iio, pmeerw, o.v.kravchenko, stigge

On 12/16/13 08:53, Lars-Peter Clausen wrote:
> On 12/11/2013 07:45 PM, Jonathan Cameron wrote:
>> IIO_ST is going away as it is a pain to maintain. As an i2c driver, multi byte
>> words will be read by the driver in the native cpu endianness.
> 
> Are you sure about this? As far as I understand it the I2C message will be
> read byte by byte. The device sends the MSB first, so I think it should be
> IIO_BE.

Gah. I just spent 5 minutes writing an essay on the fact it was an smbus
word read call, only to realise I was looking at the wrong function and
this is done with a block read.  Doh.  You are quite right!  I'll
switch this one to IIO_BE.


> 
>>
>> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
>> ---
>>  drivers/staging/iio/adc/ad799x_core.c | 8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c
>> index 5ea36410f716..45e64d8bf29b 100644
>> --- a/drivers/staging/iio/adc/ad799x_core.c
>> +++ b/drivers/staging/iio/adc/ad799x_core.c
>> @@ -409,7 +409,13 @@ static const struct iio_event_spec ad799x_events[] = {
>>  	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
>>  	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
>>  	.scan_index = (_index), \
>> -	.scan_type = IIO_ST('u', _realbits, 16, 12 - (_realbits)), \
>> +	.scan_type = { \
>> +		.sign = 'u', \
>> +		.realbits = (_realbits), \
>> +		.storagebits = 16, \
>> +		.shift = 12 - (_realbits), \
>> +		.endianness = IIO_CPU, \
>> +		}, \
>>  	.event_spec = _ev_spec, \
>>  	.num_event_specs = _num_ev_spec, \
>>  }
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 01/24] staging:iio:mag:hmc5843 fix incorrect endianness of channel as a result of missuse of the IIO_ST macro.
  2013-12-11 18:45 ` [PATCH 01/24] staging:iio:mag:hmc5843 fix incorrect endianness of channel as a result of missuse of the IIO_ST macro Jonathan Cameron
@ 2013-12-17 20:35   ` Jonathan Cameron
  0 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-17 20:35 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

On 12/11/13 18:45, Jonathan Cameron wrote:
> This driver sets the shift value equal to IIO_BE (or 1) rather than setting
> that to 0 and specificying the endianness.  This means the channel type is
> missreported as
> [be|le]:u16/16>>1 where the be|le is dependent on the cpu native endianness,
> rather than
> be:u16/16>>0 resulting in any userspace code using this information, miss
> converting the channel and generating thoroughly trashed data.
> 
> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Applied with the formatting fixup to the fixes-togreg branch of iio.git.

Tagged for stable.
> ---
>  drivers/staging/iio/magnetometer/hmc5843.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c
> index bdb018878296..680eb743df9a 100644
> --- a/drivers/staging/iio/magnetometer/hmc5843.c
> +++ b/drivers/staging/iio/magnetometer/hmc5843.c
> @@ -451,7 +451,12 @@ done:
>  		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) |	\
>  			BIT(IIO_CHAN_INFO_SAMP_FREQ),			\
>  		.scan_index = idx,					\
> -		.scan_type = IIO_ST('s', 16, 16, IIO_BE),		\
> +		.scan_type = {						\
> +			.sign = 's',					\
> +			.realbits = 16,				\
> +			.storagebits = 16,				\
> +			.endianness = IIO_BE,				\
> +			},						\
>  	}
>  
>  static const struct iio_chan_spec hmc5843_channels[] = {
> 

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 02/24] iio:imu:adis16400 fix pressure channel scan type
  2013-12-11 18:45 ` [PATCH 02/24] iio:imu:adis16400 fix pressure channel scan type Jonathan Cameron
@ 2013-12-17 20:38   ` Jonathan Cameron
  0 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-17 20:38 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

On 12/11/13 18:45, Jonathan Cameron wrote:
> A single channel in this driver was using the IIO_ST macro.
> This does not provide a parameter for setting the endianness of
> the channel.  Thus this channel will have been reported as whatever
> is the native endianness of the cpu rather than big endian. This
> means it would be incorrect on little endian platforms.
> 
> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Applied to the fixes-togreg branch of iio.git
> ---
>  drivers/iio/imu/adis16400_core.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c
> index 3fb7757a1028..368660dfe135 100644
> --- a/drivers/iio/imu/adis16400_core.c
> +++ b/drivers/iio/imu/adis16400_core.c
> @@ -651,7 +651,12 @@ static const struct iio_chan_spec adis16448_channels[] = {
>  		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
>  		.address = ADIS16448_BARO_OUT,
>  		.scan_index = ADIS16400_SCAN_BARO,
> -		.scan_type = IIO_ST('s', 16, 16, 0),
> +		.scan_type = {
> +			.sign = 's',
> +			.realbits = 16,
> +			.storagebits = 16,
> +			.endianness = IIO_BE,
> +		},
>  	},
>  	ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12),
>  	IIO_CHAN_SOFT_TIMESTAMP(11)
> 

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 03/24] iio:adc:ad7887 Fix channel reported endianness from cpu to big endian
  2013-12-11 18:45 ` [PATCH 03/24] iio:adc:ad7887 Fix channel reported endianness from cpu to big endian Jonathan Cameron
@ 2013-12-17 20:38   ` Jonathan Cameron
  0 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-17 20:38 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge, Jonathan Cameron

On 12/11/13 18:45, Jonathan Cameron wrote:
> Note this also sets the endianness to big endian whereas it would
> previously have defaulted to the cpu endian.  Hence technically
> this is a bug fix on LE platforms.
> 
> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Applied to the fixes togreg branch of iio.git with the formatting fix.

> ---
>  drivers/iio/adc/ad7887.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c
> index acb7f90359a3..3ce0160b6398 100644
> --- a/drivers/iio/adc/ad7887.c
> +++ b/drivers/iio/adc/ad7887.c
> @@ -200,7 +200,13 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = {
>  			.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
>  			.address = 1,
>  			.scan_index = 1,
> -			.scan_type = IIO_ST('u', 12, 16, 0),
> +			.scan_type = {
> +				.sign = 'u',
> +				.realbits = 12,
> +				.storagebits = 16,
> +				.shift = 0,
> +				.endianness = IIO_BE,
> +				},
>  		},
>  		.channel[1] = {
>  			.type = IIO_VOLTAGE,
> @@ -210,7 +216,13 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = {
>  			.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
>  			.address = 0,
>  			.scan_index = 0,
> -			.scan_type = IIO_ST('u', 12, 16, 0),
> +			.scan_type = {
> +				.sign = 'u',
> +				.realbits = 12,
> +				.storagebits = 16,
> +				.shift = 0,
> +				.endianness = IIO_BE,
> +				},
>  		},
>  		.channel[2] = IIO_CHAN_SOFT_TIMESTAMP(2),
>  		.int_vref_mv = 2500,
> 

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements.
  2013-12-16  8:55 ` [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Lars-Peter Clausen
@ 2013-12-17 21:53   ` Jonathan Cameron
  0 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2013-12-17 21:53 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: linux-iio, pmeerw, o.v.kravchenko, stigge

On 12/16/13 08:55, Lars-Peter Clausen wrote:
> On 12/11/2013 07:45 PM, Jonathan Cameron wrote:
>> This macro is no longer fit for purpose given it doesn't allow the endianness
>> of the element to be set. Missuse of the macro has also been responsible for
>> a couple of bugs including some fixed in this series.
>>
>> If everyone is happy I'll be apply the fixes through the fixes-togreg branch
>> and follow up with the others after those have worked their way through.
>>
>> Please do check the fixes in particular as I'm not entirely sure they are
>> correct (particularly the ad7887 which gave me a headache on a train last
>> night at the end of a very long day).
>>
> 
> Looks all good to me, except for the ad799x.
> 
> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Thanks.  I've applied 1..3 to fixes-togreg and 4..22 to
the togreg branch of iio.git (pushed out as testing for build tests).

If I'd been more awake I'd have noticed that with the ad799x now being
IIO_BE that one is another fix.  Hence I've applied 23 with a new
blurb to fixes-togreg.

Will apply 24 once all the others in are in one tree!

Indentation fixed up as you pointed out below.

Jonathan
> 
> One minor nitpick though. I think the proper indention is
> 
> 	{
> 		.foo = bar,
> 	}
> 
> instead of
> 
> 	{
> 		.foo = bar,
> 		}
> - Lars
> 
>> Thanks,
>>
>> Jonathan
>>
>> Jonathan Cameron (24):
>>   staging:iio:mag:hmc5843 fix incorrect endianness of channel as a
>>     result of missuse of the IIO_ST macro.
>>   iio:imu:adis16400 fix pressure channel scan type
>>   iio:adc:ad7887 Fix channel reported endianness from cpu to big endian
>>   iio:accel:bma180 replaces IIO_ST macro with explicit entries to struct
>>     scan_type
>>   iio:mag:mag3110 replaces IIO_ST macro with explicit entries to struct
>>     scan_type
>>   iio:dac:ad5064 replaces IIO_ST macro with explicit entries to struct
>>     scan_type
>>   iio:dac:ad5360 replaces IIO_ST macro with explicit entries to struct
>>     scan_type
>>   iio:dac:ad5380 replaces IIO_ST macro with explicit entries to struct
>>     scan_type
>>   iio:dac:ad5421 replaces IIO_ST macro with explicit entries to struct
>>     scan_type
>>   iio:dac:ad5446 replaces IIO_ST macro with explicit entries to struct
>>     scan_type
>>   iio:dac:ad5449 replaces IIO_ST macro with explicit entries to struct
>>     scan_type
>>   iio:dac:ad5504 replaces IIO_ST macro with explicit entries to struct
>>     scan_type
>>   iio:dac:ad5624r replaces IIO_ST macro with explicit entries to struct
>>     scan_type
>>   iio:dac:ad5686 replaces IIO_ST macro with explicit entries to struct
>>     scan_type
>>   iio:dac:ad5755 replaces IIO_ST macro with explicit entries to struct
>>     scan_type
>>   iio:dac:ad5764 replaces IIO_ST macro with explicit entries to struct
>>     scan_type
>>   iio:dac:ad5791 replaces IIO_ST macro with explicit entries to struct
>>     scan_type
>>   iio:dac:max517 drop specification of scan type as unused in this
>>     driver.
>>   iio:dac:mcp4725 drop specification of scan type as unused in this
>>     driver.
>>   iio:light:adjd_s311 replaces IIO_ST macro with explicit entries to
>>     struct scan_type
>>   iio:light:tcs3472 replaces IIO_ST macro with explicit entries to
>>     struct scan_type
>>   staging:iio:ad7606 replaces IIO_ST macro with explicit entries to
>>     struct scan_type
>>   staging:iio:ad799x replaces IIO_ST macro with explicit entries to
>>     struct scan_type
>>   iio:drop IIO_ST macro
>>
>>  drivers/iio/accel/bma180.c                 |  7 ++++++-
>>  drivers/iio/adc/ad7887.c                   | 16 ++++++++++++++--
>>  drivers/iio/dac/ad5064.c                   |  7 ++++++-
>>  drivers/iio/dac/ad5360.c                   |  7 ++++++-
>>  drivers/iio/dac/ad5380.c                   |  7 ++++++-
>>  drivers/iio/dac/ad5421.c                   |  6 +++++-
>>  drivers/iio/dac/ad5446.c                   |  9 +++++++--
>>  drivers/iio/dac/ad5449.c                   |  7 ++++++-
>>  drivers/iio/dac/ad5504.c                   |  6 +++++-
>>  drivers/iio/dac/ad5624r_spi.c              |  7 ++++++-
>>  drivers/iio/dac/ad5686.c                   |  9 +++++++--
>>  drivers/iio/dac/ad5755.c                   |  7 ++++++-
>>  drivers/iio/dac/ad5764.c                   |  7 ++++++-
>>  drivers/iio/dac/ad5791.c                   |  9 +++++++--
>>  drivers/iio/dac/max517.c                   |  1 -
>>  drivers/iio/dac/mcp4725.c                  |  1 -
>>  drivers/iio/imu/adis16400_core.c           |  7 ++++++-
>>  drivers/iio/light/adjd_s311.c              |  7 ++++++-
>>  drivers/iio/light/tcs3472.c                |  7 ++++++-
>>  drivers/iio/magnetometer/mag3110.c         |  6 +++++-
>>  drivers/staging/iio/adc/ad7606_core.c      |  7 ++++++-
>>  drivers/staging/iio/adc/ad799x_core.c      |  8 +++++++-
>>  drivers/staging/iio/magnetometer/hmc5843.c |  7 ++++++-
>>  include/linux/iio/iio.h                    | 16 ++++++++++------
>>  24 files changed, 145 insertions(+), 33 deletions(-)
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 24/24] iio:drop IIO_ST macro
  2013-12-11 18:45 ` [PATCH 24/24] iio:drop IIO_ST macro Jonathan Cameron
@ 2014-02-15 10:58   ` Jonathan Cameron
  0 siblings, 0 replies; 33+ messages in thread
From: Jonathan Cameron @ 2014-02-15 10:58 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, pmeerw, o.v.kravchenko, stigge

On 11/12/13 18:45, Jonathan Cameron wrote:
> This macro no longer allows all the elements of the scan_type structure
> to be set.  Missinterpretation of the parameters also caused a couple of
> recent bugs.  No mainline drivers now use this macro so drop it.
>
> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Finally applied to the togreg branch of iio.git. It's gone at last!

J
> ---
>   include/linux/iio/iio.h | 16 ++++++++++------
>   1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
> index 75a8a20c8179..5f2d00e7e488 100644
> --- a/include/linux/iio/iio.h
> +++ b/include/linux/iio/iio.h
> @@ -254,12 +254,16 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
>   		(chan->info_mask_shared_by_all & BIT(type));
>   }
>
> -#define IIO_ST(si, rb, sb, sh)						\
> -	{ .sign = si, .realbits = rb, .storagebits = sb, .shift = sh }
> -
> -#define IIO_CHAN_SOFT_TIMESTAMP(_si)					\
> -	{ .type = IIO_TIMESTAMP, .channel = -1,				\
> -			.scan_index = _si, .scan_type = IIO_ST('s', 64, 64, 0) }
> +#define IIO_CHAN_SOFT_TIMESTAMP(_si) {					\
> +	.type = IIO_TIMESTAMP,						\
> +	.channel = -1,							\
> +	.scan_index = _si,						\
> +	.scan_type = {							\
> +		.sign = 's',						\
> +		.realbits = 64,					\
> +		.storagebits = 64,					\
> +		},							\
> +}
>
>   /**
>    * iio_get_time_ns() - utility function to get a time stamp for events etc
>


^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2014-02-15 10:58 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-11 18:45 [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Jonathan Cameron
2013-12-11 18:45 ` [PATCH 01/24] staging:iio:mag:hmc5843 fix incorrect endianness of channel as a result of missuse of the IIO_ST macro Jonathan Cameron
2013-12-17 20:35   ` Jonathan Cameron
2013-12-11 18:45 ` [PATCH 02/24] iio:imu:adis16400 fix pressure channel scan type Jonathan Cameron
2013-12-17 20:38   ` Jonathan Cameron
2013-12-11 18:45 ` [PATCH 03/24] iio:adc:ad7887 Fix channel reported endianness from cpu to big endian Jonathan Cameron
2013-12-17 20:38   ` Jonathan Cameron
2013-12-11 18:45 ` [PATCH 04/24] iio:accel:bma180 replaces IIO_ST macro with explicit entries to struct scan_type Jonathan Cameron
2013-12-11 18:45 ` [PATCH 05/24] iio:mag:mag3110 " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 06/24] iio:dac:ad5064 " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 07/24] iio:dac:ad5360 " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 08/24] iio:dac:ad5380 " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 09/24] iio:dac:ad5421 " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 10/24] iio:dac:ad5446 " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 11/24] iio:dac:ad5449 " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 12/24] iio:dac:ad5504 " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 13/24] iio:dac:ad5624r " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 14/24] iio:dac:ad5686 " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 15/24] iio:dac:ad5755 " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 16/24] iio:dac:ad5764 " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 17/24] iio:dac:ad5791 " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 18/24] iio:dac:max517 drop specification of scan type as unused in this driver Jonathan Cameron
2013-12-11 18:45 ` [PATCH 19/24] iio:dac:mcp4725 " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 20/24] iio:light:adjd_s311 replaces IIO_ST macro with explicit entries to struct scan_type Jonathan Cameron
2013-12-11 18:45 ` [PATCH 21/24] iio:light:tcs3472 " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 22/24] staging:iio:ad7606 " Jonathan Cameron
2013-12-11 18:45 ` [PATCH 23/24] staging:iio:ad799x " Jonathan Cameron
2013-12-16  8:53   ` Lars-Peter Clausen
2013-12-17 20:29     ` Jonathan Cameron
2013-12-11 18:45 ` [PATCH 24/24] iio:drop IIO_ST macro Jonathan Cameron
2014-02-15 10:58   ` Jonathan Cameron
2013-12-16  8:55 ` [PATCH 00/24] Drop the IIO_ST macro for setting scan_type elements Lars-Peter Clausen
2013-12-17 21:53   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.