platform/kernel/linux-rpi.git
5 years agodocs: iio: convert to ReST
Mauro Carvalho Chehab [Tue, 18 Jun 2019 20:53:40 +0000 (17:53 -0300)]
docs: iio: convert to ReST

Rename the iio documentation files to ReST, add an
index for them and adjust in order to produce a nice html
output via the Sphinx build system.

At its new index.rst, let's add a :orphan: while this is not linked to
the main index.rst file, in order to avoid build warnings.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: stm32-adc: add missing vdda-supply
Fabrice Gasnier [Wed, 19 Jun 2019 12:29:55 +0000 (14:29 +0200)]
iio: adc: stm32-adc: add missing vdda-supply

Add missing vdda-supply, analog power supply, to STM32 ADC. When vdda is
an independent supply, it needs to be properly turned on or off to supply
the ADC.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Fixes: 1add69880240 ("iio: adc: Add support for STM32 ADC core").
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: adc: stm32: add missing vdda supply
Fabrice Gasnier [Wed, 19 Jun 2019 12:29:54 +0000 (14:29 +0200)]
dt-bindings: iio: adc: stm32: add missing vdda supply

Add missing vdda-supply, analog power supply, to STM32 ADC. It's required
to properly supply the ADC.

Fixes: 841fcea454fe ("Documentation: dt-bindings: Document STM32 ADC DT
bindings")

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: stm32-dfsdm: add comment for 16 bits record
Olivier Moysan [Wed, 19 Jun 2019 13:03:51 +0000 (15:03 +0200)]
iio: adc: stm32-dfsdm: add comment for 16 bits record

Add a comment on DMA configuration for 16 bits record.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: stm32-dfsdm: add fast mode support
Olivier Moysan [Wed, 19 Jun 2019 13:03:50 +0000 (15:03 +0200)]
iio: adc: stm32-dfsdm: add fast mode support

The use of fast mode allows to get a larger set of solution
for filter parameters. This can be useful to reach a better
output sample resolution, when fast mode can be used.

Fast mode is selected at startup if it is relevant.
The startup is performed in postenable callback context,
where there are too tight time constraints for filter parameters
computation. For this reason both fast and non fast filter parameters
are pre-computed previously.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: stm32-dfsdm: manage data resolution in trigger mode
Olivier Moysan [Wed, 19 Jun 2019 13:03:49 +0000 (15:03 +0200)]
iio: adc: stm32-dfsdm: manage data resolution in trigger mode

Add output sample resolution management in scan mode.
Add stm32_dfsdm_process_data() function to share sample
processing between continuous and trigger modes.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: stm32-dfsdm: fix data type
Olivier Moysan [Wed, 19 Jun 2019 13:03:48 +0000 (15:03 +0200)]
iio: adc: stm32-dfsdm: fix data type

Fix the data type as DFSDM raw output is complements 2,
24bits left aligned in a 32-bit register.
This change does not affect AUDIO path
- Set data as signed for IIO (as for AUDIO)
- Set 8 bit right shift for IIO.
The 8 LSBs bits of data contains channel info and are masked.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Fixes: e2e6771c6462 ("IIO: ADC: add STM32 DFSDM sigma delta ADC support")
Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: stm32-dfsdm: fix output resolution
Olivier Moysan [Wed, 19 Jun 2019 13:03:47 +0000 (15:03 +0200)]
iio: adc: stm32-dfsdm: fix output resolution

In buffered mode, output samples are shifted left
unconditionally. This works for filter order 3,
but this shift is not adapted for other filter orders.
Compute required shift, left or right, and shift
output data accordingly.
Add also saturation management to avoid wrap-around
when maximum positive sample is reached.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Fixes: eca949800d2d ("IIO: ADC: add stm32 DFSDM support for PDM microphone")
Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoMAINTAINERS: add entry for sensirion sps30 driver
Tomasz Duszynski [Thu, 20 Jun 2019 19:50:11 +0000 (21:50 +0200)]
MAINTAINERS: add entry for sensirion sps30 driver

Add myself as a sensirion sps30 driver maintainer.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: chemical: sps30: convert bindings to yaml
Tomasz Duszynski [Thu, 20 Jun 2019 19:50:10 +0000 (21:50 +0200)]
dt-bindings: iio: chemical: sps30: 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>
5 years agoiio: sca3000: Potential endian bug in sca3000_read_event_value()
Dan Carpenter [Fri, 21 Jun 2019 09:18:28 +0000 (12:18 +0300)]
iio: sca3000: Potential endian bug in sca3000_read_event_value()

The problem is that "ret" is an int but we're casting it as
"(unsigned long *)&ret" when we do the for_each_set_bit() loop.  This
will not work on big endian 64 bit systems.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: st_accel: fix iio_triggered_buffer_{pre,post}enable positions
Alexandru Ardelean [Fri, 14 Jun 2019 10:47:25 +0000 (13:47 +0300)]
iio: st_accel: 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.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: xilinx: support all platforms
Robert Hancock [Mon, 10 Jun 2019 16:23:44 +0000 (10:23 -0600)]
iio: adc: xilinx: support all platforms

Since the XADC logic can be used with standalone Xilinx FPGAs, this
driver can potentially be used with many different platforms, not just
the Zynq and MicroBlaze platforms this driver was allowed to be built
for. There should be no platform-specific code in this driver, so just
delete the platform dependency.

Signed-off-by: Robert Hancock <hancock@sedsystems.ca>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: humidity: Replace older GPIO APIs with GPIO Consumer APIs for the dht11 sensor
Shobhit Kukreti [Tue, 11 Jun 2019 03:55:57 +0000 (20:55 -0700)]
iio: humidity: Replace older GPIO APIs with GPIO Consumer APIs for the dht11 sensor

The dht11 driver uses a single gpio to make measurements. It was
using the older global gpio numberspace. The patch replaces the
old gpio api with the new gpio descriptor based api.

Removed header files "linux/gpio.h" and "linux/of_gpio.h"

Signed-off-by: Shobhit Kukreti <shobhitkukreti@gmail.com>
Acked-by: Harald Geyer <harald@ccbib.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoMAINTAINERS: add counter/ftm-quaddec driver entry
Patrick Havelange [Wed, 12 Jun 2019 14:52:23 +0000 (16:52 +0200)]
MAINTAINERS: add counter/ftm-quaddec driver entry

Adding myself as maintainer for this driver

Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad7150: clean up of comments
Melissa Wen [Fri, 14 Jun 2019 16:33:19 +0000 (13:33 -0300)]
staging: iio: ad7150: clean up of comments

General cleaning of comments to remove useless information or improve
description.

Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad7150: simplify i2c SMBus return treatment
Melissa Wen [Fri, 14 Jun 2019 16:32:54 +0000 (13:32 -0300)]
staging: iio: ad7150: simplify i2c SMBus return treatment

Since i2c_smbus_write_byte_data returns no-positive value, this commit
making the treatment of its return value less verbose.

Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad7150: use FIELD_GET and GENMASK
Melissa Wen [Fri, 14 Jun 2019 16:32:21 +0000 (13:32 -0300)]
staging: iio: ad7150: use FIELD_GET and GENMASK

Use the bitfield macro FIELD_GET, and GENMASK to do the shift and mask in
one go. This makes the code more readable than explicit masking followed
by a shift.

Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad7150: use ternary operating to ensure 0/1 value
Melissa Wen [Fri, 14 Jun 2019 16:50:59 +0000 (13:50 -0300)]
staging: iio: ad7150: use ternary operating to ensure 0/1 value

Remove idiom and use ternary operator for consistently trigger 0/1 value
on variable declaration.

Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: ad_sigma_delta: return directly in ad_sd_buffer_postenable()
Alexandru Ardelean [Thu, 30 May 2019 07:25:41 +0000 (10:25 +0300)]
iio: ad_sigma_delta: return directly in ad_sd_buffer_postenable()

There is nothing being done after the `err_predisable` label, so just
remove it.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: amplifiers: ad8366: Add support for ADL5240 VGA
Alexandru Ardelean [Thu, 30 May 2019 13:18:12 +0000 (16:18 +0300)]
iio: amplifiers: ad8366: Add support for ADL5240 VGA

The ADL5240 is a high performance, digitally controlled variable gain
amplifier (VGA) operating from 100 MHz to 4000 MHz. The VGA integrates a
high performance, 20 dB gain, internally matched amplifier (AMP) with a
6-bit digital step attenuator (DSA) that has a gain control range of
31.5 dB in 0.5 dB steps with ±0.25 dB step accuracy.

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

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: amplifiers: ad8366: Add support for the ADA4961 DGA
Paul Cercueil [Thu, 30 May 2019 13:18:11 +0000 (16:18 +0300)]
iio: amplifiers: ad8366: Add support for the ADA4961 DGA

This change adds support for the ADA4961 BiCMOS RF Digital Gain Amplifier,
(DGA), which is optimized for driving heavy loads out 2.0 GHz and beyond.
The device typically achieves -90 dBc IMD3 performance at 500 MHz and
-85  dBc at 1.5 GHz.

Datasheet link:
 http://www.analog.com/media/en/technical-documentation/data-sheets/ADA4961.pdf

This change re-uses the existing ad8366 driver, as most logic is similar.
Also, this chip has a reset pin which is initialized during probe.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: amplifiers: ad8366: rework driver to allow other chips
Alexandru Ardelean [Thu, 30 May 2019 13:18:10 +0000 (16:18 +0300)]
iio: amplifiers: ad8366: rework driver to allow other chips

The SPI gain amplifiers are simple devices, with 1 or 2 channels, to which
are read-from/written-to.

The gain computation in ad8366_write_raw() has been updated to compute gain
in dB for negative values.

This driver will be extended to support other chips as well.
To do that, this rework handles the AD8366 device as a special-case (via
switch-statements). This will make things easier when adding new chips.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: amplifiers: ad8366: use own lock to guard state
Alexandru Ardelean [Thu, 30 May 2019 13:18:09 +0000 (16:18 +0300)]
iio: amplifiers: ad8366: use own lock to guard state

This driver is still using iio_dev's mlock to guard against inconsistent
state. This has been discouraged for some time.

This change switches to using it's own mutex, defined on the state struct.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: amplifiers: update license information
Alexandru Ardelean [Thu, 30 May 2019 13:18:08 +0000 (16:18 +0300)]
iio: amplifiers: update license information

Use the new `SPDX-License-Identifier` tag to specify the license.
For ad8366, also update copyright years in the header part.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: accel: adxl372: switch to YAML bindings
Lucas Oshiro [Fri, 31 May 2019 20:11:14 +0000 (17:11 -0300)]
dt-bindings: iio: accel: adxl372: switch to YAML bindings

Convert the old device tree documentation to yaml format.

Signed-off-by: Lucas Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Rodrigo Ribeiro <rodrigorsdc@gmail.com>
Co-developed-by: Rodrigo Ribeiro <rodrigorsdc@gmail.com>
Reviewed-by: Matheus Tavares <matheus.bernardino@usp.br>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adxl372: fix iio_triggered_buffer_{pre,post}enable positions
Alexandru Ardelean [Wed, 29 May 2019 13:01:08 +0000 (16:01 +0300)]
iio: adxl372: 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.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: frequency: Add docs for ADF4371 PLL
Stefan Popa [Tue, 4 Jun 2019 14:58:21 +0000 (17:58 +0300)]
dt-bindings: iio: frequency: Add docs for ADF4371 PLL

Document support for Analog Devices ADF4371 SPI Wideband Synthesizer.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: frequency: adf4371: Add support for ADF4371 PLL
Stefan Popa [Tue, 4 Jun 2019 14:58:02 +0000 (17:58 +0300)]
iio: frequency: adf4371: Add support for ADF4371 PLL

The ADF4371 is a frequency synthesizer with an integrated voltage
controlled oscillator (VCO) for phase-locked loops (PLLs). The ADF4371
has an integrated VCO with a fundamental output frequency ranging from
4000 MHz to 8000 MHz. In addition, the VCO frequency is connected to
divide by 1, 2, 4, 8, 16, 32, or 64 circuits that allows the user to
generate radio frequency (RF) output frequencies as low as 62.5 MHz at
RF8x. A frequency multiplier at RF16x generates from 8 GHz to 16 GHz. A
frequency quadrupler generates frequencies from 16 GHz to 32 GHz at RF32x.
RFAUX8x duplicates the frequency range of RF8x or permits direct access to
the VCO output.

The driver takes the reference input frequency from the device tree and
uses it to calculate and maximize the PFD frequency (frequency of the phase
frequency detector). The PFD frequency is further used to calculate the
timeouts: synthesizer lock, VCO band selection, automatic level
calibration (ALC) and PLL settling time.

This initial driver exposes the attributes for setting the frequency and
enabling/disabling the different adf4371 channels.

Datasheet:
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/adf4371.pdf
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: get device name from st_lsm6dsx_sensor_settings
Lorenzo Bianconi [Sat, 8 Jun 2019 12:30:08 +0000 (14:30 +0200)]
iio: imu: st_lsm6dsx: get device name from st_lsm6dsx_sensor_settings

Introduce sensor name in st_lsm6dsx_sensor_settings table. This is
a preliminary patch to add I3C support to st_lsm6dsx since i3c_device_id
data structure does not contain a name field

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imx7d_adc: Remove unneeded 'average_en' member
Fabio Estevam [Mon, 3 Jun 2019 19:34:33 +0000 (16:34 -0300)]
iio: imx7d_adc: Remove unneeded 'average_en' member

average_en is always true, so there is not really need for
this structure member.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imx7d_adc: Fit into a single line
Fabio Estevam [Mon, 3 Jun 2019 19:34:32 +0000 (16:34 -0300)]
iio: imx7d_adc: Fit into a single line

All the parameters of devm_request_irq() can fit into a
single line, so place them all in a single line
for better readability.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imx7d_adc: Introduce a definition for the input clock
Fabio Estevam [Mon, 3 Jun 2019 19:34:31 +0000 (16:34 -0300)]
iio: imx7d_adc: Introduce a definition for the input clock

Since the input clock is always 24MHz, there is no need for storing
this value into a variable.

Use a definition instead, which is more appropriate in this case.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imx7d_adc: Remove unneeded error message
Fabio Estevam [Mon, 3 Jun 2019 19:34:30 +0000 (16:34 -0300)]
iio: imx7d_adc: Remove unneeded error message

In case of ioremap failure, the core code will take care of printing
the error message, so there is no need for having a local error
message in the driver.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: light: stk3310: Add support for stk3335
Martijn Braam [Mon, 3 Jun 2019 19:20:39 +0000 (21:20 +0200)]
iio: light: stk3310: Add support for stk3335

The stk3335 light/proximity sensor is similar to the stk3310 and stk3311
sensors and works with the stk3310 driver.

Signed-off-by: Martijn Braam <martijn@brixit.nl>
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio:core: Fix bug in length of event info_mask and catch unhandled bits set in masks.
Young Xiao [Tue, 4 Jun 2019 12:40:00 +0000 (20:40 +0800)]
iio:core: Fix bug in length of event info_mask and catch unhandled bits set in masks.

The incorrect limit for the for_each_set_bit loop was noticed whilst fixing
this other case.  Note that as we only have 3 possible entries a the moment
and the value was set to 4, the bug would not have any effect currently.
It will bite fairly soon though, so best fix it now.

See commit ef4b4856593f ("iio:core: Fix bug in length of event info_mask and
catch unhandled bits set in masks.") for details.

Signed-off-by: Young Xiao <92siuyang@gmail.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad2s1210: Remove platform data NULL check in probe
Alexandru Ardelean [Thu, 6 Jun 2019 10:34:09 +0000 (13:34 +0300)]
staging: iio: ad2s1210: Remove platform data NULL check in probe

The driver only needs to access GPIOs via GPIOLIB. And SPI can be
configured via device-tree or ACPI.

The platform data is a remnant from another time, and should not cause the
driver to error out during probing if it is NULL.
Also, it's not used.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: light: bh1780: simplify getting the adapter of a client
Wolfram Sang [Sat, 8 Jun 2019 10:55:42 +0000 (12:55 +0200)]
iio: light: bh1780: simplify getting the adapter of a client

We have a dedicated pointer for that, so use it. Much easier to read and
less computation involved.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: ad7606: Add software configuration
Beniamin Bia [Mon, 27 May 2019 12:56:48 +0000 (15:56 +0300)]
iio: adc: ad7606: Add software configuration

Because this driver will support multiple configurations for software,
the software configuration was made generic.

Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: ad7606: Move oversampling and scale options to chip info
Beniamin Bia [Mon, 27 May 2019 12:56:47 +0000 (15:56 +0300)]
iio: adc: ad7606: Move oversampling and scale options to chip info

The device dependent options which are going to be different for devices
which will be supported  in the future by this driver,
were moved in chip info for a more generic driver. This patch allows
supporting more devices by the driver. Also, it is an intermediate
step of adding support for ad7616 in software mode.

Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: meson_saradc: update with SPDX Licence identifier
Neil Armstrong [Mon, 27 May 2019 13:43:14 +0000 (15:43 +0200)]
iio: adc: meson_saradc: update with SPDX Licence identifier

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoMAINTAINERS: add entry for ad7780 adc driver
Renato Lui Geh [Sat, 25 May 2019 01:26:55 +0000 (22:26 -0300)]
MAINTAINERS: add entry for ad7780 adc driver

This patch adds a MAINTAINERS entry for the AD7780 ADC driver.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: adc: add adi,ad7780.yaml binding
Renato Lui Geh [Sat, 25 May 2019 01:26:30 +0000 (22:26 -0300)]
dt-bindings: iio: adc: add adi,ad7780.yaml binding

This patch adds a YAML binding for the Analog Devices AD7780/1 and
AD7170/1 analog-to-digital converters.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: accel: add missing sensor for some 2-in-1 based ultrabooks
Luís Ferreira [Tue, 2 Apr 2019 16:04:30 +0000 (17:04 +0100)]
iio: accel: add missing sensor for some 2-in-1 based ultrabooks

Some ultrabooks, like Teclast F6 Pro, use KIOX010A sensor on display
and KIOX020A sensor on keyboard base, to detect tablet mode or screen
orientation.

Signed-off-by: Luís Ferreira <luis@aurorafoss.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodocs: iio: add precision about sampling_frequency_available
Fabien Lahoudere [Thu, 23 May 2019 09:07:37 +0000 (11:07 +0200)]
docs: iio: add precision about sampling_frequency_available

The documentation give some exemple on what format can be expected
from sampling_frequency_available sysfs attribute

Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: dps310: Add pressure sensing capability
Eddie James [Tue, 21 May 2019 02:13:34 +0000 (21:13 -0500)]
iio: dps310: Add pressure sensing capability

The DPS310 supports measurement of pressure, so support that in the
driver. Use background measurement like the temperature sensing and
default to lowest precision and lowest measurement rate.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: dps310: Temperature measurement errata
Christopher Bostic [Tue, 21 May 2019 02:13:33 +0000 (21:13 -0500)]
iio: dps310: Temperature measurement errata

Add a manufacturer's suggested workaround to deal with early revisions
of chip that don't indicate correct temperature. Readings can be in the
~60C range when they should be in the ~20's.

Signed-off-by: Christopher Bostic <cbostic@linux.vnet.ibm.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: Add driver for Infineon DPS310
Joel Stanley [Tue, 21 May 2019 02:13:32 +0000 (21:13 -0500)]
iio: Add driver for Infineon DPS310

The DPS310 is a temperature and pressure sensor. It can be accessed over
i2c and SPI, but this driver only supports polling over i2c.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adis16240: add of_match_table entry
Rodrigo Ribeiro [Fri, 24 May 2019 03:29:50 +0000 (00:29 -0300)]
staging: iio: adis16240: add of_match_table entry

This patch adds of_match_table entry in device driver in order to
enable spi fallback probing.

Signed-off-by: Rodrigo Ribeiro <rodrigorsdc@gmail.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad7746: add device tree support
João Seckler [Sat, 18 May 2019 22:27:33 +0000 (19:27 -0300)]
staging: iio: ad7746: add device tree support

Add a of_device_id struct variable and subsequent call to
MODULE_DEVICE_TABLE macro to support device tree.

Signed-off-by: João Seckler <joaoseckler@gmail.com>
Signed-off-by: Lucas Oshiro <lucasseikioshiro@gmail.com>
Co-developed-by: Lucas Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adis16240: add device to module device table
Lucas Oshiro [Sat, 18 May 2019 21:44:34 +0000 (18:44 -0300)]
staging: iio: adis16240: add device to module device table

Add a of_device_id struct and MODULE_DEVICE_TABLE call, in order to add
device-tree support for this driver.

Signed-off-by: Lucas Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Rodrigo Ribeiro <rodrigorsdc@gmail.com>
Co-developed-by: Rodrigo Ribeiro <rodrigorsdc@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adt7316: create of_device_id array
Bárbara Fernandes [Sat, 18 May 2019 22:43:33 +0000 (19:43 -0300)]
staging: iio: adt7316: create of_device_id array

Create structure of type of_device_id in order to register all devices
the driver is able to manage.

Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Wilson Sales <spoonm@spoonm.org>
Co-developed-by: Wilson Sales <spoonm@spoonm.org>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adis16203: Add of_device_id table
Thiago Estrela [Sat, 18 May 2019 22:42:13 +0000 (19:42 -0300)]
staging: iio: adis16203: Add of_device_id table

Accomplish device tree compatibility to driver ADIS16203
by adding of_device_id table and making a subsequent call to
MODULE_DEVICE_TABLE.

Signed-off-by: Thiago Estrela <thiagestrela@gmail.com>
Signed-off-by: Tiago Napoli <napoli.tiago96@gmail.com>
Co-developed-by: Tiago Napoli <napoli.tiago96@gmail.com>
Signed-off-by: Pedro Sousa <pedroteosousa@gmail.com>
Co-developed-by: Pedro Sousa <pedroteosousa@gmail.com>
Reviewed-by: Matheus Tavares <matheus.bernardino@usp.br>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad9834: add of_device_id table
João Victor Marques de Oliveira [Sat, 18 May 2019 22:47:20 +0000 (19:47 -0300)]
staging: iio: ad9834: add of_device_id table

Add a of_device_id struct array of_match_table variable and subsequent
call to MODULE_DEVICE_TABLE macro to enable explicit device tree support.

Co-developed-by: Thiago L. A. Miller <tmiller@mochsl.org.br>
Signed-off-by: Thiago L. A. Miller <tmiller@mochsl.org.br>
Co-developed-by: Osvaldo M. Yasuda <omyasuda@yahoo.com.br>
Signed-off-by: Osvaldo M. Yasuda <omyasuda@yahoo.com.br>
Signed-off-by: João Victor Marques de Oliveira <joao.marques.oliveira@usp.br>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: cdc: ad7150: create macro for capacitance channels
Bárbara Fernandes [Sat, 18 May 2019 22:41:36 +0000 (19:41 -0300)]
staging: iio: cdc: ad7150: create macro for capacitance channels

Create macro for capacitance channels in order to remove the repeated
code and improve its readability.

Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Wilson Sales <spoonm@spoonm.org>
Co-developed-by: Wilson Sales <spoonm@spoonm.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoMAINTAINERS: Add entry for anybuss drivers
Sven Van Asbroeck [Fri, 24 May 2019 19:10:13 +0000 (15:10 -0400)]
MAINTAINERS: Add entry for anybuss drivers

Add myself as the maintainer of the anybuss bus driver, and its client
drivers.

Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoMAINTAINERS: Add entry for fieldbus subsystem
Sven Van Asbroeck [Fri, 24 May 2019 19:10:12 +0000 (15:10 -0400)]
MAINTAINERS: Add entry for fieldbus subsystem

Add myself as the maintainer of the fieldbus subsystem.

Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: remove unnecessary oom message
Simon Sandström [Thu, 23 May 2019 12:51:43 +0000 (14:51 +0200)]
staging: kpc2000: remove unnecessary oom message

Fixes checkpatch.pl warning "Possible unnecessary 'out of memory'
message".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: remove unnecessary include in cell_probe.c
Simon Sandström [Thu, 23 May 2019 12:51:42 +0000 (14:51 +0200)]
staging: kpc2000: remove unnecessary include in cell_probe.c

Fixes checkpatch.pl warning "Use #include <linux/io.h> instead of
<asm/io.h>".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: remove unnecessary braces in cell_probe.c
Simon Sandström [Thu, 23 May 2019 12:51:41 +0000 (14:51 +0200)]
staging: kpc2000: remove unnecessary braces in cell_probe.c

Fixes checkpatch.pl warnings "braces {} are not necessary for single
statement blocks".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: use kzalloc(sizeof(var)...) in cell_probe.c
Simon Sandström [Thu, 23 May 2019 12:51:40 +0000 (14:51 +0200)]
staging: kpc2000: use kzalloc(sizeof(var)...) in cell_probe.c

Fixes checkpatch.pl warning "Prefer kzalloc(sizeof(*kudev)...) over
kzalloc(sizeof(struct kpc_uio_device)...)"

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: remove extra blank lines in cell_probe.c
Simon Sandström [Thu, 23 May 2019 12:51:39 +0000 (14:51 +0200)]
staging: kpc2000: remove extra blank lines in cell_probe.c

Fixes checkpatch.pl warnings "Please don't use multiple blank lines".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: fix alignment issues in cell_probe.c
Simon Sandström [Thu, 23 May 2019 12:51:38 +0000 (14:51 +0200)]
staging: kpc2000: fix alignment issues in cell_probe.c

Fixes checkpatch.pl warnings "Alignment should match open parenthesis"
and "Lines should not end with a '('".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: add missing asterisk in comment
Simon Sandström [Thu, 23 May 2019 12:51:37 +0000 (14:51 +0200)]
staging: kpc2000: add missing asterisk in comment

Fixes checkpatch.pl error "code indent should use tabs where possible".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: use __func__ in debug messages
Simon Sandström [Thu, 23 May 2019 12:51:36 +0000 (14:51 +0200)]
staging: kpc2000: use __func__ in debug messages

Fixes checkpatch.pl warning "Prefer using '"%s...", __func__' to using
'<function name>', this function's name, in a string".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: add blank line after declarations
Simon Sandström [Thu, 23 May 2019 12:51:35 +0000 (14:51 +0200)]
staging: kpc2000: add blank line after declarations

Fixes checkpatch.pl warning "Missing a blank line after declarations".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: pi433: Remove unnecessary variable
Nishka Dasgupta [Thu, 23 May 2019 12:53:41 +0000 (18:23 +0530)]
staging: pi433: Remove unnecessary variable

The variable retval is assigned constant values twice, and can therefore
be replaced by its values.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: remove invalid spaces in cell_probe.c
Simon Sandström [Wed, 22 May 2019 20:58:49 +0000 (22:58 +0200)]
staging: kpc2000: remove invalid spaces in cell_probe.c

Fixes checkpatch.pl error "space prohibited before/after that
parenthesis".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: add space after comma in cell_probe.c
Simon Sandström [Wed, 22 May 2019 20:58:48 +0000 (22:58 +0200)]
staging: kpc2000: add space after comma in cell_probe.c

Fixes checkpatch.pl error "space required after that ','".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: add spaces around operators in cell_probe.c
Simon Sandström [Wed, 22 May 2019 20:58:47 +0000 (22:58 +0200)]
staging: kpc2000: add spaces around operators in cell_probe.c

Fixes checkpatch.pl warning "spaces preferred around that <op>".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: fix invalid linebreaks in cell_probe.c
Simon Sandström [Wed, 22 May 2019 20:58:46 +0000 (22:58 +0200)]
staging: kpc2000: fix invalid linebreaks in cell_probe.c

Fixes checkpatch.pl error "else should follow close brace '}'" and
"trailing statements should be on next line".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: add space between ) and { in cell_probe.c
Simon Sandström [Wed, 22 May 2019 20:58:45 +0000 (22:58 +0200)]
staging: kpc2000: add space between ) and { in cell_probe.c

Fixes checkpatch.pl error "space required before the open brace '{'".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: fix indent in cell_probe.c
Simon Sandström [Wed, 22 May 2019 20:58:44 +0000 (22:58 +0200)]
staging: kpc2000: fix indent in cell_probe.c

Use tabs instead of spaces for indentation.

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8723bs: core: rtw_recv: fix warning Comparison to NULL
Hariprasad Kelam [Thu, 23 May 2019 02:50:59 +0000 (08:20 +0530)]
staging: rtl8723bs: core: rtw_recv: fix warning Comparison to NULL

fix below warning reported by checkpatch

CHECK: Comparison to NULL could be written
"!precvpriv->pallocated_frame_buf"
CHECK: Comparison to NULL could be written "padapter"

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
-----
changes in v2:
Corected few erorrs like (!*psta == NULL) pointed in
review

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: kpc_i2c: fix platform_no_drv_owner.cocci warnings
kbuild test robot [Wed, 22 May 2019 19:58:15 +0000 (03:58 +0800)]
staging: kpc2000: kpc_i2c: fix platform_no_drv_owner.cocci warnings

drivers/staging/kpc2000/kpc2000_i2c.c:652:3-8: No need to set .owner here. The core will do it.

 Remove .owner field if calls are used which set it automatically

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

Fixes: 43ad38191816 ("staging: kpc2000: kpc_i2c: add static qual to local symbols in kpc_i2c.c")
CC: Geordan Neukum <gneukum1@gmail.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: unisys: visornic: Replace GFP_ATOMIC with GFP_KERNEL
Hariprasad Kelam [Wed, 22 May 2019 17:05:30 +0000 (22:35 +0530)]
staging: unisys: visornic: Replace GFP_ATOMIC with GFP_KERNEL

As per below information

GFP_KERNEL  FLAG

This is a normal allocation and might block. This is the flag to use in
process context code when it is safe to sleep.

GFP_ATOMIC FLAG

The allocation is high-priority and does not sleep. This is the flag to
use in interrupt handlers, bottom halves and other situations where you
cannot sleep

And we can take advantage of GFP_KERNEL , as when system is in low
memory chances of getting success is high compared to GFP_ATOMIC.

As visornic_probe is in  process context we can use GPF_KERNEL.

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: kpc_i2c: add static qual to local symbols in kpc_i2c.c
Geordan Neukum [Wed, 22 May 2019 12:14:02 +0000 (12:14 +0000)]
staging: kpc2000: kpc_i2c: add static qual to local symbols in kpc_i2c.c

kpc_i2c.c declares:
  - two functions
    - pi2c_probe()
    - pi2c_remove()
  - one struct
    - i2c_plat_driver_i
which are local to the file, yet missing the static qualifier. Add the
static qualifier to these symbols.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: kpc_i2c: Remove unnecessary function tracing prints
Geordan Neukum [Wed, 22 May 2019 12:14:01 +0000 (12:14 +0000)]
staging: kpc2000: kpc_i2c: Remove unnecessary function tracing prints

Many of the functions in kpc_i2c log debug-level messages to the
kernel log message buffer upon invocation. This is unnecessary, as
debugging tools like kgdb, kdb, etc. or the tracing tool ftrace
should be able to provide this same information. Therefore, remove
these print statements.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: kpc_i2c: use <linux/io.h> instead of <asm/io.h>
Geordan Neukum [Wed, 22 May 2019 12:14:00 +0000 (12:14 +0000)]
staging: kpc2000: kpc_i2c: use <linux/io.h> instead of <asm/io.h>

Rather than include asm/io.h, include linux/io.h. Issue reported
by the script checkpatch.pl.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: kpc_i2c: newline fixups to meet linux style guide
Geordan Neukum [Wed, 22 May 2019 12:13:59 +0000 (12:13 +0000)]
staging: kpc2000: kpc_i2c: newline fixups to meet linux style guide

The linux coding style document states:

  1) That braces should not be used where a single single statement
     will do. Therefore all instances of single block statements
     wrapped in braces that do not meet the qualifications of any
     of the exceptions to the rule should be fixed up.

  2) That the declaration of variables local to a given function
     should be immediately followed by a blank newline. Therefore,
     the single instance of this in kpc2000_i2c.c should be fixed
     up.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: kpc_i2c: remove unused module param disable_features
Geordan Neukum [Wed, 22 May 2019 12:13:58 +0000 (12:13 +0000)]
staging: kpc2000: kpc_i2c: remove unused module param disable_features

The module parameter 'disable_features' is currently unused. Therefore,
it should be removed.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8192u: Remove an unnecessary NULL check
Nathan Chancellor [Tue, 21 May 2019 17:42:21 +0000 (10:42 -0700)]
staging: rtl8192u: Remove an unnecessary NULL check

Clang warns:

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:2663:47: warning:
address of array 'param->u.wpa_ie.data' will always evaluate to 'true'
[-Wpointer-bool-conversion]
            (param->u.wpa_ie.len && !param->u.wpa_ie.data))
                                    ~~~~~~~~~~~~~~~~~^~~~

This was exposed by commit deabe03523a7 ("Staging: rtl8192u: ieee80211:
Use !x in place of NULL comparisons") because we disable the warning
that would have pointed out the comparison against NULL is also false:

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:2663:46: warning:
comparison of array 'param->u.wpa_ie.data' equal to a null pointer is
always false [-Wtautological-pointer-compare]
            (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL))
                                    ~~~~~~~~~~~~~~~~^~~~    ~~~~

Remove it so clang no longer warns.

Link: https://github.com/ClangBuiltLinux/linux/issues/487
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: removed superfluous NULL checks from device attribute call-backs.
Jeremy Sowden [Tue, 21 May 2019 10:35:24 +0000 (11:35 +0100)]
staging: kpc2000: removed superfluous NULL checks from device attribute call-backs.

All the attribute show call-backs check whether pcard is NULL.  However,
pci_set_drvdata(pdev, pcard) is called before the sysfs files are
created during probe, and pci_set_drvdata(pdev, NULL) is not called
until after they are destroyed during remove; therefore, pcard will not
be NULL, and we can drop the checks.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: simplified kp2000_device retrieval in device attribute call-backs.
Jeremy Sowden [Tue, 21 May 2019 10:35:23 +0000 (11:35 +0100)]
staging: kpc2000: simplified kp2000_device retrieval in device attribute call-backs.

All the call-backs used the same formula to retrieve the pcard from dev:

  struct pci_dev *pdev = to_pci_dev(dev);
  struct kp2000_device *pcard;

  if (!pdev)
    return NULL;

  pcard = pci_get_drvdata(pdev);

Since to_pci_dev is a wrapper for container_of, it will not return NULL,
and since pci_get_drvdata just calls dev_get_drvdata on the dev member
of pdev, this is equivalent to:

  struct kp2000_device *pcard = dev_get_drvdata(&(container_of(dev, struct pci_dev, dev)->dev));

and we can simplify it to:

  struct kp2000_device *pcard = dev_get_drvdata(dev);

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: use IDA to assign card numbers.
Jeremy Sowden [Tue, 21 May 2019 10:35:22 +0000 (11:35 +0100)]
staging: kpc2000: use IDA to assign card numbers.

Previously the next card number was assigned from a static int local
variable.  Replaced it with an IDA.  Avoids the assignment of ever-
increasing card-numbers by allowing them to be reused.

Updated TODO.

Corrected format-specifier for unsigned pcard->card_num.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: added separate show functions for readable kp device attributes...
Jeremy Sowden [Tue, 21 May 2019 10:35:21 +0000 (11:35 +0100)]
staging: kpc2000: added separate show functions for readable kp device attributes, defined them as read-only, and declared them static.

Defined separate simple show functions for each attribute instead of
having a one big one containing a chain of conditionals.

Replaced calls to scnprintf with sprintf since all the outputs are
single integers.

All the readable device attributes are read-only, so used DEVICE_ATTR_RO
to define them.

The definitions are only used to populate the kp_attr_list attribute
array, so declared them as static.

Fixes the following sparse warnings:

  drivers/staging/kpc2000/kpc2000/core.c:152:1: warning: symbol 'dev_attr_ssid' was not declared. Should it be static?
  drivers/staging/kpc2000/kpc2000/core.c:153:1: warning: symbol 'dev_attr_ddna' was not declared. Should it be static?
  drivers/staging/kpc2000/kpc2000/core.c:154:1: warning: symbol 'dev_attr_card_id' was not declared. Should it be static?
  drivers/staging/kpc2000/kpc2000/core.c:155:1: warning: symbol 'dev_attr_hw_rev' was not declared. Should it be static?
  drivers/staging/kpc2000/kpc2000/core.c:156:1: warning: symbol 'dev_attr_build' was not declared. Should it be static?
  drivers/staging/kpc2000/kpc2000/core.c:157:1: warning: symbol 'dev_attr_build_date' was not declared. Should it be static?
  drivers/staging/kpc2000/kpc2000/core.c:158:1: warning: symbol 'dev_attr_build_time' was not declared. Should it be static?
  drivers/staging/kpc2000/kpc2000/core.c:159:1: warning: symbol 'dev_attr_cpld_reg' was not declared. Should it be static?
  drivers/staging/kpc2000/kpc2000/core.c:161:1: warning: symbol 'dev_attr_cpld_reconfigure' was not declared. Should it be static?

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: added a helper to get struct kp2000_device from struct device.
Jeremy Sowden [Tue, 21 May 2019 10:35:20 +0000 (11:35 +0100)]
staging: kpc2000: added a helper to get struct kp2000_device from struct device.

The attribute call-backs all use the same formula to get the pcard from
dev:

  struct pci_dev *pdev = to_pci_dev(dev);
  struct kp2000_device *pcard;

  if (!pdev)
    return -ENXIO;
  pcard = pci_get_drvdata(pdev);
  if (!pcard)
    return -ENXIO;

Added a function to reduce the duplicated code.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: improved formatting of core.c.
Jeremy Sowden [Tue, 21 May 2019 10:35:19 +0000 (11:35 +0100)]
staging: kpc2000: improved formatting of core.c.

  * Indented with tabs.
  * Broke lines over 80 columns where possible.
  * Removed braces from one-statement blocks.
  * Tidied up some comments.
  * Removed multiple blank lines.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8723bs: Fix Coverity warning in rtw_dbg_port()
Hans de Goede [Tue, 21 May 2019 19:54:12 +0000 (21:54 +0200)]
staging: rtl8723bs: Fix Coverity warning in rtw_dbg_port()

Fix the following Coverity warning:

File: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c in function
rtw_dbg_port():

CID 18480: Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
dead_error_condition: The condition (extra_arg & 7U) > 7U cannot be true.

        if ((extra_arg & 0x07) > 0x07)
                padapter->driver_ampdu_spacing = 0xFF;
        else
                padapter->driver_ampdu_spacing = extra_arg;

Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: remove redundant masking of pkt_offset
Colin Ian King [Tue, 21 May 2019 13:17:06 +0000 (14:17 +0100)]
staging: wilc1000: remove redundant masking of pkt_offset

The masking update of pkg_offset is redundant as the updated
value is never read and pkg_offset is re-assigned on the next
iteration of the loop.  Clean this up by removing the redundant
assignment.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Adham Abozaeid <adham.abozaeid@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: fieldbus: arcx-anybus: change custom -> mmio regmap
Sven Van Asbroeck [Tue, 21 May 2019 18:29:32 +0000 (14:29 -0400)]
staging: fieldbus: arcx-anybus: change custom -> mmio regmap

The arcx-anybus's registers are accessed via a memory-mapped
IO region. A regmap associated with this region is created
using custom reg_read() / reg_write() callbacks.

However, an abstraction which creates a memory-mapped IO
region backed regmap already exists: devm_regmap_init_mmio().

Replace the custom regmap with the existing kernel abstraction.
As a pleasant side-effect, sparse warnings now disappear.

Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: rtl8188eu: core: Use !x in place of NULL comparisons
Puranjay Mohan [Tue, 21 May 2019 14:32:25 +0000 (20:02 +0530)]
Staging: rtl8188eu: core: Use !x in place of NULL comparisons

Change (x == NULL) to !x and (x != NULL) to x, to fix
following checkpatch.pl warnings:
CHECK: Comparison to NULL could be written "!x".

Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: rtl8188eu: os_dep: Replace comparison with zero to !x
Puranjay Mohan [Tue, 21 May 2019 14:16:42 +0000 (19:46 +0530)]
Staging: rtl8188eu: os_dep: Replace comparison with zero to !x

Change comparison to zero to !x.
Replace (x == 0) to !x.

Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: rtl8192u: ieee80211: Replace function names in strings with "%s", __func__
Puranjay Mohan [Tue, 21 May 2019 14:07:11 +0000 (19:37 +0530)]
Staging: rtl8192u: ieee80211: Replace function names in strings with "%s", __func__

Use "%s", __func__ in place of strings which contain function names.

Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: rtl8723bs: os_dep: Remove functions that don't do anything.
Puranjay Mohan [Tue, 21 May 2019 13:30:12 +0000 (19:00 +0530)]
Staging: rtl8723bs: os_dep: Remove functions that don't do anything.

Remove functions which just print the name of function and return 0,
These functions fake the network core to say that they support these
options.

Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: removed two kpc_uio_class device attributes.
Jeremy Sowden [Tue, 21 May 2019 07:56:29 +0000 (08:56 +0100)]
staging: kpc2000: removed two kpc_uio_class device attributes.

The show functions of two attributes output nothing and they are unused.
Removed them.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Reported-by: Matt Sickler <matt.sickler@daktronics.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: kpc2000: added separate show functions for kpc_uio_class device attributes...
Jeremy Sowden [Tue, 21 May 2019 07:56:28 +0000 (08:56 +0100)]
staging: kpc2000: added separate show functions for kpc_uio_class device attributes, defined them as read-only and declared them static.

Defined separate simple show functions for each attribute instead of
having a one big one containing a chain of conditionals.

Replaced scnprintf calls with sprintf since all the outputs are short
bounded strings or single integers.

All of the device attributes are read-only, so used DEVICE_ATTR_RO to
define them.

The definitions are only used to populate the kpc_uio_class_attrs
attribute array, so declared them as static.

Fixes the following sparse warnings:

  drivers/staging/kpc2000/kpc2000/cell_probe.c:220:1: warning: symbol 'dev_attr_offset' was not declared. Should it be static?
  drivers/staging/kpc2000/kpc2000/cell_probe.c:221:1: warning: symbol 'dev_attr_size' was not declared. Should it be static?
  drivers/staging/kpc2000/kpc2000/cell_probe.c:222:1: warning: symbol 'dev_attr_type' was not declared. Should it be static?
  drivers/staging/kpc2000/kpc2000/cell_probe.c:223:1: warning: symbol 'dev_attr_s2c_dma' was not declared. Should it be static?
  drivers/staging/kpc2000/kpc2000/cell_probe.c:224:1: warning: symbol 'dev_attr_c2s_dma' was not declared. Should it be static?
  drivers/staging/kpc2000/kpc2000/cell_probe.c:225:1: warning: symbol 'dev_attr_irq_count' was not declared. Should it be static?
  drivers/staging/kpc2000/kpc2000/cell_probe.c:226:1: warning: symbol 'dev_attr_irq_base_num' was not declared. Should it be static?
  drivers/staging/kpc2000/kpc2000/cell_probe.c:227:1: warning: symbol 'dev_attr_core_num' was not declared. Should it be static?

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8723bs: hal: Remove unused variable
Nishka Dasgupta [Tue, 21 May 2019 06:40:35 +0000 (12:10 +0530)]
staging: rtl8723bs: hal: Remove unused variable

Remove local variable psdio which is declared but not used (or returned)
in its function.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishka.dasgupta@yahoo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vt6656: manage error path during device initialization
Quentin Deslandes [Mon, 20 May 2019 16:39:05 +0000 (16:39 +0000)]
staging: vt6656: manage error path during device initialization

Check for error during device initialization callback and return a
meaningful error code or zero on success.

Signed-off-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vt6656: clean-up registers initialization error path
Quentin Deslandes [Mon, 20 May 2019 16:39:04 +0000 (16:39 +0000)]
staging: vt6656: clean-up registers initialization error path

Avoid discarding function's return code during register initialization.
Handle it instead and return 0 on success or a negative errno value on
error.

Signed-off-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>