platform/kernel/linux-rpi.git
6 years agostaging: wilc1000: rename pstrHostIFconnectAttr to avoid camelCase issue
Ajay Singh [Wed, 7 Mar 2018 02:13:50 +0000 (07:43 +0530)]
staging: wilc1000: rename pstrHostIFconnectAttr to avoid camelCase issue

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

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: fix line over 80 char in cfg_scan_result()
Ajay Singh [Wed, 7 Mar 2018 01:32:30 +0000 (07:02 +0530)]
staging: wilc1000: fix line over 80 char in cfg_scan_result()

Refactor cfg_scan_result() API to avoid 'line over 80 chars' issue
reported by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename pJoinParams to avoid camelCase
Ajay Singh [Wed, 7 Mar 2018 01:32:29 +0000 (07:02 +0530)]
staging: wilc1000: rename pJoinParams to avoid camelCase

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

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: fix line over 80 char in mgmt_tx_cancel_wait()
Ajay Singh [Wed, 7 Mar 2018 01:32:28 +0000 (07:02 +0530)]
staging: wilc1000: fix line over 80 char in mgmt_tx_cancel_wait()

Fix 'line over 80 char' issue found in checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: fix line over 80 char for cfg parse RX and TX function
Ajay Singh [Wed, 7 Mar 2018 01:32:27 +0000 (07:02 +0530)]
staging: wilc1000: fix line over 80 char for cfg parse RX and TX function

Fix 'line over 80 characters' issue found by checkpatch.pl script. Moved
the common code from wilc_wfi_cfg_parse_tx_action() &
wilc_wfi_cfg_parse_rx_action() to new function to avoid checkpatch issue.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: fix line over 80 char in get_key() & set_default_key()
Ajay Singh [Wed, 7 Mar 2018 01:32:26 +0000 (07:02 +0530)]
staging: wilc1000: fix line over 80 char in get_key() & set_default_key()

Fix 'line over 80 characters' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: fix line over 80 char in change_virtual_intf()
Ajay Singh [Wed, 7 Mar 2018 01:32:25 +0000 (07:02 +0530)]
staging: wilc1000: fix line over 80 char in change_virtual_intf()

Fix 'line over 80 char' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename au8ScanChanList to avoid camelCase
Ajay Singh [Wed, 7 Mar 2018 01:32:24 +0000 (07:02 +0530)]
staging: wilc1000: rename au8ScanChanList to avoid camelCase

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

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename CfgScanResult to avoid camelCase
Ajay Singh [Wed, 7 Mar 2018 01:32:23 +0000 (07:02 +0530)]
staging: wilc1000: rename CfgScanResult to avoid camelCase

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

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename pstrNetworkInfo to avoid camelCase
Ajay Singh [Wed, 7 Mar 2018 01:32:22 +0000 (07:02 +0530)]
staging: wilc1000: rename pstrNetworkInfo to avoid camelCase

Fix 'Avoid camleCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename strHiddenNetwork to avoid camelCase
Ajay Singh [Wed, 7 Mar 2018 01:32:21 +0000 (07:02 +0530)]
staging: wilc1000: rename strHiddenNetwork to avoid camelCase

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

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: speakup: Add unicode support to the speakup_dummy driver
Samuel Thibault [Sat, 10 Mar 2018 10:56:27 +0000 (11:56 +0100)]
staging: speakup: Add unicode support to the speakup_dummy driver

This extends spk_io_ops with a synth_out_unicode which takes a u16 character
instead of just a byte, and extends spk_ttyio to implement it to emit
utf-8. spk_do_catch_up_unicode can then be introduced to benefit from
synth_out_unicode, and speakup_dummy made to use spk_do_catch_up_unicode instead
of spk_do_catch_up.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: comedi: adl_pci6208: remove redundant initialization of 'val'
Colin Ian King [Mon, 12 Mar 2018 23:36:05 +0000 (23:36 +0000)]
staging: comedi: adl_pci6208: remove redundant initialization of 'val'

Variable 'val' is initialized with a value that is never read, it is
updated with a new value again after intitialization. Remove the
redundant initialization and move the declaration and assignment into
the scope of the for-loop.

Cleans up clang warning:
drivers/staging/comedi/drivers/adl_pci6208.c:61:15: warning: Value
stored to 'val' during its initialization is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: ks7010: replace custom rotation operations in favour of the kernel ones
Sergio Paracuellos [Sun, 11 Mar 2018 11:11:44 +0000 (12:11 +0100)]
staging: ks7010: replace custom rotation operations in favour of the kernel ones

This patch replaces custom ROR32 and ROL32 macros for the ones included in
bitops header of the linux kernel.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: fid: avoid false-positive uninitialized variable warning
Arnd Bergmann [Tue, 13 Mar 2018 13:05:16 +0000 (14:05 +0100)]
staging: lustre: fid: avoid false-positive uninitialized variable warning

One of Neil's recent cleanups apparently has led the code to get
to a state where gcc tracks the 'seqnr' variable just enough to
see that it is sometimes initialized in seq_client_alloc_seq(),
but not enough that it can prove this initialization to be reliable
before the use of that variable:

drivers/staging/lustre/lustre/fid/fid_request.c: In function 'seq_client_alloc_fid':
drivers/staging/lustre/lustre/fid/fid_request.c:245:22: error: 'seqnr' may be used uninitialized in this function [-Werror=maybe-uninitialized]

The code seems to be otherwise correct, and I could not come
up with a good way to simplify it further, so this adds a fake
initialization to shut up that warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: use module_name() macro for debug printf
Arnd Bergmann [Tue, 13 Mar 2018 13:03:44 +0000 (14:03 +0100)]
staging: lustre: use module_name() macro for debug printf

We now allow lustre to be built when CONFIG_MODULES is disabled,
but that causes a build failure:

In file included from drivers/staging/lustre/include/linux/libcfs/libcfs.h:42,
                 from drivers/staging/lustre/lustre/obdclass/lu_object.c:44:
drivers/staging/lustre/lustre/obdclass/lu_object.c: In function 'lu_context_key_degister':
drivers/staging/lustre/lustre/obdclass/lu_object.c:1410:51: error: dereferencing pointer to incomplete type 'struct module'

This particular case can be avoided by using the module_name()
macro that was designed exactly to handle printing the name of
a module in all configurations.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoMerge tag 'iio-for-4.17b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Wed, 14 Mar 2018 11:32:11 +0000 (12:32 +0100)]
Merge tag 'iio-for-4.17b' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second set of new device support, features and cleanup for IIO in the 4.17 cycle

The uptick in staging cleanup is partly due to GSoC Applications
process being underway and one of Daniel's tasks being to try
cleaning up an IIO driver to move out of staging.
Naturally there is some normal staging cleanup progress in here
as well.

New device support
* Microchip mcp4018
  - New driver supproting MCP4017, MCP4018 and MCP4019 digital pots.
* On Semiconductor lv0104cs
  - New driver to support this ambient light sensor.

Cleanup
* axp20x_adc
  - remove a !! in favour of clear ternary operator.
* ad2s1210 (staging cleanup)
  - Reorganise to avoid ending a line with [
  - Remove some unnecessary defines.
  - Remove unsed variable.
* ad5380
  - Replace magic 0 with IIO_CHAN_INFO_RAW
* ad5764
  - Replace magic 0 with IIO_CHA_INFO_RAW
* ad7150 (staging cleanup)
  - Align arguements with parenthesis.
* ad7152 (staging cleanup)
  - Align arguements.
* ad7746 (staging cleanup)
  - Align arguements.
* ad7816
  - Remove pointless void pointer cast.
* ade7753
  - Replace IIO_DEV_ATTR_CH_OFF with equivalent to avoid confusing
    checkpatch (this macro didn't really help anyway).  Also drop the
    macro from the meter.h header.
* ade7754 (staging cleanup)
  - Add names to funciton definition arguements.
  - Align arguements with open parenthesis where possible.
* ade7758 (staging cleanup)
  - Remove __func__ from dev_dbg statements as provided by dynamic
    debug anyway.
  - Align arguements with open parenthesis where possible.
* ade7759 (staging cleanup)
  - Replace IIO_DEV_ATTR_CH_OFF with equiavalent to avoid confusing
    checkpatch.
* adis16201 (staging cleanup)
  - Headers in alphabetical order.
  - Blank lines before returns.
* adis16209 (staging cleanup)
  - Headers in alphabetical order
  - Change some definition names to make them more meaningful (2 rounds
    of this).
  - Add explicit _REG prefix to register names to make them
    obviously different from fields within those registers.
  - Remove some superflous comments and group definitions better.
  - Use a switch statement to make it semantically obvious that we
    only have two options (rather than an unlimited 'else').
  - Use sign_extent32 instead of open coding.
* adt7316 (staging cleanup)
  - Move an export next to symbol.
* bmc150
  - drop redundant __func__ in dynamic debug.
* ccs811
  - Rename varaible to better reflect what it does.
* cros_ec
  - Reduce sampling frequency before suspending to avoid preventing
    suspend.
* dummy
  - Correct whitespace in Kconfig.
  - Add extra description in Kconfig.
* ds1803
  - Remove a VLA which we always know is 2 long.
* hid-sensor-accel
  - Replace magic number 0 by IIO_CHAN_INFO_RAW.
* hid-sensor-gyro
  - Replace magic number 0 by IIO_CHAN_INFO_RAW.
* hid-sensor-light
  - Replace magic number 0 by IIO_CHAN_INFO_RAW.
* hid-sensor-magn
  - Replace magic number 0 by IIO_CHAN_INFO_RAW.
* lm3533
  - Replace magic number 0 by IIO_CHAN_INFO_RAW
* mlx90632
  - Squash a smatch warning - no runtime effect.
* stm32_dfsdm:
  - Cleanup the dt bindings.
* sx9500
  - Add GPIO ACPI mapping table to behave correctly when firmware
    doesn't provide the mapping.
* tsl2x7x (staging cleanup)
  - Fix the proximity sensor functionality.
  - Remove platform data provided power functions.  There are much
    better ways to do this these days.
  - Introduce some common functions to avoid various repititions.
  - Stop using mutex_trylock when mutex_lock and wait a bit is fine.
  - Improve error handling in various places.
  - Drop some 'Camel case' (which wasn't actually strickly camel case
    but was a bit odd.
  - Drop some _available sysfs attributes for things that don't exist
    (for particular supported parts).

6 years agostaging: fsl-dpaa2/eth: allow the driver to compile multi-arch
Ioana Radulescu [Fri, 9 Mar 2018 18:40:56 +0000 (12:40 -0600)]
staging: fsl-dpaa2/eth: allow the driver to compile multi-arch

Drop dependency on ARCH_LAYERSCAPE (which in turn depends on ARM64),
thus allowing this driver to compile on all architectures supported
by the fsl-mc bus driver.

This was compile tested on:
 - powerpc (corenet_basic_defconfig, ppc64_defconfig)
 - x86 (i386_defconfig, x86_64_defconfig, needs CONFIG_OF)
 - arm64 (defconfig)

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: fsl-dpaa2/eth: Use __leXX types where needed
Ioana Radulescu [Fri, 9 Mar 2018 18:40:55 +0000 (12:40 -0600)]
staging: fsl-dpaa2/eth: Use __leXX types where needed

One MC command structure got away with using uXX fields instead
of __leXX. Fix it.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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: fsl-mc/dpio: Add missing argument identifier
Roy Pledge [Wed, 7 Mar 2018 21:50:27 +0000 (16:50 -0500)]
staging: fsl-mc/dpio: Add missing argument identifier

When running checkpatch over the DPIO code the following warning
is reported:

WARNING: function definition argument 'struct dpaa2_io_notification_ctx *' should also have an identifier name

Add the missing identifier.

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: fsl-mc/dpio: Fix incorrect masking
Ioana Radulescu [Tue, 6 Mar 2018 17:43:47 +0000 (11:43 -0600)]
staging: fsl-mc/dpio: Fix incorrect masking

In qbman_swp_alt_fq_state(), we need to mask the fqid value
before converting it to little endian, otherwise we write a
wrong value to hardware when running in big endian mode.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: fsl-mc/dpio: Use __leXX types where needed
Ioana Radulescu [Tue, 6 Mar 2018 17:43:46 +0000 (11:43 -0600)]
staging: fsl-mc/dpio: Use __leXX types where needed

Structures that are mapped to hardware registers should explicitly
specify the expected endianness for fields larger than 1 byte.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: fsl-mc/dpio: Fix cast truncate warning
Ioana Radulescu [Tue, 6 Mar 2018 17:43:45 +0000 (11:43 -0600)]
staging: fsl-mc/dpio: Fix cast truncate warning

Sparse reports the following warning:
drivers/staging/fsl-mc/include/dpaa2-fd.h:421:30:
warning: cast truncates bits from constant value (ffff7fff becomes 7fff)

Fix this by explicitly masking the value with 0xffff.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8192u: Replace printk() with more standardize output format.
Arushi Singhal [Wed, 7 Mar 2018 10:39:09 +0000 (16:09 +0530)]
staging: rtl8192u: Replace printk() with more standardize output format.

printk() is the raw way to print output and should be avoided.

For drivers with defined "struct device object", dev_*macro() is
prefer and for "struct netdevice object", netdev_*macro() is prefer over
dev_*macro() to standardize the output format within the subsystem.

If no "struct device object" is defined prefer pr_*macro() over printk().

This patch Replace printk having a log level with the appropriate output
format according to the order of preference.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: fsl-mc/dpio: Fix incorrect cast
Ioana Radulescu [Tue, 6 Mar 2018 17:43:44 +0000 (11:43 -0600)]
staging: fsl-mc/dpio: Fix incorrect cast

Move the cast in dpaa2_sg_get_addr() to the right place.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: use __func__ instead of function name
Santha Meena Ramamoorthy [Wed, 7 Mar 2018 07:54:51 +0000 (23:54 -0800)]
staging: rtl8188eu: use __func__ instead of function name

Replace occurrence of the function name in a string by reference to
__func__, to improve robustness and to conform to the Linux kernel coding
style. Issue found using checkpatch.

Signed-off-by: Santha Meena Ramamoorthy <santhameena13@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: fix typo in comment
Santha Meena Ramamoorthy [Wed, 7 Mar 2018 07:55:50 +0000 (23:55 -0800)]
staging: rtl8188eu: fix typo in comment

Fix typo in the words 'transmitted' and 'failure' in the comment. Issue
found using checkpatch.

Signed-off-by: Santha Meena Ramamoorthy <santhameena13@gmail.com>
Reviewed-by: Vaishali Thakkar <vthakkar@vaishalithakkar.in>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: most: Remove unnecessary usage of BUG_ON().
Quytelda Kahja [Wed, 7 Mar 2018 01:31:41 +0000 (17:31 -0800)]
staging: most: Remove unnecessary usage of BUG_ON().

There is no need for the calls to BUG_ON() in this driver, which are
used to check if mbo or mbo->context are NULL; mbo is never NULL, and
if mbo->context is NULL it would have already been dereferenced and
oopsed before reaching the BUG_ON().

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Acked-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: Remove VLA usage
Kees Cook [Wed, 7 Mar 2018 20:54:44 +0000 (12:54 -0800)]
staging: lustre: Remove VLA usage

The kernel would like to have all stack VLA usage removed[1]. This switches
to a simple kasprintf() instead, and in the process fixes an off-by-one
between the allocation and the sprintf (allocation did not include NULL
byte in calculation).

[1] https://lkml.org/lkml/2018/3/7/621

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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: lustre: Remove yield() call
Thomas Avery [Mon, 5 Mar 2018 19:33:49 +0000 (14:33 -0500)]
staging: lustre: Remove yield() call

Remove yield() call. In this case it's use is considered broken, since
it is being assumed that yield() will let another process run that will
make the event true.

Signed-off-by: Thomas Avery <tavery321@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: pi433: fix CamelCase for paRamp enum
Valentin Vidic [Mon, 5 Mar 2018 07:02:19 +0000 (08:02 +0100)]
staging: pi433: fix CamelCase for paRamp enum

Fixes checkpatch warning:

  CHECK: Avoid CamelCase: <paRamp>

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 Address variables
Valentin Vidic [Mon, 5 Mar 2018 07:02:18 +0000 (08:02 +0100)]
staging: pi433: fix CamelCase for Address variables

Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: <nodeAddress>
  CHECK: Avoid CamelCase: <broadcastAddress>

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 address_filtering enum
Valentin Vidic [Mon, 5 Mar 2018 07:02:17 +0000 (08:02 +0100)]
staging: pi433: fix CamelCase for address_filtering enum

Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: <filteringOff>
  CHECK: Avoid CamelCase: <nodeAddress>
  CHECK: Avoid CamelCase: <nodeOrBroadcastAddress>

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 afterSyncInterrupt
Valentin Vidic [Mon, 5 Mar 2018 07:02:16 +0000 (08:02 +0100)]
staging: pi433: fix CamelCase for afterSyncInterrupt

Fixes checkpatch warning:

  CHECK: Avoid CamelCase: <afterSyncInterrupt>

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 flag enum
Valentin Vidic [Mon, 5 Mar 2018 07:02:15 +0000 (08:02 +0100)]
staging: pi433: fix CamelCase for flag enum

Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: <modeSwitchCompleted>
  CHECK: Avoid CamelCase: <readyToReceive>
  CHECK: Avoid CamelCase: <readyToSend>
  CHECK: Avoid CamelCase: <pllLocked>
  CHECK: Avoid CamelCase: <rssiExceededThreshold>
  CHECK: Avoid CamelCase: <syncAddressMatch>
  CHECK: Avoid CamelCase: <packetSent>
  CHECK: Avoid CamelCase: <crcOk>
  CHECK: Avoid CamelCase: <batteryLow>

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 packetFormat enum
Valentin Vidic [Mon, 5 Mar 2018 07:02:14 +0000 (08:02 +0100)]
staging: pi433: fix CamelCase for packetFormat enum

Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: <packetFormat>
  CHECK: Avoid CamelCase: <packetLengthFix>
  CHECK: Avoid CamelCase: <packetLengthVar>

Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoRevert "staging: Disable lustre file system for MIPS, SH, and XTENSA"
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
Revert "staging: Disable lustre file system for MIPS, SH, and XTENSA"

This reverts commit 16f1eeb660bd2bfd223704ee6350706b39c55a7a.

The reason for this patch was that lustre used copy_from_user_page.
Commit 76133e66b141 ("staging/lustre: Replace jobid acquiring with per
node setting") removed that usage.
So the arch restrictions can go.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: allow monolithic builds
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: allow monolithic builds

Remove restriction the lustre must be built
as modules.  It now works as a monolithic build.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: ptlrpc: move thread creation out of module initialization
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: ptlrpc: move thread creation out of module initialization

When the ptlrpc module is loaded, it starts the pinger thread and
calls LNetNIInit which starts various threads.

We don't need these threads until the module is actually being
used, such as when a lustre filesystem is mounted.

So move the thread creation into new ptlrpc_inc_ref() (modeled on
ptlrpcd_inc_ref()), and call that when needed, such as at mount time.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: change sai_thread to sai_task.
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: change sai_thread to sai_task.

Rather than allocating a ptlrpc_thread for the
stat-ahead thread, just use the task_struct provided
by kthreads directly.

As nothing ever waits for the sai_task, it must call do_exit()
directly rather than simply return from the function.
Also it cannot use kthread_should_stop() to know when to stop.

There is one caller which can ask it to stop so we need a simple
signaling mechanism.  I've chosen to set ->sai_task to NULL
when the thread should finish up.  The thread notices this and
cleans up and exits.
lli_sa_lock is used to avoid races between waking up the process
and the process exiting.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: remove 'ptlrpc_thread usage' for sai_agl_thread
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: remove 'ptlrpc_thread usage' for sai_agl_thread

Lustre has a 'struct ptlrpc_thread' which provides
control functionality wrapped around kthreads.
None of the functionality used in statahead.c requires
ptlrcp_thread - it can all be done directly with kthreads.

So discard the ptlrpc_thread and just use a task_struct directly.

One particular change worth noting is that in the current
code, the thread performs some start-up actions and then
signals that it is ready to go.  In the new code, the thread
is first created, then the startup actions are perform, then
the thread is woken up.  This means there is no need to wait
any more than kthread_create() already waits.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: remove unused flag from ptlrpc_thread
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: remove unused flag from ptlrpc_thread

SVC_EVENT is no longer used.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: ptlrpc: use workqueue for pinger
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: ptlrpc: use workqueue for pinger

lustre has a "Pinger" kthread which periodically pings peers
to ensure all hosts are functioning.

This can more easily be done using a work queue.

As maintaining contact with other peers is import for
keeping the filesystem running, and as the filesystem might
be involved in freeing memory, it is safest to have a
separate WQ_MEM_RECLAIM workqueue.

The SVC_EVENT functionality to wake up the thread can be
replaced with mod_delayed_work().

Also use round_jiffies_up_relative() rather than setting a
minimum of 1 second delay.  The PING_INTERVAL is measured in
seconds so this meets the need is allow the workqueue to
keep wakeups synchronized.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: ptlrpc: use delayed_work in sec_gc
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: ptlrpc: use delayed_work in sec_gc

The garbage collection for security contexts currently
has a dedicated kthread which wakes up every 30 minutes
to discard old garbage.

Replace this with a simple delayed_work item on the
system work queue.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: ldlm: use delayed_work for pools_recalc
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: ldlm: use delayed_work for pools_recalc

ldlm currenty has a kthread which wakes up every so often
and calls ldlm_pools_recalc().
The thread is started and stopped, but no other external interactions
happen.

This can trivially be replaced by a delayed_work if we have
ldlm_pools_recalc() reschedule the work rather than just report
when to do that.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: obdclass: use workqueue for zombie management.
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: obdclass: use workqueue for zombie management.

obdclass currently maintains two lists of data structures
(imports and exports), and a kthread which will free
anything on either list.  The thread is woken whenever
anything is added to either list.

This is exactly the sort of thing that workqueues exist for.

So discard the zombie kthread and the lists and locks, and
create a single workqueue.  Each obd_import and obd_export
gets a work_struct to attach to this workqueue.

This requires a small change to import_sec_validate_get()
which was testing if an obd_import was on the zombie
list.  This cannot have every safely found it to be
on the list (as it could be freed asynchronously)
so it must be dead code.

We could use system_wq instead of creating a dedicated
zombie_wq, but as we occasionally want to flush all pending
work, it is a little nicer to only have to wait for our own
work items.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: ptlrpc: change GFP_NOFS to GFP_KERNEL
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: ptlrpc: change GFP_NOFS to GFP_KERNEL

These allocations are performed during initialization,
so they don't need GFP_NOFS.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: get entropy from nid when nid set.
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: get entropy from nid when nid set.

When the 'lustre' module is loaded, it gets a list of
net devices and uses the node ids to  add entropy
to the prng.  This means that the network interfaces need
to be configured before the module is loaded, which prevents
the module from being compiled into a monolithic kernel.

So move this entropy addition to the moment when
the interface is imported to LNet and the node id is first known.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: lnet: keep ln_nportals consistent
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: lnet: keep ln_nportals consistent

ln_nportals should be zero when no portals have
been allocated.  This ensures that memory allocation failure
is handled correctly elsewhere.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: obdclass: don't require lct_owner to be non-NULL.
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: obdclass: don't require lct_owner to be non-NULL.

Some places in lu_object.c allow lct_owner to be NULL, implying
that the code is built in to the kernel (not a module), but
two places don't.  This prevents us from building lustre into
the kernel.

So remove the requirement and always allow lct_owner to be NULL.

This requires removing an "assert" that the module count is positive,
but this is redundant as module_put() already does the necessary test.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: statahead: remove incorrect test on agl_list_empty()
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: statahead: remove incorrect test on agl_list_empty()

Including agl_list_empty() in the wait_event_idle() condition
is pointless as the body of the loop doesn't do anything
about the agl list.
So if the list wasn't empty, the while loop would spin
indefinitely.

The test was removed in the lustre-release commit
672ab0e00d61 ("LU-3270 statahead: small fixes and cleanup"),
but not in the Linux commit 5231f7651c55 ("staging: lustre:
statahead: small fixes and cleanup").

Fixes: 5231f7651c55 ("staging: lustre: statahead: small fixes and cleanup")
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: fix bug in osc_enter_cache_try
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: fix bug in osc_enter_cache_try

The lustre-release patch commit bdc5bb52c554 ("LU-4933 osc:
Automatically increase the max_dirty_mb") changed

-       if (cli->cl_dirty + PAGE_CACHE_SIZE <= cli->cl_dirty_max &&
+       if (cli->cl_dirty_pages < cli->cl_dirty_max_pages &&

When this patch landed in Linux a couple of years later, it landed as

-       if (cli->cl_dirty + PAGE_SIZE <= cli->cl_dirty_max &&
+       if (cli->cl_dirty_pages <= cli->cl_dirty_max_pages &&

which is clearly different ('<=' vs '<'), and allows cl_dirty_pages to
increase beyond cl_dirty_max_pages - which causes a latter assertion
to fails.

Fixes: 3147b268400a ("staging: lustre: osc: Automatically increase the max_dirty_mb")
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: obd_mount: use correct niduuid suffix.
NeilBrown [Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)]
staging: lustre: obd_mount: use correct niduuid suffix.

Commit 4f016420d368 ("Staging: lustre: obdclass: Use kasprintf") moved
some sprintf() calls earlier in the code to combine them with
memory allocation and create kasprintf() calls.

In one case, this code movement moved the sprintf to a location where the
values being formatter were different.
In particular
       sprintf(niduuid, "%s_%x", mgcname, i);
was move from *after* the line
        i = 0;
to a location where the value of 'i' was at least 1.

This cause the wrong name to be formatted, and triggers

       CERROR("del MDC UUID %s failed: rc = %d\n",
              niduuid, rc);

at unmount time.

So use '0' instead of 'i'.

Fixes: 4f016420d368 ("Staging: lustre: obdclass: Use kasprintf")
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: remove else after return statement
Santha Meena Ramamoorthy [Sat, 24 Feb 2018 22:56:36 +0000 (14:56 -0800)]
staging: lustre: remove else after return statement

Remove else after a return statement as it is not useful. Issue found
using checkpatch.

Signed-off-by: Santha Meena Ramamoorthy <santhameena13@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: fsl-mc/dpio: remove unused function
Anders Roxell [Tue, 6 Mar 2018 09:11:50 +0000 (10:11 +0100)]
staging: fsl-mc/dpio: remove unused function

gcc warns that function 'qbman_pull_desc_set_token' is not used.

drivers/staging/fsl-mc/bus/dpio/qbman-portal.c:525:13: warning: ‘qbman_pull_desc_set_token’ defined but not used [-Wunused-function]

In the current code we remove that function.

Fixes: 321eecb06bfb ("bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename u16DummyReasonCode to avoid camelCase
Ajay Singh [Fri, 2 Mar 2018 14:22:49 +0000 (19:52 +0530)]
staging: wilc1000: rename u16DummyReasonCode 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: fix line over 80 char in handle_rcvd_ntwrk_info()
Ajay Singh [Fri, 2 Mar 2018 14:22:48 +0000 (19:52 +0530)]
staging: wilc1000: fix line over 80 char in handle_rcvd_ntwrk_info()

Fix 'line over 80 character' issues found by checkpatch.pl script by
use of temporary variable and avoided leading tab.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename handle_connect_timeout() variables to avoid camelCase
Ajay Singh [Fri, 2 Mar 2018 14:22:47 +0000 (19:52 +0530)]
staging: wilc1000: rename handle_connect_timeout() variables 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: fix line over 80 char in wilc_scan_complete_received()
Ajay Singh [Fri, 2 Mar 2018 14:22:46 +0000 (19:52 +0530)]
staging: wilc1000: fix line over 80 char in wilc_scan_complete_received()

Fix 'line over 80 character' 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: fix line over 80 char in wilc_del_allstation() & wilc_deinit()
Ajay Singh [Fri, 2 Mar 2018 14:22:45 +0000 (19:52 +0530)]
staging: wilc1000: fix line over 80 char in wilc_del_allstation() & wilc_deinit()

Fix 'line over 80 characters' 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: fix line over 80 char in wilc_add_ptk()
Ajay Singh [Fri, 2 Mar 2018 14:22:44 +0000 (19:52 +0530)]
staging: wilc1000: fix line over 80 char in wilc_add_ptk()

Fix 'line over 80 characters' 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 pstrHostIFkeyAttr to avoid camelCase issue
Ajay Singh [Fri, 2 Mar 2018 14:22:43 +0000 (19:52 +0530)]
staging: wilc1000: rename pstrHostIFkeyAttr to avoid camelCase issue

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: fix line over 80 char in host_int_parse_join_bss_param()
Ajay Singh [Fri, 2 Mar 2018 14:22:42 +0000 (19:52 +0530)]
staging: wilc1000: fix line over 80 char in host_int_parse_join_bss_param()

Fix 'line over 80 characters' 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: fix line over 80 char for wilc_gnrl_async_info_received()
Ajay Singh [Fri, 2 Mar 2018 14:22:41 +0000 (19:52 +0530)]
staging: wilc1000: fix line over 80 char for wilc_gnrl_async_info_received()

Fix 'line over 80 char' 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: fix line over 80 char in wilc_network_info_received()
Ajay Singh [Fri, 2 Mar 2018 14:22:40 +0000 (19:52 +0530)]
staging: wilc1000: fix line over 80 char in wilc_network_info_received()

Fix 'line over 80 character' 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: fix line over 80 char in handle_cfg_param()
Ajay Singh [Fri, 2 Mar 2018 14:22:39 +0000 (19:52 +0530)]
staging: wilc1000: fix line over 80 char in handle_cfg_param()

Fix 'line over 80 char' issues found by checkpatch.pl script in
handle_cfg_param(). Rename variables and used temporary variables
to fix the line over 80 characters issue.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: remove always 'true' check from 'if' statement
Ajay Singh [Fri, 2 Mar 2018 14:22:38 +0000 (19:52 +0530)]
staging: wilc1000: remove always 'true' check from 'if' statement

Fix few smatch warning related to 'warn: always true condition'.

handle_cfg_param() warn: always true condition
'(cfg_param_attr->auth_timeout < 65536) => (0-u16max < 65536)'
handle_cfg_param() warn: always true condition
'(cfg_param_attr->rts_threshold < 65536) => (0-u16max < 65536)'
handle_cfg_param() warn: always true condition
'(cfg_param_attr->beacon_interval < 65536) => (0-u16max < 65536)'
handle_cfg_param() warn: always true condition
'(cfg_param_attr->site_survey_scan_time < 65536) => (0-u16max <
65536)'
handle_cfg_param() warn: always true condition
'(cfg_param_attr->active_scan_time < 65536) => (0-u16max < 65536)'
handle_cfg_param() warn: always true condition
'(cfg_param_attr->passive_scan_time < 65536) => (0-u16max < 65536)'

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename enuEvent to avoid camelCase
Ajay Singh [Fri, 2 Mar 2018 14:22:37 +0000 (19:52 +0530)]
staging: wilc1000: rename enuEvent 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>