From: Greg Kroah-Hartman Date: Sat, 19 Oct 2013 12:16:34 +0000 (-0700) Subject: Merge tag 'iio-for-3.12d' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23... X-Git-Tag: upstream/snapshot3+hdmi~4059^2~196 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2ef9d838e49b4d6396f9c17a38eb5b85a10da07d;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git Merge tag 'iio-for-3.12d' of git://git./linux/kernel/git/jic23/iio into staging-next Jonathan writes: Fourth round of IIO new drivers, functionality and cleanups for the 3.13 cycle. New Drivers * cm36651 combined RGB light and proximity sensor. Core improvements * Some more fixes and cleanups related to buffers. These include the second half of a series which went is as fixes. The basis for delaying until the next merge window is that some are too invasive for this late in a cycle and others only effect code paths current unused in the mainline tree. In this case we have: * protecting against concurrent userspace access * fixing a memory leak if a device goes away * avoiding always reallocating the buffer whether or not it has changed (a bug fix, but one with no functional changes other than a small speed improvement.) * Add reference counting for buffers to ensure they hang around if open from userspace or in kernel when the device is forcefully removed. * Return -ENODEV for buffer access operations when the device has gone away. * Add proper locking for iio_update_buffers (currently we only have one buffer per device in mainline, but an input bridge driver is under development which would make this bug 'real'.) * Wake up anyone waiting on a buffer if the device is unregistered. A subsequent read will fail, notifying userspace that the device is no longer there rather than having it wait possibly for ever. * Move the iio_sw_preenable functionality into the core. This avoids drivers having to 'know' about how the buffers are implemented and is called by almost all drivers anyway. Those that don't call it are not harmed by it being called. * New registration approach for information (i.e. sysfs attributes) about events. Much more generic and now similar to how the equivalent is handled for channel information. The events infrastructure had been left behind by other changes so this brings it back in line. * Using the new events registration approach, add a hysterisis event_info element and apply this to those drivers with this property. * A little unitialized variable bug in the generic_buffer.c example. * Factor out the code for freeing lists of IIO Device attributes to avoid some repitition. Driver cleanups * At91 driver gains touch screen support and some related fixes. * Follow up series of patches removing the now redundant iio_sw_buffer_preenable calls. * Lots of conversions to the new event registration methods. * Another round of hmc5843 cleanups as that driver moves towards graduating from staging. * Make some SoC drivers buildable if COMPILE_TEST is used. Follow up fixes for a few bits and bobs that revealed. * Add explicit includes of linux/of.h to those drivers making us of linux/of.h --- 2ef9d838e49b4d6396f9c17a38eb5b85a10da07d diff --cc drivers/staging/iio/cdc/ad7150.c index 618d820,14a28c4..7e7f989 --- a/drivers/staging/iio/cdc/ad7150.c +++ b/drivers/staging/iio/cdc/ad7150.c @@@ -276,31 -283,29 +283,29 @@@ error_ret } static int ad7150_read_event_value(struct iio_dev *indio_dev, - u64 event_code, - int *val) + const struct iio_chan_spec *chan, + enum iio_event_type type, + enum iio_event_direction dir, + enum iio_event_info info, + int *val, int *val2) { - int chan = IIO_EVENT_CODE_EXTRACT_CHAN(event_code); struct ad7150_chip_info *chip = iio_priv(indio_dev); - int rising = !!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) == - IIO_EV_DIR_RISING); + int rising = (dir == IIO_EV_DIR_RISING); /* Complex register sharing going on here */ - switch (IIO_EVENT_CODE_EXTRACT_TYPE(event_code)) { + switch (type) { case IIO_EV_TYPE_MAG_ADAPTIVE: - *val = chip->mag_sensitivity[rising][chan]; - return 0; - + *val = chip->mag_sensitivity[rising][chan->channel]; + return IIO_VAL_INT; case IIO_EV_TYPE_THRESH_ADAPTIVE: - *val = chip->thresh_sensitivity[rising][chan]; - return 0; - + *val = chip->thresh_sensitivity[rising][chan->channel]; + return IIO_VAL_INT; case IIO_EV_TYPE_THRESH: - *val = chip->threshold[rising][chan]; - return 0; - + *val = chip->threshold[rising][chan->channel]; + return IIO_VAL_INT; default: return -EINVAL; - }; + } } static int ad7150_write_event_value(struct iio_dev *indio_dev,