[PATCH 1/3] IIO: Add 4-byte unsigned reads into generic-buffer example

Marek Vasut marex at denx.de
Fri Aug 3 11:28:39 EDT 2012


Add unsigned 32bit-wide reads into the generic-buffer.c

Signed-off-by: Marek Vasut <marex at denx.de>
Cc: Jonathan Cameron <jic23 at kernel.org>
Cc: Juergen Beisert <jbe at pengutronix.de>
Cc: Lars-Peter Clausen <lars at metafoo.de>
Cc: Wolfgang Denk <wd at denx.de>
---
 drivers/staging/iio/Documentation/generic_buffer.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c
index 827e92d..40d0eca 100644
--- a/drivers/staging/iio/Documentation/generic_buffer.c
+++ b/drivers/staging/iio/Documentation/generic_buffer.c
@@ -104,6 +104,16 @@ void process_scan(char *data,
 			print2byte(*(uint16_t *)(data + channels[k].location),
 				   &channels[k]);
 			break;
+		case 4:
+			if (!channels[k].is_signed) {
+				uint32_t val = *(uint32_t *)
+					(data + channels[k].location);
+				printf("%05f ", ((float)val +
+						 channels[k].offset)*
+				       channels[k].scale);
+
+			}
+			break;
 		case 8:
 			if (channels[k].is_signed) {
 				int64_t val = *(int64_t *)
-- 
1.7.10.4




More information about the linux-arm-kernel mailing list