aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-02-26Merge 4.16-rc3 into staging-nextGreg Kroah-Hartman2-11/+20
We want the IIO/Staging fixes in here, and to resolve a merge problem with the move of the fsl-mc code. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-17staging: ade7759: Fix open parenthesis alignmentrodrigosiqueira1-42/+38
This patch fixes the CHECKs reported by checkpatch.pl for "alignment should match open parenthesis" Signed-off-by: rodrigosiqueira <rodrigosiqueiramelo@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-02-10Staging: iio: ade7758: Expand buf_lock to cover both buffer and state protectionShreeya Patel2-15/+39
iio_dev->mlock is to be used only by the IIO core for protecting device mode changes between INDIO_DIRECT and INDIO_BUFFER. This patch replaces the use of mlock with the already established buf_lock mutex. Introducing 'unlocked' forms of read and write registers. The read/write frequency functions now require buf_lock to be held. That's not obvious so avoid this but moving the locking inside the functions where it is then clear that they are taking the unlocked forms of the register read/write. It isn't readily apparent that write frequency function requires the locks to be taken, so move it inside the function to where it is required to protect. Also, the read raw does not require iio_dev->mlock for reads. It can run concurrently as resource protection is handled by buf_lock in read register. Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-01-30staging: iio: adc: ad7192: disable burnout currents on misconfigAlexandru Ardelean1-1/+5
The burnout currents can be enabled only if buffer is enabled and CHOP is disabled. So, if neither of these conditions are met, then we should disable the burnout currents in the driver as well, and warn the user. This change doesn't fix anything. The burnout currents simply won't work if CHOP is enabled or buffer is disabled. The intent is to provide the user with some feedback instead of silently not working inside the chip. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-01-28staging: iio: ad5933: switch buffer mode to softwareAlexandru Ardelean1-3/+1
Since commit 152a6a884ae1 ("staging:iio:accel:sca3000 move to hybrid hard / soft buffer design.") the buffer mechanism has changed and the INDIO_BUFFER_HARDWARE flag has been unused. Since commit 2d6ca60f3284 ("iio: Add a DMAengine framework based buffer") the INDIO_BUFFER_HARDWARE flag has been re-purposed for DMA buffers. This driver has lagged behind these changes, and in order for buffers to work, the INDIO_BUFFER_SOFTWARE needs to be used. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Fixes: 2d6ca60f3284 ("iio: Add a DMAengine framework based buffer") Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-01-28staging: iio: adc: ad7192: fix external frequency settingAlexandru Ardelean1-8/+19
The external clock frequency was set only when selecting the internal clock, which is fixed at 4.9152 Mhz. This is incorrect, since it should be set when any of the external clock or crystal settings is selected. Added range validation for the external (crystal/clock) frequency setting. Valid values are between 2.4576 and 5.12 Mhz. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-01-08staging: iio: light: Add breaks to lengthy linesGeorge Edward Bulmer1-3/+6
This fixes three instances of checkpatch warning: WARNING: line over 80 characters Signed-off-by: George Edward Bulmer <gebulmer@googlemail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-08Staging: iio: cdc: ad7152: Prefer using BIT macroSumit Pundir1-4/+4
This patch fixes the following checkpatch.pl issue at multiple lines: CHECK: Prefer using the BIT macro Signed-off-by: Sumit Pundir <pundirsumit11@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-08staging: iio: trigger: blackfin timer: replace device_attr with device_attr_rwAishwarya Pant1-8/+7
This is a clean-up patch which replaces DEVICE_ATTR() macro with the file permission specific DEVICE_ATTR_RW() macro for compaction and readability. Done using coccinelle. Signed-off-by: Aishwarya Pant <aishpant@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-08staging: iio: remove unnecessary parenthesesJi-Hun Kim1-1/+1
Clean up checkpatch warning: CHECK: Unnecessary parentheses around 'st->devid != ID_AD7195' Signed-off-by: Ji-Hun Kim <jihuun.k@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-02iio: trigger: Fix platform_get_irq's error checkingArvind Yadav1-2/+2
The platform_get_irq() function returns negative if an error occurs. zero or positive number on success. platform_get_irq() error checking for zero is not correct. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-12-02staging: iio: ad7746: Improve unlocking of a mutex in ad7746_start_calib()Markus Elfring1-8/+9
* Add a jump target so that a call of the function "mutex_unlock" is stored only twice in this function implementation. * Replace two calls by goto statements. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-12-02staging: iio: ad7152: Improve unlocking of a mutex in ad7152_start_calib()Markus Elfring1-8/+9
* Add a jump target so that a call of the function "mutex_unlock" is stored only twice in this function implementation. * Replace two calls by goto statements. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-11-13Merge tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/stagingLinus Torvalds31-474/+306
Pull staging and IIO updates from Greg KH: "Here is the "big" staging and IIO driver update for 4.15-rc1. Lots and lots of little changes, almost all minor code cleanups as the Outreachy application process happened during this development cycle. Also happened was a lot of IIO driver activity, and the typec USB code moving out of staging to drivers/usb (same commits are in the USB tree on a persistent branch to not cause merge issues.) Overall, it's a wash, I think we added a few hundred more lines than removed, but really only a few thousand were modified at all. All of these have been in linux-next for a while. There might be a merge issue with Al's vfs tree in the pi433 driver (take his changes, they are always better), and the media tree with some of the odd atomisp cleanups (take the media tree's version)" * tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (507 commits) staging: lustre: add SPDX identifiers to all lustre files staging: greybus: Remove redundant license text staging: greybus: add SPDX identifiers to all greybus driver files staging: ccree: simplify ioread/iowrite staging: ccree: simplify registers access staging: ccree: simplify error handling logic staging: ccree: remove dead code staging: ccree: handle limiting of DMA masks staging: ccree: copy IV to DMAable memory staging: fbtft: remove redundant initialization of buf staging: sm750fb: Fix parameter mistake in poke32 staging: wilc1000: Fix bssid buffer offset in Txq staging: fbtft: fb_ssd1331: fix mirrored display staging: android: Fix checkpatch.pl error staging: greybus: loopback: convert loopback to use generic async operations staging: greybus: operation: add private data with get/set accessors staging: greybus: loopback: Fix iteration count on async path staging: greybus: loopback: Hold per-connection mutex across operations staging: greybus/loopback: use ktime_get() for time intervals staging: fsl-dpaa2/eth: Extra headroom in RX buffers ...
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman6-0/+6
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-27Merge tag 'iio-for-4.15c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman2-275/+167
Jonathan writes: Third set of new device support, cleanups and features for IIO in the 4.15 cycle New device support * ti-dac082s085 dac - new driver supporting 8, 10 and 12 bit TI DACs with 2 and 4 channels: DAC082S085, DAC102S085, DAC122S085, DAC104s085 and DAC124S085. Minor features and cleanps * adc12138 - make array ch_to_mux static for small object code size reduction. * sun4i-gpadc - use of_device_get_match_data rather than opencoding it. * stm32 trigger - add tim15 tigger on STM32H7 - check clock rate to avoid potential division by zero * tsl2x7x staging cleanups. - move *_thresh_period to being created by IIO core. - remove unused tsl2x7x_parse_result structure. - sort includes - drop a repeat iio_dev forward definition - fix some code alignment of defines. - use IIO_CONST_ATTR for constant string attribute - drop some unnecessary parentheses - fix various alignment with parenthese - rename power defines for readability reasons - fix a missaligned break statement - Tidy up function definitions so they fit on a single line.
2017-10-23Merge 4.14-rc6 into staging-nextGreg Kroah-Hartman1-1/+1
We want the IIO and staging driver fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-21staging: iio: tsl2x7x: put function definitions on a single lineBrian Masney1-5/+3
The functions tsl2x7x_invoke_change() and tsl2x7x_prox_calculate() are short enough that the return value and static declaration can be moved onto the same line with the function name. This patch makes that change to increase code readability. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-21staging: iio: tsl2x7x: fix alignment of break statementsBrian Masney1-2/+2
Correct the alignment of the break statements to match the alignment of the rest of the code within the case statements. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-21staging: iio: tsl2x7x: rename power defines to improve code readabilityBrian Masney1-5/+5
The LED power defines are named like TSL2X7X_mAXXX. Rename these values to TSL2X7X_XXX_mA to improve code readability. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-21staging: iio: tsl2x7x: correct alignment of parenthesisBrian Masney1-17/+18
Correct error from checkpatch.pl to improve code readibility: Alignment should match open parenthesis. An unnecessary cast to 'struct tsl2x7x_lux *' was removed and the return value of static definition of in_illuminance0_calibscale_available_show() was put on its own line due to the length of that sysfs attribute. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-21staging: iio: tsl2x7x: correct alignment of parenthesisBrian Masney1-9/+8
Correct error from checkpatch.pl to improve code readibility: Alignment should match open parenthesis. This involved shortening the name of tsl2x7x_als_gainadj and tsl2x7x_prx_gainadj to tsl2x7x_als_gain and tsl2x7x_prx_gain respectively. This also required removing the ch0lux and ch1lux local variables in order to get the line short enough. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-21staging: iio: tsl2x7x: remove unnecessary parenthesesBrian Masney1-8/+8
This patch fixes the error 'Unnecessary parentheses around 'XXX' from checkpatch.pl. It also fixes several other places with unnecessary parentheses that checkpatch.pl did not detect. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-21staging: iio: tsl2x7x: convert in_proximity0_calibscale_available to use IIO_CONST_ATTRBrian Masney1-11/+4
The sysfs attribute in_proximity0_calibscale_available is currently created by using DEVICE_ATTR_RO(). Convert this over to use IIO_CONST_ATTR(). Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-21staging: iio: tsl2x7x: changed #defines to be aligned on the same columnBrian Masney1-66/+66
Some of the existing #defines have tabs between the name, and the value, while others have spaces. The alignment of the values mostly has a consistent layout, but there are some that don't. Change all of the defines so that the name and value is separated by tabs and all of the values start on the same column to increase code readability. This patch also removes the unnecessary parentheses around the value of TSL2X7X_MAX_TIMER_CNT. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-21staging: iio: tsl2x7x: remove unnecessary struct iio_dev definitionBrian Masney1-2/+0
tsl2x7x.h has a blank definition for 'struct iio_dev' that is not needed. This patch removes that definition. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-21staging: iio: tsl2x7x: sort #includesBrian Masney1-5/+5
Sort the #include statements for increased code readability. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-21staging: iio: tsl2x7x: remove unused tsl2x7x_parse_result structureBrian Masney1-5/+0
The structure tsl2x7x_parse_result is not used so this patch removes its definition. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-21staging: iio: tsl2x7x: migrate *_thresh_period sysfs attributes to iio_event_specBrian Masney1-144/+52
The sysfs attributes in_intensity0_thresh_period and in_proximity0_thresh_period are currently directly created by the driver. This patch migrates the creation of these sysfs attributes from the driver to using the IIO core via iio_event_spec. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09staging: iio: adc: ad7192: use driver private lock to protect hardware state changesAastha Gupta1-2/+7
The IIO subsystem is redefining iio_dev->mlock to be used by the IIO core only for protecting device operating mode changes. ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes. In this driver, mlock was being used to protect hardware state changes. Replace it with a driver private lock. Also, as there are state changes in the ad7192_ write_raw function, a lock is added to prevent the concurrent state changes. Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09staging: iio: ade7753: expanding buffer lock to cover both buffer and state protectionHimanshi Jain1-11/+18
Dropping the extra lock (used for protecting the write frequency) by expanding the buffer lock to cover both buffer and state protection. Doing this by introducing a new function (__ade7753_spi_write_reg_16) making buffer changes without locking the state, to avoid nested locks while making device frequency changes. Signed-off-by: Himanshi Jain <himshijain.hj@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09staging: iio: tsl2x7x: migrate in_illuminance0_integration_time sysfs attribute to iio_chan_specBrian Masney1-48/+17
The driver explicitly creates the in_illuminance0_integration_time sysfs attribute outside the IIO core. This attribute is available in the IIO core so this patches migrates the attribute to be created by the iio_chan_spec. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09staging: iio: tsl2x7x: rename tsl2x7x_settings variable to settingsBrian Masney1-98/+85
The length of the 'tsl2x7x_settings' variable within the tsl2X7X_chip structure makes some of the line lengths greater than 80 characters for upcoming patches. This patch shortens the name of the 'tsl2x7x_settings' variable in this structure to just 'settings' to improve code readability. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09Merge 4.14-rc4 into staging-nextGreg Kroah-Hartman1-3/+1
We want the staging/iio fixes in here as well to handle merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-30staging: iio: ade7759: fix signed extension bug on shift of a u8Colin Ian King1-1/+1
The current shift of st->rx[2] left shifts a u8 24 bits left, promotes the integer to a an int and then to a unsigned u64. If the top bit of st->rx[2] is set then we end up with all the upper bits being set to 1. Fix this by casting st->rx[2] to a u64 before the 24 bit left shift. Detected by CoverityScan CID#144940 ("Unintended sign extension") Fixes: 2919fa54ef64 ("staging: iio: meter: new driver for ADE7759 devices") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-09-24staging: iio: ad7192: Fix - use the dedicated reset function avoiding dma from stack.Stefan Popa1-3/+1
Depends on: 691c4b95d1 ("iio: ad_sigma_delta: Implement a dedicated reset function") SPI host drivers can use DMA to transfer data, so the buffer should be properly allocated. Keeping it on the stack could cause an undefined behavior. The dedicated reset function solves this issue. Signed-off-by: Stefan Popa <stefan.popa@analog.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-09-24Staging: iio: meter: ade7759: update locking method for write frequencyKatie Dunne1-8/+19
iio_dev->mlock is to be used only by the IIO core for protecting device mode changes between INDIO_DIRECT and INDIO_BUFFER. This patch replaces the use of mlock with the already established buf_lock mutex. Introducing an 'unlocked' spi_write_reg_16 function to be used by ade7759_write_frequency avoids nested locks and maintains atomicity between bus and device frequency changes. Based on the solution found in ade7754 patch here: https://marc.info/?l=linux-iio&m=149086659008991&w=2 Signed-off-by: Katie Dunne <kdunne@mail.ccsf.edu> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-09-24staging: iio: ade7753: replace mlock with driver private lockHimanshi Jain1-2/+5
Replace driver usage of mlock with driver private lock to meet the new model where usage of iio_dev->mlock is being redefined as protecting operating mode changes(changes between BUFFER* and DIRECT modes). Signed-off-by: Himanshi Jain <himshijain.hj@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-09-24staging: iio: tsl2x7x: clean up limit checksDan Carpenter2-10/+13
The background of this code is that we can either use the default tables or load our own table with sysfs. The default tables are three element arrays of struct tsl2x7x_lux. If we load the table with sysfs then we can have as many as nine elements. Which ever way we do it, the last element is always zeroed out. The most interesting part of this patch is in the in_illuminance0_lux_table_show() function. We were using the wrong limit, "TSL2X7X_MAX_LUX_TABLE_SIZE * 3", when it should have been just "TSL2X7X_MAX_LUX_TABLE_SIZE". This creates a static checker warning that we are going of bounds. However, since the last element is always zeroed out, that means we hit the break statement and the code works correctly despite the wrong limit check. I made several related readability changes. The most notable that I changed the MAX_DEFAULT_TABLE_BYTES define which was: I renamed the define to TSL2X7X_DEFAULT_TABLE_BYTES because it's not the max size, it's the only size. Also the size should really be expressed as sizeof(struct tsl2x7x_lux) * 3. In other words, 12 * 3 instead of 4 * 9. It's 36 bytes either way, so this doesn't change the behavior. Finally, I created the TSL2X7X_DEF_LUX_TABLE_SZ define instead of using the magic number 3. I declared the default tables using that define to hopefully signal to future programmers that if they want to use a different size they have to update all the related code. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-09-03staging: iio: tsl2x7x: constify i2c_device_idArvind Yadav1-1/+1
i2c_device_id are not supposed to change at runtime. All functions working with i2c_device_id provided by <linux/i2c.h> work with const i2c_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-09-03staging:iio:docs: drop setting of THIS_MODULE from staging docs.Jonathan Cameron1-3/+0
These docs need to be cleaned up properly, but for now lets drop this entry as it is definitely no longer true. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-09-03staging:iio:docs: drop reference to setting trig_ops->ownerJonathan Cameron1-4/+0
Whilst these docs have lots of other flaws, this element is definitely no longer true. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-08-22staging:iio:light:tsl2x7x drop assignment of driver_moduleJonathan Cameron1-5/+0
The equivalent is now done via macro magic in the register call. Note this is the only case not found by the coccinelle script suggesting that perhaps that script needs to be a little more clever! Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-08-22staging:trigger: drop assignment of iio_trigger_ops.ownerJonathan Cameron1-1/+0
The equivalent of this is now done via macro magic when the relevant register call is made. The actual structure elements will shortly go away. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-08-22iio:resolver: drop assignment of iio_info.driver_moduleJonathan Cameron3-3/+0
The equivalent is now done via macro magic when the relevant register call is made. The actual structure elements will shortly go away. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-08-22staging:iio:meter: drop assign iio_info.driver_module and iio_trigger_ops.ownerJonathan Cameron6-6/+0
The equivalent of both of these are now done via macro magic when the relevant register calls are made. The actual structure elements will shortly go away. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-08-22staging:iio:ad5933: drop assign iio_info.driver_moduleJonathan Cameron1-1/+0
The equivalent of this is now done via macro magic when the relevant register call is made. The actual structure elements will shortly go away. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-08-22staging:iio:gyro:adis16060 drop assign iio_info.driver_moduleJonathan Cameron1-1/+0
The equivalent of this is now done via macro magic when the relevant register call is made. The actual structure elements will shortly go away. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-08-22staging:iio:frequency: drop assign iio_info.driver_moduleJonathan Cameron2-3/+0
The equivalent of this is now done via macro magic when the relevant register call is made. The actual structure elements will shortly go away. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-08-22staging:iio:cdc: drop assign iio_info.driver_moduleJonathan Cameron3-3/+0
The equivalent of this is now done via macro magic when the relevant register call is made. The actual structure elements will shortly go away. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>