openwrt/staging/blogic.git
7 years agostaging: rtl8723bs: Fix indenting mistakes in core/rtw_mlme.c
Larry Finger [Sat, 8 Apr 2017 16:07:38 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting mistakes in core/rtw_mlme.c

Smatch reports the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_mlme.c
drivers/staging/rtl8723bs/core/rtw_mlme.c:862 rtw_survey_event_callback() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_mlme.c:1102 rtw_free_assoc_resources() warn: if statement not indented
drivers/staging/rtl8723bs/core/rtw_mlme.c:1165 rtw_indicate_disconnect() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_mlme.c:2830 rtw_restructure_ht_ie() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_mlme.c:2991 rtw_update_ht_cap() warn: inconsistent indenting

All of there are simple white-space errors. A typo is also fixed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting mistakes in core/rtw_ieee80211.c
Larry Finger [Sat, 8 Apr 2017 16:07:37 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting mistakes in core/rtw_ieee80211.c

Smatch reports the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_ieee80211.c
drivers/staging/rtl8723bs/core/rtw_ieee80211.c:83 rtw_is_cckrates_included() warn: if statement not indented
drivers/staging/rtl8723bs/core/rtw_ieee80211.c:98 rtw_is_cckratesonly_included() warn: if statement not indented

These warnings are fixed with white-space changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting mistake in core/rtw_ap.c
Larry Finger [Sat, 8 Apr 2017 16:07:36 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting mistake in core/rtw_ap.c

Smatch reports the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_ap.c
drivers/staging/rtl8723bs/core/rtw_ap.c:382 expire_timeout_chk() warn: inconsistent indenting

Fixing this requires changing the indentatikon of a long for loop.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix possible usage of NULL pointer in core/rtw_debug.c
Larry Finger [Sat, 8 Apr 2017 16:07:35 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix possible usage of NULL pointer in core/rtw_debug.c

Smatch reports the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_debug.c
drivers/staging/rtl8723bs/core/rtw_debug.c:454 proc_get_survey_info() error: we previously assumed 'phead' could be null (see line 453)
drivers/staging/rtl8723bs/core/rtw_debug.c:455 proc_get_survey_info() warn: variable dereferenced before check 'phead' (see line 454)

In the code, there are two successive calls to get_head(). The second
is removed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting problems in core/rtw_xmit.c
Larry Finger [Sat, 8 Apr 2017 16:07:34 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting problems in core/rtw_xmit.c

Smatch logs the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_xmit.c
drivers/staging/rtl8723bs/core/rtw_xmit.c:277 _rtw_init_xmit_priv() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_xmit.c:294 _rtw_free_xmit_priv() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_xmit.c:295 _rtw_free_xmit_priv() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_xmit.c:946 xmitframe_addmic() warn: inconsistent indenting

These are fixed with white-space changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting problem for hal/hal_com.c
Larry Finger [Sat, 8 Apr 2017 16:07:33 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting problem for hal/hal_com.c

Smatch lists the following:

  CHECK   drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c:2090 Hal_ChannelPlanToRegulation() warn: inconsistent indenting

Fixed by changing the white space.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indening problem in hal/hal_com_phycfg.c
Larry Finger [Sat, 8 Apr 2017 16:07:32 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indening problem in hal/hal_com_phycfg.c

Smatch reports the following:

  CHECK   drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c:2090 Hal_ChannelPlanToRegulation() warn: inconsistent indenting

This warning is fixed with a white-space change.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting problems in hal/HalHWImg8723B_BB.c
Larry Finger [Sat, 8 Apr 2017 16:07:31 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting problems in hal/HalHWImg8723B_BB.c

Smatch lists the following:

  CHECK   drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c
drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c:314 ODM_ReadAndConfig_MP_8723B_AGC_TAB() warn: for statement not indented
drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c:583 ODM_ReadAndConfig_MP_8723B_PHY_REG() warn: for statement not indented
drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c:586 ODM_ReadAndConfig_MP_8723B_PHY_REG() warn: inconsistent indenting

These were all fixed with white-space changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix potential usage while NULL error in hal/rtl8723b_hal_init.c
Larry Finger [Sat, 8 Apr 2017 16:07:30 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix potential usage while NULL error in hal/rtl8723b_hal_init.c

Smatch logs the following:

  CHECK   drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:518 rtl8723b_FirmwareDownload() error: we previously assumed 'pFirmware' could be null (see line 382)

Fixing this error required a rewrite of the error exits from this routine.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix various errors in os_dep/ioctl_cfg80211.c
Larry Finger [Sat, 8 Apr 2017 16:07:29 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix various errors in os_dep/ioctl_cfg80211.c

Smatch lists the following:

  CHECK   drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:470 rtw_cfg80211_ibss_indicate_connect() error: we previously assumed 'scanned' could be null (see line 466)
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:942 rtw_cfg80211_set_encryption() warn: inconsistent indenting
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:955 rtw_cfg80211_set_encryption() error: buffer overflow 'psecuritypriv->dot11DefKey' 4 <= 4
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:1017 rtw_cfg80211_set_encryption() error: buffer overflow 'padapter->securitypriv.dot118021XGrpKey' 5 <= 5
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:1216 cfg80211_rtw_set_default_key() warn: inconsistent indenting
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2498 rtw_cfg80211_monitor_if_xmit_entry() error: we previously assumed 'skb' could be null (see line 2495)
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2850 cfg80211_rtw_start_ap() warn: if statement not indented
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2860 cfg80211_rtw_start_ap() warn: if statement not indented
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:3417 rtw_cfg80211_preinit_wiphy() warn: inconsistent indenting
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:3547 rtw_wdev_alloc() info: ignoring unreachable code.

The indenting warnings were fixed by simple white space changes.

The section where 'scanned' could be null required an immediate exit from
the routine at that point. A similar fix was required where 'skb' could be null.

The two buffer overflow errors were caused by off-by-one errors. While
locating these problems, another one was found in os_dep/ioctl_linux.c.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting mistake in os_dep/mlme_linux.c
Larry Finger [Sat, 8 Apr 2017 16:07:28 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting mistake in os_dep/mlme_linux.c

Smatch reports the following warning:

  CHECK   drivers/staging/rtl8723bs/os_dep/mlme_linux.c
drivers/staging/rtl8723bs/os_dep/mlme_linux.c:149 rtw_os_indicate_disconnect() warn: inconsistent indenting

Again, a simple change in the white space fixes this problem.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting warning in os_dep/os_intfs.c
Larry Finger [Sat, 8 Apr 2017 16:07:27 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting warning in os_dep/os_intfs.c

Smatch logs the following warning:

  CHECK   drivers/staging/rtl8723bs/os_dep/os_intfs.c
drivers/staging/rtl8723bs/os_dep/os_intfs.c:1082 ips_netdrv_open() warn: inconsistent indenting

A simple change in the white space handles this warning.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix dereference before check warning in os_dep/recv_linux.c
Larry Finger [Sat, 8 Apr 2017 16:07:26 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix dereference before check warning in os_dep/recv_linux.c

Smatch lists the following warning:

  CHECK   drivers/staging/rtl8723bs/os_dep/recv_linux.c
drivers/staging/rtl8723bs/os_dep/recv_linux.c:353 rtw_recv_indicatepkt() warn: variable dereferenced before check 'precv_frame' (see line 312)

This warning is fixed by removing the test at line 353.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting warning in os_dep/rtw_proc.c
Larry Finger [Sat, 8 Apr 2017 16:07:25 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting warning in os_dep/rtw_proc.c

Smatch lists the following warning:

  CHECK   drivers/staging/rtl8723bs/os_dep/rtw_proc.c
drivers/staging/rtl8723bs/os_dep/rtw_proc.c:102 rtw_drv_proc_open() warn: inconsistent indenting

This warning is fixed with a simple change in the white space.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting warning in os_dep/xmit_linux.c
Larry Finger [Sat, 8 Apr 2017 16:07:24 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting warning in os_dep/xmit_linux.c

Smatch issues the warning

  CHECK   drivers/staging/rtl8723bs/os_dep/xmit_linux.c
drivers/staging/rtl8723bs/os_dep/xmit_linux.c:42 _rtw_pktfile_read() warn: inconsistent indenting

A simple indent changes fixes this.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:r8188eu: remove sw_encrypt member of security_priv struct
Ivan Safonov [Sun, 2 Apr 2017 14:35:40 +0000 (17:35 +0300)]
staging:r8188eu: remove sw_encrypt member of security_priv struct

sw_encrypt always is 0. Replace sw_encrypt with 0.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:r8188eu: remove software_encrypt member of registry_priv struct
Ivan Safonov [Sun, 2 Apr 2017 14:35:39 +0000 (17:35 +0300)]
staging:r8188eu: remove software_encrypt member of registry_priv struct

Value of this variable does not changed after initialization.
Replace software_encrypt with its default value.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:r8188eu: replace rtw_software_encrypt with its default value
Ivan Safonov [Sun, 2 Apr 2017 14:35:38 +0000 (17:35 +0300)]
staging:r8188eu: replace rtw_software_encrypt with its default value

rtw_software_encrypt used only once and does not changed.
Replace it with 0.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:r8188eu: remove sw_decrypt member of security_priv struct
Ivan Safonov [Sun, 2 Apr 2017 14:35:37 +0000 (17:35 +0300)]
staging:r8188eu: remove sw_decrypt member of security_priv struct

sw_decrypt always is 0, so replace it with 0.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:r8188eu: remove software_decrypt member of registry_priv struct
Ivan Safonov [Sun, 2 Apr 2017 14:35:36 +0000 (17:35 +0300)]
staging:r8188eu: remove software_decrypt member of registry_priv struct

Value of this variable has no changes, and used once.
Replace software_decrypt with its value.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:r8188eu: replace rtw_software_decrypt with its value
Ivan Safonov [Sun, 2 Apr 2017 14:35:35 +0000 (17:35 +0300)]
staging:r8188eu: replace rtw_software_decrypt with its value

rtw_software_decrypt used only once and does not changed.
Replace it with 0.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: add parenthesis to macros
Haim Daniel [Wed, 29 Mar 2017 07:58:56 +0000 (10:58 +0300)]
staging: vc04_services: add parenthesis to macros

vchi_cfg.h: fix checkpatch ERROR: Macros with complex values should be enclosed in parenthesis

Signed-off-by: Haim Daniel <haimdaniel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: drivers: s626.c - fixed checkpatch issue about data type
Andrea della Porta [Fri, 7 Apr 2017 00:16:37 +0000 (01:16 +0100)]
staging: comedi: drivers: s626.c - fixed checkpatch issue about data type

staging: comedi: drivers: s626.c - fixed the following checkpatch issue:
CHECK: Prefer kernel type 's16' over 'int16_t'
#1939: FILE: drivers/staging/comedi/drivers/s626.c:1939:
+               int16_t dacdata = (int16_t)data[i];

Signed-off-by: Andrea della Porta <sfaragnaus@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rts5208: ms.c fixed checkpatch warning - using __func__ instead of hardcoded...
Andrea della Porta [Fri, 7 Apr 2017 00:00:41 +0000 (01:00 +0100)]
staging: rts5208: ms.c fixed checkpatch warning - using __func__ instead of hardcoded name

staging: rts5208: ms.c Fixed checkpatch warning:
WARNING: Prefer using "%s", __func__ to embedded function names
#2597: FILE: rts5208/ms.c:2597:
+       dev_dbg(rtsx_dev(chip), "ms_build_l2p_tbl: %d\n", seg_no);

Signed-off-by: Andrea della Porta <sfaragnaus@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: fsl-mc/dpio: Fix early writing of valid bit
Ioana Radulescu [Wed, 5 Apr 2017 13:24:17 +0000 (08:24 -0500)]
staging: fsl-mc/dpio: Fix early writing of valid bit

Commands written to the QMan software portals have a valid
bit in the "verb" field of the command that, when set with
the right value, notifies the hardware that the command is
fully written and ready to be processed.

The "verb" field should be the last one to be written in the
swp command registers, after all other fields are filled in.
The current implementation doesn't follow this rule for all
commands, which may result in an incompletely configured
command being processed by the hardware. Enforce the correct
order of writes to avoid this situation.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8712: fixed multiple line derefence issue
Prasant Jalan [Mon, 3 Apr 2017 06:15:10 +0000 (11:45 +0530)]
staging: rtl8712: fixed multiple line derefence issue

Checkpatch emits WARNING: Avoid multiple line dereference.

Checkpatch warning is fixed by:
* Trivial indentation improvement and
* Using += instead of + helps shortening the statement.

Signed-off-by: Prasant Jalan <prasant.jalan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8712: code style fix
Tejaswini Poluri [Thu, 30 Mar 2017 15:11:54 +0000 (20:41 +0530)]
staging: rtl8712: code style fix

Fixed the warnings from checkpatch.pl on file rtl8712/mlme_linux.c
Avoided multiple line dereferences in the code

Signed-off-by: Tejaswini Poluri <tejaswinipoluri3@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: fbtft: fix type assignment warning
Alex Wilson [Thu, 30 Mar 2017 07:16:02 +0000 (01:16 -0600)]
staging: fbtft: fix type assignment warning

Sparse spits out a warning that a __be16 was being assigned to a u16.
Change the type of txbuf16 to __be16 b/c it's a restricted type and
prevents mixing endianness.

Signed-off-by: Alex Wilson <alex.david.wilson@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: xgifb: added blankline after decl.
Andrea della Porta [Tue, 28 Mar 2017 23:09:19 +0000 (00:09 +0100)]
staging: xgifb: added blankline after decl.

Fixed checkpatch warning:
WARNING: Missing a blank line after declarations
#882: FILE: drivers/staging/xgifb/XGI_main_26.c:882:
+                               const u8 *f =
XGI_TV_filter[filter_tb].filter[filter];
+                               pr_debug("FilterTable[%d]-%d: %*ph\n",

Signed-off-by: Andrea della Porta <sfaragnaus@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: sm750fb: removed line continuations in quoted strings
Prasant Jalan [Fri, 31 Mar 2017 19:10:02 +0000 (00:40 +0530)]
staging: sm750fb: removed line continuations in quoted strings

checkpatch gives WARNING: Avoid line continuations in quoted strings.

Trivial fix by removing line continuations and adding another quote at
the start of next line.

Signed-off-by: Prasant Jalan <prasant.jalan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: sm750fb: fixing function return with lock held
Prasant Jalan [Fri, 31 Mar 2017 19:10:01 +0000 (00:40 +0530)]
staging: sm750fb: fixing function return with lock held

lynxfb_suspend() & lynxfb_resume() return on errors while holding
console_lock.

Adding 'goto' such that proper cleanups can be done before returning
from function and therefore console_lock can be released before
returning.

Signed-off-by: Prasant Jalan <prasant.jalan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: sm750fb: ddk750_display.c - fixed checkpatch warning: line over 80 chars
Andrea della Porta [Fri, 7 Apr 2017 00:24:39 +0000 (01:24 +0100)]
staging: sm750fb: ddk750_display.c - fixed checkpatch warning: line over 80 chars

staging: sm750fb: ddk750_display.c - fixed the following checkpatch warning:
WARNING: line over 80 characters
#149: FILE: drivers/staging/sm750fb/ddk750_display.c:149:
+               swPanelPowerSequence((output & PNL_SEQ_MASK) >> PNL_SEQ_OFFSET, 4);

Signed-off-by: Andrea della Porta <sfaragnaus@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-audio: remove unnecessary log messages
Aishwarya Pant [Mon, 3 Apr 2017 18:33:43 +0000 (00:03 +0530)]
staging: bcm2835-audio: remove unnecessary log messages

Remove unnecessary log messages in the driver which are just tracking
function entry and exits.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-camera: fix spelling mistake: "elementry" -> "elementary"
Colin Ian King [Thu, 30 Mar 2017 09:34:03 +0000 (10:34 +0100)]
staging: bcm2835-camera: fix spelling mistake: "elementry" -> "elementary"

trivial fix to spelling mistake in various comments and pr_debug messages

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging wlan-ng: fix type mismatch warnings in mkpdrlist()
Maciek Borzecki [Sat, 8 Apr 2017 14:04:42 +0000 (16:04 +0200)]
staging wlan-ng: fix type mismatch warnings in mkpdrlist()

struct  hfa384x_pdrec len and code fields as clearly little endian,
mark both fields as such. pda->buf is also clearly little endian.

Fixes sparse warnings:

  drivers/staging/wlan-ng/prism2fw.c:613:16: warning: cast to restricted __le16
  drivers/staging/wlan-ng/prism2fw.c:616:21: warning: cast to restricted __le16
  drivers/staging/wlan-ng/prism2fw.c:625:21: warning: cast to restricted __le16

Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: amplc_pci224: convert CLK_CONFIG() macro to function
Ian Abbott [Tue, 4 Apr 2017 10:32:27 +0000 (11:32 +0100)]
staging: comedi: amplc_pci224: convert CLK_CONFIG() macro to function

Convert the `CLK_CLKFIG(chan, src)` macro to a static function
`pci224_clk_config(chan, src)`.  This is consistent with an earlier
change to convert `GAT_CONFIG(chan, src)` to a static function.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: amplc_pci224: remove 'inline' from pci224_gat_config()
Ian Abbott [Tue, 4 Apr 2017 10:32:26 +0000 (11:32 +0100)]
staging: comedi: amplc_pci224: remove 'inline' from pci224_gat_config()

Let the compiler figure out whether `pci224_gat_confip()` should be
inlined by itself.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: amplc_pci230: convert CLK_CONFIG() macro to function
Ian Abbott [Tue, 4 Apr 2017 10:29:54 +0000 (11:29 +0100)]
staging: comedi: amplc_pci230: convert CLK_CONFIG() macro to function

Convert the `CLK_CONFIG(chan, src)` macro to a static function
`pci230_clk_config(chan, src)`.  This is consistent with an earlier
change to convert `GAT_CONFIG(chan, src)` to a static function.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: amplc_pci230: remove 'inline' from pci230_gat_config()
Ian Abbott [Tue, 4 Apr 2017 10:29:53 +0000 (11:29 +0100)]
staging: comedi: amplc_pci230: remove 'inline' from pci230_gat_config()

Let the compiler figure out whether `pci230_gat_config()` should be
inlined by itself.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: wilc1000: fix incorrect strncasecmp length
Colin Ian King [Fri, 7 Apr 2017 23:44:03 +0000 (00:44 +0100)]
staging: wilc1000: fix incorrect strncasecmp length

The strncasecmp of buff against the literal string RSSI
is using variable length which is zero. This should be instead
using the variable size instead.  Also remove the redundant
variable length.

Detected by PVS-Studio, warning: V575

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: wilc1000: Fix problem with wrong vif index
Aditya Shankar [Fri, 7 Apr 2017 11:54:58 +0000 (17:24 +0530)]
staging: wilc1000: Fix problem with wrong vif index

The vif->idx value is always 0 for two interfaces.

wl->vif_num = 0;

loop {
     ...

     vif->idx = wl->vif_num;
     ...
     wl->vif_num = i;
      ....
     i++;
     ...
}

At present, vif->idx is assigned the value of wl->vif_num
at the beginning of this block and device is initialized
based on this index value.
In the next iteration, wl->vif_num is still 0 as it is only updated
later but gets assigned to vif->idx in the beginning. This causes problems
later when we try to reference a particular interface and also while
configuring the firmware.

This patch moves the assignment to vif->idx from the beginning
of the block to after wl->vif_num is updated with latest value of i.

Fixes: commit 735bb39ca3be ("staging: wilc1000: simplify vif[i]->ndev accesses")
Cc: <stable@vger.kernel.org>
Signed-off-by: Aditya Shankar <aditya.shankar@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: wilc1000: Use new format for configuring firmware
Aditya Shankar [Fri, 7 Apr 2017 11:51:43 +0000 (17:21 +0530)]
staging: wilc1000: Use new format for configuring firmware

The configuration packet format has changed in the newer wilc
firmware versions 14.2 and up. This update ensures that the
firmware is initialized correctly by the host and configured
in the required mode.

Signed-off-by: Aditya Shankar <aditya.shankar@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192u: ieee80211: Fix space required after }.
Valerio Genovese [Thu, 6 Apr 2017 06:13:16 +0000 (08:13 +0200)]
staging: rtl8192u: ieee80211: Fix space required after }.

This was reported in checkpatch.pl:
ERROR: space required after that close brace '}'

Changes in v2:
add space after close brace '}' also at line 35, before it
was only for 34.

Signed-off-by: Valerio Genovese <valerio.click@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: Remove extra spaces
Alfonso Lima Astor [Thu, 30 Mar 2017 20:49:33 +0000 (21:49 +0100)]
staging: rtl8188eu: Remove extra spaces

Coding style problem detected by checkpatch.pl
ERROR: space prohibited before that ','

Signed-off-by: Alfonso Lima Astor <alfonsolimaastor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: Macros with complex values should be enclosed in parentheses
Alfonso Lima Astor [Wed, 29 Mar 2017 19:20:32 +0000 (20:20 +0100)]
staging: rtl8188eu: Macros with complex values should be enclosed in parentheses

This macro is not used and also had a style error. I have run
grep and compiled the module to be sure.

Signed-off-by: Alfonso Lima Astor <alfonsolimaastor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: nvec: Remove FSF's mailing address
Riku Salminen [Fri, 31 Mar 2017 13:10:32 +0000 (16:10 +0300)]
Staging: nvec: Remove FSF's mailing address

Removed Free Software Foundation's address from the copyright notice
and replaced it with a link to http://www.gnu.org/licenses

Signed-off-by: Riku Salminen <riku@laatikko.io>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: labpc: fix isadma dependency
Arnd Bergmann [Wed, 29 Mar 2017 21:10:09 +0000 (23:10 +0200)]
staging: comedi: labpc: fix isadma dependency

When COMEDI_NI_LABPC is built-in and COMEDI_NI_LABPC_ISA is a loadable
module, thhe ISA DMA code is not reachable by the common module, causing
a link error:

drivers/staging/built-in.o: In function `labpc_interrupt':
ni_labpc_common.c:(.text+0x1d178): undefined reference to `labpc_handle_dma_status'
ni_labpc_common.c:(.text+0x1d1cb): undefined reference to `labpc_drain_dma'
drivers/staging/built-in.o: In function `labpc_ai_cmd':
ni_labpc_common.c:(.text+0x1d8ad): undefined reference to `labpc_setup_dma'

This changes the definition of COMEDI_NI_LABPC_ISADMA so that it will
also be builtin for that case. This looks like a rather old bug, but
I have never seen this in randconfig testing until today.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: Add rtl8723bs sdio wifi driver
Hans de Goede [Wed, 29 Mar 2017 17:47:51 +0000 (19:47 +0200)]
staging: Add rtl8723bs sdio wifi driver

The rtl8723bs is found on quite a few systems used by Linux users,
such as on Atom systems (Intel Computestick and various other
Atom based devices) and on many (budget) ARM boards such as
the CHIP.

The plan moving forward with this is for the new clean,
written from scratch, rtl8xxxu driver to eventually gain
support for sdio devices. But there is no clear timeline
for that, so lets add this driver included in staging for now.

Cc: Bastien Nocera <hadess@hadess.net>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Jes Sorensen <jes.sorensen@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vt6656: Split arguments to avoid 80-char violation in rf.c
Dan Cashman [Sun, 2 Apr 2017 20:48:12 +0000 (13:48 -0700)]
staging: vt6656: Split arguments to avoid 80-char violation in rf.c

Wrap arguments of call to vnt_control_out() to avoid exceeding 80
character limit, but maintain alignment.

Signed-off-by: Daniel Cashman <dan.a.cashman@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vt6656: Replace embedded function name with __func__ in rf.c
Dan Cashman [Sun, 2 Apr 2017 20:48:11 +0000 (13:48 -0700)]
staging: vt6656: Replace embedded function name with __func__ in rf.c

Change embedded function name in vnt_rf_set_txpower with %s format with
__func__ argument to make it consistent with other part of if-else and
kernel coding style standards as reported by checkpatch.

Signed-off-by: Daniel Cashman <dan.a.cashman@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vt6656: convert spaces to tabs for rf.c
Dan Cashman [Sun, 2 Apr 2017 20:48:10 +0000 (13:48 -0700)]
staging: vt6656: convert spaces to tabs for rf.c

Address checkpatch errors encountered in rf.c by removing use of spaces
and replacing with properly aligned tabs.

Signed-off-by: Daniel Cashman <dan.a.cashman@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: fix kernel BUG discovered by day0 testing
David Kershner [Fri, 31 Mar 2017 18:20:12 +0000 (14:20 -0400)]
staging: unisys: visorbus: fix kernel BUG discovered by day0 testing

Kernel day0 testing robot reported a kernel BUG at drivers/base/driver.c!
with the following call stack:

[   14.963563] ------------[ cut here ]------------
[   14.967298] kernel BUG at drivers/base/driver.c:153!
[   14.970948] invalid opcode: 0000 [#1] SMP
[   14.974013] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.11.0-rc4-00790-g0789e2c #1
[   14.978221] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.3-20161025_171302-gandalf 04/01/2014
[   14.983417] task: ffff88001ea46040 task.stack: ffffc90000008000
[   14.987315] RIP: 0010:driver_register+0xa1/0xd0
[   14.990044] RSP: 0000:ffffc9000000be60 EFLAGS: 00010246
[   14.993039] RAX: 0000000000000000 RBX: ffffffff831d4c20 RCX: 0000000000000000
[   14.997040] RDX: 000000000000004d RSI: ffffffff831d47c0 RDI: ffffffff831d4c20
[   15.001511] RBP: ffffc9000000be78 R08: ffffc9000000be78 R09: ffffc9000000be7c
[   15.006163] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[   15.010068] R13: 00000000ffffffff R14: ffffffff832f3923 R15: 0000000000000000
[   15.013715] FS:  0000000000000000(0000) GS:ffff88001fa00000(0000) knlGS:0000000000000000
[   15.017460] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   15.021268] CR2: 0000000000000000 CR3: 0000000003009000 CR4: 00000000000006b0
[   15.025633] Call Trace:
[   15.028069]  ? visorbus_register_visor_driver+0x3f/0x60
[   15.031065]  ? init_unisys+0x3a/0x90
[   15.033562]  ? device_resume_response+0x50/0x50
[   15.036083]  visorinput_init+0x10/0x20
[   15.038937]  do_one_initcall+0x9a/0x164
[   15.041838]  ? set_debug_rodata+0x12/0x12
[   15.045333]  kernel_init_freeable+0x11e/0x1a1
[   15.048369]  ? rest_init+0x80/0x80
[   15.050813]  kernel_init+0x9/0x100
[   15.053353]  ret_from_fork+0x2c/0x40
[   15.056009] Code: ff 85 c0 41 89 c4 75 13 48 8b 7b 70 31 f6 e8 97 16 be ff 44 89 e0 5b 41 5c 5d c3 48 89 df e8 57 e1 ff ff 44 89 e0 5b 41 5c 5d c3 <0f> 0b 48 8b 33 48 c7 c7 a0 dd d5 82 e8 ec f0 6f ff 48 8b 73 08
[   15.065144] RIP: driver_register+0xa1/0xd0 RSP: ffffc9000000be60
[   15.068360] ---[ end trace 7d13369c38d80a8f ]---

This bug will occur if the visorbus driver is built-in to the kernel, and
the resulting kernel is run in an environment where visorbus devices are
NOT supported, and an attempt is made to load any of the drivers: visorhba,
visornic, or visorinput.

Checked to see if we have called bus_register, if not do not call
driver_register.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Fixes: 5b6f9b95f7ae ("staging: unisys: visorbus: get rid of create_bus_type.")
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Reviewed-by: David Binder <david.binder@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visornic: Replace symbolic perms with octal
Thomas Jespersen [Thu, 6 Apr 2017 20:58:14 +0000 (22:58 +0200)]
staging: unisys: visornic: Replace symbolic perms with octal

Replace symbolic permissions S_IRUSR and S_IWUSR for their octal
counterparts

Signed-off-by: Thomas Jespersen <laumann.thomas@gmail.com>
Acked-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: fixed ../include/lustre_debug.h is included more than once.
Darryl T. Agostinelli [Sun, 2 Apr 2017 13:28:37 +0000 (08:28 -0500)]
staging: lustre: fixed ../include/lustre_debug.h is included more than once.

$ make includecheck
./drivers/staging/lustre/lustre/ptlrpc/layout.c: ../include/lustre_debug.h is included more than once.

Signed-off-by: Darryl T. Agostinelli <dagostinelli@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers/staging/lustre: Coding-guideline: Missing a blank line after declarations
Pushkar Jambhlekar [Tue, 4 Apr 2017 09:15:26 +0000 (14:45 +0530)]
drivers/staging/lustre: Coding-guideline: Missing a blank line after declarations

Adding a blank line after declaration

Signed-off-by: Pushkar Jambhlekar <pushkar.iit@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: most: usb: pass correct register table
Christian Gromm [Fri, 7 Apr 2017 13:38:40 +0000 (15:38 +0200)]
staging: most: usb: pass correct register table

Inside the function store_value() the table of writable registers need to
be passed to function get_static_reg_addr() or else the correct register
address is never going to be found.

Reported-by: Alex Riesen <alexander.riesen@cetitec.com>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: most: usb: fix size overflow
Andrey Shvetsov [Fri, 7 Apr 2017 13:38:39 +0000 (15:38 +0200)]
staging: most: usb: fix size overflow

Despite the user payload may not be bigger than (2**16 - 1) bytes, the
final packet size may be bigger because of the gap space needed for the
controller.

This patch removes the temporary variables of the type u16 that are used
to hold the offsets that may be bigger than 2**16 bytes.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: most: usb: fix calculation of the extra_len
Andrey Shvetsov [Fri, 7 Apr 2017 13:38:38 +0000 (15:38 +0200)]
staging: most: usb: fix calculation of the extra_len

The final size of the buffer used for the streaming transfer consists of
the size for the user payload (buffer_size) and the size for the gaps
needed by the controller (extra_len).

The current implementation of the hdm_configure_channel() corrects the
buffer size down to the next appropriate for the hardware value, that is
the whole number of frames, but uses the old unaligned value to
calculate the extra_len.

Current patch fixes the described problem.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: most: destroy cdev when channel gets disconnected
Andrey Shvetsov [Fri, 7 Apr 2017 13:38:37 +0000 (15:38 +0200)]
staging: most: destroy cdev when channel gets disconnected

When a channel is being removed while an application holds the
corresponding character device, this device is going to be destroyed only
after the application closes the file descriptor and releases character
device. In case the channel appears again before the application closes the
file descriptor it holds, the channel cannot be linked.

This patch changes the described behavior and destroys the character
device at the time the channel get disconnected from the AIM.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: most: consolidate attributes for list of links
Andrey Shvetsov [Fri, 7 Apr 2017 13:38:36 +0000 (15:38 +0200)]
staging: most: consolidate attributes for list of links

This patch replaces three temporary variables representing the
attributes to control the links between the AIMs and HDMs with an array
of three elements to keep the corresponding code compact.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: most: core: separate property showing links
Andrey Shvetsov [Fri, 7 Apr 2017 13:38:35 +0000 (15:38 +0200)]
staging: most: core: separate property showing links

Currently an AIM has the following properties available to manage links:
  - write-only "remove_link" used to remove a link from a list
  - read/write "add_link" used to add a link to a list and display them

This patch transfers the read functionality of "add_link" to the new
read-only property "links" to build consistent set of properties to control
the list of links.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: most: core: consolidate channel attributes
Andrey Shvetsov [Fri, 7 Apr 2017 13:38:34 +0000 (15:38 +0200)]
staging: most: core: consolidate channel attributes

This patch replaces 13 temporary variables representing the attributes
to control the channel with an array of 13 elements to keep the
corresponding code compact.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: most: core: make use of __ATTR_* macros
Christian Gromm [Fri, 7 Apr 2017 13:38:33 +0000 (15:38 +0200)]
staging: most: core: make use of __ATTR_* macros

This patch replaces the proprietary macros with those provided by the
kernel.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: most: core: fix function names
Christian Gromm [Fri, 7 Apr 2017 13:38:32 +0000 (15:38 +0200)]
staging: most: core: fix function names

This patch fixes the names of the show/store functions to match the naming
convention.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: most: fix comment of the function remove_link_store
Andrey Shvetsov [Fri, 7 Apr 2017 13:38:31 +0000 (15:38 +0200)]
staging: most: fix comment of the function remove_link_store

This patch replaces the name store_remove_link by the remove_link_store
in the comment for the corresponding function.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: most: fix comment of the function add_link_store
Andrey Shvetsov [Fri, 7 Apr 2017 13:38:30 +0000 (15:38 +0200)]
staging: most: fix comment of the function add_link_store

This patch replaces the name store_add_link by the add_link_store in the
comment for the corresponding function.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Remove old platform support
Laura Abbott [Mon, 3 Apr 2017 18:57:54 +0000 (11:57 -0700)]
staging: android: ion: Remove old platform support

Device specific platform support has been haphazard for Ion. There have
been several independent attempts and there are still objections to
what bindings exist right now. Just remove everything for a fresh start.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Remove duplicate ION_IOC_MAP
Laura Abbott [Mon, 3 Apr 2017 18:57:53 +0000 (11:57 -0700)]
staging: android: ion: Remove duplicate ION_IOC_MAP

ION_IOC_MAP is the same as ION_IOC_SHARE. We really don't need two
identical interfaces. Remove it.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Remove import interface
Laura Abbott [Mon, 3 Apr 2017 18:57:52 +0000 (11:57 -0700)]
staging: android: ion: Remove import interface

With the expansion of dma-buf and the move for Ion to be come just an
allocator, the import mechanism is mostly useless. There isn't a kernel
component to Ion anymore and handles are private to Ion. Remove this
interface.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Remove custom ioctl interface
Laura Abbott [Mon, 3 Apr 2017 18:57:51 +0000 (11:57 -0700)]
staging: android: ion: Remove custom ioctl interface

Ion is now moving towards a unified interfact. This makes the custom
ioctl interface unneeded. Remove it.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Remove crufty cache support
Laura Abbott [Mon, 3 Apr 2017 18:57:50 +0000 (11:57 -0700)]
staging: android: ion: Remove crufty cache support

Now that we call dma_map in the dma_buf API callbacks there is no need
to use the existing cache APIs. Remove the sync ioctl and the existing
bad dma_sync calls. Explicit caching can be handled with the dma_buf
sync API.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Remove page faulting support
Laura Abbott [Mon, 3 Apr 2017 18:57:49 +0000 (11:57 -0700)]
staging: android: ion: Remove page faulting support

The new method of syncing with dma_map means that the page faulting sync
implementation is no longer applicable. Remove it.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Call dma_map_sg for syncing and mapping
Laura Abbott [Mon, 3 Apr 2017 18:57:48 +0000 (11:57 -0700)]
staging: android: ion: Call dma_map_sg for syncing and mapping

Technically, calling dma_buf_map_attachment should return a buffer
properly dma_mapped. Add calls to dma_map_sg to begin_cpu_access to
ensure this happens. As a side effect, this lets Ion buffers take
advantage of the dma_buf sync ioctls.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Duplicate sg_table
Laura Abbott [Mon, 3 Apr 2017 18:57:47 +0000 (11:57 -0700)]
staging: android: ion: Duplicate sg_table

Ion currently returns a single sg_table on each dma_map call. This is
incorrect for later usage.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Remove alignment from allocation field
Laura Abbott [Mon, 3 Apr 2017 18:57:46 +0000 (11:57 -0700)]
staging: android: ion: Remove alignment from allocation field

The align field was supposed to be used to specify the alignment of
the allocation. Nobody actually does anything with it except to check
if the alignment specified is out of bounds. Since this has no effect
on the actual allocation, just remove it.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Remove dmap_cnt
Laura Abbott [Mon, 3 Apr 2017 18:57:45 +0000 (11:57 -0700)]
staging: android: ion: Remove dmap_cnt

The reference counting of dma_map calls was removed. Remove the
associated counter field as well.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMerge tag 'iio-for-4.12c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Mon, 3 Apr 2017 13:29:12 +0000 (15:29 +0200)]
Merge tag 'iio-for-4.12c' of git://git./linux/kernel/git/jic23/iio into staging-next

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

Somewhat dominated in patch numbers of last of the outreachy application
window related patches (they are still coming, despite window being closed
which is good to see!)

Good set of new drivers as well.

New device support
* ASPEED ADC
  - new driver
* cpcap PMIC ADC
  - new driver
* hid-humidity
  - driver for HID compatible humidity sensors.
* ltc2497 ADC
  - new driver
* mpu6050
  - bring bindings up to date and add trivial support for 9250
* rockchip-saradc
  - update bindings to cover rk3328
* vl6180 light, proximity and time of flight sensor.
  - new driver

Features
* meson-saradc
  - add calibration

Cleanup and minor fixes
* ad5504
  - constify attribute_group structure
  - drop casting of void *
* ad7150
  - replace some shifts of 1 by BIT macro usage
* ad7152
  - blank lines between function definitions
ad7280a
  - octal permissions.
* ad7606
  - replace use of core mlock mutex with a local lock
* ad7746
  - replace some shifts of 1 by BIT macro usage
  - function parameter alignment
  - drop some excessive brackets (introduced in last pull request)
* ad7753
  - white space cleanup
* ad7754
  - includes in alphabetical order and groupped appropriately.
  - change from missuse of internal mlock mutex to using the buffer lock to
  also protect values during frequency update.
* ad779x
  - constify attribute_group structures
* ad9832
  - octal permissions
* adis16060
  - remove use of core mlock mutex in favour of adding a local
  _spi_write_then_read which can use the local buffer protection lock.
  - fix naming of above function.
* adis16203
  - remove locking during reads of calibbias that doesn't protect anything
  not protected elsewhere.
* adis16209
  - remove unnecessary braces in single statement if
* adis16240
  - remove unnecessary braces in single statement if
* adt7136
  - drop excess blank lines and put some in between functions.
* ams-iaq
  - replace comma with semi colon. Not actual bug, just unusual syntax.
* apds9960
  - constify attribute group structure
* as3935
  - constify attribute group structure
* bm1750
  - constify attribute group structure
* cros_ec
  - devm version of triggered buffer setup to simplify code.
* exynos
  - drop casting of void *
* hdc100x
  - constify attribute_group structure
* hid-accel
  - fix wrong scale for newly introduced gravity sensor.
* hts221
  - drop casting of void *
* hx711
  - constify attribute_group structure
* imx7d_adc
  - drop casting of void *
* lm35333
  - constify attribute_group structure
* lsm6dsx
  - drop casting of void *
  - hold ODR configuration until enabling to avoid a race condition.
* max1027
  - drop casting of void *
* max11100
  - fix a comma where semicolon was intended (no actual bug, just odd)
* max1363
  - constify attribute_group structure
* ms sensors
  - drop casting of void *
* rockchip_saradc
  - drop casting of void *
* sun4i-gpadc
  - fix missing dependency on THERMAL or presence of stubs (issue only
  introduced in pervious set)
  - drop casting of void *
* tsl2x7x
  - fix wrong standard deviation calc.  Note these aren't actually used for
  anything at the moment so bug didn't really matter.
  - constify attribute group structure.
* vf610adc
  - drop casting of void *
* vz89x
  - replace comma with semicolon. Not actual bug, just odd syntax.
* zpa2326
  - drop casting of void *

7 years agoiio: imu: st_lsm6dsx: do not apply ODR configuration in write_raw handler
Lorenzo Bianconi [Sun, 2 Apr 2017 12:58:45 +0000 (14:58 +0200)]
iio: imu: st_lsm6dsx: do not apply ODR configuration in write_raw handler

This patch allows to avoid a transitory that occurs when a given sensor
has been already enabled (e.g. gyroscope) and the user is configuring
the sample frequency of the other one (e.g. accelerometer).
The transitory lasts until the accelerometer is enabled.
During that time slice the gyroscope ODR is incorrectly modified as well.
At the end of the transitory both sensors work at the right frequency.
Fix it introducing st_lsm6dsx_check_odr() routine to check ODR consistency
in write_raw handler in order to apply frequency configuration just
in st_lsm6dsx_set_odr()

Fixes: 290a6ce11d93 (iio: imu: add support to lsm6dsx driver)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: adc: sun4i: add THERMAL dependency
Arnd Bergmann [Tue, 28 Mar 2017 10:07:23 +0000 (12:07 +0200)]
iio: adc: sun4i: add THERMAL dependency

With CONFIG_THERMAL=m and CONFIG_SUN4I_GPADC=y, we get a link error
from calling devm_thermal_zone_of_sensor_register:

drivers/iio/built-in.o: In function `sun4i_gpadc_probe':
:(.text+0x1c284): undefined reference to `devm_thermal_zone_of_sensor_register'

This adds a Kconfig dependency to ensure we can only have the ADC
driver as built-in when this function is also built-in, or when
we see the empty stub implementation. When the thermal code is
a module, we can still build the adc driver as a module, too.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: d1caa99055382 ("iio: adc: add support for Allwinner SoCs ADC")
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio:adc: Driver for Linear Technology LTC2497 ADC
Michael Hennerich [Wed, 29 Mar 2017 09:42:58 +0000 (11:42 +0200)]
iio:adc: Driver for Linear Technology LTC2497 ADC

This patch adds support for the Analog Devices / Linear Technology
LTC2497 ADCs. The LTC2497 is a 16-channel (eight differential),
16-bit, high precision, delta-sigma ADC with an automatic, differential,
input current cancellation front end and a 2-wire, I2C interface.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: ad9832: use 4-digit octal permissions
Guru Das Srinagesh [Thu, 30 Mar 2017 09:55:39 +0000 (02:55 -0700)]
staging: iio: ad9832: use 4-digit octal permissions

This fixes the coding style issue of using S_IWUSR in place of 4-digit
octal numbers.

Issue detected by checkpatch.

Signed-off-by: Guru Das Srinagesh <gurooodas@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio:imu:mpu6050 add explicit mpu9250 support
Jonathan Cameron [Sun, 26 Mar 2017 11:11:00 +0000 (12:11 +0100)]
iio:imu:mpu6050 add explicit mpu9250 support

The mpu9250 is a SIP containing an mpu6500 and an ak8975.  If this was all
there was too it there would be no need for explicit handling in the driver.
Arguably the bindings would also only reflect the presence of an mpu6500 with
the ak8975 hanging off it, as the kernel doesn't care that they are in one
package.

However, the WHOAMI value changes as well so best to add explicit support.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio:imu:mpu6050 update i2c bindings to reflect i2c-gate and supported parts
Jonathan Cameron [Sun, 26 Mar 2017 11:10:59 +0000 (12:10 +0100)]
iio:imu:mpu6050 update i2c bindings to reflect i2c-gate and supported parts

These bindings are somewhat lagging the state of the driver.  The i2c-gate
bindings are documented elsewhere, but it seems sensible to at least have
an example and cross reference in here.  SPI bindings will need to be the
subject of a future patch.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Rob Herring <robh@kernel.org>
7 years agodt-bindings: iio: rockchip-saradc: add support for rk3328
Liang Chen [Mon, 27 Mar 2017 09:40:46 +0000 (17:40 +0800)]
dt-bindings: iio: rockchip-saradc: add support for rk3328

The rk3328 saradc is the same as rk3399.

Signed-off-by: Liang Chen <cl@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: pressure: zpa2326: Remove unnecessary cast on void pointer
simran singhal [Sat, 1 Apr 2017 14:18:39 +0000 (19:48 +0530)]
iio: pressure: zpa2326: Remove unnecessary cast on void pointer

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: imu: st_lsm6dsx: Remove unnecessary cast on void pointer
simran singhal [Sat, 1 Apr 2017 14:16:24 +0000 (19:46 +0530)]
iio: imu: st_lsm6dsx: Remove unnecessary cast on void pointer

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: humidity: hts221: Remove unnecessary cast on void pointer
simran singhal [Sat, 1 Apr 2017 14:14:15 +0000 (19:44 +0530)]
iio: humidity: hts221: Remove unnecessary cast on void pointer

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: dac: ad5504: Remove unnecessary cast on void pointer
simran singhal [Sat, 1 Apr 2017 14:11:53 +0000 (19:41 +0530)]
iio: dac: ad5504: Remove unnecessary cast on void pointer

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: common: ms_sensors: Remove unnecessary cast on void pointer
simran singhal [Sat, 1 Apr 2017 14:09:21 +0000 (19:39 +0530)]
iio: common: ms_sensors: Remove unnecessary cast on void pointer

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: adc: Remove unnecessary cast on void pointer
simran singhal [Sat, 1 Apr 2017 14:06:14 +0000 (19:36 +0530)]
iio: adc: Remove unnecessary cast on void pointer

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: gyro: adis16060: Change the name of function.
simran singhal [Fri, 31 Mar 2017 10:21:43 +0000 (15:51 +0530)]
iio: gyro: adis16060: Change the name of function.

Change the name of function from adis16060_spi_write_than_read()
to adis16060_spi_write_then_read(). change "than" to "then" as
its time depended.

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: light: lm3533-als: constify attribute_group structures
simran singhal [Thu, 30 Mar 2017 18:40:38 +0000 (00:10 +0530)]
iio: light: lm3533-als: constify attribute_group structures

Check for attribute_group structures that are only stored in the
event_attrs filed of iio_info structure. As the event_attrs field of
iio_info structures is constant, so these attribute_group structures can
also be declared constant. Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.event_attrs=&i@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

As the attrs field of iio_info structures is also constant, so these
attribute_group structures can also be declared constant. Done manually.

File size before:
   text    data     bss     dec     hex filename
   5798    2376       0    8174    1fee drivers/iio/light/lm3533-als.o

File size after:
   text    data     bss     dec     hex filename
   5926    2248       0    8174    1fee drivers/iio/light/lm3533-als.o

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: Aspeed ADC
Rick Altherr [Tue, 28 Mar 2017 21:52:59 +0000 (14:52 -0700)]
iio: Aspeed ADC

Aspeed BMC SoCs include a 16 channel, 10-bit ADC. Low and high threshold
interrupts are supported by the hardware but are not currently implemented.

Signed-off-by: Rick Altherr <raltherr@google.com>
Tested-by: Xo Wang <xow@google.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoDocumentation: dt-bindings: Document bindings for Aspeed ADC
Rick Altherr [Tue, 28 Mar 2017 21:52:58 +0000 (14:52 -0700)]
Documentation: dt-bindings: Document bindings for Aspeed ADC

Signed-off-by: Rick Altherr <raltherr@google.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: light: tsl2x7x constify attribute_group structures
simran singhal [Sat, 1 Apr 2017 02:28:56 +0000 (07:58 +0530)]
staging: iio: light: tsl2x7x constify attribute_group structures

As the event_attrs field of iio_info structures is constant, so these
attribute_group structures can also be declared constant.

File size before:
   text    data     bss     dec     hex filename
  15064    1528       0   16592    40d0
drivers/staging/iio/light/tsl2x7x_core.o

File size after:
   text    data     bss     dec     hex filename
  15192    1400       0   16592    40d0
drivers/staging/iio/light/tsl2x7x_core.o

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: adc: hx711: constify attribute_group structures
simran singhal [Sat, 1 Apr 2017 08:17:51 +0000 (13:47 +0530)]
iio: adc: hx711: constify attribute_group structures

Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=&i@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   text    data     bss     dec     hex filename
   3042     480       0    3522     dc2 drivers/iio/adc/hx711.o

File size after:
   text    data     bss     dec     hex filename
   3098     416       0    3514     dba drivers/iio/adc/hx711.o

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: humidity: hdc100x: constify attribute_group structures
simran singhal [Sat, 1 Apr 2017 08:23:33 +0000 (13:53 +0530)]
iio: humidity: hdc100x: constify attribute_group structures

Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=&i@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   text    data     bss     dec     hex filename
   3459     488       0    3947     f6b drivers/iio/humidity/hdc100x.o

File size after:
   text    data     bss     dec     hex filename
   3507     424       0    3931     f5b drivers/iio/humidity/hdc100x.o

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: light: apds9960: constify attribute_group structures
simran singhal [Sat, 1 Apr 2017 08:29:10 +0000 (13:59 +0530)]
iio: light: apds9960: constify attribute_group structures

Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=&i@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   text    data     bss     dec     hex filename
   8503     488       0    8991    231f drivers/iio/light/apds9960.o

File size after:
   text    data     bss     dec     hex filename
   8567     424       0    8991    231f drivers/iio/light/apds9960.o

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: light: bh1750: constify attribute_group structures
simran singhal [Sat, 1 Apr 2017 08:33:30 +0000 (14:03 +0530)]
iio: light: bh1750: constify attribute_group structures

Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=&i@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   text    data     bss     dec     hex filename
   2276     352       0    2628     a44 drivers/iio/light/bh1750.o

File size after:
   text    data     bss     dec     hex filename
   2340     320       0    2660     a64 drivers/iio/light/bh1750.o

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: proximity: as3935: constify attribute_group structures
simran singhal [Sat, 1 Apr 2017 08:39:55 +0000 (14:09 +0530)]
iio: proximity: as3935: constify attribute_group structures

Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=&i@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   text    data     bss     dec     hex filename
   4037     288       0    4325    10e5 drivers/iio/proximity/as3935.o

File size after:
   text    data     bss     dec     hex filename
   4101     256       0    4357    1105 drivers/iio/proximity/as3935.o

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>