diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 11:34:17 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 11:34:17 -0700 |
commit | fdc719b63ae35d6a2d8a2a2c76eed813294664bf (patch) | |
tree | f02336d93870e77f8bba4db49f7fc58078465fca /drivers/iio/industrialio-core.c | |
parent | 2794b5d408c625e104de813d3de7ac0ec34d46d9 (diff) | |
parent | a0eeed40100b2eca57afdf99d76c57dedd218a8a (diff) | |
download | op-kernel-dev-fdc719b63ae35d6a2d8a2a2c76eed813294664bf.zip op-kernel-dev-fdc719b63ae35d6a2d8a2a2c76eed813294664bf.tar.gz |
Merge tag 'staging-3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver tree update from Greg Kroah-Hartman:
"Here's the big staging driver tree update for 3.10-rc1
This update contains loads of comedi driver cleanups and fixes in
here, iio updates, android driver changes, and other various staging
driver cleanups.
Thanks to some drivers being removed, and the comedi driver cleanups,
we have removed more code than we added:
627 files changed, 65145 insertions(+), 76321 deletions(-)
which is always nice to see.
All of these have been in linux-next for a while."
* tag 'staging-3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (940 commits)
staging: comedi: ni_labpc: fix legacy driver build
staging: comedi: das800: cleanup the cio-das802/16 fifo comments
staging: comedi: das800: rename CamelCase vars in das800_ai_do_cmd()
staging: comedi: das800: tidy up the private data
staging: comedi: das800: tidy up das800_interrupt()
staging: comedi: das800: tidy up das800_ai_insn_read()
staging: comedi: das800: tidy up das800_di_insn_bits()
staging: comedi: das800: tidy up das800_do_insn_bits()
staging: comedi: das800: remove extra divisor calculation call
staging: comedi: das800: rename {enable,disable}_das800
staging: comedi: das800: tidy up subdevice init
staging: comedi: das800: allow attaching without interrupt support
staging: comedi: das800: interrupts are required for async command support
staging: comedi: das800: tidy up das800_ai_do_cmdtest()
staging: comedi: das800: remove 'volatile' on private data variables
staging: comedi: das800: cleanup the boardinfo
staging: comedi: das800: cleanup range table declarations
staging: comedi: das800: introduce das800_ind_{write, read}()
staging: comedi: das800: remove forward declarations
staging: comedi: das800: move das800_set_frequency()
...
Diffstat (limited to 'drivers/iio/industrialio-core.c')
-rw-r--r-- | drivers/iio/industrialio-core.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 8848f16..e145931 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -691,21 +691,34 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev, if (chan->channel < 0) return 0; - for_each_set_bit(i, &chan->info_mask, sizeof(long)*8) { - ret = __iio_add_chan_devattr(iio_chan_info_postfix[i/2], + for_each_set_bit(i, &chan->info_mask_separate, sizeof(long)*8) { + ret = __iio_add_chan_devattr(iio_chan_info_postfix[i], chan, &iio_read_channel_info, &iio_write_channel_info, - i/2, - !(i%2), + i, + 0, &indio_dev->dev, &indio_dev->channel_attr_list); - if (ret == -EBUSY && (i%2 == 0)) { + if (ret < 0) + goto error_ret; + attrcount++; + } + for_each_set_bit(i, &chan->info_mask_shared_by_type, sizeof(long)*8) { + ret = __iio_add_chan_devattr(iio_chan_info_postfix[i], + chan, + &iio_read_channel_info, + &iio_write_channel_info, + i, + 1, + &indio_dev->dev, + &indio_dev->channel_attr_list); + if (ret == -EBUSY) { ret = 0; continue; - } - if (ret < 0) + } else if (ret < 0) { goto error_ret; + } attrcount++; } @@ -847,7 +860,7 @@ static void iio_dev_release(struct device *device) kfree(indio_dev); } -static struct device_type iio_dev_type = { +struct device_type iio_device_type = { .name = "iio_device", .release = iio_dev_release, }; @@ -869,7 +882,7 @@ struct iio_dev *iio_device_alloc(int sizeof_priv) if (dev) { dev->dev.groups = dev->groups; - dev->dev.type = &iio_dev_type; + dev->dev.type = &iio_device_type; dev->dev.bus = &iio_bus_type; device_initialize(&dev->dev); dev_set_drvdata(&dev->dev, (void *)dev); @@ -960,6 +973,10 @@ int iio_device_register(struct iio_dev *indio_dev) { int ret; + /* If the calling driver did not initialize of_node, do it here */ + if (!indio_dev->dev.of_node && indio_dev->dev.parent) + indio_dev->dev.of_node = indio_dev->dev.parent->of_node; + /* configure elements for the chrdev */ indio_dev->dev.devt = MKDEV(MAJOR(iio_devt), indio_dev->id); |