Title: [9337] trunk/drivers/staging/iio: merge from upstream: staging: iio: lis3l02dq add _type attributes for all scan elements
Revision
9337
Author
vapier
Date
2010-10-24 16:41:27 -0400 (Sun, 24 Oct 2010)

Log Message

merge from upstream: staging: iio: lis3l02dq add _type attributes for all scan elements

From: Jonathan Cameron <[email protected]>

Also, adds a macro to make defining such attributes simple.

Signed-off-by: Jonathan Cameron <[email protected]>
Signed-off-by: Manuel Stahl <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Modified Paths

Diff

Modified: trunk/drivers/staging/iio/accel/lis3l02dq_ring.c (9336 => 9337)


--- trunk/drivers/staging/iio/accel/lis3l02dq_ring.c	2010-10-24 20:41:21 UTC (rev 9336)
+++ trunk/drivers/staging/iio/accel/lis3l02dq_ring.c	2010-10-24 20:41:27 UTC (rev 9337)
@@ -84,13 +84,17 @@
 static IIO_SCAN_EL_C(accel_z, 2, IIO_SIGNED(16),
 		     LIS3L02DQ_REG_OUT_Z_L_ADDR,
 		     &lis3l02dq_scan_el_set_state);
+static IIO_CONST_ATTR_SCAN_EL_TYPE(accel, s, 12, 16);
 static IIO_SCAN_EL_TIMESTAMP(3);
+static IIO_CONST_ATTR_SCAN_EL_TYPE(timestamp, s, 64, 64);
 
 static struct attribute *lis3l02dq_scan_el_attrs[] = {
 	&iio_scan_el_accel_x.dev_attr.attr,
 	&iio_scan_el_accel_y.dev_attr.attr,
 	&iio_scan_el_accel_z.dev_attr.attr,
+	&iio_const_attr_accel_type.dev_attr.attr,
 	&iio_scan_el_timestamp.dev_attr.attr,
+	&iio_const_attr_timestamp_type.dev_attr.attr,
 	NULL,
 };
 

Modified: trunk/drivers/staging/iio/ring_generic.h (9336 => 9337)


--- trunk/drivers/staging/iio/ring_generic.h	2010-10-24 20:41:21 UTC (rev 9336)
+++ trunk/drivers/staging/iio/ring_generic.h	2010-10-24 20:41:27 UTC (rev 9337)
@@ -247,7 +247,7 @@
 		.bit_count = _bits,					\
 		.label = _label,					\
 		.set_state = _controlfunc,				\
-	}
+	}	  
 
 #define IIO_SCAN_EL_C(_name, _number, _bits, _label, _controlfunc)	\
 	__IIO_SCAN_EL_C(_name, _number, _bits, _label, _controlfunc)
@@ -279,6 +279,15 @@
 				   iio_scan_el_ts_store),	\
 	}
 
+/**
+ * IIO_CONST_ATTR_SCAN_EL_TYPE - attr to specify the data format of a scan el
+ * @name: the scan el name (may be more general and cover a set of scan elements
+ * @_sign: either s or u for signed or unsigned
+ * @_bits: number of actual bits occuplied by the value
+ * @_storagebits: number of bits _bits is padded to when read out of buffer
+ **/
+#define IIO_CONST_ATTR_SCAN_EL_TYPE(_name, _sign, _bits, _storagebits) \
+	IIO_CONST_ATTR(_name##_type, #_sign#_bits"/"#_storagebits);
 /*
  * These are mainly provided to allow for a change of implementation if a device
  * has a large number of scan elements
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to