OSDN Git Service

uclinux-h8/linux.git
6 years agostaging:iio:ad2s1210: Remove old_data from ad2s1210_state
Rodrigo Siqueira [Fri, 9 Mar 2018 23:46:25 +0000 (20:46 -0300)]
staging:iio:ad2s1210: Remove old_data from ad2s1210_state

The variable old_data is a bool type, which only receives the value
'true' in the function ad2s1210_config_write and ad2s1210_config_read.
There is no other use for this variable. This patch removes old_data
from the ad2s1210_state and from all the function that use it.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging:iio:ad2s1210: Remove unused #define directive
Rodrigo Siqueira [Fri, 9 Mar 2018 23:46:05 +0000 (20:46 -0300)]
staging:iio:ad2s1210: Remove unused #define directive

This patch removes some #define directives not used in the code.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging:iio:ad2s1210: Remove end of line with '['
Rodrigo Siqueira [Fri, 9 Mar 2018 23:45:50 +0000 (20:45 -0300)]
staging:iio:ad2s1210: Remove end of line with '['

This patch fixes the checkpatch.pl check:

iio/resolver/ad2s1210.c:202: CHECK: Lines should not end with a '['

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging:iio:ad7150: Align arguments to match open parenthesis
Tom Lebreux [Thu, 8 Mar 2018 23:56:07 +0000 (18:56 -0500)]
staging:iio:ad7150: Align arguments to match open parenthesis

This fixes the following checkpatch.pl CHECK: Alignment should match
open parenthesis

Signed-off-by: Tom Lebreux <tomlebreux@cock.li>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging:iio:ad7152: Align arguments to match open parenthesis
Tom Lebreux [Thu, 8 Mar 2018 23:19:04 +0000 (18:19 -0500)]
staging:iio:ad7152: Align arguments to match open parenthesis

This patch fixes checkpatch.pl CHECK for alignment.

Signed-off-by: Tom Lebreux <tomlebreux@cock.li>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: potentiometer: mcp4018: driver for Microchip digital potentiometers
Peter Rosin [Thu, 8 Mar 2018 19:58:30 +0000 (20:58 +0100)]
iio: potentiometer: mcp4018: driver for Microchip digital potentiometers

Add support for Microchip digital potentiometers and rheostats
MCP4017, MCP4018, MCP4019

They all have one wiper with 128 steps and come in 5, 10, 50 and 100 kOhm
variations.

Datasheet: http://www.microchip.com/downloads/en/DeviceDoc/22147a.pdf

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoStaging: iio: ad7746: Adjust arguments to match open parenthesis
David Veenstra [Thu, 8 Mar 2018 09:48:13 +0000 (10:48 +0100)]
Staging: iio: ad7746: Adjust arguments to match open parenthesis

This patch clears all checkpatch.pl CHECKS, about alignment not matching
open parenthesis, whenever it is possible without going beyond 80 columns.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoStaging: iio: adt7316: Move symbol export to definition
David Veenstra [Thu, 8 Mar 2018 09:47:29 +0000 (10:47 +0100)]
Staging: iio: adt7316: Move symbol export to definition

This patch clears the following checkpatch.pl warning:

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
+EXPORT_SYMBOL_GPL(adt7316_pm_ops);

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: potentiometer: ds1803: Remove VLA usage
Himanshu Jha [Thu, 8 Mar 2018 18:45:33 +0000 (00:15 +0530)]
iio: potentiometer: ds1803: Remove VLA usage

In preparation to enabling -Wvla, remove VLA usage and replace it
with fixed a fixed length array and therefore, prevent potential
stack overflow attacks.

Fixed as a part of the discussion to remove all VLAs from the kernel:
https://lkml.org/lkml/2018/3/7/621

Cc: keescook@chromium.org
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: tsl2x7x: make proximity sensor function correctly
Brian Masney [Sun, 4 Mar 2018 01:49:42 +0000 (20:49 -0500)]
staging: iio: tsl2x7x: make proximity sensor function correctly

The bits for setting up the proximity diode were not setup correctly and
this was causing the proximity sensor to not function correctly. This
patch sets up the correct bit mask in tsl2x7x_chip_on() based on what
the data sheet expects. From page 35 of the TSL2771 data sheet:
https://ams.com/eng/content/download/250264/976045/file/TSL2771_DS000105_3-00.pdf

- Bits 0-1 is the ALS gain control
- Bits 2-3 is reserved (The proximity gain control on other tsl2x7x chips)
- Bits 4-5 is the proximity diode select
- Bits 6-7 is the LED drive strength

tsl2x7x_chip_on() had the power and diode hardcoded, so these are
extracted out into the settings so that these fields can be configured
in the platform data.

The default prox_gain is changed from 1 (2X gain) to 0 (1X gain) since
the proximity gain control on the TSL2771, TMD2771, and other chips have
these fields listed as reserved, and to write 0 into those bits.

Verified that the proximity sensor now works correctly on a TSL2771
hooked up to a Raspberry Pi 2.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: tsl2x7x: remove unnecessary sysfs attribute
Brian Masney [Sun, 4 Mar 2018 01:49:41 +0000 (20:49 -0500)]
staging: iio: tsl2x7x: remove unnecessary sysfs attribute

The tsl2771 and tmd2771 devices create the
in_proximity0_calibscale_available sysfs attribute. These two particular
devices do not support changing the proximity gain value on the
chip so this patch removes that sysfs attribute. As expected, these two
devices already did not create the IIO_CHAN_INFO_CALIBSCALE channel and
proximity0_calibrate sysfs attribute.

Page 38 of the tsl2772 data sheet shows that the proximity gain can be
adjusted with bits 2-3 on the control register:
https://ams.com/eng/content/download/291503/1066377/file/TSL2772_DS000181_2-00.pdf

Page 35 of the tsl2771 and tmd2771 data sheets shows that bits 2-3 on
the control register are reserved and changing the proximity gain is
not supported:
https://ams.com/eng/content/download/250264/976045/file/TSL2771_DS000105_3-00.pdf
https://ams.com/eng/content/download/250283/976077/file/TMD2771_DS000177_2-00.pdf

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: tsl2x7x: add missing error checks
Brian Masney [Sun, 4 Mar 2018 01:49:39 +0000 (20:49 -0500)]
staging: iio: tsl2x7x: add missing error checks

The functions in_illuminance0_calibrate_store() and
in_illuminance0_lux_table_store() did not have complete error handling
in place. This patch adds the missing error handling.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: tsl2x7x: add error handling to tsl2x7x_prox_cal()
Brian Masney [Sun, 4 Mar 2018 01:49:38 +0000 (20:49 -0500)]
staging: iio: tsl2x7x: add error handling to tsl2x7x_prox_cal()

tsl2x7x_prox_cal() did not have any error checks. This patch adds
the missing error handling and ensures that any errors are reported to
user space via in_proximity0_calibrate_store().

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: tsl2x7x: correct 'Avoid CamelCase' warning from checkpatch
Brian Masney [Sun, 4 Mar 2018 01:49:37 +0000 (20:49 -0500)]
staging: iio: tsl2x7x: correct 'Avoid CamelCase' warning from checkpatch

The statP and calP variables triggered an 'Avoid CamelCase' warning
from checkpatch.pl. This patch renames these variables to stat and cal
to fix this warning.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: tsl2x7x: correctly return errors in tsl2x7x_get_prox()
Brian Masney [Sun, 4 Mar 2018 01:49:36 +0000 (20:49 -0500)]
staging: iio: tsl2x7x: correctly return errors in tsl2x7x_get_prox()

Not all errors that occurred in tsl2x7x_get_prox() were correctly
reported in the return value. This patch changes the error handling
so that errors are now returned properly.

Note that the ret variable is from the call to tsl2x7x_read_status(),
and it already has the correct error check. The -EINVAL error code is
for an unexpected value in the register.

This patch also corrects an unnecessary word wrap in the call to
le16_to_cpup() while changes are being made to this code.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: tsl2x7x: convert mutex_trylock() to mutex_lock()
Brian Masney [Sun, 4 Mar 2018 01:49:35 +0000 (20:49 -0500)]
staging: iio: tsl2x7x: convert mutex_trylock() to mutex_lock()

The driver uses mutex_lock() and mutex_trylock() in several places.
Convert the mutex_trylock() to mutex_lock() for consistency with other
IIO light drivers in mainline.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: tsl2x7x: add common function for writing to the control register
Brian Masney [Sun, 4 Mar 2018 01:49:34 +0000 (20:49 -0500)]
staging: iio: tsl2x7x: add common function for writing to the control register

There were four places where the same chunk of code was used to write
to the control register. This patch creates a common function
tsl2x7x_write_control_reg() to reduce duplicate code.

The function tsl2x7x_chip_off() did not correctly return an error
code so this patch also corrects that issue.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: tsl2x7x: add common function for reading chip status
Brian Masney [Sun, 4 Mar 2018 01:49:33 +0000 (20:49 -0500)]
staging: iio: tsl2x7x: add common function for reading chip status

There were three places where the same chunk of code was used to read
the chip status. This patch creates a common function
tsl2x7x_read_status() to reduce duplicate code. This patch also corrects
tsl2x7x_event_handler() to properly check for an error after reading the
chip status.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: tsl2x7x: add common function for clearing interrupts
Brian Masney [Sun, 4 Mar 2018 01:49:32 +0000 (20:49 -0500)]
staging: iio: tsl2x7x: add common function for clearing interrupts

There were three places where the same chunk of code was used to clear
interrupts. This patch creates a common function
tsl2x7x_clear_interrupts() to reduce duplicate code.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: tsl2x7x: remove power functions from tsl2X7X_platform_data
Brian Masney [Sun, 4 Mar 2018 01:49:31 +0000 (20:49 -0500)]
staging: iio: tsl2x7x: remove power functions from tsl2X7X_platform_data

The tsl2X7X_platform_data structure contains the platform_power,
power_on, and power_off function pointers. These power management
functions should not be in the platform data. These functions were
likely used before the regulator framework was put in place. There are
no users of these functions in the mainline kernel.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoStaging: iio: adis16209: Use sign_extend32 function
Shreeya Patel [Sun, 4 Mar 2018 12:45:06 +0000 (18:15 +0530)]
Staging: iio: adis16209: Use sign_extend32 function

Use sign_extend32 function instead of manually coding
it.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoStaging: iio: adis16209: Adjust a switch statement
Shreeya Patel [Sun, 4 Mar 2018 12:43:12 +0000 (18:13 +0530)]
Staging: iio: adis16209: Adjust a switch statement

Adjust a switch block to explicitly match channels and
return -EINVAL as default case which makes the code
semantically more clear.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoStaging: iio: adis16209: Change some macro names
Shreeya Patel [Sun, 4 Mar 2018 12:41:17 +0000 (18:11 +0530)]
Staging: iio: adis16209: Change some macro names

Make some of the macro names according to the names
given in the datasheet of the adis16209 driver.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoStaging: iio: adis16209: Remove and add some comments and group the definitions
Shreeya Patel [Sun, 4 Mar 2018 12:36:22 +0000 (18:06 +0530)]
Staging: iio: adis16209: Remove and add some comments and group the definitions

Remove some unnecessay comments and group the control
register and register field macros together.
Some of the register names does not make it's puporse
very clear and hence, add some comments for more
information.
Also there are certain unit based comments which are not
providing sufficient information, so expand those comments.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoStaging: iio: accel: adis16201: Add a blank space before returns
Himanshu Jha [Mon, 5 Mar 2018 07:49:21 +0000 (13:19 +0530)]
Staging: iio: accel: adis16201: Add a blank space before returns

Adding a blank space before/after some returns improves readability.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoStaging: iio: accel: adis16201: Prefer alphabetical sequence of header files
Himanshu Jha [Mon, 5 Mar 2018 07:49:20 +0000 (13:19 +0530)]
Staging: iio: accel: adis16201: Prefer alphabetical sequence of header files

Arrange header files in alphabetical sequence to improve readability.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: Replace occurrences of magic number 0 by IIO_CHAN_INFO_RAW
Rodrigo Siqueira [Tue, 6 Mar 2018 12:02:57 +0000 (09:02 -0300)]
iio: Replace occurrences of magic number 0 by IIO_CHAN_INFO_RAW

Usually, functions responsible for reading raw data typically relies on
values from iio_chan_info_enum to correctly identify the type of data to
be read. There is a set of a device driver that uses the magic number 0
instead of IIO_CHAN_INFO_RAW. This patch improves the readability by
replaces the magic number 0 for the appropriate IIO_CHAN_INFO_RAW in six
devices driver in the IIO subsystem.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging:iio:meter: Aligns open parenthesis
Rodrigo Siqueira [Wed, 7 Mar 2018 00:44:26 +0000 (21:44 -0300)]
staging:iio:meter: Aligns open parenthesis

This patch fixes the checkpatch.pl checks:

staging/iio/meter/ade7854-spi.c:19: CHECK: Alignment should match open
parenthesis
staging/iio/meter/ade7854-spi.c:44: CHECK: Alignment should match open
parenthesis
staging/iio/meter/ade7854-spi.c:70: CHECK: Alignment should match open
parenthesis
staging/iio/meter/ade7854-spi.c:97: CHECK: Alignment should match open
parenthesis
staging/iio/meter/ade7854-spi.c:125: CHECK: Alignment should match open
parenthesis

...

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging:iio:meter: Remove unused macro IIO_DEV_ATTR_CH_OFF
Rodrigo Siqueira [Wed, 7 Mar 2018 00:44:07 +0000 (21:44 -0300)]
staging:iio:meter: Remove unused macro IIO_DEV_ATTR_CH_OFF

This patch removes the macro IIO_DEV_ATTR_CH_OFF. The macro
IIO_DEV_ATTR_CH_OFF is not required, due to the replace of it by the
direct use of IIO_DEVICE_ATTR in files staging/iio/meter/ade7759.c and
staging/iio/meter/ade7753.c.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging:iio:meter: Replaces IIO_DEV_ATTR_CH_OFF by IIO_DEVICE_ATTR
Rodrigo Siqueira [Wed, 7 Mar 2018 00:43:47 +0000 (21:43 -0300)]
staging:iio:meter: Replaces IIO_DEV_ATTR_CH_OFF by IIO_DEVICE_ATTR

The macro IIO_DEV_ATTR_CH_OFF is a wrapper for IIO_DEVICE_ATTR, with a
tiny change in the name definition. This extra macro does not improve
the readability and also creates some checkpatch errors.

This patch fixes the checkpatch.pl errors:

staging/iio/meter/ade7753.c:391: ERROR: Use 4 digit octal (0777) not
decimal permissions
staging/iio/meter/ade7753.c:395: ERROR: Use 4 digit octal (0777) not
decimal permissions
staging/iio/meter/ade7759.c:331: ERROR: Use 4 digit octal (0777) not
decimal permissions
staging/iio/meter/ade7759.c:335: ERROR: Use 4 digit octal (0777) not
decimal permissions

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: meter: Remove reduntant __func__ from debug print
HariPrasath Elango [Wed, 7 Mar 2018 05:38:04 +0000 (11:08 +0530)]
staging: iio: meter: Remove reduntant __func__ from debug print

dev_dbg includes the function name & line number by default when dynamic
debugging is enabled. Hence__func__ is reduntant here and removed.

Signed-off-by: HariPrasath Elango <hariprasath.elango@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: Remove unnecessary cast on void pointer
Arushi Singhal [Wed, 7 Mar 2018 13:17:17 +0000 (18:47 +0530)]
staging: iio: Remove unnecessary cast on void pointer

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|

- (T*)
  e
)

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoStaging: iio: adis16209: Add _REG postfix for registers
Shreeya Patel [Fri, 2 Mar 2018 13:25:56 +0000 (18:55 +0530)]
Staging: iio: adis16209: Add _REG postfix for registers

The defined names for registers does not make it very
clear that they are registers and hence, add _REG postfix.
This improves the readability of the code.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoStaging: iio: adis16209: Change the definition name
Shreeya Patel [Fri, 2 Mar 2018 13:23:41 +0000 (18:53 +0530)]
Staging: iio: adis16209: Change the definition name

The change in the definition name makes it then obvious
what the units are throughout the driver and there will
be no need of the comment.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoStaging: iio: adis16209: Arrange headers in alphabetical order
Shreeya Patel [Fri, 2 Mar 2018 13:19:23 +0000 (18:49 +0530)]
Staging: iio: adis16209: Arrange headers in alphabetical order

Arrange the headers in alphabetical order for cleanup
purpose.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio:magnetometer: Replace magic number 0 by IIO_CHAN_INFO_RAW
Rodrigo Siqueira [Tue, 27 Feb 2018 14:47:55 +0000 (11:47 -0300)]
iio:magnetometer: Replace magic number 0 by IIO_CHAN_INFO_RAW

The function magn_3d_read_raw has a switch statement handling multiple
cases per channel. The first case statement uses the magic number 0,
which means IIO_CHAN_INFO_RAW. Additionally, the iio_chan_spec for
magn_3d_channels is configured to be IIO_CHAN_INFO_RAW. Therefore, this
patch replaces the magic number 0 for the appropriate IIO_CHAN_INFO_RAW.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio:dummy: Add extra paragraphs on Kconfig
Rodrigo Siqueira [Tue, 27 Feb 2018 13:47:06 +0000 (10:47 -0300)]
iio:dummy: Add extra paragraphs on Kconfig

This patch fixes the checkpatch.pl warning:

drivers/iio/dummy/Kconfig:21: WARNING: please write a paragraph that
describes the config symbol fully
drivers/iio/dummy/Kconfig:27: WARNING: please write a paragraph that
describes the config symbol fully

This patch expands the explanation about IIO_DUMMY_EVGEN by using the
code documentation found in iio/dummy/iio_dummy_evgen.c. In the same
way, the information related to IIO_SIMPLE_DUMMY_BUFFER was extracted
from file iio_simple_dummy_buffer.c.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: dummy: Add correct tabs and spaces to Kconfig
Rodrigo Siqueira [Tue, 27 Feb 2018 13:46:51 +0000 (10:46 -0300)]
iio: dummy: Add correct tabs and spaces to Kconfig

Kconfig from iio/dummy does not follow the coding style recommendations.
According to the coding-style, Lines under a config definition are
indented with one tab, while help text is indented an additional two
spaces. This patch adds the proper tabulation and space.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: light: lv0104cs: Add support for LV0104CS light sensor
Jeff LaBundy [Tue, 27 Feb 2018 02:11:51 +0000 (20:11 -0600)]
iio: light: lv0104cs: Add support for LV0104CS light sensor

This patch adds support for the On Semiconductor LV0104CS ambient
light sensor.

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: proximity: sx9500: Add GPIO ACPI mapping table
Andy Shevchenko [Mon, 26 Feb 2018 19:37:35 +0000 (21:37 +0200)]
iio: proximity: sx9500: Add GPIO ACPI mapping table

In order to satisfy GPIO ACPI library requirements convert users of
gpiod_get_index() to correctly behave when there no mapping is provided
by firmware.

Here we add explicit mapping between _CRS GpioIo() resources and
their names used in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agodt-bindings: iio: adc: stm32-dfsdm: fix types, add missing pinctrl
Fabrice Gasnier [Fri, 23 Feb 2018 11:11:00 +0000 (12:11 +0100)]
dt-bindings: iio: adc: stm32-dfsdm: fix types, add missing pinctrl

- Add missing pinctrl description. Support is made optional as dfsdm
  may use internal sources (e.g. via registers)
- Fix typo in IIO STM32 DFSDM filter "MANCH_F" description.
Basically, this should be "falling edge = logic 0", not "1" that applies
to "MANCH_R".
BTW, make the description complete by describing both rising/falling
edges as described in reference manuals.

Fixes: 6c82f947fc97 ("IIO: add DT bindings for stm32 DFSDM filter")

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>
6 years agoiio: cros_ec: Relax sampling frequency before suspending
Gwendal Grignou [Wed, 21 Feb 2018 15:11:09 +0000 (16:11 +0100)]
iio: cros_ec: Relax sampling frequency before suspending

If an application set a tight sampling frequency, given the interrupt
use is a wakeup source, suspend will not happen: the kernel will receive
a wake up interrupt and will cancel the suspend process.

Given cros_ec sensors type is non wake up, this patch adds prepare and
complete callbacks to set 1s sampling period just before suspend. This
ensures the sensor hub will not be a source of interrupt during the
suspend process.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging:iio:meter: Add name to function definition arguments
Rodrigo Siqueira [Wed, 21 Feb 2018 19:54:35 +0000 (16:54 -0300)]
staging:iio:meter: Add name to function definition arguments

This patch fixes the checkpatch.pl warning:

drivers/staging/iio/meter/ade7854.h:157: WARNING: function definition
argument 'struct device *' should also have an identifier name...

This commit adds arguments names to the signature declared in the
ade7854_state struct. For consistency reason, It also renames all
arguments in function definitions.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio temperature/mlx90632: silence a static checker warning
Dan Carpenter [Thu, 22 Feb 2018 09:14:53 +0000 (12:14 +0300)]
iio temperature/mlx90632: silence a static checker warning

This shouldn't affect runtime at all, but Smatch complains that we
should check if mlx90632_read_ambient_raw() otherwise we
"ambient_new_raw" can be uninitialized.

    drivers/iio/temperature/mlx90632.c:509 mlx90632_calc_ambient_dsp105()
    error: uninitialized symbol 'ambient_new_raw'.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Crt Mori <cmo@melexis.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: accel: bmc150: Remove redundant __func__ in dev_dbg()
Andy Shevchenko [Thu, 22 Feb 2018 18:58:58 +0000 (20:58 +0200)]
iio: accel: bmc150: Remove redundant __func__ in dev_dbg()

Dynamic debug has a run time knob to enable function name printing.
Remove this from dev_dbg() calls.

Furthermore, functional tracing when enabled can show what function is
called, therefore remove empty dev_dbg() calls.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: axp20x_adc: remove !! in favor of ternary condition
Quentin Schulz [Mon, 19 Feb 2018 12:47:36 +0000 (13:47 +0100)]
iio: adc: axp20x_adc: remove !! in favor of ternary condition

!!'s behaviour isn't that obvious and sparse complained about it, so
let's replace it with a ternary condition.

Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: chemical: ccs811: Renamed resistance member in ccs811_reading struct
Richard Lai [Wed, 14 Feb 2018 01:08:35 +0000 (01:08 +0000)]
iio: chemical: ccs811: Renamed resistance member in ccs811_reading struct

The resistance member in ccs811_reading struct is an unsigned 16-bit
integer variable used to store RAW_DATA register bytes read from CCS811.
It is kind of misleading to name this struct member as resistance.

About the RAW_DATA register bytes, the CCS811 datasheet states that:
-----
Two byte read only register which contains the latest readings from the
sense resistor.

The most significant 6 bits of the Byte 0 contain the value of the current
through the sensor (0μA to 63μA).

The lower 10 bits contain (as computed from the ADC) the readings of the
voltage across the sensor with the selected current (1023 = 1.65V)"
-----

Hence, the RAW_DATA register byte contains information about electric
current and voltage of the CCS811 sensor. Calling this struct member
'resistance' is kind of misleading, although both electric current and
voltage are needed to calculate the electrical resistance of the sensor
using Ohm's law, V = I x R, in which a new channel type of IIO_RESISTANCE
may be added to the driver in the future.

Signed-off-by: Richard Lai <richard@richardman.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: speakup: remove space after a cast
Santha Meena Ramamoorthy [Thu, 22 Feb 2018 18:15:11 +0000 (10:15 -0800)]
staging: speakup: remove space after a cast

Remove blank space after a cast to conform to Linux kernel coding style.
Problem found using checkpatch.

Signed-off-by: Santha Meena Ramamoorthy <santhameena13@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: speakup: match alignment with open parenthesis
Santha Meena Ramamoorthy [Thu, 22 Feb 2018 18:15:10 +0000 (10:15 -0800)]
staging: speakup: match alignment with open parenthesis

Match alignment with open parenthesis to conform to Linux kernel coding
style. Problem found using checkpatch.

Signed-off-by: Santha Meena Ramamoorthy <santhameena13@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: speakup: add spaces around arithmetic operators
Santha Meena Ramamoorthy [Thu, 22 Feb 2018 18:15:09 +0000 (10:15 -0800)]
staging: speakup: add spaces around arithmetic operators

Add space around arithmetic operators ('+', '-' and '*') to conform to
Linux kernel coding style. Problem found using checkpatch.

Signed-off-by: Santha Meena Ramamoorthy <santhameena13@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoStaging: gdm724x: LTE: Refactor gdm_lte_pdn_table().
Quytelda Kahja [Fri, 23 Feb 2018 01:33:01 +0000 (17:33 -0800)]
Staging: gdm724x: LTE: Refactor gdm_lte_pdn_table().

Mostly this change just reverses the primary conditional so most of
the code can be pulled back a tab, which fixes some code style
warnings.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoStaging: gdm724x: Simplify the struct gdm_endian to a variable.
Quytelda Kahja [Fri, 23 Feb 2018 01:33:00 +0000 (17:33 -0800)]
Staging: gdm724x: Simplify the struct gdm_endian to a variable.

Since the testing for host endianness and in-driver conversion were
removed in 77e8a50149a2, the gdm_endian struct contains only one member,
and can therefore be simplified to a single u8 variable.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoStaging: gdm724x: LTE: Fix trailing open parentheses.
Quytelda Kahja [Fri, 23 Feb 2018 01:30:50 +0000 (17:30 -0800)]
Staging: gdm724x: LTE: Fix trailing open parentheses.

Fix lines with a trailing open parenthesis, which is a coding style issue.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: fsl-mc: Move irqchip code out of staging
Bogdan Purcareata [Mon, 5 Feb 2018 14:07:43 +0000 (08:07 -0600)]
staging: fsl-mc: Move irqchip code out of staging

Now that the fsl-mc bus core infrastructure is out of staging, the
remaining irqchip glue code used (irq-gic-v3-its-fsl-mc-msi.c) goes
to drivers/irqchip.

Create new Kconfig option for irqchip code that depends on
FSL_MC_BUS and ARM_GIC_V3_ITS. This ensures irqchip code only
gets built on ARM64 platforms. We can now remove #ifdef
GENERIC_MSI_DOMAIN_OPS as it was only needed for x86.

Signed-off-by: Stuart Yoder <stuyoder@gmail.com>
[rebased, add dpaa2_eth and dpio #include updates]
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
[rebased, split irqchip to separate patch]
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
[add Kconfig dependency on ARM_GIC_V3_ITS]
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: fsl-mc: Move core bus out of staging
Bogdan Purcareata [Mon, 5 Feb 2018 14:07:42 +0000 (08:07 -0600)]
staging: fsl-mc: Move core bus out of staging

Move the source files out of staging into their final locations:
  -mc.h include file in drivers/staging/fsl-mc/include go to include/linux/fsl
  -source files in drivers/staging/fsl-mc/bus go to drivers/bus/fsl-mc
  -overview.rst, providing an overview of DPAA2, goes to
   Documentation/networking/dpaa2/overview.rst

Update or delete other remaining staging files -- Makefile, Kconfig, TODO.
Update dpaa2_eth and dpio staging drivers.
Add integration bits for the documentation build system.

Signed-off-by: Stuart Yoder <stuyoder@gmail.com>
[rebased, add dpaa2_eth and dpio #include updates]
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
[rebased, split irqchip to separate patch]
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename _WPARxGtk_end_case_ label to avoid camelCase
Ajay Singh [Tue, 20 Feb 2018 14:58:01 +0000 (20:28 +0530)]
staging: wilc1000: rename _WPARxGtk_end_case_ label to avoid camelCase

Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename _WPAPtk_end_case_ label to avoid camelCase
Ajay Singh [Tue, 20 Feb 2018 14:58:00 +0000 (20:28 +0530)]
staging: wilc1000: rename _WPAPtk_end_case_ label to avoid camelCase

Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename pstrStationParam to avoid camelCase
Ajay Singh [Tue, 20 Feb 2018 14:57:59 +0000 (20:27 +0530)]
staging: wilc1000: rename pstrStationParam to avoid camelCase

Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename pstrDelStaParam to avoid camelCase
Ajay Singh [Tue, 20 Feb 2018 14:57:58 +0000 (20:27 +0530)]
staging: wilc1000: rename pstrDelStaParam to avoid camelCase

Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename strDisconnectNotifInfo to avoid camelCase
Ajay Singh [Tue, 20 Feb 2018 14:57:57 +0000 (20:27 +0530)]
staging: wilc1000: rename strDisconnectNotifInfo to avoid camelCase

Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename pstrStatistics to avoid camelCase
Ajay Singh [Tue, 20 Feb 2018 14:57:56 +0000 (20:27 +0530)]
staging: wilc1000: rename pstrStatistics to avoid camelCase

Fix "Avoid caseCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename pstrSetBeaconParam to avoid camelCase
Ajay Singh [Tue, 20 Feb 2018 14:57:55 +0000 (20:27 +0530)]
staging: wilc1000: rename pstrSetBeaconParam to avoid camelCase

Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename Handle_SetMulticastFilter to avoid camelCase
Ajay Singh [Tue, 20 Feb 2018 14:57:54 +0000 (20:27 +0530)]
staging: wilc1000: rename Handle_SetMulticastFilter to avoid camelCase

Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename pu32InactiveTime to avoid camelCase
Ajay Singh [Tue, 20 Feb 2018 14:57:53 +0000 (20:27 +0530)]
staging: wilc1000: rename pu32InactiveTime to avoid camelCase

Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename variables using camelCase in handle_rcvd_ntwrk_info()
Ajay Singh [Tue, 20 Feb 2018 14:57:52 +0000 (20:27 +0530)]
staging: wilc1000: rename variables using camelCase in handle_rcvd_ntwrk_info()

Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename ptstrJoinBssParam to avoid camelCase
Ajay Singh [Tue, 20 Feb 2018 14:57:51 +0000 (20:27 +0530)]
staging: wilc1000: rename ptstrJoinBssParam to avoid camelCase

Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename pu8HdnNtwrksWidVal to avoid camelCase
Ajay Singh [Tue, 20 Feb 2018 14:57:50 +0000 (20:27 +0530)]
staging: wilc1000: rename pu8HdnNtwrksWidVal to avoid camelCase

Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: selftest: freeing an error pointer
Dan Carpenter [Thu, 22 Feb 2018 09:15:34 +0000 (12:15 +0300)]
staging: lustre: selftest: freeing an error pointer

We should just return directly if memdup_user() fails. The current code
tries to free "param" which is an error pointer so it will Oops.

Fixes: 2baddf262e98 ("staging: lustre: use memdup_user to allocate memory and copy from user")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: socklnd: simplify ksnc_rx_iov_space
NeilBrown [Tue, 20 Feb 2018 02:23:38 +0000 (13:23 +1100)]
staging: lustre: socklnd: simplify ksnc_rx_iov_space

ksnc_rx_iov_space is currently a union of two arrays,
one of 'struct kvec', the other of 'struct bio_vec'.

The 'struct bio_vec' option is never used.  The
array of kvec is used to read in a packet header, or
to read data that needs to be skipped so as to synchronize
with a packet boundary.
In each case the target memory location is a virtual address,
never a page, so 'struct bio_vec' is never needed.

When we read into a page, different code steps up a separate
array of 'struct bio_vec'.

So remove the bio_vec option, and remove the union ksock_rxiovspace..

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: fid: perform sanity checks before commiting
NeilBrown [Tue, 20 Feb 2018 02:23:38 +0000 (13:23 +1100)]
staging: lustre: fid: perform sanity checks before commiting

When fid fetches a new range from the server, it commits
to it (*output = *out) *before* performing sanity checks.
This looks backwards.
Don't commit to a value until it has been found to be sane.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: fid: fix up debugfs access to ->lcs_space
NeilBrown [Tue, 20 Feb 2018 02:23:38 +0000 (13:23 +1100)]
staging: lustre: fid: fix up debugfs access to ->lcs_space

lcs_space can change while the lock is not held
if an RPC in underway.  This can be detected by
seq->ls_update being set.

In this case, reading or writing the value should return
-EBUSY.

Also, the D_INFO CDEBUG() which reports the lcs_space being
updated never fires, as it tests the wrong value -
ldebugfs_fid_write_common() returns 'count' on success.

Finally, this return value should be returned from
ldebugfs_fid_space_seq_write(), rather than always returning 'count',
so that errors can be detected.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: fid: remove seq_fid_alloc_fini() and simplify
NeilBrown [Tue, 20 Feb 2018 02:23:38 +0000 (13:23 +1100)]
staging: lustre: fid: remove seq_fid_alloc_fini() and simplify

seq_fid_alloc_fini() is tiny and only called
from two places in the one function.  We can move
both those calls earlier and merge them so only
one call is needed.  At that point, there is no
value added by having a separate function.

Also instead of using ++ and -- on ->lcs_update to
toggle between 0 and 1, explicitly set to 0 or 1
as appropriate.

Moving the locking earlier means that the code which updates
seq->lcs_fid is now protected, so
ldebugfs_fid_fid_seq_show() now cannot see a torn value.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: fid: use wait_event_cmd()
NeilBrown [Tue, 20 Feb 2018 02:23:38 +0000 (13:23 +1100)]
staging: lustre: fid: use wait_event_cmd()

Rather than open-coding a wait event loop twice,
use wait_event_cmd() to wait, dropping the spinlock
over schedule().
This does require duplicating part of the wait
condition, but that is just three tests on values that
are in registers or in cache, so the cost is small
and the increased readability is large.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: fid: convert lcs_mutex to a spinlock
NeilBrown [Tue, 20 Feb 2018 02:23:38 +0000 (13:23 +1100)]
staging: lustre: fid: convert lcs_mutex to a spinlock

There is only one place where this lock is held
while the task might sleep - in
  ldebugfs_fid_space_seq_write()
while ldebugfs_fid_write_common() is called.

This call can easily be taken out of the locked region
by asking it to parse the user data into a local variable,
and then copying that variable into ->lcs_space while
holding the lock.

Note that ldebugfs_gid_write_common returns >0 on
success, so use that to gate updating ->lcs_space.

So make that change, and convert lcs_mutex to a spinlock
named lcs_lock.  spinlocks are slightly cheaper than mutexes
and using one makes is clear that the lock is only held for
a short time.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: ptlrpc: list_for_each improvements.
NeilBrown [Tue, 20 Feb 2018 02:23:38 +0000 (13:23 +1100)]
staging: lustre: ptlrpc: list_for_each improvements.

1/ use list_for_each_entry_safe() instead of
   list_for_each_safe() and similar.

2/ use list_first_entry() and list_last_entry() where appropriate.

3/ When removing everything from a list, use
     while ((x = list_first_entry_or_null()) {
   as it makes the intent clear

4/ No need to take a spinlock in a structure that is about
   to be freed - we must have exclusive access at this stage.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: fix assorted checkpatch errors
NeilBrown [Tue, 20 Feb 2018 20:42:20 +0000 (07:42 +1100)]
staging: lustre: fix assorted checkpatch errors

Possibly the most interesting is the for-loop with no body.
Rearranging and initializing end_dirent on each iteration of
the outer while, makes the intent clearer.

Reviewed-by: "Eremin, Dmitry" <dmitry.eremin@intel.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: remove phantom struct cfs_crypto_hash_desc
NeilBrown [Tue, 20 Feb 2018 02:23:38 +0000 (13:23 +1100)]
staging: lustre: remove phantom struct cfs_crypto_hash_desc

There is no "struct cfs_crypto_hash_desc" structure.  There
are only pointers to this structure, which are cast back and
forth to struct ahash_request.
So discard cfs_crypto_hash_desc, and just use ahash_request directly.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: discard libcfs_kvzalloc and linux-mem.c
NeilBrown [Tue, 20 Feb 2018 02:23:37 +0000 (13:23 +1100)]
staging: lustre: discard libcfs_kvzalloc and linux-mem.c

The only interesting difference between libcfs_kvzalloc()
and kvzalloc() is that the former appears to work
with GFP_NOFS, which the latter gives a WARN_ON_ONCE()
when that is attempted.

Each libcfs_kvzalloc() should really be analysed
and either converted to a kzalloc() call if the size is never
more than a page, or to use GFP_KERNEL if no locks are held.

If there is ever a case where locks are held and a large allocation
is needed, then some other technique should be used.

It might be nice to not always blindly zero pages too...

For now, just convert libcfs_kvzalloc() calls to
kvzalloc(), and let the warning remind us that there is work to do.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: improve some libcfs_kvzalloc calls.
NeilBrown [Tue, 20 Feb 2018 02:23:37 +0000 (13:23 +1100)]
staging: lustre: improve some libcfs_kvzalloc calls.

Using vmalloc with GFP_NOFS is not supported as vmalloc
performs some internal allocations with GFP_KERNEL.

So in cases where the size passed to libcfs_kvzalloc()
is clearly at most 1 page, convert to kzalloc().
In cases where the call clearly doesn't hold any
filesystem locks, convert to GFP_KERNEL.

Unfortunately there are many more that are not easy to fix.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: discard lu_buf allocation library.
NeilBrown [Tue, 20 Feb 2018 02:23:37 +0000 (13:23 +1100)]
staging: lustre: discard lu_buf allocation library.

This library code is unnecessarily generic, but also
not generic enough.  Library code that performs
allocations should always take a gfp_flags argument.

So discard the library and in the one file where it is used,
just use kzalloc or krealloc as needed.
In this context, it is clear that vmalloc is never needed.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: discard libcfs_kvzalloc_cpt()
NeilBrown [Tue, 20 Feb 2018 02:23:37 +0000 (13:23 +1100)]
staging: lustre: discard libcfs_kvzalloc_cpt()

This function is used precisely once, and is sufficiently
trivial that it may as well be open-coded.

Doing so helpfully highlights the similarity
between the new kvzalloc_node() call and the already existing
kzalloc_node() call in the same function.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: make signal-blocking functions inline
NeilBrown [Tue, 20 Feb 2018 02:23:37 +0000 (13:23 +1100)]
staging: lustre: make signal-blocking functions inline

cfs_block_sigsinv() and cfs_restore_sigs() are now
simple enough to inline them.
This means we can discard linux-prim.c

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: improve API and implementation of blocking signals.
NeilBrown [Tue, 20 Feb 2018 02:23:37 +0000 (13:23 +1100)]
staging: lustre: improve API and implementation of blocking signals.

According to comment for set_current_blocked() in
kernel/signal.c, changing ->blocked directly is wrong.
sigprocmask() should be called instead.

So change cfs_block_sigsinv() and cfs_restore_sigs()
to use sigprocmask().
For consistency, change them to pass the sigset_t by reference
rather than by value.

Also fix cfs_block_sigsinv() so that it correctly blocks
signals above 32 on a 32bit host.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: simplify linux-prim.c
NeilBrown [Tue, 20 Feb 2018 02:23:37 +0000 (13:23 +1100)]
staging: lustre: simplify linux-prim.c

cfs_block_sigs() is never used.
cfs_clear_sigpending() is never used.
cfs_block_allsigs() is no longer used.

So those three functions can go.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: lnet: remove cfs_block_allsigs calls.
NeilBrown [Tue, 20 Feb 2018 02:23:37 +0000 (13:23 +1100)]
staging: lustre: lnet: remove cfs_block_allsigs calls.

Both places that cfs_block_allsigs() is used here,
the goal is to turn an interruptible wait into an
uninterruptible way.
So instead of blocking the signals, change TASK_INTERRUPTIBLE to
TASK_NOLOAD.
In each case, no other functions called while signals are blocked
will sleep - just the one that has been fixed.
In one case, an extra 'interruptible' flag needs to be passed
down so the waiting decision can be made at the right place.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: remove unnecessary cfs_block_allsigs() calls
NeilBrown [Tue, 20 Feb 2018 02:23:37 +0000 (13:23 +1100)]
staging: lustre: remove unnecessary cfs_block_allsigs() calls

Threads started by kthread_run() ignore all signals,
as kthreadd() calls ignore_signals(), and this is
inherited by all children.
So there is no need to call cfs_block_allsigs() in functions
that are only run from kthread_run().

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: remove linux-curproc.c
NeilBrown [Tue, 20 Feb 2018 02:23:37 +0000 (13:23 +1100)]
staging: lustre: remove linux-curproc.c

The only functionality remaining here is
cfs_curproc_cap_pack(),
and it can be trivially implemented as an inline
in curproc.h.
So do that and remove the file.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: opencode cfs_cap_{raise, lower, raised}
NeilBrown [Tue, 20 Feb 2018 02:23:37 +0000 (13:23 +1100)]
staging: lustre: opencode cfs_cap_{raise, lower, raised}

Each of these functions is used precisely once, so having
a separate exported function seems like overkill.

cfs_cap_raised() is trivial - one line.
cfs_cap_raise() and cfs_cap_lower() are used as a pair
which is more effectively implemented with
override_cred() / revert_creds().

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: replace all CFS_CAP_* macros with CAP_*
NeilBrown [Tue, 20 Feb 2018 02:23:37 +0000 (13:23 +1100)]
staging: lustre: replace all CFS_CAP_* macros with CAP_*

Lustre defines a few CFS_CAP_* macros which are exactly the
same as the corresponding CAP_* macro, with one exception.

CFS_CAP_SYS_BOOT is 23
CAP_SYS_BOOT is 22.

CFS_CAP_SYS_BOOT is only used through CFS_CAP_FS_MASK and
causes capability 23 (CAP_SYS_NICE) to be dropped in certain
circumstances.
It is probable that the intention was to drop CAP_SYS_BOOT,
and this is what is now done.

CFS_CAP_CHOWN_MASK and CFS_CAP_SYS_RESOURCE_MASK are never
used, so they have been removed.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: Remove unneeded cast
Christopher Diaz Riveros [Tue, 20 Feb 2018 16:37:22 +0000 (11:37 -0500)]
staging: rtl8188eu: Remove unneeded cast

Fix Coccinelle alert:

drivers/staging//rtl8188eu/os_dep/usb_intf.c:336:13-27: WARNING: casting value returned by memory allocation function to (struct adapter *) is useless.

This issue was detected by using the Coccinelle software.

Signed-off-by: Christopher Diaz Riveros <chrisadr@gentoo.org>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: emxx_udc: Remove unneeded cast
Christopher Diaz Riveros [Tue, 20 Feb 2018 16:35:53 +0000 (11:35 -0500)]
staging: emxx_udc: Remove unneeded cast

Fix Coccinelle alert:

drivers/staging//emxx_udc/emxx_udc.c:2689:19-21: WARNING: casting value returned by memory allocation function to (u8 *) is useless.

This issue was detected by using the Coccinelle software.

Signed-off-by: Christopher Diaz Riveros <chrisadr@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8723bs: Remove unneeded cast
Christopher Diaz Riveros [Tue, 20 Feb 2018 16:33:54 +0000 (11:33 -0500)]
staging: rtl8723bs: Remove unneeded cast

Fix Coccinelle alert:

drivers/staging//rtl8723bs/os_dep/sdio_intf.c:340:13-27: WARNING: casting value returned by memory allocation function to (struct adapter *) is useless.

This issue was detected by using the Coccinelle software.

Signed-off-by: Christopher Diaz Riveros <chrisadr@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: net: netlogic: Remove unneeded cast
Christopher Diaz Riveros [Tue, 20 Feb 2018 16:30:33 +0000 (11:30 -0500)]
staging: net: netlogic: Remove unneeded cast

Fix Coccinelle alert:

drivers/staging//netlogic/xlr_net.c:996:12-30: WARNING: casting value returned by memory allocation function to (struct xlr_adapter *) is useless.

This issue was detected by using the Coccinelle software.

Signed-off-by: Christopher Diaz Riveros <chrisadr@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoStaging: bcm2048: Fix function argument alignment in radio-bcm2048.c.
Quytelda Kahja [Tue, 20 Feb 2018 06:53:04 +0000 (22:53 -0800)]
Staging: bcm2048: Fix function argument alignment in radio-bcm2048.c.

Fix a coding style problem.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoStaging: ks7010: hostif: Convert the ps_confirm_wait_inc() macro to a real function.
Quytelda Kahja [Tue, 20 Feb 2018 06:35:38 +0000 (22:35 -0800)]
Staging: ks7010: hostif: Convert the ps_confirm_wait_inc() macro to a real function.

Convert the unsafe macro into an inline function.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoStaging: ks7010: hostif: Convert SME queue macros to real functions.
Quytelda Kahja [Tue, 20 Feb 2018 06:35:37 +0000 (22:35 -0800)]
Staging: ks7010: hostif: Convert SME queue macros to real functions.

Convert the unsafe macros into inline functions.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoStaging: ks7010: sdio: Convert RX/TX queue macros into real functions.
Quytelda Kahja [Tue, 20 Feb 2018 06:35:36 +0000 (22:35 -0800)]
Staging: ks7010: sdio: Convert RX/TX queue macros into real functions.

Convert the unsafe macros into inline functions.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: remove 'if' on field address
Dafna Hirschfeld [Thu, 22 Feb 2018 07:10:12 +0000 (09:10 +0200)]
staging: wilc1000: remove 'if' on field address

Remove 'if' statements testing struct's field address.
Since such statements always return true, they are redundant.

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: pi433: fix CamelCase for addressFiltering
Valentin Vidic [Tue, 20 Feb 2018 14:13:07 +0000 (15:13 +0100)]
staging: pi433: fix CamelCase for addressFiltering

Fixes checkpatch warning:

  CHECK: Avoid CamelCase: <addressFiltering>

Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: pi433: fix CamelCase for thresholdDecrement
Valentin Vidic [Tue, 20 Feb 2018 14:03:30 +0000 (15:03 +0100)]
staging: pi433: fix CamelCase for thresholdDecrement

Fixes checkpatch warning:

  CHECK: Avoid CamelCase: <thresholdDecrement>

Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>