OSDN Git Service

tomoyo/tomoyo-test1.git
4 years agoiio: pressure: bmp280: remove stray newline
Bartosz Golaszewski [Wed, 2 Oct 2019 08:57:58 +0000 (10:57 +0200)]
iio: pressure: bmp280: remove stray newline

Remove a stray newline from the probe callback.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: sc27xx: Use devm_hwspin_lock_request_specific() to simplify code
Baolin Wang [Fri, 27 Sep 2019 02:41:19 +0000 (10:41 +0800)]
iio: adc: sc27xx: Use devm_hwspin_lock_request_specific() to simplify code

Change to use devm_hwspin_lock_request_specific() to help to simplify the
cleanup code for drivers requesting one hwlock.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: chemical: atlas-ph-sensor: fix iio_triggered_buffer_predisable() position
Alexandru Ardelean [Fri, 20 Sep 2019 07:31:22 +0000 (10:31 +0300)]
iio: chemical: atlas-ph-sensor: fix iio_triggered_buffer_predisable() position

The iio_triggered_buffer_{predisable,postenable} functions attach/detach
the poll functions.

The iio_triggered_buffer_predisable() should be called last, to detach the
poll func after the devices has been suspended.

The position of iio_triggered_buffer_postenable() is correct.

Note this is not stable material. It's a fix in the logical
model rather fixing an actual bug.  These are being tidied up
throughout the subsystem to allow more substantial rework that
was blocked by variations in how things were done.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: gyro: clean up indentation issue
Colin Ian King [Wed, 25 Sep 2019 12:32:53 +0000 (13:32 +0100)]
iio: gyro: clean up indentation issue

There is a return statement that is indented incorrectly, add in
the missing tab.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agocounter: stm32: clean up indentation issue
Colin Ian King [Wed, 25 Sep 2019 09:51:26 +0000 (10:51 +0100)]
counter: stm32: clean up indentation issue

There is an if statement that is indented one level too deeply,
remove the extraneous tabs.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: proximity: sx9500: fix iio_triggered_buffer_{predisable,postenable} positions
Alexandru Ardelean [Fri, 20 Sep 2019 08:35:13 +0000 (11:35 +0300)]
iio: proximity: sx9500: fix iio_triggered_buffer_{predisable,postenable} positions

The iio_triggered_buffer_predisable() should be called last, to detach the
poll func after the devices has been suspended.

This change re-organizes things a bit so that the postenable & predisable
are symmetrical. It also converts the preenable() to a postenable().

Not stable material as there is no known problem with the current
code, it's just not consistent with the form we would like all the
IIO drivers to adopt so as to allow subsystem wide changes.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: core: Add optional symbolic label to device attributes
Phil Reid [Thu, 19 Sep 2019 14:36:08 +0000 (22:36 +0800)]
iio: core: Add optional symbolic label to device attributes

If a label is defined in the device tree for this device add that
to the device specific attributes. This is useful for userspace to
be able to identify an individual device when multiple identical
chips are present in the system.

Tested-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-binding: iio: Add optional label property
Phil Reid [Thu, 19 Sep 2019 14:36:07 +0000 (22:36 +0800)]
dt-binding: iio: Add optional label property

This optional property defines a symbolic name for the device.
This helps to distinguish between more than one iio device
of the same type.

Suggested-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Phil Reid <preid@electromag.com.au>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: gyro: adis16080: replace mlock with own lock
Alexandru Ardelean [Thu, 19 Sep 2019 13:23:03 +0000 (16:23 +0300)]
iio: gyro: adis16080: replace mlock with own lock

The lock is used to protect the buffer during reads. Though the spi
routines have their own locks, it may be the case that the buffer needs to
be protected before it's stored and passed to the IIO read hooks.

indio_dev's mlock was used before.
This change replaces it with the driver's own lock.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agocounter: stm32-lptimer-cnt: fix a kernel-doc warning
Fabrice Gasnier [Wed, 18 Sep 2019 12:22:41 +0000 (14:22 +0200)]
counter: stm32-lptimer-cnt: fix a kernel-doc warning

Fix the following warnings when documentation is built:
drivers/counter/stm32-lptimer-cnt.c:354: warning: cannot understand
function prototype: 'enum stm32_lptim_cnt_function'

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Fixes: 597f55e3f36c ("counter: stm32-lptimer: add counter device")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agocounter: stm32-timer-cnt: fix a kernel-doc warning
Fabrice Gasnier [Wed, 18 Sep 2019 12:22:03 +0000 (14:22 +0200)]
counter: stm32-timer-cnt: fix a kernel-doc warning

Fix the following warning when documentation is built:
drivers/counter/stm32-timer-cnt.c:37: warning: cannot understand function
prototype: 'enum stm32_count_function'

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Fixes: ad29937e206f ("counter: Add STM32 Timer quadrature encoder")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: gyro: adis16130: remove mlock usage
Alexandru Ardelean [Tue, 17 Sep 2019 16:10:23 +0000 (19:10 +0300)]
iio: gyro: adis16130: remove mlock usage

The use of indio_dev's mlock is discouraged. The driver already defines
it's own `bus_lock` in `adis16130_spi_read()`, so using the mlock is
redundant.

The parts supported by this chip are obsoleted anyway, so for now we just
remove mlock as part of a general cleanup, until the driver gets removed.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoMAINTAINERS: add entry for ROHM BH1750 driver
Tomasz Duszynski [Mon, 16 Sep 2019 19:00:24 +0000 (21:00 +0200)]
MAINTAINERS: add entry for ROHM BH1750 driver

Add myself as a ROHM BH1750 ambient light sensor driver maintainer.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: light: bh1750: convert bindings to yaml
Tomasz Duszynski [Mon, 16 Sep 2019 19:00:23 +0000 (21:00 +0200)]
dt-bindings: iio: light: bh1750: convert bindings to yaml

Convert existing device tree bindings to yaml.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: st_lsm6dsx: add motion report function and call from interrupt
Sean Nyekjaer [Mon, 16 Sep 2019 13:56:30 +0000 (15:56 +0200)]
iio: imu: st_lsm6dsx: add motion report function and call from interrupt

Report iio motion events to iio subsystem and filter motion events.
Wakeup will still be on all channels as it's not possible to do the filtering
in hw.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: st_lsm6dsx: always enter interrupt thread
Sean Nyekjaer [Mon, 16 Sep 2019 13:56:29 +0000 (15:56 +0200)]
iio: imu: st_lsm6dsx: always enter interrupt thread

The interrupt source can come from multiple sources,
fifo and wake interrupts.
Enter interrupt thread to check which interrupt that has fired.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: st_lsm6dsx: add wakeup-source option
Sean Nyekjaer [Mon, 16 Sep 2019 13:56:28 +0000 (15:56 +0200)]
iio: imu: st_lsm6dsx: add wakeup-source option

This add ways for the SoC to wake from accelerometer wake events.

In the suspend function we skip disabling the sensor if wakeup-source
and events are activated.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: st_lsm6dsx: add motion events
Sean Nyekjaer [Mon, 16 Sep 2019 13:56:27 +0000 (15:56 +0200)]
iio: imu: st_lsm6dsx: add motion events

Add event channels that controls the creation of motion events.
Tested on ISM330DLC

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: st_lsm6dsx: move interrupt thread to core
Sean Nyekjaer [Mon, 16 Sep 2019 13:56:26 +0000 (15:56 +0200)]
iio: imu: st_lsm6dsx: move interrupt thread to core

This prepares the interrupt to be used for other stuff than
fifo reading + event readings.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: inv_mpu6050: add fifo support for magnetometer data
Jean-Baptiste Maneyrol [Mon, 16 Sep 2019 09:42:09 +0000 (09:42 +0000)]
iio: imu: inv_mpu6050: add fifo support for magnetometer data

Put read magnetometer data by mpu inside the fifo.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: inv_mpu6050: add MPU925x magnetometer support
Jean-Baptiste Maneyrol [Mon, 16 Sep 2019 09:42:07 +0000 (09:42 +0000)]
iio: imu: inv_mpu6050: add MPU925x magnetometer support

Add support of driving MPU9250 magnetometer connected on i2c
auxiliary bus using the MPU i2c master.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: inv_mpu6050: helpers for using i2c master on auxiliary bus
Jean-Baptiste Maneyrol [Mon, 16 Sep 2019 09:42:05 +0000 (09:42 +0000)]
iio: imu: inv_mpu6050: helpers for using i2c master on auxiliary bus

Add helper functions to use the i2c auxiliary bus with the MPU i2c
master block.

Support only register based chip, reading and 1 byte writing. These
will be useful for initializing magnetometers inside MPU9x50 chips.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: inv_mpu6050: fix objects syntax in Makefile
Jean-Baptiste Maneyrol [Mon, 16 Sep 2019 09:42:04 +0000 (09:42 +0000)]
iio: imu: inv_mpu6050: fix objects syntax in Makefile

Use the correct syntax *-y for declaring object files.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: inv_mpu6050: add defines for supporting 9-axis chips
Jean-Baptiste Maneyrol [Mon, 16 Sep 2019 09:42:02 +0000 (09:42 +0000)]
iio: imu: inv_mpu6050: add defines for supporting 9-axis chips

Add registers defines required for driving chip i2c master ip.
Add MPU9xxx magnetometer scan elements and update data bytes size.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: inv_mpu6050: add header include protection macro
Jean-Baptiste Maneyrol [Mon, 16 Sep 2019 09:42:00 +0000 (09:42 +0000)]
iio: imu: inv_mpu6050: add header include protection macro

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: inv_mpu6050: disable i2c mux for MPU925x
Jean-Baptiste Maneyrol [Mon, 16 Sep 2019 09:41:58 +0000 (09:41 +0000)]
iio: imu: inv_mpu6050: disable i2c mux for MPU925x

Disable i2c mux for supported 9xxx chips. This is a
pre-requesite for controling 9xxx magnetometer using the
i2c master of the chip.

Check in device-tree that there is no i2c-gate device declared
for ensuring backward compatibility with existing setups.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: ad7949: fix incorrect SPI xfer len
Andrea Merello [Thu, 12 Sep 2019 14:43:08 +0000 (16:43 +0200)]
iio: ad7949: fix incorrect SPI xfer len

This driver supports 14-bits and 16-bits devices. All of them have a 14-bit
configuration registers. All SPI trasfers, for reading AD conversion
results and for writing the configuration register, fit in two bytes.

The driver always uses 4-bytes xfers which seems at least pointless (maybe
even harmful). This patch trims the SPI xfer len and the buffer size to
two bytes.

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: tcs3414: fix iio_triggered_buffer_{pre,post}enable positions
Alexandru Ardelean [Fri, 20 Sep 2019 07:57:23 +0000 (10:57 +0300)]
iio: tcs3414: fix iio_triggered_buffer_{pre,post}enable positions

The iio_triggered_buffer_{predisable,postenable} functions attach/detach
the poll functions.

For the predisable hook, the disable code should occur before detaching
the poll func, and for the postenable hook, the poll func should be
attached before the enable code.

The driver was slightly reworked. The preenable hook was moved to the
postenable, to add some symmetry to the postenable/predisable part.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: max31856: add missing of_node and parent references to iio_dev
Andrea Merello [Mon, 9 Sep 2019 12:58:17 +0000 (14:58 +0200)]
iio: max31856: add missing of_node and parent references to iio_dev

Adding missing indio_dev->dev.of_node references so that, in case multiple
max31856 are present, users can get some clues to being able to distinguish
each of them. While at it, add also the missing parent reference.

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: st_lsm6dsx: enable clear on read for latched interrupts
Lorenzo Bianconi [Wed, 11 Sep 2019 06:50:04 +0000 (08:50 +0200)]
iio: imu: st_lsm6dsx: enable clear on read for latched interrupts

Enable clear on read feature for latched interrupts. This bit allows
immediately clearing the latched interrupts of an event detection upon
the read of the corresponding status register.
It must be set to 1 together with LIR.
This feature is available just on LSM6DS0/LSM6DSR/ASM330LHH

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: st_lsm6dsx: enable LIR for sensor events
Lorenzo Bianconi [Wed, 11 Sep 2019 06:50:03 +0000 (08:50 +0200)]
iio: imu: st_lsm6dsx: enable LIR for sensor events

Enable Latched interrupt by default for sensor events

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: ad7949: kill pointless "readback"-handling code
Andrea Merello [Thu, 12 Sep 2019 14:43:07 +0000 (16:43 +0200)]
iio: ad7949: kill pointless "readback"-handling code

The device could be configured to spit out also the configuration word
while reading the AD result value (in the same SPI xfer) - this is called
"readback" in the device datasheet.

The driver checks if readback is enabled and it eventually adjusts the SPI
xfer length and it applies proper shifts to still get the data, discarding
the configuration word.

The readback option is actually never enabled (the driver disables it), so
the said checks do not serve for any purpose.

Since enabling the readback option seems not to provide any advantage (the
driver entirely sets the configuration word without relying on any default
value), just kill the said, unused, code.

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agostaging: iio: ADIS16240: Remove unused include
Rohit Sarkar [Fri, 13 Sep 2019 20:36:27 +0000 (02:06 +0530)]
staging: iio: ADIS16240: Remove unused include

'#include<linux/gpio.h>' isn't being used anywhere. Remove it.

Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: light: bh1750: Resolve compiler warning and make code more readable
Krzysztof Wilczynski [Fri, 13 Sep 2019 20:24:13 +0000 (22:24 +0200)]
iio: light: bh1750: Resolve compiler warning and make code more readable

Separate the declaration of struct bh1750_chip_info from definition
of bh1750_chip_info_tbl[] in a single statement as it makes the code
hard to read, and with the extra newline it makes it look as if the
bh1750_chip_info_tbl[] had no explicit type.

This change also resolves the following compiler warning about the
unusual position of the static keyword that can be seen when building
with warnings enabled (W=1):

drivers/iio/light/bh1750.c:64:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

Related to commit 3a11fbb037a1 ("iio: light: add support for ROHM
BH1710/BH1715/BH1721/BH1750/BH1751 ambient light sensors").

Signed-off-by: Krzysztof Wilczynski <kw@linux.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoIIO: Ingenic JZ47xx: Add support for JZ4770 SoC ADC.
Artur Rojek [Sat, 27 Jul 2019 19:59:40 +0000 (21:59 +0200)]
IIO: Ingenic JZ47xx: Add support for JZ4770 SoC ADC.

Add support for the ADC hardware present on Ingenic JZ4770 SoC.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
Tested-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio/adc: Add AUX2 channel idx for JZ4770 SoC ADC
Artur Rojek [Sat, 27 Jul 2019 19:59:39 +0000 (21:59 +0200)]
dt-bindings: iio/adc: Add AUX2 channel idx for JZ4770 SoC ADC

Introduce support for AUX2 channel found in ADC hardware present on
Ingenic JZ4770 SoC.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio/adc: Add a compatible string for JZ4770 SoC ADC
Artur Rojek [Sat, 27 Jul 2019 19:59:38 +0000 (21:59 +0200)]
dt-bindings: iio/adc: Add a compatible string for JZ4770 SoC ADC

Add a compatible string for the ADC controller present on
Ingenic JZ4770 SoC.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: light: cm36651: redundant assignment to variable ret
Colin Ian King [Sun, 1 Sep 2019 15:27:49 +0000 (16:27 +0100)]
iio: light: cm36651: redundant assignment to variable ret

Variable ret is being assigned a value that is never read and
is being re-assigned a little later on. The assignment is redundant
and hence can be removed.

Addresses-Coverity: ("Ununsed value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agostaging: iio: adc: ad7192: Add system calibration support
Mircea Caprioru [Mon, 2 Sep 2019 13:08:30 +0000 (16:08 +0300)]
staging: iio: adc: ad7192: Add system calibration support

This patch will add a system calibration attribute for each channel. Using
this option the user will have the ability to calibrate each channel for
zero scale and full scale. It uses the iio_chan_spec_ext_info and IIO_ENUM
to implement the functionality.

Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: ad_sigma_delta: Export ad_sd_calibrate
Mircea Caprioru [Mon, 2 Sep 2019 13:08:29 +0000 (16:08 +0300)]
iio: adc: ad_sigma_delta: Export ad_sd_calibrate

This patch exports the ad_sd_calibrate function in order to be able to
call it from outside ad_sigma_delta.

There are cases where the option to calibrate one channel at a time is
necessary (ex. system calibration for zero scale and full scale).

Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: ad7192: Add sysfs ABI documentation
Mircea Caprioru [Mon, 2 Sep 2019 13:08:28 +0000 (16:08 +0300)]
iio: adc: ad7192: Add sysfs ABI documentation

Add initial ABI documentation for ad7192 adc sysfs interfaces.

Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: hid-sensor-attributes: Fix divisions for 32-bit platforms
Andy Shevchenko [Thu, 5 Sep 2019 11:27:59 +0000 (14:27 +0300)]
iio: hid-sensor-attributes: Fix divisions for 32-bit platforms

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>
4 years agoerofs: use read_cache_page_gfp for erofs_get_meta_page
Gao Xiang [Wed, 4 Sep 2019 02:09:12 +0000 (10:09 +0800)]
erofs: use read_cache_page_gfp for erofs_get_meta_page

As Christoph said [1], "I'd much prefer to just use
read_cache_page_gfp, and live with the fact that this
allocates bufferheads behind you for now.  I'll try to
speed up my attempts to get rid of the buffer heads on
the block device mapping instead. "

This simplifies the code a lot and a minor thing is
"no REQ_META (e.g. for blktrace) on metadata at all..."

[1] https://lore.kernel.org/r/20190903153704.GA2201@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-26-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: always use iget5_locked
Gao Xiang [Wed, 4 Sep 2019 02:09:11 +0000 (10:09 +0800)]
erofs: always use iget5_locked

As Christoph said [1] [2], "Just use the slightly
more complicated 32-bit version everywhere so that
you have a single actually tested code path.
And then remove this helper. "

[1] https://lore.kernel.org/r/20190829102426.GE20598@infradead.org/
[2] https://lore.kernel.org/r/20190902125320.GA16726@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-25-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: use read_mapping_page instead of sb_bread
Gao Xiang [Wed, 4 Sep 2019 02:09:10 +0000 (10:09 +0800)]
erofs: use read_mapping_page instead of sb_bread

As Christoph said [1], "This seems to be your only direct
use of buffer heads, which while not deprecated are a bit
of an ugly step child.  So if you can easily avoid creating
a buffer_head dependency in a new filesystem I think you
should avoid it. "

[1] https://lore.kernel.org/r/20190902125109.GA9826@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-24-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: rename errln/infoln/debugln to erofs_{err, info, dbg}
Gao Xiang [Wed, 4 Sep 2019 02:09:09 +0000 (10:09 +0800)]
erofs: rename errln/infoln/debugln to erofs_{err, info, dbg}

Add prefix "erofs_" to these functions and print
sb->s_id as a prefix to erofs_{err, info} so that
the user knows which file system is affected.

Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-23-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: save one level of indentation
Gao Xiang [Wed, 4 Sep 2019 02:09:08 +0000 (10:09 +0800)]
erofs: save one level of indentation

As Christoph said [1], ".. and save one
level of indentation."

[1] https://lore.kernel.org/r/20190829102426.GE20598@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-22-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: kill use_vmap module parameter
Gao Xiang [Wed, 4 Sep 2019 02:09:07 +0000 (10:09 +0800)]
erofs: kill use_vmap module parameter

As Christoph said [1],
"vm_map_ram is supposed to generally behave better.  So if
it doesn't please report that that to the arch maintainer
and linux-mm so that they can look into the issue.  Having
user make choices of deep down kernel internals is just
a horrible interface.

Please talk to maintainers of other bits of the kernel
if you see issues and / or need enhancements. "

Let's redo the previous conclusion and kill the vmap
approach.

[1] https://lore.kernel.org/r/20190830165533.GA10909@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-21-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: kill all erofs specific fault injection
Gao Xiang [Wed, 4 Sep 2019 02:09:06 +0000 (10:09 +0800)]
erofs: kill all erofs specific fault injection

As Christoph suggested [1], "Please just use plain kmalloc
everywhere and let the normal kernel error injection code
take care of injeting any errors."

[1] https://lore.kernel.org/r/20190829102426.GE20598@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-20-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: add "erofs_" prefix for common and short functions
Gao Xiang [Wed, 4 Sep 2019 02:09:05 +0000 (10:09 +0800)]
erofs: add "erofs_" prefix for common and short functions

Add erofs_ prefix to free_inode, alloc_inode, ...

Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-19-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: kill __submit_bio()
Gao Xiang [Wed, 4 Sep 2019 02:09:04 +0000 (10:09 +0800)]
erofs: kill __submit_bio()

As Christoph pointed out [1], "
Why is there __submit_bio which really just obsfucates
what is going on?  Also why is __submit_bio using
bio_set_op_attrs instead of opencode it as the comment
right next to it asks you to? "

Let's use submit_bio directly instead.

[1] https://lore.kernel.org/r/20190830162812.GA10694@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-18-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: kill prio and nofail of erofs_get_meta_page()
Gao Xiang [Wed, 4 Sep 2019 02:09:03 +0000 (10:09 +0800)]
erofs: kill prio and nofail of erofs_get_meta_page()

As Christoph pointed out [1],
"Why is there __erofs_get_meta_page with the two weird
booleans instead of a single erofs_get_meta_page that
gets and gfp_t for additional flags and an unsigned int
for additional bio op flags."

And since all callers can handle errors, let's kill
prio and nofail and erofs_get_inline_page() now.

[1] https://lore.kernel.org/r/20190830162812.GA10694@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-17-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: localize erofs_grab_bio()
Gao Xiang [Wed, 4 Sep 2019 02:09:02 +0000 (10:09 +0800)]
erofs: localize erofs_grab_bio()

As Christoph pointed out [1], "erofs_grab_bio tries to
handle a bio_alloc failure, except that the function will
not actually fail due the mempool backing it."

Sorry about useless code, fix it now and
localize erofs_grab_bio [2].

[1] https://lore.kernel.org/r/20190830162812.GA10694@infradead.org/
[2] https://lore.kernel.org/r/20190902122016.GL15931@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-16-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: kill verbose debug info in erofs_fill_super
Gao Xiang [Wed, 4 Sep 2019 02:09:01 +0000 (10:09 +0800)]
erofs: kill verbose debug info in erofs_fill_super

As Christoph said [1], "That is some very verbose
debug info.  We usually don't add that and let
people trace the function instead. "

[1] https://lore.kernel.org/r/20190829101545.GC20598@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-15-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: use dsb instead of layout for ondisk super_block
Gao Xiang [Wed, 4 Sep 2019 02:09:00 +0000 (10:09 +0800)]
erofs: use dsb instead of layout for ondisk super_block

As Christoph pointed out [1], "Why is the variable name
for the on-disk subperblock layout? We usually still
calls this something with sb in the name, e.g. dsb.
for disksuper block. " Let's fix it.

[1] https://lore.kernel.org/r/20190829101545.GC20598@infradead.org/
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-14-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: better erofs symlink stuffs
Gao Xiang [Wed, 4 Sep 2019 02:08:59 +0000 (10:08 +0800)]
erofs: better erofs symlink stuffs

Fix as Christoph suggested [1] [2], "remove is_inode_fast_symlink
and just opencode it in the few places using it"

and
"Please just set the ops directly instead of obsfucating that in
a single caller, single line inline function.  And please set it
instead of the normal symlink iops in the same place where you
also set those."

[1] https://lore.kernel.org/r/20190830163910.GB29603@infradead.org/
[2] https://lore.kernel.org/r/20190829102426.GE20598@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-13-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: update comments in inode.c
Gao Xiang [Wed, 4 Sep 2019 02:08:58 +0000 (10:08 +0800)]
erofs: update comments in inode.c

As Christoph suggested [1], update them all.

[1] https://lore.kernel.org/r/20190829102426.GE20598@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-12-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: update erofs_fs.h comments
Gao Xiang [Wed, 4 Sep 2019 02:08:57 +0000 (10:08 +0800)]
erofs: update erofs_fs.h comments

As Christoph said [1] [2], update it now.

[1] https://lore.kernel.org/r/20190902124521.GA22153@infradead.org/
[2] https://lore.kernel.org/r/20190902120548.GB15931@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-11-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: use erofs_inode naming
Gao Xiang [Wed, 4 Sep 2019 02:08:56 +0000 (10:08 +0800)]
erofs: use erofs_inode naming

As Christoph suggested [1], "Why is this called vnode instead
of inode?  That seems like a rather odd naming for a Linux
file system."

[1] https://lore.kernel.org/r/20190829101545.GC20598@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-10-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: kill erofs_{init,exit}_inode_cache
Gao Xiang [Wed, 4 Sep 2019 02:08:55 +0000 (10:08 +0800)]
erofs: kill erofs_{init,exit}_inode_cache

As Christoph said [1] "having this function seems
entirely pointless", let's kill those.

filesystem                              function name
ext2,f2fs,ext4,isofs,squashfs,cifs,...  init_inodecache

In addition, add a necessary "rcu_barrier()" on exit_fs();

[1] https://lore.kernel.org/r/20190829101545.GC20598@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-9-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: better naming for erofs inode related stuffs
Gao Xiang [Wed, 4 Sep 2019 02:08:54 +0000 (10:08 +0800)]
erofs: better naming for erofs inode related stuffs

updates inode naming
 - kill is_inode_layout_compression [1]
 - kill magic underscores [2] [3]
 - better naming for datamode & data_mapping_mode [3]
 - better naming erofs_inode_{compact, extended} [4]

[1] https://lore.kernel.org/r/20190829102426.GE20598@infradead.org/
[2] https://lore.kernel.org/r/20190829102426.GE20598@infradead.org/
[3] https://lore.kernel.org/r/20190902122627.GN15931@infradead.org/
[4] https://lore.kernel.org/r/20190902125438.GA17750@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-8-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: use feature_incompat rather than requirements
Gao Xiang [Wed, 4 Sep 2019 02:08:53 +0000 (10:08 +0800)]
erofs: use feature_incompat rather than requirements

As Christoph said [1], "This is only cosmetic, why
not stick to feature_compat and feature_incompat?"

In my thought, requirements means "incompatible"
instead of "feature" though.

[1] https://lore.kernel.org/r/20190902125109.GA9826@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-7-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: update erofs_inode_is_data_compressed helper
Gao Xiang [Wed, 4 Sep 2019 02:08:52 +0000 (10:08 +0800)]
erofs: update erofs_inode_is_data_compressed helper

As Christoph said, "This looks like a really obsfucated
way to write:
return datamode == EROFS_INODE_FLAT_COMPRESSION ||
datamode == EROFS_INODE_FLAT_COMPRESSION_LEGACY; "

Although I had my own consideration, it's the right way for now.

[1] https://lore.kernel.org/r/20190829095954.GB20598@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-6-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: kill __packed for on-disk structures
Gao Xiang [Wed, 4 Sep 2019 02:08:51 +0000 (10:08 +0800)]
erofs: kill __packed for on-disk structures

As Christoph suggested "Please don't add __packed" [1],
remove all __packed except struct erofs_dirent here.

Note that all on-disk fields except struct erofs_dirent
(12 bytes with a 8-byte nid) in EROFS are naturally aligned.

[1] https://lore.kernel.org/r/20190829095954.GB20598@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-5-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: some macros are much more readable as a function
Gao Xiang [Wed, 4 Sep 2019 02:08:50 +0000 (10:08 +0800)]
erofs: some macros are much more readable as a function

As Christoph suggested [1], these macros are much
more readable as a function.

[1] https://lore.kernel.org/r/20190829095954.GB20598@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-4-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: on-disk format should have explicitly assigned numbers
Gao Xiang [Wed, 4 Sep 2019 02:08:49 +0000 (10:08 +0800)]
erofs: on-disk format should have explicitly assigned numbers

As Christoph suggested [1], on-disk format should have
explicitly assigned numbers.

[1] https://lore.kernel.org/r/20190829095954.GB20598@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-3-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoerofs: remove all the byte offset comments
Gao Xiang [Wed, 4 Sep 2019 02:08:48 +0000 (10:08 +0800)]
erofs: remove all the byte offset comments

As Christoph suggested [1], "Please remove all the byte offset comments.
that is something that can easily be checked with gdb or pahole."

[1] https://lore.kernel.org/r/20190829095954.GB20598@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-2-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8723bs: Remove return statement from void function
Leandro Ribeiro [Wed, 4 Sep 2019 21:06:31 +0000 (21:06 +0000)]
staging: rtl8723bs: Remove return statement from void function

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>
4 years agostaging: rtl8192e: remove unnecessary blank line
Beatriz Martins de Carvalho [Wed, 4 Sep 2019 21:03:26 +0000 (21:03 +0000)]
staging: rtl8192e: remove unnecessary blank line

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>
4 years agostaging: exfat: Use kmemdup in exfat_symlink()
YueHaibing [Thu, 5 Sep 2019 03:00:47 +0000 (03:00 +0000)]
staging: exfat: Use kmemdup in exfat_symlink()

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>
4 years agostaging: exfat: remove unused including <linux/version.h>
YueHaibing [Thu, 5 Sep 2019 02:56:23 +0000 (02:56 +0000)]
staging: exfat: remove unused including <linux/version.h>

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>
4 years agostaging: exfat: remove duplicated include from exfat_super.c
YueHaibing [Thu, 5 Sep 2019 02:56:08 +0000 (02:56 +0000)]
staging: exfat: remove duplicated include from exfat_super.c

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>
4 years agostaging: exfat: remove the redundant check when kfree an object in exfat_destroy_inode
zhong jiang [Wed, 4 Sep 2019 10:03:28 +0000 (18:03 +0800)]
staging: exfat: remove the redundant check when kfree an object in 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>
4 years agostaging: exfat: Fix two missing unlocks on error paths
Dan Carpenter [Wed, 4 Sep 2019 09:59:08 +0000 (12:59 +0300)]
staging: exfat: Fix two missing unlocks on error paths

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>
4 years agoerofs: using switch-case while checking the inode type.
Pratik Shinde [Fri, 30 Aug 2019 09:56:15 +0000 (15:26 +0530)]
erofs: using switch-case while checking the inode type.

while filling the linux inode, using switch-case statement to check
the type of inode.
switch-case statement looks more clean here.

Signed-off-by: Pratik Shinde <pratikshinde320@gmail.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190830095615.10995-1-pratikshinde320@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: cleanup explicit comparisons to NULL
Valentin Vidic [Tue, 3 Sep 2019 20:56:59 +0000 (22:56 +0200)]
staging: exfat: cleanup explicit comparisons to NULL

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>
4 years agoStaging: rtl8723bs: Use kzfree rather than its implementation
zhong jiang [Wed, 4 Sep 2019 03:01:19 +0000 (11:01 +0800)]
Staging: rtl8723bs: Use kzfree rather than its implementation

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>
4 years agoMerge tag 'iio-for-5.4b-take3' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Tue, 3 Sep 2019 20:27:46 +0000 (22:27 +0200)]
Merge tag 'iio-for-5.4b-take3' of git://git./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
  ...

4 years agoiio: imu: st_lsm6dsx: rely on IIO_G_TO_M_S_2 for gain definition for LSM9DS1
Lorenzo Bianconi [Tue, 27 Aug 2019 08:29:06 +0000 (10:29 +0200)]
iio: imu: st_lsm6dsx: rely on IIO_G_TO_M_S_2 for gain definition for LSM9DS1

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>
4 years agoiio: imu: st_lsm6dsx: remove invalid gain value for LSM9DS1
Lorenzo Bianconi [Tue, 27 Aug 2019 08:26:35 +0000 (10:26 +0200)]
iio: imu: st_lsm6dsx: remove invalid gain value for LSM9DS1

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>
4 years agostaging: exfat: drop local TRUE/FALSE defines
Valentin Vidic [Tue, 3 Sep 2019 18:55:37 +0000 (20:55 +0200)]
staging: exfat: drop local TRUE/FALSE defines

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>
4 years agostaging: exfat: fix spelling errors in comments
Valentin Vidic [Tue, 3 Sep 2019 16:54:08 +0000 (18:54 +0200)]
staging: exfat: fix spelling errors in comments

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>
4 years agostaging: exfat: cleanup braces for if/else statements
Valentin Vidic [Tue, 3 Sep 2019 16:47:32 +0000 (18:47 +0200)]
staging: exfat: cleanup braces for if/else statements

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>
4 years agoiio: cros_ec: set calibscale for 3d MEMS to unit vector
Gwendal Grignou [Mon, 26 Aug 2019 23:02:58 +0000 (16:02 -0700)]
iio: cros_ec: set calibscale for 3d MEMS to unit vector

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>
4 years agoiio: dac: ad5380: fix incorrect assignment to val
Colin Ian King [Thu, 15 Aug 2019 11:58:46 +0000 (12:58 +0100)]
iio: dac: ad5380: fix incorrect assignment to val

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>
4 years agoiio: imu: st_lsm6dsx: Fix FIFO diff mask for tagged fifo
mario tesi [Thu, 22 Aug 2019 13:22:19 +0000 (15:22 +0200)]
iio: imu: st_lsm6dsx: Fix FIFO diff mask for tagged fifo

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>
4 years agodt-bindings: iio: imu: st_lsm6dsx: add lsm9ds1 device bindings
Martin Kepplinger [Wed, 21 Aug 2019 13:25:20 +0000 (15:25 +0200)]
dt-bindings: iio: imu: st_lsm6dsx: add lsm9ds1 device bindings

Note the binding is st,lsm9ds1-imu.  This device is effectively
two separate devices in the same package. (separate addreses,
chip selects etc) The magnetometer is already supported
as lsm9ds1-mag.  imu may not be the best name but it's the best
that anyone has yet come up with for a gyro and accel part.

Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1
Martin Kepplinger [Wed, 21 Aug 2019 13:25:19 +0000 (15:25 +0200)]
iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1

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>
4 years agostaging: rtl8723bs: replace __inline by inline
Rasmus Villemoes [Fri, 30 Aug 2019 23:15:22 +0000 (01:15 +0200)]
staging: rtl8723bs: replace __inline by inline

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>
4 years agostaging: r8188eu: use skb_put_data instead of skb_put/memcpy pair
Ivan Safonov [Sun, 1 Sep 2019 19:53:01 +0000 (22:53 +0300)]
staging: r8188eu: use skb_put_data instead of skb_put/memcpy pair

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>
4 years agostaging: kpc2000: Fix long constant sparse warning
Harsh Jain [Sat, 31 Aug 2019 11:55:32 +0000 (17:25 +0530)]
staging: kpc2000: Fix long constant sparse warning

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>
4 years agostaging: exfat: check for null return from call to FAT_getblk
Colin Ian King [Fri, 30 Aug 2019 17:50:50 +0000 (18:50 +0100)]
staging: exfat: check for null return from call to FAT_getblk

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>
4 years agostaging: greybus: light: fix a couple double frees
Dan Carpenter [Thu, 29 Aug 2019 12:28:39 +0000 (15:28 +0300)]
staging: greybus: light: fix a couple double frees

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>
4 years agostaging: rts5208: Fix checkpath warning
P SAI PRASANTH [Sat, 31 Aug 2019 03:49:26 +0000 (09:19 +0530)]
staging: rts5208: Fix checkpath warning

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>
4 years agostaging: rts5208: Fixed checkpath warning.
Prakhar Sinha [Fri, 30 Aug 2019 12:16:56 +0000 (17:46 +0530)]
staging: rts5208: Fixed checkpath warning.

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>
4 years agostaging: rts5208: remove redundant sd30_mode checks
Colin Ian King [Fri, 30 Aug 2019 08:10:47 +0000 (09:10 +0100)]
staging: rts5208: remove redundant sd30_mode checks

There are two hunks of code that check if sd30_mode is true however
an earlier check in an outer code block on sd30_mode being false means
that sd30_mode can never be true at these points so these checks are
redundant.  Remove the dead code.

Addresses-Coverity: ("Logically dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20190830081047.13630-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: remove return and error return via a goto
Colin Ian King [Mon, 2 Sep 2019 09:40:52 +0000 (10:40 +0100)]
staging: exfat: remove return and error return via a goto

The return statement is incorrect, the error exit should be by
assigning ret with the error code and exiting via label out.
Thanks to Valdis Klētnieks for correcting my original fix.

Addresses-Coverity: ("Structurally dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20190902094052.28029-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: fix uninitialized variable ret
Colin Ian King [Fri, 30 Aug 2019 18:46:44 +0000 (19:46 +0100)]
staging: exfat: fix uninitialized variable ret

Currently there are error return paths in ffsReadFile that
exit via lable err_out that return and uninitialized error
return in variable ret. Fix this by initializing ret to zero.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: c48c9f7ff32b ("staging: exfat: add exfat filesystem code to staging")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>,
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Link: https://lore.kernel.org/r/20190830184644.15590-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: use BIT macro for defining sizes
Valentin Vidic [Mon, 2 Sep 2019 18:43:19 +0000 (20:43 +0200)]
staging: exfat: use BIT macro for defining sizes

Fixes checkpatch.pl warning:

  CHECK: Prefer using the BIT macro

Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr>
Link: https://lore.kernel.org/r/20190902184319.11971-1-vvidic@valentin-vidic.from.hr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: cleanup blank line warnings
Valentin Vidic [Mon, 2 Sep 2019 19:03:29 +0000 (21:03 +0200)]
staging: exfat: cleanup blank line warnings

Fixes checkpatch.pl warnings:

  CHECK: Please don't use multiple blank lines
  CHECK: Blank lines aren't necessary after an open brace '{'
  CHECK: Please use a blank line after function/struct/union/enum
         declarations

Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr>
Link: https://lore.kernel.org/r/20190902190329.18685-1-vvidic@valentin-vidic.from.hr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>