platform/kernel/linux-rpi.git
6 years agostaging: remove unneeded static set .owner field in platform_driver
zhong jiang [Wed, 12 Sep 2018 03:40:28 +0000 (11:40 +0800)]
staging: remove unneeded static set .owner field in platform_driver

platform_driver_register will set the .owner field. So it is safe
to remove the redundant assignment.

The issue is detected with the help of Coccinelle.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Acked-by: Vaibhav Agarwal <vaibhav.sr@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: fix null checks on wilc
Colin Ian King [Tue, 11 Sep 2018 17:38:51 +0000 (18:38 +0100)]
staging: wilc1000: fix null checks on wilc

Currently the pointer wilc is being null checked several times
and yet not checked for the final workqueue flush and destroy
(which can lead to a null pointer dereference if wilc is null);
these missing null checks were overlooked in an earlier core
refactoring commit.

Clean up the code by checking wilc at the start and bailing out
early if it is null allowing the subsequent null checks to be
removed, this also fixes the potential null pointer deferences
on the workqueue flush and destroy calls.

Detected by CoverityScan, CID#1473305 ("Dereference after null check")

Fixes: b3ee105c332e ("staging: wilc1000: refactor code to move initilization in wilc_netdev_init()")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoMerge tag 'iio-for-4.20a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Fri, 14 Sep 2018 08:38:48 +0000 (10:38 +0200)]
Merge tag 'iio-for-4.20a' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

1st round of IIO new device support, features and cleanups in the 4.20 cycle.

There is a merge commit in here to pull in regmap support for repeatedly
reading the same register (to read out FIFOs).  Used by the adxl372 driver.
This will find uses elsewhere once we tidy up various drivers that are
effectively doing this and relying on not enabling regcache.

New device support
* Analog devices ADXL372 accelerometer
  - new driver for this accelerometer including fifo and and interrupt support.
    Follow up patches enforce trigger validation, add sampling frequency
    control and filter bandwidth control.  A later series added i2c support
    to the existing SPI support.
* ST lsm6dsx
  - rework and add support fo the LSM6DSO 6 axis mems sensor.
* Linear LTC 1660 DAC
  - new driver supporting the LTC 1660 and LTC 1665 SPI DACs.
* Microchip mcp3911 ADC.
  - new driver for this integrated analog front end and ADC.
* Qualcomm SPMI PMIC5 adc driver
  - using the spmi framework, new driver and bindings for this ADC.
    Follow up patch adds some missing channels.

Features
* ad5758
  - support hard reset using a gpio (if provided).
* mpu6050
  - Regulator support
* qcom-spmi-adc5
  - Sanity check the channel numbers provided by DT to make sure the
    driver actually knows about them.
* sc27xx
  - give raw data for channel 20 as it's used on all known boards for
    the headset which needs a custom converstion function.  If it turns
    out someone builds a board where this isn't true we will deal with it
    when it happens.
  - add ADC scale calibration.
* tsl2772
  - support device tree binding to set the proximity led settings.
  - regulator supprot.
  - binding for apds9930 - trivial addition as register compatible with tsl2772.

Cleanups / Minor fixes

* adxl345
  - supress a static checker warning but explicitly checking if the id
    object is null.
* bh1750
  - avoid CONFIG_PM_SLEEP checks.
  - SPDX.
* bme680
  - spelling mistake
  - use clamp rather than open coding.
  - white space and other similar fixes.
  - rename MSK to MASK for clarifty and use GENMASK to specify them.
  - use the FIELD_GET macro rather than a very odd accessor of dividing by
    16 to get the shift.
  - rework to share handing for oversampling of the various channels in a
    unified way.
  - check explicitly for val2 in write_raw function to ensure it is 0.
  - drop some field defines that don't add anything.
* dpot-adc
  - SPDX
* envelope detector
  - SPDX
* isl29501
  - fix an ancient compiler warning mostly because it results in much
    nicer code.
* max30102
  - mark switch fall throughs.
* max44000
  - drop an unused variable.
* max512
  - avoid CONFIG_PM_SLEEP checks.
* max5481
  - use of_device_get_match_data rather than open coding it.
* max5821
  - avoid CONFIG_PM_SLEEP checks.
* max9611
  - explicity cast an enum to an integer to make it totally clear that
    this is intended.
* mcp4018
  - fix an inconsistent MODULE_LICENSE.
  - use of_device_get_match_data rather than open coding it.
* mcp4531
  - use of_device_get_match_data rather than open coding it.
  - SPDX
* mcp4725
  - avoid CONFIG_PM_SLEEP checks.
* mcp4922
  - Fix error handling and prevent writing a negative to when setting the
    output voltage.
* ms5611
  - drop deprecated compatible strings without manufacturer from being
    explicitly listed.  They are handled anyway.
  - SPDX
* multiplexer
  - SPDX
* qcom-vadc
  - fix inconsistent documentation for reg.
* ti-dac5571
  - provide and of_match_table.

* treewide
  - update Michael Hennerich's email address.
  - Use %pOFn rather than device_node.name.
* documentation.
  - tidy up a wrong kernel version for the introduction of the
    position_relative ABI.

6 years agostaging: erofs: surround fault_injection ralted option parsing using CONFIG_EROFS_FAU...
Chengguang Xu [Mon, 10 Sep 2018 23:51:54 +0000 (07:51 +0800)]
staging: erofs: surround fault_injection ralted option parsing using CONFIG_EROFS_FAULT_INJECTION

It's a little bit strange when fault_injection related
option fail with -EINVAL which was already disabled
from config, so surround all fault_injection related option
parsing code using CONFIG_EROFS_FAULT_INJECTION. Meanwhile,
slightly change warning message to keep consistency with
option POSIX_ACL and FS_XATTR.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: erofs: use explicit unsigned int type
Thomas Weißschuh [Mon, 10 Sep 2018 19:41:14 +0000 (21:41 +0200)]
staging: erofs: use explicit unsigned int type

Fix coding style issue "Prefer 'unsigned int' to bare use of 'unsigned'"
detected by checkpatch.pl.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: change array type to u8
Michael Straube [Mon, 10 Sep 2018 20:38:05 +0000 (22:38 +0200)]
staging: rtl8188eu: change array type to u8

The the last two parameters of write_cam() have type u8.
Change the type of the passed arrays from unsigned char to u8.
Clears a line over 80 characters checkpatch warning.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: fix lines over 80 characters in rtw_led.c
Michael Straube [Sat, 8 Sep 2018 12:13:53 +0000 (14:13 +0200)]
staging: rtl8188eu: fix lines over 80 characters in rtw_led.c

Wrap lines over 80 characters where appropriate to
clear checkpatch warnings.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: remove unnecessary parentheses in rtw_led.c
Michael Straube [Sat, 8 Sep 2018 12:13:52 +0000 (14:13 +0200)]
staging: rtl8188eu: remove unnecessary parentheses in rtw_led.c

Remove unnecessary parentheses from conditionals.
Also clears 'Alignment should match open parenthesis'
checkpatch issue.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: refactor SwLedControlMode1()
Michael Straube [Sat, 8 Sep 2018 12:13:51 +0000 (14:13 +0200)]
staging: rtl8188eu: refactor SwLedControlMode1()

Refactor switch cases in SwLedControlMode1() to reduce
indentation level. Also clears line over 80 characters
checkpatch warnings.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: remove handle_hif_exit_work() function
Ajay Singh [Tue, 4 Sep 2018 06:39:42 +0000 (12:09 +0530)]
staging: wilc1000: remove handle_hif_exit_work() function

Cleanup to remove handle_hif_exit_work(), as after code refactoring its
not required anymore.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: refactor wilc_netdev_init() to handle memory free in error path
Ajay Singh [Tue, 4 Sep 2018 06:39:41 +0000 (12:09 +0530)]
staging: wilc1000: refactor wilc_netdev_init() to handle memory free in error path

Refactor the wilc_netdev_init() to cleanup the memory for error
scenario and remove unnecessary 'dev' pointer check.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: refactor code to move initilization in wilc_netdev_init()
Ajay Singh [Tue, 4 Sep 2018 06:39:40 +0000 (12:09 +0530)]
staging: wilc1000: refactor code to move initilization in wilc_netdev_init()

Refactor code to move the initialization of wilc related parameters in
wilc_netdev_init() and move their deinitialization in
wilc_netdev_cleanup(). For 'hif_workqueue' creation 'clients_count' check
is not required as the single instance is maintained.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: remove unnecessary static variable 'p2p_listen_state'
Ajay Singh [Tue, 4 Sep 2018 06:39:39 +0000 (12:09 +0530)]
staging: wilc1000: remove unnecessary static variable 'p2p_listen_state'

Remove the use of unnecessary static variable 'p2p_listen_state'.
Already 'p2p_listen_state' is present in 'wilc_priv' struct. So making
use of that variable as its getting set in channel ready and
remain on channel expired callback.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: move 'wilc_connecting' static variable to 'wilc_vif' struct
Ajay Singh [Tue, 4 Sep 2018 06:39:38 +0000 (12:09 +0530)]
staging: wilc1000: move 'wilc_connecting' static variable to 'wilc_vif' struct

Move static variable 'wilc_connecting' as part of 'wilc_vif' private
struct. Remove "wilc_" prefix from name as its already part of wilc_vif
struct.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: move 'chip_ps_state' static variable as part of 'wilc' struct
Ajay Singh [Tue, 4 Sep 2018 06:39:37 +0000 (12:09 +0530)]
staging: wilc1000: move 'chip_ps_state' static variable as part of 'wilc' struct

Move the static variable as part of 'wilc' priv struct.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: remove unused code to set and get IP address
Ajay Singh [Tue, 4 Sep 2018 06:39:36 +0000 (12:09 +0530)]
staging: wilc1000: remove unused code to set and get IP address

Cleanup code to remove the variables related to setting and getting IP
address as this case was not handled from firmware side.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: use short names to fix over 80 issue in tcp_process()
Ajay Singh [Tue, 4 Sep 2018 06:39:35 +0000 (12:09 +0530)]
staging: wilc1000: use short names to fix over 80 issue in tcp_process()

Use short variable names to avoid line over 80 chars checkpatch warning
in tcp_process().

struct pending_acks_info     --> struct pending_ack
int tcp_pending_ack_idx      --> int ack_idx
u32 pending_ack              --> u32 pending_ack_idx

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: avoid line over 80 chars in wilc_wlan_txq_filter_dup_tcp_ack()
Ajay Singh [Tue, 4 Sep 2018 06:39:34 +0000 (12:09 +0530)]
staging: wilc1000: avoid line over 80 chars in wilc_wlan_txq_filter_dup_tcp_ack()

Cleanup patch to avoid line over 80 chars checkpatch issue introduced in
previous code refactor commit.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: move tcp_ack_filter algo related variables to 'wilc_vif' struct
Ajay Singh [Tue, 4 Sep 2018 06:39:33 +0000 (12:09 +0530)]
staging: wilc1000: move tcp_ack_filter algo related variables to 'wilc_vif' struct

Avoid use of static variables and move them as part of wilc_vif struct.
Move all the parameters related to tcp_ack_filter algo to wilc_vif
struct.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: use lowercase for get_BSSID() and HIL variable
Ajay Singh [Tue, 4 Sep 2018 06:39:32 +0000 (12:09 +0530)]
staging: wilc1000: use lowercase for get_BSSID() and HIL variable

Cleanup patch to use lowercase name for get_BSSID() and HIL variable.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: refactor tcp_process() to avoid extra leading tabs
Ajay Singh [Tue, 4 Sep 2018 06:39:31 +0000 (12:09 +0530)]
staging: wilc1000: refactor tcp_process() to avoid extra leading tabs

Refactor tcp_process() to avoid unnecessary leading tabs in the
function.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: move 'rcv_assoc_resp' as part of hif_drv
Ajay Singh [Tue, 4 Sep 2018 06:39:30 +0000 (12:09 +0530)]
staging: wilc1000: move 'rcv_assoc_resp' as part of hif_drv

Avoid use of static variable and move 'rcv_assoc_resp' as part of
'hif_drv' struct. Rename from 'rcv_assoc_resp' to 'assoc_resp'.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: rename 'dummy_statistics' variable to 'periodic_stat'
Ajay Singh [Tue, 4 Sep 2018 06:39:29 +0000 (12:09 +0530)]
staging: wilc1000: rename 'dummy_statistics' variable to 'periodic_stat'

Cleanup patch to use appropriate variable name to fetch the periodic
statistics.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: move 'periodic_rssi' as part of 'wilc_vif' struct
Ajay Singh [Tue, 4 Sep 2018 06:39:28 +0000 (12:09 +0530)]
staging: wilc1000: move 'periodic_rssi' as part of 'wilc_vif' struct

Refactor code to move 'periodic_rssi' as part of wilc_vif struct. Move
'dummy_statistics' from 'wilc' struct to 'wilc_vif' to maintain for
each interface separately.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: move hif_workqueue static variables to 'wilc' structure
Ajay Singh [Tue, 4 Sep 2018 06:39:27 +0000 (12:09 +0530)]
staging: wilc1000: move hif_workqueue static variables to 'wilc' structure

Avoid use of static variable hif_workqueue and move it inside 'wilc'
structure.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: refactor code to avoid use of wilc_set_multicast_list global
Ajay Singh [Tue, 4 Sep 2018 06:39:26 +0000 (12:09 +0530)]
staging: wilc1000: refactor code to avoid use of wilc_set_multicast_list global

Refactor the code to avoid use of 'wilc_set_multicast_list' global
variable. Allocate the memory required to keep the multicast mac address
and pass it to the worker thread.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: move static variable clients_count to 'wilc' structure
Ajay Singh [Tue, 4 Sep 2018 06:39:25 +0000 (12:09 +0530)]
staging: wilc1000: move static variable clients_count to 'wilc' structure

Avoid use of static variable 'clients_count' and move it part of 'wilc'
structure.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: avoid use of extra 'if' condition in wilc_init()
Ajay Singh [Tue, 4 Sep 2018 06:39:24 +0000 (12:09 +0530)]
staging: wilc1000: avoid use of extra 'if' condition in wilc_init()

Cleanup patch to avoid the avoid extra 'if' condition and clubbed the
same condition in single 'if' block.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: remove unused variable 'op_ifcs'
Ajay Singh [Tue, 4 Sep 2018 06:39:23 +0000 (12:09 +0530)]
staging: wilc1000: remove unused variable 'op_ifcs'

After code refactor in previous commit now 'op_ifcs' is not require any
more, so remove it.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: move during_ip_timer & wilc_optaining_ip to 'wilc_vif' struct
Ajay Singh [Tue, 4 Sep 2018 06:39:22 +0000 (12:09 +0530)]
staging: wilc1000: move during_ip_timer & wilc_optaining_ip to 'wilc_vif' struct

Move global variable 'wilc_during_ip_timer' and 'wilc_optaining_ip' to
'wilc_vif' structure.

Rename these variables like below

wilc_during_ip_timer -> during_ip_timer
wilc_optaining_ip -> obtaining_ip.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: moved last_scanned_shadow & last_scanned_cnt to wilc_priv struct
Ajay Singh [Tue, 4 Sep 2018 06:39:21 +0000 (12:09 +0530)]
staging: wilc1000: moved last_scanned_shadow & last_scanned_cnt to wilc_priv struct

Avoid use of static variables and moved the varibles as part of private
data. last_scanned_shadow & last_scanned_cnt variable is moved to
'wilc_priv' to maintain for each interface. After moving static
variable, clear_shadow_scan() doesn't require check 'op_ifcs'
count as now for each interface the againg timer is initiated.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: remove unnecessary NULL check in clear_shadow_scan()
Ajay Singh [Tue, 4 Sep 2018 06:39:20 +0000 (12:09 +0530)]
staging: wilc1000: remove unnecessary NULL check in clear_shadow_scan()

Cleanup patch to remove the unnecessary NULL check before freeing up ies
information in clear_shadow_scan().

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: fix to use correct index to free scanned info in clear_shadow_scan()
Ajay Singh [Tue, 4 Sep 2018 06:39:19 +0000 (12:09 +0530)]
staging: wilc1000: fix to use correct index to free scanned info in clear_shadow_scan()

Fixes to use correct index to free the allocated memory for ies
information. The check was done using 'last_scanned_cnt' index and its
not correct, so use the correct index ('i') to check for before freeing
the allocated memory.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: move 'aging_timer' static variable to wilc_priv struct
Ajay Singh [Tue, 4 Sep 2018 06:39:18 +0000 (12:09 +0530)]
staging: wilc1000: move 'aging_timer' static variable to wilc_priv struct

Moved 'aging_timer' to wilc_priv struct instead of having it as static
variable.
As 'aging_timer' is maintained for each interfaces so 'op_ifcs' check is
not required before the timer_setup() and del_timer_sync() call.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wilc1000: move 'wilc_enable_ps' global variable into 'wilc' struct
Ajay Singh [Tue, 4 Sep 2018 06:39:17 +0000 (12:09 +0530)]
staging: wilc1000: move 'wilc_enable_ps' global variable into 'wilc' struct

Instead of having 'wilc_enable_ps' as global variable moved it to 'wilc'
structure. Rename 'wilc_enable_ps' to 'enable_ps' as its already part of
'wilc' structure

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8723bs: check for i out of range before accessing szLine[i]
Colin Ian King [Thu, 6 Sep 2018 12:32:07 +0000 (13:32 +0100)]
staging: rtl8723bs: check for i out of range before accessing szLine[i]

Currently szLine[i] is being accessed before the index i is being
ranged checked.  Fix this by checking the range first.  Also, evaluate
the length of the string szLine just once rather than multiple times and
move the loop variable i to an inner scope and make it an int.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoStaging: rtl8712: Add space between else and opening brace
André Lehmann [Wed, 5 Sep 2018 21:17:27 +0000 (23:17 +0200)]
Staging: rtl8712: Add space between else and opening brace

issue found by checkpatch

Signed-off-by: André Lehmann <lenneman@web.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8192u: ieee80221: Add missing space
Sidong Yang [Tue, 4 Sep 2018 16:21:03 +0000 (16:21 +0000)]
staging: rtl8192u: ieee80221: Add missing space

Fix checkpatch.pl errors that missing space before ','.

Signed-off-by: Sidong Yang <realwakka@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Remove typedef from enum opt_rst_type_e - Style
John Whitmore [Sat, 8 Sep 2018 09:44:09 +0000 (10:44 +0100)]
staging:rtl8192u: Remove typedef from enum opt_rst_type_e - Style

Remove the typedef directive from enumerated type opt_rst_type_e,
this change clears the checkpatch issue with defining new types in
the code.

This is a coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Remove typedef from firmware_init_step_e - Style
John Whitmore [Sat, 8 Sep 2018 09:44:08 +0000 (10:44 +0100)]
staging:rtl8192u: Remove typedef from firmware_init_step_e - Style

Remove the typedef directive from enumerated type firmware_init_step_e
this clears the checkpatch issue with adding new types to the code.

This is a coding style change which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Refactor GET_COMMAND_PACKET_FRAG_THRESHOLD - Style
John Whitmore [Sat, 8 Sep 2018 09:44:07 +0000 (10:44 +0100)]
staging:rtl8192u: Refactor GET_COMMAND_PACKET_FRAG_THRESHOLD - Style

The MACRO GET_COMMAND_PACKET_FRAG_THRESHOLD causes a number of
checkpatch issues so has been refactored to use braces around the
parameter 'v' to avoid precedence issues, and to add spaces around
operators.

These changes are coding style changes which should have no impact
on runtime code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Remove unused RTL8190_CPU_START_OFFSET - Style
John Whitmore [Sat, 8 Sep 2018 09:44:06 +0000 (10:44 +0100)]
staging:rtl8192u: Remove unused RTL8190_CPU_START_OFFSET - Style

The defined constant RTL8190_CPU_START_OFFSET is not used in the code
so has been removed. This is a coding style change which should have
no impact on runtime code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Fix space characters - Style
John Whitmore [Fri, 31 Aug 2018 23:02:38 +0000 (00:02 +0100)]
staging:rtl8192u: Fix space characters - Style

Fix the spacing issues, remove space after cast operation, and replace
spaces at start of line with tab.

These changes are purely coding style changes to resolve checkpatch
issues. There should be no impact on runtime code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Refactor RT_TRACE - Style
John Whitmore [Fri, 31 Aug 2018 23:02:37 +0000 (00:02 +0100)]
staging:rtl8192u: Refactor RT_TRACE - Style

Refactor the MACRO RT_TRACE to add parentheses around the parameter
'component', this clears the checkpatch warning with respect to
precedence issues.

This is a coding style change which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Rename Rx_Smooth_Factor - Style
John Whitmore [Fri, 31 Aug 2018 23:02:36 +0000 (00:02 +0100)]
staging:rtl8192u: Rename Rx_Smooth_Factor - Style

Rename the MACRO Rx_Smooth_Factor to RX_SMOOTH_FACTOR, this clears the
checkpatch issue with CamelCase naming.

This is a coding style change which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Rename RTL819xU_MODULE_NAME - Style
John Whitmore [Fri, 31 Aug 2018 23:02:35 +0000 (00:02 +0100)]
staging:rtl8192u: Rename RTL819xU_MODULE_NAME - Style

Rename the MACRO RTL819xU_MODULE_NAME to RTL819XU_MODULE_NAME, this
clears the checkpatch issue with CamelCase naming.

This is a coding style change which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Add SPDX-License-Identifier - Style
John Whitmore [Fri, 31 Aug 2018 23:02:34 +0000 (00:02 +0100)]
staging:rtl8192u: Add SPDX-License-Identifier - Style

Add SPDX-License-Identifier tag to the start of header file. This is
a coding style change which should have no impact on runtime code
execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Remove unused functions - Style
John Whitmore [Fri, 31 Aug 2018 23:02:33 +0000 (00:02 +0100)]
staging:rtl8192u: Remove unused functions - Style

Remove unused function declarations. This is a coding style change
which should have no impact on runtime code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Remove read_cam() - Style
John Whitmore [Fri, 31 Aug 2018 23:02:32 +0000 (00:02 +0100)]
staging:rtl8192u: Remove read_cam() - Style

Remove the function read_cam(), as it is unused in code.

Simple style change which should not impact runtime code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Remove write_cam() - Style
John Whitmore [Fri, 31 Aug 2018 23:02:31 +0000 (00:02 +0100)]
staging:rtl8192u: Remove write_cam() - Style

Remove the function write_cam() as it is unused.

Simple style change which should not impact runtime code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoStaging: rtlwifi: efuse: Fixed a line length code styling issue.
Tom Todd [Sat, 1 Sep 2018 12:28:06 +0000 (13:28 +0100)]
Staging: rtlwifi: efuse: Fixed a line length code styling issue.

Fixed a code styling issue.

Signed-off-by: Tom Todd <thomas.m.a.todd@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: mt7621-mmc: Fix debug macro ERR_MSG and its usages
Nishad Kamdar [Fri, 31 Aug 2018 22:19:43 +0000 (03:49 +0530)]
staging: mt7621-mmc: Fix debug macro ERR_MSG and its usages

Replace all usages of ERR_MSG with with dev_<level> without __func__
or __LINE__ or current->comm and current->pid. Remove the do {}
while(0) loop for the single statement macro. Delete commented
ERR_MSG() usage. Drop ERR_MSG from dbg.h. Issue found by checkpatch.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: mt7621-mmc: Delete N_MSG() and all its users
Nishad Kamdar [Fri, 31 Aug 2018 22:17:15 +0000 (03:47 +0530)]
staging: mt7621-mmc: Delete N_MSG() and all its users

This patch removes N_MSG() and all its users since it is a no-op.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging/vboxvideo: Replace ttm_bo_unref with ttm_bo_put
Thomas Zimmermann [Mon, 10 Sep 2018 09:36:44 +0000 (11:36 +0200)]
staging/vboxvideo: Replace ttm_bo_unref with ttm_bo_put

The function ttm_bo_put releases a reference to a TTM buffer object. The
function's name is more aligned to the Linux kernel convention of naming
ref-counting function _get and _put.

A call to ttm_bo_unref takes the address of the TTM BO object's pointer and
clears the pointer's value to NULL. This is not necessary in most cases and
sometimes even worked around by the calling code. A call to ttm_bo_put only
releases the reference without clearing the pointer.

The current behaviour of cleaning the pointer is kept in the calling code,
but should be removed if not required in a later patch.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wlan-ng: remove redundant code in "#if 0" blocks
Tim Collier [Tue, 28 Aug 2018 19:26:12 +0000 (20:26 +0100)]
staging: wlan-ng: remove redundant code in "#if 0" blocks

Remove two blocks of code that checkpatch identified as redundant
because they were enclosed in "#if...#endif". In the case of
prism2fw.c the associated "TODO" comment was retained.

Signed-off-by: Tim Collier <osdevtc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: remove unnecessary parentheses
Michael Straube [Mon, 3 Sep 2018 18:24:45 +0000 (20:24 +0200)]
staging: rtl8188eu: remove unnecessary parentheses

Remove unnecessary parentheses to follow kernel coding style
and clean checkpatch issues.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: remove whitespace
Michael Straube [Mon, 3 Sep 2018 18:24:44 +0000 (20:24 +0200)]
staging: rtl8188eu: remove whitespace

Replace tabs with spaces where appropriate.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: fix comparsions to true
Michael Straube [Mon, 3 Sep 2018 18:24:43 +0000 (20:24 +0200)]
staging: rtl8188eu: fix comparsions to true

Use if(x) instead of if(x == true).

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: Remove code valid only for 5 GHz
Michael Straube [Mon, 3 Sep 2018 18:24:42 +0000 (20:24 +0200)]
staging: rtl8188eu: Remove code valid only for 5 GHz

Remove code that is only valid for channels > 14.
This addresses the below TODO item.

- find and remove remaining code valid only for 5 GHz. Most of the obvious
  ones have been removed, but things like channel > 14 still exist.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: remove pointless comment
Michael Straube [Mon, 3 Sep 2018 20:09:52 +0000 (22:09 +0200)]
staging: rtl8188eu: remove pointless comment

This comment adds no useful information to the code,
so remove it.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: simplify function comment
Michael Straube [Mon, 3 Sep 2018 19:59:18 +0000 (21:59 +0200)]
staging: rtl8188eu: simplify function comment

Simplify function comment to a single line.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: Fix two sleep-in-atomic-context bugs in rtw_chk_hi_queue_cmd()
Jia-Ju Bai [Sat, 1 Sep 2018 08:58:29 +0000 (16:58 +0800)]
staging: rtl8188eu: Fix two sleep-in-atomic-context bugs in rtw_chk_hi_queue_cmd()

usb_write_port_complete() in usb_ops_linux.c is a completion handler
function for the USB driver. So it should not sleep, but it is can sleep
according to the function call paths (from bottom to top) in Linux-4.16:

[FUNC] kzalloc(GFP_KERNEL)
drivers/staging/rtl8188eu/core/rtw_cmd.c, 1081:
kzalloc in rtw_chk_hi_queue_cmd
drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c, 604:
rtw_chk_hi_queue_cmd in usb_write_port_complete

[FUNC] kzalloc(GFP_KERNEL)
drivers/staging/rtl8188eu/core/rtw_cmd.c, 1075:
kzalloc in rtw_chk_hi_queue_cmd
drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c, 604:
rtw_chk_hi_queue_cmd in usb_write_port_complete

To fix these bugs, GFP_KERNEL is replaced with GFP_ATOMIC.

These bugs are found by my static analysis tool DSAC.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: most: video: fix registration of an empty comp core_component
Colin Ian King [Wed, 5 Sep 2018 09:46:05 +0000 (10:46 +0100)]
staging: most: video: fix registration of an empty comp core_component

Currently we have structrues comp (which is empty) and comp_info being
used to register and deregister the component.  This mismatch in naming
occurred from a previous commit that renamed aim_info to comp. Fix this
to use consistent component naming in line with most/net, most/sound etc.

This fixes the message two issues, one with a null empty name when
loading the module:

[ 1485.269515] most_core: registered new core component (null)

and an Oops when removing the module:

[ 1485.277971] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
[ 1485.278648] PGD 0 P4D 0
[ 1485.279253] Oops: 0002 [#2] SMP PTI
[ 1485.279847] CPU: 1 PID: 32629 Comm: modprobe Tainted: P      D WC OE     4.18.0-8-generic #9
[ 1485.280442] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
[ 1485.281040] RIP: 0010:most_deregister_component+0x3c/0x70 [most_core]
.. etc

Fixes: 1b10a0316e2d ("staging: most: video: remove aim designators")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: most: net: make array 'broadcast' static, shrinks object size
Colin Ian King [Tue, 4 Sep 2018 15:47:07 +0000 (16:47 +0100)]
staging: most: net: make array 'broadcast' static, shrinks object size

Don't populate the array 'broadcast' on the stack but instead make it
static. Makes the object code smaller by 53 bytes:

Before:
   text    data     bss     dec     hex filename
  10511    1521     448   12480    30c0 drivers/staging/most/net/net.o

After:
   text    data     bss     dec     hex filename
  10394    1585     448   12427    308b drivers/staging/most/net/net.o

(gcc version 8.2.0 x86_64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Simplify card object management
Takashi Iwai [Tue, 4 Sep 2018 15:58:58 +0000 (17:58 +0200)]
staging: bcm2835-audio: Simplify card object management

Instead of creating a dummy child device to manage the card object,
just use devm stuff directly for releasing with snd_card_free().
This results in a lot of code reduction.

Since the dummy child devices are gone, the device object to be passed
to the memory allocator needs to be adjusted as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Simplify kctl creation helpers
Takashi Iwai [Tue, 4 Sep 2018 15:58:57 +0000 (17:58 +0200)]
staging: bcm2835-audio: Simplify kctl creation helpers

Just a minor code refactoring and adding some const prefix.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Simplify PCM creation helpers
Takashi Iwai [Tue, 4 Sep 2018 15:58:56 +0000 (17:58 +0200)]
staging: bcm2835-audio: Simplify PCM creation helpers

All three functions to create PCM objects are fairly resemble, and can
be unified to a single common helper.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Set SNDRV_PCM_INFO_SYNC_APPLPTR
Takashi Iwai [Tue, 4 Sep 2018 15:58:55 +0000 (17:58 +0200)]
staging: bcm2835-audio: Set SNDRV_PCM_INFO_SYNC_APPLPTR

The recent ALSA PCM core supports the SNDRV_PCM_INFO_SYNC_APPLPTR flag
indicating that the driver needs the ack call at each appl_ptr
update.  This is requirement for the indirect PCM implementations like
bcm2835-audio driver, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Use coherent device buffers
Takashi Iwai [Tue, 4 Sep 2018 15:58:54 +0000 (17:58 +0200)]
staging: bcm2835-audio: Use coherent device buffers

The memory access to the pages allocated with
SNDRV_DMA_TYPE_CONTINUOUS are basically non-coherent, and it becomes a
problem when a process accesses via mmap.

For the more consistent access, use the device coherent memory, just
by replacing the call pattern in the allocator helpers.

The only point we need to be careful for is the device object passed
there; since bcm2835-audio driver creates fake devices and each card
is created on top of that, we need to pass its parent device as the
real device object.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Move module parameter description
Takashi Iwai [Tue, 4 Sep 2018 15:58:53 +0000 (17:58 +0200)]
staging: bcm2835-audio: Move module parameter description

For more consistency, move the module parameter description right
after its variable definition.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Remove unnecessary header file includes
Takashi Iwai [Tue, 4 Sep 2018 15:58:52 +0000 (17:58 +0200)]
staging: bcm2835-audio: Remove unnecessary header file includes

Yet a few header files are included unnecessarily.  Drop them.

Also remove trivial comments.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Use standard error print helpers
Takashi Iwai [Tue, 4 Sep 2018 15:58:51 +0000 (17:58 +0200)]
staging: bcm2835-audio: Use standard error print helpers

For making the whole code more consistent, replace the home-made debug
print macros with the standard dev_err() & co.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Use card->private_data
Takashi Iwai [Tue, 4 Sep 2018 15:58:50 +0000 (17:58 +0200)]
staging: bcm2835-audio: Use card->private_data

Instead of allocating a separate snd_device object, let snd_card_new()
allocate the private resource.  This simplifies the code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Operate non-atomic PCM ops
Takashi Iwai [Tue, 4 Sep 2018 15:58:49 +0000 (17:58 +0200)]
staging: bcm2835-audio: Operate non-atomic PCM ops

This is the most significant part in the patch series.

The bcm2835-audio driver used to queue the commands to vc04 core via
workqueue, but basically the whole accesses to vc04 core are done in
the sleepable context, including the callback calls.  In such a case,
rewriting the code using non-atomic PCM ops will simplify the logic a
lot.

This patch does it: all workqueue are gone and each former-work
implementation is now directly called from PCM ops like trigger and
write transfer.

Along with it, the DMA position updater, bcm2835_playback_fifo(), was
also rewritten to use a simpler logic.  Now it handles the XRUN and
draining properly by calling snd_pcm_stop() conditionally.

The current position is kept in atomic_t value so that it can be read
concurrently from the pointer callback.

Also, the bcm2835_audio_instance object is allocated at the beginning
of bcm2835_audio_open().  This makes the resource management clearer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Code refactoring of vchiq accessor codes
Takashi Iwai [Tue, 4 Sep 2018 15:58:48 +0000 (17:58 +0200)]
staging: bcm2835-audio: Code refactoring of vchiq accessor codes

This is a cleanup and code refactoring in bcm2835-vchiq.c.

The major code changes are to provide local helpers for easier use of
lock / unlock, and message passing with/without response wait.  This
allows us to reduce lots of open codes.

Also, the max packet is set at opening the stream, not at each time
when the write gets called.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Make single vchi handle
Takashi Iwai [Tue, 4 Sep 2018 15:58:47 +0000 (17:58 +0200)]
staging: bcm2835-audio: Make single vchi handle

The bcm2835_audio_instance object contains the array of
VCHI_SERVICE_HANDLE_T, while the code assumes and uses only the first
element explicitly.  Let's reduce to a single vchi handle for
simplifying the code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Add 10ms period constraint
Takashi Iwai [Tue, 4 Sep 2018 15:58:46 +0000 (17:58 +0200)]
staging: bcm2835-audio: Add 10ms period constraint

It seems that the resolution of vc04 callback is in 10 msec; i.e. the
minimal period size is also 10 msec.

This patch adds the corresponding hw constraint.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Drop superfluous mutex lock during prepare
Takashi Iwai [Tue, 4 Sep 2018 15:58:45 +0000 (17:58 +0200)]
staging: bcm2835-audio: Drop superfluous mutex lock during prepare

The chip->audio_mutex is used basically for protecting the opened
stream assignment, and the prepare callback is irrelevant with it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Drop debug messages in bcm2835-pcm.c
Takashi Iwai [Tue, 4 Sep 2018 15:58:44 +0000 (17:58 +0200)]
staging: bcm2835-audio: Drop debug messages in bcm2835-pcm.c

These debug messages worsen the code readability a lot while they give
little debuggability (which we already have via tracing, in anyway).

Let's clean them up.  This allows us to reduce the
snd_bcm2835_pcm_lib_ioctl() function to be a direct call of the
snd_pcm_lib_ioctl callback (like most other drivers do), too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Propagate parameter setup error
Takashi Iwai [Tue, 4 Sep 2018 15:58:43 +0000 (17:58 +0200)]
staging: bcm2835-audio: Propagate parameter setup error

When the parameter setup fails, the driver should propagate the error
code instead of silently ignoring it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Drop useless NULL check
Takashi Iwai [Tue, 4 Sep 2018 15:58:42 +0000 (17:58 +0200)]
staging: bcm2835-audio: Drop useless NULL check

alsa_stream->chip can be never NULL.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Drop unnecessary pcm indirect setup
Takashi Iwai [Tue, 4 Sep 2018 15:58:41 +0000 (17:58 +0200)]
staging: bcm2835-audio: Drop unnecessary pcm indirect setup

The hw_queue_size of PCM indirect helper doesn't need to be set up if
you use the whole given buffer size.  Drop the useless
initialization, which just confuses readers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Use PCM runtime values instead
Takashi Iwai [Tue, 4 Sep 2018 15:58:40 +0000 (17:58 +0200)]
staging: bcm2835-audio: Use PCM runtime values instead

Some fields in alsa_stream are the values we keep already in PCM
runtime object, hence they are redundant.  Use the standard PCM
runtime values instead of the private copies.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Kill unused spinlock
Takashi Iwai [Tue, 4 Sep 2018 15:58:39 +0000 (17:58 +0200)]
staging: bcm2835-audio: Kill unused spinlock

The alsa_stream->lock is never used.  Kill it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Fix incorrect draining handling
Takashi Iwai [Tue, 4 Sep 2018 15:58:38 +0000 (17:58 +0200)]
staging: bcm2835-audio: Fix incorrect draining handling

The handling of SNDRV_PCM_TRIGGER_STOP at the trigger callback is
incorrect: when the STOP is issued, the driver is supposed to drop the
stream immediately.  Meanwhile bcm2835 driver checks the DRAINING
state and tries to issue some different command.

This patch straightens things a bit, dropping the incorrect state
checks.  The draining behavior would be still not perfect at this
point, but will be improved in a later patch.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Drop useless running flag and check
Takashi Iwai [Tue, 4 Sep 2018 15:58:37 +0000 (17:58 +0200)]
staging: bcm2835-audio: Drop useless running flag and check

The running flag of alsa_stream is basically useless.  The running
state is strictly controlled in ALSA PCM core side, hence the check in
PCM trigger and close callbacks are superfluous.

Also, the prefill ack at trigger start became superfluous nowadays
with the ALSA PCM core update.

Let's rip them off.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Remove superfluous open flag
Takashi Iwai [Tue, 4 Sep 2018 15:58:36 +0000 (17:58 +0200)]
staging: bcm2835-audio: Remove superfluous open flag

All the alsa_stream->open flag checks in the current code are
redundant, and they cannot be racy.  For the code simplification,
let's remove the flag and its check.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Remove redundant function calls
Takashi Iwai [Tue, 4 Sep 2018 15:58:35 +0000 (17:58 +0200)]
staging: bcm2835-audio: Remove redundant function calls

bcm2835_audio_setup(), bcm2835_audio_flush_buffers() and
bcm2835_audio_flush_playback_buffers() functions do implement
nothing.

Also, bcm2835_audio_set_ctls() is already called inside
bcm2835_audio_set_params(), so the later call is superfluous.

This patch removes these superfluous implementations.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Fix mute controls, volume handling cleanup
Takashi Iwai [Tue, 4 Sep 2018 15:58:34 +0000 (17:58 +0200)]
staging: bcm2835-audio: Fix mute controls, volume handling cleanup

In the current code, the mute control is dealt in a special manner,
modifying the current volume and saving the old volume, etc.  This is
inconsistent (e.g. change the volume while muted, then unmute), and
way too complex.

Also, the whole volume handling code has conversion between ALSA
volume and raw volume values, which can lead to another
inconsistency and complexity.

This patch simplifies these points:
- The ALSA volume value is saved in chip->volume
- volume->mute saves the mute state
- The mute state is evaluated only when the actual volume is passed to
  the hardware, bcm2835_audio_set_ctls()

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Remove redundant substream mask checks
Takashi Iwai [Tue, 4 Sep 2018 15:58:33 +0000 (17:58 +0200)]
staging: bcm2835-audio: Remove redundant substream mask checks

The avail_substreams bit mask is checked for the possible racy
accesses, but this cannot happen in practice; i.e. the assignment and
the check are superfluous.

Let's rip them off.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Clean up include files in bcm2835-ctl.c
Takashi Iwai [Tue, 4 Sep 2018 15:58:32 +0000 (17:58 +0200)]
staging: bcm2835-audio: Clean up include files in bcm2835-ctl.c

Only a few of them are really needed.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Remove redundant spdif stream ctls
Takashi Iwai [Tue, 4 Sep 2018 15:58:31 +0000 (17:58 +0200)]
staging: bcm2835-audio: Remove redundant spdif stream ctls

The "IEC958 Playback Stream" control does basically the very same
thing as "IEC958 Playback Default" redundantly.  The former should
have been stream-specific and restored after closing the stream, but
we don't do in that way.

Since it's nothing but confusion, remove this fake.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: bcm2835-audio: Clean up mutex locks
Takashi Iwai [Tue, 4 Sep 2018 15:58:30 +0000 (17:58 +0200)]
staging: bcm2835-audio: Clean up mutex locks

snd-bcm2835 driver takes the lock with mutex_lock_interruptible() in
all places, which don't make sense.  Replace them with the simple
mutex_lock().

Also taking a mutex lock right after creating it for each PCM object
is nonsense, too.  It cannot be racy at that point.  We can get rid of
it.

Last but not least, initializing chip->audio_mutex at each place is
error-prone.  Initialize properly at creating the chip object in
snd_bcm2835_create() instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: mt7621-pci: remove unnecessary check of device_type == pci
Rob Herring [Wed, 29 Aug 2018 18:34:03 +0000 (13:34 -0500)]
staging: mt7621-pci: remove unnecessary check of device_type == pci

PCI host drivers have already matched on compatible strings, so checking
device_type is redundant. Also, device_type is considered deprecated for
FDT though we've still been requiring it for PCI hosts as it is useful
for finding PCI buses.

Cc: devel@driverdev.osuosl.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: fsl-dpaa2/ethsw: Fix uninitialized variables
Ioana Radulescu [Thu, 30 Aug 2018 13:17:08 +0000 (16:17 +0300)]
staging: fsl-dpaa2/ethsw: Fix uninitialized variables

Functions port_vlans_add() and port_vlans_del() could,
in theory, return an uninitialized variable. Fix this
by initializing the variable in question at declaration.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Rename member pDot11dInfo - Style
John Whitmore [Tue, 28 Aug 2018 18:55:35 +0000 (19:55 +0100)]
staging:rtl8192u: Rename member pDot11dInfo - Style

Rename 'pDot11dInfo', this member variable of the structure
ieee80211_device causes a checkpatch issue, CamelCase naming. The
member has been renamed 'dot11d_info' to clear this issue.

This is a coding style change which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Refactor member variable enabled - Style
John Whitmore [Tue, 28 Aug 2018 18:55:34 +0000 (19:55 +0100)]
staging:rtl8192u: Refactor member variable enabled - Style

The structure rt_dot11d_info contains a memeber variable 'enabled',
which causes a checkpatch issue as it is declared as being of type
bool. The type of the variable has been changed to a 'u8', to clear
the issue.

Additionally to aid searching for the member variable in code it
has been renamed from 'enabled' to 'dot11d_enabled'.

These are purely coding style changes which should not impact runtime
code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Add required SPDX-License-Identifier - Style
John Whitmore [Tue, 28 Aug 2018 18:55:33 +0000 (19:55 +0100)]
staging:rtl8192u: Add required SPDX-License-Identifier - Style

Add the required SPDX-License-Identifier to the file r8180_93cx6.h,
this clears a checkpatch issue.

This is a coding style change which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8192u: Remove unused definitions - Style
John Whitmore [Tue, 28 Aug 2018 18:55:32 +0000 (19:55 +0100)]
staging:rtl8192u: Remove unused definitions - Style

Remove unused definitions from the file r8180_93cx6.h.

This is a coding style change which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: android: ion: Clean unused debug_show memeber of the heap object
Alexey Skidanov [Wed, 5 Sep 2018 05:03:15 +0000 (08:03 +0300)]
staging: android: ion: Clean unused debug_show memeber of the heap object

ION had supported heap debug info under /sys/kernel/debug/ion/<heap_name>.
This support have been removed but some leftovers (dead code) still exist.

This patch removes the existing dead code.

Fixes: 15c6098cfec5 ("staging: android: ion: Remove ion_handle and ion_client")
Signed-off-by: Alexey Skidanov <alexey.skidanov@intel.com>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>