platform/kernel/linux-starfive.git
7 years agostaging: fsl-dpaa2/eth: Account for Rx FD buffers on error path
Ioana Radulescu [Wed, 11 Oct 2017 13:29:44 +0000 (08:29 -0500)]
staging: fsl-dpaa2/eth: Account for Rx FD buffers on error path

On Rx path, if we fail to build an skb from the incoming FD,
we still need to update the channel buffer count accordingly,
otherwise we risk depleting the pool while the software counter
still sees available buffers.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: fsl-dpaa2/eth: Fix potential endless loop
Ioana Radulescu [Wed, 11 Oct 2017 13:29:43 +0000 (08:29 -0500)]
staging: fsl-dpaa2/eth: Fix potential endless loop

We incorrectly assumed that dpaa2_io_release() can only
return -EBUSY as an error code, when in fact it can also
fail in case some of its arguments don't have valid values.

Make sure we only retry the operation while the portal is
busy and abort for all other error cases, otherwise we risk
entering an endless loop.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vboxvideo: Fix reporting invalid suggested-offset-properties
Hans de Goede [Thu, 12 Oct 2017 18:10:25 +0000 (20:10 +0200)]
staging: vboxvideo: Fix reporting invalid suggested-offset-properties

The x and y hints receives from the host are unsigned 32 bit integers and
they get set to -1 (0xffffffff) when invalid. Before this commit the
vboxvideo driver was storing them in an u16 causing the -1 to be truncated
to 65535 which, once reported to userspace, was breaking gnome 3.26+
in Wayland mode.

This commit stores the host values in 32 bit variables, removing the
truncation and checks for -1, replacing it with 0 as -1 is not a valid
suggested-offset-property value. Likewise the properties are now
initialized to 0 instead of -1, since -1 is not a valid value.
This fixes gnome 3.26+ in Wayland mode not working with the vboxvideo
driver.

Reported-by: Gianfranco Costamagna <locutusofborg@debian.org>
Cc: stable@vger.kernel.org
Cc: Michael Thayer <michael.thayer@oracle.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vt6655: mark expected switch fall-throughs in vnt_set_keymode
Gustavo A. R. Silva [Tue, 10 Oct 2017 19:40:31 +0000 (14:40 -0500)]
staging: vt6655: mark expected switch fall-throughs in vnt_set_keymode

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: typec: tcpci: mark expected switch fall-through in tcpci_to_typec_cc
Gustavo A. R. Silva [Tue, 10 Oct 2017 19:13:58 +0000 (14:13 -0500)]
staging: typec: tcpci: mark expected switch fall-through in tcpci_to_typec_cc

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: wilc1000: replace redundant computations with 0
Colin Ian King [Tue, 10 Oct 2017 14:05:48 +0000 (15:05 +0100)]
staging: wilc1000: replace redundant computations with 0

Shifting and masking strHostIfSetMulti->enabled is redundant since
enabled is a bool and so all the shifted and masked values will be
zero. Replace them with zero to simplify the code.

Detected by CoverityScan, CID#1339458 ("Bad shift operation") and
CID#1339506 ("Operands don't affect result").

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agogreybus: audio: don't inclide rwlock.h directly.
Sebastian Andrzej Siewior [Thu, 5 Oct 2017 12:56:54 +0000 (14:56 +0200)]
greybus: audio: don't inclide rwlock.h directly.

rwlock.h should not be included directly. Instead linux/splinlock.h
should be included. One thing it does is to break the RT build.

Cc: Vaibhav Agarwal <vaibhav.sr@gmail.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: Alex Elder <elder@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: greybus-dev@lists.linaro.org
Cc: devel@driverdev.osuosl.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agovt6655: Fix a possible sleep-in-atomic bug in vt6655_suspend
Jia-Ju Bai [Mon, 9 Oct 2017 08:45:55 +0000 (16:45 +0800)]
vt6655: Fix a possible sleep-in-atomic bug in vt6655_suspend

The driver may sleep under a spinlock, and the function call path is:
vt6655_suspend (acquire the spinlock)
  pci_set_power_state
    __pci_start_power_transition (drivers/pci/pci.c)
      msleep --> may sleep

To fix it, pci_set_power_state is called without having a spinlock.

This bug is found by my static analysis tool and my code review.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: bcm2048 fix bare use of 'unsigned' in radio-bcm2048.c
Branislav Radocaj [Tue, 10 Oct 2017 13:29:19 +0000 (15:29 +0200)]
Staging: bcm2048 fix bare use of 'unsigned' in radio-bcm2048.c

This is a patch to the radio-bcm2048.c file that fixes up
a warning found by the checkpatch.pl tool.

Signed-off-by: Branislav Radocaj <branislav@radocaj.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: mark expected switch fall-through in check_urb_status
Gustavo A. R. Silva [Tue, 10 Oct 2017 20:10:41 +0000 (15:10 -0500)]
staging: greybus: mark expected switch fall-through in check_urb_status

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vt6656: card: mark expected switch fall-throughs
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:16:52 +0000 (11:16 -0500)]
staging: vt6656: card: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: r8822be: mark expected switch fall-throughs
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:17:01 +0000 (11:17 -0500)]
staging: r8822be: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: ks_wlan_net: mark expected switch fall-throughs
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:15:17 +0000 (11:15 -0500)]
staging: ks7010: ks_wlan_net: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1364489
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/wilc1000: Convert timers to use timer_setup()
Kees Cook [Mon, 16 Oct 2017 23:24:32 +0000 (16:24 -0700)]
staging/wilc1000: Convert timers to use timer_setup()

As part of removing the timer_list.data field, this converts the wilc1000
driver to using from_timer and an explicit per-timer data field, since
there doesn't appear to be a way to sanely resolve vif from hif_drv.

Cc: Aditya Shankar <aditya.shankar@microchip.com>
Cc: Ganesh Krishna <ganesh.krishna@microchip.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-wireless@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8712: Convert timers to use timer_setup()
Kees Cook [Mon, 16 Oct 2017 23:24:36 +0000 (16:24 -0700)]
staging: rtl8712: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Tejaswini Poluri <tejaswinipoluri3@gmail.com>
Cc: Scott Matheina <scott@matheina.com>
Cc: Varsha Rao <rvarsha016@gmail.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Aleksey Kurbatov <alkbt@yandex.ru>
Cc: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
Cc: Wei Yongjun <weiyongjun1@huawei.com>
Cc: "Raphaƫl Beamonte" <raphael.beamonte@gmail.com>
Cc: Jannik Becher <becher.jannik@gmail.com>
Cc: Joseph Wright <rjosephwright@gmail.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: dgnc: Convert timers to use timer_setup()
Kees Cook [Mon, 16 Oct 2017 23:25:00 +0000 (16:25 -0700)]
staging: dgnc: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Lidza Louina <lidza.louina@gmail.com>
Cc: Mark Hounschell <markh@compro.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: driverdev-devel@linuxdriverproject.org
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/fwserial: Convert timers to use timer_setup()
Kees Cook [Mon, 16 Oct 2017 23:25:08 +0000 (16:25 -0700)]
staging/fwserial: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly. Also removes redundant initialization
of fw transaction timer, which already gets initialized per-transaction.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Bhumika Goyal <bhumirks@gmail.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: net: netlogic: Fix alignment issue
Frank A. Cancio Bello [Mon, 16 Oct 2017 22:42:12 +0000 (18:42 -0400)]
staging: net: netlogic: Fix alignment issue

Fix alignment to match open parenthesis and comply in that way with the
preferred coding style for the linux kernel.

Credits to 'checkpatch'. The 'checkpatch' message was:
'CHECK: Alignment should match open parenthesis'

Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: Use __func__ instead of function name
Mihaela Muraru [Sat, 14 Oct 2017 21:08:32 +0000 (00:08 +0300)]
staging: vc04_services: Use __func__ instead of function name

Use identifier __func__ instead of the name of the function.

Issue found by checkpatch.pl.

Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: Fix comment block coding style
Mihaela Muraru [Sat, 14 Oct 2017 09:13:31 +0000 (12:13 +0300)]
staging: vc04_services: Fix comment block coding style

Remove the unnecessary '*' character and align the comment block to fit
the coding style used by linux kernel organization.

Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: vchiq_core: mark expected switch fall-through
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:16:48 +0000 (11:16 -0500)]
staging: vc04_services: vchiq_core: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: irda: Remove trailing whitespace errors
Shreeya Patel [Fri, 13 Oct 2017 20:35:35 +0000 (02:05 +0530)]
Staging: irda: Remove trailing whitespace errors

Remove trailing whitespace checkpatch errors.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: hide "nolinked power save" info when not debugging
Icenowy Zheng [Fri, 13 Oct 2017 11:50:25 +0000 (19:50 +0800)]
staging: rtl8723bs: hide "nolinked power save" info when not debugging

Currently the rtl8723bs driver will print "nolinked power save enter"
and "nolinked power save leave" per minute if it's not connected to any
network.

These messages are meaningless and annoying to regular users.

Hide them when it's not debugging.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: rtw_mlme_ext: mark expected switch fall-through
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:16:26 +0000 (11:16 -0500)]
staging: rtl8723bs: rtw_mlme_ext: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix typos in printk
Masanari Iida [Tue, 10 Oct 2017 13:47:23 +0000 (22:47 +0900)]
staging: rtl8723bs: Fix typos in printk

This patch fixes typos found in rtl8723bs_xmit.c and odm_DIG.c.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: remove implicit int->bool conversions
Aishwarya Pant [Mon, 9 Oct 2017 16:51:17 +0000 (22:21 +0530)]
staging: rtl8723bs: remove implicit int->bool conversions

Implicit type conversions are bad; they hinder readability of code and
have potential to cause bugs. Here the variable wait_ack is always
supplied a bool value while in function declarations it is defined as an
int type. Fix it by defining wait_ack a bool type in all usages.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: remove useless variable rtw_AcceptAddbaReq
Aastha Gupta [Sun, 8 Oct 2017 04:54:56 +0000 (10:24 +0530)]
staging: rtl8723bs: remove useless variable rtw_AcceptAddbaReq

rtw_AcceptAddbaReq is a static variable, it is set once and never
modified. It is referenced only once, to assign its value to a member
of struct registry_priv.

Remove the variable, and move the meaningful part of the comment
near the declaration of the relevant field of struct registry_priv.

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: rename camelcase bAcceptAddbaReq
Aastha Gupta [Sun, 8 Oct 2017 04:54:55 +0000 (10:24 +0530)]
staging: rtl8723bs: rename camelcase bAcceptAddbaReq

bAcceptAddbaReq uses camelcase which is not according to Linux kernel
coding style.
There is a 'bAcceptAddbaReq' field both in struct mlme_ext_info and
in struct registry_priv.Rename both of them.

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: convert type to bool
Aastha Gupta [Sun, 8 Oct 2017 04:54:54 +0000 (10:24 +0530)]
staging: rtl8723bs: convert type to bool

Here the variable bips_processing is always supplied a bool value
while inside struct definition it is defined as an uint type.
Fix it by defining bips_processing a bool type.

Also a restore_iqk_rst = (pwrpriv->bips_processing == true) is same
as restore_iqk_rst = pwrpriv->bips_processing

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Change type to bool
Aastha Gupta [Sun, 8 Oct 2017 04:54:53 +0000 (10:24 +0530)]
staging: rtl8723bs: Change type to bool

res and Match have only either 'true' or 'false' values.
So making them of type bool for better readability of code.

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: remove unused variables
Aastha Gupta [Sun, 8 Oct 2017 04:54:52 +0000 (10:24 +0530)]
staging: rtl8723bs: remove unused variables

It seems these two operations are just dead code. The values of these
variables are not used subsequently.

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: remove ternary operators in assignmet statments
Aastha Gupta [Sun, 8 Oct 2017 04:54:51 +0000 (10:24 +0530)]
staging: rtl8723bs: remove ternary operators in assignmet statments

Remove unnecessary ternary operators in assignments statments.

This patch is with the help of following Coccinelle script:

@@
expression a, b, c;
binary operator op = {==, !=, <=, >=, <, >, &&, ||};
@@

c =
- (a op b) ? true : false
+ a op b

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Add space after ','
Harsha Sharma [Sun, 8 Oct 2017 13:33:06 +0000 (19:03 +0530)]
staging: rtl8723bs: Add space after ','

Space is required after ',' according to linux-kernel coding style.

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: rtl8723bs: core: rtw_cmd: Remove cast to pointer types in kfree
Srishti Sharma [Sat, 7 Oct 2017 20:33:24 +0000 (02:03 +0530)]
Staging: rtl8723bs: core: rtw_cmd: Remove cast to pointer types in kfree

The cast to pointer types in kfree is not needed and can be dropped.
This was done using the following semantic patch by coccinelle,
except kfree((unsigned char*) pcmd->parmbuf) which was transformed by
hand because coccinelle didn't have enough type information.

@r@
type T,P;
T* x;
@@

kfree(
-(P *)
x )

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: fbtft: differentiate between buffer and data types to fix sparse warning
Alfonso Lima Astor [Tue, 17 Oct 2017 17:46:29 +0000 (18:46 +0100)]
staging: fbtft: differentiate between buffer and data types to fix sparse warning

sparse was complaning about an incorrect type cast:
drivers/staging/fbtft/fbtft-bus.c:60:1: warning: incorrect type in assignment (different base types)
drivers/staging/fbtft/fbtft-bus.c:60:1:    expected unsigned short [unsigned] [short] [usertype] <noident>
drivers/staging/fbtft/fbtft-bus.c:60:1:    got restricted __be16 [usertype] <noident>
drivers/staging/fbtft/fbtft-bus.c:60:1: warning: incorrect type in assignment (different base types)
drivers/staging/fbtft/fbtft-bus.c:60:1:    expected unsigned short [unsigned] [short] [usertype] <noident>
drivers/staging/fbtft/fbtft-bus.c:60:1:    got restricted __be16 [usertype] <noident>

The solution is to add an extra parameter to the macro to
differentiate between buffer type and data type.

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Alfonso Lima Astor <alfonsolimaastor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: fbtft: remove unnecessary parantheses around assignment
Aastha Gupta [Sat, 7 Oct 2017 14:47:18 +0000 (20:17 +0530)]
staging: fbtft: remove unnecessary parantheses around assignment

Parentheses are not needed around the right hand side of an assignment.
This patch is done using Coccinelle:

@@
expression a, b;
@@

b =
-(
a
-)

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: pi433: rf69.c style fix - space before asterisk
Marcin Ciupak [Wed, 11 Oct 2017 19:24:40 +0000 (21:24 +0200)]
staging: pi433: rf69.c style fix - space before asterisk

This patch fixes the following checkpatch.pl error:

ERROR: "(foo*)" should be "(foo *)"

in rf69.c file as requested by TODO file.

Additionally some style warnings remain valid here and could be fixed by
another patch.

Signed-off-by: Marcin Ciupak <marcin.s.ciupak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: pi433: rf69.c style fix - code indent should use tabs
Marcin Ciupak [Wed, 11 Oct 2017 19:24:17 +0000 (21:24 +0200)]
staging: pi433: rf69.c style fix - code indent should use tabs

This patch fixes the following checkpatch.pl error:

ERROR: code indent should use tabs where possible

in rf69.c file as requested by TODO file.

Additionally some style warnings remain valid here and could be fixed by
another patch.

Signed-off-by: Marcin Ciupak <marcin.s.ciupak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: pi433: rf69.c style fix - spaces before/after
Marcin Ciupak [Wed, 11 Oct 2017 19:24:01 +0000 (21:24 +0200)]
staging: pi433: rf69.c style fix - spaces before/after

his patch fixes the following checkpatch.pl errors:

ERROR: space prohibited after that open parenthesis '('
ERROR: space prohibited before that ',' (ctx:WxV)
ERROR: space prohibited before that close parenthesis ')'
ERROR: space required after that ',' (ctx:VxV)
ERROR: space required before the open parenthesis '('

in rf69.c file as requested by TODO file.

Additionally some style warnings remain valid here and could be fixed by
another patch.

Signed-off-by: Marcin Ciupak <marcin.s.ciupak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: pi433: rf69.c style fix - spaces required around
Marcin Ciupak [Wed, 11 Oct 2017 19:23:39 +0000 (21:23 +0200)]
staging: pi433: rf69.c style fix - spaces required around

This patch fixes the following checkpatch.pl errors:

ERROR: spaces required around that '+=' (ctx:WxV)
ERROR: spaces required around that '=' (ctx:VxV)
ERROR: spaces required around that '<' (ctx:VxV)

in rf69.c file as requested by TODO file.

Additionally some style warnings remain valid here and could be fixed by
another patch.

Signed-off-by: Marcin Ciupak <marcin.s.ciupak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: pi433: rf69.c style fix - trailing statements
Marcin Ciupak [Wed, 11 Oct 2017 19:23:26 +0000 (21:23 +0200)]
staging: pi433: rf69.c style fix - trailing statements

This patch fixes the following checkpatch.pl error:

ERROR: trailing statements should be on next line

in rf69.c file as requested by TODO file.

Note:
ERROR: spaces required around that '=' (ctx:VxV)
remains valid here and is going to be fixed by the next patch in set.

Additionally some style warnings remain valid here and could be fixed by
another patch.

Signed-off-by: Marcin Ciupak <marcin.s.ciupak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: pi433: Fix the position of brace after if
Srishti Sharma [Sat, 7 Oct 2017 19:57:05 +0000 (01:27 +0530)]
Staging: pi433: Fix the position of brace after if

Fix the position of the brace after if when it is on the next line.
Done using the following semantic patch by coccinelle.

@r1@
position p1, p2;
@@

if(...)@p1 {@p2
...
}

@script: python r2@
p1 << r1.p1;
p2 << r1.p2;
@@

l1 = int (p1[0].line)
l2 = int (p2[0].line)
c1 = int (p1[0].column_end)
c2 = int (p2[0].column)

if l1 == l2 and c1+1 == c2:
        cocci.include_match(False)

@r3@
position r1.p1, r1.p2;
@@

if(...
- )@p1
-{@p2
+) {
...
}

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtlwifi: phydm: Remove useless parentheses
Frank A. Cancio Bello [Tue, 17 Oct 2017 22:07:18 +0000 (18:07 -0400)]
staging: rtlwifi: phydm: Remove useless parentheses

Remove unnecessary parentheses to comply with preferred coding style for
the linux kernel and avoid the following checkpatch's message:
'CHECK: Unnecessary parentheses around'.

Credits to checkpatch.

Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtlwifi: Remove unnecessary parentheses
Frank A. Cancio Bello [Tue, 17 Oct 2017 21:12:03 +0000 (17:12 -0400)]
staging: rtlwifi: Remove unnecessary parentheses

Remove unnecessary parentheses to comply with preferred coding style for
the linux kernel and avoid the following checkpatch's message:
'CHECK: Unnecessary parentheses around'.

Credits to checkpatch.

Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortlwifi: Fix typo in if ... else if ... else construct
Larry Finger [Sun, 15 Oct 2017 01:58:21 +0000 (20:58 -0500)]
rtlwifi: Fix typo in if ... else if ... else construct

The kbuild test robot reports two conditions with no effect (if == else).
These are the result of copy and paste typographical errors.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Cc: kbuild-all@01.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtlwifi: halmac: mark expected switch fall-through
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:17:15 +0000 (11:17 -0500)]
staging: rtlwifi: halmac: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtlwifi: mark expected switch fall-through in rtl_make_smps_action
Gustavo A. R. Silva [Tue, 10 Oct 2017 19:01:16 +0000 (14:01 -0500)]
staging: rtlwifi: mark expected switch fall-through in rtl_make_smps_action

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtlwifi: Convert timers to use timer_setup()
Kees Cook [Mon, 16 Oct 2017 23:25:12 +0000 (16:25 -0700)]
staging: rtlwifi: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly. Also drops unused odm timer code.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: shaofu <shaofu@realtek.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: adv_pci_dio: update for PCI-1761
Anton Dozenko [Thu, 5 Oct 2017 10:39:08 +0000 (11:39 +0100)]
staging: comedi: adv_pci_dio: update for PCI-1761

Advantech PCI-1761 device support to the driver adv_pci_dio has been
added. Patch has been successfully tested on a real card (8 digital
outs, 8 digital inputs).

Signed-off-by: Anton Dozenko <anton.dozenko@gmail.com>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: dt282x: fix IRQ assignment for dev->irq.
Arvind Yadav [Fri, 6 Oct 2017 18:25:56 +0000 (23:55 +0530)]
staging: comedi: dt282x: fix IRQ assignment for dev->irq.

Here, dev->irq is not assigned with irq. comedi_legacy_detach()
is using dev->irq for release irq and dt282x_attach() is using dev->irq
for initialize comedi_subdevice.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: s526: mark expected switch fall-through
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:16:37 +0000 (11:16 -0500)]
staging: comedi: s526: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/comedi: Convert timers to use timer_setup()
Kees Cook [Mon, 16 Oct 2017 23:25:03 +0000 (16:25 -0700)]
staging/comedi: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer
to all timer callbacks, switch to using the new timer_setup() and
from_timer() to pass the timer pointer explicitly. Adds pointer back to
comedi device from private struct.

Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192e: mark expected switch fall-through
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:16:17 +0000 (11:16 -0500)]
staging: rtl8192e: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192e: Use __func__ instead of function name
Mihaela Muraru [Sat, 14 Oct 2017 20:23:28 +0000 (23:23 +0300)]
staging: rtl8192e: Use __func__ instead of function name

Use identifier __func__ instead of the name of the function.

Issue found by checkpatch.pl.

Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192e: Convert timers to use timer_setup()
Kees Cook [Mon, 16 Oct 2017 23:24:50 +0000 (16:24 -0700)]
staging: rtl8192e: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Derek Robson <robsonde@gmail.com>
Cc: Suniel Mahesh <suniel.spartan@gmail.com>
Cc: Malcolm Priestley <tvboxspy@gmail.com>
Cc: Gargi Sharma <gs051095@gmail.com>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Yamanappagouda Patil <goudapatilk@gmail.com>
Cc: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: Baoyou Xie <baoyou.xie@linaro.org>
Cc: devel@driverdev.osuosl.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Derek Robson <robsonde@gmail.com>
Cc: Suniel Mahesh <suniel.spartan@gmail.com>
Cc: Malcolm Priestley <tvboxspy@gmail.com>
Cc: Gargi Sharma <gs051095@gmail.com>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Yamanappagouda Patil <goudapatilk@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: Baoyou Xie <baoyou.xie@linaro.org>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192u: Convert timers to use timer_setup()
Kees Cook [Mon, 16 Oct 2017 23:24:46 +0000 (16:24 -0700)]
staging: rtl8192u: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Derek Robson <robsonde@gmail.com>
Cc: simran singhal <singhalsimran0@gmail.com>
Cc: Riccardo Marotti <riccardo.marotti@gmail.com>
Cc: Fabrizio Perria <fabrizio.perria@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Baoyou Xie <baoyou.xie@linaro.org>
Cc: Tuomo Rinne <tuomo.rinne@gmail.com>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: usb_ops_linux: mark expected switch fall-through
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:16:56 +0000 (11:16 -0500)]
staging: rtl8188eu: usb_ops_linux: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1077613
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: usb_halinit: mark expected switch fall-through
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:16:42 +0000 (11:16 -0500)]
staging: rtl8188eu: usb_halinit: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1373894
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortl8188eu: Fix a possible sleep-in-atomic bug in _rtw_pwr_wakeup
Jia-Ju Bai [Sun, 8 Oct 2017 11:54:53 +0000 (19:54 +0800)]
rtl8188eu: Fix a possible sleep-in-atomic bug in _rtw_pwr_wakeup

The driver may sleep under a spinlock, and the function call path is:
rtw_set_802_11_disassociate(acquire the spinlock)
  _rtw_pwr_wakeup
    usleep_range --> may sleep

To fix it, usleep_range is replaced with udelay.
This bug is found by my static analysis tool and my code review.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortl8188eu: Fix a possible sleep-in-atomic bug in rtw_createbss_cmd
Jia-Ju Bai [Sun, 8 Oct 2017 11:54:45 +0000 (19:54 +0800)]
rtl8188eu: Fix a possible sleep-in-atomic bug in rtw_createbss_cmd

The driver may sleep under a spinlock, and the function call path is:
rtw_surveydone_event_callback(acquire the spinlock)
  rtw_createbss_cmd
    kzalloc(GFP_KERNEL) --> may sleep

To fix it, GFP_KERNEL is replaced with GFP_ATOMIC.
This bug is found by my static analysis tool and my code review.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortl8188eu: Fix a possible sleep-in-atomic bug in rtw_disassoc_cmd
Jia-Ju Bai [Sun, 8 Oct 2017 11:54:07 +0000 (19:54 +0800)]
rtl8188eu: Fix a possible sleep-in-atomic bug in rtw_disassoc_cmd

The driver may sleep under a spinlock, and the function call path is:
rtw_set_802_11_bssid(acquire the spinlock)
  rtw_disassoc_cmd
    kzalloc(GFP_KERNEL) --> may sleep

To fix it, GFP_KERNEL is replaced with GFP_ATOMIC.
This bug is found by my static analysis tool and my code review.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: add spaces around algebric and boolean operators
Aastha Gupta [Thu, 5 Oct 2017 13:06:25 +0000 (18:36 +0530)]
staging: rtl8188eu: add spaces around algebric and boolean operators

This patch fixes checkpatch.pl warnings about preferring spaces around
algebric and boolean operators.

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: fix spaces before tabs
Aastha Gupta [Thu, 5 Oct 2017 13:06:24 +0000 (18:36 +0530)]
staging: rtl8188eu: fix spaces before tabs

This patch fixes checkpatch.pl warning:
WARNING: please, no space before tabs

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: fix space between function name and '('
Aastha Gupta [Thu, 5 Oct 2017 13:06:22 +0000 (18:36 +0530)]
staging: rtl8188eu: fix space between function name and '('

This patch fixes checkpatch.pl warning:
WARNING: space prohibited between function name and open parenthesis '('

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: fix block comment styling in rtl8188eu files
Aastha Gupta [Thu, 5 Oct 2017 13:06:21 +0000 (18:36 +0530)]
staging: rtl8188eu: fix block comment styling in rtl8188eu files

This patch fixes checkpatch.pl warnings for block comment styling.
1. Block comment use a trailing */ on a separate line.
2. Block comment use * on subsequent lines.
3. Block comment should align * on each line.

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: fix comparisons should place the constant on the right side
Aastha Gupta [Wed, 18 Oct 2017 12:14:22 +0000 (17:44 +0530)]
staging: lustre: fix comparisons should place the constant on the right side

This patch fixes checkpatch.pl warning:

WARNING: Comparisons should place the constant on the right side of the test

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: fix incorrect multi-line comment style
Aastha Gupta [Wed, 18 Oct 2017 12:14:21 +0000 (17:44 +0530)]
staging: lustre: fix incorrect multi-line comment style

This patch fixes the checkpatch.pl warning:

WARNING: block comments use a trailing */ on a separate line

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtlwifi: rtl8822be: Align the * in block comment
Frank A. Cancio Bello [Wed, 18 Oct 2017 03:37:21 +0000 (23:37 -0400)]
staging: rtlwifi: rtl8822be: Align the * in block comment

Align the * on each line of a block comment to comply with kernel coding
style and address the following checkpatch message:
'WARNING: Block comments should align the * on each line'.

Credits to checkpatch.

Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtlwifi: rtl8822be: Remove useless parentheses
Frank A. Cancio Bello [Wed, 18 Oct 2017 03:35:51 +0000 (23:35 -0400)]
staging: rtlwifi: rtl8822be: Remove useless parentheses

Remove unnecessary parentheses to comply with preferred coding style for
the linux kernel and avoid the following checkpatch's message:
'CHECK: Unnecessary parentheses around'.

Credits to checkpatch.

Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtlwifi: rtl8822be: Use __func__ instead of hardcoded name
Frank A. Cancio Bello [Wed, 18 Oct 2017 03:33:06 +0000 (23:33 -0400)]
staging: rtlwifi: rtl8822be: Use __func__ instead of hardcoded name

Switch hardcoded function name with a reference to __func__ making
the code more maintenable and addressing the checkpatch warning:

WARNING: Prefer using '"%s...", __func__' to using 'rtl8822be_sc_mapping', this function's name, in a string
+                                       "rtl8822be_sc_mapping: Not Correct Primary40MHz Setting\n");

Credits to checkpatch.

Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtlwifi: rtl8822be: Balance braces in else statement
Frank A. Cancio Bello [Wed, 18 Oct 2017 03:30:20 +0000 (23:30 -0400)]
staging: rtlwifi: rtl8822be: Balance braces in else statement

Add braces to else statements to comply with section 3) of  'Linux
kernel coding style' and avoid the following checkpatch message:
'CHECK: Unbalanced braces around else statement'

Credits to checkpatch.

Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8822be: Keep array subscript no lower than zero
Larry Finger [Sun, 24 Sep 2017 00:36:04 +0000 (19:36 -0500)]
staging: rtl8822be: Keep array subscript no lower than zero

The kbuild test robot reports the following:
   drivers/staging//rtlwifi/phydm/phydm_dig.c: In function 'odm_pause_dig':
   drivers/staging//rtlwifi/phydm/phydm_dig.c:494:45: warning: array subscript is below array bounds [-Warray-bounds]
      odm_write_dig(dm, dig_tab->pause_dig_value[max_level]);

This condition is caused when a loop falls through. The fix is to pin
max_level to be >= 0.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
c: kbuild test robot <fengguang.wu@intel.com>
Fixes: 9ce99b04b5b82fdf11e4c76b60a5f82c1e541297 staging: r8822be: Add phydm mini driver
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ccree: fix boolreturn.cocci warning
Suniel Mahesh [Wed, 18 Oct 2017 06:41:55 +0000 (12:11 +0530)]
staging: ccree: fix boolreturn.cocci warning

This fixes the following coccinelle warning:
WARNING: return of 0/1 in function 'ssi_is_hw_key' with return type bool.

return "false" instead of 0.

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ccree: Fix bool comparison
Suniel Mahesh [Wed, 18 Oct 2017 02:10:14 +0000 (07:40 +0530)]
staging: ccree: Fix bool comparison

Comparision operator "equal to" not required on a variable
"foo" of type "bool". Bool has only two values, can be used
directly or with logical not.

This fixes the following coccinelle warning:
WARNING: Comparison of bool to 0/1

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/ccree: Declare compiled out functions static inline
Rishabh Hardas [Thu, 12 Oct 2017 12:36:53 +0000 (18:06 +0530)]
staging/ccree: Declare compiled out functions static inline

Sparse was giving out a warning for symbols
'cc_set_ree_fips_status' and 'fips_handler'
that they were not declared and need to be
made static. This patch makes both the symbols
static inline, to remove the warnings.

Signed-off-by: Rishabh Hardas <rishabhhardas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: Convert timers to use timer_setup()
Kees Cook [Mon, 16 Oct 2017 23:24:41 +0000 (16:24 -0700)]
staging: rtl8188eu: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Juliana Rodrigues <juliana.orod@gmail.com>
Cc: Ivan Safonov <insafonov@gmail.com>
Cc: Gargi Sharma <gs051095@gmail.com>
Cc: sayli karnik <karniksayli1995@gmail.com>
Cc: Yamanappagouda Patil <goudapatilk@gmail.com>
Cc: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Victor Carvajal <carva005@gmail.com>
Cc: Sebastian Haas <sehaas@deebas.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: rpc: mark expected switch fall-throughs
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:17:43 +0000 (11:17 -0500)]
staging: lustre: rpc: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1077604
Addresses-Coverity-ID: 1077605
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: ptlrpc: mark expected switch fall-throughs
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:17:39 +0000 (11:17 -0500)]
staging: lustre: ptlrpc: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: osc: mark expected switch fall-through
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:17:36 +0000 (11:17 -0500)]
staging: lustre: osc: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1077598
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: ldlm: mark expected switch fall-through
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:17:32 +0000 (11:17 -0500)]
staging: lustre: ldlm: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: lprocfs: mark expected switch fall-throughs
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:17:29 +0000 (11:17 -0500)]
staging: lustre: lprocfs: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1271166
Addresses-Coverity-ID: 1271167
Addresses-Coverity-ID: 1271168
Addresses-Coverity-ID: 1271169
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: llite: mark expected switch fall-through
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:17:23 +0000 (11:17 -0500)]
staging: lustre: llite: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: lnet: selftest: mark expected switch fall-throughs
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:17:19 +0000 (11:17 -0500)]
staging: lustre: lnet: selftest: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: lnet: selftest: mark expected switch fall-through
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:17:12 +0000 (11:17 -0500)]
staging: lustre: lnet: selftest: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: lnet: net_fault: mark expected switch fall-through
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:16:32 +0000 (11:16 -0500)]
staging: lustre: lnet: net_fault: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: lnet: socklnd: mark expected switch fall-through
Gustavo A. R. Silva [Thu, 12 Oct 2017 16:16:08 +0000 (11:16 -0500)]
staging: lustre: lnet: socklnd: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMerge tag 'iio-for-4.15b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Sun, 15 Oct 2017 13:46:32 +0000 (15:46 +0200)]
Merge tag 'iio-for-4.15b' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second set of IIO new device support, features and cleanup for 4.15

New device support
* cros_ec_accel_legacy
  - New driver for this older chromebook accelerometer.
* ds4422 dac driver
  - New driver and bindings for the Maxim ds4422 and ds4424 I2C DACs.
* kxcjk1013
  - Support the KXTF9 accelerometers.
* mcp320x
  - support mcp3550, mcp3551, mcp3553 21 bit ADCs.
* rfd77402
  - new driver for this laser range finder.
* st-sensors-accel
  - add support for the LIS2DW12 accelerometer with bindings
  - add support for the LIS3DHH accelerometer with bindings

New features
* core
  - Drop a duplicate forward declaration in iio.h
* Docs
  - add a clarification of the meaning of IIO_DISTANCE to reflect
    existing use in various range finding devices.
* st-sensors
  - add a register mask for the status register to correctly support
    2 channel devices.
  - decouple the irq1 and irq2 configuration parameters.
  - do not always write the enable_axis register as some newer devices
    are always on and don't support such configuration.
  - split open-drain control for irq1 and irq2
  - make sampling frequency control optional as non all hardware
    supports it.
* st-sensors-gyro
  - support 3 wire SPI mode
* st-sensors-magn
  - support 3 wire SPI mode
* st-sensors-pressure
  - support 3 wire SPI mode.

Cleanups and fixes
* ad7192
  - expand the buffer lock to cover device state protection rather than
    using core mlock to provide the state protection.
* ade7753
  - expand the buffer lock to cover device state protection as well
    rather than having an additional lock.
* dummy-evgen
  - Use the new irq_sim infrastructure rather than having our
    own local version of the same thing.
* hid-sensor-trigger
  - avoid touching sensors ever if user hasn't requested it.  This
    is a work around for one reported issue where turning a sensor
    off wasn't sufficient to make it actually switch off.  As we
    have only one report from what looks like buggy hardware we
    are sending this upstream the slow way.
* ina2xx
  - Adhere to the published ABI docs and use Ohms instead of
    microohms.  We don't think that anyone will notice this ABI fix
    but are sending it the slow route to reduce fallout if someone
    does!
* kxcjk1013 - refactors to support the KXTF9 being added.
  - Refactor ODR support.
  - Fix INT_CTRL/INT_SRC1 bit names to match the register name.
  - Extract code for reporting motion events as this isn't present
    on some parts to be supported.
  - Make the sysfs sampling_frequency_available stuff not a fixed
    string so as to allow for it to be chip type dependent.
  - Make the sampling frequency_available per type to match
    the sampling_frequency attributes.
* lsm6dsx - rework prior to new device support.
  - express the max fifo depth in 'scans' rather than bytes.
  - split control of the fifo mode fifo output data rate.
  - move decimator registers into the sensor_settings structure
    as this will make it easier to support devices that don't have
    this function.
  - add a fifo ops datastructure to allow for inter-part variations.
* max30100
  - fix i2c chip address in dt example
* max30102
  - use correct binding name for max30102 in example
* mma8452
  - Rename read/write event value callbacks to be more generic
    reflecting what they actually do now.
* rcar-gyroadc
  - pointer case to fix warnings when moving to 64 bit as this IP is
    present on new 64 bit SOCs
  - enable compile-testing to improve build coverage on this driver.
  - use the of_device_get_match_data helper instead of open coding
* sun4i-gpadc-iio
  - Register in the thermal framework after pm. Otherwise the IP is not
    enabled.
  - Don't fail probing if no thermal DT node is present.
* tsl2x7x
  - renaming tsl2x7x_settings to settings to avoid excessive line
    lengths.
  - Use IIO core to generate the integration_time sysfs attributes
    rather than hand rolling.
* vf6180
  - Move the range check on integration time to the setter function.
  - Refactor the code around integration time to be clearer including
    caching current integration time avoiding unnecessary chip reads.
  - cleanup the als_gain lookup avoiding reading registers on chip.
  - use rounded matching rather than precise values for als_gain
    lookup.
  - Correct the ALS  scale when non-default gain or integration time
    is used.

7 years agoplatform/chrome: Add cros_ec_accel_legacy driver
Gwendal Grignou [Thu, 12 Oct 2017 17:33:23 +0000 (19:33 +0200)]
platform/chrome: Add cros_ec_accel_legacy driver

Add driver to support older EC firmware that only support deprecated
ec command. Rely on ACPI memory map register to access sensor
information.
Present same interface as the regular cros_ec sensor stack:
- one iio device per accelerometer
- use HTML5 axis definition
- use iio abi units
- accept calibration calls, but do nothing
Chrome can use the same code than regular cros_ec sensor stack to
calculate orientation and lid angle.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: hid-sensor-trigger: Don't touch sensors unless user space requests
Srinivas Pandruvada [Wed, 11 Oct 2017 16:35:01 +0000 (09:35 -0700)]
iio: hid-sensor-trigger: Don't touch sensors unless user space requests

One of the user complained that on his system Thinkpad Yoga S1, with
commit f1664eaacec3 ("iio: hid-sensor-trigger: Fix the race with user
space powering up sensors") causes the system to resume immediately
on suspend (S3 operation). On this system the sensor hub is on USB
and is a wake up device from S3. So if any sensor sends data on
motion, the system will wake up. This can be a legitimate use case
to wake up device motion, but that needs proper user space support
to set right thresholds.

In fact the above commit didn't cause this regression, but any operation
which cause sensors to wake up would have caused the same issue. So if
user reads the raw sensor data, same issue occurs, with or without this
commit. Only difference is that the above commit by default will trigger
a power up and power down of sensors as part of runtime pm enable
(runtime enable will cause a runtime resume callback followed by
runtime_suspend callback). Previously user has to do some action on
sensors.

On investigation it was observed that the current driver correctly
changing the state of all sensors to power off but then also some sensor
will still send some data. Only option is to never power up any sensor.

Only good option is to:
- Using sysfs interface disable USB as a wakeup device (This will not
need any driver change)

Since some user don't care about sensors. So for those users this change
brings back old functionality. As long as they don't cause any operation
to power up sensors (like raw read or start iio-sensor-proxy service),
the sensors will not be to touched. This is done by delaying run time
enable till user space does some operation with sensors.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=196853
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agodt-bindings: iio: health: Use binding name for max30102 in example
Peter Meerwald-Stadler [Wed, 11 Oct 2017 09:09:08 +0000 (11:09 +0200)]
dt-bindings: iio: health: Use binding name for max30102 in example

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agodt-bindings: iio: health: Fix max30100 I2C chip address in example
Peter Meerwald-Stadler [Wed, 11 Oct 2017 09:09:07 +0000 (11:09 +0200)]
dt-bindings: iio: health: Fix max30100 I2C chip address in example

Should be in hex, not decimal or even octal

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: Drop duplicate forward declaration
Lukas Wunner [Tue, 10 Oct 2017 16:15:34 +0000 (18:15 +0200)]
iio: Drop duplicate forward declaration

Commit 5f420b42079c ("staging:iio: Add extended IIO channel info") added
a forward declaration for struct iio_dev to <linux/iio/iio.h> but forgot
to remove an existing forward declaration further down originating from
commit 7ae8cf627558 ("staging: iio: chrdev.h rationalization").

Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: proximity: Add rfd77402 driver
Peter Meerwald-Stadler [Tue, 10 Oct 2017 13:48:47 +0000 (15:48 +0200)]
iio: proximity: Add rfd77402 driver

Driver for RF Digital RFD77402 VCSEL (vertical-cavity surface-emitting
laser) Time-of-Flight (ToF) sensor to measure distance up to 2 m with
millimeter precision

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoDocumentation: iio: Clarify meaning of IIO_DISTANCE channel type
Peter Meerwald-Stadler [Tue, 10 Oct 2017 13:48:46 +0000 (15:48 +0200)]
Documentation: iio: Clarify meaning of IIO_DISTANCE channel type

IIO_DISTANCE is used for two purposes: for pedometers to record the
distance covered by a walker, and to measure the distance to an object

IIO_DISTANCE is in meters while IIO_PROXIMITY is a unitless measure
indirectly proportional to distance (higher value relates to a closer
object)

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agodt-bindings: iio: accel: add LIS3DHH device bindings
Lorenzo Bianconi [Sun, 17 Sep 2017 16:17:12 +0000 (18:17 +0200)]
dt-bindings: iio: accel: add LIS3DHH device bindings

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: accel: add support to LIS3DHH
Lorenzo Bianconi [Sun, 17 Sep 2017 16:17:11 +0000 (18:17 +0200)]
iio: accel: add support to LIS3DHH

add support to STMicroelectronics LIS3DHH accel sensor

http://www.st.com/resource/en/datasheet/lis3dhh.pdf

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: common: st_sensors: check odr address value in st_sensors_set_odr()
Lorenzo Bianconi [Sun, 17 Sep 2017 16:17:10 +0000 (18:17 +0200)]
iio: common: st_sensors: check odr address value in st_sensors_set_odr()

Do not try to configure sample frequency if the sensor do not export
odr register address in register map. That change will be used to
properly support LIS3DHH accel sensor.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: st_sensors: split open-drain parameters for irq1 and irq2
Lorenzo Bianconi [Sun, 17 Sep 2017 16:17:09 +0000 (18:17 +0200)]
iio: st_sensors: split open-drain parameters for irq1 and irq2

Define st_sensor_int_drdy structure in st_sensor_data_ready_irq in order
to contain irq line parameters of the device.
Moreover separate data-ready open-drain configuration parameters for INT1
and INT2 pins in st_sensor_data_ready_irq data structure.
That change will be used to properly support LIS3DHH accel sensor.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: pressure: st_pressure: add SPI-3wire support to st_pressure framework
Lorenzo Bianconi [Sun, 17 Sep 2017 15:20:47 +0000 (17:20 +0200)]
iio: pressure: st_pressure: add SPI-3wire support to st_pressure framework

Add SPI Serial Interface Mode (SIM) register information
to STM pressure framework

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 years agoiio: magnetometer: st_magn: add SPI-3wire support to LIS3MDL
Lorenzo Bianconi [Sun, 17 Sep 2017 15:20:46 +0000 (17:20 +0200)]
iio: magnetometer: st_magn: add SPI-3wire support to LIS3MDL

Add SPI Serial Interface Mode (SIM) register information to
LIS3MDL magn sensor

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>