Make iio_info elements attrs and event_attrs struct attribute *
Subsystems (4)
Jonathan Cameron
maintainercover Make iio_info elements attrs and event_attrs struct attribute *
This came up whilst I was taking a look at Pirmin Duss' driver the other day. When we originally created these the attribute groups were passed directly through the core and registered with sysfs. Since the introduction of iio_chan_spec structures this is no longer true. Their elements are simply coppied into attribute_groups created by the core.
Hence, what other reasons are there for having these as attribute groups? The only one I can see is the availablity of the is_visible callback.
Now I've always had mixed feelings about that one. It's handy on occasion but mostly gets used to handle variations across the different devices that are supported by a given driver. This is true of ad7192, ad9834, ad5446 (indirectly). These can all be easily unwound and handled at a higher level (which iio_info varient we use for the device instance).
The ad7606 is the only more complex use case here. There we have attributes whose visibility is dependent on some gpios being specified in platform data. There are two different sets so we have a total of 4 resulting iio_info structures. Not too bad I suppose.
A side effect of this is that we can remove the code Lars-Peter just added to copy the is_visible callback over. That copy is a little odd anyway as it is applied to far more attributes than are initially visible. whilst all current drivers do a 'is condition true then mask attribute' we only need one to do the reverse logic to get nasty to find bug.
Note this set is on top of Lars-Peters recent rearrangement of the event code as obviously the last patch here edits code he moves.
Jonathan
Jonathan Cameron (6):
staging:iio:adc:ad7192 unwind use of is_visible for attribute group. staging:iio:dds:ad9834 unwind use of is_visible for attrs. staging:iio:dac:ad5446 unwind use of is_visible for attrs. staging:iio:adc:ad7606 unwind use of is_visible for attrs. staging:iio:adc:adt7310/7410 sticking plaster fix for broken event
attrs.
staging:iio:treewide make attrs and event_attrs entries struct
attribute *
drivers/staging/iio/accel/adis16201_core.c | 6 +-- drivers/staging/iio/accel/adis16203_core.c | 6 +-- drivers/staging/iio/accel/adis16204_core.c | 6 +-- drivers/staging/iio/accel/adis16209_core.c | 6 +-- drivers/staging/iio/accel/adis16220_core.c | 6 +-- drivers/staging/iio/accel/adis16240_core.c | 6 +-- drivers/staging/iio/accel/kxsd9.c | 6 +-- drivers/staging/iio/accel/lis3l02dq_core.c | 6 +-- drivers/staging/iio/accel/sca3000_core.c | 19 +----- drivers/staging/iio/adc/ad7192.c | 41 ++++++------- drivers/staging/iio/adc/ad7280a.c | 12 +--- drivers/staging/iio/adc/ad7291.c | 12 +--- drivers/staging/iio/adc/ad7606_core.c | 73 +++++++++++++---------- drivers/staging/iio/adc/ad7793.c | 6 +-- drivers/staging/iio/adc/ad7816.c | 13 +---- drivers/staging/iio/adc/ad799x.h | 1 - drivers/staging/iio/adc/ad799x_core.c | 14 +---- drivers/staging/iio/adc/adt7310.c | 26 +-------- drivers/staging/iio/adc/adt7410.c | 26 +-------- drivers/staging/iio/adc/max1363_core.c | 10 +--- drivers/staging/iio/addac/adt7316.c | 26 +------- drivers/staging/iio/cdc/ad7150.c | 7 +-- drivers/staging/iio/cdc/ad7152.c | 6 +-- drivers/staging/iio/cdc/ad7746.c | 6 +-- drivers/staging/iio/dac/ad5064.c | 6 +-- drivers/staging/iio/dac/ad5360.c | 6 +-- drivers/staging/iio/dac/ad5380.c | 6 +-- drivers/staging/iio/dac/ad5446.c | 39 ++++--------- drivers/staging/iio/dac/ad5504.c | 21 +----- drivers/staging/iio/dac/ad5624r_spi.c | 6 +-- drivers/staging/iio/dac/ad5686.c | 6 +-- drivers/staging/iio/dac/ad5791.c | 6 +-- drivers/staging/iio/dac/max517.c | 12 +--- drivers/staging/iio/dds/ad5930.c | 6 +-- drivers/staging/iio/dds/ad9832.c | 6 +-- drivers/staging/iio/dds/ad9834.c | 46 +++++++-------- drivers/staging/iio/dds/ad9850.c | 6 +-- drivers/staging/iio/dds/ad9852.c | 6 +-- drivers/staging/iio/dds/ad9910.c | 6 +-- drivers/staging/iio/dds/ad9951.c | 6 +-- drivers/staging/iio/gyro/adis16260_core.c | 6 +-- drivers/staging/iio/iio.h | 4 +- drivers/staging/iio/impedance-analyzer/ad5933.c | 6 +-- drivers/staging/iio/imu/adis16400_core.c | 6 +-- drivers/staging/iio/industrialio-core.c | 4 +- drivers/staging/iio/industrialio-event.c | 4 +- drivers/staging/iio/light/isl29018.c | 6 +-- drivers/staging/iio/light/tsl2583.c | 6 +-- drivers/staging/iio/magnetometer/ak8975.c | 7 +-- drivers/staging/iio/magnetometer/hmc5843.c | 6 +-- drivers/staging/iio/meter/ade7753.c | 6 +-- drivers/staging/iio/meter/ade7754.c | 6 +-- drivers/staging/iio/meter/ade7758_core.c | 6 +-- drivers/staging/iio/meter/ade7759.c | 6 +-- drivers/staging/iio/meter/ade7854.c | 6 +-- drivers/staging/iio/resolver/ad2s1210.c | 6 +-- 56 files changed, 164 insertions(+), 463 deletions(-)
Signature · 1 line
1.7.7.4
Jonathan Cameron
maintainerPATCH 1/6 staging:iio:adc:ad7192 unwind use of is_visible for attribute group.
It saves a couple of lines of code but reduces simplicity of code. I generally wish to discourage use of is_visible throughout IIO.
--- drivers/staging/iio/adc/ad7192.c | 43 ++++++++++++++++++++++--------------- 1 files changed, 25 insertions(+), 18 deletions(-)
drivers/staging/iio/adc/ad7192.c +25 -18
@@ -824,25 +824,20 @@ static struct attribute *ad7192_attributes[] = {NULL }; -static mode_t ad7192_attr_is_visible (struct kobject *kobj, -struct attribute *attr,int n) -{ - struct device *dev = container_of(kobj, struct device, kobj); -struct iio_dev *indio_dev =dev_get_drvdata (dev); -struct ad7192_state *st =iio_priv (indio_dev); - -mode_t mode = attr->mode; - -if ((st->devid !=ID_AD7195 ) && - (attr == &iio_dev_attr_ac_excitation_en.dev_attr.attr)) - mode =0 ; - -return mode; -} -static const struct attribute_group ad7192_attribute_group = { .attrs = ad7192_attributes, - .is_visible = ad7192_attr_is_visible, +}; + +static struct attribute *ad7195_attributes[] = { + &iio_dev_attr_sampling_frequency.dev_attr.attr, + &iio_dev_attr_in_v_m_v_scale_available.dev_attr.attr, + &iio_dev_attr_in_voltage_scale_available.dev_attr.attr, + &iio_dev_attr_bridge_switch_en.dev_attr.attr, +NULL +}; + +static const struct attribute_group ad7195_attribute_group = { + .attrs = ad7195_attributes, }; static int ad7192_read_raw(struct iio_dev *indio_dev,
@@ -972,6 +967,15 @@ static const struct iio_info ad7192_info = { .driver_module = THIS_MODULE, }; +static const struct iio_info ad7195_info = { + .read_raw = &ad7192_read_raw, + .write_raw = &ad7192_write_raw, + .write_raw_get_fmt = &ad7192_write_raw_get_fmt, + .attrs = &ad7195_attribute_group, + .validate_trigger = ad7192_validate_trigger, + .driver_module =THIS_MODULE , +}; +#define AD7192_CHAN_DIFF (_chan, _chan2, _name, _address, _si) \ { .type = IIO_VOLTAGE, \ .differential = 1, \
@@ -1064,7 +1068,10 @@ static int __devinit ad7192_probe(struct spi_device *spi) indio_dev->channels = ad7192_channels; indio_dev->num_channels =ARRAY_SIZE (ad7192_channels); indio_dev->available_scan_masks = st->available_scan_masks; - indio_dev->info = &ad7192_info; +if (st->devid ==ID_AD7195 ) + indio_dev->info = &ad7195_info; +else + indio_dev->info = &ad7192_info;for (i =0 ; i < indio_dev->num_channels; i++) st->available_scan_masks[i] = (1 << i) | (1 <<
Signature · 1 line
1.7.7.4
Jonathan Cameron
maintainerPATCH 4/6 staging:iio:adc:ad7606 unwind use of is_visible for attrs.
In reply to Jonathan CameronThis is the most controversial of this set of is_visible removals. There are two conditions controlling availability of attrs resulting in 4 different attribute groups.
Still for a few more lines things are clearer to read to my mind.
--- drivers/staging/iio/adc/ad7606_core.c | 83 +++++++++++++++++++++------------ 1 files changed, 53 insertions(+), 30 deletions(-)
drivers/staging/iio/adc/ad7606_core.c +53 -30
@@ -197,7 +197,7 @@ static IIO_DEVICE_ATTR(oversampling_ratio, S_IRUGO | S_IWUSR, ad7606_store_oversampling_ratio, 0); static IIO_CONST_ATTR(oversampling_ratio_available, "0 2 4 8 16 32 64"); -static struct attribute *ad7606_attributes[] = { +static struct attribute *ad7606_attributes_os_and_range[] = { &iio_dev_attr_in_voltage_range.dev_attr.attr, &iio_const_attr_in_voltage_range_available.dev_attr.attr, &iio_dev_attr_oversampling_ratio.dev_attr.attr,
@@ -205,34 +205,28 @@ static struct attribute *ad7606_attributes[] = { NULL, }; -static mode_t ad7606_attr_is_visible (struct kobject *kobj, -struct attribute *attr,int n) -{ - struct device *dev = container_of(kobj, struct device, kobj); -struct iio_dev *indio_dev =dev_get_drvdata (dev); -struct ad7606_state *st =iio_priv (indio_dev); +static const struct attribute_group ad7606_attribute_group_os_and_range = { + .attrs = ad7606_attributes_os_and_range, +}; -mode_t mode = attr->mode; - -if (!(gpio_is_valid (st->pdata->gpio_os0) && -gpio_is_valid (st->pdata->gpio_os1) && -gpio_is_valid (st->pdata->gpio_os2)) && - (attr == &iio_dev_attr_oversampling_ratio.dev_attr.attr || - attr == - &iio_const_attr_oversampling_ratio_available.dev_attr.attr)) - mode =0 ; -else if (!gpio_is_valid (st->pdata->gpio_range) && - (attr == &iio_dev_attr_in_voltage_range.dev_attr.attr || - attr == - &iio_const_attr_in_voltage_range_available.dev_attr.attr)) - mode =0 ; - -return mode; -} +static struct attribute *ad7606_attributes_os[] = { + &iio_dev_attr_oversampling_ratio.dev_attr.attr, + &iio_const_attr_oversampling_ratio_available.dev_attr.attr, +NULL , +}; -static const struct attribute_group ad7606_attribute_group = { - .attrs = ad7606_attributes, - .is_visible = ad7606_attr_is_visible, +static const struct attribute_group ad7606_attribute_group_os = { + .attrs = ad7606_attributes_os, +}; + +static struct attribute *ad7606_attributes_range[] = { + &iio_dev_attr_in_voltage_range.dev_attr.attr, + &iio_const_attr_in_voltage_range_available.dev_attr.attr, +NULL , +}; + +static const struct attribute_group ad7606_attribute_group_range = { + .attrs = ad7606_attributes_range, };#define AD7606_CHANNEL (num) \
@@ -435,10 +429,27 @@ static irqreturn_t ad7606_interrupt(int irq, void *dev_id)return IRQ_HANDLED ; }; -static const struct iio_info ad7606_info = { +static const struct iio_info ad7606_info_no_os_or_range = { .driver_module =THIS_MODULE , .read_raw = &ad7606_read_raw, - .attrs = &ad7606_attribute_group, +}; + +static const struct iio_info ad7606_info_os_and_range = { + .driver_module =THIS_MODULE , + .read_raw = &ad7606_read_raw, + .attrs = &ad7606_attribute_group_os_and_range, +}; + +static const struct iio_info ad7606_info_os = { + .driver_module =THIS_MODULE , + .read_raw = &ad7606_read_raw, + .attrs = &ad7606_attribute_group_os, +}; + +static const struct iio_info ad7606_info_range = { + .driver_module =THIS_MODULE , + .read_raw = &ad7606_read_raw, + .attrs = &ad7606_attribute_group_range, }; struct iio_dev *ad7606_probe(struct device *dev, int irq,
@@ -483,7 +494,19 @@ struct iio_dev *ad7606_probe(struct device *dev, int irq, st->chip_info = &ad7606_chip_info_tbl[id]; indio_dev->dev.parent = dev; - indio_dev->info = &ad7606_info; +if (gpio_is_valid (st->pdata->gpio_os0) && +gpio_is_valid (st->pdata->gpio_os1) && +gpio_is_valid (st->pdata->gpio_os2)) { +if (gpio_is_valid (st->pdata->gpio_range)) + indio_dev->info = &ad7606_info_os_and_range; +else + indio_dev->info = &ad7606_info_os; + }else { +if (gpio_is_valid (st->pdata->gpio_range)) + indio_dev->info = &ad7606_info_range; +else + indio_dev->info = &ad7606_info_no_os_or_range; + } indio_dev->modes =INDIO_DIRECT_MODE ; indio_dev->name = st->chip_info->name; indio_dev->channels = st->chip_info->channels;
Signature · 1 line
1.7.7.4
Jonathan Cameron
maintainerPATCH 5/6 staging:iio:adc:adt7310/7410 sticking plaster fix for broken event attrs.
In reply to Jonathan CameronNeither of these drivers has ever been anywhere near the iio abi. Probably as a result of this the fact they had two event groups each was not picked up when we restricted IIO to having only 1 event line per device (as part of the chrdev merge set).
As such these definitely didn't work before. This patch squishes the only element from the 'comparator' event line that isn't in the 'interrupt' one into it and kills off the 'comparator' one.
Ultimately both of these drivers belong in hwmon not IIO and are just waiting here because I don't want to kill off a driver that may prove useful to someone. (Ultimately I will ask Greg to scrap these two if no one steps up to deal with them.)
--- drivers/staging/iio/adc/adt7310.c | 21 ++++----------------- drivers/staging/iio/adc/adt7410.c | 21 ++++----------------- 2 files changed, 8 insertions(+), 34 deletions(-)
drivers/staging/iio/adc/adt7310.c +4 -17
@@ -725,32 +725,19 @@ static struct attribute *adt7310_event_int_attributes[] = { &iio_dev_attr_fault_queue.dev_attr.attr, &iio_dev_attr_t_alarm_high.dev_attr.attr, &iio_dev_attr_t_alarm_low.dev_attr.attr, - &iio_dev_attr_t_hyst.dev_attr.attr, - NULL, -}; - -static struct attribute *adt7310_event_ct_attributes[] = { - &iio_dev_attr_event_mode.dev_attr.attr, - &iio_dev_attr_available_event_modes.dev_attr.attr, - &iio_dev_attr_fault_queue.dev_attr.attr, &iio_dev_attr_t_crit.dev_attr.attr, &iio_dev_attr_t_hyst.dev_attr.attr, NULL, }; -static struct attribute_group adt7310_event_attribute_group[ADT7310_IRQS ] = { - { - .attrs = adt7310_event_int_attributes, - .name ="events" , - }, { - .attrs = adt7310_event_ct_attributes, - .name ="events" , - } +static struct attribute_group adt7310_event_attribute_group = { + .attrs = adt7310_event_int_attributes, + .name ="events" , };static const struct iio_info adt7310_info = { .attrs = &adt7310_attribute_group, - .event_attrs = adt7310_event_attribute_group, + .event_attrs = &adt7310_event_attribute_group, .driver_module =THIS_MODULE , };
drivers/staging/iio/adc/adt7410.c +4 -17
@@ -693,32 +693,19 @@ static struct attribute *adt7410_event_int_attributes[] = { &iio_dev_attr_fault_queue.dev_attr.attr, &iio_dev_attr_t_alarm_high.dev_attr.attr, &iio_dev_attr_t_alarm_low.dev_attr.attr, - &iio_dev_attr_t_hyst.dev_attr.attr, - NULL, -}; - -static struct attribute *adt7410_event_ct_attributes[] = { - &iio_dev_attr_event_mode.dev_attr.attr, - &iio_dev_attr_available_event_modes.dev_attr.attr, - &iio_dev_attr_fault_queue.dev_attr.attr, &iio_dev_attr_t_crit.dev_attr.attr, &iio_dev_attr_t_hyst.dev_attr.attr, NULL, }; -static struct attribute_group adt7410_event_attribute_group[ADT7410_IRQS ] = { - { - .attrs = adt7410_event_int_attributes, - .name ="events" , - }, { - .attrs = adt7410_event_ct_attributes, - .name ="events" , - } +static struct attribute_group adt7410_event_attribute_group = { + .attrs = adt7410_event_int_attributes, + .name ="events" , };static const struct iio_info adt7410_info = { .attrs = &adt7410_attribute_group, - .event_attrs = adt7410_event_attribute_group, + .event_attrs = &adt7410_event_attribute_group, .driver_module =THIS_MODULE , };
Signature · 1 line
1.7.7.4
Jonathan Cameron
maintainerPATCH 6/6 staging:iio:treewide make attrs and event_attrs entries struct attribute *
In reply to Jonathan CameronThey were previously struct attribute_group, but are copied internally into another attribute_group.
Also clear out a rather odd unused attribute_group in ak8975. No idea where that came from.
--- drivers/staging/iio/accel/adis16201_core.c | 6 +---- drivers/staging/iio/accel/adis16203_core.c | 6 +---- drivers/staging/iio/accel/adis16204_core.c | 6 +---- drivers/staging/iio/accel/adis16209_core.c | 6 +---- drivers/staging/iio/accel/adis16220_core.c | 6 +---- drivers/staging/iio/accel/adis16240_core.c | 6 +---- drivers/staging/iio/accel/kxsd9.c | 6 +---- drivers/staging/iio/accel/lis3l02dq_core.c | 6 +---- drivers/staging/iio/accel/sca3000_core.c | 19 ++-------------- drivers/staging/iio/adc/ad7192.c | 12 +-------- drivers/staging/iio/adc/ad7280a.c | 12 +-------- drivers/staging/iio/adc/ad7291.c | 12 +-------- drivers/staging/iio/adc/ad7606_core.c | 18 ++------------- drivers/staging/iio/adc/ad7793.c | 6 +---- drivers/staging/iio/adc/ad7816.c | 13 +--------- drivers/staging/iio/adc/ad799x.h | 1 - drivers/staging/iio/adc/ad799x_core.c | 14 +---------- drivers/staging/iio/adc/adt7310.c | 13 +--------- drivers/staging/iio/adc/adt7410.c | 13 +--------- drivers/staging/iio/adc/max1363_core.c | 10 +-------- drivers/staging/iio/addac/adt7316.c | 26 +++------------------- drivers/staging/iio/cdc/ad7150.c | 7 +----- drivers/staging/iio/cdc/ad7152.c | 6 +---- drivers/staging/iio/cdc/ad7746.c | 6 +---- drivers/staging/iio/dac/ad5064.c | 6 +---- drivers/staging/iio/dac/ad5360.c | 6 +---- drivers/staging/iio/dac/ad5380.c | 6 +---- drivers/staging/iio/dac/ad5446.c | 6 +---- drivers/staging/iio/dac/ad5504.c | 21 +++--------------- drivers/staging/iio/dac/ad5624r_spi.c | 6 +---- drivers/staging/iio/dac/ad5686.c | 6 +---- drivers/staging/iio/dac/ad5791.c | 6 +---- drivers/staging/iio/dac/max517.c | 12 +-------- drivers/staging/iio/dds/ad5930.c | 6 +---- drivers/staging/iio/dds/ad9832.c | 6 +---- drivers/staging/iio/dds/ad9834.c | 12 +-------- drivers/staging/iio/dds/ad9850.c | 6 +---- drivers/staging/iio/dds/ad9852.c | 6 +---- drivers/staging/iio/dds/ad9910.c | 6 +---- drivers/staging/iio/dds/ad9951.c | 6 +---- drivers/staging/iio/gyro/adis16260_core.c | 6 +---- drivers/staging/iio/iio.h | 4 +- drivers/staging/iio/impedance-analyzer/ad5933.c | 6 +---- drivers/staging/iio/imu/adis16400_core.c | 6 +---- drivers/staging/iio/industrialio-core.c | 4 +- drivers/staging/iio/industrialio-event.c | 4 +- drivers/staging/iio/light/isl29018.c | 6 +---- drivers/staging/iio/light/tsl2583.c | 6 +---- drivers/staging/iio/magnetometer/ak8975.c | 7 +----- drivers/staging/iio/magnetometer/hmc5843.c | 6 +---- drivers/staging/iio/meter/ade7753.c | 6 +---- drivers/staging/iio/meter/ade7754.c | 6 +---- drivers/staging/iio/meter/ade7758_core.c | 6 +---- drivers/staging/iio/meter/ade7759.c | 6 +---- drivers/staging/iio/meter/ade7854.c | 6 +---- drivers/staging/iio/resolver/ad2s1210.c | 6 +---- 56 files changed, 77 insertions(+), 373 deletions(-)
drivers/staging/iio/accel/adis16201_core.c +1 -5
@@ -449,12 +449,8 @@ static struct attribute *adis16201_attributes[] = {NULL }; -static const struct attribute_group adis16201_attribute_group = { - .attrs = adis16201_attributes, -}; -static const struct iio_info adis16201_info = { - .attrs = &adis16201_attribute_group, + .attrs = adis16201_attributes, .read_raw = &adis16201_read_raw, .write_raw = &adis16201_write_raw, .driver_module =THIS_MODULE ,
drivers/staging/iio/accel/adis16203_core.c +1 -5
@@ -405,12 +405,8 @@ static struct attribute *adis16203_attributes[] = {NULL }; -static const struct attribute_group adis16203_attribute_group = { - .attrs = adis16203_attributes, -}; -static const struct iio_info adis16203_info = { - .attrs = &adis16203_attribute_group, + .attrs = adis16203_attributes, .read_raw = &adis16203_read_raw, .write_raw = &adis16203_write_raw, .driver_module =THIS_MODULE ,
drivers/staging/iio/accel/adis16204_core.c +1 -5
@@ -480,12 +480,8 @@ static struct attribute *adis16204_attributes[] = {NULL }; -static const struct attribute_group adis16204_attribute_group = { - .attrs = adis16204_attributes, -}; -static const struct iio_info adis16204_info = { - .attrs = &adis16204_attribute_group, + .attrs = adis16204_attributes, .read_raw = &adis16204_read_raw, .write_raw = &adis16204_write_raw, .driver_module =THIS_MODULE ,
drivers/staging/iio/accel/adis16209_core.c +1 -5
@@ -453,12 +453,8 @@ static struct attribute *adis16209_attributes[] = {NULL }; -static const struct attribute_group adis16209_attribute_group = { - .attrs = adis16209_attributes, -}; -static const struct iio_info adis16209_info = { - .attrs = &adis16209_attribute_group, + .attrs = adis16209_attributes, .read_raw = &adis16209_read_raw, .write_raw = &adis16209_write_raw, .driver_module =THIS_MODULE ,
drivers/staging/iio/accel/adis16220_core.c +1 -5
@@ -612,12 +612,8 @@ static struct attribute *adis16220_attributes[] = { NULL }; -static const struct attribute_group adis16220_attribute_group = { - .attrs = adis16220_attributes, -}; -static const struct iio_info adis16220_info = { - .attrs = &adis16220_attribute_group, + .attrs = adis16220_attributes, .driver_module =THIS_MODULE , .read_raw = &adis16220_read_raw, };
drivers/staging/iio/accel/adis16240_core.c +1 -5
@@ -505,12 +505,8 @@ static struct attribute *adis16240_attributes[] = {NULL }; -static const struct attribute_group adis16240_attribute_group = { - .attrs = adis16240_attributes, -}; -static const struct iio_info adis16240_info = { - .attrs = &adis16240_attribute_group, + .attrs = adis16240_attributes, .read_raw = &adis16240_read_raw, .write_raw = &adis16240_write_raw, .driver_module =THIS_MODULE ,
drivers/staging/iio/accel/kxsd9.c +1 -5
@@ -194,10 +194,6 @@ static struct iio_chan_spec kxsd9_channels[] = { } }; -static const struct attribute_group kxsd9_attribute_group = { - .attrs = kxsd9_attributes, -}; -static int __devinit kxsd9_power_up (struct kxsd9_state *st) {int ret;
@@ -216,7 +212,7 @@ static int __devinit kxsd9_power_up(struct kxsd9_state *st)static const struct iio_info kxsd9_info = { .read_raw = &kxsd9_read_raw, .write_raw = &kxsd9_write_raw, - .attrs = &kxsd9_attribute_group, + .attrs = kxsd9_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/accel/lis3l02dq_core.c +1 -5
@@ -645,10 +645,6 @@ static struct attribute *lis3l02dq_attributes[] = {NULL }; -static const struct attribute_group lis3l02dq_attribute_group = { - .attrs = lis3l02dq_attributes, -}; -static const struct iio_info lis3l02dq_info = { .read_raw = &lis3l02dq_read_raw, .write_raw = &lis3l02dq_write_raw,
@@ -657,7 +653,7 @@ static const struct iio_info lis3l02dq_info = { .write_event_config = &lis3l02dq_write_event_config, .read_event_config = &lis3l02dq_read_event_config, .driver_module = THIS_MODULE, - .attrs = &lis3l02dq_attribute_group, + .attrs = lis3l02dq_attributes, };static int __devinit lis3l02dq_probe (struct spi_device *spi)
drivers/staging/iio/accel/sca3000_core.c +3 -16
@@ -781,14 +781,6 @@ static struct attribute *sca3000_attributes_with_temp[] = { NULL, }; -static const struct attribute_group sca3000_attribute_group = { - .attrs = sca3000_attributes, -}; - -static const struct attribute_group sca3000_attribute_group_with_temp = { - .attrs = sca3000_attributes_with_temp, -}; -/* RING RELATED interrupt handler */ /* depending on event, push to the ring buffer event chrdev or the event one */
@@ -1038,11 +1030,6 @@ static struct attribute *sca3000_event_attributes[] = { NULL, }; -static struct attribute_group sca3000_event_attribute_group = { - .attrs = sca3000_event_attributes, - .name ="events" , -}; -/** * sca3000_clean_setup() get the device into a predictable state *
@@ -1105,9 +1092,9 @@ error_ret: }static const struct iio_info sca3000_info = { - .attrs = &sca3000_attribute_group, + .attrs = sca3000_attributes, .read_raw = &sca3000_read_raw, - .event_attrs = &sca3000_event_attribute_group, + .event_attrs = sca3000_event_attributes, .read_event_value = &sca3000_read_thresh, .write_event_value = &sca3000_write_thresh, .read_event_config = &sca3000_read_event_config,
@@ -1116,7 +1103,7 @@ static const struct iio_info sca3000_info = { };static const struct iio_info sca3000_info_with_temp = { - .attrs = &sca3000_attribute_group_with_temp, + .attrs = sca3000_attributes_with_temp, .read_raw = &sca3000_read_raw, .read_event_value = &sca3000_read_thresh, .write_event_value = &sca3000_write_thresh,
drivers/staging/iio/adc/ad7192.c +2 -10
@@ -824,10 +824,6 @@ static struct attribute *ad7192_attributes[] = {NULL }; -static const struct attribute_group ad7192_attribute_group = { - .attrs = ad7192_attributes, -}; -static struct attribute *ad7195_attributes[] = { &iio_dev_attr_sampling_frequency.dev_attr.attr, &iio_dev_attr_in_v_m_v_scale_available.dev_attr.attr,
@@ -836,10 +832,6 @@ static struct attribute *ad7195_attributes[] = {NULL }; -static const struct attribute_group ad7195_attribute_group = { - .attrs = ad7195_attributes, -}; - static int ad7192_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val,
@@ -962,7 +954,7 @@ static const struct iio_info ad7192_info = { .read_raw = &ad7192_read_raw, .write_raw = &ad7192_write_raw, .write_raw_get_fmt = &ad7192_write_raw_get_fmt, - .attrs = &ad7192_attribute_group, + .attrs = ad7192_attributes, .validate_trigger = ad7192_validate_trigger, .driver_module = THIS_MODULE, };
@@ -971,7 +963,7 @@ static const struct iio_info ad7195_info = { .read_raw = &ad7192_read_raw, .write_raw = &ad7192_write_raw, .write_raw_get_fmt = &ad7192_write_raw_get_fmt, - .attrs = &ad7195_attribute_group, + .attrs = ad7195_attributes, .validate_trigger = ad7192_validate_trigger, .driver_module = THIS_MODULE, };
drivers/staging/iio/adc/ad7280a.c +2 -10
@@ -480,10 +480,6 @@ static ssize_t ad7280_store_balance_timer(struct device *dev,static struct attribute *ad7280_attributes[AD7280A_MAX_CHAIN *AD7280A_CELLS_PER_DEV *2 +1 ]; -static struct attribute_group ad7280_attrs_group = { - .attrs = ad7280_attributes, -}; -static int ad7280_channel_init (struct ad7280_state *st) {int dev, ch, cnt;
@@ -773,10 +769,6 @@ static struct attribute *ad7280_event_attributes[] = { NULL, }; -static struct attribute_group ad7280_event_attrs_group = { - .attrs = ad7280_event_attributes, -}; - static int ad7280_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val,
@@ -818,8 +810,8 @@ static int ad7280_read_raw(struct iio_dev *indio_dev,static const struct iio_info ad7280_info = { .read_raw = &ad7280_read_raw, - .event_attrs = &ad7280_event_attrs_group, - .attrs = &ad7280_attrs_group, + .event_attrs = ad7280_event_attributes, + .attrs = ad7280_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/adc/ad7291.c +2 -10
@@ -146,10 +146,6 @@ static struct attribute *ad7291_attributes[] = { NULL, }; -static const struct attribute_group ad7291_attribute_group = { - .attrs = ad7291_attributes, -}; -static irqreturn_t ad7291_event_handler (int irq,void *private) {struct iio_dev *indio_dev = private;
@@ -564,18 +560,14 @@ static const struct iio_chan_spec ad7291_channels[] = { } }; -static struct attribute_group ad7291_event_attribute_group = { - .attrs = ad7291_event_attributes, -}; -static const struct iio_info ad7291_info = { - .attrs = &ad7291_attribute_group, + .attrs = ad7291_attributes, .read_raw = &ad7291_read_raw, .read_event_config = &ad7291_read_event_config, .write_event_config = &ad7291_write_event_config, .read_event_value = &ad7291_read_event_value, .write_event_value = &ad7291_write_event_value, - .event_attrs = &ad7291_event_attribute_group, + .event_attrs = ad7291_event_attributes, }; static int __devinit ad7291_probe(struct i2c_client *client,
drivers/staging/iio/adc/ad7606_core.c +3 -15
@@ -205,30 +205,18 @@ static struct attribute *ad7606_attributes_os_and_range[] = { NULL, }; -static const struct attribute_group ad7606_attribute_group_os_and_range = { - .attrs = ad7606_attributes_os_and_range, -}; -static struct attribute *ad7606_attributes_os[] = { &iio_dev_attr_oversampling_ratio.dev_attr.attr, &iio_const_attr_oversampling_ratio_available.dev_attr.attr,NULL , }; -static const struct attribute_group ad7606_attribute_group_os = { - .attrs = ad7606_attributes_os, -}; -static struct attribute *ad7606_attributes_range[] = { &iio_dev_attr_in_voltage_range.dev_attr.attr, &iio_const_attr_in_voltage_range_available.dev_attr.attr,NULL , }; -static const struct attribute_group ad7606_attribute_group_range = { - .attrs = ad7606_attributes_range, -}; -#define AD7606_CHANNEL (num) \ { \ .type = IIO_VOLTAGE, \
@@ -437,19 +425,19 @@ static const struct iio_info ad7606_info_no_os_or_range = {static const struct iio_info ad7606_info_os_and_range = { .driver_module =THIS_MODULE , .read_raw = &ad7606_read_raw, - .attrs = &ad7606_attribute_group_os_and_range, + .attrs = ad7606_attributes_os_and_range, };static const struct iio_info ad7606_info_os = { .driver_module =THIS_MODULE , .read_raw = &ad7606_read_raw, - .attrs = &ad7606_attribute_group_os, + .attrs = ad7606_attributes_os, };static const struct iio_info ad7606_info_range = { .driver_module =THIS_MODULE , .read_raw = &ad7606_read_raw, - .attrs = &ad7606_attribute_group_range, + .attrs = ad7606_attributes_range, }; struct iio_dev *ad7606_probe(struct device *dev, int irq,
drivers/staging/iio/adc/ad7793.c +1 -5
@@ -616,10 +616,6 @@ static struct attribute *ad7793_attributes[] = {NULL }; -static const struct attribute_group ad7793_attribute_group = { - .attrs = ad7793_attributes, -}; - static int ad7793_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val,
@@ -748,7 +744,7 @@ static const struct iio_info ad7793_info = { .read_raw = &ad7793_read_raw, .write_raw = &ad7793_write_raw, .write_raw_get_fmt = &ad7793_write_raw_get_fmt, - .attrs = &ad7793_attribute_group, + .attrs = ad7793_attributes, .validate_trigger = ad7793_validate_trigger, .driver_module = THIS_MODULE, };
drivers/staging/iio/adc/ad7816.c +2 -11
@@ -240,10 +240,6 @@ static struct attribute *ad7816_attributes[] = { NULL, }; -static const struct attribute_group ad7816_attribute_group = { - .attrs = ad7816_attributes, -}; -/* * temperature bound events */
@@ -326,14 +322,9 @@ static struct attribute *ad7816_event_attributes[] = { NULL, }; -static struct attribute_group ad7816_event_attribute_group = { - .attrs = ad7816_event_attributes, - .name ="events" , -}; -static const struct iio_info ad7816_info = { - .attrs = &ad7816_attribute_group, - .event_attrs = &ad7816_event_attribute_group, + .attrs = ad7816_attributes, + .event_attrs = ad7816_event_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/adc/ad799x.h +0 -1
@@ -90,7 +90,6 @@ struct ad799x_state;* @int_vref_mv: the internal reference voltage * @monitor_mode: whether the chip supports monitor interrupts * @default_config: device default configuration -* @event_attrs: pointer to the monitor event attribute group */ struct ad799x_chip_info {
drivers/staging/iio/adc/ad799x_core.c +2 -12
@@ -403,11 +403,6 @@ static struct attribute *ad7993_4_7_8_event_attributes[] = { NULL, }; -static struct attribute_group ad7993_4_7_8_event_attrs_group = { - .attrs = ad7993_4_7_8_event_attributes, - .name ="events" , -}; -static struct attribute *ad7992_event_attributes[] = { &iio_dev_attr_in_voltage0_thresh_both_hyst_raw.dev_attr.attr, &iio_dev_attr_in_voltage1_thresh_both_hyst_raw.dev_attr.attr,
@@ -416,11 +411,6 @@ static struct attribute *ad7992_event_attributes[] = { NULL, }; -static struct attribute_group ad7992_event_attrs_group = { - .attrs = ad7992_event_attributes, - .name ="events" , -}; -static const struct iio_info ad7991_info = { .read_raw = &ad799x_read_raw, .driver_module =THIS_MODULE ,
@@ -428,7 +418,7 @@ static const struct iio_info ad7991_info = {static const struct iio_info ad7992_info = { .read_raw = &ad799x_read_raw, - .event_attrs = &ad7992_event_attrs_group, + .event_attrs = ad7992_event_attributes, .read_event_config = &ad799x_read_event_config, .read_event_value = &ad799x_read_event_value, .write_event_value = &ad799x_write_event_value,
@@ -437,7 +427,7 @@ static const struct iio_info ad7992_info = {static const struct iio_info ad7993_4_7_8_info = { .read_raw = &ad799x_read_raw, - .event_attrs = &ad7993_4_7_8_event_attrs_group, + .event_attrs = ad7993_4_7_8_event_attributes, .read_event_config = &ad799x_read_event_config, .read_event_value = &ad799x_read_event_value, .write_event_value = &ad799x_write_event_value,
drivers/staging/iio/adc/adt7310.c +2 -11
@@ -383,10 +383,6 @@ static struct attribute *adt7310_attributes[] = { NULL, }; -static const struct attribute_group adt7310_attribute_group = { - .attrs = adt7310_attributes, -}; -static irqreturn_t adt7310_event_handler (int irq,void *private) {struct iio_dev *indio_dev = private;
@@ -730,14 +726,9 @@ static struct attribute *adt7310_event_int_attributes[] = { NULL, }; -static struct attribute_group adt7310_event_attribute_group = { - .attrs = adt7310_event_int_attributes, - .name ="events" , -}; -static const struct iio_info adt7310_info = { - .attrs = &adt7310_attribute_group, - .event_attrs = &adt7310_event_attribute_group, + .attrs = adt7310_attributes, + .event_attrs = adt7310_event_int_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/adc/adt7410.c +2 -11
@@ -352,10 +352,6 @@ static struct attribute *adt7410_attributes[] = { NULL, }; -static const struct attribute_group adt7410_attribute_group = { - .attrs = adt7410_attributes, -}; -static irqreturn_t adt7410_event_handler (int irq,void *private) {struct iio_dev *indio_dev = private;
@@ -698,14 +694,9 @@ static struct attribute *adt7410_event_int_attributes[] = { NULL, }; -static struct attribute_group adt7410_event_attribute_group = { - .attrs = adt7410_event_int_attributes, - .name ="events" , -}; -static const struct iio_info adt7410_info = { - .attrs = &adt7410_attribute_group, - .event_attrs = &adt7410_event_attribute_group, + .attrs = adt7410_attributes, + .event_attrs = adt7410_event_int_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/adc/max1363_core.c +1 -9
@@ -819,14 +819,6 @@ static struct attribute *max1363_event_attributes[] = { NULL, }; -static struct attribute_group max1363_event_attribute_group = { - .attrs = max1363_event_attributes, - .name ="events" , -}; - -#define MAX1363_EVENT_FUNCS \ - -static const struct iio_info max1238_info = { .read_raw = &max1363_read_raw, .driver_module =THIS_MODULE ,
@@ -840,7 +832,7 @@ static const struct iio_info max1363_info = { .read_raw = &max1363_read_raw, .update_scan_mode = &max1363_update_scan_mode, .driver_module = THIS_MODULE, - .event_attrs = &max1363_event_attribute_group, + .event_attrs = max1363_event_attributes, };/* max1363 and max1368 tested - rest from data sheet */
drivers/staging/iio/addac/adt7316.c +4 -22
@@ -1711,10 +1711,6 @@ static struct attribute *adt7316_attributes[] = { NULL, }; -static const struct attribute_group adt7316_attribute_group = { - .attrs = adt7316_attributes, -}; -static struct attribute *adt7516_attributes[] = { &iio_dev_attr_all_modes.dev_attr.attr, &iio_dev_attr_mode.dev_attr.attr,
@@ -1759,10 +1755,6 @@ static struct attribute *adt7516_attributes[] = { NULL, }; -static const struct attribute_group adt7516_attribute_group = { - .attrs = adt7516_attributes, -}; -static irqreturn_t adt7316_event_handler (int irq,void *private) {struct iio_dev *indio_dev = private;
@@ -2063,11 +2055,6 @@ static struct attribute *adt7316_event_attributes[] = { NULL, }; -static struct attribute_group adt7316_event_attribute_group = { - .attrs = adt7316_event_attributes, - .name ="events" , -}; -static struct attribute *adt7516_event_attributes[] = { &iio_dev_attr_int_mask.dev_attr.attr, &iio_dev_attr_in_temp_high_value.dev_attr.attr,
@@ -2084,11 +2071,6 @@ static struct attribute *adt7516_event_attributes[] = { NULL, }; -static struct attribute_group adt7516_event_attribute_group = { - .attrs = adt7516_event_attributes, - .name ="events" , -}; -#ifdef CONFIG_PM int adt7316_disable (struct device *dev) {
@@ -2110,14 +2092,14 @@ EXPORT_SYMBOL(adt7316_enable);#endif static const struct iio_info adt7316_info = { - .attrs = &adt7316_attribute_group, - .event_attrs = &adt7316_event_attribute_group, + .attrs = adt7316_attributes, + .event_attrs = adt7316_event_attributes, .driver_module =THIS_MODULE , };static const struct iio_info adt7516_info = { - .attrs = &adt7516_attribute_group, - .event_attrs = &adt7516_event_attribute_group, + .attrs = adt7516_attributes, + .event_attrs = adt7516_event_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/cdc/ad7150.c +1 -6
@@ -530,13 +530,8 @@ static struct attribute *ad7150_event_attributes[] = { NULL, }; -static struct attribute_group ad7150_event_attribute_group = { - .attrs = ad7150_event_attributes, - .name ="events" , -}; -static const struct iio_info ad7150_info = { - .event_attrs = &ad7150_event_attribute_group, + .event_attrs = ad7150_event_attributes, .driver_module =THIS_MODULE , .read_raw = &ad7150_read_raw, .read_event_config = &ad7150_read_event_config,
drivers/staging/iio/cdc/ad7152.c +1 -5
@@ -231,10 +231,6 @@ static struct attribute *ad7152_attributes[] = { NULL, }; -static const struct attribute_group ad7152_attribute_group = { - .attrs = ad7152_attributes, -}; -static const u8 ad7152_addresses[][4 ] = { {AD7152_REG_CH1_DATA_HIGH ,AD7152_REG_CH1_OFFS_HIGH ,AD7152_REG_CH1_GAIN_HIGH ,AD7152_REG_CH1_SETUP },
@@ -424,7 +420,7 @@ static int ad7152_write_raw_get_fmt(struct iio_dev *indio_dev, }static const struct iio_info ad7152_info = { - .attrs = &ad7152_attribute_group, + .attrs = ad7152_attributes, .read_raw = &ad7152_read_raw, .write_raw = &ad7152_write_raw, .write_raw_get_fmt = &ad7152_write_raw_get_fmt,
drivers/staging/iio/cdc/ad7746.c +1 -5
@@ -461,10 +461,6 @@ static struct attribute *ad7746_attributes[] = { NULL, }; -static const struct attribute_group ad7746_attribute_group = { - .attrs = ad7746_attributes, -}; - static int ad7746_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int val,
@@ -677,7 +673,7 @@ out: }static const struct iio_info ad7746_info = { - .attrs = &ad7746_attribute_group, + .attrs = ad7746_attributes, .read_raw = &ad7746_read_raw, .write_raw = &ad7746_write_raw, .driver_module =THIS_MODULE ,
drivers/staging/iio/dac/ad5064.c +1 -5
@@ -269,10 +269,6 @@ static struct attribute *ad5064_attributes[] = { NULL, }; -static const struct attribute_group ad5064_attribute_group = { - .attrs = ad5064_attributes, -}; - static int ad5064_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val,
@@ -331,7 +327,7 @@ static int ad5064_write_raw(struct iio_dev *indio_dev,static const struct iio_info ad5064_info = { .read_raw = ad5064_read_raw, .write_raw = ad5064_write_raw, - .attrs = &ad5064_attribute_group, + .attrs = ad5064_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/dac/ad5360.c +1 -5
@@ -304,10 +304,6 @@ static struct attribute *ad5360_attributes[] = { NULL, }; -static const struct attribute_group ad5360_attribute_group = { - .attrs = ad5360_attributes, -}; - static int ad5360_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int val,
@@ -425,7 +421,7 @@ static int ad5360_read_raw(struct iio_dev *indio_dev,static const struct iio_info ad5360_info = { .read_raw = ad5360_read_raw, .write_raw = ad5360_write_raw, - .attrs = &ad5360_attribute_group, + .attrs = ad5360_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/dac/ad5380.c +1 -5
@@ -264,10 +264,6 @@ static struct attribute *ad5380_attributes[] = { NULL, }; -static const struct attribute_group ad5380_attribute_group = { - .attrs = ad5380_attributes, -}; -static unsigned int ad5380_info_to_reg (struct iio_chan_spec const *chan,long info) {
@@ -353,7 +349,7 @@ static int ad5380_read_raw(struct iio_dev *indio_dev,static const struct iio_info ad5380_info = { .read_raw = ad5380_read_raw, .write_raw = ad5380_write_raw, - .attrs = &ad5380_attribute_group, + .attrs = ad5380_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/dac/ad5446.c +1 -5
@@ -149,10 +149,6 @@ static struct attribute *ad5446_attributes[] = { NULL, }; -static const struct attribute_group ad5446_attribute_group = { - .attrs = ad5446_attributes, -}; -#define AD5446_CHANNEL (bits, storage, shift) { \ .type = IIO_VOLTAGE, \ .indexed = 1, \
@@ -295,7 +291,7 @@ static int ad5446_write_raw(struct iio_dev *indio_dev,static const struct iio_info ad5446_info = { .read_raw = ad5446_read_raw, .write_raw = ad5446_write_raw, - .attrs = &ad5446_attribute_group, + .attrs = ad5446_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/dac/ad5504.c +4 -17
@@ -222,10 +222,6 @@ static struct attribute *ad5504_attributes[] = { NULL, }; -static const struct attribute_group ad5504_attribute_group = { - .attrs = ad5504_attributes, -}; -static struct attribute *ad5501_attributes[] = { &iio_dev_attr_out_voltage0_powerdown.dev_attr.attr, &iio_dev_attr_out_voltage_powerdown_mode.dev_attr.attr,
@@ -233,10 +229,6 @@ static struct attribute *ad5501_attributes[] = { NULL, }; -static const struct attribute_group ad5501_attribute_group = { - .attrs = ad5501_attributes, -}; - static IIO_CONST_ATTR(temp0_thresh_rising_value, "110000"); static IIO_CONST_ATTR(temp0_thresh_rising_en, "1");
@@ -246,11 +238,6 @@ static struct attribute *ad5504_ev_attributes[] = { NULL, }; -static struct attribute_group ad5504_ev_attribute_group = { - .attrs = ad5504_ev_attributes, - .name ="events" , -}; -static irqreturn_t ad5504_event_handler (int irq,void *private) { iio_push_event(private,
@@ -266,16 +253,16 @@ static irqreturn_t ad5504_event_handler(int irq, void *private)static const struct iio_info ad5504_info = { .write_raw = ad5504_write_raw, .read_raw = ad5504_read_raw, - .attrs = &ad5504_attribute_group, - .event_attrs = &ad5504_ev_attribute_group, + .attrs = ad5504_attributes, + .event_attrs = ad5504_ev_attributes, .driver_module =THIS_MODULE , };static const struct iio_info ad5501_info = { .write_raw = ad5504_write_raw, .read_raw = ad5504_read_raw, - .attrs = &ad5501_attribute_group, - .event_attrs = &ad5504_ev_attribute_group, + .attrs = ad5501_attributes, + .event_attrs = ad5504_ev_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/dac/ad5624r_spi.c +1 -5
@@ -238,14 +238,10 @@ static struct attribute *ad5624r_attributes[] = { NULL, }; -static const struct attribute_group ad5624r_attribute_group = { - .attrs = ad5624r_attributes, -}; -static const struct iio_info ad5624r_info = { .write_raw = ad5624r_write_raw, .read_raw = ad5624r_read_raw, - .attrs = &ad5624r_attribute_group, + .attrs = ad5624r_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/dac/ad5686.c +1 -5
@@ -282,10 +282,6 @@ static struct attribute *ad5686_attributes[] = { NULL, }; -static const struct attribute_group ad5686_attribute_group = { - .attrs = ad5686_attributes, -}; - static int ad5686_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val,
@@ -349,7 +345,7 @@ static int ad5686_write_raw(struct iio_dev *indio_dev,static const struct iio_info ad5686_info = { .read_raw = ad5686_read_raw, .write_raw = ad5686_write_raw, - .attrs = &ad5686_attribute_group, + .attrs = ad5686_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/dac/ad5791.c +1 -5
@@ -180,10 +180,6 @@ static struct attribute *ad5791_attributes[] = { NULL, }; -static const struct attribute_group ad5791_attribute_group = { - .attrs = ad5791_attributes, -}; -static int ad5791_get_lin_comp (unsigned int span) {if (span <=10000 )
@@ -277,7 +273,7 @@ static int ad5791_write_raw(struct iio_dev *indio_dev,static const struct iio_info ad5791_info = { .read_raw = &ad5791_read_raw, .write_raw = &ad5791_write_raw, - .attrs = &ad5791_attribute_group, + .attrs = ad5791_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/dac/max517.c +2 -10
@@ -161,10 +161,6 @@ static struct attribute *max517_attributes[] = {NULL }; -static struct attribute_group max517_attribute_group = { - .attrs = max517_attributes, -}; -/* On MAX518 and MAX519 variant, we have two outputs */ static struct attribute *max518_attributes[] = { &iio_dev_attr_out_voltage1_raw.dev_attr.attr,
@@ -175,10 +171,6 @@ static struct attribute *max518_attributes[] = { NULL }; -static struct attribute_group max518_attribute_group = { - .attrs = max518_attributes, -}; -static int max517_suspend (struct i2c_client *client,pm_message_t mesg) {u8 outbuf =COMMAND_PD ;
@@ -194,12 +186,12 @@ static int max517_resume(struct i2c_client *client) }static const struct iio_info max517_info = { - .attrs = &max517_attribute_group, + .attrs = max517_attributes, .driver_module =THIS_MODULE , };static const struct iio_info max518_info = { - .attrs = &max518_attribute_group, + .attrs = max518_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/dds/ad5930.c +1 -5
@@ -82,12 +82,8 @@ static struct attribute *ad5930_attributes[] = { NULL, }; -static const struct attribute_group ad5930_attribute_group = { - .attrs = ad5930_attributes, -}; -static const struct iio_info ad5930_info = { - .attrs = &ad5930_attribute_group, + .attrs = ad5930_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/dds/ad9832.c +1 -5
@@ -192,12 +192,8 @@ static struct attribute *ad9832_attributes[] = { NULL, }; -static const struct attribute_group ad9832_attribute_group = { - .attrs = ad9832_attributes, -}; -static const struct iio_info ad9832_info = { - .attrs = &ad9832_attribute_group, + .attrs = ad9832_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/dds/ad9834.c +2 -10
@@ -296,21 +296,13 @@ static struct attribute *ad9833_attributes[] = { NULL, }; -static const struct attribute_group ad9834_attribute_group = { - .attrs = ad9834_attributes, -}; - -static const struct attribute_group ad9833_attribute_group = { - .attrs = ad9833_attributes, -}; -static const struct iio_info ad9834_info = { - .attrs = &ad9834_attribute_group, + .attrs = ad9834_attributes, .driver_module =THIS_MODULE , };static const struct iio_info ad9833_info = { - .attrs = &ad9833_attribute_group, + .attrs = ad9833_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/dds/ad9850.c +1 -5
@@ -68,12 +68,8 @@ static struct attribute *ad9850_attributes[] = { NULL, }; -static const struct attribute_group ad9850_attribute_group = { - .attrs = ad9850_attributes, -}; -static const struct iio_info ad9850_info = { - .attrs = &ad9850_attribute_group, + .attrs = ad9850_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/dds/ad9852.c +1 -5
@@ -217,12 +217,8 @@ static struct attribute *ad9852_attributes[] = { NULL, }; -static const struct attribute_group ad9852_attribute_group = { - .attrs = ad9852_attributes, -}; -static const struct iio_info ad9852_info = { - .attrs = &ad9852_attribute_group, + .attrs = ad9852_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/dds/ad9910.c +1 -5
@@ -352,12 +352,8 @@ static struct attribute *ad9910_attributes[] = { NULL, }; -static const struct attribute_group ad9910_attribute_group = { - .attrs = ad9910_attributes, -}; -static const struct iio_info ad9910_info = { - .attrs = &ad9910_attribute_group, + .attrs = ad9910_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/dds/ad9951.c +1 -5
@@ -161,12 +161,8 @@ static struct attribute *ad9951_attributes[] = { NULL, }; -static const struct attribute_group ad9951_attribute_group = { - .attrs = ad9951_attributes, -}; -static const struct iio_info ad9951_info = { - .attrs = &ad9951_attribute_group, + .attrs = ad9951_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/gyro/adis16260_core.c +1 -5
@@ -562,12 +562,8 @@ static struct attribute *adis16260_attributes[] = {NULL }; -static const struct attribute_group adis16260_attribute_group = { - .attrs = adis16260_attributes, -}; -static const struct iio_info adis16260_info = { - .attrs = &adis16260_attribute_group, + .attrs = adis16260_attributes, .read_raw = &adis16260_read_raw, .write_raw = &adis16260_write_raw, .driver_module =THIS_MODULE ,
drivers/staging/iio/iio.h +2 -2
@@ -233,8 +233,8 @@ struct iio_dev;**/ struct iio_info {struct module *driver_module; -struct attribute_group *event_attrs; -const struct attribute_group *attrs; +struct attribute **event_attrs; +struct attribute **attrs; int (*read_raw)(struct iio_dev *indio_dev, struct iio_chan_spec const *chan,
drivers/staging/iio/impedance-analyzer/ad5933.c +1 -5
@@ -479,10 +479,6 @@ static struct attribute *ad5933_attributes[] = {NULL }; -static const struct attribute_group ad5933_attribute_group = { - .attrs = ad5933_attributes, -}; - static int ad5933_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val,
@@ -530,7 +526,7 @@ out:static const struct iio_info ad5933_info = { .read_raw = &ad5933_read_raw, - .attrs = &ad5933_attribute_group, + .attrs = ad5933_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/imu/adis16400_core.c +1 -5
@@ -1029,10 +1029,6 @@ static struct attribute *adis16400_attributes[] = {NULL }; -static const struct attribute_group adis16400_attribute_group = { - .attrs = adis16400_attributes, -}; -static struct adis16400_chip_info adis16400_chips[] = { [ADIS16300 ] = { .channels = adis16300_channels,
@@ -1115,7 +1111,7 @@ static const struct iio_info adis16400_info = { .driver_module = THIS_MODULE, .read_raw = &adis16400_read_raw, .write_raw = &adis16400_write_raw, - .attrs = &adis16400_attribute_group, + .attrs = adis16400_attributes, };static int __devinit adis16400_probe (struct spi_device *spi)
drivers/staging/iio/industrialio-core.c +2 -2
@@ -487,7 +487,7 @@ static int iio_device_register_sysfs(struct iio_dev *indio_dev)/* First count elements in any existing group */ if (indio_dev->info->attrs) { - attr = indio_dev->info->attrs->attrs; + attr = indio_dev->info->attrs;while (*attr++ !=NULL ) attrcount_orig++; }
@@ -520,7 +520,7 @@ static int iio_device_register_sysfs(struct iio_dev *indio_dev)/* Copy across original attributes */ if (indio_dev->info->attrs)memcpy (indio_dev->chan_attr_group.attrs, - indio_dev->info->attrs->attrs, + indio_dev->info->attrs,sizeof (indio_dev->chan_attr_group.attrs[0 ]) *attrcount_orig); attrn = attrcount_orig;
drivers/staging/iio/industrialio-event.c +2 -2
@@ -396,7 +396,7 @@ int iio_device_register_eventset(struct iio_dev *indio_dev)iio_setup_ev_int (indio_dev->event_interface);if (indio_dev->info->event_attrs !=NULL ) { - attr = indio_dev->info->event_attrs->attrs; + attr = indio_dev->info->event_attrs;while (*attr++ !=NULL ) attrcount_orig++; }
@@ -418,7 +418,7 @@ int iio_device_register_eventset(struct iio_dev *indio_dev) }if (indio_dev->info->event_attrs)memcpy (indio_dev->event_interface->group.attrs, - indio_dev->info->event_attrs->attrs, + indio_dev->info->event_attrs,sizeof (indio_dev->event_interface->group.attrs[0 ]) *attrcount_orig); attrn = attrcount_orig;
drivers/staging/iio/light/isl29018.c +1 -5
@@ -452,10 +452,6 @@ static struct attribute *isl29018_attributes[] = { NULL }; -static const struct attribute_group isl29108_group = { - .attrs = isl29018_attributes, -}; -static int isl29018_chip_init (struct i2c_client *client) {struct isl29018_chip *chip =iio_priv (i2c_get_clientdata (client));
@@ -521,7 +517,7 @@ static int isl29018_chip_init(struct i2c_client *client) }static const struct iio_info isl29108_info = { - .attrs = &isl29108_group, + .attrs = isl29018_attributes, .driver_module =THIS_MODULE , .read_raw = &isl29018_read_raw, .write_raw = &isl29018_write_raw,
drivers/staging/iio/light/tsl2583.c +1 -5
@@ -780,10 +780,6 @@ static struct attribute *sysfs_attrs_ctrl[] = { NULL }; -static struct attribute_group tsl2583_attribute_group = { - .attrs = sysfs_attrs_ctrl, -}; -/* Use the default register values to identify the Taos device */ static int taos_tsl258x_device (unsigned char *bufp) {
@@ -791,7 +787,7 @@ static int taos_tsl258x_device(unsigned char *bufp) }static const struct iio_info tsl2583_info = { - .attrs = &tsl2583_attribute_group, + .attrs = sysfs_attrs_ctrl, .driver_module =THIS_MODULE , };
drivers/staging/iio/magnetometer/ak8975.c +1 -6
@@ -88,7 +88,6 @@*/ struct ak8975_data {struct i2c_client *client; -struct attribute_group attrs;struct mutex lock;u8 asa[3 ];long raw_to_gauss[3 ];
@@ -458,12 +457,8 @@ static struct attribute *ak8975_attr[] = { NULL }; -static struct attribute_group ak8975_attr_group = { - .attrs = ak8975_attr, -}; -static const struct iio_info ak8975_info = { - .attrs = &ak8975_attr_group, + .attrs = ak8975_attr, .read_raw = &ak8975_read_raw, .driver_module =THIS_MODULE , };
drivers/staging/iio/magnetometer/hmc5843.c +1 -5
@@ -495,10 +495,6 @@ static struct attribute *hmc5843_attributes[] = { NULL }; -static const struct attribute_group hmc5843_group = { - .attrs = hmc5843_attributes, -}; -static int hmc5843_detect (struct i2c_client *client,struct i2c_board_info *info) {
@@ -531,7 +527,7 @@ static void hmc5843_init_client(struct i2c_client *client) }static const struct iio_info hmc5843_info = { - .attrs = &hmc5843_group, + .attrs = hmc5843_attributes, .read_raw = &hmc5843_read_raw, .driver_module =THIS_MODULE , };
drivers/staging/iio/meter/ade7753.c +1 -5
@@ -501,12 +501,8 @@ static struct attribute *ade7753_attributes[] = { NULL, }; -static const struct attribute_group ade7753_attribute_group = { - .attrs = ade7753_attributes, -}; -static const struct iio_info ade7753_info = { - .attrs = &ade7753_attribute_group, + .attrs = ade7753_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/meter/ade7754.c +1 -5
@@ -524,12 +524,8 @@ static struct attribute *ade7754_attributes[] = { NULL, }; -static const struct attribute_group ade7754_attribute_group = { - .attrs = ade7754_attributes, -}; -static const struct iio_info ade7754_info = { - .attrs = &ade7754_attribute_group, + .attrs = ade7754_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/meter/ade7758_core.c +1 -5
@@ -657,10 +657,6 @@ static struct attribute *ade7758_attributes[] = { NULL, }; -static const struct attribute_group ade7758_attribute_group = { - .attrs = ade7758_attributes, -}; -static struct iio_chan_spec ade7758_channels[] = { IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, "raw", 0, 0, IIO_CHAN_INFO_SCALE_SHARED_BIT,
@@ -726,7 +722,7 @@ static struct iio_chan_spec ade7758_channels[] = { };static const struct iio_info ade7758_info = { - .attrs = &ade7758_attribute_group, + .attrs = ade7758_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/meter/ade7759.c +1 -5
@@ -447,12 +447,8 @@ static struct attribute *ade7759_attributes[] = { NULL, }; -static const struct attribute_group ade7759_attribute_group = { - .attrs = ade7759_attributes, -}; -static const struct iio_info ade7759_info = { - .attrs = &ade7759_attribute_group, + .attrs = ade7759_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/meter/ade7854.c +1 -5
@@ -547,12 +547,8 @@ static struct attribute *ade7854_attributes[] = { NULL, }; -static const struct attribute_group ade7854_attribute_group = { - .attrs = ade7854_attributes, -}; -static const struct iio_info ade7854_info = { - .attrs = &ade7854_attribute_group, + .attrs = ade7854_attributes, .driver_module =THIS_MODULE , };
drivers/staging/iio/resolver/ad2s1210.c +1 -5
@@ -604,10 +604,6 @@ static struct attribute *ad2s1210_attributes[] = { NULL, }; -static const struct attribute_group ad2s1210_attribute_group = { - .attrs = ad2s1210_attributes, -}; -static int __devinit ad2s1210_initial (struct ad2s1210_state *st) {unsigned char data;
@@ -647,7 +643,7 @@ error_ret:static const struct iio_info ad2s1210_info = { .read_raw = &ad2s1210_read_raw, - .attrs = &ad2s1210_attribute_group, + .attrs = ad2s1210_attributes, .driver_module =THIS_MODULE , };
Signature · 1 line
1.7.7.4
Quoted 1 line · Jonathan Cameron
This came up whilst I was taking a look at Pirmin Duss' driver the ot=
her day.
Quoted 1 line
When we originally created these the attribute groups were passed dir=
ectly
Quoted 1 line
through the core and registered with sysfs. Since the introduction o=
f
Quoted 1 line
iio_chan_specstructures this is no longer true. Their elements are =
simply
Quoted 3 lines
coppied into
attribute_groupscreated by the core.
=20
Hence, what other reasons are there for having these as attribute gro=
ups?
Quoted 3 lines
The only one I can see is the availablity of the
is_visiblecallback. =20
Now I've always had mixed feelings about that one. It's handy on occa=
sion
Quoted 1 line
but mostly gets used to handle variations across the different device=
s
Quoted 1 line
that are supported by a given driver. This is true of ad7192, ad9834=
,
Quoted 1 line
ad5446 (indirectly). These can all be easily unwound and handled at =
a
Quoted 1 line
higher level (which
iio_infovarient we use for the device instance).
This sounds sensible.
Quoted 3 lines
=20
The ad7606 is the only more complex use case here. There we have attributes whose visibility is dependent on some gpios being specifie=
d
Quoted 1 line
in platform data. There are two different sets so we have a total of=
4
Quoted 1 line
resulting
iio_infostructures. Not too bad I suppose.
But this is getting a bit ugly in my opinion. Maybe we can add a attrs fields to the iio_dev struct to handle these. This would also allow us = to
allocate attributes at runtime if necessary.
Quoted 2 lines
=20
A side effect of this is that we can remove the code Lars-Peter just =
added
Quoted 1 line
to copy the
is_visiblecallback over. =20
Hm, while I have such a patch locally I don=92t think I've send it out = yet.
Quoted 2 lines
That copy is a little odd anyway
as it is applied to far more attributes than are initially visible. =
whilst
Quoted 1 line
all current drivers do a 'is condition true then mask attribute' we o=
nly
Quoted 3 lines
need one to do the reverse logic to get nasty to find bug. =20
Note this set is on top of Lars-Peters recent rearrangement of the ev=
ent
Quoted 1 line
code as obviously the last patch here edits code he moves.
- Lars
Quoted 5 lines · Lars-Peter Clausen
Quoted 1 line · Jonathan Cameron
This came up whilst I was taking a look at Pirmin Duss' driver the
other day.
Quoted 1 line
When we originally created these the attribute groups were passed
directly
Quoted 9 lines
Quoted 1 line
through the core and registered with sysfs. Since the introduction
of
Quoted 1 line
iio_chan_specstructures this is no longer true. Their elements aresimply
Quoted 3 lines
coppied into
attribute_groupscreated by the core.
=20
Hence, what other reasons are there for having these as attributegroups?
Quoted 1 line
The only one I can see is the availablity of the
is_visiblecallback=
=2E
Quoted 10 lines
Quoted 2 lines
=20
Now I've always had mixed feelings about that one. It's handy onoccasion
Quoted 1 line
but mostly gets used to handle variations across the different
devices
Quoted 1 line
that are supported by a given driver. This is true of ad7192,
ad9834,
Quoted 1 line
ad5446 (indirectly). These can all be easily unwound and handled at
a
Quoted 1 line
higher level (which
iio_infovarient we use for the device instance)=
=2E
Quoted 8 lines
This sounds sensible.
Quoted 3 lines
=20
The ad7606 is the only more complex use case here. There we have attributes whose visibility is dependent on some gpios beingspecified
Quoted 1 line
in platform data. There are two different sets so we have a total o=
f
Quoted 7 lines
4
Quoted 1 line
resulting
iio_infostructures. Not too bad I suppose.But this is getting a bit ugly in my opinion. Maybe we can add a attrs fields to the
iio_devstruct to handle these. This would also allow us to
allocate attributes at runtime if necessary.
You are right. These do seem like they are too dynamic to be in iio _in= fo. I will make that change as an additional patch.
Quoted 7 lines
Quoted 3 lines
=20
A side effect of this is that we can remove the code Lars-Peter justadded
Quoted 1 line
to copy the
is_visiblecallback over. =20Hm, while I have such a patch locally I don=E2=80=99t think I've send =
it out
Quoted 10 lines
yet.
Quoted 2 lines
That copy is a little odd anyway
as it is applied to far more attributes than are initially visible.=20whilst
Quoted 1 line
all current drivers do a 'is condition true then mask attribute' we
only
Quoted 3 lines
need one to do the reverse logic to get nasty to find bug. =20
Note this set is on top of Lars-Peters recent rearrangement of the
Quoted 6 lines
event
Quoted 1 line
code as obviously the last patch here edits code he moves.
- Lars
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" i=
n
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--=20
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 2/6] staging:iio:dds:ad9834 unwind use of is_visible for attrs.
Quoted 9 lines · Jonathan Cameron
Trivial usecase in which just having two different attr groups covers all options. Slightly more code, but a simpler to follow result.
static int
__devinitad9834_probe(struct spi_device *spi){(quoted diff) +0
-0struct ad9834_platform_data *pdata = spi->dev.platform_data;
Review static int __devinit ad9834_probe(struct spi_device *spi) · line 350
Quoted 5 lines
(quoted diff) +1
-1@@ -344,7 +347,10 @@ static int __devinit ad9834_probe(struct spi_device *spi) st->reg = reg; indio_dev->dev.parent = &spi->dev; indio_dev->name = spi_get_device_id(spi)->name; - indio_dev->info = &ad9834_info; + if ((st->devid == ID_AD9833) || (st->devid == ID_AD9837))
Maybe use a switch statement.
Quoted 6 lines
(quoted diff) +3
-0+ indio_dev->info = &ad9833_info; + else + indio_dev->info = &ad9834_info; indio_dev->modes = INDIO_DIRECT_MODE; /* Setup default messages */
Re: [PATCH 2/6] staging:iio:dds:ad9834 unwind use of is_visible for attrs.
Quoted 1 line · Lars-Peter Clausen
On 01/02/2012 06:25 PM, Jon=
Quoted 1 line · athan Cameron
Quoted 1 line
Trivial usecase in which just having two different =
attr
Quoted 2 lines
Quoted 2 lines
groups covers all options. Slightly more code, but a simpler to=
follow result.
Quoted 3 lines
Quoted 3 lines
static int
__devinitad9834_probe(struct spi_devi=
ce *spi)
Quoted 2 lines
Quoted 2 lines
{
structad9834_platform_data*pdata =3D spi->dev.platfor=
m_data;
Quoted 2 lines
Review static int __devinit ad9834_probe(struct
Quoted 1 line
(quoted diff) +0
-0@@ -344,7 +347,10 @@ static int __devinit ad9834_probe(structs=
pi_device *spi)
Quoted 2 lines
Review static int __devinit ad9834_probe(struct · line 348
Quoted 2 lines
(quoted diff) +0
-0st->reg =3D reg; indio_dev->dev.parent =3D &spi->=
dev;
Quoted 4 lines
Review static int __devinit ad9834_probe(struct · line 347
Quoted 2 lines
(quoted diff) +0
-1indio_dev->name =3D spi_get_device_id(spi)->name; - indio_dev-=info =3D
&ad9834_info;Review static int __devinit ad9834_probe(struct · line 350
Quoted 1 line
(quoted diff) +1
-0+ if ((st->devid =3D=3D ID_AD9833) || (st->devid=
=3D=3D ID_AD9837))
Quoted 2 lines
Maybe use a switch statement.
Good idea
Quoted 2 lines
Review static int __devinit ad9834_probe(struct · line 351
Quoted 2 lines
(quoted diff) +1
-0+ indi=
o_dev->info =3D &ad9833_info;
Quoted 2 lines
Review static int __devinit ad9834_probe(struct · line 353
Quoted 2 lines
(quoted diff) +2
-0+ else + indio_dev->info =3D &ad9834_i=
nfo;
Quoted 3 lines
Review static int __devinit ad9834_probe(struct · line 356
Quoted 3 lines
(quoted diff) +0
-0indio_dev->modes =3D INDIO_DIRECT_MODE; /* Setup defaul=
t messages */
Quoted 3 lines
--
To unsubscribe from this list: send the line "unsubscr=
ibe linux-iio" in
Quoted 2 lines
the body of a message to [email protected] More=
majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Sent fr= om my Android phone with K-9 Mail. Please excuse my brevity.