sfrench/cifs-2.6.git
7 years agostaging: rtl8723bs: rework debug configuration handling
Arnd Bergmann [Fri, 21 Apr 2017 20:59:16 +0000 (22:59 +0200)]
staging: rtl8723bs: rework debug configuration handling

I ran into this warning during randconfig testing:

drivers/staging/rtl8723bs/os_dep/rtw_proc.c: In function 'rtw_adapter_proc_deinit':
drivers/staging/rtl8723bs/os_dep/rtw_proc.c:738:25: error: unused variable 'drv_proc' [-Werror=unused-variable]
drivers/staging/rtl8723bs/os_dep/rtw_proc.c: In function 'rtw_adapter_proc_replace':
drivers/staging/rtl8723bs/os_dep/rtw_proc.c:762:25: error: unused variable 'drv_proc' [-Werror=unused-variable]

The problem is that the code procfs code gets built even when CONFIG_PROC_FS
is disabled, but some functions are turned into empty stubs then. This
is easily addressed by adding an #ifdef around the definition of the
CONFIG_PROC_DEBUG macro.

However, I could not bear looking at the macro name that clashes with the
Kconfig name space, so I also renamed it to simply PROC_DEBUG, along with
the other rtl8723bs specific CONFIG_DEBUG_* macros that I renamed the same
way. This is consistent with how we handle the same checks in the non-staging
rtlwifi driver.

As the code path for !CONFIG_PROC_DEBUG had not been tested properly, it
turned out to be incorrect and requires adding 'static inline' annotations
for the stub handlers, and moving some variables around.

Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: fix empty-body warning
Arnd Bergmann [Wed, 19 Apr 2017 17:16:26 +0000 (19:16 +0200)]
staging: rtl8723bs: fix empty-body warning

The newly added driver causes lots of warnings like

drivers/staging/rtl8723bs/core/rtw_recv.c: In function 'validate_recv_frame':
drivers/staging/rtl8723bs/core/rtw_recv.c:1602:4: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
    DBG_COUNTER(adapter->rx_logs.core_rx_pre_data_handled);
drivers/staging/rtl8723bs/core/rtw_xmit.c: In function 'update_attrib':
drivers/staging/rtl8723bs/core/rtw_xmit.c:726:3: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
   DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_unknown);
drivers/staging/rtl8723bs/hal/HalPhyRf.c: In function 'ODM_TXPowerTrackingCallback_ThermalMeter':
drivers/staging/rtl8723bs/hal/HalPhyRf.c:146:4: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
drivers/staging/rtl8723bs/hal/HalPhyRf.c:529:6: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
drivers/staging/rtl8723bs/hal/HalPhyRf.c:559:6: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]

When DBG_COUNTER() etc is defined as a non-empty macro, we get the intended
behavior and no warning. Using no_printk() for printing helper functions
as the added advantage of compile-time checking format strings

Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: fbtft: fix open parentheses alignment
Christophe Colin [Sun, 23 Apr 2017 19:55:25 +0000 (21:55 +0200)]
staging: fbtft: fix open parentheses alignment

Modify the code indentations to fix the checkpatch issues.

Signed-off-by: Christophe Colin <popscolin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: olpc_dcon: style fixes
Dhananjay Balan [Mon, 24 Apr 2017 13:15:53 +0000 (15:15 +0200)]
staging: olpc_dcon: style fixes

 removes hardcoded function name and uses __func__ to print info.

Signed-off-by: Dhananjay Balan <mail@dbalan.in>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: wlan-ng: break long line in p80211req.c
Ian Chard [Thu, 27 Apr 2017 08:28:06 +0000 (09:28 +0100)]
staging: wlan-ng: break long line in p80211req.c

Fix a style warning for a line over 80 characters long.

Signed-off-by: Ian Chard <ian@chard.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vt6656: use off stack for in buffer USB transfers.
Malcolm Priestley [Sat, 22 Apr 2017 10:14:58 +0000 (11:14 +0100)]
staging: vt6656: use off stack for in buffer USB transfers.

Since 4.9 mandated USB buffers to be heap allocated. This causes
the driver to fail.

Create buffer for USB transfers.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: <stable@vger.kernel.org> # v4.9+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vt6656: use off stack for out buffer USB transfers.
Malcolm Priestley [Sat, 22 Apr 2017 10:14:57 +0000 (11:14 +0100)]
staging: vt6656: use off stack for out buffer USB transfers.

Since 4.9 mandated USB buffers be heap allocated this causes the driver
to fail.

Since there is a wide range of buffer sizes use kmemdup to create
allocated buffer.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: <stable@vger.kernel.org> # v4.9+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers:staging:vt6656: remove usb_device_reset in main_usb.c:
Chewie Lin [Wed, 19 Apr 2017 07:58:35 +0000 (00:58 -0700)]
drivers:staging:vt6656: remove usb_device_reset in main_usb.c:

Removed the usb_device_reset(), replace with call to usb_reset_device()
directly. Plus it removes the confusing function name and addressed
the checkpatch warning. This change also swaps string in the dev_warn() call
with __func__ argument to "vt6656_probe" instead of literal string
"usb_reset_device".

        WARNING: Prefer using "%s", __func__ to embedded function names
        #417: FILE: main_usb.c:417:
        +                        "usb_device_reset fail status=%d\n", status);

        total: 0 errors, 1 warnings, 1058 lines checked

And after fix:

         main_usb.c has no obvious style problems and is ready for submission.

Signed-off-by: Chewie Lin <linsh@oregonstate.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: wilc1000: fix unchecked return value
Pan Bian [Sun, 23 Apr 2017 11:53:58 +0000 (19:53 +0800)]
staging: wilc1000: fix unchecked return value

Function dev_alloc_skb() will return a NULL pointer if there is no
enough memory. However, in function WILC_WFI_mon_xmit(), its return
value is used without validation. This may result in a bad memory access
bug. This patch fixes the bug.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorhba: fix s-Par to boot with option CONFIG_VMAP_STACK set to y
Sameer Wadgaonkar [Tue, 18 Apr 2017 20:55:25 +0000 (16:55 -0400)]
staging: unisys: visorhba: fix s-Par to boot with option CONFIG_VMAP_STACK set to y

The root issue is that we are not allowed to have items on the
stack being passed to "DMA" like operations. In this case we have
a vmcall and an inline completion of scsi command.

This patch fixes the issue by moving the variables on stack in
do_scsi_nolinuxstat() to heap memory.

Signed-off-by: Sameer Wadgaonkar <sameer.wadgaonkar@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: fix s-Par to boot with option CONFIG_VMAP_STACK set to y
Sameer Wadgaonkar [Tue, 18 Apr 2017 20:55:24 +0000 (16:55 -0400)]
staging: unisys: visorbus: fix s-Par to boot with option CONFIG_VMAP_STACK set to y

The root issue is that we are not allowed to have items on the
stack being passed to "DMA" like operations. In this case we have
vmcall operation that was using parameters from the stack.

This patch fixes the issue by moving the variables on stack in
issue_vmcall_io_controlvm_addr() to vmcall_controlvm_addr struct.

Signed-off-by: Sameer Wadgaonkar <sameer.wadgaonkar@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: remove POSTCODE from visorchipset_init
David Kershner [Tue, 18 Apr 2017 20:55:23 +0000 (16:55 -0400)]
staging: unisys: visorbus: remove POSTCODE from visorchipset_init

Remove POSTCODEs from visorchipset_init and replace them with dev_err when
needed.

Since there are no more POSTCODEs in the code, we can get rid of the data
in the header file as well.

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 postcodes in setup_crash_devices_work_queue
David Kershner [Tue, 18 Apr 2017 20:55:22 +0000 (16:55 -0400)]
staging: unisys: visorbus: remove postcodes in setup_crash_devices_work_queue

Replace postcodes with dev_err in the function
setup_crash_device_work_queue.

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: refactor setup_crash_devices_work_queue
David Kershner [Tue, 18 Apr 2017 20:55:21 +0000 (16:55 -0400)]
staging: unisys: visorbus: refactor setup_crash_devices_work_queue

The if statement was sending us down the happy path with the error path
in the else. This can be simplified by having the if be the error and
just falling through with the good path.

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: get rid of POSTCODES in my_device_changestate
David Kershner [Tue, 18 Apr 2017 20:55:20 +0000 (16:55 -0400)]
staging: unisys: visorbus: get rid of POSTCODES in my_device_changestate

Replace POSTCODEs with dev_err in the function my_device_changestate.

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 POSTCODE from my_device_create
David Kershner [Tue, 18 Apr 2017 20:55:19 +0000 (16:55 -0400)]
staging: unisys: visorbus: remove POSTCODE from my_device_create

Replace the POSTCODEs with dev_err in my_device_create.

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 POSTCODE from bus_configure
David Kershner [Tue, 18 Apr 2017 20:55:18 +0000 (16:55 -0400)]
staging: unisys: visorbus: remove POSTCODE from bus_configure

Remove the POSTCODE logging from bus_configure, replace it with an
error message if we fail dumping the errno.

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 POSTCODEs from bus_create
David Kershner [Tue, 18 Apr 2017 20:55:17 +0000 (16:55 -0400)]
staging: unisys: visorbus: remove POSTCODEs from bus_create

Removed the POSTCODEs from the function bus_create.

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: get rid of POSTCODEs in save_crash_msg
David Kershner [Tue, 18 Apr 2017 20:55:16 +0000 (16:55 -0400)]
staging: unisys: visorbus: get rid of POSTCODEs in save_crash_msg

Replace POSTCODES in save_crash_msg with dev_err handling.

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 postcodes in visorbus_init
David Kershner [Tue, 18 Apr 2017 20:55:15 +0000 (16:55 -0400)]
staging: unisys: visorbus: remove postcodes in visorbus_init

Remove the POSTCODES in visorbus_init. Since there are no more POSTCODES
in visorbus_main.c we can remove the reference to the vmcallinterface
header file.

No need for vmcallinterface 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: remove noisy postcode from visorchipset_exit
David Kershner [Tue, 18 Apr 2017 20:55:14 +0000 (16:55 -0400)]
staging: unisys: visorbus: remove noisy postcode from visorchipset_exit

The postcodes in visorchipset_exit were not displaying errors, they can
just be removed.

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 noisy postcode in bus_destroy
David Kershner [Tue, 18 Apr 2017 20:55:13 +0000 (16:55 -0400)]
staging: unisys: visorbus: remove noisy postcode in bus_destroy

Since kzalloc will display error the postcode becomes redundant, it
can be removed.

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 noisy postcodes
David Kershner [Tue, 18 Apr 2017 20:55:12 +0000 (16:55 -0400)]
staging: unisys: visorbus: remove noisy postcodes

Get rid of postcodes from visorbus_main.c that are just informational.

They were not logging errors, we don't need to replace them with
anything.

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 POSTCODE in create_bus_instance
David Kershner [Tue, 18 Apr 2017 20:55:11 +0000 (16:55 -0400)]
staging: unisys: visorbus: remove POSTCODE in create_bus_instance

Remove postcodes from create_bus_instance. If there is an error log
it with dev_err.

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 POSTCODE from chispet_init
David Kershner [Tue, 18 Apr 2017 20:55:10 +0000 (16:55 -0400)]
staging: unisys: visorbus: remove POSTCODE from chispet_init

Get rid of the postcodes from the function chipset_init. They were
being noisy, so don't replace them with errors.

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 POSTCODE from create_visor_device
David Kershner [Tue, 18 Apr 2017 20:55:09 +0000 (16:55 -0400)]
staging: unisys: visorbus: remove POSTCODE from create_visor_device

Remove POSTCODES from create_visor_device, when we fail log an error
with dev_err.

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 NORETRY
David Kershner [Tue, 18 Apr 2017 20:55:08 +0000 (16:55 -0400)]
staging: unisys: visorbus: remove NORETRY

Allow retry when allocating memory.

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: handle visorchannel_write errors in code
David Kershner [Tue, 18 Apr 2017 20:55:07 +0000 (16:55 -0400)]
staging: unisys: visorbus: handle visorchannel_write errors in code

Catch and report back errors when visorchannel_write fails.

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: add timeout to controlvm_periodic_work
David Kershner [Tue, 18 Apr 2017 20:55:06 +0000 (16:55 -0400)]
staging: unisys: visorbus: add timeout to controlvm_periodic_work

Limit the amount that gets pulled from the queue on each try so we don't
get stuck in an infinite loop if something has gone wrong with the s-Par
firmware.

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: update comment
David Kershner [Tue, 18 Apr 2017 20:55:05 +0000 (16:55 -0400)]
staging: unisys: visorbus: update comment

Comment was outdated and did not reflect what was actually happening.
Update the comment to reflect reality.

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: fixed indentation
David Kershner [Tue, 18 Apr 2017 20:55:04 +0000 (16:55 -0400)]
staging: unisys: visorbus: fixed indentation

Moved the brace to the left to fix the indentation issue.

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: replace uint32 with int
David Kershner [Tue, 18 Apr 2017 20:55:03 +0000 (16:55 -0400)]
staging; unisys: visorbus: replace uint32 with int

Shouldn't use uint32 in the kernel, it can be replaced with int here.

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: visornic: remove keyword inline from function
David Kershner [Tue, 18 Apr 2017 20:55:02 +0000 (16:55 -0400)]
staging: unisys: visornic: remove keyword inline from function

Functions in c files don't need to be inlined, get rid of the keyword.

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: combine response functions into a single one
David Kershner [Tue, 18 Apr 2017 20:55:01 +0000 (16:55 -0400)]
staging: unisys: visorbus: combine response functions into a single one

There are several different controlvm response functions, consolidate them
to one so we can simplify error handling.

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: ks7010: fix enumeration tags
Tobin C. Harding [Thu, 27 Apr 2017 01:25:27 +0000 (11:25 +1000)]
staging: ks7010: fix enumeration tags

Driver header declares enumeration types without tags. Using
informative tags makes the code easier to understand and
eliminates the need to comment the enum.

Add tags to enumeration types.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: add enum multicast_filter_type
Tobin C. Harding [Thu, 27 Apr 2017 01:25:26 +0000 (11:25 +1000)]
staging: ks7010: add enum multicast_filter_type

Driver uses preprocessor directives to define multicast filter
constants. These can be defined using an enumeration type. Doing so
adds to the readability and gives the assists the compiler.

Add enumeration type multicast_filter_type to replace preprocessor
defined constants.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: clean up macro ps_confirm_wait_inc
Tobin C. Harding [Thu, 27 Apr 2017 01:25:25 +0000 (11:25 +1000)]
staging: ks7010: clean up macro ps_confirm_wait_inc

Macro includes commented out code. Removing dead code line enables
braces to be removed. Macro is easier to read if the code is clean.

Clean up macro ps_confirm_wait_inc.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: continue from loop on unmatched mac
Tobin C. Harding [Thu, 27 Apr 2017 01:25:24 +0000 (11:25 +1000)]
staging: ks7010: continue from loop on unmatched mac

Inside loop, code block is guarded with an 'if' statement. Instead of
guarding the block we can invert the 'if' statement conditional and
continue the loop. Doing so allows subsequent code indentation to be
reduced and aids the readability of the code.

Invert 'if' statement conditional, continue loop if new conditional
evaluates to true. Reduce subsequent code indentation level. Do not
change program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove cast from netdev_priv()
Tobin C. Harding [Thu, 27 Apr 2017 01:25:23 +0000 (11:25 +1000)]
staging: ks7010: remove cast from netdev_priv()

The returned pointer from netdev_priv() (void *) does not need to be
cast.

Remove unnecessary cast of void * returned by netdev_priv().

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: make abbreviation mgmt uniform
Tobin C. Harding [Thu, 27 Apr 2017 01:25:22 +0000 (11:25 +1000)]
staging: ks7010: make abbreviation mgmt uniform

Driver currently uses abbreviations 'mgt' and 'mngmt' for
'management'. Also 'power' is sometimes abbreviated to 'pow' and other
times not. It makes the code easier to read and easier to modify if
one abbreviation is used throughout the driver. 'mgmt' is widely
accepted as an abbreviation of 'management'. 'power' can be spelled
out in full, the extra two characters aids readability without an
excessive cost.

Make abbreviation of 'management' uniform across the driver, function
names, preprocessor defined constants, and enumeration types.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix checkpatch LINE_SPACING
Tobin C. Harding [Thu, 27 Apr 2017 01:25:21 +0000 (11:25 +1000)]
staging: ks7010: fix checkpatch LINE_SPACING

Checkpatch emits CHECK: Please don't use multiple blank lines.

Remove multiple blank lines.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: add enum sleep_mode_type
Tobin C. Harding [Thu, 27 Apr 2017 01:25:20 +0000 (11:25 +1000)]
staging: ks7010: add enum sleep_mode_type

Driver uses preprocessor directives to define SLP_ASLEEP and
SLP_ACTIVE. These can be defined using an enumeration type. Doing so
adds to the readability and gives the usual compiler benefits of
having an enum. Functions that currently accept integer types can now
use the new enumeration type, further aiding readability.

Add enumeration type sleep_mode_type. Update code that handles sleep
mode to use the new enumeration type.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: abstract connection status
Tobin C. Harding [Thu, 27 Apr 2017 01:25:19 +0000 (11:25 +1000)]
staging: ks7010: abstract connection status

Host interface connection status is handled using a 32 bit type. Top
byte is used as for FORCE_DISCONNECT status, low bits are used for
connect/disconnect status. Driver masks and checks integers to
ascertain status. If functions are defined to do the masking and
equality check then the details of how the status integer is used are
abstracted away. This makes the code easier to read. Also future
updates to the status handling will be easier because the code is in
one place.

Driver currently uses the CONNECT_STATUS and DISCONNECT_STATUS as
values, as apposed to opaque values. Because of this driver code
checks for equality with CONNECT_STATUS and DISCONNECT_STATUS as
apposed to negating a single check (ie 'foo != CONNECT_STATUS). In
order to maintain the current functionality we define two separate
functions is_connect_status() and is_disconnect_status().

Add functions to abstract the status integer check. Update all sites
that do the check manually to use the newly defined functions.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: add hostif_generic_request()
Tobin C. Harding [Thu, 27 Apr 2017 01:25:18 +0000 (11:25 +1000)]
staging: ks7010: add hostif_generic_request()

Driver contains duplicate code. Host interface has numerous request
functions which allocate memory for a request header. Each request
header is different but all contain, as the first member, a hostif_hdr
structure. This structure has size and event members which need to be
set. By defining a helper function to allocate the memory and set the
initial hostif_hdr members code duplication is reduced.

Add function to allocate  memory for a host interface request. Set
'size' and 'event' members. Remove duplicate code using newly defined
function.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: clean memory allocation
Tobin C. Harding [Thu, 27 Apr 2017 01:25:17 +0000 (11:25 +1000)]
staging: ks7010: clean memory allocation

Memory allocation code contains unneeded debug statements, failed
kmalloc() calls typically do not require a debug message. Introduction
of a local 'size' variable allows kmalloc() call to be marginally
cleaner, still uses magic numbers but these require a more substantial
fix. Moving the magic numbers onto a single line opens the way for
further refactoring.

Clean memory allocation code, remove debug statements.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove duplicate code
Tobin C. Harding [Thu, 27 Apr 2017 01:25:16 +0000 (11:25 +1000)]
staging: ks7010: remove duplicate code

Current switch statement has duplicate code in branches. This code can
be put after the switch statement so as to remove the duplication.

Move code to after switch statement, remove duplicate code. Make error
branch return so as not to execute the moved code block. Do not change
the program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove magic numbers
Tobin C. Harding [Thu, 27 Apr 2017 01:25:15 +0000 (11:25 +1000)]
staging: ks7010: remove magic numbers

Driver includes magic numbers. Defining constants or using existing
constants aids the readability of the code.

Magic number '12' is used for two ethernet addresses (6 bytes
each). ETH_ALEN is already defined within the kernel to 6. We can us
the expression '2 * ETH_ALEN' to make this code explicit.

Magic number '20' refers to the data size, in bytes, of a struct
ether_hdr (described in eap_packet.h). We can define a constant for
this purpose, making the code explicit and easier to read.

Define constant. Remove magic numbers, using newly defined constant
and/or expression using existing kernel constant.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: move skb null check near allocation
Tobin C. Harding [Thu, 27 Apr 2017 01:25:14 +0000 (11:25 +1000)]
staging: ks7010: move skb null check near allocation

Currently, after allocating an sk_buff, driver fills the sk_buff
within code block guarded by a NULL check on the sk_buff. If a NULL
check is done immediately after the allocation, and code returns on
error, then the subsequent code need not be guarded and the level of
indentation may be reduced. This aids the readability of the code and
makes explicit the error path.

Check for NULL directly after allocating the sk_buff, return if
allocation fails. Reduce indentation of subsequent code. Do not change
the program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove unused local variable eap_key
Tobin C. Harding [Thu, 27 Apr 2017 01:25:13 +0000 (11:25 +1000)]
staging: ks7010: remove unused local variable eap_key

Code declares and assigns to a local variable that is never used, it
can be safely removed.

Remove unused local variable.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove unnecessary address check
Tobin C. Harding [Thu, 27 Apr 2017 01:25:12 +0000 (11:25 +1000)]
staging: ks7010: remove unnecessary address check

Currently source and destination ethernet addresses are checked twice,
once in hostif_data_indication() and then again in
hostif_data_indication_wpa(). The second of these functions is called
from the first right after the address check is done. This check is a
duplicate and is unnecessary.

Remove unnecessary duplicate address check.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: remove void function return
Valentin Vidic [Wed, 26 Apr 2017 10:48:31 +0000 (12:48 +0200)]
staging: lustre: remove void function return

All statements removed from the end of void functions
as reported by checkpatch.

Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Remove whitespace before quoted newline
Paolo Cretaro [Tue, 25 Apr 2017 20:14:29 +0000 (22:14 +0200)]
staging: android: ion: Remove whitespace before quoted newline

Fix checkpatch.pl warning about unnecessary whitespace before a
quoted newline.

Signed-off-by: Paolo Cretaro <melko@frugalware.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: most: aim-sound style fixess
Dhananjay Balan [Mon, 24 Apr 2017 13:54:05 +0000 (15:54 +0200)]
staging: most: aim-sound style fixess

Replace hardcoded function name with __func__

Signed-off-by: Dhananjay Balan <mail@dbalan.in>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Replace spaces with tabs for indentation
Paolo Cretaro [Fri, 21 Apr 2017 22:47:59 +0000 (00:47 +0200)]
staging: android: ion: Replace spaces with tabs for indentation

Fix checkpatch ERRORs: code indent should use tabs where possible.

Signed-off-by: Paolo Cretaro <melko@frugalware.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: speakup: add send_xchar and tiocmset methods
Okash Khawaja [Sat, 22 Apr 2017 08:00:28 +0000 (09:00 +0100)]
staging: speakup: add send_xchar and tiocmset methods

This adds two methods to spk_synth struct: send_xchar and tiocmset, and
creates serial implementation for each of them. It takes existing code
in apollo, audptr and spkout which already fits the behaviour of
send_xchar and tiocmset. In follow-up patches there will be TTY-based
implementations of these methods. Then migrating the synths to TTY will
include repointing these methods to their TTY implementations

Rest of the changes simply make use of serial implementation of these two
functions.

Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: addi_apci_3xxx: check return value
Pan Bian [Sun, 23 Apr 2017 09:52:55 +0000 (17:52 +0800)]
staging: comedi: addi_apci_3xxx: check return value

Function pci_ioremap_bar() will return a NULL pointer if there is no
enough memory. However, in function apci3xxx_auto_attach(), the return
value of function pci_ioremap_bar() is not validated. This may result in
NULL dereference in following access to dev->mmio. This patch fixes the
bug.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: support vm_access_process for mmap'd buffer
Ian Abbott [Thu, 20 Apr 2017 18:05:14 +0000 (19:05 +0100)]
staging: comedi: support vm_access_process for mmap'd buffer

If a process that has mmap'd a COMEDI buffer is being run under a
debugger such as GDB, the buffer contents are inaccessible from the
debugger.  Support the `access()` VM operation to allow the buffer
contents to be accessed by another process.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/android: Update Ion TODO list
Laura Abbott [Tue, 18 Apr 2017 18:27:14 +0000 (11:27 -0700)]
staging/android: Update Ion TODO list

Most of the items have been taken care of by a clean up series. Remove
the completed items and add a few new ones.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Set query return value
Laura Abbott [Tue, 18 Apr 2017 18:27:13 +0000 (11:27 -0700)]
staging: android: ion: Set query return value

This never got set in the ioctl. Properly set a return value of 0 on
success.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Remove ion_handle and ion_client
Laura Abbott [Tue, 18 Apr 2017 18:27:12 +0000 (11:27 -0700)]
staging: android: ion: Remove ion_handle and ion_client

ion_handle was introduced as an abstraction to represent a reference to
a buffer via an ion_client. As frameworks outside of Ion evolved, the dmabuf
emerged as the preferred standard for use in the kernel. This has made
the ion_handle an unnecessary abstraction and prone to race
conditions. ion_client is also now only used internally. We have enough
mechanisms for race conditions and leaks already so just drop ion_handle
and ion_client. This also includes ripping out most of the debugfs
infrastructure since much of that was tied to clients and handles.
The debugfs infrastructure was prone to give confusing data (orphaned
allocations) so it can be replaced with something better if people
actually want it.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Drop ion_map_kernel interface
Laura Abbott [Tue, 18 Apr 2017 18:27:11 +0000 (11:27 -0700)]
staging: android: ion: Drop ion_map_kernel interface

Nobody uses this interface externally. Drop it.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Rework heap registration/enumeration
Laura Abbott [Tue, 18 Apr 2017 18:27:10 +0000 (11:27 -0700)]
staging: android: ion: Rework heap registration/enumeration

The current model of Ion heap registration  is based on the outdated
model of board files. The replacement for board files (devicetree)
isn't a good replacement for what Ion wants to do. In actuality, Ion
wants to show what memory is available in the system for something else
to figure out what to use. Switch to a model where Ion creates its
device unconditionally and heaps are registed as available regions.
Currently, only system and CMA heaps are converted over to the new
model. Carveout and chunk heaps can be converted over when someone wants
to figure out how.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Collapse internal header files
Laura Abbott [Tue, 18 Apr 2017 18:27:09 +0000 (11:27 -0700)]
staging: android: ion: Collapse internal header files

Ion current has ion_priv.h and ion.h as header files. ion.h was intended
to be used for public APIs but Ion never ended up really having anything
public. Combine the two headers so there is only one internal header.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Get rid of ion_phys_addr_t
Laura Abbott [Tue, 18 Apr 2017 18:27:08 +0000 (11:27 -0700)]
staging: android: ion: Get rid of ion_phys_addr_t

Once upon a time, phys_addr_t was not everywhere in the kernel. These
days it is used enough places that having a separate Ion type doesn't
make sense. Remove the extra type and just use phys_addr_t directly.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Break the ABI in the name of forward progress
Laura Abbott [Tue, 18 Apr 2017 18:27:07 +0000 (11:27 -0700)]
staging: android: ion: Break the ABI in the name of forward progress

Several of the Ion ioctls were designed in such a way that they
necessitate compat ioctls. We're breaking a bunch of other ABIs and
cleaning stuff up anyway so let's follow the ioctl guidelines and clean
things up while everyone is busy converting things over anyway. As part
of this, also remove the useless alignment field from the allocation
structure.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Stop butchering the DMA address
Laura Abbott [Tue, 18 Apr 2017 18:27:06 +0000 (11:27 -0700)]
staging: android: ion: Stop butchering the DMA address

Now that we have proper caching, stop setting the DMA address manually.
It should be set after properly calling dma_map.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Use CMA APIs directly
Laura Abbott [Tue, 18 Apr 2017 18:27:05 +0000 (11:27 -0700)]
staging: android: ion: Use CMA APIs directly

When CMA was first introduced, its primary use was for DMA allocation
and the only way to get CMA memory was to call dma_alloc_coherent. This
put Ion in an awkward position since there was no device structure
readily available and setting one up messed up the coherency model.
These days, CMA can be allocated directly from the APIs. Switch to using
this model to avoid needing a dummy device. This also mitigates some of
the caching problems (e.g. dma_alloc_coherent only returning uncached
memory).

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocma: Introduce cma_for_each_area
Laura Abbott [Tue, 18 Apr 2017 18:27:04 +0000 (11:27 -0700)]
cma: Introduce cma_for_each_area

Frameworks (e.g. Ion) may want to iterate over each possible CMA area to
allow for enumeration. Introduce a function to allow a callback.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocma: Store a name in the cma structure
Laura Abbott [Tue, 18 Apr 2017 18:27:03 +0000 (11:27 -0700)]
cma: Store a name in the cma structure

Frameworks that may want to enumerate CMA heaps (e.g. Ion) will find it
useful to have an explicit name attached to each region. Store the name
in each CMA structure.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMerge tag 'iio-fixes-for-4.11e' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Tue, 18 Apr 2017 17:38:38 +0000 (19:38 +0200)]
Merge tag 'iio-fixes-for-4.11e' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Fifth set of IIO fixes for the 4.11 cycle.

As these are rather late in the cycle, they may sneak over into 4.12.
There is a fix for a regression caused by another fix (hid sensors
hardware seems to vary a lot in how various corner cases are handled).

* ad7303
  - fix channel description. Numeric values were being passed as characters
  presumably leading to garbage from the userspace interface.
* as3935
  - the write data macro was wrong so fix it.
* bmp280
  - incorrect handling of negative values as being unsigned broke humidity
  calculation.
* hid-sensor
  - Restore the poll and hysteresis values after resume as some hardware
  doesn't do it.
* stm32-trigger
  - buglet in reading the sampling frequency

7 years agoMerge tag 'iio-for-4.12d' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Tue, 18 Apr 2017 15:13:31 +0000 (17:13 +0200)]
Merge tag 'iio-for-4.12d' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Fourth set of IIO new device support, features and cleanups for the 4.12 cycle

New device support
* max1117, 1118 and 1119
  - new ADC driver
* max9611
  - new ADC driver
* pm8xxx hk/xoadc
  - new driver with some shared features broken out from the SPMI vadc.
* sun4i-gpadc
  - A33 thermal sensor support (with associated rework)
* stm32-dac
  - new driver and bindings
* stm32 trigger
  - enable support of quadrature encoder device and counter modes

Features
* apds9960
  - use the runtime pm for normal suspend
* stm32-adc
  - add opition to sest resolution via devicetree
* xoadc
  - augment DT bindings to deal with some weird mux cases

Cleanups
* ad5933
  - protect direct mode using claim and release helpers
ade7759
  - S_IRUGO and friends to octal in two goes
* adis16203
  - drop unnecessary brackets
* hid-sensor
  - fix unbalanced pm_runtieme_enable error when probing after remove
* lsm6dsx
  - use actual part numbers for device name when known
  - simplify data read pin parsing
* mpu3050
  - avoid double reporting errors

7 years agostaging: rtl8192u: fix incorrect type in assignment in ieee80211_tx.c
Martin Karamihov [Mon, 17 Apr 2017 17:00:25 +0000 (20:00 +0300)]
staging: rtl8192u: fix incorrect type in assignment in ieee80211_tx.c

This patch fixes the following sparse warning:
ieee80211_tx.c:174:36: incorrect type in assignment (different base types)
ieee80211_tx.c:174:36: expected unsigned short [unsigned] [short] [usertype] <noident>
ieee80211_tx.c:174:36: got restricted __be16 [usertype] <noident>

by adding left side cast to __be16.

Signed-off-by: Martin Karamihov <martinowar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: fix sparse signedness warnings in rtw_generate_ie
Aishwarya Pant [Sat, 15 Apr 2017 12:38:39 +0000 (18:08 +0530)]
staging: rtl8188eu: fix sparse signedness warnings in rtw_generate_ie

Changed the type of wpa_ie_len from (int *) to (unsigned int *) in the
function rtw_get_wpa_ie(..) to suppress signedness mismatch warnings in
rtw_generate_ie of the type-

drivers/staging/rtl8188eu//core/rtw_ieee80211.c:1009:60: warning: incorrect
type in argument 2 (different signedness)
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:1009:60:    expected int
*wpa_ie_len
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:1009:60:    got unsigned
int *<noident>

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: fix sparse signedness warnings in rtw_set_ie
Aishwarya Pant [Sat, 15 Apr 2017 12:38:10 +0000 (18:08 +0530)]
staging: rtl8188eu: fix sparse signedness warnings in rtw_set_ie

Changed the type of sz from (int) to (unsigned int) to suppress
signedness mismatch warnings of the type-

drivers/staging/rtl8188eu//core/rtw_ieee80211.c:258:97: warning:
incorrect type in argument 5 (different signedness)
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:258:97:    expected
unsigned int [usertype] *frlen
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:258:97:    got int
*<noident>

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: fix sparse signedness warnings in rtw_get_ie
Aishwarya Pant [Sat, 15 Apr 2017 12:37:42 +0000 (18:07 +0530)]
staging: rtl8188eu: fix sparse signedness warnings in rtw_get_ie

Changed the type of len from (int *) to (unsigned int *) in the
function rtw_get_ie(..) and wherever this function is called to
suppress signedness mismatch warnings of the type-

drivers/staging/rtl8188eu//core/rtw_ap.c:78:60: warning: incorrect type
in argument 3 (different signedness)
drivers/staging/rtl8188eu//core/rtw_ap.c:78:60:    expected int *len
drivers/staging/rtl8188eu//core/rtw_ap.c:78:60:    got unsigned int
*<noident>

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: clean up identical code on an if statement
Colin Ian King [Thu, 13 Apr 2017 15:46:36 +0000 (16:46 +0100)]
staging: rtl8723bs: clean up identical code on an if statement

The two different paths for an if statement are identical and hence
we can just replace it with the single statement.

Detected by CoverityScan, CID#1428443 ("Identical code for
different branches")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: remove redundant comparisons of unsigned ints with >= 0
Colin Ian King [Thu, 13 Apr 2017 14:13:46 +0000 (15:13 +0100)]
staging: rtl8723bs: remove redundant comparisons of unsigned ints with >= 0

The comparison of mode >= 0 is redundant as mode is a u32 and this
is always true.  Remove this redundant code.

Detected with CoverityScan ("Unsigned compared against 0")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: media/platform/bcm2835: remove gstreamer workaround
Kevin Wern [Tue, 11 Apr 2017 22:17:02 +0000 (18:17 -0400)]
staging: media/platform/bcm2835: remove gstreamer workaround

Gstreamer's v4l2src reacted poorly to certain outputs from the bcm2835
video driver's ioctl ops function vidioc_enum_framesizes, so a
workaround was created that could be activated by user input. This
workaround would replace the driver's ioctl ops struct with another,
similar struct--only with no function pointed to by
vidioc_enum_framesizes. With no response, gstreamer would attempt to
continue with some default settings that happened to work better.

However, this bug has been fixed in gstreamer since 2014, so we
shouldn't include this workaround in the stable version of the driver.

Signed-off-by: Kevin Wern <kevin.m.wern@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix checkpatch SPLIT_STRING
Tobin C. Harding [Tue, 18 Apr 2017 00:35:42 +0000 (10:35 +1000)]
staging: ks7010: fix checkpatch SPLIT_STRING

Checkpatch emits WARNING: quoted string split across lines.

Concatenate string onto single line.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: refactor SDIO read/write helpers
Tobin C. Harding [Tue, 18 Apr 2017 00:35:41 +0000 (10:35 +1000)]
staging: ks7010: refactor SDIO read/write helpers

Driver SDIO code uses helper functions to do IO to the SDIO
device. Current helpers handle IO of a single byte as well as
multi-byte. Driver predominately uses single byte IO. If the
common case is made simple it simplifies the whole driver. The common
case can be made simple by splitting the multi-byte and single byte
calls into separate functions, i.e 4 functions in total, read single
byte, read multi-byte, write single byte, write multi-byte.

Also, we need to handle the debug code. Currently debug calls after
read/write fail access the IO buffer. This buffer, at best, does not hold
useful data on the error path, at worst is uninitialized and holds
garbage.

Split read/write helper functions into two functions each, one for
single byte IO and one for multi-byte IO. Fix all call sites. Do not
change the program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix checkpatch LINE_SPACING
Tobin C. Harding [Tue, 18 Apr 2017 00:35:40 +0000 (10:35 +1000)]
staging: ks7010: fix checkpatch LINE_SPACING

Checkpatch emits CHECK: Please don't use multiple blank lines.

Remove multiple blank lines.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix checkpatch SPACE_BEFORE_TAB
Tobin C. Harding [Tue, 18 Apr 2017 00:35:39 +0000 (10:35 +1000)]
staging: ks7010: fix checkpatch SPACE_BEFORE_TAB

Checkpatch emits WARNING: please, no space before tabs.

Remove space before tabs.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove err_ from non-error path label
Tobin C. Harding [Tue, 18 Apr 2017 00:35:38 +0000 (10:35 +1000)]
staging: ks7010: remove err_ from non-error path label

goto label includes 'err_' suffix but is executed on non-error paths.

Remove err_ suffix from goto label.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: clean up SDIO source comments
Tobin C. Harding [Tue, 18 Apr 2017 00:35:37 +0000 (10:35 +1000)]
staging: ks7010: clean up SDIO source comments

SDIO code currently has a number of unneeded comments. Following
kernel coding style we do not need extraneous comments, especially on
code where it is clear what is being done. Spelling typos can be
fixed.

Remove unnecessary comments, fix typos in comments.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: add struct comment to ks_sdio_card
Tobin C. Harding [Tue, 18 Apr 2017 00:35:36 +0000 (10:35 +1000)]
staging: ks7010: add struct comment to ks_sdio_card

ks_sdio_card structure description does not have a kernel doc format
comment.

Add kernel doc format comment to struct ks_sdio_card.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: move hw info into dev private data
Tobin C. Harding [Tue, 18 Apr 2017 00:35:35 +0000 (10:35 +1000)]
staging: ks7010: move hw info into dev private data

Currently driver uses a hardware information struct description to
group some SDIO related functionality (work, work queue, sdio private
data pointer). This structure is then embedded in the device private
data structure. Having nested structures described in different header
files means that to view the device private data programmers must open
two header files. This structure could be embedded anonymously in the
device private data and achieve the same result (grouping of function
specific to SDIO) without the need to open multiple headers. However,
the SDIO private data structure already has various different data and
pointers, adding the embedded structure adds little extra meaning and
lengthens all the dereferences throughout the driver, often meaning
addition line breaks and braces. We can increase readability and
reduce code complexity by moving the hardware information data and
pointers to directly be within the device private data structure
description.

While preparing for this refactoring it was noted that the identifier
currently used for the delayed work is 'rw_wq', this is confusing
since the 'wq' suffix typically means 'work queue'. This identifier
would be more meaningful if it used the suffix 'dwork' as does the
declaration of queue_delayed_work() (include/linux/workqueue.h).

The identifier for the work queue is currently 'ks7010sdio_wq'. This
identifier can be shortened without loss of meaning because there is
only one work queue within the driver. Identifier 'wq' is typical
within in-tree driver code and aptly describes the pointer.

Current pointer to the SDIO private data is identified by 'sdio_card',
this is sufficiently meaningful from within the hw_info structure but
once the hw_info_t structure is removed the pointer would be better to
have a prefix appended to it to retain the prior level of meaning.

Move members from struct hw_info_t to struct ks_wlan_private.

Rename identifiers;
struct delayed_work pointer 'rw_wq' to 'rw_dwork'.
struct workqueue_struct pointer 'ks7010sdio_wq' to 'wq'.
struct ks_sdio_card  pointer 'sdio_card' to 'ks_sdio_card'.

Remove structure description hw_info_t. Fix init/destroy calls. Fix
all call sites, SDIO private data access calls, and queuing calls.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: move tasklet_struct to ks_wlan_private
Tobin C. Harding [Tue, 18 Apr 2017 00:35:34 +0000 (10:35 +1000)]
staging: ks7010: move tasklet_struct to ks_wlan_private

Currently a pointer to the tasklet_struct used for bottom half
processing on the receive path is within the hw_info_t structure. This
structure is then embedded in the device private data
structure. Having the tasklet_struct nested does not add meaning to
the device private data, device private data already (and typically)
has various data relating to the device, there is no real need to
separate the tasklet_struct to a SDIO specific structure. While not
adding allot of extra meaning having the nested structure means the
programmer must open two header files to read the description of the
device private data, the code would be easier to read if the device
private data struct description was not spread over two files.

Move tasklet_struct out of sdio header file and into the device
private data structure description.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: rename wakeup work struct
Tobin C. Harding [Tue, 18 Apr 2017 00:35:33 +0000 (10:35 +1000)]
staging: ks7010: rename wakeup work struct

struct work_struct uses identifier ks_wlan_wakeup_task, this is
confusing because the 'task' suffix implies that this is a
tasklet_struct instead of a work struct. Suffix 'work' would be more
clear. The code would be easier to read if it followed the principle
of least surprise and used the 'work' suffix for a work_struct
identifier.

Rename work_struct structure 'ks_wlan_wakeup_task' to 'wakeup_work'.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: clean up SDIO header comments
Tobin C. Harding [Tue, 18 Apr 2017 00:35:32 +0000 (10:35 +1000)]
staging: ks7010: clean up SDIO header comments

SDIO header file does not use kernel doc format struct
comments. Adding them aids readability and enables documentation to be
built from the source code. Other comments may be tidied up as we do this.

Add kernel format struct comments. Tidy up comments.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix complete_handler
Tobin C. Harding [Tue, 18 Apr 2017 00:35:31 +0000 (10:35 +1000)]
staging: ks7010: fix complete_handler

complete_handler() takes void * types as parameters. void * parameters are then
cast to struct types. Call sites for this function either pass in NULL
or pointers to the struct types cast to void *. This casting is
unnecessary and can be removed.

Struct tx_device_buffer (which contains a pointer member to the
complete_handler() function) has as member 'ks_wlan_priv *priv' this is
unnecessary, we always have a pointer to this struct there is no need
to store it here.

The complete_handler can be more clearly defined by using struct
pointer types instead of void * types. The code is currently
unnecessarily complex, storing and passing extraneous pointer
parameters.

Remove unnecessary parameters, unnecessary casting to/from 'void
*'. Fix all call sites involving complete_handler().

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: replace defines with enum types
Tobin C. Harding [Tue, 18 Apr 2017 00:35:30 +0000 (10:35 +1000)]
staging: ks7010: replace defines with enum types

Header has multiple constants defined using preprocessor
directive. In the cases where these are an integer progression an
enumeration type can be used. Doing so adds documentation to the code
and makes the usage explicit. Maintain original constant value, this
value is returned by the device.

Replace (integer progression) preprocessor constants with enumeration
type.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: create reg_status_type enum type
Tobin C. Harding [Tue, 18 Apr 2017 00:35:29 +0000 (10:35 +1000)]
staging: ks7010: create reg_status_type enum type

SDIO header currently defines unused constants READ_STATUS_BUSY and
WRITE_STATUS_IDLE. There are reciprocal constants that are used
READ_STATUS_IDLE and WRITE_STATUS_BUSY. We can roll these into a
single enumeration type and remove the two that are unused.

Add enumeration type containing IDLE/BUSY pair that are currently used
within the SDIO source. Change source to use new enum types.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: uart.c: Remove include linux/serial.h
Darryl T. Agostinelli [Thu, 13 Apr 2017 01:36:15 +0000 (20:36 -0500)]
staging: greybus: uart.c: Remove include linux/serial.h

$ make includecheck | grep staging
./drivers/staging/greybus/uart.c: linux/serial.h is included more than once.

Signed-off-by: Darryl T. Agostinelli <dagostinelli@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: light.c: Remove include linux/version.h
Darryl T. Agostinelli [Thu, 13 Apr 2017 01:36:14 +0000 (20:36 -0500)]
staging: greybus: light.c: Remove include linux/version.h

Fixes:
$ make versioncheck | grep staging
./drivers/staging/greybus/light.c: 15 linux/version.h not needed.

Signed-off-by: Darryl T. Agostinelli <dagostinelli@gmail.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: Fix sparse endianness warnings cast to restricted __le64 and __le32
Skanda Guruanand [Sun, 16 Apr 2017 00:48:59 +0000 (17:48 -0700)]
staging: lustre: Fix sparse endianness warnings cast to restricted __le64 and __le32

The struct lu_dirpage elements in lustre_idl.h file are modified to
__le64 and __le32 types since the  elements are always converted from
litte endian to processor native format in mdc_request.c file.

Following warnings are removed by this fix.

drivers/staging/lustre/lustre/mdc/mdc_request.c:958:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:959:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:962:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:963:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:985:50: warning: cast to restricted __le32
drivers/staging/lustre/lustre/mdc/mdc_request.c:1193:24: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1328:25: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1329:23: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1332:25: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1333:23: warning: cast to restricted __le64

Signed-off-by: Skanda Guruanand <skanda.kashyap@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: lustre cleanup macros in libcfs_private.h
Craig Inches [Thu, 13 Apr 2017 09:24:41 +0000 (10:24 +0100)]
Staging: lustre cleanup macros in libcfs_private.h

This resolves a checkpatch warning that "Single statement macros should
not use a do {} while (0) loop" by removing the loop and adjusting line
length accordingly.

Signed-off-by: Craig Inches <Craig@craiginches.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: make cport_quiesce() method optional
Alexandre Bailon [Sun, 26 Mar 2017 16:58:23 +0000 (18:58 +0200)]
staging: greybus: make cport_quiesce() method optional

The cport_quiesce() method is mandatory in the case of
the es2 Greybus hd controller to shutdown the cports on
the es2 controller.
In order to add support of another controller which may not
need to shutdown its cports, make the cport_quiesce() optional,
and check if the controller implement it before to use it.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/media: make atomisp vlv2_plat_clock explicitly non-modular
Paul Gortmaker [Thu, 13 Apr 2017 01:57:55 +0000 (21:57 -0400)]
staging/media: make atomisp vlv2_plat_clock explicitly non-modular

The Makefile / Kconfig currently controlling compilation of this code is:

clock/Makefile:obj-$(CONFIG_INTEL_ATOMISP)     += vlv2_plat_clock.o

atomisp/Kconfig:menuconfig INTEL_ATOMISP
atomisp/Kconfig:        bool "Enable support to Intel MIPI camera drivers"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was already not in use by this driver, the init
ordering remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Cox <alan@linux.intel.com>
Cc: linux-media@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: remove odd 'list' file
Greg Kroah-Hartman [Tue, 18 Apr 2017 11:20:22 +0000 (13:20 +0200)]
staging: atomisp: remove odd 'list' file

This removes a strange 'list' file in
drivers/staging/media/atomisp/pci/atomisp2/ that was not being used for
anything.

Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: fix build breakage from files going away
Greg Kroah-Hartman [Tue, 18 Apr 2017 11:19:16 +0000 (13:19 +0200)]
staging: atomisp: fix build breakage from files going away

Previous patches deleted files, but the Makefile still referenced their
.o files.  Fix this up by removing them in the Makefile.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>