]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/log
mirror_ubuntu-eoan-kernel.git
7 years agostaging: unisys: remove visorbus_type extern
David Kershner [Wed, 27 Sep 2017 17:14:36 +0000 (13:14 -0400)]
staging: unisys: remove visorbus_type extern

The variable visorbus_type could be contained to the visorbus_main.c
file by moving the two functions that referenced it visorchipset.c. This
allowed us to remove the incorrect extern from the include file visorbus.h.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: keep the success path on the left side
David Kershner [Wed, 27 Sep 2017 17:14:35 +0000 (13:14 -0400)]
staging: unisys: visorbus: keep the success path on the left side

If you can't find the dev, it is an error. Indent for the error, instead
of the success.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: include: consolidate a comment
David Kershner [Wed, 27 Sep 2017 17:14:34 +0000 (13:14 -0400)]
staging: unisys: include: consolidate a comment

Use all 80 characters of the line to consolidate a comment.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: include: remove signature_32
David Kershner [Wed, 27 Sep 2017 17:14:33 +0000 (13:14 -0400)]
staging: unisys: include: remove signature_32

Remove signature_32 since it was only being referenced in one location.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: include: reorder to avoid forward declaration
David Kershner [Wed, 27 Sep 2017 17:14:32 +0000 (13:14 -0400)]
staging: unisys: include: reorder to avoid forward declaration

The include file visorbus.h has a forward declaration of visor_device.
A simple reorder of the file removed the need for the forward
declaration.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: vbuschannel doesn't use ctypes
David Kershner [Wed, 27 Sep 2017 17:14:31 +0000 (13:14 -0400)]
staging: unisys: visorbus: vbuschannel doesn't use ctypes

Don't include ctypes in vbuschannel.h, it isn't used by ctypes, but it is
used by visorbus_main.c so include it there.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: include: remove io.h from channel.h
David Kershner [Wed, 27 Sep 2017 17:14:30 +0000 (13:14 -0400)]
staging: unisys: include: remove io.h from channel.h

Channel.h was including io.h and not using it. Remove the #include.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: only include a file where it is used.
David Kershner [Wed, 27 Sep 2017 17:14:29 +0000 (13:14 -0400)]
staging: unisys: only include a file where it is used.

The header file visorbus.h included several linux headers that were
used by the source files that include it. Move the includes to the
files that actually use them.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: to_visor_device/to_visor_driver move up
David Kershner [Wed, 27 Sep 2017 17:14:28 +0000 (13:14 -0400)]
staging: unisys: visorbus: to_visor_device/to_visor_driver move up

The macros to_visor_device and to_visor_driver are fairly small; move them
up to the declaration block to save some space.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: visorbus_main.c: remove blank lines
David Kershner [Wed, 27 Sep 2017 17:14:27 +0000 (13:14 -0400)]
staging: unisys: visorbus: visorbus_main.c: remove blank lines

Removes several extraneous blank lines in visorbus_main.c.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: visorchipset: clean up blank lines in visorchipset
David Kershner [Wed, 27 Sep 2017 17:14:26 +0000 (13:14 -0400)]
staging: unisys: visorbus: visorchipset: clean up blank lines in visorchipset

Remove extraneous blank lines and get consistency of blank lines.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: fix newlines for visorchannel
David Kershner [Wed, 27 Sep 2017 17:14:25 +0000 (13:14 -0400)]
staging: unisys: visorbus: fix newlines for visorchannel

Remove extraneous blank lines and add some lines that are needed. General
philosophy -- declaration, space, pre-conditions (if needed), space, then
rest of function.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: Remove unneeded initialization
David Kershner [Wed, 27 Sep 2017 17:14:24 +0000 (13:14 -0400)]
staging: unisys: visorbus: Remove unneeded initialization

No need to set drv to NULL.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: simplify debugfs print statment
David Kershner [Wed, 27 Sep 2017 17:14:23 +0000 (13:14 -0400)]
staging: unisys: visorbus: simplify debugfs print statment

Simplify debugfs statement so it is clearer and more compact.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: clean up formatting of function definitions
David Kershner [Wed, 27 Sep 2017 17:14:22 +0000 (13:14 -0400)]
staging: unisys: visorbus: clean up formatting of function definitions

Consolidate function parameters onto the same line if they can fit.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: shrink the name of a variable
David Kershner [Wed, 27 Sep 2017 17:14:21 +0000 (13:14 -0400)]
staging: unisys: shrink the name of a variable

The field debugfs_client_bus_info can be reduced to debugfs_bus_info.
The word client is extraneous in this context.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: keep the success path on the left
David Kershner [Wed, 27 Sep 2017 17:14:20 +0000 (13:14 -0400)]
staging: unisys: visorbus: keep the success path on the left

The code was indenting for the successful path and then combining the
error and success path for the rest of the function. Correct it so the
success path is not indented.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: clean up initializations
David Kershner [Wed, 27 Sep 2017 17:14:19 +0000 (13:14 -0400)]
staging: unisys: visorbus: clean up initializations

Don't compute value of offset during initialization. Assigning a value to
offset should happen after we have verified all of its components.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys; visorbus: visorbus_main.c: remove extraneous newline
David Kershner [Wed, 27 Sep 2017 17:14:18 +0000 (13:14 -0400)]
staging: unisys; visorbus: visorbus_main.c: remove extraneous newline

Use all 80 characters when calling functions.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: fix up device_destroy
David Kershner [Wed, 27 Sep 2017 17:14:17 +0000 (13:14 -0400)]
staging: unisys: fix up device_destroy

Visorbus_remove_instance calls device_unregister which in turn will call
visorbus_release_busdevice. The function visorbus_release_busdevice was
freeing the visor_device. The code in visorbus_remove_instance was then
trying to reference the visor_device. This patch cleans up the code so
the visor_device is not referenced after the unregister.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: NULL pending_msg_hdr not an error
David Kershner [Wed, 27 Sep 2017 17:14:16 +0000 (13:14 -0400)]
staging: unisys: visorbus: NULL pending_msg_hdr not an error

A NULL pending_msg_hdr is not an error, it just means that the firmware
does not want an error response for that message.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: don't put code in declaration.
David Kershner [Wed, 27 Sep 2017 17:14:15 +0000 (13:14 -0400)]
staging: unisys: visorbus: don't put code in declaration.

Simplify the code by not putting the assignment in the declaration. Define
it and then assign it, so the function doesn't get bunched up on the
right.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: use guid_is_equal instead of memcmp
David Kershner [Wed, 27 Sep 2017 17:14:14 +0000 (13:14 -0400)]
staging: unisys: visorbus: use guid_is_equal instead of memcmp

The function publish_vbus_dev_info was doing a memcmp of guids. It should
be using the kernel provided guid_equal function instead.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: visorbus_main.c: cleanup and consolidate comments
David Kershner [Wed, 27 Sep 2017 17:14:13 +0000 (13:14 -0400)]
staging: unisys: visorbus: visorbus_main.c: cleanup and consolidate comments

Use all 80 characters of the line for comments to help reduce the number
of extra lines in the code.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: visorbus_private.h remove extra blank lines
David Kershner [Wed, 27 Sep 2017 17:14:12 +0000 (13:14 -0400)]
staging: unisys: visorbus: visorbus_private.h remove extra blank lines

Remvoe several unneeded blank lines.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: fix alignment of paranethesis
David Kershner [Wed, 27 Sep 2017 17:14:11 +0000 (13:14 -0400)]
staging: unisys: visorbus: fix alignment of paranethesis

Correct indenting of parameters when calling the functions in the file
visorchipset.c.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys; visorbus: visorchipset.c: remove extraneous newline
David Kershner [Wed, 27 Sep 2017 17:14:10 +0000 (13:14 -0400)]
staging: unisys; visorbus: visorchipset.c: remove extraneous newline

Use all 80 characters when calling functions.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: visorchannel: use 80 characters for comments
David Kershner [Wed, 27 Sep 2017 17:14:09 +0000 (13:14 -0400)]
staging: unisys: visorbus: visorchannel: use 80 characters for comments

In the file visorhcannel.c use all 80 characters for comments instead of
shortening them.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: clean up parser_string_get function
David Kershner [Wed, 27 Sep 2017 17:14:08 +0000 (13:14 -0400)]
staging: unisys: visorbus: clean up parser_string_get function

The function parser_string_get was writing its own strnlen function, use
the kernel version instead.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: don't need local variable cmd
David Kershner [Wed, 27 Sep 2017 17:14:07 +0000 (13:14 -0400)]
staging: unisys: visorbus: don't need local variable cmd

The local variable cmd was just being used to dereference a field inside
of it. Get rid of the variable and just derefernce the parameter being
passed in.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: simplify commenting in controlvm_init
David Kershner [Wed, 27 Sep 2017 17:14:06 +0000 (13:14 -0400)]
staging: unisys: visorbus: simplify commenting in controlvm_init

During the process of udpating the features bits, put a block comment for
all updates instead of a separate comment for each one.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8712: Fix indent coding style issue
Mihaela Muraru [Tue, 26 Sep 2017 07:24:50 +0000 (10:24 +0300)]
staging: rtl8712: Fix indent coding style issue

This patch fixes an indentation coding style issue found by
checkpatch.pl:

WARNING: suspect code indent for conditional statements (16, 32)

Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: rtl8723bs: core: Remove boolean comparison
Georgiana Chelu [Fri, 22 Sep 2017 15:04:51 +0000 (08:04 -0700)]
Staging: rtl8723bs: core: Remove boolean comparison

Remove comparison to bool in order to improve
the clearness of the code.

Issue found using coccinelle script.

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoiio:stm32-lp-timer and ep93xx: drop assign iio_info.driver_module and iio_trigger_ops...
Jonathan Cameron [Tue, 26 Sep 2017 07:05:08 +0000 (08:05 +0100)]
iio:stm32-lp-timer and ep93xx: drop assign iio_info.driver_module and iio_trigger_ops.owner

The equivalent of both of these are now done via macro magic when
the relevant register calls are made.  The actual structure
elements have gone away.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMerge tag 'iio-for-4.15a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Mon, 25 Sep 2017 10:56:37 +0000 (12:56 +0200)]
Merge tag 'iio-for-4.15a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Round one of new device support, features and cleanup for IIO in the 4.15 cycle.

Note there is a misc driver drop in here given we have support
in IIO and the feeling is no one will care.

A large part of this series is a boiler plate removal series avoiding
the need to explicitly provide THIS_MODULE in various locations.
It's very dull but touches all drivers.

New device support
* ad5446
  - add ids to support compatible parts DAC081S101, DAC101S101,
    DAC121S101.
  - add the dac7512 id and drop the misc driver as feeling is no
    one is using it (was introduced for a board that is long obsolete)
* mt6577
  - add bindings for mt2712 which is fully compatible with other
    supported parts.
* st_pressure
  - add support for LPS33HW and LPS35HW with bindings (ids mostly).

New features
* ccs811
  - Add support for the data ready trigger.
* mma8452
  - remove artifical restriction on supporting multiple event types
    at the same time.
* tcs3472
  - support out of threshold events

Core and tree wide cleanup
* Use macro magic to remove the need to provide THIS_MODULE as part of
  struct iio_info or struct iio_trigger_ops.  This is similar to
  work done in a number of other subsystems (e.g. i2c, spi).

  All drivers are fixed and then the fields in these structures are
  removed.

  This will cause build failures for out of tree drivers and any
  new drivers that cross with this work going into the kernel.

  Note mostly done with a coccinelle patch, included in the series
  on the mailing list but not merged as the fields no longer exist
  in the structures so the any hold outs will cause a build failure.

Cleanups
* ads1015
  - avoid writing config register when it doesn't change.
  - add 10% to conversion wait time as it seems it is sometimes
    a little small.
ade7753
  - replace use of core mlock with a local lock.  This is part of a
    long term effort to make the use of mlock opaque and single
    purpose.
ade7759
  - expand the use of buf_lock to cover previous mlock cases.  This
    is a slightly nicer solution to the same issue as in ade7753.
* cros_ec
  - drop an unused variable
* inv_mpu6050
  - add a missing break in a switch for consistency - not actual
    bug,
  - make some local arrays static to save on object code size.
* max5481
  - drop manual setting of the spi module owner as handled by the
    spi core.
* max5487
  - drop manual setting of the spi module owner as handled by the
    spi core.
* max9611
  - drop explicit setting of the i2c module owner as handled by
    the i2c core.
* mcp320x
  - speed up reads on single channel devices,
  - drop unused of_device_id data elements,
  - document the struct mcp320x,
  - improve binding docs to reflect restrictions on spi setup and
    to make it explicit that the reference regulator is needed.
* mma8452
  - symbolic to octal permissions,
  - unsigned to unsigned int.
* st_lsm6dsx
  - avoid setting odr values multiple times,
  - drop config of LIR as it is only ever set to the existing
    defaults,
  - drop rounding configuration as it only ever matches the defaults.
* ti-ads8688
  - drop manual setting of the spi module owner as handled by the
    spi core.
* tsl2x7x
  - constify the i2c_device_id,
  - cleanup limit checks to avoid static checker warnings (and generally
    have nicer code).

7 years agoiio: imu: st_lsm6dsx: remove rounding configuration
Lorenzo Bianconi [Sat, 23 Sep 2017 19:10:52 +0000 (21:10 +0200)]
iio: imu: st_lsm6dsx: remove rounding configuration

Remove rounding configuration since it is enabled by default for the
FIFO output registers

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: imu: st_lsm6dsx: remove LIR configuration
Lorenzo Bianconi [Sat, 23 Sep 2017 19:10:51 +0000 (21:10 +0200)]
iio: imu: st_lsm6dsx: remove LIR configuration

Remove Latched Interrupt configuration since it is enabled by default
for FIFO watermark interrupt

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: adc: mt2712: Add compatible node for mt2712.
Zhiyong Tao [Thu, 21 Sep 2017 01:26:51 +0000 (09:26 +0800)]
iio: adc: mt2712: Add compatible node for mt2712.

This commit adds mt2712 compatible node.

Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agodt-bindings: adc: mt2712: add binding documention
Zhiyong Tao [Thu, 21 Sep 2017 01:26:50 +0000 (09:26 +0800)]
dt-bindings: adc: mt2712: add binding documention

The commit adds mt2712 compatible node in binding document.

Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agodt-bindings: iio: adc: mcp320x: Update for mcp3550/1/3
Lukas Wunner [Sat, 9 Sep 2017 18:32:41 +0000 (20:32 +0200)]
dt-bindings: iio: adc: mcp320x: Update for mcp3550/1/3

All chips supported by this driver clock data out on the falling edge
and latch data in on the rising edge, hence SPI mode (0,0) or (1,1)
must be used.

Furthermore, none of the chips has an internal reference voltage
regulator, so an external supply is always required and needs to be
specified in the device tree lest the IIO "scale" in sysfs cannot be
calculated.

Document these requirements in the device tree binding, add compatible
strings for the newly supported mcp3550/1/3 and explain that SPI mode
(0,0) should be preferred for these chips.

Cc: Mathias Duckeck <m.duckeck@kunbus.de>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: imu: st_lsm6dsx: set sensor->odr value just in st_lsm6dsx_write_raw()
Lorenzo Bianconi [Mon, 18 Sep 2017 17:49:57 +0000 (19:49 +0200)]
iio: imu: st_lsm6dsx: set sensor->odr value just in st_lsm6dsx_write_raw()

Update odr value in st_lsm6dsx_sensor data structure just in
st_lsm6dsx_write_raw() in order to avoid to set the same value
multiple times

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoStaging: iio: meter: ade7759: update locking method for write frequency
Katie Dunne [Mon, 18 Sep 2017 22:52:40 +0000 (15:52 -0700)]
Staging: iio: meter: ade7759: update locking method for write frequency

iio_dev->mlock is to be used only by the IIO core for protecting
device mode changes between INDIO_DIRECT and INDIO_BUFFER.

This patch replaces the use of mlock with the already established
buf_lock mutex.

Introducing an 'unlocked' spi_write_reg_16 function to be used by
ade7759_write_frequency avoids nested locks and maintains atomicity
between bus and device frequency changes.

Based on the solution found in ade7754 patch here:
https://marc.info/?l=linux-iio&m=149086659008991&w=2

Signed-off-by: Katie Dunne <kdunne@mail.ccsf.edu>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agostaging: iio: ade7753: replace mlock with driver private lock
Himanshi Jain [Mon, 18 Sep 2017 06:59:52 +0000 (12:29 +0530)]
staging: iio: ade7753: replace mlock with driver private lock

Replace driver usage of mlock with driver private lock to meet the new
model where usage of iio_dev->mlock is being redefined as protecting
operating mode changes(changes between BUFFER* and DIRECT modes).

Signed-off-by: Himanshi Jain <himshijain.hj@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: accel: mma8452: Fix code style warning for unsigned int declarations
Harinath Nampally [Sat, 23 Sep 2017 20:56:30 +0000 (16:56 -0400)]
iio: accel: mma8452: Fix code style warning for unsigned int declarations

Replace 'unsigned' with 'unsigned int'
to improve code readability.

Issue found by checkpatch.

Signed-off-by: Harinath Nampally <harinath922@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: accel: mma8452: Fix code style warning
Harinath Nampally [Sat, 23 Sep 2017 20:56:29 +0000 (16:56 -0400)]
iio: accel: mma8452: Fix code style warning

Replace symbolic permissions with octal permissions
to improve code readability.

Issue found by checkpatch.

Signed-off-by: Harinath Nampally <harinath922@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: cros_ec: Remove unused variable
Paolo Cretaro [Thu, 14 Sep 2017 21:19:22 +0000 (23:19 +0200)]
iio: cros_ec: Remove unused variable

Fix gcc warning:
cros_ec_baro.c:130:25: warning: variable â€˜ec_device’ set but not used

Signed-off-by: Paolo Cretaro <paolocretaro@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agostaging: iio: tsl2x7x: clean up limit checks
Dan Carpenter [Fri, 8 Sep 2017 10:53:43 +0000 (13:53 +0300)]
staging: iio: tsl2x7x: clean up limit checks

The background of this code is that we can either use the default
tables or load our own table with sysfs.  The default tables are three
element arrays of struct tsl2x7x_lux.  If we load the table with sysfs
then we can have as many as nine elements.  Which ever way we do it, the
last element is always zeroed out.

The most interesting part of this patch is in the
in_illuminance0_lux_table_show() function.  We were using the wrong
limit, "TSL2X7X_MAX_LUX_TABLE_SIZE * 3", when it should have been just
"TSL2X7X_MAX_LUX_TABLE_SIZE".  This creates a static checker warning
that we are going of bounds.  However, since the last element is
always zeroed out, that means we hit the break statement and the code
works correctly despite the wrong limit check.

I made several related readability changes.  The most notable that I
changed the MAX_DEFAULT_TABLE_BYTES define which was:

I renamed the define to TSL2X7X_DEFAULT_TABLE_BYTES because it's not the
max size, it's the only size.  Also the size should really be expressed
as sizeof(struct tsl2x7x_lux) * 3.  In other words, 12 * 3 instead of
4 * 9.  It's 36 bytes either way, so this doesn't change the behavior.

Finally, I created the TSL2X7X_DEF_LUX_TABLE_SZ define instead of using
the magic number 3.  I declared the default tables using that define
to hopefully signal to future programmers that if they want to use a
different size they have to update all the related code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: adc: mcp320x: Document struct mcp320x
Lukas Wunner [Sat, 9 Sep 2017 18:32:41 +0000 (20:32 +0200)]
iio: adc: mcp320x: Document struct mcp320x

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: adc: mcp320x: Drop unnecessary of_device_id attributes
Lukas Wunner [Sat, 9 Sep 2017 18:32:41 +0000 (20:32 +0200)]
iio: adc: mcp320x: Drop unnecessary of_device_id attributes

The driver sets a .data pointer for each .compatible string but never
calls of_device_get_match_data().  Instead, ADC properties are looked up
with spi_get_device_id().  The .data pointer is therefore unnecessary,
so drop it.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: adc: mcp320x: Speed up readout of single-channel ADCs
Lukas Wunner [Sat, 9 Sep 2017 18:32:41 +0000 (20:32 +0200)]
iio: adc: mcp320x: Speed up readout of single-channel ADCs

Single-channel converters such as mcp3001, mcp3201, mcp3301 and the
upcoming mcp3550/1/3 lack a MOSI pin, so there's no need to call
mcp320x_channel_to_tx_data() for them.

Moreover, instead of calling spi_read() for these converters, which
generates an spi_message and spi_transfer on the stack on every readout,
it's more efficient to use the spi_message and spi_transfer[] included
in struct mcp320x (as we do for multi-channel ADCs), but initialize the
spi_message only with the receive transfer.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: chemical: ccs811: Add support for data ready trigger
Narcisa Ana Maria Vasile [Thu, 7 Sep 2017 18:38:37 +0000 (21:38 +0300)]
iio: chemical: ccs811: Add support for data ready trigger

Add data ready trigger for hardware interrupts that signal
new, available measurement samples.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agostaging: xgifb: make const array static to shink object code size
Colin Ian King [Thu, 21 Sep 2017 22:39:59 +0000 (23:39 +0100)]
staging: xgifb: make const array static to shink object code size

Don't populate const array LCDARefreshIndex on the stack, instead
make it static.  Makes the object code smaller by 340 bytes:

Before:
   text    data     bss     dec     hex filename
  84949   12336       0   97285   17c05 drivers/staging/xgifb/vb_setmode.o

After:
   text    data     bss     dec     hex filename
  84506   12432       0   96938   17aaa drivers/staging/xgifb/vb_setmode.o

(gcc version 7.2.0 x86_64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: remove BCM2835_VCHIQ_SUPPORT_MEMDUMP
Dan Carpenter [Thu, 21 Sep 2017 07:14:09 +0000 (10:14 +0300)]
staging: vc04_services: remove BCM2835_VCHIQ_SUPPORT_MEMDUMP

BCM2835_VCHIQ_SUPPORT_MEMDUMP lets you look through any user memory.
That's too big of an information leak from a security perspective.  The
debugging dumps need to be more specific to this driver.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:rtl8188eu:hal Fix wrong comparison to False
Janani Sankara Babu [Thu, 21 Sep 2017 05:39:55 +0000 (11:09 +0530)]
staging:rtl8188eu:hal Fix wrong comparison to False

This patch solves the warning "Using comparison to false is error prone"

Signed-off-by: Janani Sankara Babu <jananis37@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:rtl8188eu Fix remove semicolon in do {}while(0)
Janani Sankara Babu [Thu, 21 Sep 2017 05:42:46 +0000 (11:12 +0530)]
staging:rtl8188eu Fix remove semicolon in do {}while(0)

This patch removes the semicolon at the end of while statement in the
do while macro , inorder to avoid it behaving like compound statement.

Signed-off-by: Janani Sankara Babu <jananis37@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/comedi/das16: Make timer initialization unconditional
Kees Cook [Wed, 20 Sep 2017 23:27:50 +0000 (16:27 -0700)]
staging/comedi/das16: Make timer initialization unconditional

With timer initialization made unconditional, there is no reason to
make del_timer_sync() calls conditionally, there by removing the test
of the .data field.

Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: irda: net: Fix style issues
Georgiana Chelu [Fri, 22 Sep 2017 07:52:14 +0000 (00:52 -0700)]
Staging: irda: net: Fix style issues

Fix minor coding style issues found by checkpatch.pl.

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: irda: net: Use NOT operator instead of comparison to NULL
Georgiana Chelu [Fri, 22 Sep 2017 07:52:13 +0000 (00:52 -0700)]
Staging: irda: net: Use NOT operator instead of comparison to NULL

Fix issues find by checkpatch.pl.
CHECK: Comparison to NULL could be written "!dongles"
CHECK: Comparison to NULL could be written "!tasks"

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: irda: net: Do not initialise statics to NULL
Georgiana Chelu [Fri, 22 Sep 2017 07:52:12 +0000 (00:52 -0700)]
Staging: irda: net: Do not initialise statics to NULL

There is no need to initialize static variables to NULL
because they are stored in .bss segment. This segment
is initialized to 0 at the beginning of the code execution.

Issue found by checkpatch.pl.
ERROR: do not initialise statics to NULL

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: Remove typedef struct
Harsha Sharma [Fri, 22 Sep 2017 07:37:03 +0000 (13:07 +0530)]
staging: vc04_services: Remove typedef struct

Remove typedef from struct as linux-kernel coding style tends to
avoid using typedefs

Done using following coccinelle semantic patch

@r1@
type T;
@@

typedef struct { ... } T;

@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_t" or T[-2:] == "_T":
        coccinelle.T2 = T[:-2];
else:
        coccinelle.T2 = T;

print T, coccinelle.T2

@r2@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;

@r3@
type r1.T;
identifier c1.T2;
@@
-T
+struct T2

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: rtlwifi: halmac: Remove unnecessary 'out of memory' messages
Georgiana Chelu [Wed, 20 Sep 2017 20:32:17 +0000 (23:32 +0300)]
Staging: rtlwifi: halmac: Remove unnecessary 'out of memory' messages

Remove unnecessary messages because OOM (Out Of Memory Manager)
reports memory allocation fail messages. The return value
is clear regarding the problem, so there is no need for the
'out of memory' comments. Also, delete braces {} for single
if statement blocks to improve the coding style.

Fix issues found by by checkpatch.pl.
WARNING: Possible unnecessary 'out of memory' message.
WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Georgiana Chelu <georgiana.chelu93@example.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: rtl8192u: ieee80211: Use netdev_info instead of printk
Georgiana Chelu [Tue, 19 Sep 2017 19:54:06 +0000 (22:54 +0300)]
Staging: rtl8192u: ieee80211: Use netdev_info instead of printk

Replace printk with netdev_info because struct ieee80211_device
contains a net_device structure.

Issue found by checkpatch.pl script.
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then
dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...

Signed-off-by: Georgiana Chelu <georgiana.chelu93@example.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: ptlrpc: kfree used instead of kvfree
Nadav Amit [Tue, 5 Sep 2017 20:25:25 +0000 (20:25 +0000)]
staging: lustre: ptlrpc: kfree used instead of kvfree

rq_reqbuf is allocated using kvmalloc() but released in one occasion
using kfree() instead of kvfree().

The issue was found using grep based on a similar bug.

Fixes: d7e09d0397e8 ("add Lustre file system client support")
Fixes: ee0ec1946ec2 ("lustre: ptlrpc: Replace uses of OBD_{ALLOC,FREE}_LARGE")
Cc: Peng Tao <bergwolf@gmail.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: James Simmons <jsimmons@infradead.org>
Signed-off-by: Nadav Amit <namit@vmware.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: fbtft: remove redundant initialization of txbuf16
Colin Ian King [Sat, 16 Sep 2017 16:46:28 +0000 (17:46 +0100)]
staging: fbtft: remove redundant initialization of txbuf16

txbuf16 is being initialized at declaration time and then later
set to another value without it being read inbetween, hence making
the initialization redundant.  Fix this by setting txbuf16 just
the once. Also clean up some incorrect indentations. Cleans up
clang build warning:

warning: Value stored to 'txbuf16' during its initialization is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ccree: remove unused and redundant variable idx
Colin Ian King [Sat, 16 Sep 2017 16:32:51 +0000 (17:32 +0100)]
staging: ccree: remove unused and redundant variable idx

Variable idx is being set but never read and thus it can be
removed because it is redundant. Cleans up clang build warnings:

warning: Value stored to 'idx' during its initialization is never read
warning: Value stored to 'idx' is never read
warning: Value stored to 'idx' is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: speakup: Remove unnecessary parentheses
Castulo J. Martinez [Sat, 16 Sep 2017 00:16:54 +0000 (17:16 -0700)]
staging: speakup: Remove unnecessary parentheses

Remove unnecessary parentheses from if statements to make the code
easier to read.

Issue found by checkpatch.

Signed-off-by: Castulo J. Martinez <castulo.martinez@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: Fix spelling
Valentine Sinitsyn [Fri, 15 Sep 2017 01:34:20 +0000 (18:34 -0700)]
staging: rtl8188eu: Fix spelling

rtl8188eu contains some spelling errors in comment lines as well as in
constants. Harmless as they are, they still make the code feel a bit
unclean, which is not something we want in the kernel.

Improve this by fixing typos so they won't catch eyes of future driver
developers anymore.

Signed-off-by: Wolfgang Hartmann <wolfgang.hartmann@siemens.com>
Signed-off-by: Manish Shrestha <manishshrestha2006@gmail.com>
Signed-off-by: Valentine Sinitsyn <valentine.sinitsyn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192u: remove unneeded SN_LESS macro
Greg Kroah-Hartman [Mon, 18 Sep 2017 10:15:09 +0000 (12:15 +0200)]
staging: rtl8192u: remove unneeded SN_LESS macro

It's already in a .h file, don't redefine it as the compiler doesn't
like it if it does not match identically.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl819u: move '{' to next line
Aastha Gupta [Sat, 16 Sep 2017 11:00:54 +0000 (16:30 +0530)]
staging: rtl819u: move '{' to next line

Fixes checkpatch.pl error:
ERROR: open brace '{' following function declarations go on the next line

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192u: remove space before semicolon
Aastha Gupta [Sat, 16 Sep 2017 11:00:53 +0000 (16:30 +0530)]
staging: rtl8192u: remove space before semicolon

Fixex checkpatch.pl warning:
WARNING: space prohibited before semicolon

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192u: add space after ','
Aastha Gupta [Sat, 16 Sep 2017 11:00:52 +0000 (16:30 +0530)]
staging: rtl8192u: add space after ','

Fixes 'space required after ','', reported by checkpatch.pl

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192u: remove space function pointer arguments
Aastha Gupta [Sat, 16 Sep 2017 11:00:51 +0000 (16:30 +0530)]
staging: rtl8192u: remove space function pointer arguments

Fixes checkpatch.pl warning:
WARNING: Unnecessary space before function pointer arguments

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192u: fix '{' following enum go on the same line
Aastha Gupta [Sat, 16 Sep 2017 11:00:50 +0000 (16:30 +0530)]
staging: rtl8192u: fix '{' following enum go on the same line

Fixes checkpatch.pl error:
ERROR: open brace '{' following enum go on the same line

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192u:add space before '(' and '{'
Aastha Gupta [Sat, 16 Sep 2017 11:00:49 +0000 (16:30 +0530)]
staging: rtl8192u:add space before '(' and '{'

Fixes checkpatch.pl errors:
ERROR: space required before the open parenthesis '('
ERROR: space required before the open brace '{'

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192u: add spaces after struct/enum definitions
Aastha Gupta [Sat, 16 Sep 2017 11:00:48 +0000 (16:30 +0530)]
staging: rtl8192u: add spaces after struct/enum definitions

Fixes checkpatch.pl warnings:
WARNING: missing space after enum definition
WARNING: missing space after struct definition

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192u: remove space before ')'
Aastha Gupta [Sat, 16 Sep 2017 11:00:47 +0000 (16:30 +0530)]
staging: rtl8192u: remove space before ')'

Fixes checkpatch.pl error:
ERROR: space prohibited before that close parenthesis ')'

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192u: remove space after '('
Aastha Gupta [Sat, 16 Sep 2017 11:00:46 +0000 (16:30 +0530)]
staging: rtl8192u: remove space after '('

ERROR: space prohibited after the open parenthesis '('

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192u: add space after '}'
Aastha Gupta [Sat, 16 Sep 2017 11:00:45 +0000 (16:30 +0530)]
staging: rtl8192u: add space after '}'

This patch fixes checkpatch.pl error:
ERROR: space required after that close brace '}'

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192u: fix spaces around algebric and binary operators
Aastha Gupta [Sat, 16 Sep 2017 11:00:44 +0000 (16:30 +0530)]
staging: rtl8192u: fix spaces around algebric and binary operators

Fixes prefer spaces around '+', '_', '?', '&', '==', '!=', '|', '&&', '=' as reported
by checkpatch.pl.

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: wlan-ng: Replace pr_debug with netdev_dbg
Haneen Mohammed [Wed, 13 Sep 2017 04:32:25 +0000 (22:32 -0600)]
staging: wlan-ng: Replace pr_debug with netdev_dbg

This patch replace pr_debug with netdev_dbg when appropriate net_device
structure is found.
Issue found using the following Coccinelle script:

@r exists@
identifier f, s, i;
position p;
@@

f(...,struct s *i,...) {
<+... when != i == NULL
(
pr_err@p(...);
|
pr_info@p(...);
|
pr_debug@p(...);
)
...+>
}

@rr@
identifier r.s, fld;
@@

struct s {
...
struct net_device *fld;
... };

@@
identifier r.i, r.s, rr.fld;
position r.p;
@@
(
-pr_err@p
+netdev_err
(
+ i->fld,
...)
|
-pr_info@p
+netdev_info
(
+ i->fld,
...)
|
-pr_debug@p
+netdev_dbg
(
+ i->fld,
...)
)

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: pi433: Merge assignment with return value
Meghana Madhyastha [Fri, 15 Sep 2017 07:04:30 +0000 (12:34 +0530)]
Staging: pi433: Merge assignment with return value

Removes the unnecessary assignment of retval preceding
the return statement.

Detected using the following Coccinelle script:
@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: Android: follow coding guidlines
Keerthi Reddy [Wed, 13 Sep 2017 17:12:34 +0000 (22:42 +0530)]
staging: Android: follow coding guidlines

- Add a new line after struct declaration
- remove extra new line.

Signed-off-by: Keerthi Reddy <keerthigd4990@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: xgifb: fix multiple line dereference
Aastha Gupta [Thu, 14 Sep 2017 12:08:50 +0000 (17:38 +0530)]
staging: xgifb: fix multiple line dereference

This patch fixes the checkpatch.pl warning:

WARNING: Avoid multiple line dereference - prefer'XGI330_EModeIDTable[ModeIdIndex].Ext_ModeFlag'

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: ccree: Use kcalloc instead of kzalloc
Srishti Sharma [Thu, 14 Sep 2017 12:48:13 +0000 (18:18 +0530)]
Staging: ccree: Use kcalloc instead of kzalloc

Use kcalloc instead of kzalloc to check for overflow before
multiplication. Done using the following semantic patch by
coccinelle.

http://coccinelle.lip6.fr/rules/kzalloc.cocci

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: remove parenthesis from right hand side of assignment
Aishwarya Pant [Fri, 15 Sep 2017 13:23:08 +0000 (18:53 +0530)]
staging: rtl8188eu: remove parenthesis from right hand side of assignment

Parenthesis are not needed around the right hand side of an assignment.
This patch was made on the core files of rtl8188eu using the following
coccinelle script.

@@
binary operator op = {==,!=,&&,||,>=,<=,&,|};
expression l, r, t;
@@

(
l = (r op t)
|
l =
-(
r
-)
)

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: rtl8723bs/os_dep: Remove typecast in kfree
Meghana Madhyastha [Sat, 16 Sep 2017 08:12:16 +0000 (13:42 +0530)]
Staging: rtl8723bs/os_dep: Remove typecast in kfree

Remove typecast of pointer in kfree((u8 *)pdvobj) as
it is not needed.

Found using the following Coccinelle semantic patch:
@@
identifier x;
type t;
@@

-kfree((t *)x)
+kfree(x)

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Merge assignment with return
Harsha Sharma [Thu, 14 Sep 2017 12:04:05 +0000 (17:34 +0530)]
staging: rtl8723bs: Merge assignment with return

Merge assignment with return statement to directly return the value.
Done using following coccinelle semantic patch

@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: irda: Use !x instead of NULL comparison
Srishti Sharma [Sat, 16 Sep 2017 06:34:27 +0000 (12:04 +0530)]
Staging: irda: Use !x instead of NULL comparison

Test for NULL as !x where functions that return NULL on failure
are used. Done using the following semantic patch by coccinelle.

@ is_null @
expression E;
statement S;
@@

E = (\(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\|
usb_alloc_urb\|alloc_netdev\|dev_alloc_skb\)(...));

(
if(!E)
   S
|
-if(E==NULL)
+if(!E)
    S
)

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: irda: drivers: Move the curly bracket to the same line as if
Meghana Madhyastha [Sat, 16 Sep 2017 06:08:38 +0000 (11:38 +0530)]
Staging: irda: drivers: Move the curly bracket to the same line as if

Move the left curly brace to the same line as the if statement.
This coding style is more common and also reduces the number of
lines of code.

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: irda: Remove parentheses on the right of assignment
Srishti Sharma [Fri, 15 Sep 2017 21:06:16 +0000 (02:36 +0530)]
Staging: irda: Remove parentheses on the right of assignment

Parentheses are not needed on the right hand side of assignment
statement in most cases. Done using the following semantic
patch by coccinelle.

@@
identifier E,F,G,f;
expression e,r;
@@

(
E = (G == F);
|
E = (e == r);
|
E =
-(
...
-)
;
)

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: irda: Don't use assignment inside if statement
Srishti Sharma [Fri, 15 Sep 2017 21:05:47 +0000 (02:35 +0530)]
Staging: irda: Don't use assignment inside if statement

Write assignment statement outside of the if statement. Done
using the following semantic patch by coccinelle.

@@
identifier E;
expression F;
statement S;
@@

-if((E = F))
+E = F;
+if(E)
    S

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: irda: drivers: Replace (skb == NULL) with (!skb)
Meghana Madhyastha [Fri, 15 Sep 2017 09:13:15 +0000 (14:43 +0530)]
Staging: irda: drivers: Replace (skb == NULL) with (!skb)

Some functions return NULL as an indication of failure.
The style (!skb) is more common than (skb == NULL) for these
functions.

Found by the following Coccinelle script.

@@
identifier i;
statement S;
@@

i = (\(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\|usb_alloc_urb\|
alloc_netdev\|dev_alloc_skb\)(...));

(
-if (i == NULL)
+if (!i)
S
|
-if (NULL == i)
+if (!i)
S
)

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: irda: Remove typedef struct
Haneen Mohammed [Thu, 14 Sep 2017 04:55:38 +0000 (22:55 -0600)]
staging: irda: Remove typedef struct

This patch remove typedef from a structure with all its ocurrences
since using typedefs for structures is discouraged.
Issue found using Coccinelle:

@r1@
type T;
@@

typedef struct { ... } T;

@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_t" or T[-2:] == "_T":
coccinelle.T2 = T[:-2];
else:
coccinelle.T2 = T;

print T, coccinelle.T2

@r2@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;

@r3@
type r1.T;
identifier c1.T2;
@@
-T
+struct T2

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: speakup: remove NULL comparison
Aastha Gupta [Sun, 17 Sep 2017 20:00:35 +0000 (01:30 +0530)]
staging: speakup: remove NULL comparison

This was done using cocccinelle script:
@@
identifier arg;
@@

-arg==NULL
+!arg

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: speakup: Remove print following unsuccessful kmalloc
Meghana Madhyastha [Sat, 16 Sep 2017 05:04:05 +0000 (10:34 +0530)]
Staging: speakup: Remove print following unsuccessful kmalloc

Remove print statement following unsuccessful kmalloc when there
is not enough memory. Kmalloc and variants normally produce a
backtrace in such a case. Hence, a print statement is not necessary.

Found using the following Coccinelle semantic patch:

@@
identifier i;
@@

i = (\(kmalloc\|devm_kzalloc\|kmalloc_array\|
devm_ioremap\|usb_alloc_urb\|alloc_netdev\|dev_alloc_skb\|
kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
   kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...));
(
if (i == NULL)
{
-\(DBG_8723A\|printk\|pr_err\|CERROR\|DBG_88E\)(...);
...when any
}
|
if (!i)
{
-\(DBG_8723A\|printk\|pr_err\|CERROR\|DBG_88E\)(...);
...when any
}
)

@@
identifier i;
@@
(
- if (i == NULL) {
+ if (i == NULL)
       return ...;
- }
|
- if (!i) {
+ if (!i)
       return ...;
- }
)

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: dgnc: Remove unused fields in struct channel_t
Srishti Sharma [Sat, 16 Sep 2017 16:39:29 +0000 (22:09 +0530)]
Staging: dgnc: Remove unused fields in struct channel_t

Eliminate the fields that are not used and the comments
associated with them.

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: dgnc: Remove unused fields in struct dgnc_board
Srishti Sharma [Sat, 16 Sep 2017 16:38:54 +0000 (22:08 +0530)]
Staging: dgnc: Remove unused fields in struct dgnc_board

Remove unused fields and comments associated with them in
the structure definition.

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: dgnc: remove variable rc
Aastha Gupta [Sat, 16 Sep 2017 13:59:33 +0000 (19:29 +0530)]
staging: dgnc: remove variable rc

Found using coccinelle script:
@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: dgnc: remove unused variable
Aastha Gupta [Sat, 16 Sep 2017 13:02:32 +0000 (18:32 +0530)]
staging: dgnc: remove unused variable

This patch removes unused variable.

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: lnet: Replace list_for_each with list_for_each_entry
Haneen Mohammed [Sat, 16 Sep 2017 00:41:48 +0000 (18:41 -0600)]
staging: lustre: lnet: Replace list_for_each with list_for_each_entry

Replace use of the combination of list_for_each and list_entry
with list_for_each_entry to simplify the code and remove variables
that are used only in list_for_each.
Issue found and corrected using Coccinelle script:

@r@
expression head, member, e;
type T1, T2, T3;
iterator name list_for_each, list_for_each_entry;
identifier pos, var;
@@

-T1 *pos;
...when!=pos=e;

-list_for_each(pos, head)
+list_for_each_entry(var, head, member)
{
...when!=pos=e;
   when!=T3 *var;
-var = list_entry(pos, T2, member);
...when!=pos=e;
}
...when!=pos=e;

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>