From 5666ec9a04acb363cb19fbd8c4b51d14293827f8 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Thu, 7 Oct 2010 14:24:33 +0200 Subject: [PATCH] --- yaml --- r: 220147 b: refs/heads/master c: e968d0950439c757b890f2a9543d9d17acf04be8 h: refs/heads/master i: 220145: 561aea7e040ab68233375bf227a0d7478fdb634f 220143: 6bad25b6a539a10297fa32b2cdb8ffa791fe0e48 v: v3 --- [refs] | 2 +- trunk/drivers/staging/iio/ring_generic.h | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 2cdddf454cf5..5896c607ef4c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3ba2e4939d1d0426466de755a2435d2cbb311f8e +refs/heads/master: e968d0950439c757b890f2a9543d9d17acf04be8 diff --git a/trunk/drivers/staging/iio/ring_generic.h b/trunk/drivers/staging/iio/ring_generic.h index 6975722616fa..8ecb1895cec2 100644 --- a/trunk/drivers/staging/iio/ring_generic.h +++ b/trunk/drivers/staging/iio/ring_generic.h @@ -292,6 +292,23 @@ ssize_t iio_scan_el_ts_show(struct device *dev, struct device_attribute *attr, **/ #define IIO_CONST_ATTR_SCAN_EL_TYPE(_name, _sign, _bits, _storagebits) \ IIO_CONST_ATTR(_name##_type, #_sign#_bits"/"#_storagebits); + +/** + * IIO_CONST_ATTR_SCAN_EL_TYPE_WITH_SHIFT - 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 + * @_shiftbits: number of bits _shiftbits the result must be shifted + **/ +#define IIO_CONST_ATTR_SCAN_EL_TYPE_WITH_SHIFT(_name, _sign, _bits, \ + _storagebits, _shiftbits) \ + IIO_CONST_ATTR(_name##_type, #_sign#_bits"/"#_storagebits \ + ">>"#_shiftbits); + +#define IIO_SCAN_EL_TYPE_SIGNED 's' +#define IIO_SCAN_EL_TYPE_UNSIGNED 'u' + /* * These are mainly provided to allow for a change of implementation if a device * has a large number of scan elements