staging: iio: Fix scan_element naming issue

The addition of a number to the scan_element names caused
an issue in drivers that used either #define or an enum
to provide the number. Before this fix names like
ADIS16350_ACCEL_X_accel_x_en occur rather than 5_accel_x_en.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Jonathan Cameron 2010-07-11 16:39:15 +01:00 committed by Greg Kroah-Hartman
parent 2662051e08
commit 69584bd6d2
7 changed files with 59 additions and 66 deletions

View File

@ -126,16 +126,15 @@ struct adis16209_state {
int adis16209_set_irq(struct device *dev, bool enable); int adis16209_set_irq(struct device *dev, bool enable);
#ifdef CONFIG_IIO_RING_BUFFER #ifdef CONFIG_IIO_RING_BUFFER
enum adis16209_scan {
ADIS16209_SCAN_SUPPLY, #define ADIS16209_SCAN_SUPPLY 0
ADIS16209_SCAN_ACC_X, #define ADIS16209_SCAN_ACC_X 1
ADIS16209_SCAN_ACC_Y, #define ADIS16209_SCAN_ACC_Y 2
ADIS16209_SCAN_AUX_ADC, #define ADIS16209_SCAN_AUX_ADC 3
ADIS16209_SCAN_TEMP, #define ADIS16209_SCAN_TEMP 4
ADIS16209_SCAN_INCLI_X, #define ADIS16209_SCAN_INCLI_X 5
ADIS16209_SCAN_INCLI_Y, #define ADIS16209_SCAN_INCLI_Y 6
ADIS16209_SCAN_ROT, #define ADIS16209_SCAN_ROT 7
};
void adis16209_remove_trigger(struct iio_dev *indio_dev); void adis16209_remove_trigger(struct iio_dev *indio_dev);
int adis16209_probe_trigger(struct iio_dev *indio_dev); int adis16209_probe_trigger(struct iio_dev *indio_dev);

View File

@ -153,14 +153,12 @@ int adis16240_set_irq(struct device *dev, bool enable);
* filling. This may change! * filling. This may change!
*/ */
enum adis16240_scan { #define ADIS16240_SCAN_SUPPLY 0
ADIS16240_SCAN_SUPPLY, #define ADIS16240_SCAN_ACC_X 1
ADIS16240_SCAN_ACC_X, #define ADIS16240_SCAN_ACC_Y 2
ADIS16240_SCAN_ACC_Y, #define ADIS16240_SCAN_ACC_Z 3
ADIS16240_SCAN_ACC_Z, #define ADIS16240_SCAN_AUX_ADC 4
ADIS16240_SCAN_AUX_ADC, #define ADIS16240_SCAN_TEMP 5
ADIS16240_SCAN_TEMP,
};
void adis16240_remove_trigger(struct iio_dev *indio_dev); void adis16240_remove_trigger(struct iio_dev *indio_dev);
int adis16240_probe_trigger(struct iio_dev *indio_dev); int adis16240_probe_trigger(struct iio_dev *indio_dev);

View File

@ -111,13 +111,11 @@ int adis16260_set_irq(struct device *dev, bool enable);
* filling. This may change! * filling. This may change!
*/ */
enum adis16260_scan { #define ADIS16260_SCAN_SUPPLY 0
ADIS16260_SCAN_SUPPLY, #define ADIS16260_SCAN_GYRO 1
ADIS16260_SCAN_GYRO, #define ADIS16260_SCAN_AUX_ADC 2
ADIS16260_SCAN_AUX_ADC, #define ADIS16260_SCAN_TEMP 3
ADIS16260_SCAN_TEMP, #define ADIS16260_SCAN_ANGL 4
ADIS16260_SCAN_ANGL,
};
void adis16260_remove_trigger(struct iio_dev *indio_dev); void adis16260_remove_trigger(struct iio_dev *indio_dev);
int adis16260_probe_trigger(struct iio_dev *indio_dev); int adis16260_probe_trigger(struct iio_dev *indio_dev);

View File

@ -120,17 +120,15 @@ int adis16300_set_irq(struct device *dev, bool enable);
* filling. This may change! * filling. This may change!
*/ */
enum adis16300_scan { #define ADIS16300_SCAN_SUPPLY 0
ADIS16300_SCAN_SUPPLY, #define ADIS16300_SCAN_GYRO_X 1
ADIS16300_SCAN_GYRO_X, #define ADIS16300_SCAN_ACC_X 2
ADIS16300_SCAN_ACC_X, #define ADIS16300_SCAN_ACC_Y 3
ADIS16300_SCAN_ACC_Y, #define ADIS16300_SCAN_ACC_Z 4
ADIS16300_SCAN_ACC_Z, #define ADIS16300_SCAN_TEMP 5
ADIS16300_SCAN_TEMP, #define ADIS16300_SCAN_ADC_0 6
ADIS16300_SCAN_ADC_0, #define ADIS16300_SCAN_INCLI_X 7
ADIS16300_SCAN_INCLI_X, #define ADIS16300_SCAN_INCLI_Y 8
ADIS16300_SCAN_INCLI_Y,
};
void adis16300_remove_trigger(struct iio_dev *indio_dev); void adis16300_remove_trigger(struct iio_dev *indio_dev);
int adis16300_probe_trigger(struct iio_dev *indio_dev); int adis16300_probe_trigger(struct iio_dev *indio_dev);

View File

@ -123,19 +123,17 @@ int adis16350_set_irq(struct device *dev, bool enable);
#ifdef CONFIG_IIO_RING_BUFFER #ifdef CONFIG_IIO_RING_BUFFER
enum adis16350_scan { #define ADIS16350_SCAN_SUPPLY 0
ADIS16350_SCAN_SUPPLY, #define ADIS16350_SCAN_GYRO_X 1
ADIS16350_SCAN_GYRO_X, #define ADIS16350_SCAN_GYRO_Y 2
ADIS16350_SCAN_GYRO_Y, #define ADIS16350_SCAN_GYRO_Z 3
ADIS16350_SCAN_GYRO_Z, #define ADIS16350_SCAN_ACC_X 4
ADIS16350_SCAN_ACC_X, #define ADIS16350_SCAN_ACC_Y 5
ADIS16350_SCAN_ACC_Y, #define ADIS16350_SCAN_ACC_Z 6
ADIS16350_SCAN_ACC_Z, #define ADIS16350_SCAN_TEMP_X 7
ADIS16350_SCAN_TEMP_X, #define ADIS16350_SCAN_TEMP_Y 8
ADIS16350_SCAN_TEMP_Y, #define ADIS16350_SCAN_TEMP_Z 9
ADIS16350_SCAN_TEMP_Z, #define ADIS16350_SCAN_ADC_0 10
ADIS16350_SCAN_ADC_0
};
void adis16350_remove_trigger(struct iio_dev *indio_dev); void adis16350_remove_trigger(struct iio_dev *indio_dev);
int adis16350_probe_trigger(struct iio_dev *indio_dev); int adis16350_probe_trigger(struct iio_dev *indio_dev);

View File

@ -152,20 +152,18 @@ int adis16400_set_irq(struct device *dev, bool enable);
* filling. This may change! * filling. This may change!
*/ */
enum adis16400_scan { #define ADIS16400_SCAN_SUPPLY 0
ADIS16400_SCAN_SUPPLY, #define ADIS16400_SCAN_GYRO_X 1
ADIS16400_SCAN_GYRO_X, #define ADIS16400_SCAN_GYRO_Y 2
ADIS16400_SCAN_GYRO_Y, #define ADIS16400_SCAN_GYRO_Z 3
ADIS16400_SCAN_GYRO_Z, #define ADIS16400_SCAN_ACC_X 4
ADIS16400_SCAN_ACC_X, #define ADIS16400_SCAN_ACC_Y 5
ADIS16400_SCAN_ACC_Y, #define ADIS16400_SCAN_ACC_Z 6
ADIS16400_SCAN_ACC_Z, #define ADIS16400_SCAN_MAGN_X 7
ADIS16400_SCAN_MAGN_X, #define ADIS16400_SCAN_MAGN_Y 8
ADIS16400_SCAN_MAGN_Y, #define ADIS16400_SCAN_MAGN_Z 9
ADIS16400_SCAN_MAGN_Z, #define ADIS16400_SCAN_TEMP 10
ADIS16400_SCAN_TEMP, #define ADIS16400_SCAN_ADC_0 11
ADIS16400_SCAN_ADC_0
};
void adis16400_remove_trigger(struct iio_dev *indio_dev); void adis16400_remove_trigger(struct iio_dev *indio_dev);
int adis16400_probe_trigger(struct iio_dev *indio_dev); int adis16400_probe_trigger(struct iio_dev *indio_dev);

View File

@ -215,7 +215,7 @@ ssize_t iio_scan_el_ts_show(struct device *dev, struct device_attribute *attr,
* @_label: indentification variable used by drivers. Often a reg address. * @_label: indentification variable used by drivers. Often a reg address.
* @_controlfunc: function used to notify hardware of whether state changes * @_controlfunc: function used to notify hardware of whether state changes
**/ **/
#define IIO_SCAN_EL_C(_name, _number, _bits, _label, _controlfunc) \ #define __IIO_SCAN_EL_C(_name, _number, _bits, _label, _controlfunc) \
struct iio_scan_el iio_scan_el_##_name = { \ struct iio_scan_el iio_scan_el_##_name = { \
.dev_attr = __ATTR(_number##_##_name##_en, \ .dev_attr = __ATTR(_number##_##_name##_en, \
S_IRUGO | S_IWUSR, \ S_IRUGO | S_IWUSR, \
@ -227,7 +227,10 @@ ssize_t iio_scan_el_ts_show(struct device *dev, struct device_attribute *attr,
.set_state = _controlfunc, \ .set_state = _controlfunc, \
} }
#define IIO_SCAN_NAMED_EL_C(_name, _string, _number, _bits, _label, _cf) \ #define IIO_SCAN_EL_C(_name, _number, _bits, _label, _controlfunc) \
__IIO_SCAN_EL_C(_name, _number, _bits, _label, _controlfunc)
#define __IIO_SCAN_NAMED_EL_C(_name, _string, _number, _bits, _label, _cf) \
struct iio_scan_el iio_scan_el_##_name = { \ struct iio_scan_el iio_scan_el_##_name = { \
.dev_attr = __ATTR(_number##_##_string##_en, \ .dev_attr = __ATTR(_number##_##_string##_en, \
S_IRUGO | S_IWUSR, \ S_IRUGO | S_IWUSR, \
@ -238,7 +241,8 @@ ssize_t iio_scan_el_ts_show(struct device *dev, struct device_attribute *attr,
.label = _label, \ .label = _label, \
.set_state = _cf, \ .set_state = _cf, \
} }
#define IIO_SCAN_NAMED_EL_C(_name, _string, _number, _bits, _label, _cf) \
__IIO_SCAN_NAMED_EL_C(_name, _string, _number, _bits, _label, _cf)
/** /**
* IIO_SCAN_EL_TIMESTAMP - declare a special scan element for timestamps * IIO_SCAN_EL_TIMESTAMP - declare a special scan element for timestamps
* *