platform/kernel/linux-rpi.git
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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.

6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 years agoiio: gyro: st_gyro: add SPI-3wire support to st_gyro framework
Lorenzo Bianconi [Sun, 17 Sep 2017 15:20:45 +0000 (17:20 +0200)]
iio: gyro: st_gyro: add SPI-3wire support to st_gyro framework

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

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agodt-bindings: iio: accel: add LIS2DW12 sensor device binding
Lorenzo Bianconi [Wed, 30 Aug 2017 11:50:43 +0000 (13:50 +0200)]
dt-bindings: iio: accel: add LIS2DW12 sensor device binding

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: accel: add support to LIS2DW12
Lorenzo Bianconi [Wed, 30 Aug 2017 11:50:42 +0000 (13:50 +0200)]
iio: accel: add support to LIS2DW12

add support to STMicroelectronics LIS2DW12 accelerometer in
st_accel framework

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

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: st_sensors: do not always write enable_axis register
Lorenzo Bianconi [Wed, 30 Aug 2017 11:50:41 +0000 (13:50 +0200)]
iio: st_sensors: do not always write enable_axis register

New devices (e.g. LIS2DW12) enable all axis by default and do not export
that capability in register map. Check if the enable_axis register
address has been declared in st_sensor_settings map in order to verify if
the driver needs to enable all sensor axis

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: st_sensors: decouple irq1 configuration parameters from the irq2 ones
Lorenzo Bianconi [Wed, 30 Aug 2017 11:50:40 +0000 (13:50 +0200)]
iio: st_sensors: decouple irq1 configuration parameters from the irq2 ones

Separate data-ready configuration parameters for INT1 and INT2 pins in
st_sensor_data_ready_irq data structure. That change will be use to
properly support LIS2DW12 accel sensor.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: st_sensors: add register mask for status register
Lorenzo Bianconi [Wed, 30 Aug 2017 11:50:39 +0000 (13:50 +0200)]
iio: st_sensors: add register mask for status register

Introduce register mask for data-ready status register since
pressure sensors (e.g. LPS22HB) export just two channels
(BIT(0) and BIT(1)) and BIT(2) is marked reserved while in
st_sensors_new_samples_available() value read from status register
is masked using 0x7.
Moreover do not mask status register using active_scan_mask since
now status value is properly masked and if the result is not zero the
interrupt has to be consumed by the driver. This fix an issue on LPS25H
and LPS331AP where channel definition is swapped respect to status
register.
Furthermore that change allows to properly support new devices
(e.g LIS2DW12) that report just ZYXDA (data-ready) field in status register
to figure out if the interrupt has been generated by the device.

Fixes: 97865fe41322 (iio: st_sensors: verify interrupt event to status)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: mcp320x: Add support for mcp3550/1/3
Lukas Wunner [Sat, 9 Sep 2017 18:32:41 +0000 (20:32 +0200)]
iio: adc: mcp320x: Add support for mcp3550/1/3

These ADCs are marketed as single-channel 22 bit delta-sigma ADCs, but
in reality their resolution is 21 bit with an overrange or underrange
of 12% beyond Vref.  In other words, "full scale" means +/- 2^20.

This driver does not explicitly signal back to the user when an
overrange or underrange occurs, but the user can detect it by comparing
the raw value to +/- 2^20 (or the scaled value to Vref).

The chips feature an extended temperature range and high accuracy,
low noise characteristics, but their conversion times are slow with
up to 80 ms +/- 2% (on the MCP3550-50).

Hence, unlike the other ADCs supported by the driver, conversion does
not take place in realtime upon lowering CS.  Instead, CS is asserted
for 8 usec to start the conversion.  After waiting for the duration of
the conversion, the result can be fetched.  While waiting, control of
the bus is ceased so it may be used by a different device.

After the result has been fetched and 10 us have passed, the chip goes
into shutdown and an additional power-up delay of 144 clock periods is
then required to wake the analog circuitry upon the next conversion
(footnote below table 4-1, page 16 in the spec).

Optionally, the chips can be used in so-called "continuous conversion
mode":  Conversions then take place continuously and the last result may
be fetched at any time without observing a delay.  The mode is enabled
by permanently driving CS low, e.g. by wiring it to ground.  The driver
only supports "single conversion mode" for now but should be adaptable
to "continuous conversion mode" with moderate effort.

The chips clock out a 3 byte word, unlike the other ADCs supported by
the driver which all have a lower resolution than 16 bit and thus make
do with 2 bytes.  Calculate the word length on probe by rounding up the
resolution to full bytes.  Crucially, if the clock idles low, the
transfer is preceded by a useless Data Ready bit which increases its
length from 24 bit to 25 bit = 4 bytes (section 5.5 in the spec).
Autosense this based on the SPI slave's configuration.

Cc: Mathias Duckeck <m.duckeck@kunbus.de>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: adc: ad7192: use driver private lock to protect hardware state changes
Aastha Gupta [Wed, 27 Sep 2017 06:31:59 +0000 (12:01 +0530)]
staging: iio: adc: ad7192: use driver private lock to protect hardware state changes

The IIO subsystem is redefining iio_dev->mlock to be used by
the IIO core only for protecting device operating mode changes.
ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes.

In this driver, mlock was being used to protect hardware state
changes.  Replace it with a driver private lock.

Also, as there are state changes in the ad7192_ write_raw function, a lock
is added to prevent the concurrent state changes.

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: ina2xx: Adhere to documented ABI, use Ohm instead of uOhm
Stefan Brüns [Sun, 1 Oct 2017 19:48:17 +0000 (21:48 +0200)]
iio: adc: ina2xx: Adhere to documented ABI, use Ohm instead of uOhm

According to the ABI documentation, the shunt resistor value should be
specificied in Ohm. As this is also used/documented for the MAX9611,
use the same for the INA2xx driver.

This poses an ABI break for anyone actually altering the shunt value
through the sysfs interface, it does not alter the default value nor
a value set from the devicetree.

Minor change: Fix comment, 1mA is 10^-3A.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: imu: st_lsm6dsx: add FIFO ops data structure
Lorenzo Bianconi [Mon, 2 Oct 2017 16:37:40 +0000 (18:37 +0200)]
iio: imu: st_lsm6dsx: add FIFO ops data structure

Introduce FIFO ops data structure to contain FIFO related parameters
in order to properly support more devices in st_lsm6dsx driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: imu: st_lsm6dsx: move decimator info in st_lsm6dsx_sensor_settings
Lorenzo Bianconi [Mon, 2 Oct 2017 16:37:39 +0000 (18:37 +0200)]
iio: imu: st_lsm6dsx: move decimator info in st_lsm6dsx_sensor_settings

Move FIFO decimator info in st_lsm6dsx_sensor_settings list since
decimator registers are exported in register map just in
lsm6ds3/lsm6ds3h/lsm6dsl/lsm6dsm sensors and not in other compliant
devices

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: imu: st_lsm6dsx: split fifo mode and fifo odr configuration
Lorenzo Bianconi [Mon, 2 Oct 2017 16:37:38 +0000 (18:37 +0200)]
iio: imu: st_lsm6dsx: split fifo mode and fifo odr configuration

Separate fifo mode and max fifo sample rate configuration.
That change will be necessary to reuse st_lsm6dsx_set_fifo_mode()
routine and to support more devices in st_lsm6dsx driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: imu: st_lsm6dsx: convert max_fifo_size in FIFO sample size
Lorenzo Bianconi [Mon, 2 Oct 2017 16:37:37 +0000 (18:37 +0200)]
iio: imu: st_lsm6dsx: convert max_fifo_size in FIFO sample size

Express max fifo depth in ST_LSM6DSX_SAMPLE_SIZE instead of in bytes.
That change will be necessary to properly support more devices
in st_lsm6dsx driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: rcar-gyroadc: Use of_device_get_match_data() helper
Geert Uytterhoeven [Wed, 4 Oct 2017 12:08:26 +0000 (14:08 +0200)]
iio: adc: rcar-gyroadc: Use of_device_get_match_data() helper

Use the of_device_get_match_data() helper instead of open coding.
Note that the rcar-gyroadc driver is used with DT only, so there's
always a valid match.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: rcar-gyroadc: Enable compile-testing on non-ARM
Geert Uytterhoeven [Wed, 4 Oct 2017 12:08:25 +0000 (14:08 +0200)]
iio: adc: rcar-gyroadc: Enable compile-testing on non-ARM

The rcar-gyroadc driver compiles fine on other platforms, hence increase
compile coverage.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: rcar-gyroadc: Cast pointer to uintptr_t to fix warning on 64-bit
Geert Uytterhoeven [Wed, 4 Oct 2017 12:08:24 +0000 (14:08 +0200)]
iio: adc: rcar-gyroadc: Cast pointer to uintptr_t to fix warning on 64-bit

On 64-bit:

    drivers/iio/adc/rcar-gyroadc.c: In function 'rcar_gyroadc_parse_subdevs':
    drivers/iio/adc/rcar-gyroadc.c:352:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       childmode = (unsigned int)of_id->data;
   ^

Cast the pointer to uintptr_t instead of unsigned int to fix this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: ade7753: expanding buffer lock to cover both buffer and state protection
Himanshi Jain [Sat, 30 Sep 2017 20:05:21 +0000 (01:35 +0530)]
staging: iio: ade7753: expanding buffer lock to cover both buffer and state protection

Dropping the extra lock (used for protecting the write frequency) by
expanding the buffer lock to cover both buffer and state protection.

Doing this by introducing a new function (__ade7753_spi_write_reg_16)
making buffer changes without locking the state, to avoid nested locks
while making device frequency changes.

Signed-off-by: Himanshi Jain <himshijain.hj@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: dummy: evgen: use irq_sim
Bartosz Golaszewski [Thu, 28 Sep 2017 10:56:41 +0000 (12:56 +0200)]
iio: dummy: evgen: use irq_sim

Switch to using the recently added interrupt simulator for dummy irqs.

Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: tsl2x7x: migrate in_illuminance0_integration_time sysfs attribute to...
Brian Masney [Sat, 30 Sep 2017 01:09:20 +0000 (21:09 -0400)]
staging: iio: tsl2x7x: migrate in_illuminance0_integration_time sysfs attribute to iio_chan_spec

The driver explicitly creates the in_illuminance0_integration_time sysfs
attribute outside the IIO core. This attribute is available in the IIO
core so this patches migrates the attribute to be created by
the iio_chan_spec.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: tsl2x7x: rename tsl2x7x_settings variable to settings
Brian Masney [Sat, 30 Sep 2017 01:09:19 +0000 (21:09 -0400)]
staging: iio: tsl2x7x: rename tsl2x7x_settings variable to settings

The length of the 'tsl2x7x_settings' variable within the tsl2X7X_chip
structure makes some of the line lengths greater than 80 characters for
upcoming patches. This patch shortens the name of the 'tsl2x7x_settings'
variable in this structure to just 'settings' to improve code
readability.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: light: vl6180: Correct ALS scale for non-default gain/integration time
Stefan Brüns [Sun, 24 Sep 2017 21:59:20 +0000 (23:59 +0200)]
iio: light: vl6180: Correct ALS scale for non-default gain/integration time

The reported scale was only correct for the default settings of 100 ms
integration time and gain 1.

This aligns the reported scale with the behaviour of any other IIO driver
and the documented ABI, but may require userspace changes if someone uses
non-default settings.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: light: vl6180: Cleanup als_gain lookup, avoid register readback
Stefan Brüns [Sun, 24 Sep 2017 21:59:19 +0000 (23:59 +0200)]
iio: light: vl6180: Cleanup als_gain lookup, avoid register readback

Instead of manually iterating the array of allowed gain values, use
find_closest. Storing the current gain setting avoids accessing the
hardware on each query.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: light: vl6180: Avoid readback of integration time register
Stefan Brüns [Sun, 24 Sep 2017 21:59:18 +0000 (23:59 +0200)]
iio: light: vl6180: Avoid readback of integration time register

Instead of reading the value from the register on each query, store the
set value.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: light: vl6180: Move range check to integration time setter, cleanup
Stefan Brüns [Sun, 24 Sep 2017 21:59:17 +0000 (23:59 +0200)]
iio: light: vl6180: Move range check to integration time setter, cleanup

This improves code uniformity (range checks for als_gain are also done
in the setter). Also unmangle rounding and calculation of register value.

The calculated integration time it_ms is required in the next patch of
the series.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: accel: kxcjk1013: add support for KXTF9
Michał Mirosław [Sun, 17 Sep 2017 15:01:04 +0000 (17:01 +0200)]
iio: accel: kxcjk1013: add support for KXTF9

KXTF9 has mostly compatible register layout to KXCJK accelerometer.
There is no motion direction interrupt support, but there is tap
direction detection instead (not implemented in this patch).

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: accel: kxcjk1013: make sampling_frequency_avail per-type
Michał Mirosław [Sun, 17 Sep 2017 15:01:03 +0000 (17:01 +0200)]
iio: accel: kxcjk1013: make sampling_frequency_avail per-type

Make sampling_frequency_avail per-type - like sampling_frequency is.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: accel: kxcjk1013: make sysfs/sampling_frequency_avail dynamic
Michał Mirosław [Sun, 17 Sep 2017 15:01:03 +0000 (17:01 +0200)]
iio: accel: kxcjk1013: make sysfs/sampling_frequency_avail dynamic

In preparation for KXTF9 support, make sampling_frequency_avail
attribute dynamic.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: accel: kxcjk1013: extract report_motion_event() from interrupt handler
Michał Mirosław [Sun, 17 Sep 2017 15:01:02 +0000 (17:01 +0200)]
iio: accel: kxcjk1013: extract report_motion_event() from interrupt handler

Extract reporting of motion event direction from interrupt handler,
as it is not supported by KXTF9.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: accel: kxcjk1013: fix INT_CTRL/INT_SRC1 bit names
Michał Mirosław [Sun, 17 Sep 2017 15:01:02 +0000 (17:01 +0200)]
iio: accel: kxcjk1013: fix INT_CTRL/INT_SRC1 bit names

Fix INT_CTRL1 bit names to match register name and add names
for INT_SRC1 bits.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: accel: kxcjk1003: refactor ODR setting
Michał Mirosław [Sun, 17 Sep 2017 15:01:01 +0000 (17:01 +0200)]
iio: accel: kxcjk1003: refactor ODR setting

Refactor ODR/WUF setting code in preparation of KXTF9 support.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: accel: mma8452: Rename read/write event value callbacks to generic function...
Harinath Nampally [Mon, 25 Sep 2017 10:40:08 +0000 (06:40 -0400)]
iio: accel: mma8452: Rename read/write event value callbacks to generic function name.

'mma8452_read_thresh' and 'mma8452_write_thresh' functions
does more than just read/write threshold values.
They also handle  IIO_EV_INFO_HIGH_PASS_FILTER_3DB and
IIO_EV_INFO_PERIOD therefore renaming to generic names.

Improves code readability, no impact on functionality.

Signed-off-by: Harinath Nampally <harinath922@gmail.com>
Acked-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: sun4i-gpadc-iio: do not fail probing when no thermal DT node
Quentin Schulz [Tue, 26 Sep 2017 12:52:19 +0000 (14:52 +0200)]
iio: adc: sun4i-gpadc-iio: do not fail probing when no thermal DT node

Before this patch, forgetting to put a thermal-zones DT node would
result in the driver failing to probe.

It should be perfectly acceptable to have the driver probe even if no
thermal-zones DT is found. However, it shouldn't want to fail if the
thermal registering fail for any other reason (waiting for other drivers
for example) so check on ENODEV only.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: sun4i-gpadc-iio: register in the thermal after registering in pm
Quentin Schulz [Tue, 26 Sep 2017 12:52:18 +0000 (14:52 +0200)]
iio: adc: sun4i-gpadc-iio: register in the thermal after registering in pm

This driver has a get_temp function used by the thermal framework that
uses pm functions.

However, the driver isn't registered in pm before it is registered in
thermal framework, resulting in the pm_resume not being called and thus
the IP not enabled.

When the IP is disabled, the raw temp value is always 0. With the
devices currently supported, it isn't a problem since with their
respective formula, they return a really cold SoC temperature which
isn't a problem for the thermal framework. But for future SoC that have
a different formula, it could return a critically hot temperature,
forcing the thermal framework to shutdown the board.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: dac: ds4422/ds4424 dac driver
Ismail H. Kose [Mon, 25 Sep 2017 19:14:11 +0000 (12:14 -0700)]
iio: dac: ds4422/ds4424 dac driver

This patch provides an iio device driver for DS4422/DS4424 chips that support
two/four channel 7-bit Sink/Source Current DAC.

Signed-off-by: Ismail H. Kose <Ismail.Kose@maximintegrated.com>
Signed-off-by: Ismail H. Kose <ihkose@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio:dac: Add DT binding documentation for ds4424
Ismail H. Kose [Fri, 22 Sep 2017 20:12:09 +0000 (13:12 -0700)]
iio:dac: Add DT binding documentation for ds4424

Signed-off-by: Ismail H. Kose <ihkose@gmail.com>
Signed-off-by: Ismail H. Kose <Ismail.Kose@maximintegrated.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>