openwrt/staging/blogic.git
4 years agoiio: light: al3320a slightly improve code formatting
David Heidelberg [Tue, 11 Feb 2020 19:11:57 +0000 (20:11 +0100)]
iio: light: al3320a slightly improve code formatting

- modified to be in part with al3010 driver
- cleanup using bitfield, no functionality change intended

Signed-off-by: David Heidelberg <david@ixit.cz>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: light: add support for Dyna-Image AL3010
David Heidelberg [Tue, 11 Feb 2020 19:11:56 +0000 (20:11 +0100)]
dt-bindings: iio: light: add support for Dyna-Image AL3010

The Dyna-Image AL3010 is a 16-bit digital ambient light sensor which
provides a multiple gain function with linear response over a dynamic
range 1216/4863/19452/77806.

Signed-off-by: David Heidelberg <david@ixit.cz>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: light: add support for Dyna-Image AL3320A
David Heidelberg [Tue, 11 Feb 2020 19:11:55 +0000 (20:11 +0100)]
dt-bindings: iio: light: add support for Dyna-Image AL3320A

This commit add dt-bindings support to al3320a driver and vendor-prefix
dynaimage.
Partly based on unmerged commit:
"iio: Add Dyna-Image AP3223 ambient light and proximity driver"

Signed-off-by: David Heidelberg <david@ixit.cz>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agostaging: iio: adc: ad7192: move out of staging
Alexandru Tachici [Wed, 12 Feb 2020 16:17:21 +0000 (18:17 +0200)]
staging: iio: adc: ad7192: move out of staging

Move ad7192 ADC driver out of staging into mainline.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoDocumentation: ABI: testing: ad7192: update sysfs docs
Alexandru Tachici [Wed, 12 Feb 2020 16:17:20 +0000 (18:17 +0200)]
Documentation: ABI: testing: ad7192: update sysfs docs

Updated mainline documentation on ad7192 userspace sysfs.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agostaging: iio: adc: ad7192: removed spi_device_id
Alexandru Tachici [Wed, 12 Feb 2020 16:17:19 +0000 (18:17 +0200)]
staging: iio: adc: ad7192: removed spi_device_id

This patch removes spi_device_id table and moves the
init data (id of the chip) in the .data field
of of_device_id table.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agostaging: iio: adc: ad7192: modify iio_chan_spec array
Alexandru Tachici [Wed, 12 Feb 2020 16:17:18 +0000 (18:17 +0200)]
staging: iio: adc: ad7192: modify iio_chan_spec array

This patch changes the static const struct iio_chan_spec arrays
in a way that all the necessary attributes are set at
compile time. Now ad7192_channels_config only makes the
channels attribute of iio_dev point to the right array depending
on the chip.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agostaging: iio: adc: ad7192: fail probe on get_voltage
Alexandru Tachici [Wed, 12 Feb 2020 16:17:17 +0000 (18:17 +0200)]
staging: iio: adc: ad7192: fail probe on get_voltage

This patch makes the ad7192_probe fail in case
regulator_get_voltage will return an error or voltage
is set to 0.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: ad7124: Add direct reg access
Mircea Caprioru [Tue, 11 Feb 2020 08:44:53 +0000 (10:44 +0200)]
iio: adc: ad7124: Add direct reg access

This patch adds the posibility do read and write registers from userspace
using the kernel debug direct register access option.

Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adis16460: Make use of __adis_initial_startup
Nuno Sá [Mon, 10 Feb 2020 13:26:06 +0000 (15:26 +0200)]
iio: adis16460: Make use of __adis_initial_startup

All of the actions done in `adis16460_initial_setup()` are now done in
`__adis_initial_startup()` so, there's no need for code duplication.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adis16480: Make use of __adis_initial_startup
Nuno Sá [Mon, 10 Feb 2020 13:26:05 +0000 (15:26 +0200)]
iio: adis16480: Make use of __adis_initial_startup

All actions done in `adis16480_initial_setup()` are now done in
`__adis_initial_startup()` so, there's no need for code duplication.
Furthermore, the call to `adis16480_initial_setup()` is done before any
device configuration since the device will be reset if not already (via
rst pin). This is actually fixing a potential bug since `adis_reset()` was
being called after configuring the device which is obviously a problem.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: adis: add support product ID check in adis_initial_startup
Alexandru Ardelean [Mon, 10 Feb 2020 13:26:04 +0000 (15:26 +0200)]
iio: imu: adis: add support product ID check in adis_initial_startup

Each driver/chip that wants to validate it's product id, can now
specify a 'prod_id_reg' and an expected 'prod_id' value.
The 'prod_id' value is intentionally left 0 (uninitialized). There aren't
(yet) any product IDs with value 0; this enforces that both 'prod_id_reg'
and 'prod_id' are specified.

At the very least, this routine validates that the SPI connection to the
ADIS chip[s] works well.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: adis: Refactor adis_initial_startup
Nuno Sá [Mon, 10 Feb 2020 13:26:03 +0000 (15:26 +0200)]
iio: imu: adis: Refactor adis_initial_startup

All the ADIS devices perform, at the beginning, a self test to make sure
the device is in a sane state. Previously, the logic was that the self-test
was performed in adis_initial_startup() and if that failed a reset was done
and then a self-test was attempted again.

This change unifies the reset mechanism under the adis_initial_startup()
call. A HW reset will be done if  GPIO is configured, or a SW reset
otherwise. This should make sure that the chip is in a sane state for
self-test. Once the reset is done, the self-test operation will be
performed. If anything goes wrong with self-test, the driver should just
bail/error-out (i.e. no second attempt). The chip would likely not be a in
a sane state state if the self-test fails after a reset.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: adis: Add self_test_reg variable
Nuno Sá [Mon, 10 Feb 2020 13:26:02 +0000 (15:26 +0200)]
iio: imu: adis: Add self_test_reg variable

This patch adds a dedicated self_test_reg variable. This is also a step
to let new drivers make use of `adis_initial_startup()`. Some devices
use MSG_CTRL reg to request a self_test command while others use the
GLOB_CMD register.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: adis: add unlocked __adis_initial_startup()
Alexandru Ardelean [Mon, 10 Feb 2020 13:26:01 +0000 (15:26 +0200)]
iio: imu: adis: add unlocked __adis_initial_startup()

This change splits the __adis_initial_startup() away from
adis_initial_startup(). The unlocked version can be used in certain calls
during probe, where races won't happen since the ADIS driver may not be
registered yet with IIO.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: gyro: adis16136: initialize adis_data statically
Alexandru Ardelean [Mon, 10 Feb 2020 13:26:00 +0000 (15:26 +0200)]
iio: gyro: adis16136: initialize adis_data statically

This change overrides commit 380b107bbf944 ("iio: adis: Introduce timeouts
structure"). It removes the memory allocation and moves the 'adis_data'
information to be static on the chip_info struct.

This also adds a timeout structure to ADIS16334, since it was initially
omitted. This was omitted (by accident) when the change was done.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: adis16400: initialize adis_data statically
Alexandru Ardelean [Mon, 10 Feb 2020 13:25:59 +0000 (15:25 +0200)]
iio: imu: adis16400: initialize adis_data statically

This change overrides commit 380b107bbf944 ("iio: adis: Introduce timeouts
structure"). It removes the memory allocation and moves the 'adis_data'
information to be static on the chip_info struct.

This also adds a timeout structure to ADIS16334, since it was initially
omitted. This was omitted (by accident) when the change was done.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: adis16480: initialize adis_data statically
Alexandru Ardelean [Mon, 10 Feb 2020 13:25:58 +0000 (15:25 +0200)]
iio: imu: adis16480: initialize adis_data statically

This change overrides commit 380b107bbf944 ("iio: adis: Introduce timeouts
structure"). It removes the memory allocation and moves the 'adis_data'
information to be static on the chip_info struct.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: st_lsm6dsx: check return value from st_lsm6dsx_sensor_set_enable
Lorenzo Bianconi [Fri, 7 Feb 2020 12:37:54 +0000 (13:37 +0100)]
iio: imu: st_lsm6dsx: check return value from st_lsm6dsx_sensor_set_enable

Add missing return value check in st_lsm6dsx_shub_read_oneshot disabling
the slave device connected to the st_lsm6dsx i2c controller.
The issue is reported by coverity with the following error:

Unchecked return value:
If the function returns an error value, the error value may be mistaken
for a normal value.

Addresses-Coverity-ID: 1456767 ("Unchecked return value")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoMAINTAINERS: add entry for hmc425a driver.
Beniamin Bia [Thu, 6 Feb 2020 15:11:49 +0000 (17:11 +0200)]
MAINTAINERS: add entry for hmc425a driver.

Add Beniamin Bia and Michael Hennerich as maintainers for HMC425A
attenuator.

Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: amplifiers: Add docs for HMC425A Step Attenuator
Michael Hennerich [Thu, 6 Feb 2020 15:11:48 +0000 (17:11 +0200)]
dt-bindings: iio: amplifiers: Add docs for HMC425A Step Attenuator

Document support for Analog Devices MC425A Step Attenuator.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: amplifiers: hmc425a: Add support for HMC425A attenuator
Michael Hennerich [Thu, 6 Feb 2020 15:11:47 +0000 (17:11 +0200)]
iio: amplifiers: hmc425a: Add support for HMC425A attenuator

This patch adds support for the HMC425A 0.5 dB LSB GaAs MMIC 6-BIT
DIGITAL POSITIVE CONTROL ATTENUATOR, 2.2 - 8.0 GHz.

Datasheet:
https://www.analog.com/media/en/technical-documentation/data-sheets/hmc425A.pdf

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: amplifiers: ad8366: Add write_raw_get_fmt function
Beniamin Bia [Thu, 6 Feb 2020 15:11:46 +0000 (17:11 +0200)]
iio: amplifiers: ad8366: Add write_raw_get_fmt function

This patch add write_raw_get_fmt function to specify conversion for
hardware gain.

Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: core: Handle 'dB' suffix in core
Beniamin Bia [Thu, 6 Feb 2020 15:11:45 +0000 (17:11 +0200)]
iio: core: Handle 'dB' suffix in core

This patch handles the db suffix used for writing micro db values.

Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agocounter: stm32-timer-cnt: remove iio headers
Fabrice Gasnier [Tue, 11 Feb 2020 10:56:06 +0000 (11:56 +0100)]
counter: stm32-timer-cnt: remove iio headers

The stm32-timer-cnt driver doesn't use the iio interface. The iio headers
aren't relevant and can be removed as reported by William in [1].
With this change, mod_devicetable.h needs to be added to define the
'of_device_id' struct.

[1] https://lkml.org/lkml/2020/2/10/1516

Reported-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agocounter: stm32-timer-cnt: add power management support
Fabrice Gasnier [Mon, 10 Feb 2020 17:19:58 +0000 (18:19 +0100)]
counter: stm32-timer-cnt: add power management support

Add suspend/resume PM sleep ops. When going to low power, enforce the
counter isn't active. Gracefully restore its state upon resume in case
it's been left enabled prior to suspend.

Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: add description for new supported chips
Jean-Baptiste Maneyrol [Thu, 6 Feb 2020 10:31:05 +0000 (11:31 +0100)]
dt-bindings: add description for new supported chips

Add missing mpu6000 and new icm20609, icm20689, icm20690, and
iam20680.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: inv_mpu6050: update LPF bandwidth settings
Jean-Baptiste Maneyrol [Thu, 6 Feb 2020 10:31:04 +0000 (11:31 +0100)]
iio: imu: inv_mpu6050: update LPF bandwidth settings

As every chip has some little variant in LPF bandwidth values,
use common values that are working for all chips.
Simplify the LPF setting function.

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 support of ICM20690
Jean-Baptiste Maneyrol [Thu, 6 Feb 2020 10:31:03 +0000 (11:31 +0100)]
iio: imu: inv_mpu6050: add support of ICM20690

Same generation as ICM20602 but different registers.

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 support of IAM20680
Jean-Baptiste Maneyrol [Thu, 6 Feb 2020 10:31:02 +0000 (11:31 +0100)]
iio: imu: inv_mpu6050: add support of IAM20680

Automotive certified IMU, similar to ICM20608.

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 support of ICM20609 & ICM20689
Jean-Baptiste Maneyrol [Thu, 6 Feb 2020 10:31:01 +0000 (11:31 +0100)]
iio: imu: inv_mpu6050: add support of ICM20609 & ICM20689

They are similar to ICM20608 chip.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: inv_mpu6050: cleanup of/acpi support
Jean-Baptiste Maneyrol [Thu, 6 Feb 2020 10:31:00 +0000 (11:31 +0100)]
iio: imu: inv_mpu6050: cleanup of/acpi support

Use device_get_match_data for using of and acpi tables.
In spi support add missing mpu6515 and of match table.
Reorganize Kconfig to display chips grouped by generations.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: modify NPCM reset support
Tomer Maimon [Mon, 3 Feb 2020 15:09:17 +0000 (17:09 +0200)]
iio: adc: modify NPCM reset support

Modify NPCM ADC reset support from
direct register access to reset controller support.

please make sure to modify NPCM adc device tree
parameters as described at nuvoton,npcm-adc.txt
document for using this change.

Note for anyone noting that this is a breaking change, this is on
a BMC and effectively in a close ecosystem so it is fine to rely
on DT and kernel being updated together.

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-binding: iio: add NPCM ADC reset support
Tomer Maimon [Mon, 3 Feb 2020 15:09:16 +0000 (17:09 +0200)]
dt-binding: iio: add NPCM ADC reset support

Add NPCM ADC reset binding documentation.

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: vcnl4000: Enable runtime pm for vcnl4200/4040
Guido Günther [Mon, 3 Feb 2020 09:17:02 +0000 (10:17 +0100)]
iio: vcnl4000: Enable runtime pm for vcnl4200/4040

This is modelled after the vcnl4035 driver. For the vcnl40{0,1,2}0
we don't do anything since they use on demand measurement.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: vcnl4000: Use a single return when getting IIO_CHAN_INFO_RAW
Guido Günther [Mon, 3 Feb 2020 09:17:01 +0000 (10:17 +0100)]
iio: vcnl4000: Use a single return when getting IIO_CHAN_INFO_RAW

This will be useful when introducing runtime pm.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: dac: ltc2632: remove some unused defines
Uwe Kleine-König [Mon, 3 Feb 2020 20:31:26 +0000 (21:31 +0100)]
iio: dac: ltc2632: remove some unused defines

These two defines are unused since the driver was introduced in commit
02b829f9e11f ("iio: dac: Add support for ltc2632 DACs").

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: dac: ltc2632: add support for LTC2636 family
Uwe Kleine-König [Thu, 30 Jan 2020 13:15:49 +0000 (14:15 +0100)]
iio: dac: ltc2632: add support for LTC2636 family

The only difference between LTC2632 and LTC2636 is that the former has
two DAC channels while the latter has eight.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: dac: ltc2632: drop some duplicated data
Uwe Kleine-König [Thu, 30 Jan 2020 13:15:48 +0000 (14:15 +0100)]
iio: dac: ltc2632: drop some duplicated data

The channel data for ltc2632l12 and ltc2632h12 are identical. So there
is no gain in using two different (but identical) channel descriptions.
The only side effect of this change is some memory savings.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: ltc2632: expand for ltc2636 support
Uwe Kleine-König [Thu, 30 Jan 2020 13:15:47 +0000 (14:15 +0100)]
dt-bindings: iio: ltc2632: expand for ltc2636 support

The ltc2636 family of devices is register compatible with the ltc2636
chips, it just features 8 instead of 2 channels.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: srf04: add power management feature
Andreas Klinger [Mon, 20 Jan 2020 16:45:41 +0000 (17:45 +0100)]
iio: srf04: add power management feature

Add suspend and resume operations for being used by optional power
management.

The suspend function is switching off an GPIO which can be used by the
hardware to switch power off. The resume function is switching the GPIO
on and sleeps an adjustable time to give the device a chance to be up
and running.

If activated the driver gets into autosuspend after some time of
inactivity.

Suggested-by: Franz Parzer <rpi-receiver@htl-steyr.ac.at>
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: devantech-srf04.yaml: add pm feature
Andreas Klinger [Mon, 20 Jan 2020 16:44:55 +0000 (17:44 +0100)]
dt-bindings: devantech-srf04.yaml: add pm feature

Add GPIO line and startup time for usage of power management

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: st_sensors: handle memory allocation failure to fix null pointer dereference
Colin Ian King [Tue, 21 Jan 2020 16:17:57 +0000 (16:17 +0000)]
iio: st_sensors: handle memory allocation failure to fix null pointer dereference

A null pointer deference on pdata can occur if the allocation of
pdata fails.  Fix this by adding a null pointer check and handle
the -ENOMEM failure in the caller.

Addresses-Coverity: ("Dereference null return value")
Fixes: 3ce85cc4fbb7 ("iio: st_sensors: get platform data from device tree")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: ad7124: add 3db filter
Alexandru Tachici [Wed, 22 Jan 2020 08:54:14 +0000 (10:54 +0200)]
iio: adc: ad7124: add 3db filter

This patch adds the LOW_PASS_FILTER_3DB_FREQUENCY attribute
in iio_chan_spec for each channel. The used filters are sinc3
or sinc4. The filter type with the highest output data rate
is used when setting a low pass frequency in the channel's sysfs.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: ad5755: fix spelling mistake "to" -> "too" and grammar plus formatting
Colin Ian King [Thu, 23 Jan 2020 09:19:54 +0000 (09:19 +0000)]
iio: ad5755: fix spelling mistake "to" -> "too" and grammar plus formatting

There is a spelling mistake and grammar mistake in a dev_err
message. Fix it.

Also include Joe Perches' additional suggestions around:
* Missing newlines
* Excess braces
* Odd indentation
* Some grammar

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Suggested-by: Joe Perches <joe@perches.com> # Additional cleanups etc.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: light: Add a driver for Sharp GP2AP002x00F
Linus Walleij [Sun, 26 Jan 2020 15:05:48 +0000 (16:05 +0100)]
iio: light: Add a driver for Sharp GP2AP002x00F

This driver handles two different Sharp sensors that have been
proposed for merging to the mainline kernel over the years, and
already has a limited proximity-only driver in the input
subsystem.

These components are completely different from the confusingly
similarly named Sharp GP2AP020A00F, for which we have a driver
in drivers/iio/light/gp2ap020a00f.c

The two components GP2AP002A00F and GP2AP002S00F are
distinctively different but similar: they share the same set of
registers but differ slightly in the I2C protocol.

Instead of the approach by the previous input driver, we create
a combined IIO proximity and light sensor driver.

The plan is to merge this driver and delete the input driver.

The pieces for the driver are picked all over the place after
researching and grepping through a few different vendor trees
and driver submissions.

We merge it under the light sensors because:

- It has similarities with the Capella CM3605 light sensor and
  proximity driver which is there.

- It is related to the GP2AP020A00F driver which is also there.

This driver was tested with the Samsung GT-S7710 mobile phone
which has the GP2AP002S00F proximity sensor mounted.

The suspend/resume cycle will disable the interrupt from the
sensor. If someone would desire to use this interrupt for
wakeup, the driver will need modifications.

Cc: Stephan Gerhold <stephan@gerhold.net>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Cc: Jonathan Bakker <xc-racer2@live.ca>
Cc: Oskar Andero <oskar.andero@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Tested-by: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: light: Add DT bindings for GP2AP002
Linus Walleij [Sun, 26 Jan 2020 15:05:47 +0000 (16:05 +0100)]
iio: light: Add DT bindings for GP2AP002

This adds device tree bindings for the GP2AP002 light
and proximity sensor.

As with other early proximity sensors (~2010) the light
sensor and proximity sensors were combined into a single
component.

Cc: Stephan Gerhold <stephan@gerhold.net>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Cc: Jonathan Bakker <xc-racer2@live.ca>
Cc: Oskar Andero <oskar.andero@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: devicetree@vger.kernel.org
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: st_lsm6dsx: Fix mismatched comments
JieunKim [Mon, 27 Jan 2020 12:03:59 +0000 (21:03 +0900)]
iio: imu: st_lsm6dsx: Fix mismatched comments

odr to odr_table
gain to fs_table

'gain' is actually in 'st_lsm6dsx_fs' structure of 'fs_table'

Signed-off-by: JieunKim <jieun.kim4758@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: accel: st_accel: Use st_sensors_dev_name_probe()
Andy Shevchenko [Mon, 20 Jan 2020 09:25:50 +0000 (11:25 +0200)]
iio: accel: st_accel: Use st_sensors_dev_name_probe()

Use st_sensors_dev_name_probe() instead open coded variant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: adc: stm32-adc: convert bindings to json-schema
Fabrice Gasnier [Wed, 15 Jan 2020 13:45:41 +0000 (14:45 +0100)]
dt-bindings: iio: adc: stm32-adc: convert bindings to json-schema

Convert the STM32 ADC binding to DT schema format using json-schema

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoRevert "staging/octeon: Mark Ethernet driver as BROKEN"
Chris Packham [Wed, 5 Feb 2020 00:11:16 +0000 (13:11 +1300)]
Revert "staging/octeon: Mark Ethernet driver as BROKEN"

This reverts commit 075a1e87d1e2358d0b0301ac8f8e7f25051decf1. Now that
the build issues have been fixed we can resume build testing.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20200205001116.14096-7-chris.packham@alliedtelesis.co.nz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoMIPS: octeon: remove typedef declaration for cvmx_pko_command_word0
Chris Packham [Wed, 5 Feb 2020 00:11:15 +0000 (13:11 +1300)]
MIPS: octeon: remove typedef declaration for cvmx_pko_command_word0

Remove the typedef and update usage to use the union.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20200205001116.14096-6-chris.packham@alliedtelesis.co.nz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoMIPS: octeon: remove typedef declaration for cvmx_helper_link_info
Chris Packham [Wed, 5 Feb 2020 00:11:14 +0000 (13:11 +1300)]
MIPS: octeon: remove typedef declaration for cvmx_helper_link_info

Remove declaration of union cvmx_helper_link_info as typedef and update
uses to use the union.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20200205001116.14096-5-chris.packham@alliedtelesis.co.nz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoMIPS: octeon: remove typedef declaration for cvmx_wqe
Chris Packham [Wed, 5 Feb 2020 00:11:13 +0000 (13:11 +1300)]
MIPS: octeon: remove typedef declaration for cvmx_wqe

Remove typedef declaration from struct cvmx_wqe and replace its previous
uses with new struct declaration.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20200205001116.14096-4-chris.packham@alliedtelesis.co.nz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoRevert "staging: octeon: delete driver"
Chris Packham [Wed, 5 Feb 2020 00:11:12 +0000 (13:11 +1300)]
Revert "staging: octeon: delete driver"

This reverts commit 710d7fbe21ee2ceab121f1f84a20edf68f9f9742.
Re-instate the code so subsequent commits can clean it up and get it
building properly.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20200205001116.14096-3-chris.packham@alliedtelesis.co.nz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoRevert "staging: octeon-usb: delete the octeon usb host controller driver"
Chris Packham [Wed, 5 Feb 2020 00:11:11 +0000 (13:11 +1300)]
Revert "staging: octeon-usb: delete the octeon usb host controller driver"

This reverts commit 95ace52e4036482da1895b6e19f15141802cc3dd. Re-instate
the code so subsequent commits can clean it up and get it building
properly.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20200205001116.14096-2-chris.packham@alliedtelesis.co.nz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoStaging: remove wusbcore and UWB from the kernel tree.
Greg Kroah-Hartman [Mon, 10 Feb 2020 23:14:17 +0000 (15:14 -0800)]
Staging: remove wusbcore and UWB from the kernel tree.

It's been over 6 months, and no one has noticed that these drivers are
deleted, probably because no one actually has this hardware.  As no one
has volunteered to maintain the code, let's drop it for good.

Link: https://lore.kernel.org/r/20200210231417.GA1736729@kroah.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wilc1000: refactor p2p action frames handling API's
Ajay Singh [Wed, 12 Feb 2020 10:14:15 +0000 (10:14 +0000)]
staging: wilc1000: refactor p2p action frames handling API's

Refactor handling of P2P specific action frames. Make use of 'struct' to
handle the P2P frames instead of manipulating using 'buf' pointer.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Link: https://lore.kernel.org/r/20200212154503.8835-1-ajay.kathat@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: vc04_services: don't increment service refcount when it's not needed
Marcelo Diop-Gonzalez [Wed, 12 Feb 2020 18:43:33 +0000 (13:43 -0500)]
staging: vc04_services: don't increment service refcount when it's not needed

There are a few places where a service's reference count is incremented,
something quick is done, and the refcount is dropped. This can be made
a little simpler/faster by not grabbing a reference in these cases.

Signed-off-by: Marcelo Diop-Gonzalez <marcgonzalez@google.com>
Link: https://lore.kernel.org/r/ac6186ac888f1acf489b5b504efcba8b0d6a8b25.1581532523.git.marcgonzalez@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: vc04_services: use kref + RCU to reference count services
Marcelo Diop-Gonzalez [Wed, 12 Feb 2020 18:43:32 +0000 (13:43 -0500)]
staging: vc04_services: use kref + RCU to reference count services

Currently reference counts are implemented by locking service_spinlock
and then incrementing the service's ->ref_count field, calling
kfree() when the last reference has been dropped. But at the same
time, there's code in multiple places that dereferences pointers
to services without having a reference, so there could be a race there.

It should be possible to avoid taking any lock in unlock_service()
or service_release() because we are setting a single array element
to NULL, and on service creation, a mutex is locked before looking
for a NULL spot to put the new service in.

Using a struct kref and RCU-delaying the freeing of services fixes
this race condition while still making it possible to skip
grabbing a reference in many places. Also it avoids the need to
acquire a single spinlock when e.g. taking a reference on
state->services[i] when somebody else is in the middle of taking
a reference on state->services[j].

Signed-off-by: Marcelo Diop-Gonzalez <marcgonzalez@google.com>
Link: https://lore.kernel.org/r/3bf6f1ec6ace64d7072025505e165b8dd18b25ca.1581532523.git.marcgonzalez@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: gasket: unify multi-line string
Kaaira Gupta [Wed, 12 Feb 2020 17:58:26 +0000 (23:28 +0530)]
staging: gasket: unify multi-line string

Fix three checkpatch.pl warnings of 'quoted string split across lines'
in gasket_core.c by merging the strings in one line.
Though some strings
are over 80 characters long, fixing this warning is necessary to ease
grep-ing the source for printk.

Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
Link: https://lore.kernel.org/r/20200212175826.GA5967@kaaira-HP-Pavilion-Notebook
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: vc04_services: fix indentation alignment in a few places
Marcelo Diop-Gonzalez [Wed, 12 Feb 2020 18:43:31 +0000 (13:43 -0500)]
staging: vc04_services: fix indentation alignment in a few places

This fixes some checkpatch warnings about incorrect indentation levels

Signed-off-by: Marcelo Diop-Gonzalez <marcgonzalez@google.com>
Link: https://lore.kernel.org/r/feadcde28a987fad12011a5f17b29f2147c09e12.1581532523.git.marcgonzalez@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: vc04_services: remove unneeded parentheses
Marcelo Diop-Gonzalez [Wed, 12 Feb 2020 18:43:30 +0000 (13:43 -0500)]
staging: vc04_services: remove unneeded parentheses

there are extra parentheses around many conditional statements
that make things a little harder to read

Signed-off-by: Marcelo Diop-Gonzalez <marcgonzalez@google.com>
Link: https://lore.kernel.org/r/41511abf64f73af62f21f8e0c7457edc289af905.1581532523.git.marcgonzalez@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: vc04_services: remove unused function
Marcelo Diop-Gonzalez [Wed, 12 Feb 2020 18:43:29 +0000 (13:43 -0500)]
staging: vc04_services: remove unused function

vchiq_get_service_fourcc() doesn't seem to be used anywhere

Signed-off-by: Marcelo Diop-Gonzalez <marcgonzalez@google.com>
Link: https://lore.kernel.org/r/ed8b0034e316b2a81b621e9fca43f8368334b191.1581532523.git.marcgonzalez@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: greybus: Replace zero-length array with flexible-array member
Gustavo A. R. Silva [Tue, 11 Feb 2020 21:12:19 +0000 (15:12 -0600)]
staging: greybus: Replace zero-length array with flexible-array member

The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertenly introduced[3] to the codebase from now on.

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Link: https://lore.kernel.org/r/20200211211219.GA673@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: unisys: visorinput: Replace zero-length array with flexible-array member
Gustavo A. R. Silva [Tue, 11 Feb 2020 21:17:22 +0000 (15:17 -0600)]
staging: unisys: visorinput: Replace zero-length array with flexible-array member

The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertenly introduced[3] to the codebase from now on.

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Link: https://lore.kernel.org/r/20200211211722.GA1640@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Rename variable 'AccessTimestamp' to 'access_timestamp'
Pragat Pandya [Mon, 10 Feb 2020 18:35:58 +0000 (00:05 +0530)]
staging: exfat: Rename variable 'AccessTimestamp' to 'access_timestamp'

Fix checkpatch warning: Avoid CamelCase
Change all occurrences of identifier "AccessTimestamp" to
"access_timestamp"

Signed-off-by: Pragat Pandya <pragat.pandya@gmail.com>
Link: https://lore.kernel.org/r/20200210183558.11836-20-pragat.pandya@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Rename variable 'ModifyTimestamp' to 'modify_timestamp'
Pragat Pandya [Mon, 10 Feb 2020 18:35:57 +0000 (00:05 +0530)]
staging: exfat: Rename variable 'ModifyTimestamp' to 'modify_timestamp'

Fix checkpatch warning: Avoid CamelCase
Change all occurrences of identifier "ModifyTimestamp" to
"modify_timestamp"

Signed-off-by: Pragat Pandya <pragat.pandya@gmail.com>
Link: https://lore.kernel.org/r/20200210183558.11836-19-pragat.pandya@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Rename variable 'CreateTimestamp' to 'create_timestamp'
Pragat Pandya [Mon, 10 Feb 2020 18:35:56 +0000 (00:05 +0530)]
staging: exfat: Rename variable 'CreateTimestamp' to 'create_timestamp'

Fix checkpatch warning: Avoid CamelCase
Change all occurrences of identifier "CreateTimestamp" to
"create_timestamp"

Signed-off-by: Pragat Pandya <pragat.pandya@gmail.com>
Link: https://lore.kernel.org/r/20200210183558.11836-18-pragat.pandya@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Rename variable 'NumSubdirs' to 'num_subdirs'
Pragat Pandya [Mon, 10 Feb 2020 18:35:55 +0000 (00:05 +0530)]
staging: exfat: Rename variable 'NumSubdirs' to 'num_subdirs'

Fix checkpatch warning: Avoid CamelCase
Change all occurrences of identifier "NumSubdirs" to "num_subdirs"

Signed-off-by: Pragat Pandya <pragat.pandya@gmail.com>
Link: https://lore.kernel.org/r/20200210183558.11836-17-pragat.pandya@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Rename variable 'Attr' to 'attr'
Pragat Pandya [Mon, 10 Feb 2020 18:35:54 +0000 (00:05 +0530)]
staging: exfat: Rename variable 'Attr' to 'attr'

Fix checkpatch warning: Avoid CamelCase
Change all occurrences of identifier "Attr" to "attr"

Signed-off-by: Pragat Pandya <pragat.pandya@gmail.com>
Link: https://lore.kernel.org/r/20200210183558.11836-16-pragat.pandya@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Rename variable 'ShortName' to 'short_name'
Pragat Pandya [Mon, 10 Feb 2020 18:35:53 +0000 (00:05 +0530)]
staging: exfat: Rename variable 'ShortName' to 'short_name'

Fix checkpatch warning: Avoid CamelCase
Change all occurrences of identifier "ShortName" to "short_name"

Signed-off-by: Pragat Pandya <pragat.pandya@gmail.com>
Link: https://lore.kernel.org/r/20200210183558.11836-15-pragat.pandya@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Rename variable 'Name' to 'name'
Pragat Pandya [Mon, 10 Feb 2020 18:35:52 +0000 (00:05 +0530)]
staging: exfat: Rename variable 'Name' to 'name'

Fix checkpatch warning: Avoid CamelCase
Change all occurrences of identifier "Name" to "name"

Signed-off-by: Pragat Pandya <pragat.pandya@gmail.com>
Link: https://lore.kernel.org/r/20200210183558.11836-14-pragat.pandya@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Rename variable 'MilliSecond' to 'millisecond'
Pragat Pandya [Mon, 10 Feb 2020 18:35:46 +0000 (00:05 +0530)]
staging: exfat: Rename variable 'MilliSecond' to 'millisecond'

Fix checkpatch warning: Avoid CamelCase
Change all occurrences of identifier "MilliSecond" to "millisecond"

Signed-off-by: Pragat Pandya <pragat.pandya@gmail.com>
Link: https://lore.kernel.org/r/20200210183558.11836-8-pragat.pandya@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Rename variable 'Second' to 'second'
Pragat Pandya [Mon, 10 Feb 2020 18:35:45 +0000 (00:05 +0530)]
staging: exfat: Rename variable 'Second' to 'second'

Fix checkpatch warning: Avoid CamelCase
Change all occurrences of identifier "Second" to "second"

Signed-off-by: Pragat Pandya <pragat.pandya@gmail.com>
Link: https://lore.kernel.org/r/20200210183558.11836-7-pragat.pandya@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Rename variable 'Minute' to 'minute'
Pragat Pandya [Mon, 10 Feb 2020 18:35:44 +0000 (00:05 +0530)]
staging: exfat: Rename variable 'Minute' to 'minute'

Fix checkpatch warning: Avoid CamelCase
Change all occurrences of identifier "Minute" to "minute"

Signed-off-by: Pragat Pandya <pragat.pandya@gmail.com>
Link: https://lore.kernel.org/r/20200210183558.11836-6-pragat.pandya@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Rename variable 'Hour' to 'hour'
Pragat Pandya [Mon, 10 Feb 2020 18:35:43 +0000 (00:05 +0530)]
staging: exfat: Rename variable 'Hour' to 'hour'

Fix checkpatch warning: Avoid CamelCase
Change all occurrences of identifier "Hour" to "hour"

Signed-off-by: Pragat Pandya <pragat.pandya@gmail.com>
Link: https://lore.kernel.org/r/20200210183558.11836-5-pragat.pandya@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Rename variable 'Day' to 'day'
Pragat Pandya [Mon, 10 Feb 2020 18:35:42 +0000 (00:05 +0530)]
staging: exfat: Rename variable 'Day' to 'day'

Fix checkpatch warning: Avoid CamelCase
Change all occurrences of identifier "Day" to "day"

Signed-off-by: Pragat Pandya <pragat.pandya@gmail.com>
Link: https://lore.kernel.org/r/20200210183558.11836-4-pragat.pandya@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Rename variable 'Month' to 'month'
Pragat Pandya [Mon, 10 Feb 2020 18:35:41 +0000 (00:05 +0530)]
staging: exfat: Rename variable 'Month' to 'month'

Fix checkpatch warning: Avoid CamelCase
Change all occurrences of identifier "Month" to "month"

Signed-off-by: Pragat Pandya <pragat.pandya@gmail.com>
Link: https://lore.kernel.org/r/20200210183558.11836-3-pragat.pandya@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Rename variable 'Year' to 'year'
Pragat Pandya [Mon, 10 Feb 2020 18:35:40 +0000 (00:05 +0530)]
staging: exfat: Rename variable 'Year' to 'year'

Fix checkpatch warning: Avoid CamelCase
Change all occurrences of identifier "Year" to "year"

Signed-off-by: Pragat Pandya <pragat.pandya@gmail.com>
Link: https://lore.kernel.org/r/20200210183558.11836-2-pragat.pandya@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: qlge: qlge_main.c: fix style issues
Mohana Datta Yelugoti [Tue, 11 Feb 2020 09:58:13 +0000 (15:28 +0530)]
staging: qlge: qlge_main.c: fix style issues

This patch fixes "WARNING: Missing a blank line after
declarations" generated from checkpatch.pl by adding
a blank line after declarations.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
Link: https://lore.kernel.org/r/20200211095813.11426-1-ymdatta.work@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wilc1000: directly fetch 'priv' handler from 'vif' instance
Ajay Singh [Tue, 11 Feb 2020 09:57:09 +0000 (09:57 +0000)]
staging: wilc1000: directly fetch 'priv' handler from 'vif' instance

The 'priv' handler is already present in 'vif' struct so directly fetch
its value from vif handler in wilc_handle_roc_expired().

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Link: https://lore.kernel.org/r/20200211152802.6096-2-ajay.kathat@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wilc1000: remove use of vendor specific IE for p2p handling
Ajay Singh [Tue, 11 Feb 2020 09:57:05 +0000 (09:57 +0000)]
staging: wilc1000: remove use of vendor specific IE for p2p handling

Remove the use of vendor specific IE parameter to decide
p2p_GO/p2p_Client roles between two 'wilc' device. Previously p2p group
formation between two 'wilc' device make use of vendor IE for roles
decision. The role is decided based on the 'go_intent' value.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Link: https://lore.kernel.org/r/20200211152802.6096-1-ajay.kathat@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: use more power-efficient sleep for reset
Michał Mirosław [Tue, 11 Feb 2020 10:35:04 +0000 (11:35 +0100)]
staging: wfx: use more power-efficient sleep for reset

Replace udelay() with usleep_range() as all uses are in a sleepable context.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Link: https://lore.kernel.org/r/59e1e4e5bd80c1879ef36eaa59916e47005dbb04.1581416843.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: use sleeping gpio accessors
Michał Mirosław [Tue, 11 Feb 2020 10:35:03 +0000 (11:35 +0100)]
staging: wfx: use sleeping gpio accessors

Driver calls GPIO get/set only from non-atomic context and so can use any
GPIOs.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Link: https://lore.kernel.org/r/cb19e7c521712d5a166e0b7e9cac4450798fdce0.1581416843.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: follow compatible = vendor,chip format
Michał Mirosław [Tue, 11 Feb 2020 10:35:02 +0000 (11:35 +0100)]
staging: wfx: follow compatible = vendor,chip format

As for SPI, follow "vendor,chip" format 'compatible' string also for
SDIO bus.

Fixes: 0096214a59a7 ("staging: wfx: add support for I/O access")
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Link: https://lore.kernel.org/r/96b95d52d0b613065fe655f1d0fe9d7c6adf65fb.1581416843.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: add proper "compatible" string
Michał Mirosław [Tue, 11 Feb 2020 10:35:02 +0000 (11:35 +0100)]
staging: wfx: add proper "compatible" string

Add "compatible" string matching "vendor,chip" template and proper
GPIO flags handling. Keep support for old name and reset polarity
for older devicetrees.

Cc: stable@vger.kernel.org # d3a5bcb4a17f ("gpio: add gpiod_toggle_active_low()")
Cc: stable@vger.kernel.org
Fixes: 0096214a59a7 ("staging: wfx: add support for I/O access")
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Link: https://lore.kernel.org/r/0e6dda06f145676861860f073a53dc95987c7ab5.1581416843.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: annotate nested gc_list vs tx queue locking
Michał Mirosław [Tue, 11 Feb 2020 10:35:01 +0000 (11:35 +0100)]
staging: wfx: annotate nested gc_list vs tx queue locking

Lockdep is complaining about recursive locking, because it can't make
a difference between locked skb_queues. Annotate nested locks and avoid
double bh_disable/enable.

[...]
insmod/815 is trying to acquire lock:
cb7d6418 (&(&list->lock)->rlock){+...}, at: wfx_tx_queues_clear+0xfc/0x198 [wfx]

but task is already holding lock:
cb7d61f4 (&(&list->lock)->rlock){+...}, at: wfx_tx_queues_clear+0xa0/0x198 [wfx]

[...]
Possible unsafe locking scenario:

      CPU0
      ----
 lock(&(&list->lock)->rlock);
 lock(&(&list->lock)->rlock);

Cc: stable@vger.kernel.org
Fixes: 9bca45f3d692 ("staging: wfx: allow to send 802.11 frames")
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Link: https://lore.kernel.org/r/5e30397af95854b4a7deea073b730c00229f42ba.1581416843.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: fix init/remove vs IRQ race
Michał Mirosław [Tue, 11 Feb 2020 10:35:01 +0000 (11:35 +0100)]
staging: wfx: fix init/remove vs IRQ race

Current code races in init/exit with interrupt handlers. This is noticed
by the warning below. Fix it by using devres for ordering allocations and
IRQ de/registration.

WARNING: CPU: 0 PID: 827 at drivers/staging/wfx/bus_spi.c:142 wfx_spi_irq_handler+0x5c/0x64 [wfx]
race condition in driver init/deinit

Cc: stable@vger.kernel.org
Fixes: 0096214a59a7 ("staging: wfx: add support for I/O access")
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/f0c66cbb3110c2736cd4357c753fba8c14ee3aee.1581416843.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: remove set but not used variable 'tx_priv'
YueHaibing [Tue, 11 Feb 2020 14:03:34 +0000 (22:03 +0800)]
staging: wfx: remove set but not used variable 'tx_priv'

drivers/staging/wfx/queue.c: In function wfx_tx_queues_get:
drivers/staging/wfx/queue.c:484:28: warning: variable tx_priv set but not used [-Wunused-but-set-variable]

commit 2e57865e79cf ("staging: wfx: pspoll_mask make no sense")
left behind this unused variable.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200211140334.55248-1-yuehaibing@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8188eu: rename variable pnetdev -> netdev
Michael Straube [Mon, 10 Feb 2020 20:08:30 +0000 (21:08 +0100)]
staging: rtl8188eu: rename variable pnetdev -> netdev

Rename the local variable pnetdev in rtw_alloc_etherdev_with_old_priv
to avoid hungarian notation and clear the last checkpatch warning in
the file osdep_service.c.

rtl8188eu/os_dep/osdep_service.c:32: WARNING: line over 80 characters

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20200210200830.22868-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Replace printk with pr_info
JieunKim [Mon, 10 Feb 2020 09:14:20 +0000 (18:14 +0900)]
staging: exfat: Replace printk with pr_info

pr_info is preferred to use than printk.
pr_info calls printk with KERN_INFO macros by itself.

Signed-off-by: JieunKim <jieun.kim4758@gmail.com>
Link: https://lore.kernel.org/r/20200210091421.12335-1-jieun.kim4758@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: comedi: ni_pcimio: add routes for NI PCIe-6251 and PCIe-6259
Ian Abbott [Fri, 7 Feb 2020 15:14:00 +0000 (15:14 +0000)]
staging: comedi: ni_pcimio: add routes for NI PCIe-6251 and PCIe-6259

We do not currently provide routing information for NI PCIe-6251 and
PCI-6259 boards, but they are functionally identical to the PCI-6251 and
PCI-6259 boards and can share their routing information.  (This has been
confirmed for the PCIe-6251 by Éric Piel, using the "NI MAX" software
for Windows.  It is hoped that it applies to PCIe-6259, but has not yet
been checked due to lack of hardware.)  Initialize the `alt_route_name`
member of the board information for PCIe-6251 and PCIe-6259 to allow
them to make use of the routing information provided for PCI-6251 and
PCI-6259 respectively.

Cc: Éric Piel <piel@delmic.com>
Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20200207151400.272678-5-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: comedi: ni_mio_common: Allow alternate board name for routes
Ian Abbott [Fri, 7 Feb 2020 15:13:59 +0000 (15:13 +0000)]
staging: comedi: ni_mio_common: Allow alternate board name for routes

We do not have or do not provide routing information for all supported
boards.  Some of the boards for which we do not provide routing
information actually have routes that are identical to a similar board
for which we already provide routing information.

To allow boards to share identical routing information, add an
`alt_route_name` member to `struct ni_board_struct`.  This will be
initialized to `NULL` for all boards except those that will use make use
of the identical routing information that has been provided for a
similar board, in which case it will name that board.  Pass the
`alt_route_name` member value to `ni_assign_device_routes()` as the
`alt_board_name` parameter, which it will use if no routing information
could be found for the actual board name.

Cc: Éric Piel <piel@delmic.com>
Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20200207151400.272678-4-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: comedi: ni_routes: Allow alternate board name for routes
Ian Abbott [Fri, 7 Feb 2020 15:13:58 +0000 (15:13 +0000)]
staging: comedi: ni_routes: Allow alternate board name for routes

We do not have or provide routing information available for all
supported boards.  Some of the boards for which we do not currently
provide routing information actually have identical routes to a similar
board for which we do provide routing information.  To avoid having to
provide duplicate routing information, add an "alternate board name"
parameter (possibly `NULl`) to `ni_assign_device_routes()` and
`ni_find_device_routes()`.  If the routing information cannot be found
for the actual board name, try finding it using the alternate board
name.

Cc: Éric Piel <piel@delmic.com>
Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20200207151400.272678-3-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: comedi: ni_routes: Refactor ni_find_valid_routes()
Ian Abbott [Fri, 7 Feb 2020 15:13:57 +0000 (15:13 +0000)]
staging: comedi: ni_routes: Refactor ni_find_valid_routes()

Split out the loops in `ni_find_valid_routes()` into separate functions:

* ni_find_route_values(device_family) to find the list of route values
  for a device family (e.g "ni-mseries"); and
* ni_find_valid_routes(board_name) to find the set of valid routes for a
  board name.

The functions above return `NULL` if the information is not found (as we
do not currently have the routing information available for all
supported boards).

Cc: Éric Piel <piel@delmic.com>
Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20200207151400.272678-2-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: qlge: remove spaces at the start of a line
Mohana Datta Yelugoti [Sun, 9 Feb 2020 17:36:28 +0000 (23:06 +0530)]
staging: qlge: remove spaces at the start of a line

This patch fixes "WARNING: please, no spaces at the start of a
line" by checkpatch.pl by replacing spaces with the tab.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
Link: https://lore.kernel.org/r/20200209173628.21221-1-ymdatta.work@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8192u: Add space to fix style issue
Sumera Priyadarsini [Sun, 9 Feb 2020 07:30:20 +0000 (13:00 +0530)]
staging: rtl8192u: Add space to fix style issue

This patch fixes the file r8190_rtl8256.c to avoid the following
checkpatch.pl warnings:
CHECK: spaces preferred around that '>>' (ctx:VxV)

Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
Link: https://lore.kernel.org/r/20200209073020.13423-1-sylphrenadin@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: pi433: Use the correct style for SPDX License Identifier
Nishad Kamdar [Sat, 8 Feb 2020 08:36:25 +0000 (14:06 +0530)]
staging: pi433: Use the correct style for SPDX License Identifier

This patch corrects the SPDX License Identifier style in
header files related to pi433 radio module drivers.
It assigns explicit block comment to the SPDX License Identifier.

Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Link: https://lore.kernel.org/r/20200208083621.GA3797@nishad
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8188eu: remove unnecessary RETURN label
Michael Straube [Thu, 6 Feb 2020 08:59:24 +0000 (09:59 +0100)]
staging: rtl8188eu: remove unnecessary RETURN label

Remove unnecessary RETURN label and use return directly instead. Since
the return type of rtw_free_netdev() is void, remove the return at the
end of the function.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20200206085924.21531-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>