summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/cdc
AgeCommit message (Collapse)Author
2017-05-28staging: iio: ad7152: Fix deadlock in ad7152_write_raw_samp_freq()Alexey Khoroshilov
ad7152_write_raw_samp_freq() is called by ad7152_write_raw() with chip->state_lock held. So, there is unavoidable deadlock when ad7152_write_raw_samp_freq() locks the mutex itself. The patch removes unneeded locking. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Fixes: 6572389bcc11 ("staging: iio: cdc: ad7152: Implement IIO_CHAN_INFO_SAMP_FREQ attribute") Acked-by: Lars-Peter Clausen <lars@metafoo.de> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-25staging: iio: Remove extra Parenthesis.Arushi Singhal
Remove the extra parenthesis remove the checkpatch issue. Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-23staging: iio: cdc: ad7746: Fix alignment with paranthesisNarcisa Ana Maria Vasile
This was reported by checkpatch.pl: CHECK: Alignment should match open parenthesis Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-23staging: iio: Add blank lines after function declarationsNarcisa Ana Maria Vasile
This was reported by checkpatch.pl: CHECK: Please use a blank line after function/struct/union/enum declarations Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-23staging: iio: Replace a bit shift by a use of BIT.Arushi Singhal
This patch replaces bit shifting on 1 with the BIT(x) macro. This was done with coccinelle: @@ constant c; @@ -1 << c +BIT(c) Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-19Staging: iio: cdc: ad7746: use octal permissions instead of symbolicMiguel Robles
Fix checkpatch warnings: Symbolic permissions 'S_IWUSR' are not preferred. Signed-off-by: Miguel Robles <miguel.robles@farole.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-15Staging: iio: cdc: ad7152.c, use octal permissions instead of symbolicMiguel Robles
Fix checkpatch warnings: Symbolic permissions are not preferred. Consider using octal permissions. Signed-off-by: Miguel Robles <miguel.robles@farole.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-15staging:iio:cdc:ade7746 replace mlock with driver private lockAishwarya Pant
The IIO subsystem is redefining iio_dev mlock to be used by IIO core only for protecting device operating mode changes. In driver ad7746 wherever mlock was used to protect hardware state changes, it has been replaced with a driver private lock. Signed-off-by: Aishwarya Pant <aishpant@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13staging: iio: cdc: ad7152: Remove exceptional & on function namesimran singhal
Remove & from function pointers to conform to the style found elsewhere in the file. Done using the following semantic patch // <smpl> @r@ identifier f; @@ f(...) { ... } @@ identifier r.f; @@ - &f + f // </smpl> Signed-off-by: simran singhal <singhalsimran0@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13staging: iio: cdc: ad7746: Remove exceptional & on function namesimran singhal
Remove & from function pointers to conform to the style found elsewhere in the file. Done using the following semantic patch // <smpl> @r@ identifier f; @@ f(...) { ... } @@ identifier r.f; @@ - &f + f // </smpl> Signed-off-by: simran singhal <singhalsimran0@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-25staging: iio: ad7152: Use BIT() macro for left shifting 1sayli karnik
Replace left shifting on 1 with the BIT(x) macro as suggested by checkpatch.pl. Signed-off-by: sayli karnik <karniksayli1995@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-28drivers:staging:iio:cdc: Style fix.Anthony Brandon
Align parameters to parentheses. Signed-off-by: Anthony Brandon <anthony@amarulasolutions.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-04staging: iio: cdc: fix improper return valuePan Bian
At the end of function ad7150_write_event_config(), directly returns 0. As a result, the errors will be ignored by the callers. It may be better to return variable "ret". Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-03staging: iio: replace symbolic permissionAmit Kumar Kushwaha
This patch fixes the following checkpatch.pl warning in ad7150.c WARNING: Symbolic permissions 'S_IRUGO | S_IWUSR' are not preferred Occured during build. Signed-off-by: Amit Kushwaha <kushwaha.a@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01staging: iio: cdc: ad7746: add additional config definesEva Rachel Retuya
Introduce defines for shifting and mask under the config register for better readability. Also, introduce helper variables for index calculation. Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-25staging: iio: cdc/ad7746: fix missing return valueArnd Bergmann
As found by "gcc -Wmaybe-uninitialized", the latest change to the driver lacked an initalization for the return code in one of the added cases: drivers/staging/iio/cdc/ad7746.c: In function ‘ad7746_read_raw’: drivers/staging/iio/cdc/ad7746.c:655:2: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized] This sets it to IIO_VAL_INT, which I think is what we want here. Fixes: 2296c0623eb7 ("staging: iio: cdc: ad7746: implement IIO_CHAN_INFO_SAMP_FREQ") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23staging: iio: cdc: ad7152: Replace mlock with a local mutex locksayli karnik
mlock is intended to protect only switches between modes. Given this driver doesn't support more than one mode (sysfs polled reads only), replace mlock with a local mutex lock. Signed-off-by: sayli karnik <karniksayli1995@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23staging: iio: cdc: ad7746: implement IIO_CHAN_INFO_SAMP_FREQEva Rachel Retuya
This driver predates the availability of IIO_CHAN_INFO_SAMP_FREQ attribute wherein usage has some advantages like it can be accessed by in-kernel consumers as well as reduces the code size. Therefore, use IIO_CHAN_INFO_SAMP_FREQ to implement the sampling_frequency attribute instead of using IIO_DEVICE_ATTR() macro. Move code from the functions associated with IIO_DEVICE_ATTR() into respective read and write hooks with the mask set to IIO_CHAN_INFO_SAMP_FREQ. Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23staging: iio: cdc: ad7152: Implement IIO_CHAN_INFO_SAMP_FREQ attributesayli karnik
Attributes that were once privately defined become standard with time and hence a special global define is used. Hence update driver ad7152 to use IIO_CHAN_INFO_SAMP_FREQ which is a global define instead of IIO_DEV_ATTR_SAMP_FREQ. Move functionality from IIO_DEV_ATTR_SAMP_FREQ attribute into IIO_CHAN_INFO_SAMP_FREQ to implement the sampling_frequency attribute. Modify ad7152_read_raw() and ad7152_write_raw() to allow reading and writing the element as well. Also add a lock in the driver's private data. Signed-off-by: sayli karnik <karniksayli1995@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-03Staging: iio: ad7150: constify attribute_group structuresBhumika Goyal
Check for attribute_group structures that are only stored in the event_attrs filed of iio_info structure. As the event_attrs field of iio_info structures is constant, so these attribute_group structures can also be declared constant. Done using coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct attribute_group i@p = {...}; @ok1@ identifier r1.i; position p; struct iio_info x; @@ x.event_attrs=&i@p; @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ static +const struct attribute_group i={...}; @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct attribute_group i; File size before: text data bss dec hex filename 3561 1152 8 4721 1271 drivers/staging/iio/cdc/ad7150.o File size after: text data bss dec hex filename 3625 1088 8 4721 1271 drivers/staging/iio/cdc/ad7150.o Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-03staging: iio: cdc: ad7152: Add blank line after declarations to increase ↵Anchal Jain
readability Add a blank line after the function to increase the readability of the code. Signed-off-by: Anchal Jain <anchalj109@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-30iio:core: timestamping clock selection supportGregor Boirie
Adds a new per-device sysfs attribute "current_timestamp_clock" to allow userspace to select a particular POSIX clock for buffered samples and events timestamping. Following clocks, as listed in clock_gettime(2), are supported: CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW, CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME and CLOCK_TAI. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Acked-by: Sanchayan Maity <maitysanchayan@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-11staging: iio: Remove parentheses on the right hand side of assignmentJanani Ravichandran
Remove parentheses on the right hand side of assignment as they are not needed. Semantic patch used: @@ expression a, b, c, d; @@ ( a = (c == d) | a = - ( b - ) ) Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-04Staging: iio: cdc: ad7150: Fix alignment should match open parenthesisShraddha Barke
Fix the checkpatch warning of alignment should match open parenthesis. Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-04Staging: iio: cdc: ad7150: Prefer using the BIT macroShraddha Barke
Replace bit shifting on 1 with the BIT(x) macro Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-24staging: iio: cdc: Remove explicit comparisonsCristina Moraru
Remove comparisons to 0 or NULL Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16Staging: iio: cdc: Remove unused macrosShraddha Barke
Remove the macros since they are not used anywhere throughout the kernel. Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com> Reviewed-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16staging: iio: cdc: simplify return flowIoana Ciornei
Simplify return flow ad7150_write_event_params in order to reduce code length. Since i2c_smbus_write_word_data only returns a negative value or 0 the change is safe. This patch fixes the following coccicheck warning: drivers/staging/iio/cdc/ad7150.c:182:2-5: WARNING: end returns can be simpified if negative or 0 value Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16Merge tag 'iio-for-4.4b' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: Second set of new drivers, functionality and cleanups for IIO in the 4.4 cycle. Core stuff * adjust resistance documentation to allow for output devices. New device support: * bmc150 - split the i2c driver up into a core and i2c_regmap part including regmap conversion. - add spi support. * mcp4531 digitial potentiometer driver. * Measurement Specialties set of drivers with a core library module providing common functionality. Note that the htu21 has a driver in hwmon, but the view from that side was that, given the range of devices the same silicon turns up in are not all typical hwmon material, that driver would be deprecated in favour of this new support. - ms8607 temperature, pressure and humidty sensor - ms5637 temperature and pressure sensor - htu21 temperature and humidity sensor - tsys02d temperature sensor - tsys01 temperature sensor Cleanups * tree wide. - squish cases where irq 0 is still considered valid. * apds9960 - sparse endian warning cleanups by making endianness explicit. * ad5504 - leave group naming to the core. * ad7746 - cleanup comment style. - drop an unnecessary bit of dev_info - add some appropriate uses of the BIT macro. * ad799x - leave group naming to the core. * hdc100x - introduced this cycle,. - fix a wrong offset value. * lidar - add missing MODULE_DEVICE_TABLE for dt. * max1363 - leave sysfs group naming to the core. * m62332 got the Harmut treatment and as ever he found a 'few' bits the rest of us had missed! - Share scale and offset attributes across channels. - Shutdown the device on driver remove - Use ARRAY_SIZE rather than a hard coded count for channels. - Return more directly in the write_raw callback dropping a local variable along the way. - a few style issues - move to reading the regulator voltage for each use allowing for dynamic regulators. This is a common feature across drivers so we might end up with more fixes throughout the tree for this. * mlx96014 - introduced this cycle. - fixed up a spot of error handling. * vz89x - introduced this cycle. - work around a hardware quirk.
2015-10-11staging: iio: adc: fix comment block coding style issueHugo Camboulive
This patch to ad7746.c makes the comment blocks end with a */ on a separate line, and start with a /* on an empty line. Signed-off-by: Hugo Camboulive <hugo.camboulive@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-04staging: iio: adc: fix comment block coding style issueHugo Camboulive
This patch to ad7746.c makes the comment block end with a */ on a separate line. Signed-off-by: Hugo Camboulive <hugo.camboulive@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04staging: iio: cdc: use devm_iio_device_register instead iio_device_registerIoana Ciornei
Replace iio_device_register with resource managed devm_iio_device_register in order to ease the error path. Also delete de remove function since there is no need after this change. Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-30Staging: iio: cdc: Remove unnecessary dev_infoShraddha Barke
Remove dev_info as the information can be obtained by other means Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-09-30Staging: iio: cdc: Prefer using the BIT macroShraddha Barke
Replace bit shifting on 1 with the BIT(x) macro Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-09-12Staging: iio: cdc: Prefer using the BIT macroShraddha Barke
This patch replaces bit shifting on 1 with the BIT(x) macro This was done with coccinelle: @@ int g; @@ -(1 << g) +BIT(g) Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: iio: cdc: Don't put an else right after a returnCatalina Mocanu
This fixes the following checkpatch.pl warning: WARNING: else is not generally useful after a break or return. While at it, remove new line for symmetry with the rest of the code. Signed-off-by: Catalina Mocanu <catalina.mocanu@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-23staging: iio: Fix typo in iioMasanari Iida
Correct spelling typo in comment within staging/iio Signed-off-by: Masanari Iida <standby24x7@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-08iio: Remove support for the legacy event config interfaceLars-Peter Clausen
Now that all drivers have been converted to the new event config interface we can remove for the legacy event config interface. Also drop the '_new' suffix for the event config interface callbacks, since those are the only callbacks now. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03staging:iio:ad7746: Do not store the transfer buffer on the stackLars-Peter Clausen
Some I2C controllers might not be able to handle transfer buffers that are stored on stack. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03staging:iio:ad7746: Mark transfer buffer as __be32Lars-Peter Clausen
Fixes the following warnings from sparse: drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-19Merge tag 'iio-for-3.12d' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/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
2013-10-12staging:iio:ad7150: Switch to new event config interfaceLars-Peter Clausen
Switch the ad7150 driver to the new IIO event config interface as the old one is going to be removed. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-11staging: Remove unnecessary semicolonsJoe Perches
These aren't necessary after switch, if and while statements. Also remove some unnecessary braces where these semicolons were removed around single statement and some unnecessary blank lines. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-01staging:iio:ad7746: Report scale as fractional valueLars-Peter Clausen
Move the complexity of calculating the fixed point scale to the core. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-28staging: iio: ad7746: Use devm_iio_device_allocSachin Kamat
Using devm_iio_device_alloc makes code simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-28staging: iio: ad7152: Use devm_iio_device_allocSachin Kamat
Using devm_iio_device_alloc makes code simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-28staging: iio: ad7150: Use devm_* APIsSachin Kamat
devm_* APIs are device managed and make code simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-03-17staging:iio:cdc:ad7746 move to info_mask_(shared_by_type/separate)Jonathan Cameron
The original info_mask is going away in favour of the broken out versions. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-03-17staging:iio:cdc:ad7152 move to info_mask_(shared_by_type/separate)Jonathan Cameron
The original info_mask is going away in favour of the broken out versions. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-03-17staging:iio:cdc:ad7150 move to info_mask_(shared_by_type/separate)Jonathan Cameron
The original info_mask is going away in favour of the broken out versions. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de>