summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-02-23iio:event: Fix and cleanup lockingiio-for-3.15bLars-Peter Clausen
The event code currently holds a spinlock with IRQs disabled while calling kfifo_to_user(). kfifo_to_user() can generate a page fault though, which means we have to be able to sleep, which is not possible if the interrupts are disabled. The good thing is that kfifo handles concurrent read and write access just fine as long as there is only one reader and one writer, so we do not any locking to protect against concurrent access from the read and writer thread. It is possible though that userspace is trying to read from the event FIFO from multiple concurrent threads, so we need to add locking to protect against this. This is done using a mutex. The mutex will only protect the kfifo_to_user() call, it will not protect the waitqueue. This means that multiple threads can be waiting for new data and once a new event is added to the FIFO all waiting threads will be woken up. If one of those threads is unable to read any data (because another thread already read all the data) it will go back to sleep. The only remaining issue is that now that the clearing of the BUSY flag and the emptying of the FIFO does no longer happen in one atomic step it is possible that a event is added to the FIFO after it has been emptied and this sample will be visible the next time a new event file descriptor is created. To avoid this rather move the emptying of the FIFO from iio_event_chrdev_release to iio_event_getfd(). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-22iio:pressure: Add support for LPS25H pressure sensorDenis CIOCCA
This patch adds support for the new barometer sensor: LPS25H. Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-22iio: hid-sensors: Added Pressure Sensor driverArchana Patni
Added usage id processing for Pressure Sensor. This uses IIO interfaces for triggered buffer to present data to user mode. This uses HID sensor framework for registering callback events from the sensor hub. Signed-off-by: Archana Patni <archana.patni@intel.com> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-22iio: hid-sensors: Added Proximity Sensor DriverArchana Patni
Added usage id processing for Proximity (Human Presence). This uses IIO interfaces for triggered buffer to present data to user mode. This uses HID sensor framework for registering callback events from the sensor hub. Signed-off-by: Archana Patni <archana.patni@intel.com> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-18iio: Avoid unnecessary kasprintfLars-Peter Clausen
name_format already contains the final name and no format characters. So the code basically reads: dev_attr->attr.name = kstrdup(GFP_KERNEL, name_format); if (dev_attr->attr.name == NULL) ... kfree(name_format); Which means we can save one alloc and free pair per attribute name if we directly assign name_format to dev_attr->attr.name. The patch also renames name_format to name to denote that this is indeed the final name and has no format characters in it. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-18iio: Don't include extended name in shared attributesLars-Peter Clausen
The extended name is channel specific and should not be included in shared attributes. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-18iio get rid of unneccessary error_retHartmut Knaack
Get rid of obsolete uses of goto error_ret and some empty lines. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-18iio:max1363 fix typos of int_vref_mvHartmut Knaack
This patch fixes some typos in max1363_chip_info_tbl[]. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-18staging:iio:ad799x use regulator for vrefHartmut Knaack
Switch the ad799x driver to use the regulator framework and add binding for reference voltage. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-18staging:iio:ad799x fix typo in copyright messageHartmut Knaack
Fix a typo in the copyright message. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-15iio: mxs-lradc: Propagate the real error code on platform_get_irq() failureFabio Estevam
No need to return a 'fake' return value on platform_get_irq() failure. Just return the error code itself instead. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-15staging: iio: Add tool to list IIO devices and triggersManuel Stahl
Signed-off-by: Manuel Stahl <manuel.stahl@iis.fraunhofer.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-15iio:accel:bma180: Make LOW_PASS_FILTER_3DB_FREQUENCY shared_by_typePeter Meerwald
the property is not per-channel, but shared by type Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Cc: Kravchenko Oleksandr <x0199363@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-15iio:drop IIO_ST macroJonathan Cameron
This macro no longer allows all the elements of the scan_type structure to be set. Missinterpretation of the parameters also caused a couple of recent bugs. No mainline drivers now use this macro so drop it. Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-15Documentation: add the binding file for Freescale vf610 ADC driverFugang Duan
The patch adds the binding file for Freescale vf610 ADC driver. CC: Shawn Guo <shawn.guo@linaro.org> CC: Jonathan Cameron <jic23@kernel.org> CC: Mark Rutland <mark.rutland@arm.com> CC: Otavio Salvador <otavio@ossystems.com.br> CC: Peter Meerwald <pmeerw@pmeerw.net> CC: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-15iio:adc:imx: add Freescale Vybrid vf610 adc driverFugang Duan
Add Freescale Vybrid vf610 adc driver. The driver only support ADC software trigger. VF610 ADC device documentation is available at below reference manual (chapter 37): http://cache.freescale.com/files/32bit/doc/ref_manual/VYBRIDRM.pdf? fpsp=1&WT_TYPE=Reference%20Manuals&WT_VENDOR=FREESCALE&WT_FILE_FORMAT =pdf&WT_ASSET=Documentation CC: Shawn Guo <shawn.guo@linaro.org> CC: Jonathan Cameron <jic23@kernel.org> CC: Mark Rutland <mark.rutland@arm.com> CC: Otavio Salvador <otavio@ossystems.com.br> CC: Peter Meerwald <pmeerw@pmeerw.net> CC: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-15iio:magnetometer:mag3110: Scale factor missing for temperaturePeter Meerwald
temperature is reported in milli-Celsius Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-15staging:iio:ad799x Move to devm_request_threaded_irq to make device-removal ↵Hartmut Knaack
simpler. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-14staging: usbip: prevent possible buffer overflow reading port recordsMark Asselstine
To avoid buffer overflow while reading a corrupted or possibly modified port file we validate the length of each part of the port record to ensure it doesn't exceed the length of the destination buffer. https://bugzilla.kernel.org/show_bug.cgi?id=69931 Signed-off-by: Mark Asselstine <asselsm@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: pcl816: trigger sources were validated in (*do_cmdtest)H Hartley Sweeten
The trigger sources were already validataed in the (*do_cmdtest) before the (*do_cmd) is called. Remove the unnecessary checks in pcl816_ai_cmd(). Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: pcl812: trigger sources were validated in (*do_cmdtest)H Hartley Sweeten
The trigger sources were already validataed in the (*do_cmdtest) before the (*do_cmd) is called. Remove the unnecessary checks in pcl812_ai_cmd(). Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: das800: trigger sources are validated in (*do_cmdtest)H Hartley Sweeten
The trigger sources were already validataed in the (*do_cmdtest) before the (*do_cmd) is called. Refactor the code in das800_ai_do_cmd() to use if/else instead of the switch since the default cases can never be reached. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: comedi_test: trigger sources are validated in (*do_cmdtest)H Hartley Sweeten
The trigger sources were already validataed in the (*do_cmdtest) before the (*do_cmd) is called. Refactor the code in waveform_ai_cmd() to remove the final else which can never be reached. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: cb_pcidas: trigger sources are validated in (*do_cmdtest)H Hartley Sweeten
The trigger sources were already validataed in the (*do_cmdtest) before the (*do_cmd) is called. Refactor the code in cb_pcidas_ai_cmd() to remove the final else which can never be reached. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: cb_das16_cs: remove incomplete async command supportH Hartley Sweeten
This driver has a (*do_cmdtest) function for analog input async command support but the (*do_cmd) function just returns -EINVAL. Remove the incomplete async command support. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: adl_pci9111: trigger sources are validated in (*do_cmdtest)H Hartley Sweeten
The trigger sources were already validataed in the (*do_cmdtest) before the (*do_cmd) is called. Refactor the code in pci9111_ai_do_cmd() to use if/else instead of the switch since the default cases can never be reached. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: usbduxfast: remove TRIG_TIMER from scan_begin_srcH Hartley Sweeten
Currently the (*do_cmdtest) indicates that TRIG_TIMER is a valid scan_begin_src but later this source is tested as -EINVAL. To simplify the code a bit just remove the TRIG_TIMER source. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: usbduxfast: 'cmd->chanlist_len' was already validataedH Hartley Sweeten
Remove the unnecessary check of 'cmd->chanlist_len > 0'. The (*do_cmdtest) already validated this before the (*do_cmd) was called. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: don't clear 'data' on (*insn_read) timeoutH Hartley Sweeten
It's not necessary to clear the returned data pointer when an (*insn_read) times out. For aesthetics, remove all of these in the drivers. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: move (*insn_{read, write}) timeout debug messages to coreH Hartley Sweeten
Have the comedi core display a standard dev_dbg() message when a timeout occurs and remove all the driver specific messages. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: dmm32at: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input settle and end-of- conversion. These tests use different registers but the same bit so the register is passed as the 'context'. The same test is used in dmm32at_ai_cmd() but the 'insn' is not available. This is ok since the test function, and comedi_timeout() don't use it. Use comedi_timout() to wait for the analog output end-of-conversion. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: dt2814: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: pcl818: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: pcl816: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: pcl812: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. Combine the logic for the pcl812 and acl812 end-of-conversion in the helper function to simplify the driver. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: daqboard2000: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input pipe full, scanning, amd end-of-conversion status. The status to check it passed as the 'context' to comedi_timeout(). Use comedi_timeout() to wait for the analog output end-of-conversion. This also fixes a possible bug where invalid data is returned for the analog input read if the conversion did not complete, The analog output has a similar possible bug where the cached readback value is incorrect if the conversion times out. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: dt282x: use comedi_timeout()H Hartley Sweeten
The wait_for() macro in this driver is a bit nasty. It effects control flow which according to the CodingStyle is a _very_ bad idea. The mux_busy() and ad_done() macros are also bad since they rely on a local variable having a specific name. Remove these macros and use comedi_timeout() to wait for the analog input mux busy completion and end-of-conversion. Both of these are detected by reading the same register and testing different bits. Pass the bits to test as the 'context' to the callback function. The dt282x_ai_cmd() function also checks for the mux busy completion. The 'insn' is not available here but passing NULL is safe because nothing uses it. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: s626: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. This prevents a deadlock condition that could occur by providing a timeout in case the end-of-conversion does not happen. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: rtd520: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input and output end-of- conversions. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: ni_daq_700: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: multiq3: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: icp_multi: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input and output end-of- conversion. Use break to exit the loop when a timeout occurs during the analog input read so that common code can be used to disable the device. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: dyna_pci10xx: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. Also, remove some unnecessary comments. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: amplc_pci230: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: adq12b: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. This also fixes a possible bug where invalid data is returned if the conversion did not complete. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: adv_pci1710: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: adl_pci9118: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: adl_pci9111: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: ni_atmio16d: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. Change the errno returned when the conversion overflows from -ETIME to -EOVERFLOW. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14staging: comedi: ni_at_a2150: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>