diff options
author | Jonathan Cameron <jic23@cam.ac.uk> | 2011-05-18 13:42:37 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-05-19 23:15:05 (GMT) |
commit | 6fe8135fccd66aedcc55ded70824342587fd2499 (patch) | |
tree | 3afc7acfd0edc052ba93241761e935af9a3b6ebc /drivers/staging/iio/addac | |
parent | a3f02370c9fa6d85fbee2c11649ebc9c84bae919 (diff) | |
download | linux-6fe8135fccd66aedcc55ded70824342587fd2499.tar.xz |
staging:iio: implement an iio_info structure to take some of the constant elements out of iio_dev.
This was suggested by Arnd Bergmann, Other elements may well
move in here in future, but it definitely makes sense for these.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/addac')
-rw-r--r-- | drivers/staging/iio/addac/adt7316.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c index b71994ee..7097deb 100644 --- a/drivers/staging/iio/addac/adt7316.c +++ b/drivers/staging/iio/addac/adt7316.c @@ -2106,6 +2106,20 @@ int adt7316_enable(struct device *dev) EXPORT_SYMBOL(adt7316_enable); #endif +static const struct iio_info adt7316_info = { + .attrs = &adt7316_attribute_group, + .num_interrupt_lines = 1, + .event_attrs = &adt7316_event_attribute_group, + .driver_module = THIS_MODULE, +}; + +static const struct iio_info adt7516_info = { + .attrs = &adt7516_attribute_group, + .num_interrupt_lines = 1, + .event_attrs = &adt7516_event_attribute_group, + .driver_module = THIS_MODULE, +}; + /* * device probe and remove */ @@ -2150,17 +2164,12 @@ int __devinit adt7316_probe(struct device *dev, struct adt7316_bus *bus, } chip->indio_dev->dev.parent = dev; - if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX) { - chip->indio_dev->attrs = &adt7516_attribute_group; - chip->indio_dev->event_attrs = &adt7516_event_attribute_group; - } else { - chip->indio_dev->attrs = &adt7316_attribute_group; - chip->indio_dev->event_attrs = &adt7316_event_attribute_group; - } + if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX) + chip->indio_dev->info = &adt7516_info; + else + chip->indio_dev->info = &adt7316_info; chip->indio_dev->name = name; chip->indio_dev->dev_data = (void *)chip; - chip->indio_dev->driver_module = THIS_MODULE; - chip->indio_dev->num_interrupt_lines = 1; chip->indio_dev->modes = INDIO_DIRECT_MODE; ret = iio_device_register(chip->indio_dev); |