OSDN Git Service

uclinux-h8/linux.git
3 years agostaging: rtl8723bs: fix broken indentation
Fabio Aiuto [Fri, 26 Mar 2021 18:06:32 +0000 (19:06 +0100)]
staging: rtl8723bs: fix broken indentation

fix indentation broken by patch removing conditional
code blocks checked by unused
CONFIG_INTERRUPT_BASED_TXBCN family defines

Fixes: 65f183001f6e (staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_INTERRUPT_BASED_TXBCN*)
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/20210326180632.1859-1-fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8723bs: hal: remove unused variable in HalBtc8723b1Ant.c
Edmundo Carmona Antoranz [Sat, 27 Mar 2021 00:17:33 +0000 (18:17 -0600)]
staging: rtl8723bs: hal: remove unused variable in HalBtc8723b1Ant.c

Variable btRssiState in halbtc8723b1ant_ActionWifiConnectedBtAclBusy()
is set but never read. Removing it.

Removing this warning:

drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c:2093:5: warning: variable ‘btRssiState’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>
Link: https://lore.kernel.org/r/20210327001736.180881-3-eantoranz@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8723bs: sdio_ops: removing unused variable
Edmundo Carmona Antoranz [Sat, 27 Mar 2021 00:17:34 +0000 (18:17 -0600)]
staging: rtl8723bs: sdio_ops: removing unused variable

Inside sd_int_dpc(), variable report is set but it's never read.
Getting rid of it.

Removing this warning:

drivers/staging/rtl8723bs/hal/sdio_ops.c:946:30: warning: variable ‘report’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>
Link: https://lore.kernel.org/r/20210327001736.180881-4-eantoranz@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agodrivers: staging: netlogic: fix unmet dependency for PHYLIB
Julian Braha [Fri, 26 Mar 2021 05:45:33 +0000 (01:45 -0400)]
drivers: staging: netlogic: fix unmet dependency for PHYLIB

When NETLOGIC_XLR_NET is enabled, and NETDEVICES is
disabled, Kbuild gives the following warning:

WARNING: unmet direct dependencies detected for PHYLIB
  Depends on [n]: NETDEVICES [=n]
  Selected by [y]:
  - NETLOGIC_XLR_NET [=y] && STAGING [=y] && CPU_XLR [=y]

This is because NETLOGIC_XLR_NET selects PHYLIB
without selecting or depending on NETDEVICES,
despite PHYLIB depending on NETDEVICES.

Signed-off-by: Julian Braha <julianbraha@gmail.com>
Link: https://lore.kernel.org/r/20210326054533.48751-1-julianbraha@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8723bs: remove assignment in condition in os_dep/ioctl_linux.c
Fabio Aiuto [Wed, 24 Mar 2021 15:50:36 +0000 (16:50 +0100)]
staging: rtl8723bs: remove assignment in condition in os_dep/ioctl_linux.c

fix the following checkpatch warning:

ERROR: do not use assignment in if condition
2607: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:2607:
+ if (0 != (ret = rtw_change_ifname(padapter, new_ifname)))
--
ERROR: do not use assignment in if condition
4239: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:4239:
+ if (!(ext = vmalloc(len)))
--
ERROR: do not use assignment in if condition
4253: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:4253:
+ if (!(ext_dbg = vmalloc(len))) {

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/98b58790ae7c791d091b301bccf67a70c41ec599.1616600897.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8723bs: remove assignment in condition in os_dep/ioctl_cfg80211.c
Fabio Aiuto [Wed, 24 Mar 2021 15:50:35 +0000 (16:50 +0100)]
staging: rtl8723bs: remove assignment in condition in os_dep/ioctl_cfg80211.c

fix the following checkpatch warning:

ERROR: do not use assignment in if condition
1440: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:1440:
+ if ((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen)))
--
ERROR: do not use assignment in if condition
2465: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2465:
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
--
ERROR: do not use assignment in if condition
2937: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2937:
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) {
--
ERROR: do not use assignment in if condition
3335: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:3335:
+ if (!(ndev = wdev_to_ndev(wdev)))

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/cc687c2ff614da3e110addd1c5cd610e3356cbd7.1616600897.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8723bs: remove assignment in condition in core/rtw_ieee80211.c
Fabio Aiuto [Wed, 24 Mar 2021 15:50:34 +0000 (16:50 +0100)]
staging: rtl8723bs: remove assignment in condition in core/rtw_ieee80211.c

fix the following checkpatch warning:

ERROR: do not use assignment in if condition
1118: FILE: drivers/staging/rtl8723bs/core/rtw_ieee80211.c:1118:
+ if ((addr = of_get_property(np, "local-mac-address", &len)) &&

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/8e784a7e1407924724c97398af8e5aeb23460612.1616600897.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in HalBtc8723b2Ant.h
Marco Cesati [Wed, 24 Mar 2021 12:44:56 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in HalBtc8723b2Ant.h

Remove the following unnecessary enum names in
hal/HalBtc8723b2Ant.h:

enum bt_info_src_8723b_2ant
enum bt_8723b_2ant_bt_status
enum bt_8723b_2ant_coex_algo

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-34-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in odm.h
Marco Cesati [Wed, 24 Mar 2021 12:44:55 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in odm.h

Remove the following unnecessary enum names or definitions in
hal/odm.h:

enum ODM_Ability_E [definition]
enum odm_ability_e [name]
enum odm_interface_e [name]
enum odm_ic_type_e [name]
enum odm_cut_version_e [name]
enum odm_fab_e [name]
enum odm_rf_path_e [definition]
enum odm_rf_type_e [name]
enum odm_mac_phy_mode_e [definition]
enum odm_bt_coexist_e [definition]
enum odm_operation_mode_e [definition]
enum odm_wireless_mode_e [name]
enum odm_band_type_e [name]
enum odm_sec_chnl_offset_e [definition]
enum odm_security_e [definition]
enum odm_bw_e [name]
enum odm_board_type_e [definition]
enum ODM_Package_TYPE_E [definition]
enum odm_cca_path_e [definition]
enum fat_state_e [definition]
enum ant_div_type_e [name]
enum rt_status [definition]
enum dm_1r_cca_e [name]
enum dm_rf_e [name]
enum dm_swas_e [definition]

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-33-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in HalPhyRf.h
Marco Cesati [Wed, 24 Mar 2021 12:44:54 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in HalPhyRf.h

Remove the following unnecessary enum definition in
hal/HalPhyRf.h:

enum spur_cal_method

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-32-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in odm_DIG.h
Marco Cesati [Wed, 24 Mar 2021 12:44:53 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in odm_DIG.h

Remove the following unnecessary enum definitions in
hal/odm_DIG.h:

enum dm_dig_op_e
enum ODM_Pause_CCKPD_TYPE

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-31-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in odm_types.h
Marco Cesati [Wed, 24 Mar 2021 12:44:52 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in odm_types.h

Remove the following unnecessary enum definition in
hal/odm_types.h:

enum rt_spinlock_type

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-30-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in HalBtc8723b1Ant.h
Marco Cesati [Wed, 24 Mar 2021 12:44:51 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in HalBtc8723b1Ant.h

Remove the following unnecessary enum names in
hal/HalBtc8723b1Ant.h:

enum bt_info_src_8723b_1ant
enum bt_8723b_1ant_bt_status
enum bt_8723b_1ant_wifi_status
enum bt_8723b_1ant_coex_algo

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-29-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in HalBtcOutSrc.h
Marco Cesati [Wed, 24 Mar 2021 12:44:50 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in HalBtcOutSrc.h

Remove the following unnecessary enum names or definitions in
hal/HalBtcOutSrc.h:

enum btc_powersave_type [name]
enum btc_bt_reg_type [name]
enum btc_chip_type [name]
enum btc_msg_type [name]
enum btc_dbg_opcode [definition]
enum btc_rssi_state [name]
enum btc_wifi_role [definition]
enum btc_wifi_bw_mode [name]
enum btc_wifi_traffic_dir [name]
enum btc_wifi_pnp [name]
enum bt_wifi_coex_state [definition]
enum btc_get_type [name]
enum btc_set_type [name]
enum btc_dbg_disp_type [name]
enum btc_notify_type_ips [name]
enum btc_notify_type_lps [name]
enum btc_notify_type_scan [name]
enum btc_notify_type_associate [name]
enum btc_notify_type_media_status [name]
enum btc_notify_type_special_packet [name]
enum btc_notify_type_stack_operation [definition]
enum btc_antenna_pos [name]

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-28-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in odm_interface.h
Marco Cesati [Wed, 24 Mar 2021 12:44:49 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in odm_interface.h

Remove the following unnecessary enum definition in
hal/odm_interface.h:

enum odm_h2c_cmd

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-27-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in rtw_efuse.h
Marco Cesati [Wed, 24 Mar 2021 12:44:48 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in rtw_efuse.h

Remove the following unnecessary enum name in
include/rtw_efuse.h:

enum _efuse_def_type

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-26-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in ieee80211.h
Marco Cesati [Wed, 24 Mar 2021 12:44:47 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in ieee80211.h

Remove the following unnecessary enum names or definitions in
include/ieee80211.h:

enum rateid_idx [name]
enum ratr_table_mode [definition]
enum eap_type [definition]
enum mgn_rate [name]
enum ieee80211_state [definition]
enum rtw_ieee80211_category [name]
enum _public_action [name]
enum rtw_ieee80211_back_parties [definition]
enum rtw_ieee80211_vht_actioncode [definition]
enum secondary_ch_offset [definition]

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-25-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in hal_com_phycfg.h
Marco Cesati [Wed, 24 Mar 2021 12:44:46 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in hal_com_phycfg.h

Remove the following unnecessary enum names in
include/hal_com_phycfg.h:

enum rf_tx_num
enum _regulation_txpwr_lmt

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-24-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in HalPwrSeqCmd.h
Marco Cesati [Wed, 24 Mar 2021 12:44:45 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in HalPwrSeqCmd.h

Remove the following unnecessary enum name in
include/HalPwrSeqCmd.h:

enum pwrseq_cmd_delay_unit

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-23-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in rtw_rf.h
Marco Cesati [Wed, 24 Mar 2021 12:44:44 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in rtw_rf.h

Remove the following unnecessary enum names or definitions in
include/rtw_rf.h:

enum capability [name]
enum   _reg_preamble_mode [name]
enum _rtl8712_rf_mimo_config_ [definition]
enum rf90_radio_path [definition]
enum vht_data_sc [name]
enum protection_mode [definition]
enum rt_rf_type_definition [name]

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-22-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in rtw_xmit.h
Marco Cesati [Wed, 24 Mar 2021 12:44:43 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in rtw_xmit.h

Remove the following unnecessary enum definition in
include/rtw_xmit.h:

enum txdesc_sc

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-21-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in rtw_mlme_ext.h
Marco Cesati [Wed, 24 Mar 2021 12:44:42 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in rtw_mlme_ext.h

Remove the following unnecessary enum names or definitions in
include/rtw_mlme_ext.h:

enum rt_channel_domain [name]
enum rt_channel_domain_2g [name]
enum rt_channel_domain_5g [name]
enum Associated_AP [definition]
enum ht_iot_peer_e [name]
enum scan_state [name]
enum rtw_c2h_event [name]

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-20-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in hal_phy.h
Marco Cesati [Wed, 24 Mar 2021 12:44:41 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in hal_phy.h

Remove the following unnecessary enum names or definitions in
include/hal_phy.h:

enum rf_type [name]
enum antenna_path [definition]
enum rf_content [definition]
enum BaseBand_Config_Type [definition]
enum hw_block [definition]

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-19-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in rtl8723b_hal.h
Marco Cesati [Wed, 24 Mar 2021 12:44:40 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in rtl8723b_hal.h

Remove the following unnecessary enum names in
include/rtl8723b_hal.h:

enum c2h_evt
enum package_type_e

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-18-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in wifi.h
Marco Cesati [Wed, 24 Mar 2021 12:44:39 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in wifi.h

Remove the following unnecessary enum names or definitions in
include/wifi.h:

enum wifi_frame_type [name]
enum wifi_frame_subtype [name]
enum wifi_reg_domain [definition]
enum p2p_proto_wk_id [definition]

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-17-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in rtw_wifi_regd.h
Marco Cesati [Wed, 24 Mar 2021 12:44:38 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in rtw_wifi_regd.h

Remove the following unnecessary enum definition in
include/rtw_wifi_regd.h:

enum country_code_type_t

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-16-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in hal_com_h2c.h
Marco Cesati [Wed, 24 Mar 2021 12:44:37 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in hal_com_h2c.h

Remove the following unnecessary enum definition in
include/hal_com_h2c.h:

enum h2c_cmd

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-15-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in rtl8723b_cmd.h
Marco Cesati [Wed, 24 Mar 2021 12:44:36 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in rtl8723b_cmd.h

Remove the following unnecessary enum name in
include/rtl8723b_cmd.h:

enum h2c_cmd_8723B

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-14-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in rtw_pwrctrl.h
Marco Cesati [Wed, 24 Mar 2021 12:44:35 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in rtw_pwrctrl.h

Remove the following unnecessary enum names in
include/rtw_pwrctrl.h:

enum Power_Mgnt
enum _PS_BBRegBackup_

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-13-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in hal_intf.h
Marco Cesati [Wed, 24 Mar 2021 12:44:34 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in hal_intf.h

Remove the following unnecessary enum names or definitions in
include/hal_intf.h:

enum rtl871x_hci_type [name]
enum hw_variables [name]
enum rt_eeprom_type [definition]
enum wowlan_subcode [definition]

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-12-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in osdep_service.h
Marco Cesati [Wed, 24 Mar 2021 12:44:33 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in osdep_service.h

Remove the following unnecessary enum definitions in
include/osdep_service.h:

enum mstat_f
enum mstat_status

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-11-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in rtw_mp.h
Marco Cesati [Wed, 24 Mar 2021 12:44:32 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in rtw_mp.h

Remove the following unnecessary enum definitions in
include/rtw_mp.h:

enum mp_mode
enum mpt_rate_index
enum power_mode
enum ofdm_tx_mode
enum encry_ctrl_state
enum mpt_txpwr_def

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-10-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in wlan_bssdef.h
Marco Cesati [Wed, 24 Mar 2021 12:44:31 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in wlan_bssdef.h

Remove the following unnecessary enum names or definitions in
include/wlan_bssdef.h:

enum ndis_802_11_wep_status [name]
enum ndis_802_11_reload_defaults [definition]
enum vrtl_carrier_sense [name]
enum vcs_type [name]
enum uapsd_max_sp [name]

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-9-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in rtw_ht.h
Marco Cesati [Wed, 24 Mar 2021 12:44:30 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in rtw_ht.h

Remove the following unnecessary enum names in
include/rtw_ht.h:

enum aggre_size_e
enum rt_ht_inf0_capbility
enum rt_ht_inf1_capbility

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-8-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in drv_types.h
Marco Cesati [Wed, 24 Mar 2021 12:44:29 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in drv_types.h

Remove the following unnecessary enum names or definitions in
include/drv_types.h:

enum _nic_version [definition]
enum _iface_type [name]
enum adapter_type [definition]
enum driver_state [name]

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-7-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in rtw_recv.h
Marco Cesati [Wed, 24 Mar 2021 12:44:28 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in rtw_recv.h

Remove the following unnecessary enum name in
include/rtw_recv.h:

enum rx_packet_type

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-6-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in hal_com.h
Marco Cesati [Wed, 24 Mar 2021 12:44:27 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in hal_com.h

Remove the following unnecessary enum definition in
include/hal_com.h:

enum firmware_source

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-5-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in rtw_eeprom.h
Marco Cesati [Wed, 24 Mar 2021 12:44:26 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in rtw_eeprom.h

Remove the following unnecessary enum name
include/rtw_eeprom.h:

enum rt_customer_id

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-4-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in rtw_cmd.h
Marco Cesati [Wed, 24 Mar 2021 12:44:25 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in rtw_cmd.h

Remove the following unnecessary enum names in
include/rtw_cmd.h:

enum rtw_drvextra_cmd_id
enum lps_ctrl_type
enum rfintfs
enum rtw_h2c_cmd

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-3-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: rtl8723bs: remove named enums in rtw_mlme.h
Marco Cesati [Wed, 24 Mar 2021 12:44:24 +0000 (13:44 +0100)]
Staging: rtl8723bs: remove named enums in rtw_mlme.h

Remove the following unnecessary enum names or definitions in
include/rtw_mlme.h:

enum dot11AuthAlgrthmNum [name]
enum  _band [name]
enum DriverInterface [definition]
enum scan_result_type [definition]

Signed-off-by: Marco Cesati <marcocesati@gmail.com>
Link: https://lore.kernel.org/r/20210324124456.25221-2-marcocesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agor8192U_wx.c: style: avoid multiple blank lines
Bruno Raoult [Fri, 26 Mar 2021 09:48:35 +0000 (10:48 +0100)]
r8192U_wx.c: style: avoid multiple blank lines

fix checkpatch.pl check:

CHECK: Please don't use multiple blank lines
in drivers/staging/rtl8192u/r8192U_wx.c

Signed-off-by: Bruno Raoult <braoult@gmail.com>
Link: https://lore.kernel.org/r/2c1f2c668d299ce1895ce97dc7fb9a67d3723e63.1616748922.git.braoult@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agor8192U_wx.c: style: Unnecessary parentheses
Bruno Raoult [Fri, 26 Mar 2021 09:48:34 +0000 (10:48 +0100)]
r8192U_wx.c: style: Unnecessary parentheses

fix checkpatch.pl check:

CHECK: Unnecessary parentheses around expr
in drivers/staging/rtl8192u/r8192U_wx.c

Signed-off-by: Bruno Raoult <braoult@gmail.com>
Link: https://lore.kernel.org/r/f42993e183e1127dcc9fce3f0ed42dd6d795c647.1616748922.git.braoult@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agor8192U_wx.c: style: braces all arms of statement
Bruno Raoult [Fri, 26 Mar 2021 09:48:33 +0000 (10:48 +0100)]
r8192U_wx.c: style: braces all arms of statement

fix checkpatch.pl check:

CHECK: braces {} should be used on all arms of this statement
in drivers/staging/rtl8192u/r8192U_wx.c

Signed-off-by: Bruno Raoult <braoult@gmail.com>
Link: https://lore.kernel.org/r/adbbb5243dca7998a31a786eef277bd85068c63a.1616748922.git.braoult@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agor8192U_wx.c: style: spaces preferred around operators
Bruno Raoult [Fri, 26 Mar 2021 09:48:32 +0000 (10:48 +0100)]
r8192U_wx.c: style: spaces preferred around operators

fix checkpatch.pl check:

CHECK: spaces required around that <op>
in drivers/staging/rtl8192u/r8192U_wx.c

Signed-off-by: Bruno Raoult <braoult@gmail.com>
Link: https://lore.kernel.org/r/e7298c14538ad7a58720585d019a70f637e0cdb1.1616748922.git.braoult@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agor8192U_wx.c: style: alignment with open parenthesis
Bruno Raoult [Fri, 26 Mar 2021 09:48:31 +0000 (10:48 +0100)]
r8192U_wx.c: style: alignment with open parenthesis

fix checkpatch.pl check:

CHECK: Alignment should match open parenthesis
in drivers/staging/rtl8192u/r8192U_wx.c

Signed-off-by: Bruno Raoult <braoult@gmail.com>
Link: https://lore.kernel.org/r/34f4134241f49d1694cbfb9c2185e3ef54284680.1616748922.git.braoult@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoStaging: comedi: remove unnecessary else statement
Swen Kalski [Thu, 25 Mar 2021 13:35:20 +0000 (14:35 +0100)]
Staging: comedi: remove unnecessary else statement

Removal of an unnecessary else in statging/comedi/comedi_buf.c
Add an early Return and removed the unleashed the else condition
for better readability int staging/comedi drivers.

Signed-off-by: Swen Kalski <kalski.swen@gmail.com>
Link: https://lore.kernel.org/r/20210325133520.GA594125@m17r3en
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agodrivers: staging: rtl8712: _adapter is declared twice
Wan Jiabing [Thu, 25 Mar 2021 08:00:46 +0000 (16:00 +0800)]
drivers: staging: rtl8712: _adapter is declared twice

struct _adapter has been declared at 23rd line.
Remove the duplicate.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Link: https://lore.kernel.org/r/20210325080050.861273-1-wanjiabing@vivo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: Fix null pointer dereference on free_netdev call
Colin Ian King [Wed, 24 Mar 2021 15:21:35 +0000 (15:21 +0000)]
staging: rtl8188eu: Fix null pointer dereference on free_netdev call

An unregister_netdev call checks if pnetdev is null, hence a later
call to free_netdev can potentially be passing a null pointer, causing
a null pointer dereference. Avoid this by adding a null pointer check
on pnetdev before calling free_netdev.

Fixes: 1665c8fdffbb ("staging: rtl8188eu: use netdev routines for private data")
Reviewed-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210324152135.254152-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: qlge: deal with the case that devlink_health_reporter_create fails
Coiby Xu [Wed, 24 Mar 2021 01:00:01 +0000 (09:00 +0800)]
staging: qlge: deal with the case that devlink_health_reporter_create fails

devlink_health_reporter_create may fail. In that case, do the cleanup
work.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
Link: https://lore.kernel.org/r/20210324010002.109846-1-coxu@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoMerge tag 'iio-for-5.13a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Fri, 26 Mar 2021 11:09:47 +0000 (12:09 +0100)]
Merge tag 'iio-for-5.13a' of https://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

1st set of IIO/counter device support, features and cleanup in the 5.13 cycle

Big set in here from Alexandru Ardelean enabling multiple buffer support.
This includes providing a new directory per buffer that combines
what was previously in buffer/ and scan_elements/. Old interfaces still
in place for compatiblity.

Note immuatable branch for scmi patches to allow for some significant
rework going on in that subsystem.  Merge required updating to reflect
some changes in IIO.

Late rebase to fix some wrong fixes tags due to some earlier rebases
made necessary by messing up the immutable branch.

IIO New Device Support
* adi,ad5686
  - Add info to support AD5673R and AD5677R
* bosch,bmi088
  - New driver supporting this accelerometer + gyroscope
* cros_ec_mkbp
  - New driver for this proximity sensor that exposes a 'front'
    sensor. Very simple switch like device, but driver allows it
    to share interface with more sophisticated proximity sensors.
* iio_scmi
  - New driver to support ARM SCMI protocol to expose underlying
    accelerometers and gyroscopes via this firmware interface.
* st,st_magn
  - Add ID for IISMDC magnetometer.
* ti,ads131e0
  - New driver supporting ads131e04, ads131e06 and ads131e08 24 bit ADCs

Counter New Device Support
* IRQ or GPIO based counter
  - New driver for a conceptually simple counter that uses interrupts
    to perform the count.

Features
* core
  - Dual buffer supprt including:
     Various helpers to centralize handling of bufferer related elements.
     Document existing and new IOCTLs
     Register the IIO chrdev only if it can actually be used for anything.
     Rework attribute group creation in the core (lots of patches)
     Merge buffer/ and scan_elements/ entries into one list + maintain
     backwards compatible set.
     Introduce the internal logic and IOCTL to allow multiple buffers
     + access to an anon FD per buffer to actually read from it.
     Tidy up tools/iio/iio_generic_buffer and switch to new interfaces.
     Update ABI docs.
     A few follow up fixes, unsuprising as this was a huge bit of rework.
  - Move common case setting of trig->parent to the core.
  - Provide an iio_read_channel_processed_scale() to avoid loss of
    precision from iio_read_channel_processed() then applying integer
    scale. Use it in ntc_thermistor driver in hwmon.
  - Allow drivers to specify labels from elsewhere than DT. Use it for
    bmc150 and kxcjk-1013 labels related to position on 2 in one tablets.
  - Document label usage for proximity and accelerometer sensors.
  - Some local variable renames for consistency
tools
  - Add -a parameter to iio_event_monitor to allow autoenabling of events.
* acpi_als
  - Add trigger support for devices that don't support notification method.
* adi,ad7124
  - Allow more than 8 channels.  This is a complex little device, but is
    capable of supporting up to 16 channels if the share certain
    configuration settings.
* hrtimer-trigger
  - Support sampling frequency below 1Hz.
* mediatek,mt8195-auxadc
  - Add compatible to binding docs (always also includes mt8173)
* st,stm32-adc
  - Enable timetamps when not using DMA.
* vishay,vcnl3020
  - Sampling frequency control.

Cleanup and minor fixes:
* treewide
  - Use some getter and setter functions instead of opencoding.
  - Set of fixes for pointless casts in various drivers.
  - Avoid wrong kernel-doc marking on comment blocks.
  - Fix various other minor kernel-doc issues shown by W=1
* core
  - Use a signed temporary for IIO_VAL_FRACTIONAL_LOG2 to avoid odd casts.
  - Fix IIO_VAL_FRACTIONAL_LOG2 for values between -1.0 and 0.0
  - Add unit tests for iio_format_value()
* docs
  - Fix formatting/typos in iio_configfs.rst and buffers.rst
  - Add documentation of index in buffers.rst
  - Fix scan element description
  - Avoid some issues with HTML generation from ABI docs by moving
    duplicated defintions to more generic files.
  - Drop reference to long dead mailing list.
* 104-quad
  - Remove left over deprecated IIO counter ABI.
* adi,adi-axi-adc
  - Fix wrong bit of docs.
* adi,ad5791
  - Typos
* adi,ad9834
   - Switch to device managed functions in probe.
* adi,adis*
  - Add and use helpers for locking to reduced duplication.
* adi,adis16480
  - Fix calculation of sampling frequency when using pulse per second input.
* adi,adis16475
  - Calculate the IMU scaled internal sampling rate and runtime depending
    on sysfs based configuration rather than getting from DT. Drop now
    unnecessary property from DT bindings doc.
* cros_ec
   - Fix result of a series of recent changes that means extended buffer
     attributes turn up in the wrong place. Too complex to revert the
     various patches unfortunately so this is a bit messy.
* fsl,mma3452
  - Indentation cleanup.
* hid-sensors
  - Size of storage needs to increase for some parts when using quaternions.
  - Move the get sensistivity attribute to hid-sensors-common to reduce
    duplication.  Enable it for more device types.
  - Correctly handle relative sensitivity if reported that way including
    documenting the new ABI.
* maxim,max517
  - Use device managed functions in probe.
* mediatek,mt6360-adc
  - Use asm/unaligned.h instead of directly including
    unaligned/be_byteshift.h
* novuton,npcm-adc
  - Local lock instead of missusing mlock.
* semtech,sx9500
  - Typos
* st,sensor
  - typo fix
* st,spear-adc
  - Local lock instead of missusing mlock.
* st,stm32-adc
  - Long standing HAS_IOMEM dependency fix.
* st,stm32-counter
  - Remove left over deprecated IIO counter ABI.
* ti,palmas-adc
  - Local lock instead of missusing mlock.
* ti,tmp007
  - Switch to device managed functions in probe.

Other
* MAINTAINERS
  - Move Peter Meerwald-Stadler to Credits at his request

* tag 'iio-for-5.13a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (119 commits)
  iio: acpi_als: Add trigger support
  iio: acpi_als: Add local variable dev in probe
  iio: acpi_als: Add timestamp channel
  iio: adc: ad7292: Modify the bool initialization assignment
  iio: cros: unify hw fifo attributes without API changes
  iio: kfifo: add devm_iio_triggered_buffer_setup_ext variant
  iio: event_monitor: Enable events before monitoring
  dt-bindings: iio: adc: Add compatible for Mediatek MT8195
  iio:magnetometer: Add Support for ST IIS2MDC
  dt-bindings: iio: st,st-sensors add IIS2MDC.
  staging: iio: ad9832: kernel-doc fixes
  iio:dac:max517.c: Use devm_iio_device_register()
  iio:cros_ec_sensors: Fix a wrong function name in kernel doc.
  iio: buffer: kfifo_buf: kernel-doc, typo in function name.
  iio: accel: sca3000: kernel-doc fixes. Missing - and wrong function names.
  iio: adc: adi-axi-adc: Drop false marking for kernel-doc
  iio: adc: cpcap-adc: kernel-doc fix - that should be _ in structure name
  iio: dac: ad5504: fix wrong part number in kernel-doc structure name.
  iio: dac: ad5770r: kernel-doc fix case of letter R wrong in structure name
  iio: adc: ti-adc084s021: kernel-doc fixes, missing function names
  ...

3 years agoMerge remote-tracking branch 'local/ib-iio-scmi-5.12-rc2-take3' into togreg
Jonathan Cameron [Fri, 26 Mar 2021 10:03:41 +0000 (10:03 +0000)]
Merge remote-tracking branch 'local/ib-iio-scmi-5.12-rc2-take3' into togreg

Updated to use devm_iio_kfifo_buffer_setup() in place of now
removed devm_iio_kfifo_allocate()

Take3 branch because first 2 versions including wrong version of
patch.

3 years agoiio: acpi_als: Add trigger support
Gwendal Grignou [Wed, 17 Mar 2021 07:40:12 +0000 (00:40 -0700)]
iio: acpi_als: Add trigger support

As some firmware does not notify on illuminance changes, add a
trigger to be able to query light via software (sysfs-trigger or
hrtrigger).
Add a hardware trigger set as the default trigger to maintain backward
compatibility.

Check iio_info reports the sensor as buffer capable:
  iio:device0: acpi-als (buffer capable)

To test, check we can get data on demand on an Intel based chromebook:

  IIO_DEV="iio:device0"
  echo 1 > iio_sysfs_trigger/add_trigger
  cat trigger2/name > ${IIO_DEV}/trigger/current_trigger
  for i in ${IIO_DEV}/scan_elements/*_en ${IIO_DEV}/buffer/enable ; do
    echo 1 > $i
  done
  od -x /dev/${IIO_DEV} &
  echo 1 > trigger2/trigger_now

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210317074012.2336454-4-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: acpi_als: Add local variable dev in probe
Gwendal Grignou [Wed, 17 Mar 2021 07:40:11 +0000 (00:40 -0700)]
iio: acpi_als: Add local variable dev in probe

Use dev = &device->dev in probe routine for clarity.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210317074012.2336454-3-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: acpi_als: Add timestamp channel
Gwendal Grignou [Wed, 17 Mar 2021 07:40:10 +0000 (00:40 -0700)]
iio: acpi_als: Add timestamp channel

Add timestamp channel in list of channel, to allow retrieving timestamps
when events are produced.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210317074012.2336454-2-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: adc: ad7292: Modify the bool initialization assignment
Guoqing Chi [Fri, 19 Mar 2021 06:27:06 +0000 (14:27 +0800)]
iio: adc: ad7292: Modify the bool initialization assignment

A bool initializer is best assigned to false rather than 0.

Signed-off-by: Guoqing Chi <chiguoqing@yulong.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20210319062706.5135-1-chi962464zy@163.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: cros: unify hw fifo attributes without API changes
Gwendal Grignou [Thu, 18 Mar 2021 18:48:57 +0000 (11:48 -0700)]
iio: cros: unify hw fifo attributes without API changes

Commit 2e2366c2d141 ("iio: cros_ec: unify hw fifo attributes into the core file")
should be reverted as it set buffer extended attributes at
the wrong place. However, to revert it will requires to revert more
commits:
commit 165aea80e2e2 ("iio: cros_ec: use devm_iio_triggered_buffer_setup_ext()")
commit 21232b4456ba ("iio: buffer: remove iio_buffer_set_attrs() helper")).
and we would still have conflict with more recent development.
commit ee708e6baacd ("iio: buffer: introduce support for attaching more IIO buffers")

Instead, this commit reverts the first 2 commits without re-adding
iio_buffer_set_attrs() and set the buffer extended attributes at the
right place:

1. Instead of adding has_fw_fifo, deduct it from the configuration:
- EC must support FIFO (EC_FEATURE_MOTION_SENSE_FIFO) set.
- sensors send data a regular interval (accelerometer, gyro,
  magnetomer, barometer, light sensor).
- "Legacy accelerometer" is only present on EC without FIFO, so we don't
need to set buffer attributes.

2. devm_iio_triggered_buffer_setup_ext() does not need to be called when
EC does not support FIFO, as there is no FIFO to manage.

3. Use devm_iio_triggered_buffer_setup_ext() when EC has a FIFO to
specify the buffer extended attributes.

Fixes: 2e2366c2d141 ("iio: cros_ec: unify hw fifo attributes into the core file")
Fixes: 165aea80e2e2 ("iio: cros_ec: use devm_iio_triggered_buffer_setup_ext()")
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210318184857.2679181-1-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: kfifo: add devm_iio_triggered_buffer_setup_ext variant
Alexandru Ardelean [Thu, 11 Mar 2021 09:10:42 +0000 (11:10 +0200)]
iio: kfifo: add devm_iio_triggered_buffer_setup_ext variant

This is similar to the {devm_}iio_triggered_buffer_setup_ext variants added
via commit 5164c7889857 ("iio: triggered-buffer: add
{devm_}iio_triggered_buffer_setup_ext variants").

These can be used to pass extra buffer attributes to the buffer object.
This is a bit of temporary mechanism (hopefully) so that drivers that want
to allocate a kfifo buffer with extra buffer attributes, don't need to
include 'buffer_impl.h' directly. This can also become an API function (in
it's own right, unfortunately), but it may be a little less bad vs drivers
having to include 'buffer_impl.h'.

So, far the drivers that want to pass buffer attributes, all have to do
with some HW FIFO attributes, so there may be a chance of unifying them
into IIO core somehow (as some standard API). But, until that happens, we
just need to let them register their HW FIFO attributes directly (without
having to let them include 'buffer_impl.h' directly).

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210311091042.22417-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: event_monitor: Enable events before monitoring
Linus Walleij [Fri, 19 Mar 2021 13:53:01 +0000 (14:53 +0100)]
iio: event_monitor: Enable events before monitoring

After some painful sessions with a driver that register an
enable/disable sysfs knob (gp2ap002) and manually going
in and enabling the event before monitoring it:

  cd /sys/bus/iio/devices/iio\:device2/events
  # ls
  in_proximity_thresh_either_en
  # echo 1 > in_proximity_thresh_either_en

I realized that it's better if the iio_event_monitor is
smart enough to enable all events by itself and disable them
after use, if passed the -a flag familiar from the
iio_generic_buffer tool.

Auto-enabling events depend on the hardware being able
to handle all events at the same time which isn't
necessarily the case, so a command line option is required
for this.

Cc: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210319135301.542911-1-linus.walleij@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agodt-bindings: iio: adc: Add compatible for Mediatek MT8195
Seiya Wang [Fri, 19 Mar 2021 02:34:24 +0000 (10:34 +0800)]
dt-bindings: iio: adc: Add compatible for Mediatek MT8195

This commit adds dt-binding documentation of auxadc for Mediatek MT8195 SoC
Platform.

Signed-off-by: Seiya Wang <seiya.wang@mediatek.com>
Link: https://lore.kernel.org/r/20210319023427.16711-7-seiya.wang@mediatek.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio:magnetometer: Add Support for ST IIS2MDC
LI Qingwu [Wed, 17 Mar 2021 06:39:02 +0000 (06:39 +0000)]
iio:magnetometer: Add Support for ST IIS2MDC

Add support for ST magnetometer IIS2MDC,
an I2C/SPI interface 3-axis magnetometer.
The patch was tested on the instrument with IIS2MDC via I2C interface.

Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
Link: https://lore.kernel.org/r/20210317063902.19300-3-Qing-wu.Li@leica-geosystems.com.cn
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agodt-bindings: iio: st,st-sensors add IIS2MDC.
LI Qingwu [Wed, 17 Mar 2021 06:39:01 +0000 (06:39 +0000)]
dt-bindings: iio: st,st-sensors add IIS2MDC.

Add support for ST magnetometer IIS2MDC,
an I2C/SPI interface 3-axis magnetometer sensor.
The patch was tested on the instrument with IIS2MDC via I2C interface.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
Link: https://lore.kernel.org/r/20210317063902.19300-2-Qing-wu.Li@leica-geosystems.com.cn
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agostaging: iio: ad9832: kernel-doc fixes
Mugilraj Dhavachelvan [Mon, 15 Mar 2021 13:37:11 +0000 (19:07 +0530)]
staging: iio: ad9832: kernel-doc fixes

Fixes a W=1 warning.
-Added ``:`` to lock parameter in 'ad9832_state' description.
-It's a reference comment so removed /**

Signed-off-by: Mugilraj Dhavachelvan <dmugil2000@gmail.com>
Link: https://lore.kernel.org/r/20210315133711.26860-1-dmugil2000@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio:dac:max517.c: Use devm_iio_device_register()
Mugilraj Dhavachelvan [Sun, 14 Mar 2021 17:57:09 +0000 (23:27 +0530)]
iio:dac:max517.c: Use devm_iio_device_register()

Use devm_iio_device_register() to avoid remove function and
drop explicit call to iio_device_unregister().

Signed-off-by: Mugilraj Dhavachelvan <dmugil2000@gmail.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20210314175709.34301-1-dmugil2000@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio:cros_ec_sensors: Fix a wrong function name in kernel doc.
Jonathan Cameron [Sat, 13 Mar 2021 14:53:41 +0000 (14:53 +0000)]
iio:cros_ec_sensors: Fix a wrong function name in kernel doc.

cros_ec_sensors_read_data_unsafe() had wrong function name in kernel-doc
This shows up with W=1 builds.

No fixes tag because I don't want to waste time on this being
backported.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Guenter Roeck <groeck@chromium.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Gwendal Grignou <gwendal@chromium.org>
Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20210313145341.116088-1-jic23@kernel.org
3 years agoiio: buffer: kfifo_buf: kernel-doc, typo in function name.
Jonathan Cameron [Sun, 14 Mar 2021 16:46:55 +0000 (16:46 +0000)]
iio: buffer: kfifo_buf: kernel-doc, typo in function name.

Should have been _kfifo_ and was _fifo_

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20210314164655.408461-9-jic23@kernel.org
3 years agoiio: accel: sca3000: kernel-doc fixes. Missing - and wrong function names.
Jonathan Cameron [Sun, 14 Mar 2021 16:46:54 +0000 (16:46 +0000)]
iio: accel: sca3000: kernel-doc fixes. Missing - and wrong function names.

All extremely obvious so nothing to add to patch title.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20210314164655.408461-8-jic23@kernel.org
3 years agoiio: adc: adi-axi-adc: Drop false marking for kernel-doc
Jonathan Cameron [Sun, 14 Mar 2021 16:46:53 +0000 (16:46 +0000)]
iio: adc: adi-axi-adc: Drop false marking for kernel-doc

This comment block isn't in kernel-doc format so drop the /** marking.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210314164655.408461-7-jic23@kernel.org
3 years agoiio: adc: cpcap-adc: kernel-doc fix - that should be _ in structure name
Jonathan Cameron [Sun, 14 Mar 2021 16:46:52 +0000 (16:46 +0000)]
iio: adc: cpcap-adc: kernel-doc fix - that should be _ in structure name

Fixes a W=1 warning.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20210314164655.408461-6-jic23@kernel.org
3 years agoiio: dac: ad5504: fix wrong part number in kernel-doc structure name.
Jonathan Cameron [Sun, 14 Mar 2021 16:46:51 +0000 (16:46 +0000)]
iio: dac: ad5504: fix wrong part number in kernel-doc structure name.

Probably a bit of cut and paste where someone forgot to change the
part number.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20210314164655.408461-5-jic23@kernel.org
3 years agoiio: dac: ad5770r: kernel-doc fix case of letter R wrong in structure name
Jonathan Cameron [Sun, 14 Mar 2021 16:46:50 +0000 (16:46 +0000)]
iio: dac: ad5770r: kernel-doc fix case of letter R wrong in structure name

Nothing useful to add beyond this causing a warning with W=1

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210314164655.408461-4-jic23@kernel.org
3 years agoiio: adc: ti-adc084s021: kernel-doc fixes, missing function names
Jonathan Cameron [Sun, 14 Mar 2021 16:46:49 +0000 (16:46 +0000)]
iio: adc: ti-adc084s021: kernel-doc fixes, missing function names

The documentation in this driver was nearly kernel-doc and was marked
as such. Unfortunately the format was wrong and function names were
missing. This patch puts them in with minor edits to keep the resulting
line short.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Gwendal Grignou <gwendal@chromium.org>
Cc: Mårten Lindahl <martenli@axis.com>
Link: https://lore.kernel.org/r/20210314164655.408461-3-jic23@kernel.org
3 years agoiio: pressure: zpa2326: kernel-doc fixes
Jonathan Cameron [Sun, 14 Mar 2021 16:46:48 +0000 (16:46 +0000)]
iio: pressure: zpa2326: kernel-doc fixes

Two comment blocks had wrong naming for function/structures that they
referred to.  Results in warnings when doing a W=1 build.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20210314164655.408461-2-jic23@kernel.org
3 years agocounter: add IRQ or GPIO based counter
Oleksij Rempel [Mon, 1 Mar 2021 08:04:01 +0000 (09:04 +0100)]
counter: add IRQ or GPIO based counter

Add simple IRQ or GPIO base counter. This device is used to measure
rotation speed of some agricultural devices, so no high frequency on the
counter pin is expected.

The maximal measurement frequency depends on the CPU and system load. On
the idle iMX6S I was able to measure up to 20kHz without count drops.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Reviewed-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/20210301080401.22190-3-o.rempel@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agodt-bindings: counter: add interrupt-counter binding
Oleksij Rempel [Mon, 1 Mar 2021 08:04:00 +0000 (09:04 +0100)]
dt-bindings: counter: add interrupt-counter binding

Add binding for the interrupt counter node

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210301080401.22190-2-o.rempel@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agostaging: iio: ad9834: convert to device-managed functions in probe
Alexandru Ardelean [Wed, 10 Mar 2021 09:51:31 +0000 (11:51 +0200)]
staging: iio: ad9834: convert to device-managed functions in probe

This change converts the driver to use device-managed functions in the
probe function. For the clock and regulator disable, some
devm_add_action_or_reset() calls are required, and then
devm_iio_device_register() function can be used register the IIO device.

The final aim here would be for IIO to export only the device-managed
functions of it's API. That's a long way to go and this a small step in
that direction.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210310095131.47476-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: temperature: tmp007: use device-managed functions in probe
Alexandru Ardelean [Wed, 10 Mar 2021 09:38:00 +0000 (11:38 +0200)]
iio: temperature: tmp007: use device-managed functions in probe

This change converts the driver to use device-managed functions in the
probe function. The power-down call is handled now via a
devm_add_action_or_reset() hook, and then devm_iio_device_register() can be
used to register the IIO device.

The final aim here would be for IIO to export only the device-managed
functions of it's API. That's a long way to go and this a small step in
that direction.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210310093800.45822-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: buffer: fix use-after-free for attached_buffers array
Alexandru Ardelean [Sun, 7 Mar 2021 18:54:44 +0000 (20:54 +0200)]
iio: buffer: fix use-after-free for attached_buffers array

Thanks to Lars for finding this.
The free of the 'attached_buffers' array should be done as late as
possible. This change moves it to iio_buffers_put(), which looks like
the best place for it, since it takes place right before the IIO device
data is free'd.
The free of this array will be handled by calling iio_device_free().
The iio_buffers_put() function is renamed to iio_device_detach_buffers()
since the role of this function changes a bit.

It looks like this issue was ocurring on the error path of
iio_buffers_alloc_sysfs_and_mask() and in
iio_buffers_free_sysfs_and_mask()

Added a comment in the doc-header of iio_device_attach_buffer() to
mention how this will be free'd in case anyone is reading the code
and becoming confused about it.

Fixes: ee708e6baacd ("iio: buffer: introduce support for attaching more IIO buffers")
Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210307185444.32924-1-ardeleanalex@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agohwmon: (ntc_thermistor): try reading processed
Linus Walleij [Mon, 8 Mar 2021 10:02:19 +0000 (11:02 +0100)]
hwmon: (ntc_thermistor): try reading processed

Before trying the custom method of reading the sensor
as raw and then converting, we want to use
iio_read_channel_processed_scale() which first tries to
see if the ADC can provide a processed value directly,
else reads raw and applies scaling inside of IIO
using the scale attributes of the ADC. We need to
multiply the scaled value with 1000 to get to
microvolts from millivolts which is what processed
IIO channels returns.

Keep the code that assumes 12bit ADC around as a
fallback.

This gives correct readings on the AB8500 thermistor
inputs used in the Ux500 HREFP520 platform for reading
battery and board temperature.

Cc: Peter Rosin <peda@axentia.se>
Cc: Chris Lesiak <chris.lesiak@licor.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org
Link: https://lore.kernel.org/linux-iio/20201224011607.1059534-1-linus.walleij@linaro.org/
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Chris Lesiak <chris.lesiak@licor.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20210308100219.2732156-2-linus.walleij@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: Provide iio_read_channel_processed_scale() API
Linus Walleij [Mon, 8 Mar 2021 10:02:18 +0000 (11:02 +0100)]
iio: Provide iio_read_channel_processed_scale() API

Since the old iio_read_channel_processed() would
lose precision if we fall back to reading raw and
scaling, we introduce a new API that will pass in
a scale factor when reading a processed channel:
iio_read_channel_processed_scale().

Refactor iio_read_channel_processed() as a special
case with scale factor 1.

Cc: Peter Rosin <peda@axentia.se>
Cc: Chris Lesiak <chris.lesiak@licor.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org
Link: https://lore.kernel.org/linux-iio/20201224011607.1059534-1-linus.walleij@linaro.org/
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210308100219.2732156-1-linus.walleij@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: xilinx-xadc: Remove code to set trigger parent
Gwendal Grignou [Tue, 9 Mar 2021 19:36:20 +0000 (11:36 -0800)]
iio: xilinx-xadc: Remove code to set trigger parent

iio_trigger_set_drvdata() sets the trigger device parent to first
argument of viio_trigger_alloc(), no need to do it again in the driver
code.

In xadc_alloc_trigger, given dev is indio_dev->dev.parent, and we call
devm_iio_trigger_alloc wit dev as argument,  we do not have to set
data->trig->dev.parent to indio_dev->dev.parent anymore.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210309193620.2176163-9-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: as3935: Remove code to set trigger parent
Gwendal Grignou [Tue, 9 Mar 2021 19:36:19 +0000 (11:36 -0800)]
iio: as3935: Remove code to set trigger parent

iio_trigger_set_drvdata() sets the trigger device parent to first
argument of viio_trigger_alloc(), no need to do it again in the driver
code.

Given we call devm_iio_trigger_alloc() and devm_iio_device_alloc() with
dev as parent, we do not have to set data->trig->dev.parent to
indio_dev->dev.parent anymore.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>
Link: https://lore.kernel.org/r/20210309193620.2176163-8-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: chemical: atlas: Remove code to set trigger parent
Gwendal Grignou [Tue, 9 Mar 2021 19:36:18 +0000 (11:36 -0800)]
iio: chemical: atlas: Remove code to set trigger parent

iio_trigger_set_drvdata() sets the trigger device parent to first
argument of viio_trigger_alloc(), no need to do it again in the driver
code.

Given we call devm_iio_trigger_alloc() and devm_iio_device_alloc() with
&client->dev as parent, we do not have to set data->trig->dev.parent to
indio_dev->dev.parent anymore.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>
Link: https://lore.kernel.org/r/20210309193620.2176163-7-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: lmp91000: Remove code to set trigger parent
Gwendal Grignou [Tue, 9 Mar 2021 19:36:17 +0000 (11:36 -0800)]
iio: lmp91000: Remove code to set trigger parent

iio_trigger_set_drvdata() sets the trigger device parent to first
argument of viio_trigger_alloc(), no need to do it again in the driver
code.

Given data->dev is dev, and we call devm_iio_trigger_alloc with
dev instead of data->dev, we do not have to set data->trig->dev.parent to
dev anymore.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>
Link: https://lore.kernel.org/r/20210309193620.2176163-6-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: gp2ap020a00f: Remove code to set trigger parent
Gwendal Grignou [Tue, 9 Mar 2021 19:36:16 +0000 (11:36 -0800)]
iio: gp2ap020a00f: Remove code to set trigger parent

iio_trigger_set_drvdata() sets the trigger device parent to first
argument of viio_trigger_alloc(), no need to do it again in the driver
code.

Given data->client is client, and we call devm_iio_trigger_alloc() with
&client->dev, we do not have to set data->trig->dev.parent to
&data->client->dev anymore.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210309193620.2176163-5-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: adis_trigger: Remove code to set trigger parent
Gwendal Grignou [Tue, 9 Mar 2021 19:36:15 +0000 (11:36 -0800)]
iio: adis_trigger: Remove code to set trigger parent

iio_trigger_set_drvdata() sets the trigger device parent to first
argument of viio_trigger_alloc(), no need to do it again in the driver
code.
Remove adis_trigger_setup() to match other drivers where setting the
trigger is usually done in the probe() routine.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210309193620.2176163-4-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: fix devm_iio_trigger_alloc with parent.cocci
Gwendal Grignou [Tue, 9 Mar 2021 19:36:14 +0000 (11:36 -0800)]
iio: fix devm_iio_trigger_alloc with parent.cocci

Use cocci semantic patch:
@@
expression trigger, P;
@@
   trigger = devm_iio_trigger_alloc(P, ...);
   ...
-  trigger->dev.parent = P;

To remove trigger->dev.parent, since it is set by default.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210309193620.2176163-3-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: set default trig->dev.parent
Gwendal Grignou [Tue, 9 Mar 2021 19:36:13 +0000 (11:36 -0800)]
iio: set default trig->dev.parent

When allocated with [devm_]iio_trigger_alloc(), set trig device parent to
the device the trigger is allocated for by default.

It can always be reassigned in the probe routine.

Change iio_trigger_alloc() API to add the device pointer to be coherent
with devm_iio_trigger_alloc, using similar interface to
iio_device_alloc().

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210309193620.2176163-2-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: adc: ad7124: allow more than 8 channels
Alexandru Tachici [Thu, 11 Mar 2021 09:11:54 +0000 (11:11 +0200)]
iio: adc: ad7124: allow more than 8 channels

Currently AD7124-8 driver cannot use more than 8 IIO channels
because it was assigning the channel configurations bijectively
to channels specified in the device-tree. This is not possible
to do when using more than 8 channels as AD7124-8 has only 8
configuration registers.

To allow the user to use all channels at once the driver
will keep in memory configurations for all channels but
will program only 8 of them at a time on the device.
If multiple channels have the same configuration, only
one configuration register will be used. If there
are more configurations than available registers only
the last 8 used configurations will be allowed to exist
on the device in a LRU fashion.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20210311091154.47785-2-alexandru.tachici@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: light: gp2ap002: Drop unneeded explicit casting
Andy Shevchenko [Fri, 12 Mar 2021 13:49:03 +0000 (15:49 +0200)]
iio: light: gp2ap002: Drop unneeded explicit casting

The unnecessary explicit casting is being used. Drop it for good.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210312134903.4296-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: imu: st_lsm6dsx: Drop unneeded explicit castings
Andy Shevchenko [Fri, 12 Mar 2021 13:47:43 +0000 (15:47 +0200)]
iio: imu: st_lsm6dsx: Drop unneeded explicit castings

In a few places the unnecessary explicit castings are being used.
Drop them for good.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210312134743.4055-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: imu: fxos8700: Drop unneeded explicit castings
Andy Shevchenko [Fri, 12 Mar 2021 13:45:38 +0000 (15:45 +0200)]
iio: imu: fxos8700: Drop unneeded explicit castings

In a few places the unnecessary explicit castings are being used.
Drop them for good.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210312134538.3759-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: chemical: bmp680: Drop unneeded explicit castings
Andy Shevchenko [Fri, 12 Mar 2021 13:43:49 +0000 (15:43 +0200)]
iio: chemical: bmp680: Drop unneeded explicit castings

In few places the unnecessary explicit castings are being used.
Drop them for good.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210312134349.3472-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: proximity: Add a ChromeOS EC MKBP proximity driver
Stephen Boyd [Thu, 11 Feb 2021 02:46:01 +0000 (18:46 -0800)]
iio: proximity: Add a ChromeOS EC MKBP proximity driver

Add support for a ChromeOS EC proximity driver that exposes a "front"
proximity sensor via the IIO subsystem. The EC decides when front
proximity is near and sets an MKBP switch 'EC_MKBP_FRONT_PROXIMITY' to
notify the kernel of proximity. Similarly, when proximity detects
something far away it sets the switch bit to 0. For now this driver
exposes a single sensor, but it could be expanded in the future via more
MKBP bits if desired.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Benson Leung <bleung@chromium.org>
Cc: Guenter Roeck <groeck@chromium.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20210211024601.1963379-4-swboyd@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agodt-bindings: iio: Add cros ec proximity yaml doc
Stephen Boyd [Thu, 11 Feb 2021 02:46:00 +0000 (18:46 -0800)]
dt-bindings: iio: Add cros ec proximity yaml doc

Some cros ECs support a front proximity MKBP event via
'EC_MKBP_FRONT_PROXIMITY'. Add a DT binding to document this feature via
a node that is a child of the main cros_ec device node. Devices that
have this ability will describe this in firmware.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Benson Leung <bleung@chromium.org>
Cc: Guenter Roeck <groeck@chromium.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Gwendal Grignou <gwendal@chromium.org>
Cc: <devicetree@vger.kernel.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20210211024601.1963379-3-swboyd@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoplatform/chrome: cros_ec: Add SW_FRONT_PROXIMITY MKBP define
Stephen Boyd [Thu, 11 Feb 2021 02:45:59 +0000 (18:45 -0800)]
platform/chrome: cros_ec: Add SW_FRONT_PROXIMITY MKBP define

Some cros ECs support a front proximity MKBP event via
'EC_MKBP_FRONT_PROXIMITY'. Add this define so it can be used in a
future patch.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Benson Leung <bleung@chromium.org>
Cc: Guenter Roeck <groeck@chromium.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Gwendal Grignou <gwendal@chromium.org>
Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20210211024601.1963379-2-swboyd@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: Remove kernel-doc keyword in file header comment
Gwendal Grignou [Tue, 9 Mar 2021 23:43:14 +0000 (15:43 -0800)]
iio: Remove kernel-doc keyword in file header comment

Remove kernel-doc keyword from function header comment.
It fixes issues spotted by scripts/kernel-doc like:
drivers/iio/<driver>.c:3: info: Scanning doc for function <component name>
drivers/iio/<driver>.c:X: warning: expecting prototype for <component name>.
  Prototype was for <function>() instead

To reproduce the errors:
scripts/kernel-doc -v -none $(find drivers/iio/ -name \*.c \
-exec head -2 {} \+ | grep -B2 -e '\*\*' | grep '==' | cut -d ' ' -f 2)

After, confirm these errors are gone with:
scripts/kernel-doc -v -none $(git show --name-only  | grep -e "^driver")

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20210309234314.2208256-1-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: kfifo: mask flags without zero-check in devm_iio_kfifo_buffer_setup()
Alexandru Ardelean [Sat, 6 Mar 2021 16:28:34 +0000 (18:28 +0200)]
iio: kfifo: mask flags without zero-check in devm_iio_kfifo_buffer_setup()

As pointed by Lars, this doesn't require a zero-check. Also, while looking
at this a little closer at it (again), the masking can be done later, as
there is a zero-check for 'mode_flags' anyway, which returns -EINVAL. And
we only need the 'mode_flags' later in the logic.

This change is more of a tweak.

Fixes: e36db6a06937 ("iio: kfifo: add devm_iio_kfifo_buffer_setup() helper")
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210306162834.7339-1-ardeleanalex@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: hrtimer: Allow sub Hz granularity
Gwendal Grignou [Fri, 26 Feb 2021 01:47:33 +0000 (17:47 -0800)]
iio: hrtimer: Allow sub Hz granularity

Allow setting frequency below 1Hz or sub 1Hz precision.
Useful for slow sensors like ALS.

Test frequency is set properly:
modprobe iio-trig-hrtimer && \
mkdir /sys/kernel/config/iio/triggers/hrtimer/t1 && \
cd /sys/bus/iio/devices/triggerX ;
for i in 1 .1 .01 .001 ; do
  echo $i > sampling_frequency
  cat sampling_frequency
done

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210226014733.2108544-1-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agostaging: iio: remove mention of defunct list
Baruch Siach [Tue, 23 Feb 2021 12:12:23 +0000 (14:12 +0200)]
staging: iio: remove mention of defunct list

The ADI device-drivers-devel list no longer exists.

Cc: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Link: https://lore.kernel.org/r/69b3e45e7666a1dd74a83df0b84ef8a63bf090ea.1614082343.git.baruch@tkos.co.il
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: accel: mma8452: fix indentation
Sean Nyekjaer [Mon, 1 Mar 2021 08:00:28 +0000 (09:00 +0100)]
iio: accel: mma8452: fix indentation

Improve readability by fixing indentation.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Link: https://lore.kernel.org/r/20210301080029.1974797-1-sean@geanix.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>