summaryrefslogtreecommitdiffstats
path: root/drivers
Commit message (Collapse)AuthorAgeFilesLines
* iio: accel: adxl372: Fix push to buffers lost samplesStefan Popa2019-10-091-2/+1
| | | | | | | | | | | One in two sample sets was lost by multiplying fifo_set_size with sizeof(u16). Also, the double number of available samples were pushed to the iio buffers. Signed-off-by: Stefan Popa <stefan.popa@analog.com> Fixes: f4f55ce38e5f ("iio:adxl372: Add FIFO and interrupts support") Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: accel: adxl372: Fix/remove limitation for FIFO samplesStefan Popa2019-10-091-3/+8
| | | | | | | | | | | | Currently, the driver sets the FIFO_SAMPLES register with the number of sample sets (maximum of 170 for 3 axis data, 256 for 2-axis and 512 for single axis). However, the FIFO_SAMPLES register should store the number of samples, regardless of how the FIFO format is configured. Signed-off-by: Stefan Popa <stefan.popa@analog.com> Fixes: f4f55ce38e5f ("iio:adxl372: Add FIFO and interrupts support") Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: hx711: fix bug in sampling of dataAndreas Klinger2019-10-091-5/+5
| | | | | | | | | | | | | | | | | Fix bug in sampling function hx711_cycle() when interrupt occures while PD_SCK is high. If PD_SCK is high for at least 60 us power down mode of the sensor is entered which in turn leads to a wrong measurement. Switch off interrupts during a PD_SCK high period and move query of DOUT to the latest point of time which is at the end of PD_SCK low period. This bug exists in the driver since it's initial addition. The more interrupts on the system the higher is the probability that it happens. Fixes: c3b2fdd0ea7e ("iio: adc: hx711: Add IIO driver for AVIA HX711") Signed-off-by: Andreas Klinger <ak@it-klinger.de> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: fix center temperature of bmc150-accel-corePascal Bouwmann2019-09-081-1/+1
| | | | | | | | | | | | The center temperature of the supported devices stored in the constant BMC150_ACCEL_TEMP_CENTER_VAL is not 24 degrees but 23 degrees. It seems that some datasheets were inconsistent on this value leading to the error. For most usecases will only make minor difference so not queued for stable. Signed-off-by: Pascal Bouwmann <bouwmann@tau-tec.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: imu: st_lsm6dsx: forbid 0 sensor sensitivityLorenzo Bianconi2019-09-083-16/+25
| | | | | | | | | Do not allow configuring null sensor gain since it will force to 0 device outputs Fixes: c8d4066c7246 ("iio: imu: st_lsm6dsx: remove invalid gain value for LSM9DS1") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: meson_saradc: Fix memory allocation orderRemi Pommarel2019-09-081-5/+5
| | | | | | | | | | | | | | | | | | meson_saradc's irq handler uses priv->regmap so make sure that it is allocated before the irq get enabled. This also fixes crash when CONFIG_DEBUG_SHIRQ is enabled, as device managed resources are freed in the inverted order they had been allocated, priv->regmap was freed before the spurious fake irq that CONFIG_DEBUG_SHIRQ adds called the handler. Fixes: 3af109131b7eb8 ("iio: adc: meson-saradc: switch from polling to interrupt mode") Reported-by: Elie Roudninski <xademax@gmail.com> Signed-off-by: Remi Pommarel <repk@triplefau.lt> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Tested-by: Elie ROUDNINSKI <xademax@gmail.com> Reviewed-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* staging: rtl8723bs: hal: remove redundant variable nColin Ian King2019-09-061-4/+2
| | | | | | | | | | | | | The variable n is being assigned a value that is never read inside an if statement block, the assignment is redundant and can be removed. With this removed, n is only being used for a constant loop bounds check, so replace n with that value instead and remove n completely. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20190905152227.4610-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: pi433: Fix typo in documentationRohit Sarkar2019-09-061-1/+1
| | | | | | | | Fixes a typo in the documentation. Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com> Link: https://lore.kernel.org/r/20190905132219.GA1004@SARKAR Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: exfat: stop using 32-bit time_tArnd Bergmann2019-09-061-126/+38
| | | | | | | | | | | time_t suffers from overflow problems and should not be used. In exfat, it is currently used in two open-coded time64_to_tm() implementations. Changes those to use the existing function instead. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20190906150917.1025250-2-arnd@arndb.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: exfat: stopusing CONFIG_FAT_DEFAULT_IOCHARSETArnd Bergmann2019-09-061-5/+2
| | | | | | | | | | | | | | | When CONFIG_VFAT_FS is disabled, the reference to CONFIG_FAT_DEFAULT_IOCHARSET causes a link failure: drivers/staging/exfat/exfat_super.c:46:41: error: use of undeclared identifier 'CONFIG_FAT_DEFAULT_IOCHARSET' static char exfat_default_iocharset[] = CONFIG_FAT_DEFAULT_IOCHARSET; I could not figure out why the correct code is commented out, but using that fixes the problem. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20190906150917.1025250-1-arnd@arndb.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* iio: hid-sensor-attributes: Fix divisions for 32-bit platformsAndy Shevchenko2019-09-061-14/+28
| | | | | | | | | | | | | | | | | | | | | | | | The commit 473d12f7638c ("iio: hid-sensor-attributes: Convert to use int_pow()") converted to use generic int_pow() helper. Though, the generic one returns 64-bit value and, in cases when it is used as divisor, it compels 64-bit division from compiler. In order to fix this, introduce a temporary 32-bit variable to hold the result of int_pow() and use it as divisor afterwards. In couple of cases, replace int_pow() with a predefined unit factors for time and frequency. Fixes: 473d12f7638c ("iio: hid-sensor-attributes: Convert to use int_pow()") Reported-by: kbuild test robot <lkp@intel.com> Reported-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Link: https://lore.kernel.org/r/20190905112759.13035-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: rtl8723bs: Remove return statement from void functionLeandro Ribeiro2019-09-051-1/+0
| | | | | | | | | | Fix the following checkpatch warning: "WARNING: void function return statements are not generally useful" Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net> Link: https://lore.kernel.org/r/20190904210631.13599-1-leandrohr@riseup.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: rtl8192e: remove unnecessary blank lineBeatriz Martins de Carvalho2019-09-051-1/+0
| | | | | | | | | | Fix checkpath error "CHECK: Blank lines aren't necessary after an open brace '{'" in rtllib.h:482. Signed-off-by: Beatriz Martins de Carvalho <martinsdecarvalhobeatriz@gmail.com> Link: https://lore.kernel.org/r/20190904210326.17983-1-martinsdecarvalhobeatriz@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: exfat: Use kmemdup in exfat_symlink()YueHaibing2019-09-051-2/+1
| | | | | | | | Use kmemdup rather than duplicating its implementation Signed-off-by: YueHaibing <yuehaibing@huawei.com> Link: https://lore.kernel.org/r/20190905030047.88401-1-yuehaibing@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: exfat: remove unused including <linux/version.h>YueHaibing2019-09-051-1/+0
| | | | | | | | Remove including <linux/version.h> that don't need it. Signed-off-by: YueHaibing <yuehaibing@huawei.com> Link: https://lore.kernel.org/r/20190905025623.63210-1-yuehaibing@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: exfat: remove duplicated include from exfat_super.cYueHaibing2019-09-051-1/+0
| | | | | | | | Remove duplicated include. Signed-off-by: YueHaibing <yuehaibing@huawei.com> Link: https://lore.kernel.org/r/20190905025608.61884-1-yuehaibing@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: exfat: remove the redundant check when kfree an object in ↵zhong jiang2019-09-041-2/+1
| | | | | | | | | | | | exfat_destroy_inode kfree has taken the null check in account. hence it is unnecessary to add the null check before kfree the object. Just remove it. Reported-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: zhong jiang <zhongjiang@huawei.com> Link: https://lore.kernel.org/r/1567591408-24268-1-git-send-email-zhongjiang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: exfat: Fix two missing unlocks on error pathsDan Carpenter2019-09-041-2/+4
| | | | | | | | These two error paths need to unlock before we can return. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20190904095908.GA7007@mwanda Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: exfat: cleanup explicit comparisons to NULLValentin Vidic2019-09-042-46/+46
| | | | | | | | | | | Fixes checkpatch.pl warnings: CHECK: Comparison to NULL could be written "expr" CHECK: Comparison to NULL could be written "!expr" Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr> Link: https://lore.kernel.org/r/20190903205659.18856-1-vvidic@valentin-vidic.from.hr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: rtl8723bs: Use kzfree rather than its implementationzhong jiang2019-09-041-2/+1
| | | | | | | | Use kzfree instead of memset() + kfree(). Signed-off-by: zhong jiang <zhongjiang@huawei.com> Link: https://lore.kernel.org/r/1567566079-7412-4-git-send-email-zhongjiang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Merge tag 'iio-for-5.4b-take3' of ↵Greg Kroah-Hartman2019-09-0321-213/+489
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: Second set of new device support, cleanups and features for IIO in the 5.4 cycle Revised pull request to fix up a missing Signed-off-by and roll in a fix in the lsm9ds1 support after I broke it when applying. Revised again because the fix changed a hash meaning a fix that previously followed it now had the wrong fixes tag. A few fixes in here that could have gone a faster path but aren't quite worth the rush for 5.3. New device support * ad7606 - Support the ad7606b which adds a software controlled mode alongside the pin controlled only approach of the ad7606. Including dt-bindings. * lsm6dsx - Add support for the gyro and accelerometer part of the lsm9ds1 which is a compound device also including a magnetometer (st_sensors driver). Includes bindings and precursor rework of the driver. Features * ad7192 - Add support for low pass filter control. - DT binding docs. Cleanups and minor fixes * MAINTAINERS - Fix a typo in a path. - Add entry for ad7606 * ad5380 - Fix a failure to dereference a pointer before atempting to assign the value. * ad7192 - Drop platform data as not used in mainline and we now have full DT bindings. * ad7606 - YAML conversion for dt-bindings. * adis16240 - Rework write_raw to make it more readable using GENMASK. * adis16460 - Fix and issue with an unsigned variable holding potential negatives. * cros_ec - Fix missing default of calibration vector so that we get 'something' before calibration is complete on a given axis. * hid-sensors - Use int_pow instead of opencoding. * isl29501 - rename dt-binding docs to include renesas inline with other renesas parts and general current convention. * kxcjk1013 - Improve comments on the 'unusual' ACPI ids used to identify which sensor is which in certain laptops. * lsm6dsx - Add one bit to the fifo status masks for a number of parts. - Drop a reserved entry from the sensitivity values to tidy up interface. - Use core conversion macro from G to m/s^2 for lsm9ds1 to make it easier to relate to the datasheet and consistent with other parts supported. * max1027 - Use device managed APIs to avoid manual error handling and cleanup. * rfd77402 - Typo in Kconfig help. * sc27xx - Switch to polling mode from interrupts as interrupt handling typically to slow for very short sleeps. * st-sensors - Fix some missing selects for regmap. * tools - Add a .gitignore containing the binary outputs. * tag 'iio-for-5.4b-take3' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (27 commits) iio: imu: st_lsm6dsx: rely on IIO_G_TO_M_S_2 for gain definition for LSM9DS1 iio: imu: st_lsm6dsx: remove invalid gain value for LSM9DS1 iio: cros_ec: set calibscale for 3d MEMS to unit vector iio: dac: ad5380: fix incorrect assignment to val iio: imu: st_lsm6dsx: Fix FIFO diff mask for tagged fifo dt-bindings: iio: imu: st_lsm6dsx: add lsm9ds1 device bindings iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1 iio: imu: st_lsm6dsx: move register definitions to sensor_settings struct iio: imu: st_lsm6dsx: introduce update_fifo function pointer dt-bindings: iio: light: isl29501: Rename bindings documentation file Kconfig: Fix the reference to the RFD77402 ToF sensor in the 'help' section iio: st_sensors: Fix build error dt-bindings: iio: adc: Add AD7606B ADC documentation dt-bindings: iio: adc: Migrate AD7606 documentation to yaml MAINTAINERS: Add Beniamin Bia for AD7606 driver iio: adc: ad7606: Add support for AD7606B ADC tools: iio: add .gitignore iio: adc: sc27xx: Change to polling mode to read data iio: hid-sensor-attributes: Convert to use int_pow() iio: adc: max1027: Use device-managed APIs ...
| * iio: imu: st_lsm6dsx: rely on IIO_G_TO_M_S_2 for gain definition for LSM9DS1Lorenzo Bianconi2019-09-031-4/+4
| | | | | | | | | | | | | | Rely on IIO_G_TO_M_S_2 macro for LSM9DS1 accelerometer gain definitions Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: imu: st_lsm6dsx: remove invalid gain value for LSM9DS1Lorenzo Bianconi2019-09-031-6/+11
| | | | | | | | | | | | | | | | Get rid of invalid sensitivity value for LSM9DS1 gyro sensor Fixes: 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: cros_ec: set calibscale for 3d MEMS to unit vectorGwendal Grignou2019-09-031-1/+4
| | | | | | | | | | | | | | | | | | | | | | By default, set the calibscale vector to unit vector. When calibrating one axis, the other axis calibrations are sent as well. If left to 0, sensor data from uncalibrated axis are zero'ed out until all axis are calibrated. Fixes: ed1f2e85da79 ("iio: cros_ec: Add calibscale for 3d MEMS ") Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: dac: ad5380: fix incorrect assignment to valColin Ian King2019-09-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Currently the pointer val is being incorrectly incremented instead of the value pointed to by val. Fix this by adding in the missing * indirection operator. Addresses-Coverity: ("Unused value") Fixes: c03f2c536818 ("staging:iio:dac: Add AD5380 driver") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: imu: st_lsm6dsx: Fix FIFO diff mask for tagged fifomario tesi2019-09-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to the latest version of datasheet the mask for number of unread sensor data in FIFO_STATUS registers has been extended to 10 bits The devices involved are: - LSM6DSO - LSM6DSOX - ASM330LHH - LSM6DSR - ISM330DHCX Signed-off-by: mario tesi <mario.tesi@st.com> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1Martin Kepplinger2019-09-035-1/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The LSM9DS1's accelerometer / gyroscope unit and it's magnetometer (separately supported in iio/magnetometer/st_magn*) are located on a separate i2c addresses on the bus. For the datasheet, see https://www.st.com/resource/en/datasheet/lsm9ds1.pdf Treat it just like the LSM6* devices and, despite it's name, hook it up to the st_lsm6dsx driver, using it's basic functionality. accelerometer and gyroscope are not independently clocked. It runs at the gyro frequencies if both are enabled, see chapter 7.12 of the datasheet. We could have handled this as a single IIO device but we have split it up to be more consistent with the other more flexible devices. Despite supporting and testing the LSM9DS1, we call the gyro channels iio_chan_spec struct "st_lsm6ds0_gyro_channels" because the register description is equal. This suggests that supporting LSM6DS0 should be trivial to do. Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: imu: st_lsm6dsx: move register definitions to sensor_settings structMartin Kepplinger2019-08-272-9/+28
| | | | | | | | | | | | | | | | | | | | | | | | Move some register definitions to the per-device array of struct st_lsm6dsx_sensor_settings in order to simplify adding new sensor devices to the driver. Also, remove completely unused register definitions. Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: imu: st_lsm6dsx: introduce update_fifo function pointerLorenzo Bianconi2019-08-263-4/+25
| | | | | | | | | | | | | | | | | | | | Introduce update_fifo routine pointer in st_lsm6dsx_fifo_ops data structure since we will need a different update FIFO configuration callback adding support for lsm6ds0/lsm9ds1 imu device Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Tested-by: Martin Kepplinger <martin.kepplinger@puri.sm> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * Kconfig: Fix the reference to the RFD77402 ToF sensor in the 'help' sectionChristophe JAILLET2019-08-251-1/+1
| | | | | | | | | | | | | | This should be RFD77402, not RFD77420. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: st_sensors: Fix build errorYueHaibing2019-08-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IIO_ST_SENSORS_CORE select IIO_ST_SENSORS_I2C unconditionally, if REGMAP_I2C is not set, build fails drivers/iio/common/st_sensors/st_sensors_i2c.o: In function `st_sensors_i2c_configure': st_sensors_i2c.c:(.text+0x58): undefined reference to `__devm_regmap_init_i2c' This patch selects REGMAP_I2C to fix it. IIO_ST_SENSORS_SPI is similar to SPI issue. Reported-by: Hulk Robot <hulkci@huawei.com> Fixes: 062809ef7733 ("iio: make st_sensors drivers use regmap") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7606: Add support for AD7606B ADCStefan Popa2019-08-253-3/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The AD7606B is a 16-bit ADC that supports simultaneous sampling of 8 channels. It is pin compatible to AD7606, but adds extra modes by writing to the register map. The AD7606B can be configured to work in software mode by setting all oversampling pins to high. This mode is selected by default. The oversampling ratio is configured from the OS_MODE register (address 0x08) with the addition of OS=128 and OS=256 that were not available in hardware mode. The device is configured to output data on a single spi channel, but this configuration must be done right after restart. That is why the delay was removed for devices which doesn't require it. Moreover, in software mode, the range gpio has no longer its function. Instead, the scale can be configured individually for each channel from the RANGE_CH registers (address 0x03 to 0x06). Besides the already supported ±10 V and ±5 V ranges, software mode can also accommodate the ±2.5 V range. Signed-off-by: Stefan Popa <stefan.popa@analog.com> Co-developed-by: Beniamin Bia <beniamin.bia@analog.com> Signed-off-by: Beniamin Bia <beniamin.bia@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: sc27xx: Change to polling mode to read dataFreeman Liu2019-08-181-54/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | On Spreadtrum platform, the headphone will read one ADC channel multiple times to identify the headphone type, and the headphone identification is sensitive of the ADC reading time. And we found it will take longer time to reading ADC data by using interrupt mode comparing with the polling mode, thus we should change to polling mode to improve the efficiency of reading data, which can identify the headphone type successfully. Signed-off-by: Freeman Liu <freeman.liu@unisoc.com> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: hid-sensor-attributes: Convert to use int_pow()Andy Shevchenko2019-08-181-31/+22
| | | | | | | | | | | | | | | | Instead of linear approach to calculate power of 10, use generic int_pow() which does it better. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: max1027: Use device-managed APIsChuhong Yuan2019-08-181-31/+7
| | | | | | | | | | | | | | Use device-managed APIs to simplify the code. Signed-off-by: Chuhong Yuan <hslester96@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * staging: iio: accel: adis16240: Improve readability on write_raw functionRodrigo Ribeiro2019-08-181-4/+1
| | | | | | | | | | | | | | | | | | Replace shift and minus operation by GENMASK macro and remove the local variables used to store intermediate data. Signed-off-by: Rodrigo Ribeiro Carvalho <rodrigorsdc@gmail.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * staging: iio: adc: ad7192: Add low_pass_3db_filter_frequencyMircea Caprioru2019-08-181-16/+133
| | | | | | | | | | | | | | | | | | By adding this option we are able to remove the sync3 field and dt binding. When setting the required cutoff frequency we also determine the ADC configuration for chop and sync filter. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * staging: iio: adc: ad7192: Remove platform dataMircea Caprioru2019-08-182-49/+2
| | | | | | | | | | | | | | | | | | | | | | | | This patch removes the reference voltage entry from the platform_data structure. This is no longer needed since the reference voltage is obtained from the device tree. With this we also remove the entire ad7192.h file. The undefined reference voltage warning is promoted to an error signaling a problem with the device tree. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: imu: adis16460: fix variable signednessAlexandru Ardelean2019-08-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Caught via static-analysis checker: ``` drivers/iio/imu/adis16460.c 152 static int adis16460_set_freq(struct iio_dev *indio_dev, int val, int val2) 153 { 154 struct adis16460 *st = iio_priv(indio_dev); 155 unsigned int t; ^^^^^^^^^^^^^^ 156 157 t = val * 1000 + val2 / 1000; 158 if (t <= 0) ^^^^^^ Unsigned is not less than zero. ``` The types of `val` && `val2` are obtained from the IIO `write_raw` hook, so userspace can provide negative values, which can cause weird behavior after conversion to unsigned. This patch changes the sign of variable `t` so that -EINVAL will be returned for negative values as well. Fixes: db6ed4d23dd1 ("iio: imu: Add support for the ADIS16460 IMU") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: accel: kxcjk1013: Improve comments on KIOX010A and KIOX020A ACPI idsHans de Goede2019-08-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The KIOX010A and KIOX020A ACPI ids go hand in hand, they are used in yoga style 2-in-1s, with KIOX010A indicating the KXCJ91008 sensor in the display of the 2-in-1 and KIOX020A indicating the KXCJ91008 sensor in the base. Improve the existing comment on the "KIOX010A" kx_acpi_match table entry to make clear we are talking about a yoga-style (360 degree hinges) device here and add a similar comment to the "KIOX020A" entry. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | staging: exfat: drop local TRUE/FALSE definesValentin Vidic2019-09-034-51/+53
| | | | | | | | | | | | | | | | | | | | Replace with bool where it makes sense. Also drop unused local variable lossy in fat_find_dir_entry. Reported-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr> Link: https://lore.kernel.org/r/20190903185537.25099-1-vvidic@valentin-vidic.from.hr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | staging: exfat: fix spelling errors in commentsValentin Vidic2019-09-032-2/+2
| | | | | | | | | | | | | | | | | | | | | | Fixes checkpatch.pl warnings: CHECK: 'consistancy' may be misspelled - perhaps 'consistency'? CHECK: 'stuct' may be misspelled - perhaps 'struct'? Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr> Link: https://lore.kernel.org/r/20190903165408.16010-1-vvidic@valentin-vidic.from.hr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | staging: exfat: cleanup braces for if/else statementsValentin Vidic2019-09-032-13/+15
| | | | | | | | | | | | | | | | | | | | | | Fixes checkpatch.pl warnings: CHECK: Unbalanced braces around else statement CHECK: braces {} should be used on all arms of this statement Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr> Link: https://lore.kernel.org/r/20190903164732.14194-1-vvidic@valentin-vidic.from.hr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | staging: rtl8723bs: replace __inline by inlineRasmus Villemoes2019-09-0310-42/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, __inline is #defined as inline in compiler_types.h, so this should not change functionality. It is preparation for removing said #define. While at it, change some "inline static" to the customary "static inline" order. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Link: https://lore.kernel.org/r/20190830231527.22304-2-linux@rasmusvillemoes.dk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | staging: r8188eu: use skb_put_data instead of skb_put/memcpy pairIvan Safonov2019-09-032-7/+2
| | | | | | | | | | | | | | | | skb_put_data is shorter and clear. Signed-off-by: Ivan Safonov <insafonov@gmail.com> Link: https://lore.kernel.org/r/20190901195301.GA16043@alpha Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | staging: kpc2000: Fix long constant sparse warningHarsh Jain2019-09-033-22/+22
| | | | | | | | | | | | | | | | | | It fixed following warning in kpc2000 driver "constant XXXX is so big it is unsigned long" Signed-off-by: Harsh Jain <harshjain32@gmail.com> Link: https://lore.kernel.org/r/20190831115532.2398-1-harshjain32@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | staging: exfat: check for null return from call to FAT_getblkColin Ian King2019-09-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | A call to FAT_getblk is missing a null return check which can lead to a null pointer dereference. Fix this by adding a null check to match all the other FAT_getblk return sanity checks. Addresses-Coverity: ("Dereference null return") Fixes: c48c9f7ff32b ("staging: exfat: add exfat filesystem code to staging") Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20190830175050.12706-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | staging: greybus: light: fix a couple double freesDan Carpenter2019-09-031-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is in gb_lights_request_handler(). If we get a request to change the config then we release the light with gb_lights_light_release() and re-allocated it. However, if the allocation fails part way through then we call gb_lights_light_release() again. This can lead to a couple different double frees where we haven't cleared out the original values: gb_lights_light_v4l2_unregister(light); ... kfree(light->channels); kfree(light->name); I also made a small change to how we set "light->channels_count = 0;". The original code handled this part fine and did not cause a use after free but it was sort of complicated to read. Fixes: 2870b52bae4c ("greybus: lights: add lights implementation") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Link: https://lore.kernel.org/r/20190829122839.GA20116@mwanda Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | staging: rts5208: Fix checkpath warningP SAI PRASANTH2019-09-031-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the following checkpath warning in the file drivers/staging/rts5208/rtsx_transport.c:546 WARNING: line over 80 characters + option = RTSX_SG_VALID | RTSX_SG_END | RTSX_SG_TRANS_DATA; Signed-off-by: P SAI PRASANTH <saip2823@gmail.com> Link: https://lore.kernel.org/r/20190831034926.GA17810@dell-inspiron Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | staging: rts5208: Fixed checkpath warning.Prakhar Sinha2019-09-031-4/+3
| | | | | | | | | | | | | | | | | | | | | | This patch solves the following checkpatch.pl's message in drivers/staging/rts5208/rtsx_transport.c:397. WARNING: line over 80 characters + option = RTSX_SG_VALID | RTSX_SG_END | RTSX_SG_TRANS_DATA; Signed-off-by: Prakhar Sinha <prakharsinha2808@gmail.com> Link: https://lore.kernel.org/r/20190830121656.GA2740@MeraComputer Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>