From aellenvera at gmail.com Mon Mar 1 03:27:16 2021 From: aellenvera at gmail.com (Mrs. Vera Aellen) Date: Mon, 1 Mar 2021 04:27:16 +0100 Subject: Greeting Message-ID: Good day You have been selected to receive my grant donation. Please, contact me for further detail.I shall be expecting your quick response veraaellen7 at gmail.com Best Regards, Mrs. Vera Aellen From dan.carpenter at oracle.com Mon Mar 1 06:23:06 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Mon, 1 Mar 2021 09:23:06 +0300 Subject: [PATCH] staging: rtl8723bs: Fixed indentation and coding style In-Reply-To: <20210227220233.10259-1-chakravarthikulkarni2021@gmail.com> References: <20210227220233.10259-1-chakravarthikulkarni2021@gmail.com> Message-ID: <20210301062306.GJ2087@kadam> On Sun, Feb 28, 2021 at 03:32:30AM +0530, chakravarthikulkarni wrote: > @@ -795,14 +795,14 @@ struct RunInThread_param { > > > /* > - > -Result: > -0x00: success > -0x01: sucess, and check Response. > -0x02: cmd ignored due to duplicated sequcne number > -0x03: cmd dropped due to invalid cmd code > -0x04: reserved. > - > +* > +*Result: > +*0x00: success > +*0x01: sucess, and check Response. > +*0x02: cmd ignored due to duplicated sequcne number > +*0x03: cmd dropped due to invalid cmd code > +*0x04: reserved. > +* > */ This indenting style is wrong. There should be a spaces around the '*' character: /* * Result: * 0x00: success * 0x01: sucess, and check Response. * 0x02: cmd ignored due to duplicated sequcne number * 0x03: cmd dropped due to invalid cmd code * 0x04: reserved. */ regards, dan carpenter From dan.carpenter at oracle.com Mon Mar 1 06:33:12 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Mon, 1 Mar 2021 09:33:12 +0300 Subject: [PATCH] staging: rtl8192u avoid flex array of flex array In-Reply-To: <20210228010614.162998-1-dagostinelli@gmail.com> References: <20210228010614.162998-1-dagostinelli@gmail.com> Message-ID: <20210301063312.GK2087@kadam> On Sat, Feb 27, 2021 at 07:06:14PM -0600, Darryl T. Agostinelli wrote: > Undo the flex array in struct ieee80211_info_element. It is used as the flex > array type in other structs (creating a flex array of flex arrays) making > sparse unhappy. This change maintains the intent of the code and satisfies > sparse. > > Signed-off-by: Darryl T. Agostinelli > --- > drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h > index 39f4ddd86796..43bb7aeb35e3 100644 > --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h > +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h > @@ -951,7 +951,7 @@ struct rtl_80211_hdr_4addrqos { > struct ieee80211_info_element { > u8 id; > u8 len; > - u8 data[]; > + u8 data[0]; Nah... Just ignore Sparse on this. regards, dan carpenter From mike.ximing.chen at intel.com Mon Mar 1 08:11:29 2021 From: mike.ximing.chen at intel.com (Chen, Mike Ximing) Date: Mon, 1 Mar 2021 08:11:29 +0000 Subject: [PATCH 4/4] staging:rtl8712: replace cap_* definitions with native kernel WLAN_CAPABILITY_* In-Reply-To: <20210227222236.581490-5-insafonov@gmail.com> References: <20210227222236.581490-1-insafonov@gmail.com> <20210227222236.581490-5-insafonov@gmail.com> Message-ID: > -----Original Message----- > From: Ivan Safonov > Sent: Saturday, February 27, 2021 5:23 PM > To: Greg Kroah-Hartman > Cc: Florian Schilhabel ; Larry Finger > ; Michael Straube ; Pascal > Terjan ; devel at driverdev.osuosl.org; linux- > kernel at vger.kernel.org; Ivan Safonov > Subject: [PATCH 4/4] staging:rtl8712: replace cap_* definitions with native kernel > WLAN_CAPABILITY_* > > cap_* definitions duplicate WLAN_CAPABILITY_*. Remove cap_* definitions, > improve code consistency. > > Signed-off-by: Ivan Safonov > --- > drivers/staging/rtl8712/ieee80211.c | 6 +++--- > drivers/staging/rtl8712/wifi.h | 7 ------- > 2 files changed, 3 insertions(+), 10 deletions(-) > > diff --git a/drivers/staging/rtl8712/ieee80211.c > b/drivers/staging/rtl8712/ieee80211.c > index b4a099169c7c..13fc3c1ec0db 100644 > --- a/drivers/staging/rtl8712/ieee80211.c > +++ b/drivers/staging/rtl8712/ieee80211.c > @@ -173,11 +173,11 @@ int r8712_generate_ie(struct registry_priv *registrypriv) > ie += 2; > /*capability info*/ > *(u16 *)ie = 0; > - *(__le16 *)ie |= cpu_to_le16(cap_IBSS); > + *(__le16 *)ie |= cpu_to_le16(WLAN_CAPABILITY_IBSS); > if (registrypriv->preamble == PREAMBLE_SHORT) > - *(__le16 *)ie |= cpu_to_le16(cap_ShortPremble); > + *(__le16 *)ie |= > cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE); > if (dev_network->Privacy) > - *(__le16 *)ie |= cpu_to_le16(cap_Privacy); > + *(__le16 *)ie |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); > sz += 2; > ie += 2; > /*SSID*/ > diff --git a/drivers/staging/rtl8712/wifi.h b/drivers/staging/rtl8712/wifi.h > index b7889ac3dce9..f941efb1f4e2 100644 > --- a/drivers/staging/rtl8712/wifi.h > +++ b/drivers/staging/rtl8712/wifi.h > @@ -278,13 +278,6 @@ static inline unsigned char *get_hdr_bssid(unsigned char > *pframe) > #define AUTH_ODD_TO 0 > #define AUTH_EVEN_TO 1 > > -#define cap_ESS BIT(0) > -#define cap_IBSS BIT(1) > -#define cap_CFPollable BIT(2) > -#define cap_CFRequest BIT(3) > -#define cap_Privacy BIT(4) > -#define cap_ShortPremble BIT(5) > - > /*----------------------------------------------------------------------------- > * Below is the definition for 802.11i / 802.1x > *------------------------------------------------------------------------------ > -- > 2.26.2 Reviewed-by: Mike Ximing Chen From aellenvera at gmail.com Mon Mar 1 10:31:41 2021 From: aellenvera at gmail.com (Mrs. Vera Aellen) Date: Mon, 1 Mar 2021 11:31:41 +0100 Subject: Greeting Message-ID: Good day You have been selected to receive my grant donation. Please, contact me for further detail.I shall be expecting your quick response veraaellen7 at gmail.com Best Regards, Mrs. Vera Aellen From cfebriyanto at gmail.com Mon Mar 1 13:12:22 2021 From: cfebriyanto at gmail.com (Candy Febriyanto) Date: Mon, 1 Mar 2021 20:12:22 +0700 Subject: [PATCH 0/3] staging: rtl8723bs: Replace sprintf with scnprintf Message-ID: This patchset replaces most calls to sprintf with scnprintf, thereby preventing potential buffer overflows. The rest I left alone because they write to a buffer passed by a caller that doesn't pass its size alongside it. Candy Febriyanto (3): staging: rtl8723bs: core: Replace sprintf with scnprintf staging: rtl8723bs: hal: Replace sprintf with scnprintf staging: rtl8723bs: os_dep: Replace sprintf with scnprintf drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 3 +- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 4 +- drivers/staging/rtl8723bs/hal/hal_com.c | 45 ++++++++++--------- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 20 +++++---- drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 6 +-- 5 files changed, 41 insertions(+), 37 deletions(-) -- 2.30.1 From cfebriyanto at gmail.com Mon Mar 1 13:12:59 2021 From: cfebriyanto at gmail.com (Candy Febriyanto) Date: Mon, 1 Mar 2021 20:12:59 +0700 Subject: [PATCH 1/3] staging: rtl8723bs: core: Replace sprintf with scnprintf In-Reply-To: References: Message-ID: <6c260641164d6856fc4447555fe739124cb27c19.1614603705.git.cfebriyanto@gmail.com> The use of sprintf with format string here means that there is a risk that the writes will go out of bounds, replace it with scnprintf. In on_action_public_default the variable "cnt" isn't being used for anything meaningful so remove it. Signed-off-by: Candy Febriyanto --- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 3 +-- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index fa4b0259c5ae..3443a5764c50 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -2084,7 +2084,6 @@ static unsigned int on_action_public_default(union recv_frame *precv_frame, u8 a u8 *frame_body = pframe + sizeof(struct ieee80211_hdr_3addr); u8 token; struct adapter *adapter = precv_frame->u.hdr.adapter; - int cnt = 0; char msg[64]; token = frame_body[2]; @@ -2092,7 +2091,7 @@ static unsigned int on_action_public_default(union recv_frame *precv_frame, u8 a if (rtw_action_public_decache(precv_frame, token) == _FAIL) goto exit; - cnt += sprintf((msg+cnt), "%s(token:%u)", action_public_str(action), token); + scnprintf(msg, sizeof(msg), "%s(token:%u)", action_public_str(action), token); rtw_cfg80211_rx_action(adapter, pframe, frame_len, msg); ret = _SUCCESS; diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index 5b05d1eaa328..c9f4a18b24b9 100644 --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c @@ -554,7 +554,7 @@ void LPS_Enter(struct adapter *padapter, const char *msg) /* Idle for a while if we connect to AP a while ago. */ if (pwrpriv->LpsIdleCount >= 2) { /* 4 Sec */ if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) { - sprintf(buf, "WIFI-%s", msg); + scnprintf(buf, sizeof(buf), "WIFI-%s", msg); pwrpriv->bpower_saving = true; rtw_set_ps_mode(padapter, pwrpriv->power_mgnt, padapter->registrypriv.smart_ps, 0, buf); } @@ -584,7 +584,7 @@ void LPS_Leave(struct adapter *padapter, const char *msg) if (pwrpriv->bLeisurePs) { if (pwrpriv->pwr_mode != PS_MODE_ACTIVE) { - sprintf(buf, "WIFI-%s", msg); + scnprintf(buf, sizeof(buf), "WIFI-%s", msg); rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, buf); if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) -- 2.30.1 From cfebriyanto at gmail.com Mon Mar 1 13:13:30 2021 From: cfebriyanto at gmail.com (Candy Febriyanto) Date: Mon, 1 Mar 2021 20:13:30 +0700 Subject: [PATCH 2/3] staging: rtl8723bs: hal: Replace sprintf with scnprintf In-Reply-To: References: Message-ID: The use of sprintf with format string here means that there is a risk that the writes will go out of bounds, replace it with scnprintf. Also avoid unnecessarily passing "%s" on some of the function calls. Signed-off-by: Candy Febriyanto --- drivers/staging/rtl8723bs/hal/hal_com.c | 45 +++++++++++++------------ 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 16b259acbe1a..173ccaba2537 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -40,47 +40,50 @@ void rtw_hal_data_deinit(struct adapter *padapter) void dump_chip_info(HAL_VERSION ChipVersion) { - int cnt = 0; - u8 buf[128]; + char buf[128]; + size_t cnt = 0; + + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "Chip Version Info: CHIP_8723B_%s_", + IS_NORMAL_CHIP(ChipVersion) ? "Normal_Chip" : "Test_Chip"); - cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8723B_"); - cnt += sprintf((buf+cnt), "%s_", IS_NORMAL_CHIP(ChipVersion) ? "Normal_Chip" : "Test_Chip"); if (IS_CHIP_VENDOR_TSMC(ChipVersion)) - cnt += sprintf((buf+cnt), "%s_", "TSMC"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "TSMC_"); else if (IS_CHIP_VENDOR_UMC(ChipVersion)) - cnt += sprintf((buf+cnt), "%s_", "UMC"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "UMC_"); else if (IS_CHIP_VENDOR_SMIC(ChipVersion)) - cnt += sprintf((buf+cnt), "%s_", "SMIC"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "SMIC_"); if (IS_A_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "A_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "A_CUT_"); else if (IS_B_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "B_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "B_CUT_"); else if (IS_C_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "C_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "C_CUT_"); else if (IS_D_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "D_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "D_CUT_"); else if (IS_E_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "E_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "E_CUT_"); else if (IS_I_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "I_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "I_CUT_"); else if (IS_J_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "J_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "J_CUT_"); else if (IS_K_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "K_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "K_CUT_"); else - cnt += sprintf((buf+cnt), "UNKNOWN_CUT(%d)_", ChipVersion.CUTVersion); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, + "UNKNOWN_CUT(%d)_", ChipVersion.CUTVersion); if (IS_1T1R(ChipVersion)) - cnt += sprintf((buf+cnt), "1T1R_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "1T1R_"); else if (IS_1T2R(ChipVersion)) - cnt += sprintf((buf+cnt), "1T2R_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "1T2R_"); else if (IS_2T2R(ChipVersion)) - cnt += sprintf((buf+cnt), "2T2R_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "2T2R_"); else - cnt += sprintf((buf+cnt), "UNKNOWN_RFTYPE(%d)_", ChipVersion.RFType); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, + "UNKNOWN_RFTYPE(%d)_", ChipVersion.RFType); - cnt += sprintf((buf+cnt), "RomVer(%d)\n", ChipVersion.ROMVer); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "RomVer(%d)\n", ChipVersion.ROMVer); DBG_871X("%s", buf); } -- 2.30.1 From cfebriyanto at gmail.com Mon Mar 1 13:13:54 2021 From: cfebriyanto at gmail.com (Candy Febriyanto) Date: Mon, 1 Mar 2021 20:13:54 +0700 Subject: [PATCH 3/3] staging: rtl8723bs: os_dep: Replace sprintf with scnprintf In-Reply-To: References: Message-ID: <502b559ee7d6a2736f10d8228002ac7780243cd1.1614603705.git.cfebriyanto@gmail.com> The use of sprintf with format string here means that there is a risk that the writes will go out of bounds, replace it with scnprintf. In one block of the translate_scan function sprintf is only called once (it's not being used to concatenate strings) so there is no need to keep the pointer "p", remove it. Signed-off-by: Candy Febriyanto --- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 20 ++++++++++--------- drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 6 +++--- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index 41389e266f54..0bc3585d7097 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -240,9 +240,10 @@ static char *translate_scan(struct adapter *padapter, return start; if (wpa_len > 0) { p = buf; - p += sprintf(p, "wpa_ie ="); + p += scnprintf(p, (MAX_WPA_IE_LEN * 2) - (p - buf), "wpa_ie ="); for (i = 0; i < wpa_len; i++) - p += sprintf(p, "%02x", wpa_ie[i]); + p += scnprintf(p, (MAX_WPA_IE_LEN * 2) - (p - buf), + "%02x", wpa_ie[i]); if (wpa_len > 100) { printk("-----------------Len %d----------------\n", wpa_len); @@ -265,9 +266,10 @@ static char *translate_scan(struct adapter *padapter, if (rsn_len > 0) { p = buf; memset(buf, 0, MAX_WPA_IE_LEN*2); - p += sprintf(p, "rsn_ie ="); + p += scnprintf(p, (MAX_WPA_IE_LEN * 2) - (p - buf), "rsn_ie ="); for (i = 0; i < rsn_len; i++) - p += sprintf(p, "%02x", rsn_ie[i]); + p += scnprintf(p, (MAX_WPA_IE_LEN * 2) - (p - buf), + "%02x", rsn_ie[i]); memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVCUSTOM; iwe.u.data.length = strlen(buf); @@ -365,14 +367,14 @@ static char *translate_scan(struct adapter *padapter, { u8 *buf; - u8 *p, *pos; + u8 *pos; buf = kzalloc(MAX_WPA_IE_LEN, GFP_ATOMIC); if (!buf) goto exit; - p = buf; + pos = pnetwork->network.Reserved; - p += sprintf(p, "fm =%02X%02X", pos[1], pos[0]); + scnprintf(buf, MAX_WPA_IE_LEN, "fm =%02X%02X", pos[1], pos[0]); memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVCUSTOM; iwe.u.data.length = strlen(buf); @@ -5082,7 +5084,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ case IW_PRIV_TYPE_BYTE: /* Display args */ for (j = 0; j < n; j++) { - sprintf(str, "%d ", extra[j]); + scnprintf(str, sizeof(str), "%d ", extra[j]); len = strlen(str); output_len = strlen(output); if ((output_len + len + 1) > 4096) { @@ -5096,7 +5098,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ case IW_PRIV_TYPE_INT: /* Display args */ for (j = 0; j < n; j++) { - sprintf(str, "%d ", ((__s32 *)extra)[j]); + scnprintf(str, sizeof(str), "%d ", ((__s32 *)extra)[j]); len = strlen(str); output_len = strlen(output); if ((output_len + len + 1) > 4096) { diff --git a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c index d46c65ab384b..20899b2cff43 100644 --- a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c @@ -159,15 +159,15 @@ void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie) } p = buff; - p += sprintf(p, "ASSOCINFO(ReqIEs ="); + p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), "ASSOCINFO(ReqIEs ="); len = sec_ie[1] + 2; len = (len < IW_CUSTOM_MAX) ? len : IW_CUSTOM_MAX; for (i = 0; i < len; i++) - p += sprintf(p, "%02x", sec_ie[i]); + p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), "%02x", sec_ie[i]); - p += sprintf(p, ")"); + p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), ")"); memset(&wrqu, 0, sizeof(wrqu)); -- 2.30.1 From dan.carpenter at oracle.com Mon Mar 1 13:25:35 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Mon, 1 Mar 2021 16:25:35 +0300 Subject: [PATCH] staging: rtl8192e: Fix possible buffer overflow in _rtl92e_wx_set_scan In-Reply-To: <20210226140526.GG2222@kadam> References: <20210226114829.316980-1-leegib@gmail.com> <20210226134333.GA2087@kadam> <20210226140526.GG2222@kadam> Message-ID: <20210301132535.GR2087@kadam> On Fri, Feb 26, 2021 at 05:05:26PM +0300, Dan Carpenter wrote: > Here is a v2 of my check. I've changed it to mark all "->ssid" and > everything in "(struct ieee80211_network)" as protected. I'm just > playing around with it at this point to explore what works best. It's > impossible to know until after some results come back. > [ Added linux-wireless to the CC list. Here was the original check I wrote on Friday. https://lore.kernel.org/lkml/20210226140526.GG2222 at kadam/ ] This check worked out pretty well. It's probably 50% bugs? Unfiltered results below. The trick of warning for "if (ststr(member, "->ssid")) " and the memcpy length couldn't be verified turned out to be the best. Protecting ieee80211_network didn't find anything. Sometimes we're copying from an existing (presumably verified) config to another config so the ->ssid_len is valid. An example of that is: drivers/staging/rtl8192e/rtllib_softmac.c:1685 rtllib_softmac_new_net() protected struct member '(struct rtllib_network)->ssid' overflow: rl='0-255' drivers/staging/rtl8192e/rtllib_softmac.c 1674 /* Save the essid so that if it is hidden, it is 1675 * replaced with the essid provided by the user. 1676 */ 1677 if (!ssidbroad) { 1678 memcpy(tmp_ssid, ieee->current_network.ssid, 1679 ieee->current_network.ssid_len); 1680 tmp_ssid_len = ieee->current_network.ssid_len; ^^^^^^^^^^^^ We can assume the existing ssid_len is valid 1681 } 1682 memcpy(&ieee->current_network, net, 1683 sizeof(ieee->current_network)); 1684 if (!ssidbroad) { 1685 memcpy(ieee->current_network.ssid, tmp_ssid, 1686 tmp_ssid_len); ^^^^^^^^^^^^ so this memcpy() won't overflow. It's easy enough for a human reviewer to make this sort of assumption, but Smatch can't. 1687 ieee->current_network.ssid_len = tmp_ssid_len; 1688 } All the code outside of drivers/ seems correct. They're mostly similar examples of copying the ssid from one valid existing config to another. The other places are using nla attrs like this: net/wireless/nl80211.c 14399 if (info->attrs[NL80211_ATTR_SSID]) { 14400 params.ssid.ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); 14401 if (params.ssid.ssid_len == 0) 14402 return -EINVAL; 14403 memcpy(params.ssid.ssid, 14404 nla_data(info->attrs[NL80211_ATTR_SSID]), 14405 params.ssid.ssid_len); 14406 } Smatch doesn't parse nla attributes correctly. They're capped using the nl80211_policy[] array: net/wireless/nl80211.c 528 [NL80211_ATTR_SSID] = { .type = NLA_BINARY, 529 .len = IEEE80211_MAX_SSID_LEN }, But there are quite a few real bugs as well. If anyone wants to fix any of these just claim a bug, and I won't send a patch for that warning. :) Lee, I think you mentioned that you had found a related buffer overflow fix? Did the check find it? regards, dan carpenter drivers/staging/rtl8192u/r8192U_wx.c:335 r8192_wx_set_scan() protected struct member '(struct ieee80211_network)->ssid' overflow: rl='1-255' drivers/staging/rtl8192e/rtllib_softmac.c:1685 rtllib_softmac_new_net() protected struct member '(struct rtllib_network)->ssid' overflow: rl='0-255' drivers/staging/rtl8192e/rtl8192e/rtl_wx.c:412 _rtl92e_wx_set_scan() protected struct member '(struct rtllib_network)->ssid' overflow: rl='1-255' drivers/staging/rtl8188eu/core/rtw_ap.c:795 rtw_check_beacon_data() protected struct member '(struct ndis_802_11_ssid)->ssid' overflow: rl='1-255' drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:1138 rtw_wx_set_scan() protected struct member '(struct ndis_802_11_ssid)->ssid' overflow: rl='1-127' drivers/net/wireless/ath/wcn36xx/smd.c:1571 wcn36xx_smd_set_bss_params() protected struct member '(struct wcn36xx_hal_mac_ssid)->ssid' overflow: rl='0-255' drivers/net/wireless/ath/ath11k/wmi.c:2148 ath11k_wmi_send_scan_start_cmd() protected struct member '(struct wmi_ssid)->ssid' overflow: rl='0-255' drivers/net/wireless/ath/wil6210/cfg80211.c:2100 wil_cfg80211_change_beacon() protected struct member '(struct wil6210_vif)->ssid' overflow: rl='0-255' drivers/net/wireless/ath/ath10k/wow.c:198 ath10k_wmi_pno_check() protected struct member '(struct wmi_ssid)->ssid' overflow: rl='0-255' drivers/net/wireless/ath/ath10k/wmi-tlv.c:2029 ath10k_wmi_tlv_op_gen_start_scan() protected struct member '(struct wmi_ssid)->ssid' overflow: rl='0-255' drivers/net/wireless/ath/ath10k/wmi-tlv.c:3929 ath10k_wmi_tlv_op_gen_config_pno_start() protected struct member '(struct wmi_ssid)->ssid' overflow: rl='0-u32max' drivers/net/wireless/ath/ath6kl/wmi.c:1884 ath6kl_wmi_connect_cmd() protected struct member '(struct wmi_connect_cmd)->ssid' overflow: rl='s32min-(-1),1-s32max' drivers/net/wireless/ath/ath6kl/cfg80211.c:932 ath6kl_set_probed_ssids() protected struct member '(struct cfg80211_ssid)->ssid' overflow: rl='0-255' drivers/net/wireless/ath/ath6kl/cfg80211.c:971 ath6kl_set_probed_ssids() protected struct member '(struct cfg80211_ssid)->ssid' overflow: rl='0-255' drivers/net/wireless/ath/ath6kl/cfg80211.c:1631 ath6kl_cfg80211_join_ibss() protected struct member '(struct ath6kl_vif)->ssid' overflow: rl='0-255' drivers/net/wireless/ath/ath6kl/cfg80211.c:2809 ath6kl_start_ap() protected struct member '(struct ath6kl_vif)->ssid' overflow: rl='0-65531' drivers/net/wireless/ath/ath6kl/cfg80211.c:2892 ath6kl_start_ap() protected struct member '(struct wmi_connect_cmd)->ssid' overflow: rl='0-65531' drivers/net/wireless/st/cw1200/sta.c:1293 cw1200_do_join() protected struct member '(struct wsm_join)->ssid' overflow: rl='0-255' drivers/net/wireless/st/cw1200/sta.c:2334 cw1200_start_ap() protected struct member '(struct wsm_start)->ssid' overflow: rl='0-255' drivers/net/wireless/quantenna/qtnfmac/event.c:573 qtnf_event_handle_external_auth() protected struct member '(struct cfg80211_ssid)->ssid' overflow: rl='1-255' drivers/net/wireless/marvell/mwifiex/uap_cmd.c:506 mwifiex_uap_bss_param_prepare() protected struct member '(struct host_cmd_tlv_ssid)->ssid' overflow: rl='1-u32max' drivers/net/wireless/marvell/mwifiex/join.c:428 mwifiex_cmd_802_11_associate() protected struct member '(struct mwifiex_ie_types_ssid_param_set)->ssid' overflow: rl='0-u16max' drivers/net/wireless/marvell/mwifiex/scan.c:933 mwifiex_config_scan() protected struct member '(struct mwifiex_ie_types_wildcard_ssid_params)->ssid' overflow: rl='0-255' drivers/net/wireless/marvell/mwifiex/scan.c:2383 mwifiex_cmd_802_11_bg_scan_config() protected struct member '(struct mwifiex_ie_types_wildcard_ssid_params)->ssid' overflow: rl='0-255' drivers/net/wireless/marvell/mwifiex/cfg80211.c:1999 mwifiex_cfg80211_start_ap() protected struct member '(struct mwifiex_802_11_ssid)->ssid' overflow: rl='1-65531' drivers/net/wireless/marvell/libertas/cfg.c:176 lbs_add_ssid_tlv() protected struct member '(struct mrvl_ie_ssid_param_set)->ssid' overflow: rl='s32min-s32max' drivers/net/wireless/marvell/libertas/cfg.c:1767 lbs_ibss_join_existing() protected struct member '(struct adhoc_bssdesc)->ssid' overflow: rl='0-255' drivers/net/wireless/marvell/libertas/cfg.c:1878 lbs_ibss_start_new() protected struct member '(struct cmd_ds_802_11_ad_hoc_start)->ssid' overflow: rl='0-255' drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:3708 brcmf_wowl_nd_results() protected struct member '(struct cfg80211_ssid)->ssid' overflow: rl='0-255' drivers/net/wireless/intel/iwlwifi/mvm/d3.c:1932 iwl_mvm_query_netdetect_reasons() protected struct member '(struct cfg80211_ssid)->ssid' overflow: rl='0-255' drivers/net/wireless/intel/iwlwifi/mvm/scan.c:486 iwl_scan_build_ssids() protected struct member '(struct iwl_ssid_ie)->ssid' overflow: rl='1-255' drivers/net/wireless/intel/iwlwifi/mvm/scan.c:500 iwl_scan_build_ssids() protected struct member '(struct iwl_ssid_ie)->ssid' overflow: rl='0-255' drivers/net/wireless/intel/iwlwifi/dvm/scan.c:721 iwlagn_request_scan() protected struct member '(struct iwl_ssid_ie)->ssid' overflow: rl='0-255' drivers/net/wireless/intel/ipw2x00/ipw2200.c:5870 ipw_adhoc_create() protected struct member '(struct libipw_network)->ssid' overflow: rl='0-255' drivers/net/wireless/intel/iwlegacy/3945-mac.c:2573 il3945_request_scan() protected struct member '(struct il_ssid_ie)->ssid' overflow: rl='1-255' drivers/net/wireless/intel/iwlegacy/4965-mac.c:919 il4965_request_scan() protected struct member '(struct il_ssid_ie)->ssid' overflow: rl='1-255' drivers/net/wireless/ti/wlcore/scan.c:351 wlcore_scan() protected struct member '(struct wl1271_scan)->ssid' overflow: rl='1-255' drivers/net/wireless/ti/wlcore/scan.c:410 wlcore_scan_sched_scan_ssid_list() protected struct member '(struct wl1271_ssid)->ssid' overflow: rl='0-255' drivers/net/wireless/ti/wlcore/scan.c:425 wlcore_scan_sched_scan_ssid_list() protected struct member '(struct wl1271_ssid)->ssid' overflow: rl='1-255' drivers/net/wireless/ti/wl18xx/scan.c:94 wl18xx_scan_send() protected struct member '(struct wl18xx_cmd_scan_params)->ssid' overflow: rl='0-255' drivers/net/wireless/ti/wl1251/cmd.c:459 wl1251_cmd_scan() protected struct member '(struct wl1251_scan_parameters)->ssid' overflow: rl='0-255' drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c:1338 mt76_connac_mcu_hw_scan() protected struct member '(struct mt76_connac_mcu_scan_ssid)->ssid' overflow: rl='1-255' drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c:1445 mt76_connac_mcu_sched_scan_req() protected struct member '(struct mt76_connac_mcu_scan_ssid)->ssid' overflow: rl='0-255' drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c:1452 mt76_connac_mcu_sched_scan_req() protected struct member '(struct mt76_connac_mcu_scan_match)->ssid' overflow: rl='0-255' net/wireless/nl80211.c:3890 nl80211_set_interface() protected struct member '(struct wireless_dev)->ssid' overflow: rl='0-255' net/wireless/nl80211.c:4001 nl80211_new_interface() protected struct member '(struct wireless_dev)->ssid' overflow: rl='0-255' net/wireless/nl80211.c:5503 nl80211_start_ap() protected struct member '(struct wireless_dev)->ssid' overflow: rl='0-255' net/wireless/nl80211.c:8382 nl80211_trigger_scan() protected struct member '(struct cfg80211_ssid)->ssid' overflow: rl='0-65527' net/wireless/nl80211.c:8836 nl80211_parse_sched_scan() protected struct member '(struct cfg80211_ssid)->ssid' overflow: rl='0-65527' net/wireless/nl80211.c:8874 nl80211_parse_sched_scan() protected struct member '(struct cfg80211_ssid)->ssid' overflow: rl='0-65531' net/wireless/nl80211.c:14403 nl80211_external_auth() protected struct member '(struct cfg80211_ssid)->ssid' overflow: rl='1-255' net/wireless/ibss.c:151 __cfg80211_join_ibss() protected struct member '(struct wireless_dev)->ssid' overflow: rl='0-255' net/wireless/ibss.c:424 cfg80211_ibss_wext_siwessid() protected struct member '(struct wireless_dev)->ssid' overflow: rl='0-u16max' net/wireless/mesh.c:212 __cfg80211_join_mesh() protected struct member '(struct wireless_dev)->ssid' overflow: rl='1-255' net/mac80211/ibss.c:330 __ieee80211_sta_join_ibss() protected struct member '(struct ieee80211_bss_conf)->ssid' overflow: rl='0-255' net/mac80211/ibss.c:1833 ieee80211_ibss_join() protected struct member '(struct ieee80211_if_ibss)->ssid' overflow: rl='0-255' net/mac80211/cfg.c:1132 ieee80211_start_ap() protected struct member '(struct ieee80211_bss_conf)->ssid' overflow: rl='1-65531' From leegib at gmail.com Mon Mar 1 13:26:48 2021 From: leegib at gmail.com (Lee Gibson) Date: Mon, 1 Mar 2021 13:26:48 +0000 Subject: [PATCH] staging: rtl8712: Fix possible buffer overflow in r8712_sitesurvey_cmd Message-ID: <20210301132648.420296-1-leegib@gmail.com> Function r8712_sitesurvey_cmd calls memcpy without checking the length. A user could control that length and trigger a buffer overflow. Fix by checking the length is within the maximum allowed size. Signed-off-by: Lee Gibson --- drivers/staging/rtl8712/rtl871x_cmd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index 18116469bd31..75716f59044d 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -192,8 +192,10 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter, psurveyPara->ss_ssidlen = 0; memset(psurveyPara->ss_ssid, 0, IW_ESSID_MAX_SIZE + 1); if (pssid && pssid->SsidLength) { - memcpy(psurveyPara->ss_ssid, pssid->Ssid, pssid->SsidLength); - psurveyPara->ss_ssidlen = cpu_to_le32(pssid->SsidLength); + int len = min_t(int, pssid->SsidLength, IW_ESSID_MAX_SIZE); + + memcpy(psurveyPara->ss_ssid, pssid->Ssid, len); + psurveyPara->ss_ssidlen = cpu_to_le32(len); } set_fwstate(pmlmepriv, _FW_UNDER_SURVEY); r8712_enqueue_cmd(pcmdpriv, ph2c); -- 2.25.1 From dan.carpenter at oracle.com Mon Mar 1 13:41:09 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Mon, 1 Mar 2021 16:41:09 +0300 Subject: [PATCH 3/3] staging: rtl8723bs: os_dep: Replace sprintf with scnprintf In-Reply-To: <502b559ee7d6a2736f10d8228002ac7780243cd1.1614603705.git.cfebriyanto@gmail.com> References: <502b559ee7d6a2736f10d8228002ac7780243cd1.1614603705.git.cfebriyanto@gmail.com> Message-ID: <20210301134109.GS2087@kadam> On Mon, Mar 01, 2021 at 08:13:54PM +0700, Candy Febriyanto wrote: > @@ -5082,7 +5084,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ > case IW_PRIV_TYPE_BYTE: > /* Display args */ > for (j = 0; j < n; j++) { > - sprintf(str, "%d ", extra[j]); > + scnprintf(str, sizeof(str), "%d ", extra[j]); > len = strlen(str); You could save a little code and combine the two statements: len = scnprintf(str, sizeof(str), "%d ", extra[j]); For bonus points, you could write a Coccinelle script to look for that pattern of calling strlen() on a freshly sprintfed string. > output_len = strlen(output); > if ((output_len + len + 1) > 4096) { regards, dan carpenter From hdegoede at redhat.com Mon Mar 1 13:45:00 2021 From: hdegoede at redhat.com (Hans de Goede) Date: Mon, 1 Mar 2021 14:45:00 +0100 Subject: [PATCH 0/3] staging: rtl8723bs: Replace sprintf with scnprintf In-Reply-To: References: Message-ID: <6e6c21b1-ad40-4719-b9bb-989a36ea7b4e@redhat.com> Hi, On 3/1/21 2:12 PM, Candy Febriyanto wrote: > This patchset replaces most calls to sprintf with scnprintf, thereby > preventing potential buffer overflows. The rest I left alone because > they write to a buffer passed by a caller that doesn't pass its size > alongside it. > > Candy Febriyanto (3): > staging: rtl8723bs: core: Replace sprintf with scnprintf > staging: rtl8723bs: hal: Replace sprintf with scnprintf > staging: rtl8723bs: os_dep: Replace sprintf with scnprintf > > drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 3 +- > drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 4 +- > drivers/staging/rtl8723bs/hal/hal_com.c | 45 ++++++++++--------- > .../staging/rtl8723bs/os_dep/ioctl_linux.c | 20 +++++---- > drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 6 +-- > 5 files changed, 41 insertions(+), 37 deletions(-) Thanks, the entire series looks good to me, for the series: Reviewed-by: Hans de Goede Regards, Hans From cfebriyanto at gmail.com Mon Mar 1 14:01:54 2021 From: cfebriyanto at gmail.com (Candy Febriyanto) Date: Mon, 1 Mar 2021 21:01:54 +0700 Subject: [PATCH 3/3] staging: rtl8723bs: os_dep: Replace sprintf with scnprintf In-Reply-To: <20210301134109.GS2087@kadam> References: <502b559ee7d6a2736f10d8228002ac7780243cd1.1614603705.git.cfebriyanto@gmail.com> <20210301134109.GS2087@kadam> Message-ID: On Mon, Mar 01, 2021 at 04:41:09PM +0300, Dan Carpenter wrote: > On Mon, Mar 01, 2021 at 08:13:54PM +0700, Candy Febriyanto wrote: > > @@ -5082,7 +5084,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ > > case IW_PRIV_TYPE_BYTE: > > /* Display args */ > > for (j = 0; j < n; j++) { > > - sprintf(str, "%d ", extra[j]); > > + scnprintf(str, sizeof(str), "%d ", extra[j]); > > len = strlen(str); > > You could save a little code and combine the two statements: > > len = scnprintf(str, sizeof(str), "%d ", extra[j]); Good catch, I'll send a V2. > > For bonus points, you could write a Coccinelle script to look for that > pattern of calling strlen() on a freshly sprintfed string. Sounds like a good idea, I don't know how to do it though so feel free. > > > output_len = strlen(output); > > if ((output_len + len + 1) > 4096) { > > regards, > dan carpenter From cfebriyanto at gmail.com Mon Mar 1 14:02:57 2021 From: cfebriyanto at gmail.com (Candy Febriyanto) Date: Mon, 1 Mar 2021 21:02:57 +0700 Subject: [PATCH 0/3] staging: rtl8723bs: Replace sprintf with scnprintf In-Reply-To: <6e6c21b1-ad40-4719-b9bb-989a36ea7b4e@redhat.com> References: <6e6c21b1-ad40-4719-b9bb-989a36ea7b4e@redhat.com> Message-ID: On Mon, Mar 01, 2021 at 02:45:00PM +0100, Hans de Goede wrote: > Hi, > > On 3/1/21 2:12 PM, Candy Febriyanto wrote: > > This patchset replaces most calls to sprintf with scnprintf, thereby > > preventing potential buffer overflows. The rest I left alone because > > they write to a buffer passed by a caller that doesn't pass its size > > alongside it. > > > > Candy Febriyanto (3): > > staging: rtl8723bs: core: Replace sprintf with scnprintf > > staging: rtl8723bs: hal: Replace sprintf with scnprintf > > staging: rtl8723bs: os_dep: Replace sprintf with scnprintf > > > > drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 3 +- > > drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 4 +- > > drivers/staging/rtl8723bs/hal/hal_com.c | 45 ++++++++++--------- > > .../staging/rtl8723bs/os_dep/ioctl_linux.c | 20 +++++---- > > drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 6 +-- > > 5 files changed, 41 insertions(+), 37 deletions(-) > > Thanks, the entire series looks good to me, for the series: > > Reviewed-by: Hans de Goede > > Regards, > > Hans > Thank you Hans. From robh at kernel.org Mon Mar 1 14:44:21 2021 From: robh at kernel.org (Rob Herring) Date: Mon, 01 Mar 2021 08:44:21 -0600 Subject: [PATCH v2 2/5] dt-bindings: media: IMX8MQ VPU: document reset usage In-Reply-To: <20210226091128.14379-3-benjamin.gaignard@collabora.com> References: <20210226091128.14379-1-benjamin.gaignard@collabora.com> <20210226091128.14379-3-benjamin.gaignard@collabora.com> Message-ID: <1614609861.076244.37861.nullmailer@robh.at.kernel.org> On Fri, 26 Feb 2021 10:11:25 +0100, Benjamin Gaignard wrote: > Document IMX8MQ VPU bindings to add the phandle to the reset driver. > > Provide an independent reset driver allow to the both VPUs to share > their control/reset hardware block. The reset driver replace what > was previously done be using the 'ctrl' registers inside the driver. > > This breaks the compatibility between DTB and kernel but the driver > is still in staging directory and limited to IMX8MQ SoC. > > Signed-off-by: Benjamin Gaignard > --- > .../devicetree/bindings/media/nxp,imx8mq-vpu.yaml | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > My bot found errors running 'make dt_binding_check' on your patch: yamllint warnings/errors: dtschema/dtc warnings/errors: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.example.dt.yaml: video-codec at 38300000: reg: [[942669824, 65536], [942735360, 65536], [942800896, 65536]] is too long From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.yaml See https://patchwork.ozlabs.org/patch/1444845 This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1. If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date: pip3 install dtschema --upgrade Please check and re-submit. From cfebriyanto at gmail.com Mon Mar 1 14:56:31 2021 From: cfebriyanto at gmail.com (Candy Febriyanto) Date: Mon, 1 Mar 2021 21:56:31 +0700 Subject: [PATCH v2 0/3] staging: rtl8723bs: Replace sprintf with scnprintf Message-ID: This patchset replaces most calls to sprintf with scnprintf, thereby preventing potential buffer overflows. The rest I left alone because they write to a buffer passed by a caller that doesn't pass its size alongside it. Candy Febriyanto (3): staging: rtl8723bs: core: Replace sprintf with scnprintf staging: rtl8723bs: hal: Replace sprintf with scnprintf staging: rtl8723bs: os_dep: Replace sprintf with scnprintf drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 3 +- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 4 +- drivers/staging/rtl8723bs/hal/hal_com.c | 45 ++++++++++--------- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 23 +++++----- drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 6 +-- 5 files changed, 41 insertions(+), 40 deletions(-) -- 2.30.1 From cfebriyanto at gmail.com Mon Mar 1 14:58:17 2021 From: cfebriyanto at gmail.com (Candy Febriyanto) Date: Mon, 1 Mar 2021 21:58:17 +0700 Subject: [PATCH v2 1/3] staging: rtl8723bs: core: Replace sprintf with scnprintf In-Reply-To: References: Message-ID: <6c260641164d6856fc4447555fe739124cb27c19.1614610197.git.cfebriyanto@gmail.com> The use of sprintf with format string here means that there is a risk that the writes will go out of bounds, replace it with scnprintf. In on_action_public_default the variable "cnt" isn't being used for anything meaningful so remove it. Signed-off-by: Candy Febriyanto Reviewed-by: Hans de Goede --- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 3 +-- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index fa4b0259c5ae..3443a5764c50 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -2084,7 +2084,6 @@ static unsigned int on_action_public_default(union recv_frame *precv_frame, u8 a u8 *frame_body = pframe + sizeof(struct ieee80211_hdr_3addr); u8 token; struct adapter *adapter = precv_frame->u.hdr.adapter; - int cnt = 0; char msg[64]; token = frame_body[2]; @@ -2092,7 +2091,7 @@ static unsigned int on_action_public_default(union recv_frame *precv_frame, u8 a if (rtw_action_public_decache(precv_frame, token) == _FAIL) goto exit; - cnt += sprintf((msg+cnt), "%s(token:%u)", action_public_str(action), token); + scnprintf(msg, sizeof(msg), "%s(token:%u)", action_public_str(action), token); rtw_cfg80211_rx_action(adapter, pframe, frame_len, msg); ret = _SUCCESS; diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index 5b05d1eaa328..c9f4a18b24b9 100644 --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c @@ -554,7 +554,7 @@ void LPS_Enter(struct adapter *padapter, const char *msg) /* Idle for a while if we connect to AP a while ago. */ if (pwrpriv->LpsIdleCount >= 2) { /* 4 Sec */ if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) { - sprintf(buf, "WIFI-%s", msg); + scnprintf(buf, sizeof(buf), "WIFI-%s", msg); pwrpriv->bpower_saving = true; rtw_set_ps_mode(padapter, pwrpriv->power_mgnt, padapter->registrypriv.smart_ps, 0, buf); } @@ -584,7 +584,7 @@ void LPS_Leave(struct adapter *padapter, const char *msg) if (pwrpriv->bLeisurePs) { if (pwrpriv->pwr_mode != PS_MODE_ACTIVE) { - sprintf(buf, "WIFI-%s", msg); + scnprintf(buf, sizeof(buf), "WIFI-%s", msg); rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, buf); if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) -- 2.30.1 From cfebriyanto at gmail.com Mon Mar 1 15:00:11 2021 From: cfebriyanto at gmail.com (Candy Febriyanto) Date: Mon, 1 Mar 2021 22:00:11 +0700 Subject: [PATCH v2 3/3] staging: rtl8723bs: os_dep: Replace sprintf with scnprintf In-Reply-To: References: Message-ID: The use of sprintf with format string here means that there is a risk that the writes will go out of bounds, replace it with scnprintf. In one block of the translate_scan function sprintf is only called once (it's not being used to concatenate strings) so there is no need to keep the pointer "p", remove it. Signed-off-by: Candy Febriyanto --- Changed since V1: - Dan Carpenter: assign the return value of scnprintf to the length variable instead of calling strlen .../staging/rtl8723bs/os_dep/ioctl_linux.c | 23 +++++++++---------- drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 6 ++--- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index 41389e266f54..78ba2423ed65 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -240,9 +240,10 @@ static char *translate_scan(struct adapter *padapter, return start; if (wpa_len > 0) { p = buf; - p += sprintf(p, "wpa_ie ="); + p += scnprintf(p, (MAX_WPA_IE_LEN * 2) - (p - buf), "wpa_ie ="); for (i = 0; i < wpa_len; i++) - p += sprintf(p, "%02x", wpa_ie[i]); + p += scnprintf(p, (MAX_WPA_IE_LEN * 2) - (p - buf), + "%02x", wpa_ie[i]); if (wpa_len > 100) { printk("-----------------Len %d----------------\n", wpa_len); @@ -265,9 +266,10 @@ static char *translate_scan(struct adapter *padapter, if (rsn_len > 0) { p = buf; memset(buf, 0, MAX_WPA_IE_LEN*2); - p += sprintf(p, "rsn_ie ="); + p += scnprintf(p, (MAX_WPA_IE_LEN * 2) - (p - buf), "rsn_ie ="); for (i = 0; i < rsn_len; i++) - p += sprintf(p, "%02x", rsn_ie[i]); + p += scnprintf(p, (MAX_WPA_IE_LEN * 2) - (p - buf), + "%02x", rsn_ie[i]); memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVCUSTOM; iwe.u.data.length = strlen(buf); @@ -365,17 +367,16 @@ static char *translate_scan(struct adapter *padapter, { u8 *buf; - u8 *p, *pos; + u8 *pos; buf = kzalloc(MAX_WPA_IE_LEN, GFP_ATOMIC); if (!buf) goto exit; - p = buf; + pos = pnetwork->network.Reserved; - p += sprintf(p, "fm =%02X%02X", pos[1], pos[0]); memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVCUSTOM; - iwe.u.data.length = strlen(buf); + iwe.u.data.length = scnprintf(buf, MAX_WPA_IE_LEN, "fm =%02X%02X", pos[1], pos[0]); start = iwe_stream_add_point(info, start, stop, &iwe, buf); kfree(buf); } @@ -5082,8 +5083,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ case IW_PRIV_TYPE_BYTE: /* Display args */ for (j = 0; j < n; j++) { - sprintf(str, "%d ", extra[j]); - len = strlen(str); + len = scnprintf(str, sizeof(str), "%d ", extra[j]); output_len = strlen(output); if ((output_len + len + 1) > 4096) { err = -E2BIG; @@ -5096,8 +5096,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ case IW_PRIV_TYPE_INT: /* Display args */ for (j = 0; j < n; j++) { - sprintf(str, "%d ", ((__s32 *)extra)[j]); - len = strlen(str); + len = scnprintf(str, sizeof(str), "%d ", ((__s32 *)extra)[j]); output_len = strlen(output); if ((output_len + len + 1) > 4096) { err = -E2BIG; diff --git a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c index d46c65ab384b..20899b2cff43 100644 --- a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c @@ -159,15 +159,15 @@ void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie) } p = buff; - p += sprintf(p, "ASSOCINFO(ReqIEs ="); + p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), "ASSOCINFO(ReqIEs ="); len = sec_ie[1] + 2; len = (len < IW_CUSTOM_MAX) ? len : IW_CUSTOM_MAX; for (i = 0; i < len; i++) - p += sprintf(p, "%02x", sec_ie[i]); + p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), "%02x", sec_ie[i]); - p += sprintf(p, ")"); + p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), ")"); memset(&wrqu, 0, sizeof(wrqu)); -- 2.30.1 From cfebriyanto at gmail.com Mon Mar 1 15:01:50 2021 From: cfebriyanto at gmail.com (Candy Febriyanto) Date: Mon, 1 Mar 2021 22:01:50 +0700 Subject: [PATCH v2 2/3] staging: rtl8723bs: hal: Replace sprintf with scnprintf In-Reply-To: References: Message-ID: The use of sprintf with format string here means that there is a risk that the writes will go out of bounds, replace it with scnprintf. Also avoid unnecessarily passing "%s" on some of the function calls. Signed-off-by: Candy Febriyanto Reviewed-by: Hans de Goede --- drivers/staging/rtl8723bs/hal/hal_com.c | 45 +++++++++++++------------ 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 16b259acbe1a..173ccaba2537 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -40,47 +40,50 @@ void rtw_hal_data_deinit(struct adapter *padapter) void dump_chip_info(HAL_VERSION ChipVersion) { - int cnt = 0; - u8 buf[128]; + char buf[128]; + size_t cnt = 0; + + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "Chip Version Info: CHIP_8723B_%s_", + IS_NORMAL_CHIP(ChipVersion) ? "Normal_Chip" : "Test_Chip"); - cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8723B_"); - cnt += sprintf((buf+cnt), "%s_", IS_NORMAL_CHIP(ChipVersion) ? "Normal_Chip" : "Test_Chip"); if (IS_CHIP_VENDOR_TSMC(ChipVersion)) - cnt += sprintf((buf+cnt), "%s_", "TSMC"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "TSMC_"); else if (IS_CHIP_VENDOR_UMC(ChipVersion)) - cnt += sprintf((buf+cnt), "%s_", "UMC"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "UMC_"); else if (IS_CHIP_VENDOR_SMIC(ChipVersion)) - cnt += sprintf((buf+cnt), "%s_", "SMIC"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "SMIC_"); if (IS_A_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "A_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "A_CUT_"); else if (IS_B_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "B_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "B_CUT_"); else if (IS_C_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "C_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "C_CUT_"); else if (IS_D_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "D_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "D_CUT_"); else if (IS_E_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "E_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "E_CUT_"); else if (IS_I_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "I_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "I_CUT_"); else if (IS_J_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "J_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "J_CUT_"); else if (IS_K_CUT(ChipVersion)) - cnt += sprintf((buf+cnt), "K_CUT_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "K_CUT_"); else - cnt += sprintf((buf+cnt), "UNKNOWN_CUT(%d)_", ChipVersion.CUTVersion); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, + "UNKNOWN_CUT(%d)_", ChipVersion.CUTVersion); if (IS_1T1R(ChipVersion)) - cnt += sprintf((buf+cnt), "1T1R_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "1T1R_"); else if (IS_1T2R(ChipVersion)) - cnt += sprintf((buf+cnt), "1T2R_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "1T2R_"); else if (IS_2T2R(ChipVersion)) - cnt += sprintf((buf+cnt), "2T2R_"); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "2T2R_"); else - cnt += sprintf((buf+cnt), "UNKNOWN_RFTYPE(%d)_", ChipVersion.RFType); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, + "UNKNOWN_RFTYPE(%d)_", ChipVersion.RFType); - cnt += sprintf((buf+cnt), "RomVer(%d)\n", ChipVersion.ROMVer); + cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "RomVer(%d)\n", ChipVersion.ROMVer); DBG_871X("%s", buf); } -- 2.30.1 From dan.carpenter at oracle.com Mon Mar 1 15:07:25 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Mon, 1 Mar 2021 18:07:25 +0300 Subject: [PATCH v2 3/3] staging: rtl8723bs: os_dep: Replace sprintf with scnprintf In-Reply-To: References: Message-ID: <20210301150725.GT2087@kadam> On Mon, Mar 01, 2021 at 10:00:11PM +0700, Candy Febriyanto wrote: > The use of sprintf with format string here means that there is a risk > that the writes will go out of bounds, replace it with scnprintf. > > In one block of the translate_scan function sprintf is only called once > (it's not being used to concatenate strings) so there is no need to keep > the pointer "p", remove it. > > Signed-off-by: Candy Febriyanto > --- Looks good. TBH, v1 was also fine. I should have just acked it instead of commenting... Reviewed-by: Dan Carpenter regards, dan carpenter From cfebriyanto at gmail.com Mon Mar 1 15:15:18 2021 From: cfebriyanto at gmail.com (Candy Febriyanto) Date: Mon, 1 Mar 2021 22:15:18 +0700 Subject: [PATCH v2 3/3] staging: rtl8723bs: os_dep: Replace sprintf with scnprintf In-Reply-To: <20210301150725.GT2087@kadam> References: <20210301150725.GT2087@kadam> Message-ID: On Mon, Mar 01, 2021 at 06:07:25PM +0300, Dan Carpenter wrote: > On Mon, Mar 01, 2021 at 10:00:11PM +0700, Candy Febriyanto wrote: > > The use of sprintf with format string here means that there is a risk > > that the writes will go out of bounds, replace it with scnprintf. > > > > In one block of the translate_scan function sprintf is only called once > > (it's not being used to concatenate strings) so there is no need to keep > > the pointer "p", remove it. > > > > Signed-off-by: Candy Febriyanto > > --- > > Looks good. TBH, v1 was also fine. I should have just acked it instead > of commenting... > > Reviewed-by: Dan Carpenter > > regards, > dan carpenter > Thanks for the review! From benjamin.gaignard at collabora.com Mon Mar 1 15:17:49 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Mon, 1 Mar 2021 16:17:49 +0100 Subject: [PATCH v3 0/5] Reset driver for IMX8MQ VPU hardware block Message-ID: <20210301151754.104749-1-benjamin.gaignard@collabora.com> The two VPUs inside IMX8MQ share the same control block which can be see as a reset hardware block. In order to be able to add the second VPU (for HECV decoding) it will be more handy if the both VPU drivers instance don't have to share the control block registers. This lead to implement it as an independ reset driver and to change the VPU driver to use it. Please note that this series break the compatibility between the DTB and kernel. This break is limited to IMX8MQ SoC and is done when the driver is still in staging directory. version 3: - Fix error in VPU example node version 2: - Document the change in VPU bindings Benjamin Gaignard (5): dt-bindings: reset: IMX8MQ VPU reset dt-bindings: media: IMX8MQ VPU: document reset usage reset: Add reset driver for IMX8MQ VPU block media: hantro: Use reset driver arm64: dts: imx8mq: Use reset driver for VPU hardware block .../bindings/media/nxp,imx8mq-vpu.yaml | 14 +- .../bindings/reset/fsl,imx8mq-vpu-reset.yaml | 54 ++++++ arch/arm64/boot/dts/freescale/imx8mq.dtsi | 31 +++- drivers/reset/Kconfig | 8 + drivers/reset/Makefile | 1 + drivers/reset/reset-imx8mq-vpu.c | 169 ++++++++++++++++++ drivers/staging/media/hantro/Kconfig | 1 + drivers/staging/media/hantro/imx8m_vpu_hw.c | 61 ++----- include/dt-bindings/reset/imx8mq-vpu-reset.h | 16 ++ 9 files changed, 294 insertions(+), 61 deletions(-) create mode 100644 Documentation/devicetree/bindings/reset/fsl,imx8mq-vpu-reset.yaml create mode 100644 drivers/reset/reset-imx8mq-vpu.c create mode 100644 include/dt-bindings/reset/imx8mq-vpu-reset.h -- 2.25.1 From benjamin.gaignard at collabora.com Mon Mar 1 15:17:51 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Mon, 1 Mar 2021 16:17:51 +0100 Subject: [PATCH v3 2/5] dt-bindings: media: IMX8MQ VPU: document reset usage In-Reply-To: <20210301151754.104749-1-benjamin.gaignard@collabora.com> References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> Message-ID: <20210301151754.104749-3-benjamin.gaignard@collabora.com> Document IMX8MQ VPU bindings to add the phandle to the reset driver. Provide an independent reset driver allow to the both VPUs to share their control/reset hardware block. The reset driver replace what was previously done be using the 'ctrl' registers inside the driver. This breaks the compatibility between DTB and kernel but the driver is still in staging directory and limited to IMX8MQ SoC. Signed-off-by: Benjamin Gaignard --- version 3: - Fix error in VPU example node .../devicetree/bindings/media/nxp,imx8mq-vpu.yaml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.yaml b/Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.yaml index 762be3f96ce9..fd53a4e43572 100644 --- a/Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.yaml +++ b/Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.yaml @@ -18,13 +18,12 @@ properties: const: nxp,imx8mq-vpu reg: - maxItems: 3 + maxItems: 2 reg-names: items: - const: g1 - const: g2 - - const: ctrl interrupts: maxItems: 2 @@ -46,6 +45,9 @@ properties: power-domains: maxItems: 1 + resets: + maxItems: 1 + required: - compatible - reg @@ -54,6 +56,7 @@ required: - interrupt-names - clocks - clock-names + - resets additionalProperties: false @@ -61,13 +64,13 @@ examples: - | #include #include + #include vpu: video-codec at 38300000 { compatible = "nxp,imx8mq-vpu"; reg = <0x38300000 0x10000>, - <0x38310000 0x10000>, - <0x38320000 0x10000>; - reg-names = "g1", "g2", "ctrl"; + <0x38310000 0x10000>; + reg-names = "g1", "g2"; interrupts = , ; interrupt-names = "g1", "g2"; @@ -76,4 +79,5 @@ examples: <&clk IMX8MQ_CLK_VPU_DEC_ROOT>; clock-names = "g1", "g2", "bus"; power-domains = <&pgc_vpu>; + resets = <&vpu_reset IMX8MQ_RESET_VPU_RESET_G1>; }; -- 2.25.1 From benjamin.gaignard at collabora.com Mon Mar 1 15:17:52 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Mon, 1 Mar 2021 16:17:52 +0100 Subject: [PATCH v3 3/5] reset: Add reset driver for IMX8MQ VPU block In-Reply-To: <20210301151754.104749-1-benjamin.gaignard@collabora.com> References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> Message-ID: <20210301151754.104749-4-benjamin.gaignard@collabora.com> IMX8MQ SoC got a dedicated hardware block to reset the video processor units (G1 and G2). Signed-off-by: Benjamin Gaignard --- drivers/reset/Kconfig | 8 ++ drivers/reset/Makefile | 1 + drivers/reset/reset-imx8mq-vpu.c | 169 +++++++++++++++++++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 drivers/reset/reset-imx8mq-vpu.c diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 71ab75a46491..fa95380b271a 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -80,6 +80,14 @@ config RESET_IMX7 help This enables the reset controller driver for i.MX7 SoCs. +config RESET_VPU_IMX8MQ + tristate "i.MX8MQ VPU Reset Driver" + depends on HAS_IOMEM + depends on (ARM64 && ARCH_MXC) || COMPILE_TEST + select MFD_SYSCON + help + This enables the VPU reset controller driver for i.MX8MQ SoCs. + config RESET_INTEL_GW bool "Intel Reset Controller Driver" depends on OF && HAS_IOMEM diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index 1054123fd187..6007e0cdfc05 100644 --- a/drivers/reset/Makefile +++ b/drivers/reset/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_RESET_BRCMSTB) += reset-brcmstb.o obj-$(CONFIG_RESET_BRCMSTB_RESCAL) += reset-brcmstb-rescal.o obj-$(CONFIG_RESET_HSDK) += reset-hsdk.o obj-$(CONFIG_RESET_IMX7) += reset-imx7.o +obj-$(CONFIG_RESET_VPU_IMX8MQ) += reset-imx8mq-vpu.o obj-$(CONFIG_RESET_INTEL_GW) += reset-intel-gw.o obj-$(CONFIG_RESET_LANTIQ) += reset-lantiq.o obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o diff --git a/drivers/reset/reset-imx8mq-vpu.c b/drivers/reset/reset-imx8mq-vpu.c new file mode 100644 index 000000000000..14c589f19266 --- /dev/null +++ b/drivers/reset/reset-imx8mq-vpu.c @@ -0,0 +1,169 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2021, Collabora + * + * i.MX8MQ VPU Reset Controller driver + * + * Author: Benjamin Gaignard + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define CTRL_SOFT_RESET 0x00 +#define RESET_G1 ((u32)BIT(1)) +#define RESET_G2 ((u32)BIT(0)) + +#define CTRL_ENABLE 0x04 +#define ENABLE_G1 BIT(1) +#define ENABLE_G2 BIT(0) + +#define CTRL_G1_DEC_FUSE 0x08 +#define CTRL_G1_PP_FUSE 0x0c +#define CTRL_G2_DEC_FUSE 0x10 + +struct imx8mq_vpu_reset { + struct reset_controller_dev rcdev; + struct regmap *regmap; + struct clk_bulk_data *clocks; + int num_clocks; + struct device *dev; +}; + +static inline struct imx8mq_vpu_reset *to_imx8mq_vpu_reset(struct reset_controller_dev *rcdev) +{ + return container_of(rcdev, struct imx8mq_vpu_reset, rcdev); +} + +static int imx8mq_vpu_reset_assert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct imx8mq_vpu_reset *reset = to_imx8mq_vpu_reset(rcdev); + int ret = -EINVAL; + + ret = clk_bulk_prepare_enable(reset->num_clocks, reset->clocks); + if (ret) { + dev_err(reset->dev, "Failed to prepare clocks\n"); + return ret; + } + + switch (id) { + case IMX8MQ_RESET_VPU_RESET_G1: + ret = regmap_update_bits(reset->regmap, CTRL_SOFT_RESET, RESET_G1, ~RESET_G1); + ret |= regmap_update_bits(reset->regmap, CTRL_ENABLE, ENABLE_G1, ENABLE_G1); + break; + case IMX8MQ_RESET_VPU_RESET_G2: + ret = regmap_update_bits(reset->regmap, CTRL_SOFT_RESET, RESET_G2, ~RESET_G2); + ret |= regmap_update_bits(reset->regmap, CTRL_ENABLE, ENABLE_G2, ENABLE_G2); + break; + } + + /* Set values of the fuse registers */ + ret |= regmap_write(reset->regmap, CTRL_G1_DEC_FUSE, 0xffffffff); + ret |= regmap_write(reset->regmap, CTRL_G1_PP_FUSE, 0xffffffff); + ret |= regmap_write(reset->regmap, CTRL_G2_DEC_FUSE, 0xffffffff); + + clk_bulk_disable_unprepare(reset->num_clocks, reset->clocks); + + return ret; +} + +static int imx8mq_vpu_reset_deassert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct imx8mq_vpu_reset *reset = to_imx8mq_vpu_reset(rcdev); + int ret; + + ret = clk_bulk_prepare_enable(reset->num_clocks, reset->clocks); + if (ret) { + dev_err(reset->dev, "Failed to prepare clocks\n"); + return ret; + } + + switch (id) { + case IMX8MQ_RESET_VPU_RESET_G1: + return regmap_update_bits(reset->regmap, CTRL_SOFT_RESET, RESET_G1, RESET_G1); + case IMX8MQ_RESET_VPU_RESET_G2: + return regmap_update_bits(reset->regmap, CTRL_SOFT_RESET, RESET_G2, RESET_G2); + } + + clk_bulk_disable_unprepare(reset->num_clocks, reset->clocks); + + return -EINVAL; +} + +static int imx8mq_vpu_reset_dev(struct reset_controller_dev *rcdev, + unsigned long id) +{ + int ret; + + ret = imx8mq_vpu_reset_assert(rcdev, id); + if (ret) + return ret; + + udelay(2); + + return imx8mq_vpu_reset_deassert(rcdev, id); +} + +static const struct reset_control_ops imx8mq_vpu_reset_ops = { + .reset = imx8mq_vpu_reset_dev, + .assert = imx8mq_vpu_reset_assert, + .deassert = imx8mq_vpu_reset_deassert, +}; + +static int imx8mq_vpu_reset_probe(struct platform_device *pdev) +{ + struct imx8mq_vpu_reset *reset; + struct device *dev = &pdev->dev; + struct regmap_config config = { .name = "vpu-reset" }; + + reset = devm_kzalloc(dev, sizeof(*reset), GFP_KERNEL); + if (!reset) + return -ENOMEM; + + reset->regmap = device_node_to_regmap(dev->of_node); + if (IS_ERR(reset->regmap)) { + dev_err(dev, "Unable to get imx8mq-vpu-reset regmap"); + return PTR_ERR(reset->regmap); + } + regmap_attach_dev(dev, reset->regmap, &config); + + reset->num_clocks = devm_clk_bulk_get_all(dev, &reset->clocks); + if (!reset->num_clocks) + return -EINVAL; + + reset->rcdev.owner = THIS_MODULE; + reset->rcdev.nr_resets = 2; + reset->rcdev.ops = &imx8mq_vpu_reset_ops; + reset->rcdev.of_node = dev->of_node; + reset->dev = dev; + + return devm_reset_controller_register(dev, &reset->rcdev); +} + +static const struct of_device_id imx8mq_vpu_reset_dt_ids[] = { + { .compatible = "fsl,imx8mq-vpu-reset",}, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, imx8mq_vpu_reset_dt_ids); + +static struct platform_driver imx8mq_vpu_reset_driver = { + .probe = imx8mq_vpu_reset_probe, + .driver = { + .name = KBUILD_MODNAME, + .of_match_table = imx8mq_vpu_reset_dt_ids, + }, +}; +module_platform_driver(imx8mq_vpu_reset_driver); + +MODULE_AUTHOR("Benjamin Gaignard "); +MODULE_DESCRIPTION("NXP i.MX8MQ VPU reset driver"); +MODULE_LICENSE("GPL v2"); -- 2.25.1 From benjamin.gaignard at collabora.com Mon Mar 1 15:17:50 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Mon, 1 Mar 2021 16:17:50 +0100 Subject: [PATCH v3 1/5] dt-bindings: reset: IMX8MQ VPU reset In-Reply-To: <20210301151754.104749-1-benjamin.gaignard@collabora.com> References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> Message-ID: <20210301151754.104749-2-benjamin.gaignard@collabora.com> Document bindings for IMX8MQ VPU reset hardware block Signed-off-by: Benjamin Gaignard --- .../bindings/reset/fsl,imx8mq-vpu-reset.yaml | 54 +++++++++++++++++++ include/dt-bindings/reset/imx8mq-vpu-reset.h | 16 ++++++ 2 files changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/fsl,imx8mq-vpu-reset.yaml create mode 100644 include/dt-bindings/reset/imx8mq-vpu-reset.h diff --git a/Documentation/devicetree/bindings/reset/fsl,imx8mq-vpu-reset.yaml b/Documentation/devicetree/bindings/reset/fsl,imx8mq-vpu-reset.yaml new file mode 100644 index 000000000000..00020421c0e3 --- /dev/null +++ b/Documentation/devicetree/bindings/reset/fsl,imx8mq-vpu-reset.yaml @@ -0,0 +1,54 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/fsl,imx8mq-vpu-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale i.MX8MQ VPU Reset Controller + +maintainers: + - Benjamin Gaignard + +description: | + The VPU reset controller is used to reset the video processor + unit peripherals. Device nodes that need access to reset lines should + specify them as a reset phandle in their corresponding node as + specified in reset.txt. + + For list of all valid reset indices see + for i.MX8MQ. + +properties: + compatible: + items: + - const: fsl,imx8mq-vpu-reset + - const: syscon + + reg: + maxItems: 1 + + clocks: + minItems: 1 + maxItems: 3 + + '#reset-cells': + const: 1 + +required: + - compatible + - reg + - clocks + - '#reset-cells' + +additionalProperties: false + +examples: + - | + #include + + vpu-reset at 38320000 { + compatible = "fsl,imx8mq-vpu-reset", "syscon"; + reg = <0x38320000 0x10000>; + clocks = <&clk IMX8MQ_CLK_VPU_DEC_ROOT>; + #reset-cells = <1>; + }; diff --git a/include/dt-bindings/reset/imx8mq-vpu-reset.h b/include/dt-bindings/reset/imx8mq-vpu-reset.h new file mode 100644 index 000000000000..efcbe18177fe --- /dev/null +++ b/include/dt-bindings/reset/imx8mq-vpu-reset.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2021, Collabora + * + * i.MX7 System Reset Controller (SRC) driver + * + * Author: Benjamin Gaignard + */ + +#ifndef DT_BINDINGS_VPU_RESET_IMX8MQ +#define DT_BINDINGS_VPU_RESET_IMX8MQ + +#define IMX8MQ_RESET_VPU_RESET_G1 0 +#define IMX8MQ_RESET_VPU_RESET_G2 1 + +#endif -- 2.25.1 From benjamin.gaignard at collabora.com Mon Mar 1 15:17:53 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Mon, 1 Mar 2021 16:17:53 +0100 Subject: [PATCH v3 4/5] media: hantro: Use reset driver In-Reply-To: <20210301151754.104749-1-benjamin.gaignard@collabora.com> References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> Message-ID: <20210301151754.104749-5-benjamin.gaignard@collabora.com> Rather use a reset like feature inside the driver use the reset controller API to get the same result. Signed-off-by: Benjamin Gaignard --- drivers/staging/media/hantro/Kconfig | 1 + drivers/staging/media/hantro/imx8m_vpu_hw.c | 61 ++++----------------- 2 files changed, 12 insertions(+), 50 deletions(-) diff --git a/drivers/staging/media/hantro/Kconfig b/drivers/staging/media/hantro/Kconfig index 5b6cf9f62b1a..dd1d4dde2658 100644 --- a/drivers/staging/media/hantro/Kconfig +++ b/drivers/staging/media/hantro/Kconfig @@ -20,6 +20,7 @@ config VIDEO_HANTRO_IMX8M bool "Hantro VPU i.MX8M support" depends on VIDEO_HANTRO depends on ARCH_MXC || COMPILE_TEST + select RESET_VPU_IMX8MQ default y help Enable support for i.MX8M SoCs. diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c index c222de075ef4..d5b4312b9391 100644 --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c @@ -7,49 +7,12 @@ #include #include +#include #include "hantro.h" #include "hantro_jpeg.h" #include "hantro_g1_regs.h" -#define CTRL_SOFT_RESET 0x00 -#define RESET_G1 BIT(1) -#define RESET_G2 BIT(0) - -#define CTRL_CLOCK_ENABLE 0x04 -#define CLOCK_G1 BIT(1) -#define CLOCK_G2 BIT(0) - -#define CTRL_G1_DEC_FUSE 0x08 -#define CTRL_G1_PP_FUSE 0x0c -#define CTRL_G2_DEC_FUSE 0x10 - -static void imx8m_soft_reset(struct hantro_dev *vpu, u32 reset_bits) -{ - u32 val; - - /* Assert */ - val = readl(vpu->ctrl_base + CTRL_SOFT_RESET); - val &= ~reset_bits; - writel(val, vpu->ctrl_base + CTRL_SOFT_RESET); - - udelay(2); - - /* Release */ - val = readl(vpu->ctrl_base + CTRL_SOFT_RESET); - val |= reset_bits; - writel(val, vpu->ctrl_base + CTRL_SOFT_RESET); -} - -static void imx8m_clk_enable(struct hantro_dev *vpu, u32 clock_bits) -{ - u32 val; - - val = readl(vpu->ctrl_base + CTRL_CLOCK_ENABLE); - val |= clock_bits; - writel(val, vpu->ctrl_base + CTRL_CLOCK_ENABLE); -} - static int imx8mq_runtime_resume(struct hantro_dev *vpu) { int ret; @@ -60,13 +23,10 @@ static int imx8mq_runtime_resume(struct hantro_dev *vpu) return ret; } - imx8m_soft_reset(vpu, RESET_G1 | RESET_G2); - imx8m_clk_enable(vpu, CLOCK_G1 | CLOCK_G2); + ret = device_reset(vpu->dev); + if (ret) + dev_err(vpu->dev, "Failed to reset Hantro VPU\n"); - /* Set values of the fuse registers */ - writel(0xffffffff, vpu->ctrl_base + CTRL_G1_DEC_FUSE); - writel(0xffffffff, vpu->ctrl_base + CTRL_G1_PP_FUSE); - writel(0xffffffff, vpu->ctrl_base + CTRL_G2_DEC_FUSE); clk_bulk_disable_unprepare(vpu->variant->num_clocks, vpu->clocks); @@ -151,16 +111,17 @@ static irqreturn_t imx8m_vpu_g1_irq(int irq, void *dev_id) static int imx8mq_vpu_hw_init(struct hantro_dev *vpu) { vpu->dec_base = vpu->reg_bases[0]; - vpu->ctrl_base = vpu->reg_bases[vpu->variant->num_regs - 1]; return 0; } -static void imx8m_vpu_g1_reset(struct hantro_ctx *ctx) +static void imx8mq_vpu_reset(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; + int ret = device_reset(vpu->dev); - imx8m_soft_reset(vpu, RESET_G1); + if (ret) + dev_err(vpu->dev, "Failed to reset Hantro VPU\n"); } /* @@ -170,19 +131,19 @@ static void imx8m_vpu_g1_reset(struct hantro_ctx *ctx) static const struct hantro_codec_ops imx8mq_vpu_codec_ops[] = { [HANTRO_MODE_MPEG2_DEC] = { .run = hantro_g1_mpeg2_dec_run, - .reset = imx8m_vpu_g1_reset, + .reset = imx8mq_vpu_reset, .init = hantro_mpeg2_dec_init, .exit = hantro_mpeg2_dec_exit, }, [HANTRO_MODE_VP8_DEC] = { .run = hantro_g1_vp8_dec_run, - .reset = imx8m_vpu_g1_reset, + .reset = imx8mq_vpu_reset, .init = hantro_vp8_dec_init, .exit = hantro_vp8_dec_exit, }, [HANTRO_MODE_H264_DEC] = { .run = hantro_g1_h264_dec_run, - .reset = imx8m_vpu_g1_reset, + .reset = imx8mq_vpu_reset, .init = hantro_h264_dec_init, .exit = hantro_h264_dec_exit, }, -- 2.25.1 From benjamin.gaignard at collabora.com Mon Mar 1 15:17:54 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Mon, 1 Mar 2021 16:17:54 +0100 Subject: [PATCH v3 5/5] arm64: dts: imx8mq: Use reset driver for VPU hardware block In-Reply-To: <20210301151754.104749-1-benjamin.gaignard@collabora.com> References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> Message-ID: <20210301151754.104749-6-benjamin.gaignard@collabora.com> Add a vpu reset hardware block node. Signed-off-by: Benjamin Gaignard --- arch/arm64/boot/dts/freescale/imx8mq.dtsi | 31 ++++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi index a841a023e8e0..d9d9efc8592d 100644 --- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "dt-bindings/input/input.h" #include @@ -1267,19 +1268,36 @@ usb3_phy1: usb-phy at 382f0040 { status = "disabled"; }; + vpu_reset: vpu-reset at 38320000 { + compatible = "fsl,imx8mq-vpu-reset", "syscon"; + reg = <0x38320000 0x10000>; + clocks = <&clk IMX8MQ_CLK_VPU_G1_ROOT>, + <&clk IMX8MQ_CLK_VPU_G2_ROOT>, + <&clk IMX8MQ_CLK_VPU_DEC_ROOT>; + assigned-clocks = <&clk IMX8MQ_CLK_VPU_G1>, + <&clk IMX8MQ_CLK_VPU_G2>, + <&clk IMX8MQ_CLK_VPU_BUS>, + <&clk IMX8MQ_VPU_PLL_BYPASS>; + assigned-clock-parents = <&clk IMX8MQ_VPU_PLL_OUT>, + <&clk IMX8MQ_VPU_PLL_OUT>, + <&clk IMX8MQ_SYS1_PLL_800M>, + <&clk IMX8MQ_VPU_PLL>; + assigned-clock-rates = <600000000>, <300000000>, + <800000000>, <0>; + #reset-cells = <1>; + }; + vpu: video-codec at 38300000 { compatible = "nxp,imx8mq-vpu"; reg = <0x38300000 0x10000>, - <0x38310000 0x10000>, - <0x38320000 0x10000>; - reg-names = "g1", "g2", "ctrl"; + <0x38310000 0x10000>; + reg-names = "g1", "g2"; interrupts = , ; interrupt-names = "g1", "g2"; clocks = <&clk IMX8MQ_CLK_VPU_G1_ROOT>, - <&clk IMX8MQ_CLK_VPU_G2_ROOT>, - <&clk IMX8MQ_CLK_VPU_DEC_ROOT>; - clock-names = "g1", "g2", "bus"; + <&clk IMX8MQ_CLK_VPU_G2_ROOT>; + clock-names = "g1", "g2"; assigned-clocks = <&clk IMX8MQ_CLK_VPU_G1>, <&clk IMX8MQ_CLK_VPU_G2>, <&clk IMX8MQ_CLK_VPU_BUS>, @@ -1290,6 +1308,7 @@ vpu: video-codec at 38300000 { <&clk IMX8MQ_VPU_PLL>; assigned-clock-rates = <600000000>, <600000000>, <800000000>, <0>; + resets = <&vpu_reset IMX8MQ_RESET_VPU_RESET_G1>; power-domains = <&pgc_vpu>; }; -- 2.25.1 From leegib at gmail.com Mon Mar 1 15:37:42 2021 From: leegib at gmail.com (Lee) Date: Mon, 1 Mar 2021 15:37:42 +0000 Subject: [PATCH] staging: rtl8192e: Fix possible buffer overflow in _rtl92e_wx_set_scan In-Reply-To: <20210301132535.GR2087@kadam> References: <20210226114829.316980-1-leegib@gmail.com> <20210226134333.GA2087@kadam> <20210226140526.GG2222@kadam> <20210301132535.GR2087@kadam> Message-ID: <20210301153742.GA427438@ubuntudesktop> > This check worked out pretty well. It's probably 50% bugs? Unfiltered > results below. The trick of warning for "if (ststr(member, "->ssid")) " > and the memcpy length couldn't be verified turned out to be the best. That list looks great. I checked out 2 of those listed at random and they look like valid bugs to me. > But there are quite a few real bugs as well. If anyone wants to fix any > of these just claim a bug, and I won't send a patch for that warning. > :) Lee, I think you mentioned that you had found a related buffer > overflow fix? Did the check find it? I think I found 2 in these files: drivers/staging/rtl8712/rtl871x_cmd.c drivers/staging/wfx/hif_tx.c Regards, Lee From abbotti at mev.co.uk Mon Mar 1 16:57:51 2021 From: abbotti at mev.co.uk (Ian Abbott) Date: Mon, 1 Mar 2021 16:57:51 +0000 Subject: [PATCH 0/6] staging: comedi: dt2814: Fix broken AI command support Message-ID: <20210301165757.243065-1-abbotti@mev.co.uk> The DT2814 board is an old analog-to-digital ISA card supported by the Comedi "dt2814" driver. The board has a timed acquisition mode, and an end-of-conversion interrupt. The interrupt can be disabled by removing the jumper that sets the IRQ level. In Comedi, the board is a manually configured "legacy" device with an optional IRQ setting. The Comedi driver has some broken support for asynchronous streaming commands when the optional IRQ setting has been configured. The main problems are: * It doesn't write any samples to the Comedi buffer to be read by the user application. * The IRQ handler gets called at the end of any conversion, including during non-streaming, software-triggered acquisitions, but will interfere with these acquisitions because it reads the A/D Data register. This series of patches attempts to support the asynchronous commands properly so that it only reads the A/D Data register if the asynchronous command has been set up, and actually writes it to the Comedi buffer. Stopping the asynchronous command triggers an unwanted conversion. The interrupt handler used to wait for that to finish, but this series of patches changes that so that other places in the code outside the interrupt handler wait for a stale conversion to finish and/or read the stale data before starting a new conversion. 1) staging: comedi: dt2814: Clear stale AI data before operation 2) staging: comedi: dt2814: Don't wait for conversion in interrupt handler 3) staging: comedi: dt2814: Call dt2814_ai_clear() during initialization 4) staging: comedi: dt2814: Fix asynchronous command interrupt handling 5) staging: comedi: dt2814: Remove struct dt2814_private 6) staging: comedi: dt2814: Clear stale AI data on detach drivers/staging/comedi/drivers/dt2814.c | 153 +++++++++++++++++++++++++------- 1 file changed, 120 insertions(+), 33 deletions(-) From abbotti at mev.co.uk Mon Mar 1 16:57:52 2021 From: abbotti at mev.co.uk (Ian Abbott) Date: Mon, 1 Mar 2021 16:57:52 +0000 Subject: [PATCH 1/6] staging: comedi: dt2814: Clear stale AI data before operation In-Reply-To: <20210301165757.243065-1-abbotti@mev.co.uk> References: <20210301165757.243065-1-abbotti@mev.co.uk> Message-ID: <20210301165757.243065-2-abbotti@mev.co.uk> When performing a Comedi read instruction or setting up an asynchronous command on the AI subdevice, clear any stale data on the A/D registers by waiting for the Status register's BUSY bit to clear (if set) and then if the FINISH or ERR bit is set, reading the A/D Data register twice to clear the stale data. Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/dt2814.c | 39 +++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index bd329d7b4893..7e73aa094eea 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -52,6 +52,43 @@ struct dt2814_private { #define DT2814_TIMEOUT 10 #define DT2814_MAX_SPEED 100000 /* Arbitrary 10 khz limit */ +static int dt2814_ai_notbusy(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned long context) +{ + unsigned int status; + + status = inb(dev->iobase + DT2814_CSR); + if (context) + *(unsigned int *)context = status; + if (status & DT2814_BUSY) + return -EBUSY; + return 0; +} + +static int dt2814_ai_clear(struct comedi_device *dev) +{ + unsigned int status = 0; + int ret; + + /* Wait until not busy and get status register value. */ + ret = comedi_timeout(dev, NULL, NULL, dt2814_ai_notbusy, + (unsigned long)&status); + if (ret) + return ret; + + if (status & (DT2814_FINISH | DT2814_ERR)) { + /* + * There unread data, or the error flag is set. + * Read the data register twice to clear the condition. + */ + inb(dev->iobase + DT2814_DATA); + inb(dev->iobase + DT2814_DATA); + } + return 0; +} + static int dt2814_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -73,6 +110,7 @@ static int dt2814_ai_insn_read(struct comedi_device *dev, int chan; int ret; + dt2814_ai_clear(dev); /* clear stale data or error */ for (n = 0; n < insn->n; n++) { chan = CR_CHAN(insn->chanspec); @@ -174,6 +212,7 @@ static int dt2814_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) int chan; int trigvar; + dt2814_ai_clear(dev); /* clear stale data or error */ trigvar = dt2814_ns_to_timer(&cmd->scan_begin_arg, cmd->flags); chan = CR_CHAN(cmd->chanlist[0]); -- 2.30.0 From abbotti at mev.co.uk Mon Mar 1 16:57:53 2021 From: abbotti at mev.co.uk (Ian Abbott) Date: Mon, 1 Mar 2021 16:57:53 +0000 Subject: [PATCH 2/6] staging: comedi: dt2814: Don't wait for conversion in interrupt handler In-Reply-To: <20210301165757.243065-1-abbotti@mev.co.uk> References: <20210301165757.243065-1-abbotti@mev.co.uk> Message-ID: <20210301165757.243065-3-abbotti@mev.co.uk> When the interrupt handler decides the final sample has been acquired, it turns off the timer enable (ENB) bit in the Command register. That triggers another A/D conversion. The interrupt handler currently waits for that to finish and then reads the resulting, unwanted sample. Since the functions for handling Comedi read instructions and for setting up asynchronous commands now call `dt2814_ai_clear()` to wait for and discard any spurious A/D conversion, let's remove that code from the interrupt handler. Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/dt2814.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index 7e73aa094eea..8a70b7ba30f4 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -238,21 +238,13 @@ static irqreturn_t dt2814_interrupt(int irq, void *d) inb(dev->iobase + DT2814_DATA); if (!(--devpriv->ntrig)) { - int i; - outb(0, dev->iobase + DT2814_CSR); /* - * note: turning off timed mode triggers another - * sample. + * Note: turning off timed mode triggers another + * sample. This will be mopped up by the calls to + * dt2814_ai_clear(). */ - for (i = 0; i < DT2814_TIMEOUT; i++) { - if (inb(dev->iobase + DT2814_CSR) & DT2814_FINISH) - break; - } - inb(dev->iobase + DT2814_DATA); - inb(dev->iobase + DT2814_DATA); - s->async->events |= COMEDI_CB_EOA; } comedi_handle_events(dev, s); -- 2.30.0 From abbotti at mev.co.uk Mon Mar 1 16:57:54 2021 From: abbotti at mev.co.uk (Ian Abbott) Date: Mon, 1 Mar 2021 16:57:54 +0000 Subject: [PATCH 3/6] staging: comedi: dt2814: Call dt2814_ai_clear() during initialization In-Reply-To: <20210301165757.243065-1-abbotti@mev.co.uk> References: <20210301165757.243065-1-abbotti@mev.co.uk> Message-ID: <20210301165757.243065-4-abbotti@mev.co.uk> The Comedi "attach" handler `dt2814_attach()` writes to the Control register to turn off the timer enable 'ENB' bit, which triggers a conversion. It then sleeps awhile and checks the Status register, returning an error if the ERR bit is set. However, the ERR bit could have been set due to the conversion being triggered while the A/D converter was busy (unlikely) or due to the conversion being triggered before some previous sample had been read from the A/D Data register. Replace the existing code with a call to `dt2814_ai_clear()` which waits for any conversion to finish and then clears any unread data or error condition. A non-zero return value from `dt2814_ai_clear()` indicates a time-out while waiting for the A/D converter to become non-busy. Return an error in that case. Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/dt2814.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index 8a70b7ba30f4..da4dc4df3a95 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -262,13 +262,10 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) return ret; outb(0, dev->iobase + DT2814_CSR); - usleep_range(100, 200); - if (inb(dev->iobase + DT2814_CSR) & DT2814_ERR) { + if (dt2814_ai_clear(dev)) { dev_err(dev->class_dev, "reset error (fatal)\n"); return -EIO; } - inb(dev->iobase + DT2814_DATA); - inb(dev->iobase + DT2814_DATA); if (it->options[1]) { ret = request_irq(it->options[1], dt2814_interrupt, 0, -- 2.30.0 From abbotti at mev.co.uk Mon Mar 1 16:57:55 2021 From: abbotti at mev.co.uk (Ian Abbott) Date: Mon, 1 Mar 2021 16:57:55 +0000 Subject: [PATCH 4/6] staging: comedi: dt2814: Fix asynchronous command interrupt handling In-Reply-To: <20210301165757.243065-1-abbotti@mev.co.uk> References: <20210301165757.243065-1-abbotti@mev.co.uk> Message-ID: <20210301165757.243065-5-abbotti@mev.co.uk> The support for asynchronous commands in this driver is currently broken. If interrupts are enabled, the interrupt handler is called at the end of every A/D conversion. A/D conversions could be due to software-triggered conversions resulting from Comedi `INSN_READ` instruction handling, or due to timer-trigger conversions enabled when a Comedi asynchronous command is set up. We only want the interrupt handler to read a sample from the A/D Data register for timer-triggered conversions, but currently it always reads the A/D Data register. Since the A/D Data register is read twice (to read a 12-bit value from an 8-bit register), that probably interferes with the reading for software-triggered conversions. The interrupt handler does not currently do anything with the data, it just ignores it. It should be written to the Comedi buffer if handling an asynchronous command. Other problems are that the driver has no Comedi `cancel` handler to call when the asynchronous command is being stopped manually, and it does not handle "infinite" acquisitions (when the command's `stop_src == TRIG_NONE`) properly. Change the interrupt handler to check the timer enable (ENB) bit to check the asynchronous command is active and return early if not enabled. Also check the error (ERR) and "conversion complete" (FINISH) bits, and return early if neither is set. Then the sample can be read from the A/D Data register to clear the ERR and FINISH bits. If the ERR bit was set, terminate the acquisition with an error, otherwise write the data to the Comedi buffer and check for end of acquisition. Replace the current check for end of acquisition, using the count of completed scans in `scans_done` (updated by calls to `comedi_buf_write_samples()`) when `stop_src == TRIG_COUNT`) and allowing "infinite" acquisitions when `stop_src == TRIG_NONE`. Add a `cancel` handler function `dt2814_ai_cancel()` that will be called when the end of acquisition event is processed and when the acquisition is stopped manually. It turns off the timer enable (ENB) bit in the Control register, leaving the current channel selected. Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/dt2814.c | 72 ++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index da4dc4df3a95..6f6d0b2bb44b 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -223,30 +223,87 @@ static int dt2814_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) return 0; } +static int dt2814_ai_cancel(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + unsigned int status; + unsigned long flags; + + spin_lock_irqsave(&dev->spinlock, flags); + status = inb(dev->iobase + DT2814_CSR); + if (status & DT2814_ENB) { + /* + * Clear the timed trigger enable bit. + * + * Note: turning off timed mode triggers another + * sample. This will be mopped up by the calls to + * dt2814_ai_clear(). + */ + outb(status & DT2814_CHANMASK, dev->iobase + DT2814_CSR); + } + spin_unlock_irqrestore(&dev->spinlock, flags); + return 0; +} + static irqreturn_t dt2814_interrupt(int irq, void *d) { struct comedi_device *dev = d; - struct dt2814_private *devpriv = dev->private; struct comedi_subdevice *s = dev->read_subdev; + struct comedi_async *async; + unsigned int lo, hi; + unsigned short data; + unsigned int status; if (!dev->attached) { dev_err(dev->class_dev, "spurious interrupt\n"); return IRQ_HANDLED; } - inb(dev->iobase + DT2814_DATA); - inb(dev->iobase + DT2814_DATA); + async = s->async; - if (!(--devpriv->ntrig)) { - outb(0, dev->iobase + DT2814_CSR); + spin_lock(&dev->spinlock); + + status = inb(dev->iobase + DT2814_CSR); + if (!(status & DT2814_ENB)) { + /* Timed acquisition not enabled. Nothing to do. */ + spin_unlock(&dev->spinlock); + return IRQ_HANDLED; + } + + if (!(status & (DT2814_FINISH | DT2814_ERR))) { + /* Spurious interrupt? */ + spin_unlock(&dev->spinlock); + return IRQ_HANDLED; + } + + /* Read data or clear error. */ + hi = inb(dev->iobase + DT2814_DATA); + lo = inb(dev->iobase + DT2814_DATA); + + data = (hi << 4) | (lo >> 4); + + if (status & DT2814_ERR) { + async->events |= COMEDI_CB_ERROR; + } else { + comedi_buf_write_samples(s, &data, 1); + if (async->cmd.stop_src == TRIG_COUNT && + async->scans_done >= async->cmd.stop_arg) { + async->events |= COMEDI_CB_EOA; + } + } + if (async->events & COMEDI_CB_CANCEL_MASK) { /* + * Disable timed mode. + * * Note: turning off timed mode triggers another * sample. This will be mopped up by the calls to * dt2814_ai_clear(). */ - - s->async->events |= COMEDI_CB_EOA; + outb(status & DT2814_CHANMASK, dev->iobase + DT2814_CSR); } + + spin_unlock(&dev->spinlock); + comedi_handle_events(dev, s); return IRQ_HANDLED; } @@ -295,6 +352,7 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->len_chanlist = 1; s->do_cmd = dt2814_ai_cmd; s->do_cmdtest = dt2814_ai_cmdtest; + s->cancel = dt2814_ai_cancel; } return 0; -- 2.30.0 From abbotti at mev.co.uk Mon Mar 1 16:57:56 2021 From: abbotti at mev.co.uk (Ian Abbott) Date: Mon, 1 Mar 2021 16:57:56 +0000 Subject: [PATCH 5/6] staging: comedi: dt2814: Remove struct dt2814_private In-Reply-To: <20210301165757.243065-1-abbotti@mev.co.uk> References: <20210301165757.243065-1-abbotti@mev.co.uk> Message-ID: <20210301165757.243065-6-abbotti@mev.co.uk> The `ntrig` member of the `struct dt2814_private` pointed to by `dev->private` is no longer used as a counter to determine the end of acquisition for a Comedi asynchronous command. The other member `curadscan` is also unused. Remove the allocation of the private data during initialization and remove the definition of `struct dt2814_private` since they are no longer needed. Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/dt2814.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index 6f6d0b2bb44b..d18f9a5a9fb1 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -44,11 +44,6 @@ #define DT2814_ENB 0x10 #define DT2814_CHANMASK 0x0f -struct dt2814_private { - int ntrig; - int curadchan; -}; - #define DT2814_TIMEOUT 10 #define DT2814_MAX_SPEED 100000 /* Arbitrary 10 khz limit */ @@ -207,7 +202,6 @@ static int dt2814_ai_cmdtest(struct comedi_device *dev, static int dt2814_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { - struct dt2814_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; int chan; int trigvar; @@ -217,7 +211,6 @@ static int dt2814_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) chan = CR_CHAN(cmd->chanlist[0]); - devpriv->ntrig = cmd->stop_arg; outb(chan | DT2814_ENB | (trigvar << 5), dev->iobase + DT2814_CSR); return 0; @@ -310,7 +303,6 @@ static irqreturn_t dt2814_interrupt(int irq, void *d) static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - struct dt2814_private *devpriv; struct comedi_subdevice *s; int ret; @@ -335,10 +327,6 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret) return ret; - devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); - if (!devpriv) - return -ENOMEM; - s = &dev->subdevices[0]; s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE | SDF_GROUND; -- 2.30.0 From abbotti at mev.co.uk Mon Mar 1 16:57:57 2021 From: abbotti at mev.co.uk (Ian Abbott) Date: Mon, 1 Mar 2021 16:57:57 +0000 Subject: [PATCH 6/6] staging: comedi: dt2814: Clear stale AI data on detach In-Reply-To: <20210301165757.243065-1-abbotti@mev.co.uk> References: <20210301165757.243065-1-abbotti@mev.co.uk> Message-ID: <20210301165757.243065-7-abbotti@mev.co.uk> When the Comedi "detach" handler is called, it is possible that an extra A/D conversion (triggered during termination of a Comedi asynchronous command) is still in progress. In that case, the FINISH bit in the Status register will eventually get set and there will be stale data waiting to be read from the A/D Data register. The interrupt handler will also be called if still connected at the time. That should all be mostly harmless, but it would be better to wait for any such conversion to complete and clear any stale data during the "detach". Add a custom "detach" handler `dt2814_detach()` to do that if an interrupt handler has been set up. (There is no need to do it if no interrupt handler was set up because Comedi asynchronous command support is disabled in that case.) Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/dt2814.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index d18f9a5a9fb1..ed44ce0d151b 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -346,11 +346,24 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) return 0; } +static void dt2814_detach(struct comedi_device *dev) +{ + if (dev->irq) { + /* + * An extra conversion triggered on termination of an + * asynchronous command may still be in progress. Wait for + * it to finish and clear the data or error status. + */ + dt2814_ai_clear(dev); + } + comedi_legacy_detach(dev); +} + static struct comedi_driver dt2814_driver = { .driver_name = "dt2814", .module = THIS_MODULE, .attach = dt2814_attach, - .detach = comedi_legacy_detach, + .detach = dt2814_detach, }; module_comedi_driver(dt2814_driver); -- 2.30.0 From aellenvera at gmail.com Mon Mar 1 19:45:40 2021 From: aellenvera at gmail.com (Mrs. Vera Aellen) Date: Mon, 1 Mar 2021 20:45:40 +0100 Subject: Greeting Message-ID: Good day You have been selected to receive my grant donation. Please, contact me for further detail.I shall be expecting your quick response veraaellen7 at gmail.com Best Regards, Mrs. Vera Aellen From lkp at intel.com Mon Mar 1 20:15:09 2021 From: lkp at intel.com (kernel test robot) Date: Tue, 02 Mar 2021 04:15:09 +0800 Subject: [driver-core:debugfs_remove_return_value] BUILD SUCCESS 996b090d746db78df6947e224a2f594f0f80dc4c Message-ID: <603d4b4d.ypAntnxTM/gnkQdn%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git debugfs_remove_return_value branch HEAD: 996b090d746db78df6947e224a2f594f0f80dc4c x86/tools/relocs: add __printf attribute to die() elapsed time: 727m configs tested: 122 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm allyesconfig arm allmodconfig arm64 allyesconfig arm64 defconfig arm hackkit_defconfig powerpc ep88xc_defconfig m68k m5475evb_defconfig mips malta_defconfig riscv nommu_virt_defconfig h8300 defconfig sh se7724_defconfig mips xway_defconfig arm realview_defconfig mips vocore2_defconfig arm shannon_defconfig sh polaris_defconfig arc allyesconfig powerpc arches_defconfig ia64 zx1_defconfig sh se7619_defconfig s390 zfcpdump_defconfig xtensa xip_kc705_defconfig powerpc katmai_defconfig sparc sparc32_defconfig powerpc maple_defconfig sh alldefconfig sh kfr2r09_defconfig powerpc mpc834x_itxgp_defconfig sh landisk_defconfig arm stm32_defconfig ia64 allyesconfig powerpc stx_gp3_defconfig riscv alldefconfig arm spitz_defconfig powerpc warp_defconfig xtensa common_defconfig arm neponset_defconfig sh magicpanelr2_defconfig arm zeus_defconfig mips cu1830-neo_defconfig sh rsk7269_defconfig mips mpc30x_defconfig arm versatile_defconfig nios2 alldefconfig powerpc ebony_defconfig powerpc mpc8313_rdb_defconfig powerpc mpc834x_mds_defconfig i386 alldefconfig sh secureedge5410_defconfig mips qi_lb60_defconfig powerpc eiger_defconfig sh rsk7201_defconfig powerpc iss476-smp_defconfig ia64 allmodconfig ia64 defconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig nds32 allnoconfig c6x allyesconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig i386 allyesconfig sparc allyesconfig sparc defconfig i386 tinyconfig i386 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a005-20210301 i386 randconfig-a003-20210301 i386 randconfig-a002-20210301 i386 randconfig-a004-20210301 i386 randconfig-a006-20210301 i386 randconfig-a001-20210301 x86_64 randconfig-a013-20210301 x86_64 randconfig-a016-20210301 x86_64 randconfig-a015-20210301 x86_64 randconfig-a014-20210301 x86_64 randconfig-a012-20210301 x86_64 randconfig-a011-20210301 i386 randconfig-a012-20210301 i386 randconfig-a014-20210301 i386 randconfig-a013-20210301 i386 randconfig-a011-20210301 i386 randconfig-a015-20210301 i386 randconfig-a016-20210301 riscv nommu_k210_defconfig riscv allyesconfig riscv allnoconfig riscv defconfig riscv rv32_defconfig riscv allmodconfig x86_64 allyesconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a006-20210301 x86_64 randconfig-a001-20210301 x86_64 randconfig-a004-20210301 x86_64 randconfig-a002-20210301 x86_64 randconfig-a005-20210301 x86_64 randconfig-a003-20210301 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From lkp at intel.com Mon Mar 1 20:15:12 2021 From: lkp at intel.com (kernel test robot) Date: Tue, 02 Mar 2021 04:15:12 +0800 Subject: [staging:staging-next] BUILD SUCCESS b0ff7ee301a6ed3220056d99a3b343f534edd788 Message-ID: <603d4b50.V6qmCrdJQoluY5Fg%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-next branch HEAD: b0ff7ee301a6ed3220056d99a3b343f534edd788 staging: clocking-wizard: Remove the hardcoding of the clock outputs elapsed time: 728m configs tested: 126 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig arm moxart_defconfig m68k q40_defconfig alpha defconfig ia64 alldefconfig powerpc makalu_defconfig sh se7724_defconfig mips xway_defconfig arm realview_defconfig mips vocore2_defconfig arm shannon_defconfig sh polaris_defconfig arc allyesconfig powerpc arches_defconfig ia64 zx1_defconfig sh se7619_defconfig powerpc mpc832x_rdb_defconfig powerpc walnut_defconfig m68k mvme16x_defconfig arm vexpress_defconfig s390 zfcpdump_defconfig xtensa xip_kc705_defconfig powerpc katmai_defconfig sparc sparc32_defconfig arm sama5_defconfig powerpc maple_defconfig sh alldefconfig sh kfr2r09_defconfig powerpc mpc834x_itxgp_defconfig x86_64 allyesconfig m68k m5475evb_defconfig mips bigsur_defconfig powerpc sequoia_defconfig riscv alldefconfig arm spitz_defconfig powerpc warp_defconfig xtensa common_defconfig arm neponset_defconfig sh magicpanelr2_defconfig arm zeus_defconfig mips cu1830-neo_defconfig sh rsk7269_defconfig mips mpc30x_defconfig arm versatile_defconfig nios2 alldefconfig powerpc ebony_defconfig powerpc mpc8313_rdb_defconfig riscv nommu_virt_defconfig powerpc mpc834x_mds_defconfig i386 alldefconfig sh secureedge5410_defconfig mips qi_lb60_defconfig powerpc eiger_defconfig sh rsk7201_defconfig powerpc iss476-smp_defconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig nios2 defconfig nds32 allnoconfig c6x allyesconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig i386 allyesconfig sparc allyesconfig sparc defconfig i386 tinyconfig i386 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a005-20210301 i386 randconfig-a003-20210301 i386 randconfig-a002-20210301 i386 randconfig-a004-20210301 i386 randconfig-a006-20210301 i386 randconfig-a001-20210301 x86_64 randconfig-a013-20210301 x86_64 randconfig-a016-20210301 x86_64 randconfig-a015-20210301 x86_64 randconfig-a014-20210301 x86_64 randconfig-a012-20210301 x86_64 randconfig-a011-20210301 i386 randconfig-a016-20210301 i386 randconfig-a012-20210301 i386 randconfig-a014-20210301 i386 randconfig-a013-20210301 i386 randconfig-a011-20210301 i386 randconfig-a015-20210301 riscv nommu_k210_defconfig riscv allyesconfig riscv allnoconfig riscv defconfig riscv rv32_defconfig riscv allmodconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a006-20210301 x86_64 randconfig-a001-20210301 x86_64 randconfig-a004-20210301 x86_64 randconfig-a002-20210301 x86_64 randconfig-a005-20210301 x86_64 randconfig-a003-20210301 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From will+git at drnd.me Mon Mar 1 21:53:25 2021 From: will+git at drnd.me (William Durand) Date: Mon, 1 Mar 2021 21:53:25 +0000 Subject: [PATCH 0/9] rx_ts_record struct cleanups Message-ID: <20210301215335.767-1-will+git@drnd.me> This patchset fixes the checkpatch issues related to the `rx_ts_record` struct defined in `rtl8192e/rtl819x_TS.h` (avoid camelcase). The last patch reformats the struct a bit to be more consistent with structures defined in other header files. William Durand (9): staging: rtl8192e: rename TsCommonInfo to ts_common_info in rx_ts_record struct staging: rtl8192e: rename RxIndicateSeq to rx_indicate_seq in rx_ts_record struct staging: rtl8192e: rename RxTimeoutIndicateSeq to rx_timeout_indicate_seq in rx_ts_record struct staging: rtl8192e: rename RxPendingPktList to rx_pending_pkt_list in rx_ts_record struct staging: rtl8192e: rename RxPktPendingTimer to rx_pkt_pending_timer in rx_ts_record struct staging: rtl8192e: rename RxAdmittedBARecord to rx_admitted_ba_record in rx_ts_record struct staging: rtl8192e: rename RxLastSeqNum to rx_last_seq_num in rx_ts_record struct staging: rtl8192e: rename RxLastFragNum to rx_last_frag_num in rx_ts_record struct staging: rtl8192e: reformat rx_ts_record struct drivers/staging/rtl8192e/rtl819x_BAProc.c | 12 ++-- drivers/staging/rtl8192e/rtl819x_TS.h | 18 +++--- drivers/staging/rtl8192e/rtl819x_TSProc.c | 58 +++++++++--------- drivers/staging/rtl8192e/rtllib_rx.c | 74 +++++++++++------------ 4 files changed, 81 insertions(+), 81 deletions(-) -- 2.30.1 From will+git at drnd.me Mon Mar 1 21:53:26 2021 From: will+git at drnd.me (William Durand) Date: Mon, 1 Mar 2021 21:53:26 +0000 Subject: [PATCH 1/9] staging: rtl8192e: rename TsCommonInfo to ts_common_info in rx_ts_record struct In-Reply-To: <20210301215335.767-1-will+git@drnd.me> References: <20210301215335.767-1-will+git@drnd.me> Message-ID: <20210301215335.767-2-will+git@drnd.me> Rename TsCommonInfo to ts_common_info to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand --- drivers/staging/rtl8192e/rtl819x_BAProc.c | 2 +- drivers/staging/rtl8192e/rtl819x_TS.h | 2 +- drivers/staging/rtl8192e/rtl819x_TSProc.c | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c index 880b5f1c14d7..760d143cb3bd 100644 --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c @@ -549,7 +549,7 @@ void RxBaInactTimeout(struct timer_list *t) RxTsRecord[pRxTs->num]); RxTsDeleteBA(ieee, pRxTs); - rtllib_send_DELBA(ieee, pRxTs->TsCommonInfo.Addr, + rtllib_send_DELBA(ieee, pRxTs->ts_common_info.Addr, &pRxTs->RxAdmittedBARecord, RX_DIR, DELBA_REASON_TIMEOUT); } diff --git a/drivers/staging/rtl8192e/rtl819x_TS.h b/drivers/staging/rtl8192e/rtl819x_TS.h index 9dc93d41939d..58879fbba9ef 100644 --- a/drivers/staging/rtl8192e/rtl819x_TS.h +++ b/drivers/staging/rtl8192e/rtl819x_TS.h @@ -42,7 +42,7 @@ struct tx_ts_record { }; struct rx_ts_record { - struct ts_common_info TsCommonInfo; + struct ts_common_info ts_common_info; u16 RxIndicateSeq; u16 RxTimeoutIndicateSeq; struct list_head RxPendingPktList; diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index ff65aa45abe0..f8e7beb7909f 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -123,7 +123,7 @@ static void ResetTxTsEntry(struct tx_ts_record *pTS) static void ResetRxTsEntry(struct rx_ts_record *pTS) { - ResetTsCommonInfo(&pTS->TsCommonInfo); + ResetTsCommonInfo(&pTS->ts_common_info); pTS->RxIndicateSeq = 0xffff; pTS->RxTimeoutIndicateSeq = 0xffff; ResetBaEntry(&pTS->RxAdmittedBARecord); @@ -169,10 +169,10 @@ void TSInitialize(struct rtllib_device *ieee) pRxTS->num = count; INIT_LIST_HEAD(&pRxTS->RxPendingPktList); - timer_setup(&pRxTS->TsCommonInfo.SetupTimer, TsSetupTimeOut, + timer_setup(&pRxTS->ts_common_info.SetupTimer, TsSetupTimeOut, 0); - timer_setup(&pRxTS->TsCommonInfo.InactTimer, TsInactTimeout, + timer_setup(&pRxTS->ts_common_info.InactTimer, TsInactTimeout, 0); timer_setup(&pRxTS->RxAdmittedBARecord.timer, @@ -181,7 +181,7 @@ void TSInitialize(struct rtllib_device *ieee) timer_setup(&pRxTS->RxPktPendingTimer, RxPktPendingTimeout, 0); ResetRxTsEntry(pRxTS); - list_add_tail(&pRxTS->TsCommonInfo.List, + list_add_tail(&pRxTS->ts_common_info.List, &ieee->Rx_TS_Unused_List); pRxTS++; } @@ -364,7 +364,7 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, struct rx_ts_record *tmp = container_of(*ppTS, struct rx_ts_record, - TsCommonInfo); + ts_common_info); ResetRxTsEntry(tmp); } -- 2.30.1 From will+git at drnd.me Mon Mar 1 21:53:27 2021 From: will+git at drnd.me (William Durand) Date: Mon, 1 Mar 2021 21:53:27 +0000 Subject: [PATCH 2/9] staging: rtl8192e: rename RxIndicateSeq to rx_indicate_seq in rx_ts_record struct In-Reply-To: <20210301215335.767-1-will+git@drnd.me> References: <20210301215335.767-1-will+git@drnd.me> Message-ID: <20210301215335.767-3-will+git@drnd.me> Rename RxIndicateSeq to rx_indicate_seq to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand --- drivers/staging/rtl8192e/rtl819x_TS.h | 2 +- drivers/staging/rtl8192e/rtl819x_TSProc.c | 16 ++++----- drivers/staging/rtl8192e/rtllib_rx.c | 42 +++++++++++------------ 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_TS.h b/drivers/staging/rtl8192e/rtl819x_TS.h index 58879fbba9ef..11335df748b5 100644 --- a/drivers/staging/rtl8192e/rtl819x_TS.h +++ b/drivers/staging/rtl8192e/rtl819x_TS.h @@ -43,7 +43,7 @@ struct tx_ts_record { struct rx_ts_record { struct ts_common_info ts_common_info; - u16 RxIndicateSeq; + u16 rx_indicate_seq; u16 RxTimeoutIndicateSeq; struct list_head RxPendingPktList; struct timer_list RxPktPendingTimer; diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index f8e7beb7909f..e885eff0ea79 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -36,18 +36,18 @@ static void RxPktPendingTimeout(struct timer_list *t) list_entry(pRxTs->RxPendingPktList.prev, struct rx_reorder_entry, List); if (index == 0) - pRxTs->RxIndicateSeq = pReorderEntry->SeqNum; + pRxTs->rx_indicate_seq = pReorderEntry->SeqNum; if (SN_LESS(pReorderEntry->SeqNum, - pRxTs->RxIndicateSeq) || + pRxTs->rx_indicate_seq) || SN_EQUAL(pReorderEntry->SeqNum, - pRxTs->RxIndicateSeq)) { + pRxTs->rx_indicate_seq)) { list_del_init(&pReorderEntry->List); if (SN_EQUAL(pReorderEntry->SeqNum, - pRxTs->RxIndicateSeq)) - pRxTs->RxIndicateSeq = - (pRxTs->RxIndicateSeq + 1) % 4096; + pRxTs->rx_indicate_seq)) + pRxTs->rx_indicate_seq = + (pRxTs->rx_indicate_seq + 1) % 4096; netdev_dbg(ieee->dev, "%s(): Indicate SeqNum: %d\n", @@ -81,7 +81,7 @@ static void RxPktPendingTimeout(struct timer_list *t) } if (bPktInBuf && (pRxTs->RxTimeoutIndicateSeq == 0xffff)) { - pRxTs->RxTimeoutIndicateSeq = pRxTs->RxIndicateSeq; + pRxTs->RxTimeoutIndicateSeq = pRxTs->rx_indicate_seq; mod_timer(&pRxTs->RxPktPendingTimer, jiffies + msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime) ); @@ -124,7 +124,7 @@ static void ResetTxTsEntry(struct tx_ts_record *pTS) static void ResetRxTsEntry(struct rx_ts_record *pTS) { ResetTsCommonInfo(&pTS->ts_common_info); - pTS->RxIndicateSeq = 0xffff; + pTS->rx_indicate_seq = 0xffff; pTS->RxTimeoutIndicateSeq = 0xffff; ResetBaEntry(&pTS->RxAdmittedBARecord); } diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index b8ab34250e6a..c8fa4cf8eab0 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -560,7 +560,7 @@ void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, } rtllib_indicate_packets(ieee, ieee->RfdArray, RfdCnt); - pTS->RxIndicateSeq = 0xffff; + pTS->rx_indicate_seq = 0xffff; } static void RxReorderIndicatePacket(struct rtllib_device *ieee, @@ -576,21 +576,21 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, unsigned long flags; netdev_dbg(ieee->dev, - "%s(): Seq is %d, pTS->RxIndicateSeq is %d, WinSize is %d\n", - __func__, SeqNum, pTS->RxIndicateSeq, WinSize); + "%s(): Seq is %d, pTS->rx_indicate_seq is %d, WinSize is %d\n", + __func__, SeqNum, pTS->rx_indicate_seq, WinSize); spin_lock_irqsave(&(ieee->reorder_spinlock), flags); - WinEnd = (pTS->RxIndicateSeq + WinSize - 1) % 4096; + WinEnd = (pTS->rx_indicate_seq + WinSize - 1) % 4096; /* Rx Reorder initialize condition.*/ - if (pTS->RxIndicateSeq == 0xffff) - pTS->RxIndicateSeq = SeqNum; + if (pTS->rx_indicate_seq == 0xffff) + pTS->rx_indicate_seq = SeqNum; /* Drop out the packet which SeqNum is smaller than WinStart */ - if (SN_LESS(SeqNum, pTS->RxIndicateSeq)) { + if (SN_LESS(SeqNum, pTS->rx_indicate_seq)) { netdev_dbg(ieee->dev, "Packet Drop! IndicateSeq: %d, NewSeq: %d\n", - pTS->RxIndicateSeq, SeqNum); + pTS->rx_indicate_seq, SeqNum); pHTInfo->RxReorderDropCounter++; { int i; @@ -608,18 +608,18 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, * 1. Incoming SeqNum is equal to WinStart =>Window shift 1 * 2. Incoming SeqNum is larger than the WinEnd => Window shift N */ - if (SN_EQUAL(SeqNum, pTS->RxIndicateSeq)) { - pTS->RxIndicateSeq = (pTS->RxIndicateSeq + 1) % 4096; + if (SN_EQUAL(SeqNum, pTS->rx_indicate_seq)) { + pTS->rx_indicate_seq = (pTS->rx_indicate_seq + 1) % 4096; bMatchWinStart = true; } else if (SN_LESS(WinEnd, SeqNum)) { if (SeqNum >= (WinSize - 1)) - pTS->RxIndicateSeq = SeqNum + 1 - WinSize; + pTS->rx_indicate_seq = SeqNum + 1 - WinSize; else - pTS->RxIndicateSeq = 4095 - + pTS->rx_indicate_seq = 4095 - (WinSize - (SeqNum + 1)) + 1; netdev_dbg(ieee->dev, "Window Shift! IndicateSeq: %d, NewSeq: %d\n", - pTS->RxIndicateSeq, SeqNum); + pTS->rx_indicate_seq, SeqNum); } /* Indication process. @@ -636,7 +636,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, /* Current packet is going to be indicated.*/ netdev_dbg(ieee->dev, "Packets indication! IndicateSeq: %d, NewSeq: %d\n", - pTS->RxIndicateSeq, SeqNum); + pTS->rx_indicate_seq, SeqNum); ieee->prxbIndicateArray[0] = prxb; index = 1; } else { @@ -658,7 +658,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, netdev_dbg(ieee->dev, "%s(): Duplicate packet is dropped. IndicateSeq: %d, NewSeq: %d\n", - __func__, pTS->RxIndicateSeq, + __func__, pTS->rx_indicate_seq, SeqNum); list_add_tail(&pReorderEntry->List, &ieee->RxReorder_Unused_List); @@ -670,7 +670,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, } else { netdev_dbg(ieee->dev, "Pkt insert into struct buffer. IndicateSeq: %d, NewSeq: %d\n", - pTS->RxIndicateSeq, SeqNum); + pTS->rx_indicate_seq, SeqNum); } } else { /* Packets are dropped if there are not enough reorder @@ -701,8 +701,8 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, list_entry(pTS->RxPendingPktList.prev, struct rx_reorder_entry, List); - if (SN_LESS(pReorderEntry->SeqNum, pTS->RxIndicateSeq) || - SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq)) { + if (SN_LESS(pReorderEntry->SeqNum, pTS->rx_indicate_seq) || + SN_EQUAL(pReorderEntry->SeqNum, pTS->rx_indicate_seq)) { /* This protect struct buffer from overflow. */ if (index >= REORDER_WIN_SIZE) { netdev_err(ieee->dev, @@ -714,8 +714,8 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, list_del_init(&pReorderEntry->List); - if (SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq)) - pTS->RxIndicateSeq = (pTS->RxIndicateSeq + 1) % + if (SN_EQUAL(pReorderEntry->SeqNum, pTS->rx_indicate_seq)) + pTS->rx_indicate_seq = (pTS->rx_indicate_seq + 1) % 4096; ieee->prxbIndicateArray[index] = pReorderEntry->prxb; @@ -753,7 +753,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, if (bPktInBuf && pTS->RxTimeoutIndicateSeq == 0xffff) { netdev_dbg(ieee->dev, "%s(): SET rx timeout timer\n", __func__); - pTS->RxTimeoutIndicateSeq = pTS->RxIndicateSeq; + pTS->RxTimeoutIndicateSeq = pTS->rx_indicate_seq; mod_timer(&pTS->RxPktPendingTimer, jiffies + msecs_to_jiffies(pHTInfo->RxReorderPendingTime)); } -- 2.30.1 From will+git at drnd.me Mon Mar 1 21:53:28 2021 From: will+git at drnd.me (William Durand) Date: Mon, 1 Mar 2021 21:53:28 +0000 Subject: [PATCH 3/9] staging: rtl8192e: rename RxTimeoutIndicateSeq to rx_timeout_indicate_seq in rx_ts_record struct In-Reply-To: <20210301215335.767-1-will+git@drnd.me> References: <20210301215335.767-1-will+git@drnd.me> Message-ID: <20210301215335.767-4-will+git@drnd.me> Rename RxTimeoutIndicateSeq to rx_timeout_indicate_seq to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand --- drivers/staging/rtl8192e/rtl819x_TS.h | 2 +- drivers/staging/rtl8192e/rtl819x_TSProc.c | 10 +++++----- drivers/staging/rtl8192e/rtllib_rx.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_TS.h b/drivers/staging/rtl8192e/rtl819x_TS.h index 11335df748b5..045093c1eb79 100644 --- a/drivers/staging/rtl8192e/rtl819x_TS.h +++ b/drivers/staging/rtl8192e/rtl819x_TS.h @@ -44,7 +44,7 @@ struct tx_ts_record { struct rx_ts_record { struct ts_common_info ts_common_info; u16 rx_indicate_seq; - u16 RxTimeoutIndicateSeq; + u16 rx_timeout_indicate_seq; struct list_head RxPendingPktList; struct timer_list RxPktPendingTimer; struct ba_record RxAdmittedBARecord; diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index e885eff0ea79..004a2f65436c 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -30,7 +30,7 @@ static void RxPktPendingTimeout(struct timer_list *t) bool bPktInBuf = false; spin_lock_irqsave(&(ieee->reorder_spinlock), flags); - if (pRxTs->RxTimeoutIndicateSeq != 0xffff) { + if (pRxTs->rx_timeout_indicate_seq != 0xffff) { while (!list_empty(&pRxTs->RxPendingPktList)) { pReorderEntry = (struct rx_reorder_entry *) list_entry(pRxTs->RxPendingPktList.prev, @@ -66,7 +66,7 @@ static void RxPktPendingTimeout(struct timer_list *t) } if (index > 0) { - pRxTs->RxTimeoutIndicateSeq = 0xffff; + pRxTs->rx_timeout_indicate_seq = 0xffff; if (index > REORDER_WIN_SIZE) { netdev_warn(ieee->dev, @@ -80,8 +80,8 @@ static void RxPktPendingTimeout(struct timer_list *t) bPktInBuf = false; } - if (bPktInBuf && (pRxTs->RxTimeoutIndicateSeq == 0xffff)) { - pRxTs->RxTimeoutIndicateSeq = pRxTs->rx_indicate_seq; + if (bPktInBuf && (pRxTs->rx_timeout_indicate_seq == 0xffff)) { + pRxTs->rx_timeout_indicate_seq = pRxTs->rx_indicate_seq; mod_timer(&pRxTs->RxPktPendingTimer, jiffies + msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime) ); @@ -125,7 +125,7 @@ static void ResetRxTsEntry(struct rx_ts_record *pTS) { ResetTsCommonInfo(&pTS->ts_common_info); pTS->rx_indicate_seq = 0xffff; - pTS->RxTimeoutIndicateSeq = 0xffff; + pTS->rx_timeout_indicate_seq = 0xffff; ResetBaEntry(&pTS->RxAdmittedBARecord); } diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index c8fa4cf8eab0..76a671ec4d35 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -737,7 +737,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, if (index > 0) { if (timer_pending(&pTS->RxPktPendingTimer)) del_timer_sync(&pTS->RxPktPendingTimer); - pTS->RxTimeoutIndicateSeq = 0xffff; + pTS->rx_timeout_indicate_seq = 0xffff; if (index > REORDER_WIN_SIZE) { netdev_err(ieee->dev, @@ -751,9 +751,9 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, bPktInBuf = false; } - if (bPktInBuf && pTS->RxTimeoutIndicateSeq == 0xffff) { + if (bPktInBuf && pTS->rx_timeout_indicate_seq == 0xffff) { netdev_dbg(ieee->dev, "%s(): SET rx timeout timer\n", __func__); - pTS->RxTimeoutIndicateSeq = pTS->rx_indicate_seq; + pTS->rx_timeout_indicate_seq = pTS->rx_indicate_seq; mod_timer(&pTS->RxPktPendingTimer, jiffies + msecs_to_jiffies(pHTInfo->RxReorderPendingTime)); } -- 2.30.1 From will+git at drnd.me Mon Mar 1 21:53:32 2021 From: will+git at drnd.me (William Durand) Date: Mon, 1 Mar 2021 21:53:32 +0000 Subject: [PATCH 7/9] staging: rtl8192e: rename RxLastSeqNum to rx_last_seq_num in rx_ts_record struct In-Reply-To: <20210301215335.767-1-will+git@drnd.me> References: <20210301215335.767-1-will+git@drnd.me> Message-ID: <20210301215335.767-8-will+git@drnd.me> Rename RxLastSeqNum to rx_last_seq_num to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand --- drivers/staging/rtl8192e/rtl819x_TS.h | 2 +- drivers/staging/rtl8192e/rtllib_rx.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_TS.h b/drivers/staging/rtl8192e/rtl819x_TS.h index 333bf6b4f164..af1e658f2028 100644 --- a/drivers/staging/rtl8192e/rtl819x_TS.h +++ b/drivers/staging/rtl8192e/rtl819x_TS.h @@ -48,7 +48,7 @@ struct rx_ts_record { struct list_head rx_pending_pkt_list; struct timer_list rx_pkt_pending_timer; struct ba_record rx_admitted_ba_record; - u16 RxLastSeqNum; + u16 rx_last_seq_num; u8 RxLastFragNum; u8 num; }; diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 50c30993f68d..f1571e91aa08 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -939,10 +939,10 @@ static int rtllib_rx_check_duplicate(struct rtllib_device *ieee, if (GetTs(ieee, (struct ts_common_info **) &pRxTS, hdr->addr2, (u8)Frame_QoSTID((u8 *)(skb->data)), RX_DIR, true)) { if ((fc & (1<<11)) && (frag == pRxTS->RxLastFragNum) && - (WLAN_GET_SEQ_SEQ(sc) == pRxTS->RxLastSeqNum)) + (WLAN_GET_SEQ_SEQ(sc) == pRxTS->rx_last_seq_num)) return -1; pRxTS->RxLastFragNum = frag; - pRxTS->RxLastSeqNum = WLAN_GET_SEQ_SEQ(sc); + pRxTS->rx_last_seq_num = WLAN_GET_SEQ_SEQ(sc); } else { netdev_warn(ieee->dev, "%s(): No TS! Skip the check!\n", __func__); -- 2.30.1 From will+git at drnd.me Mon Mar 1 21:53:30 2021 From: will+git at drnd.me (William Durand) Date: Mon, 1 Mar 2021 21:53:30 +0000 Subject: [PATCH 5/9] staging: rtl8192e: rename RxPktPendingTimer to rx_pkt_pending_timer in rx_ts_record struct In-Reply-To: <20210301215335.767-1-will+git@drnd.me> References: <20210301215335.767-1-will+git@drnd.me> Message-ID: <20210301215335.767-6-will+git@drnd.me> Rename RxPktPendingTimer to rx_pkt_pending_timer to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand --- drivers/staging/rtl8192e/rtl819x_TS.h | 2 +- drivers/staging/rtl8192e/rtl819x_TSProc.c | 10 +++++----- drivers/staging/rtl8192e/rtllib_rx.c | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_TS.h b/drivers/staging/rtl8192e/rtl819x_TS.h index 3fc89906b309..0e936c82617b 100644 --- a/drivers/staging/rtl8192e/rtl819x_TS.h +++ b/drivers/staging/rtl8192e/rtl819x_TS.h @@ -46,7 +46,7 @@ struct rx_ts_record { u16 rx_indicate_seq; u16 rx_timeout_indicate_seq; struct list_head rx_pending_pkt_list; - struct timer_list RxPktPendingTimer; + struct timer_list rx_pkt_pending_timer; struct ba_record RxAdmittedBARecord; u16 RxLastSeqNum; u8 RxLastFragNum; diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index 0195c75ec59c..ae53303775da 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -19,7 +19,7 @@ static void TsInactTimeout(struct timer_list *unused) static void RxPktPendingTimeout(struct timer_list *t) { struct rx_ts_record *pRxTs = from_timer(pRxTs, t, - RxPktPendingTimer); + rx_pkt_pending_timer); struct rtllib_device *ieee = container_of(pRxTs, struct rtllib_device, RxTsRecord[pRxTs->num]); @@ -82,7 +82,7 @@ static void RxPktPendingTimeout(struct timer_list *t) if (bPktInBuf && (pRxTs->rx_timeout_indicate_seq == 0xffff)) { pRxTs->rx_timeout_indicate_seq = pRxTs->rx_indicate_seq; - mod_timer(&pRxTs->RxPktPendingTimer, jiffies + + mod_timer(&pRxTs->rx_pkt_pending_timer, jiffies + msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime) ); } @@ -178,7 +178,7 @@ void TSInitialize(struct rtllib_device *ieee) timer_setup(&pRxTS->RxAdmittedBARecord.timer, RxBaInactTimeout, 0); - timer_setup(&pRxTS->RxPktPendingTimer, RxPktPendingTimeout, 0); + timer_setup(&pRxTS->rx_pkt_pending_timer, RxPktPendingTimeout, 0); ResetRxTsEntry(pRxTS); list_add_tail(&pRxTS->ts_common_info.List, @@ -405,8 +405,8 @@ static void RemoveTsEntry(struct rtllib_device *ieee, struct rx_reorder_entry *pRxReorderEntry; struct rx_ts_record *pRxTS = (struct rx_ts_record *)pTs; - if (timer_pending(&pRxTS->RxPktPendingTimer)) - del_timer_sync(&pRxTS->RxPktPendingTimer); + if (timer_pending(&pRxTS->rx_pkt_pending_timer)) + del_timer_sync(&pRxTS->rx_pkt_pending_timer); while (!list_empty(&pRxTS->rx_pending_pkt_list)) { pRxReorderEntry = (struct rx_reorder_entry *) diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index cbf314cbfebf..50c30993f68d 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -536,7 +536,7 @@ void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, struct rx_reorder_entry *pRxReorderEntry; u8 RfdCnt = 0; - del_timer_sync(&pTS->RxPktPendingTimer); + del_timer_sync(&pTS->rx_pkt_pending_timer); while (!list_empty(&pTS->rx_pending_pkt_list)) { if (RfdCnt >= REORDER_WIN_SIZE) { netdev_info(ieee->dev, @@ -735,8 +735,8 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, * Rx buffering. */ if (index > 0) { - if (timer_pending(&pTS->RxPktPendingTimer)) - del_timer_sync(&pTS->RxPktPendingTimer); + if (timer_pending(&pTS->rx_pkt_pending_timer)) + del_timer_sync(&pTS->rx_pkt_pending_timer); pTS->rx_timeout_indicate_seq = 0xffff; if (index > REORDER_WIN_SIZE) { @@ -754,7 +754,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, if (bPktInBuf && pTS->rx_timeout_indicate_seq == 0xffff) { netdev_dbg(ieee->dev, "%s(): SET rx timeout timer\n", __func__); pTS->rx_timeout_indicate_seq = pTS->rx_indicate_seq; - mod_timer(&pTS->RxPktPendingTimer, jiffies + + mod_timer(&pTS->rx_pkt_pending_timer, jiffies + msecs_to_jiffies(pHTInfo->RxReorderPendingTime)); } spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); -- 2.30.1 From will+git at drnd.me Mon Mar 1 21:53:33 2021 From: will+git at drnd.me (William Durand) Date: Mon, 1 Mar 2021 21:53:33 +0000 Subject: [PATCH 8/9] staging: rtl8192e: rename RxLastFragNum to rx_last_frag_num in rx_ts_record struct In-Reply-To: <20210301215335.767-1-will+git@drnd.me> References: <20210301215335.767-1-will+git@drnd.me> Message-ID: <20210301215335.767-9-will+git@drnd.me> Rename RxLastFragNum to rx_last_frag_num to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand --- drivers/staging/rtl8192e/rtl819x_TS.h | 2 +- drivers/staging/rtl8192e/rtllib_rx.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_TS.h b/drivers/staging/rtl8192e/rtl819x_TS.h index af1e658f2028..c4995fda9ebb 100644 --- a/drivers/staging/rtl8192e/rtl819x_TS.h +++ b/drivers/staging/rtl8192e/rtl819x_TS.h @@ -49,7 +49,7 @@ struct rx_ts_record { struct timer_list rx_pkt_pending_timer; struct ba_record rx_admitted_ba_record; u16 rx_last_seq_num; - u8 RxLastFragNum; + u8 rx_last_frag_num; u8 num; }; diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index f1571e91aa08..8415f26fd4c0 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -938,10 +938,10 @@ static int rtllib_rx_check_duplicate(struct rtllib_device *ieee, if (GetTs(ieee, (struct ts_common_info **) &pRxTS, hdr->addr2, (u8)Frame_QoSTID((u8 *)(skb->data)), RX_DIR, true)) { - if ((fc & (1<<11)) && (frag == pRxTS->RxLastFragNum) && + if ((fc & (1<<11)) && (frag == pRxTS->rx_last_frag_num) && (WLAN_GET_SEQ_SEQ(sc) == pRxTS->rx_last_seq_num)) return -1; - pRxTS->RxLastFragNum = frag; + pRxTS->rx_last_frag_num = frag; pRxTS->rx_last_seq_num = WLAN_GET_SEQ_SEQ(sc); } else { netdev_warn(ieee->dev, "%s(): No TS! Skip the check!\n", -- 2.30.1 From will+git at drnd.me Mon Mar 1 21:53:31 2021 From: will+git at drnd.me (William Durand) Date: Mon, 1 Mar 2021 21:53:31 +0000 Subject: [PATCH 6/9] staging: rtl8192e: rename RxAdmittedBARecord to rx_admitted_ba_record in rx_ts_record struct In-Reply-To: <20210301215335.767-1-will+git@drnd.me> References: <20210301215335.767-1-will+git@drnd.me> Message-ID: <20210301215335.767-7-will+git@drnd.me> Rename RxAdmittedBARecord to rx_admitted_ba_record to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand --- drivers/staging/rtl8192e/rtl819x_BAProc.c | 10 +++++----- drivers/staging/rtl8192e/rtl819x_TS.h | 2 +- drivers/staging/rtl8192e/rtl819x_TSProc.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c index 760d143cb3bd..7dfe7a055876 100644 --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c @@ -44,7 +44,7 @@ static u8 TxTsDeleteBA(struct rtllib_device *ieee, struct tx_ts_record *pTxTs) static u8 RxTsDeleteBA(struct rtllib_device *ieee, struct rx_ts_record *pRxTs) { - struct ba_record *pBa = &pRxTs->RxAdmittedBARecord; + struct ba_record *pBa = &pRxTs->rx_admitted_ba_record; u8 bSendDELBA = false; if (pBa->b_valid) { @@ -265,7 +265,7 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb) netdev_warn(ieee->dev, "%s(): can't get TS\n", __func__); goto OnADDBAReq_Fail; } - pBA = &pTS->RxAdmittedBARecord; + pBA = &pTS->rx_admitted_ba_record; if (pBaParamSet->field.ba_policy == BA_POLICY_DELAYED) { rc = ADDBA_STATUS_INVALID_PARAM; @@ -514,7 +514,7 @@ void TsInitDelBA(struct rtllib_device *ieee, (struct rx_ts_record *)pTsCommonInfo; if (RxTsDeleteBA(ieee, pRxTs)) rtllib_send_DELBA(ieee, pTsCommonInfo->Addr, - &pRxTs->RxAdmittedBARecord, + &pRxTs->rx_admitted_ba_record, TxRxSelect, DELBA_REASON_END_BA); } } @@ -544,12 +544,12 @@ void TxBaInactTimeout(struct timer_list *t) void RxBaInactTimeout(struct timer_list *t) { struct rx_ts_record *pRxTs = from_timer(pRxTs, t, - RxAdmittedBARecord.timer); + rx_admitted_ba_record.timer); struct rtllib_device *ieee = container_of(pRxTs, struct rtllib_device, RxTsRecord[pRxTs->num]); RxTsDeleteBA(ieee, pRxTs); rtllib_send_DELBA(ieee, pRxTs->ts_common_info.Addr, - &pRxTs->RxAdmittedBARecord, RX_DIR, + &pRxTs->rx_admitted_ba_record, RX_DIR, DELBA_REASON_TIMEOUT); } diff --git a/drivers/staging/rtl8192e/rtl819x_TS.h b/drivers/staging/rtl8192e/rtl819x_TS.h index 0e936c82617b..333bf6b4f164 100644 --- a/drivers/staging/rtl8192e/rtl819x_TS.h +++ b/drivers/staging/rtl8192e/rtl819x_TS.h @@ -47,7 +47,7 @@ struct rx_ts_record { u16 rx_timeout_indicate_seq; struct list_head rx_pending_pkt_list; struct timer_list rx_pkt_pending_timer; - struct ba_record RxAdmittedBARecord; + struct ba_record rx_admitted_ba_record; u16 RxLastSeqNum; u8 RxLastFragNum; u8 num; diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index ae53303775da..c294a6543e12 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -126,7 +126,7 @@ static void ResetRxTsEntry(struct rx_ts_record *pTS) ResetTsCommonInfo(&pTS->ts_common_info); pTS->rx_indicate_seq = 0xffff; pTS->rx_timeout_indicate_seq = 0xffff; - ResetBaEntry(&pTS->RxAdmittedBARecord); + ResetBaEntry(&pTS->rx_admitted_ba_record); } void TSInitialize(struct rtllib_device *ieee) @@ -175,7 +175,7 @@ void TSInitialize(struct rtllib_device *ieee) timer_setup(&pRxTS->ts_common_info.InactTimer, TsInactTimeout, 0); - timer_setup(&pRxTS->RxAdmittedBARecord.timer, + timer_setup(&pRxTS->rx_admitted_ba_record.timer, RxBaInactTimeout, 0); timer_setup(&pRxTS->rx_pkt_pending_timer, RxPktPendingTimeout, 0); -- 2.30.1 From will+git at drnd.me Mon Mar 1 21:53:29 2021 From: will+git at drnd.me (William Durand) Date: Mon, 1 Mar 2021 21:53:29 +0000 Subject: [PATCH 4/9] staging: rtl8192e: rename RxPendingPktList to rx_pending_pkt_list in rx_ts_record struct In-Reply-To: <20210301215335.767-1-will+git@drnd.me> References: <20210301215335.767-1-will+git@drnd.me> Message-ID: <20210301215335.767-5-will+git@drnd.me> Rename RxPendingPktList to rx_pending_pkt_list to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand --- drivers/staging/rtl8192e/rtl819x_TS.h | 2 +- drivers/staging/rtl8192e/rtl819x_TSProc.c | 10 +++++----- drivers/staging/rtl8192e/rtllib_rx.c | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_TS.h b/drivers/staging/rtl8192e/rtl819x_TS.h index 045093c1eb79..3fc89906b309 100644 --- a/drivers/staging/rtl8192e/rtl819x_TS.h +++ b/drivers/staging/rtl8192e/rtl819x_TS.h @@ -45,7 +45,7 @@ struct rx_ts_record { struct ts_common_info ts_common_info; u16 rx_indicate_seq; u16 rx_timeout_indicate_seq; - struct list_head RxPendingPktList; + struct list_head rx_pending_pkt_list; struct timer_list RxPktPendingTimer; struct ba_record RxAdmittedBARecord; u16 RxLastSeqNum; diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index 004a2f65436c..0195c75ec59c 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -31,9 +31,9 @@ static void RxPktPendingTimeout(struct timer_list *t) spin_lock_irqsave(&(ieee->reorder_spinlock), flags); if (pRxTs->rx_timeout_indicate_seq != 0xffff) { - while (!list_empty(&pRxTs->RxPendingPktList)) { + while (!list_empty(&pRxTs->rx_pending_pkt_list)) { pReorderEntry = (struct rx_reorder_entry *) - list_entry(pRxTs->RxPendingPktList.prev, + list_entry(pRxTs->rx_pending_pkt_list.prev, struct rx_reorder_entry, List); if (index == 0) pRxTs->rx_indicate_seq = pReorderEntry->SeqNum; @@ -167,7 +167,7 @@ void TSInitialize(struct rtllib_device *ieee) INIT_LIST_HEAD(&ieee->Rx_TS_Unused_List); for (count = 0; count < TOTAL_TS_NUM; count++) { pRxTS->num = count; - INIT_LIST_HEAD(&pRxTS->RxPendingPktList); + INIT_LIST_HEAD(&pRxTS->rx_pending_pkt_list); timer_setup(&pRxTS->ts_common_info.SetupTimer, TsSetupTimeOut, 0); @@ -408,9 +408,9 @@ static void RemoveTsEntry(struct rtllib_device *ieee, if (timer_pending(&pRxTS->RxPktPendingTimer)) del_timer_sync(&pRxTS->RxPktPendingTimer); - while (!list_empty(&pRxTS->RxPendingPktList)) { + while (!list_empty(&pRxTS->rx_pending_pkt_list)) { pRxReorderEntry = (struct rx_reorder_entry *) - list_entry(pRxTS->RxPendingPktList.prev, + list_entry(pRxTS->rx_pending_pkt_list.prev, struct rx_reorder_entry, List); netdev_dbg(ieee->dev, "%s(): Delete SeqNum %d!\n", __func__, pRxReorderEntry->SeqNum); diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 76a671ec4d35..cbf314cbfebf 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -449,9 +449,9 @@ static int is_duplicate_packet(struct rtllib_device *ieee, static bool AddReorderEntry(struct rx_ts_record *pTS, struct rx_reorder_entry *pReorderEntry) { - struct list_head *pList = &pTS->RxPendingPktList; + struct list_head *pList = &pTS->rx_pending_pkt_list; - while (pList->next != &pTS->RxPendingPktList) { + while (pList->next != &pTS->rx_pending_pkt_list) { if (SN_LESS(pReorderEntry->SeqNum, ((struct rx_reorder_entry *) list_entry(pList->next, struct rx_reorder_entry, List))->SeqNum)) @@ -537,7 +537,7 @@ void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, u8 RfdCnt = 0; del_timer_sync(&pTS->RxPktPendingTimer); - while (!list_empty(&pTS->RxPendingPktList)) { + while (!list_empty(&pTS->rx_pending_pkt_list)) { if (RfdCnt >= REORDER_WIN_SIZE) { netdev_info(ieee->dev, "-------------->%s() error! RfdCnt >= REORDER_WIN_SIZE\n", @@ -546,7 +546,7 @@ void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, } pRxReorderEntry = (struct rx_reorder_entry *) - list_entry(pTS->RxPendingPktList.prev, + list_entry(pTS->rx_pending_pkt_list.prev, struct rx_reorder_entry, List); netdev_dbg(ieee->dev, "%s(): Indicate SeqNum %d!\n", __func__, pRxReorderEntry->SeqNum); @@ -693,12 +693,12 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, } /* Check if there is any packet need indicate.*/ - while (!list_empty(&pTS->RxPendingPktList)) { + while (!list_empty(&pTS->rx_pending_pkt_list)) { netdev_dbg(ieee->dev, "%s(): start RREORDER indicate\n", __func__); pReorderEntry = (struct rx_reorder_entry *) - list_entry(pTS->RxPendingPktList.prev, + list_entry(pTS->rx_pending_pkt_list.prev, struct rx_reorder_entry, List); if (SN_LESS(pReorderEntry->SeqNum, pTS->rx_indicate_seq) || -- 2.30.1 From will+git at drnd.me Mon Mar 1 21:53:34 2021 From: will+git at drnd.me (William Durand) Date: Mon, 1 Mar 2021 21:53:34 +0000 Subject: [PATCH 9/9] staging: rtl8192e: reformat rx_ts_record struct In-Reply-To: <20210301215335.767-1-will+git@drnd.me> References: <20210301215335.767-1-will+git@drnd.me> Message-ID: <20210301215335.767-10-will+git@drnd.me> This change uses a space instead of tabs between the type and name of each member of the struct. Signed-off-by: William Durand --- drivers/staging/rtl8192e/rtl819x_TS.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_TS.h b/drivers/staging/rtl8192e/rtl819x_TS.h index c4995fda9ebb..4aa9b12a2dd5 100644 --- a/drivers/staging/rtl8192e/rtl819x_TS.h +++ b/drivers/staging/rtl8192e/rtl819x_TS.h @@ -43,14 +43,14 @@ struct tx_ts_record { struct rx_ts_record { struct ts_common_info ts_common_info; - u16 rx_indicate_seq; - u16 rx_timeout_indicate_seq; - struct list_head rx_pending_pkt_list; - struct timer_list rx_pkt_pending_timer; + u16 rx_indicate_seq; + u16 rx_timeout_indicate_seq; + struct list_head rx_pending_pkt_list; + struct timer_list rx_pkt_pending_timer; struct ba_record rx_admitted_ba_record; - u16 rx_last_seq_num; - u8 rx_last_frag_num; - u8 num; + u16 rx_last_seq_num; + u8 rx_last_frag_num; + u8 num; }; -- 2.30.1 From gabriele.modena at gmail.com Tue Mar 2 09:11:02 2021 From: gabriele.modena at gmail.com (gabriele.modena at gmail.com) Date: Tue, 2 Mar 2021 10:11:02 +0100 Subject: [PATCH] wimax: attempt to address style issues. Message-ID: <20210302091102.1598-1-gabriele.modena@gmail.com> From: Gabriele Modena When running checkpatch.pl on op-msg.c, op-rfkill.c and stack.c I noticed that they contained a few style issues at warning level of severity. This patch is both an attempt to address the warnings, as well as a way for me to familiarise with the linux kernel contribution process, by following tasks proposed by a popular online challenge. Signed-off-by: Gabriele Modena --- drivers/staging/wimax/op-msg.c | 8 ++++---- drivers/staging/wimax/op-rfkill.c | 7 ++++--- drivers/staging/wimax/stack.c | 12 ++++++------ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/staging/wimax/op-msg.c b/drivers/staging/wimax/op-msg.c index e20ac7d84e82..11da48bf704f 100644 --- a/drivers/staging/wimax/op-msg.c +++ b/drivers/staging/wimax/op-msg.c @@ -142,8 +142,8 @@ struct sk_buff *wimax_msg_alloc(struct wimax_dev *wimax_dev, } result = nla_put(skb, WIMAX_GNL_MSG_DATA, size, msg); if (result < 0) { - dev_err(dev, "no memory to add payload (msg %p size %zu) in " - "attribute: %d\n", msg, size, result); + dev_err(dev, "no memory to add payload (msg %p size %zu) in attribute: %d\n", + msg, size, result); goto error_nla_put; } genlmsg_end(skb, genl_msg); @@ -260,6 +260,7 @@ int wimax_msg_send(struct wimax_dev *wimax_dev, struct sk_buff *skb) struct device *dev = wimax_dev_to_dev(wimax_dev); void *msg = skb->data; size_t size = skb->len; + might_sleep(); d_printf(1, dev, "CTX: wimax msg, %zu bytes\n", size); @@ -340,8 +341,7 @@ int wimax_gnl_doit_msg_from_user(struct sk_buff *skb, struct genl_info *info) /* Unpack arguments */ result = -EINVAL; if (info->attrs[WIMAX_GNL_MSG_DATA] == NULL) { - dev_err(dev, "WIMAX_GNL_MSG_FROM_USER: can't find MSG_DATA " - "attribute\n"); + dev_err(dev, "WIMAX_GNL_MSG_FROM_USER: can't find MSG_DATA attribute\n"); goto error_no_data; } msg_buf = nla_data(info->attrs[WIMAX_GNL_MSG_DATA]); diff --git a/drivers/staging/wimax/op-rfkill.c b/drivers/staging/wimax/op-rfkill.c index 78b294481a59..52612ed09183 100644 --- a/drivers/staging/wimax/op-rfkill.c +++ b/drivers/staging/wimax/op-rfkill.c @@ -294,7 +294,8 @@ int wimax_rfkill(struct wimax_dev *wimax_dev, enum wimax_rf_state state) /* While initializing, < 1.4.3 wimax-tools versions use * this call to check if the device is a valid WiMAX * device; so we allow it to proceed always, - * considering the radios are all off. */ + * considering the radios are all off. + */ if (result == -ENOMEDIUM && state == WIMAX_RF_QUERY) result = WIMAX_RF_OFF << 1 | WIMAX_RF_OFF; goto error_not_ready; @@ -378,6 +379,7 @@ int wimax_rfkill_add(struct wimax_dev *wimax_dev) void wimax_rfkill_rm(struct wimax_dev *wimax_dev) { struct device *dev = wimax_dev_to_dev(wimax_dev); + d_fnstart(3, dev, "(wimax_dev %p)\n", wimax_dev); rfkill_unregister(wimax_dev->rfkill); rfkill_destroy(wimax_dev->rfkill); @@ -415,8 +417,7 @@ int wimax_gnl_doit_rfkill(struct sk_buff *skb, struct genl_info *info) dev = wimax_dev_to_dev(wimax_dev); result = -EINVAL; if (info->attrs[WIMAX_GNL_RFKILL_STATE] == NULL) { - dev_err(dev, "WIMAX_GNL_RFKILL: can't find RFKILL_STATE " - "attribute\n"); + dev_err(dev, "WIMAX_GNL_RFKILL: can't find RFKILL_STATE attribute\n"); goto error_no_pid; } new_state = nla_get_u32(info->attrs[WIMAX_GNL_RFKILL_STATE]); diff --git a/drivers/staging/wimax/stack.c b/drivers/staging/wimax/stack.c index ace24a6dfd2d..e44158334246 100644 --- a/drivers/staging/wimax/stack.c +++ b/drivers/staging/wimax/stack.c @@ -51,9 +51,7 @@ static char wimax_debug_params[128]; module_param_string(debug, wimax_debug_params, sizeof(wimax_debug_params), 0644); MODULE_PARM_DESC(debug, - "String of space-separated NAME:VALUE pairs, where NAMEs " - "are the different debug submodules and VALUE are the " - "initial debug value to set."); + "String of space-separated NAME:VALUE pairs, where NAMEs are the different debug submodules and VALUE are the initial debug value to set."); /* * Authoritative source for the RE_STATE_CHANGE attribute policy @@ -62,7 +60,7 @@ MODULE_PARM_DESC(debug, * close to where the data is generated. */ /* -static const struct nla_policy wimax_gnl_re_status_change[WIMAX_GNL_ATTR_MAX + 1] = { + * static const struct nla_policy wimax_gnl_re_status_change[WIMAX_GNL_ATTR_MAX + 1] = { [WIMAX_GNL_STCH_STATE_OLD] = { .type = NLA_U8 }, [WIMAX_GNL_STCH_STATE_NEW] = { .type = NLA_U8 }, }; @@ -156,6 +154,7 @@ int wimax_gnl_re_state_change_send( { int result = 0; struct device *dev = wimax_dev_to_dev(wimax_dev); + d_fnstart(3, dev, "(wimax_dev %p report_skb %p)\n", wimax_dev, report_skb); if (report_skb == NULL) { @@ -275,8 +274,8 @@ void __wimax_state_change(struct wimax_dev *wimax_dev, enum wimax_st new_state) /* Execute the actions of entry to the new state */ switch (new_state) { case __WIMAX_ST_NULL: - dev_err(dev, "SW BUG: wimax_dev %p entering NULL state " - "from %u\n", wimax_dev, wimax_dev->state); + dev_err(dev, "SW BUG: wimax_dev %p entering NULL state from %u\n", + wimax_dev, wimax_dev->state); WARN_ON(1); /* Nobody can enter this state */ break; case WIMAX_ST_DOWN: @@ -362,6 +361,7 @@ EXPORT_SYMBOL_GPL(wimax_state_change); enum wimax_st wimax_state_get(struct wimax_dev *wimax_dev) { enum wimax_st state; + mutex_lock(&wimax_dev->mutex); state = wimax_dev->state; mutex_unlock(&wimax_dev->mutex); -- 2.11.0 From gregkh at linuxfoundation.org Tue Mar 2 09:29:13 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 2 Mar 2021 10:29:13 +0100 Subject: [PATCH] wimax: attempt to address style issues. In-Reply-To: <20210302091102.1598-1-gabriele.modena@gmail.com> References: <20210302091102.1598-1-gabriele.modena@gmail.com> Message-ID: On Tue, Mar 02, 2021 at 10:11:02AM +0100, gabriele.modena at gmail.com wrote: > From: Gabriele Modena > > When running checkpatch.pl on op-msg.c, op-rfkill.c > and stack.c I noticed that they contained a few style issues > at warning level of severity. This patch is both an attempt to > address the warnings, as well as a way for me to familiarise > with the linux kernel contribution process, by following > tasks proposed by a popular online challenge. > > Signed-off-by: Gabriele Modena > --- > drivers/staging/wimax/op-msg.c | 8 ++++---- > drivers/staging/wimax/op-rfkill.c | 7 ++++--- > drivers/staging/wimax/stack.c | 12 ++++++------ > 3 files changed, 14 insertions(+), 13 deletions(-) > > diff --git a/drivers/staging/wimax/op-msg.c b/drivers/staging/wimax/op-msg.c > index e20ac7d84e82..11da48bf704f 100644 > --- a/drivers/staging/wimax/op-msg.c > +++ b/drivers/staging/wimax/op-msg.c > @@ -142,8 +142,8 @@ struct sk_buff *wimax_msg_alloc(struct wimax_dev *wimax_dev, > } > result = nla_put(skb, WIMAX_GNL_MSG_DATA, size, msg); > if (result < 0) { > - dev_err(dev, "no memory to add payload (msg %p size %zu) in " > - "attribute: %d\n", msg, size, result); > + dev_err(dev, "no memory to add payload (msg %p size %zu) in attribute: %d\n", > + msg, size, result); > goto error_nla_put; > } > genlmsg_end(skb, genl_msg); > @@ -260,6 +260,7 @@ int wimax_msg_send(struct wimax_dev *wimax_dev, struct sk_buff *skb) > struct device *dev = wimax_dev_to_dev(wimax_dev); > void *msg = skb->data; > size_t size = skb->len; > + > might_sleep(); > > d_printf(1, dev, "CTX: wimax msg, %zu bytes\n", size); > @@ -340,8 +341,7 @@ int wimax_gnl_doit_msg_from_user(struct sk_buff *skb, struct genl_info *info) > /* Unpack arguments */ > result = -EINVAL; > if (info->attrs[WIMAX_GNL_MSG_DATA] == NULL) { > - dev_err(dev, "WIMAX_GNL_MSG_FROM_USER: can't find MSG_DATA " > - "attribute\n"); > + dev_err(dev, "WIMAX_GNL_MSG_FROM_USER: can't find MSG_DATA attribute\n"); > goto error_no_data; > } > msg_buf = nla_data(info->attrs[WIMAX_GNL_MSG_DATA]); > diff --git a/drivers/staging/wimax/op-rfkill.c b/drivers/staging/wimax/op-rfkill.c > index 78b294481a59..52612ed09183 100644 > --- a/drivers/staging/wimax/op-rfkill.c > +++ b/drivers/staging/wimax/op-rfkill.c > @@ -294,7 +294,8 @@ int wimax_rfkill(struct wimax_dev *wimax_dev, enum wimax_rf_state state) > /* While initializing, < 1.4.3 wimax-tools versions use > * this call to check if the device is a valid WiMAX > * device; so we allow it to proceed always, > - * considering the radios are all off. */ > + * considering the radios are all off. > + */ > if (result == -ENOMEDIUM && state == WIMAX_RF_QUERY) > result = WIMAX_RF_OFF << 1 | WIMAX_RF_OFF; > goto error_not_ready; > @@ -378,6 +379,7 @@ int wimax_rfkill_add(struct wimax_dev *wimax_dev) > void wimax_rfkill_rm(struct wimax_dev *wimax_dev) > { > struct device *dev = wimax_dev_to_dev(wimax_dev); > + > d_fnstart(3, dev, "(wimax_dev %p)\n", wimax_dev); > rfkill_unregister(wimax_dev->rfkill); > rfkill_destroy(wimax_dev->rfkill); > @@ -415,8 +417,7 @@ int wimax_gnl_doit_rfkill(struct sk_buff *skb, struct genl_info *info) > dev = wimax_dev_to_dev(wimax_dev); > result = -EINVAL; > if (info->attrs[WIMAX_GNL_RFKILL_STATE] == NULL) { > - dev_err(dev, "WIMAX_GNL_RFKILL: can't find RFKILL_STATE " > - "attribute\n"); > + dev_err(dev, "WIMAX_GNL_RFKILL: can't find RFKILL_STATE attribute\n"); > goto error_no_pid; > } > new_state = nla_get_u32(info->attrs[WIMAX_GNL_RFKILL_STATE]); > diff --git a/drivers/staging/wimax/stack.c b/drivers/staging/wimax/stack.c > index ace24a6dfd2d..e44158334246 100644 > --- a/drivers/staging/wimax/stack.c > +++ b/drivers/staging/wimax/stack.c > @@ -51,9 +51,7 @@ static char wimax_debug_params[128]; > module_param_string(debug, wimax_debug_params, sizeof(wimax_debug_params), > 0644); > MODULE_PARM_DESC(debug, > - "String of space-separated NAME:VALUE pairs, where NAMEs " > - "are the different debug submodules and VALUE are the " > - "initial debug value to set."); > + "String of space-separated NAME:VALUE pairs, where NAMEs are the different debug submodules and VALUE are the initial debug value to set."); > > /* > * Authoritative source for the RE_STATE_CHANGE attribute policy > @@ -62,7 +60,7 @@ MODULE_PARM_DESC(debug, > * close to where the data is generated. > */ > /* > -static const struct nla_policy wimax_gnl_re_status_change[WIMAX_GNL_ATTR_MAX + 1] = { > + * static const struct nla_policy wimax_gnl_re_status_change[WIMAX_GNL_ATTR_MAX + 1] = { > [WIMAX_GNL_STCH_STATE_OLD] = { .type = NLA_U8 }, > [WIMAX_GNL_STCH_STATE_NEW] = { .type = NLA_U8 }, > }; > @@ -156,6 +154,7 @@ int wimax_gnl_re_state_change_send( > { > int result = 0; > struct device *dev = wimax_dev_to_dev(wimax_dev); > + > d_fnstart(3, dev, "(wimax_dev %p report_skb %p)\n", > wimax_dev, report_skb); > if (report_skb == NULL) { > @@ -275,8 +274,8 @@ void __wimax_state_change(struct wimax_dev *wimax_dev, enum wimax_st new_state) > /* Execute the actions of entry to the new state */ > switch (new_state) { > case __WIMAX_ST_NULL: > - dev_err(dev, "SW BUG: wimax_dev %p entering NULL state " > - "from %u\n", wimax_dev, wimax_dev->state); > + dev_err(dev, "SW BUG: wimax_dev %p entering NULL state from %u\n", > + wimax_dev, wimax_dev->state); > WARN_ON(1); /* Nobody can enter this state */ > break; > case WIMAX_ST_DOWN: > @@ -362,6 +361,7 @@ EXPORT_SYMBOL_GPL(wimax_state_change); > enum wimax_st wimax_state_get(struct wimax_dev *wimax_dev) > { > enum wimax_st state; > + > mutex_lock(&wimax_dev->mutex); > state = wimax_dev->state; > mutex_unlock(&wimax_dev->mutex); > -- > 2.11.0 > > _______________________________________________ > devel mailing list > devel at linuxdriverproject.org > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - Your patch did many different things all at once, making it difficult to review. All Linux kernel patches need to only do one thing at a time. If you need to do multiple things (such as clean up all coding style issues in a file/driver), do it in a sequence of patches, each one doing only one thing. This will make it easier to review the patches to ensure that they are correct, and to help alleviate any merge issues that larger patches can cause. - You did not write a descriptive Subject: for the patch, allowing Greg, and everyone else, to know what this patch is all about. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what a proper Subject: line should look like. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot From sergio.paracuellos at gmail.com Tue Mar 2 10:54:12 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Tue, 2 Mar 2021 11:54:12 +0100 Subject: [PATCH] phy: ralink: phy-mt7621-pci: fix XTAL bitmask Message-ID: <20210302105412.16221-1-sergio.paracuellos@gmail.com> When this was rewriten to get mainlined and start to use 'linux/bitfield.h' headers, XTAL_MASK was wrong. It must mask three bits but only two were used. Hence properly fix it to make things work. Fixes: d87da32372a0 ("phy: ralink: Add PHY driver for MT7621 PCIe PHY") Signed-off-by: Sergio Paracuellos --- drivers/phy/ralink/phy-mt7621-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/ralink/phy-mt7621-pci.c b/drivers/phy/ralink/phy-mt7621-pci.c index 9a610b414b1f..84ee2b5c2228 100644 --- a/drivers/phy/ralink/phy-mt7621-pci.c +++ b/drivers/phy/ralink/phy-mt7621-pci.c @@ -62,7 +62,7 @@ #define RG_PE1_FRC_MSTCKDIV BIT(5) -#define XTAL_MASK GENMASK(7, 6) +#define XTAL_MASK GENMASK(8, 6) #define MAX_PHYS 2 -- 2.25.1 From dan.carpenter at oracle.com Tue Mar 2 11:19:39 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Tue, 2 Mar 2021 14:19:39 +0300 Subject: [PATCH] staging: ks7010: prevent buffer overflow in ks_wlan_set_scan() Message-ID: The user can specify a "req->essid_len" of up to 255 but if it's over IW_ESSID_MAX_SIZE (32) that can lead to memory corruption. Fixes: 13a9930d15b4 ("staging: ks7010: add driver from Nanonote extra-repository") Signed-off-by: Dan Carpenter --- drivers/staging/ks7010/ks_wlan_net.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index dc09cc6e1c47..09e7b4cd0138 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -1120,6 +1120,7 @@ static int ks_wlan_set_scan(struct net_device *dev, { struct ks_wlan_private *priv = netdev_priv(dev); struct iw_scan_req *req = NULL; + int len; if (priv->sleep_mode == SLP_SLEEP) return -EPERM; @@ -1129,8 +1130,9 @@ static int ks_wlan_set_scan(struct net_device *dev, if (wrqu->data.length == sizeof(struct iw_scan_req) && wrqu->data.flags & IW_SCAN_THIS_ESSID) { req = (struct iw_scan_req *)extra; - priv->scan_ssid_len = req->essid_len; - memcpy(priv->scan_ssid, req->essid, priv->scan_ssid_len); + len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE); + priv->scan_ssid_len = len; + memcpy(priv->scan_ssid, req->essid, len); } else { priv->scan_ssid_len = 0; } -- 2.30.1 From vkoul at kernel.org Tue Mar 2 12:28:44 2021 From: vkoul at kernel.org (Vinod Koul) Date: Tue, 2 Mar 2021 17:58:44 +0530 Subject: [PATCH] phy: ralink: phy-mt7621-pci: fix XTAL bitmask In-Reply-To: <20210302105412.16221-1-sergio.paracuellos@gmail.com> References: <20210302105412.16221-1-sergio.paracuellos@gmail.com> Message-ID: On 02-03-21, 11:54, Sergio Paracuellos wrote: > When this was rewriten to get mainlined and start to > use 'linux/bitfield.h' headers, XTAL_MASK was wrong. > It must mask three bits but only two were used. Hence > properly fix it to make things work. Applied, thanks -- ~Vinod From gregkh at linuxfoundation.org Tue Mar 2 12:53:57 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 2 Mar 2021 13:53:57 +0100 Subject: [PATCH] This patch fixes the check-patch errors In-Reply-To: <20210302124254.GA2349431@vijayakumar> References: <20210302124254.GA2349431@vijayakumar> Message-ID: On Tue, Mar 02, 2021 at 06:12:54PM +0530, Vikas Kumar Sharma wrote: > Disclaimer:This message is intended only for the designated recipient(s). > It may contain confidential or proprietary information and may be subject > to other confidentiality protections. If you are not a designated > recipient, you may not review, copy or distribute this message. Please > notify the sender by e-mail and delete this message. GlobalEdge does not > accept any liability for virus infected mails. Email is now deleted, sorry, this does not belong on any emails sent to public mailing lists for kernel development efforts. From ks.vikas at globaledgesoft.com Tue Mar 2 12:42:54 2021 From: ks.vikas at globaledgesoft.com (Vikas Kumar Sharma) Date: Tue, 2 Mar 2021 18:12:54 +0530 Subject: [PATCH] This patch fixes the check-patch errors Message-ID: <20210302124254.GA2349431@vijayakumar> ERROR: Macros with complex values should be enclosed in parentheses. Signed-off-by: Vikas Kumar Sharma --- drivers/staging/ks7010/ks_hostif.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 39138191a556..c62a494ed6bb 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -498,20 +498,20 @@ struct hostif_mic_failure_request { #define TX_RATE_FIXED 5 /* 11b rate */ -#define TX_RATE_1M (u8)(10 / 5) /* 11b 11g basic rate */ -#define TX_RATE_2M (u8)(20 / 5) /* 11b 11g basic rate */ -#define TX_RATE_5M (u8)(55 / 5) /* 11g basic rate */ -#define TX_RATE_11M (u8)(110 / 5) /* 11g basic rate */ +#define TX_RATE_1M ((u8)(10 / 5)) /* 11b 11g basic rate */ +#define TX_RATE_2M ((u8)(20 / 5)) /* 11b 11g basic rate */ +#define TX_RATE_5M ((u8)(55 / 5)) /* 11g basic rate */ +#define TX_RATE_11M ((u8)(110 / 5)) /* 11g basic rate */ /* 11g rate */ -#define TX_RATE_6M (u8)(60 / 5) /* 11g basic rate */ -#define TX_RATE_12M (u8)(120 / 5) /* 11g basic rate */ -#define TX_RATE_24M (u8)(240 / 5) /* 11g basic rate */ -#define TX_RATE_9M (u8)(90 / 5) -#define TX_RATE_18M (u8)(180 / 5) -#define TX_RATE_36M (u8)(360 / 5) -#define TX_RATE_48M (u8)(480 / 5) -#define TX_RATE_54M (u8)(540 / 5) +#define TX_RATE_6M ((u8)(60 / 5)) /* 11g basic rate */ +#define TX_RATE_12M ((u8)(120 / 5)) /* 11g basic rate */ +#define TX_RATE_24M ((u8)(240 / 5)) /* 11g basic rate */ +#define TX_RATE_9M ((u8)(90 / 5)) +#define TX_RATE_18M ((u8)(180 / 5)) +#define TX_RATE_36M ((u8)(360 / 5)) +#define TX_RATE_48M ((u8)(480 / 5)) +#define TX_RATE_54M ((u8)(540 / 5)) static inline bool is_11b_rate(u8 rate) { -- 2.25.1 -- Disclaimer:This message is intended only for the designated recipient(s). It may contain confidential or proprietary information and may be subject to other confidentiality protections. If you are not a designated recipient, you may not review, copy or distribute this message. Please notify the sender by e-mail and delete this message. GlobalEdge does not accept any liability for virus infected mails. From knv418 at gmail.com Tue Mar 2 13:32:17 2021 From: knv418 at gmail.com (Nikolay Kyx) Date: Tue, 2 Mar 2021 16:32:17 +0300 Subject: [PATCH] staging: rtl8192e: remove redundant variable shadowing Message-ID: <20210302133217.145994-1-knv418@gmail.com> In function rtl92e_start_adapter() automatic variable 'i' referenced only within certain loops, used as iteration counter. Control flow can't get into such loop w/o 'i = 0' assignment. It's redundant to shadow this variable by creating scope around loop. This patch fixes the following sparse warning: warning: symbol 'i' shadows an earlier one Signed-off-by: Nikolay Kyx --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index ff843d7ec606..8cd085ebea81 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -800,12 +800,10 @@ bool rtl92e_start_adapter(struct net_device *dev) } rtl92e_writew(dev, ATIMWND, 2); rtl92e_writew(dev, BCN_INTERVAL, 100); - { - int i; - for (i = 0; i < QOS_QUEUE_NUM; i++) - rtl92e_writel(dev, WDCAPARA_ADD[i], 0x005e4332); - } + for (i = 0; i < QOS_QUEUE_NUM; i++) + rtl92e_writel(dev, WDCAPARA_ADD[i], 0x005e4332); + rtl92e_writeb(dev, 0xbe, 0xc0); rtl92e_config_mac(dev); -- 2.30.1 From gregkh at linuxfoundation.org Tue Mar 2 14:18:01 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 2 Mar 2021 15:18:01 +0100 Subject: [PATCH] staging: rtl8192u avoid flex array of flex array In-Reply-To: <20210228010614.162998-1-dagostinelli@gmail.com> References: <20210228010614.162998-1-dagostinelli@gmail.com> Message-ID: On Sat, Feb 27, 2021 at 07:06:14PM -0600, Darryl T. Agostinelli wrote: > Undo the flex array in struct ieee80211_info_element. It is used as the flex > array type in other structs (creating a flex array of flex arrays) making > sparse unhappy. This change maintains the intent of the code and satisfies > sparse. We have been trying to convert the kernel to use the [] style over time, please don't move backwards on this. There are loads of commits by Gustavo in the tree that show this work. thanks, greg k-h From gregkh at linuxfoundation.org Tue Mar 2 14:38:52 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 2 Mar 2021 15:38:52 +0100 Subject: [PATCH 2/2] staging: rtl8192e: Change state information from u16 to u8 In-Reply-To: <20210222172330.GA2507@atulu-ubuntu> References: <20210220182154.9457-1-atulgopinathan@gmail.com> <20210220182154.9457-2-atulgopinathan@gmail.com> <20210221165721.GA10040@atulu-nitro> <20210222172330.GA2507@atulu-ubuntu> Message-ID: On Mon, Feb 22, 2021 at 10:53:30PM +0530, Atul Gopinathan wrote: > On Mon, Feb 22, 2021 at 04:26:33PM +0100, Greg KH wrote: > > On Sun, Feb 21, 2021 at 10:27:21PM +0530, Atul Gopinathan wrote: > > > On Sun, Feb 21, 2021 at 02:08:26PM +0100, Greg KH wrote: > > > > On Sat, Feb 20, 2021 at 11:51:55PM +0530, Atul Gopinathan wrote: > > > > > The "CcxRmState" field in struct "rtllib_network" is defined > > > > > as a u16 array of size 2 (so, 4 bytes in total). > > > > > > > > > > But the operations performed on this array throughout the code > > > > > base (in rtl8192e/) are all in byte size 2 indicating that this > > > > > array's type was defined wrongly. > > > > > > > > > > There are two situation were u16 type of this field could yield > > > > > incorrect behaviour: > > > > > > > > > > 1. In rtllib_rx.c:1970: > > > > > memcpy(network->CcxRmState, &info_element->data[4], 2); > > > > > > > > > > Here last 2 bytes (index 4 and 5) from the info_element->data[] > > > > > array are meant to be copied into CcxRmState[]. > > > > > Note that "data" array here is an array of type u8. > > > > > > > > > > 2. In function "update_network()" in staging/rtl8192e/rtllib_rx.c: > > > > > memcpy(dst->CcxRmState, src->CcxRmState, 2); > > > > > > > > > > Here again, only 2 bytes are copied from the source state to > > > > > destination state. > > > > > > > > > > There are no instances of "CcxRmState" requiring u16 data type. > > > > > Here is the output of "grep -IRn 'CcxRmState'" on the rtl8192e/ > > > > > directory for reviewing: > > > > > > > > > > rtllib_rx.c:1970: memcpy(network->CcxRmState, &info_element->data[4], 2); > > > > > rtllib_rx.c:1971: if (network->CcxRmState[0] != 0) > > > > > rtllib_rx.c:1975: network->MBssidMask = network->CcxRmState[1] & 0x07; > > > > > rtllib_rx.c:2520: memcpy(dst->CcxRmState, src->CcxRmState, 2); > > > > > rtllib.h:1108: u8 CcxRmState[2]; > > > > > > > > You just changed the logic in line 1975 in that file, right? Are you > > > > _SURE_ that is ok? Do you have a device to test this on? > > > > > > I'm sorry, I didn't quite get you. By line 1975 in rtllib_rx.c, did you mean > > > the following line?: > > > > > > network->MBssidMask = network->CcxRmState[1] & 0x07; > > > > Yes. > > > > > network->CcxRmState is being fed with 2 bytes of u8 data, in line 1970 (as > > > seen above). I believe my patch doesn't change the logic of an "&" operation > > > being performed on it with 0x07, right? > > > > It changes the location of the [1] operation to point to a different > > place in memory from what I can tell, as you changed the type of that > > array. > > Oh yes, earlier, the network->CcxRmState[] array had memory locations as: > [x, x+16]. With this patch, it's locations are [x, x+8]. > > And I strongly believe this is how it should be based on how the original > author is using the CcxRmState[] array throughout the codebase: Ok, but this has changed the way memory is addressed, which is what I was trying to point out when you said that nothing had changed. > Allow me to explain (Based on the output of "grep -IRn 'CcxRmState'" that > I sent previously): > 1. At line 1970: > > memcpy(network->CcxRmState, &info_element->data[4], 2); > > this is where the array CcxRmState[] is being fed with > data. And one can see the source is an array named "data" which itself > has type u8. The third argument is "2", meaning 2 bytes of data should > be written from "data" array to "CcxRmState". > > Also note that, the array CcxRmState has a size 2, as defined in > rtllib.h, in struct "rtllib_network": > > u16 CcxRmState[2]; > > Say if CcxRmState[] _was_ supposed to be u16 and not u8, then both elements > of the source "data" array will only be written into the first element of > "CcxRmState", i.e, "CcxRmState[0]". The 2nd element, "CcxRmState[1]" will > never be fed with any data. The resultant CcxRmState[] array would look > something like this: > > [(u8-data and u8-data squashed), 0]. > > The 2 u8-data here refers to info_element->data[4] and > info_element->data[5]. > > Instead, if "CcxRmState" was of type u8, then both elements of source > "data" array will be written into the 2 elements of "CcxRmState" > respectively: > > [u8 data, u8 data] > > This makes a lot more sense. > > 2. Line 1975: > network->MBssidMask = network->CcxRmState[1] & 0x07; > > With point 1 clear, it should now be easy to understand that > the the "&" operation in line 1975, will _always_ yield 0 if "CcxRmState" > is u16, simply because CcxRmState[1] is never fed with any data at > all. > > Oh and "network->MBssidMask" is also of type u8. > > 3. Line 2520: > memcpy(dst->CcxRmState, src->CcxRmState, 2); > > 2 bytes, and not 4, again.:D > The above line belongs to the following function: > > static inline void update_network(struct rtllib_device *ieee, > struct rtllib_network *dst, > struct rtllib_network *src) > > As you can see, there is "dst" destination and a "src" source. The author > is essentially copying all the data from "src" to "dst" in this function. > Throughout the function, "memcpy()" is being used several times to copy > the data of all arrays/structs existing in "src" into "dst". In each > of those instances, the author is making sure to copy the entirety of > the respective struct/array by passing all used up size of the struct/ > array in the third, size, argument. Here are a few lines from that > function (posting the entire function defintion would be inappropriate) > > instance 1: memcpy(dst->hidden_ssid, src->ssid, src->ssid_len); > instance 2: memcpy(&dst->stats, &src->stats, sizeof(struct rtllib_rx_stats)); > instance 3: memcpy(&dst->tim, &src->tim, sizeof(struct rtllib_tim_parameters)); > instance 4: memcpy(dst->wzc_ie, src->wzc_ie, src->wzc_ie_len); > > There are a LOT more instances, here is the elixir link to that > function for a quick reference: > https://elixir.bootlin.com/linux/v5.11/source/drivers/staging/rtl8192e/rtllib_rx.c#L2420 > > My point is, it's clear that the intent of this function is to duplicate > the data of src into dst. If "CcxRmState" really is supposed to be u16, > then why only write down the first 2 bytes into "dst->CcxRmState"? > > What about "dst->CcxRmState[1]"? It never gets any value, again. > > These are the only places where CcxRmState is being used in the entire > rtl8192e driver directory. I skipped line 1971 as it just checks whether > "CcxRmState[0]" is 0 or not, this should not require any explanation. Ok, can you provide more information in the changelog text and resend the commit so that it is easier to understand why you feel this change is ok? thanks, greg k-h From perrinjamessmith at gmail.com Tue Mar 2 15:29:03 2021 From: perrinjamessmith at gmail.com (Perrin Smith) Date: Tue, 2 Mar 2021 23:29:03 +0800 Subject: [PATCH] staging: rtl8192e: remove unnecessary break Message-ID: <20210302152903.2930-1-perrinjemessmith@gmail.com> From: Perrin Smith removed unnecessary break at end of while loop Signed-off-by: Perrin Smith --- drivers/staging/rtl8192e/rtllib_rx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index b8ab34250e6a..2de6330b7737 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -460,8 +460,6 @@ static bool AddReorderEntry(struct rx_ts_record *pTS, ((struct rx_reorder_entry *)list_entry(pList->next, struct rx_reorder_entry, List))->SeqNum)) return false; - else - break; } pReorderEntry->List.next = pList->next; pReorderEntry->List.next->prev = &pReorderEntry->List; -- 2.26.2 From dan.carpenter at oracle.com Tue Mar 2 16:24:18 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Tue, 2 Mar 2021 19:24:18 +0300 Subject: [PATCH] staging: rtl8192e: remove unnecessary break In-Reply-To: <20210302152903.2930-1-perrinjemessmith@gmail.com> References: <20210302152903.2930-1-perrinjemessmith@gmail.com> Message-ID: <20210302162417.GU2087@kadam> On Tue, Mar 02, 2021 at 11:29:03PM +0800, Perrin Smith wrote: > From: Perrin Smith > > removed unnecessary break at end of while loop > > Signed-off-by: Perrin Smith > --- > drivers/staging/rtl8192e/rtllib_rx.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c > index b8ab34250e6a..2de6330b7737 100644 > --- a/drivers/staging/rtl8192e/rtllib_rx.c > +++ b/drivers/staging/rtl8192e/rtllib_rx.c > @@ -460,8 +460,6 @@ static bool AddReorderEntry(struct rx_ts_record *pTS, > ((struct rx_reorder_entry *)list_entry(pList->next, > struct rx_reorder_entry, List))->SeqNum)) > return false; > - else > - break; No, this break is necessary. The patch introduces a bug. You need to be careful following checkpatch's advice because it's just a simple Perl script. > } regards, dan carpenter From atulgopinathan at gmail.com Tue Mar 2 16:53:10 2021 From: atulgopinathan at gmail.com (Atul Gopinathan) Date: Tue, 2 Mar 2021 22:23:10 +0530 Subject: [PATCH 2/2] staging: rtl8192e: Change state information from u16 to u8 In-Reply-To: References: <20210220182154.9457-1-atulgopinathan@gmail.com> <20210220182154.9457-2-atulgopinathan@gmail.com> <20210221165721.GA10040@atulu-nitro> <20210222172330.GA2507@atulu-ubuntu> Message-ID: <20210302165310.GA3493@atulu-nitro> On Tue, Mar 02, 2021 at 03:38:52PM +0100, Greg KH wrote: > On Mon, Feb 22, 2021 at 10:53:30PM +0530, Atul Gopinathan wrote: > > On Mon, Feb 22, 2021 at 04:26:33PM +0100, Greg KH wrote: > > > On Sun, Feb 21, 2021 at 10:27:21PM +0530, Atul Gopinathan wrote: > > > > On Sun, Feb 21, 2021 at 02:08:26PM +0100, Greg KH wrote: > > > > > On Sat, Feb 20, 2021 at 11:51:55PM +0530, Atul Gopinathan wrote: > > > > > > The "CcxRmState" field in struct "rtllib_network" is defined > > > > > > as a u16 array of size 2 (so, 4 bytes in total). > > > > > > > > > > > > But the operations performed on this array throughout the code > > > > > > base (in rtl8192e/) are all in byte size 2 indicating that this > > > > > > array's type was defined wrongly. > > > > > > > > > > > > There are two situation were u16 type of this field could yield > > > > > > incorrect behaviour: > > > > > > > > > > > > 1. In rtllib_rx.c:1970: > > > > > > memcpy(network->CcxRmState, &info_element->data[4], 2); > > > > > > > > > > > > Here last 2 bytes (index 4 and 5) from the info_element->data[] > > > > > > array are meant to be copied into CcxRmState[]. > > > > > > Note that "data" array here is an array of type u8. > > > > > > > > > > > > 2. In function "update_network()" in staging/rtl8192e/rtllib_rx.c: > > > > > > memcpy(dst->CcxRmState, src->CcxRmState, 2); > > > > > > > > > > > > Here again, only 2 bytes are copied from the source state to > > > > > > destination state. > > > > > > > > > > > > There are no instances of "CcxRmState" requiring u16 data type. > > > > > > Here is the output of "grep -IRn 'CcxRmState'" on the rtl8192e/ > > > > > > directory for reviewing: > > > > > > > > > > > > rtllib_rx.c:1970: memcpy(network->CcxRmState, &info_element->data[4], 2); > > > > > > rtllib_rx.c:1971: if (network->CcxRmState[0] != 0) > > > > > > rtllib_rx.c:1975: network->MBssidMask = network->CcxRmState[1] & 0x07; > > > > > > rtllib_rx.c:2520: memcpy(dst->CcxRmState, src->CcxRmState, 2); > > > > > > rtllib.h:1108: u8 CcxRmState[2]; > > > > > > > > > > You just changed the logic in line 1975 in that file, right? Are you > > > > > _SURE_ that is ok? Do you have a device to test this on? > > > > > > > > I'm sorry, I didn't quite get you. By line 1975 in rtllib_rx.c, did you mean > > > > the following line?: > > > > > > > > network->MBssidMask = network->CcxRmState[1] & 0x07; > > > > > > Yes. > > > > > > > network->CcxRmState is being fed with 2 bytes of u8 data, in line 1970 (as > > > > seen above). I believe my patch doesn't change the logic of an "&" operation > > > > being performed on it with 0x07, right? > > > > > > It changes the location of the [1] operation to point to a different > > > place in memory from what I can tell, as you changed the type of that > > > array. > > > > Oh yes, earlier, the network->CcxRmState[] array had memory locations as: > > [x, x+16]. With this patch, it's locations are [x, x+8]. > > > > And I strongly believe this is how it should be based on how the original > > author is using the CcxRmState[] array throughout the codebase: > > Ok, but this has changed the way memory is addressed, which is what I > was trying to point out when you said that nothing had changed. Ah sorry about that, It just wasn't clear to me what you meant and my mind was too fixated on the "&" operation. > > > Allow me to explain (Based on the output of "grep -IRn 'CcxRmState'" that > > I sent previously): > > 1. At line 1970: > > > > memcpy(network->CcxRmState, &info_element->data[4], 2); > > > > this is where the array CcxRmState[] is being fed with > > data. And one can see the source is an array named "data" which itself > > has type u8. The third argument is "2", meaning 2 bytes of data should > > be written from "data" array to "CcxRmState". > > > > Also note that, the array CcxRmState has a size 2, as defined in > > rtllib.h, in struct "rtllib_network": > > > > u16 CcxRmState[2]; > > > > Say if CcxRmState[] _was_ supposed to be u16 and not u8, then both elements > > of the source "data" array will only be written into the first element of > > "CcxRmState", i.e, "CcxRmState[0]". The 2nd element, "CcxRmState[1]" will > > never be fed with any data. The resultant CcxRmState[] array would look > > something like this: > > > > [(u8-data and u8-data squashed), 0]. > > > > The 2 u8-data here refers to info_element->data[4] and > > info_element->data[5]. > > > > Instead, if "CcxRmState" was of type u8, then both elements of source > > "data" array will be written into the 2 elements of "CcxRmState" > > respectively: > > > > [u8 data, u8 data] > > > > This makes a lot more sense. > > > > 2. Line 1975: > > network->MBssidMask = network->CcxRmState[1] & 0x07; > > > > With point 1 clear, it should now be easy to understand that > > the the "&" operation in line 1975, will _always_ yield 0 if "CcxRmState" > > is u16, simply because CcxRmState[1] is never fed with any data at > > all. > > > > Oh and "network->MBssidMask" is also of type u8. > > > > 3. Line 2520: > > memcpy(dst->CcxRmState, src->CcxRmState, 2); > > > > 2 bytes, and not 4, again.:D > > The above line belongs to the following function: > > > > static inline void update_network(struct rtllib_device *ieee, > > struct rtllib_network *dst, > > struct rtllib_network *src) > > > > As you can see, there is "dst" destination and a "src" source. The author > > is essentially copying all the data from "src" to "dst" in this function. > > Throughout the function, "memcpy()" is being used several times to copy > > the data of all arrays/structs existing in "src" into "dst". In each > > of those instances, the author is making sure to copy the entirety of > > the respective struct/array by passing all used up size of the struct/ > > array in the third, size, argument. Here are a few lines from that > > function (posting the entire function defintion would be inappropriate) > > > > instance 1: memcpy(dst->hidden_ssid, src->ssid, src->ssid_len); > > instance 2: memcpy(&dst->stats, &src->stats, sizeof(struct rtllib_rx_stats)); > > instance 3: memcpy(&dst->tim, &src->tim, sizeof(struct rtllib_tim_parameters)); > > instance 4: memcpy(dst->wzc_ie, src->wzc_ie, src->wzc_ie_len); > > > > There are a LOT more instances, here is the elixir link to that > > function for a quick reference: > > https://elixir.bootlin.com/linux/v5.11/source/drivers/staging/rtl8192e/rtllib_rx.c#L2420 > > > > My point is, it's clear that the intent of this function is to duplicate > > the data of src into dst. If "CcxRmState" really is supposed to be u16, > > then why only write down the first 2 bytes into "dst->CcxRmState"? > > > > What about "dst->CcxRmState[1]"? It never gets any value, again. > > > > These are the only places where CcxRmState is being used in the entire > > rtl8192e driver directory. I skipped line 1971 as it just checks whether > > "CcxRmState[0]" is 0 or not, this should not require any explanation. > > Ok, can you provide more information in the changelog text and resend > the commit so that it is easier to understand why you feel this change > is ok? Sure! Just a couple of doubts: 1. Do you want me to include all the information I wrote in my previous e-mail into the body of new e-mail? (Is there a limit to how long the body of the mail should be?) 2. I was asked to add the Fixes tag and also tag in -stable in my patch. I had a small confusion with the "Fixes" tag which I asked earlier in the thread but couldn't get it clarified with anyone, so I'll ask again: The previous commit pertaining to the lines I'm modifying is a checkpatch.pl fix (found using simple "git blame"). Should I write _that_ as the Fixes ? Or should I write in the commit id which created that file and hence, that specific line? (which makes more sense.) `git blame -L1960,1980 -- rtllib_rx.c` returns a single commit (80d2579d8608f) which was a checkpatch fix (1970, is the line my patch-1/1 modifies `git log -S'&info_element[4]' -- rtllib_rx.c` returned the commit (94a799425eee8) which created the file (the file which my patch-1/1 modifies) Which one should I write in the Fixes tag? Thanks for the review! Atul From jerome.pouiller at silabs.com Tue Mar 2 15:01:25 2021 From: jerome.pouiller at silabs.com (=?ISO-8859-1?Q?J=E9r=F4me?= Pouiller) Date: Tue, 02 Mar 2021 16:01:25 +0100 Subject: [PATCH] staging: wfx: remove unused included header files In-Reply-To: <20210211143637.GA177425@LEGION> References: <20210211143637.GA177425@LEGION> Message-ID: <1722736.fQpYkz0vEs@pc-42> Hello Muhammad, Sorry, I am a bit late for the review of this patch. Thank you for your contribution. On Thursday 11 February 2021 15:36:37 CET Muhammad Usama Anjum wrote: > > Many header files have been included, but never used. Those header > files have been removed. > > Signed-off-by: Muhammad Usama Anjum > --- > drivers/staging/wfx/bh.c | 1 - > drivers/staging/wfx/bh.h | 4 ---- > drivers/staging/wfx/bus.h | 3 --- > drivers/staging/wfx/bus_sdio.c | 6 ------ > drivers/staging/wfx/bus_spi.c | 7 ------- > drivers/staging/wfx/data_rx.c | 5 ----- > drivers/staging/wfx/data_tx.c | 5 ----- > drivers/staging/wfx/data_tx.h | 3 --- > drivers/staging/wfx/debug.c | 6 ------ > drivers/staging/wfx/fwio.c | 2 -- > drivers/staging/wfx/hif_api_cmd.h | 4 ---- > drivers/staging/wfx/hif_api_general.h | 9 --------- > drivers/staging/wfx/hif_tx.c | 4 ---- > drivers/staging/wfx/hif_tx_mib.c | 5 ----- > drivers/staging/wfx/hwio.c | 3 --- > drivers/staging/wfx/hwio.h | 2 -- > drivers/staging/wfx/key.c | 2 -- > drivers/staging/wfx/key.h | 2 -- > drivers/staging/wfx/main.c | 7 ------- > drivers/staging/wfx/main.h | 3 --- > drivers/staging/wfx/queue.c | 4 ---- > drivers/staging/wfx/queue.h | 3 --- > drivers/staging/wfx/scan.h | 2 -- > drivers/staging/wfx/sta.c | 6 ------ > drivers/staging/wfx/sta.h | 2 -- > drivers/staging/wfx/traces.h | 3 --- > drivers/staging/wfx/wfx.h | 3 --- > 27 files changed, 106 deletions(-) > > diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c > index ed53d0b45592..cd6bcfdfbe9a 100644 > --- a/drivers/staging/wfx/bh.c > +++ b/drivers/staging/wfx/bh.c > @@ -5,7 +5,6 @@ > * Copyright (c) 2017-2020, Silicon Laboratories, Inc. > * Copyright (c) 2010, ST-Ericsson > */ > -#include > #include Though bh.c refers to gpiod_set_value_cansleep() > #include "bh.h" > diff --git a/drivers/staging/wfx/bh.h b/drivers/staging/wfx/bh.h > index 78c49329e22a..92ef3298d4ac 100644 > --- a/drivers/staging/wfx/bh.h > +++ b/drivers/staging/wfx/bh.h > @@ -8,10 +8,6 @@ > #ifndef WFX_BH_H > #define WFX_BH_H > > -#include > -#include > -#include > - > struct wfx_dev; > > struct wfx_hif { Ditto, bh.h refers to atomic_t, struct work_struct and struct completion. If you try to compile bh.h alone (with something like gcc -xc .../bh.h) it won't work. Maybe it works now because we are lucky in the order the headers are included, but I think it is not sufficient. [... same problem repeats multiple times in the following ...] -- J?r?me Pouiller From lkp at intel.com Wed Mar 3 03:01:02 2021 From: lkp at intel.com (kernel test robot) Date: Wed, 03 Mar 2021 11:01:02 +0800 Subject: [staging:staging-linus] BUILD SUCCESS d1a5bd3f875c3a507470ecce1b77e40406e34302 Message-ID: <603efbee.PG3fs14bMt64o/XO%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-linus branch HEAD: d1a5bd3f875c3a507470ecce1b77e40406e34302 staging: comedi: pcl726: Use 16-bit 0 for interrupt data elapsed time: 731m configs tested: 92 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig arm ep93xx_defconfig arm am200epdkit_defconfig powerpc warp_defconfig m68k stmark2_defconfig riscv nommu_k210_defconfig m68k amiga_defconfig powerpc acadia_defconfig mips bigsur_defconfig arm oxnas_v6_defconfig xtensa nommu_kc705_defconfig s390 zfcpdump_defconfig sh rts7751r2d1_defconfig sparc defconfig c6x alldefconfig sh kfr2r09-romimage_defconfig parisc defconfig arm h3600_defconfig arm vexpress_defconfig xtensa iss_defconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig c6x allyesconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig i386 allyesconfig sparc allyesconfig i386 tinyconfig i386 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a005-20210302 i386 randconfig-a003-20210302 i386 randconfig-a002-20210302 i386 randconfig-a004-20210302 i386 randconfig-a006-20210302 i386 randconfig-a001-20210302 i386 randconfig-a016-20210302 i386 randconfig-a012-20210302 i386 randconfig-a014-20210302 i386 randconfig-a013-20210302 i386 randconfig-a011-20210302 i386 randconfig-a015-20210302 x86_64 randconfig-a006-20210302 x86_64 randconfig-a001-20210302 x86_64 randconfig-a004-20210302 x86_64 randconfig-a002-20210302 x86_64 randconfig-a005-20210302 x86_64 randconfig-a003-20210302 riscv allyesconfig riscv nommu_virt_defconfig riscv allnoconfig riscv defconfig riscv rv32_defconfig riscv allmodconfig x86_64 allyesconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a013-20210302 x86_64 randconfig-a016-20210302 x86_64 randconfig-a015-20210302 x86_64 randconfig-a014-20210302 x86_64 randconfig-a012-20210302 x86_64 randconfig-a011-20210302 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From lkp at intel.com Wed Mar 3 03:01:51 2021 From: lkp at intel.com (kernel test robot) Date: Wed, 03 Mar 2021 11:01:51 +0800 Subject: [staging:staging-testing] BUILD SUCCESS 4e1c5d4c35d8d5a5f861019f1392ebaa0abb490b Message-ID: <603efc1f.jcZvV5HgzwJAPQc+%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-testing branch HEAD: 4e1c5d4c35d8d5a5f861019f1392ebaa0abb490b staging: wimax/i2400m: convert __le32 type to host byte-order elapsed time: 731m configs tested: 90 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig arm ep93xx_defconfig arm am200epdkit_defconfig powerpc warp_defconfig m68k stmark2_defconfig mips bigsur_defconfig arm oxnas_v6_defconfig xtensa nommu_kc705_defconfig s390 zfcpdump_defconfig sh rts7751r2d1_defconfig sparc defconfig c6x alldefconfig sh kfr2r09-romimage_defconfig parisc defconfig arm h3600_defconfig arm vexpress_defconfig xtensa iss_defconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig c6x allyesconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig i386 allyesconfig sparc allyesconfig i386 tinyconfig i386 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a005-20210302 i386 randconfig-a003-20210302 i386 randconfig-a002-20210302 i386 randconfig-a004-20210302 i386 randconfig-a006-20210302 i386 randconfig-a001-20210302 i386 randconfig-a016-20210302 i386 randconfig-a012-20210302 i386 randconfig-a014-20210302 i386 randconfig-a013-20210302 i386 randconfig-a011-20210302 i386 randconfig-a015-20210302 x86_64 randconfig-a006-20210302 x86_64 randconfig-a001-20210302 x86_64 randconfig-a004-20210302 x86_64 randconfig-a002-20210302 x86_64 randconfig-a005-20210302 x86_64 randconfig-a003-20210302 riscv nommu_k210_defconfig riscv allyesconfig riscv nommu_virt_defconfig riscv allnoconfig riscv defconfig riscv rv32_defconfig riscv allmodconfig x86_64 allyesconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a013-20210302 x86_64 randconfig-a016-20210302 x86_64 randconfig-a015-20210302 x86_64 randconfig-a014-20210302 x86_64 randconfig-a012-20210302 x86_64 randconfig-a011-20210302 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From klemen.kosir at kream.io Wed Mar 3 09:01:34 2021 From: klemen.kosir at kream.io (=?UTF-8?q?Klemen=20Ko=C5=A1ir?=) Date: Wed, 3 Mar 2021 18:01:34 +0900 Subject: [PATCH] staging: unisys: visornic: Fix repeated words in comments Message-ID: <20210303090134.16007-1-klemen.kosir@kream.io> This patch removes some repeated words in code comments. Signed-off-by: Klemen Ko?ir --- drivers/staging/unisys/visornic/visornic_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 0433536930a9..13e72fbe7bb1 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -534,7 +534,7 @@ static int visornic_disable_with_timeout(struct net_device *netdev, return err; /* wait for ack to arrive before we try to free rcv buffers - * NOTE: the other end automatically unposts the rcv buffers when + * NOTE: the other end automatically unposts the rcv buffers * when it gets a disable. */ spin_lock_irqsave(&devdata->priv_lock, flags); @@ -1750,7 +1750,7 @@ static int visornic_poll(struct napi_struct *napi, int budget) } /* poll_for_irq - checks the status of the response queue - * @t: pointer to the 'struct timer_list' from which we can retrieve the + * @t: pointer to the 'struct timer_list' from which we can retrieve * the visornic devdata struct. * * Main function of the vnic_incoming thread. Periodically check the response -- 2.29.2 From p.zabel at pengutronix.de Wed Mar 3 14:17:53 2021 From: p.zabel at pengutronix.de (Philipp Zabel) Date: Wed, 03 Mar 2021 15:17:53 +0100 Subject: [PATCH v3 0/5] Reset driver for IMX8MQ VPU hardware block In-Reply-To: <20210301151754.104749-1-benjamin.gaignard@collabora.com> References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> Message-ID: Hi Benjamin, On Mon, 2021-03-01 at 16:17 +0100, Benjamin Gaignard wrote: > The two VPUs inside IMX8MQ share the same control block which can be see > as a reset hardware block. This isn't a reset controller though. The control block also contains clock gates of some sort and a filter register for the featureset fuses. Those shouldn't be manipulated via the reset API. > In order to be able to add the second VPU (for HECV decoding) it will be > more handy if the both VPU drivers instance don't have to share the > control block registers. This lead to implement it as an independ reset > driver and to change the VPU driver to use it. Why not switch to a syscon regmap for the control block? That should also allow to keep backwards compatibility with the old binding with minimal effort. > Please note that this series break the compatibility between the DTB and > kernel. This break is limited to IMX8MQ SoC and is done when the driver > is still in staging directory. I know in this case we are pretty sure there are no users of this binding except for a staging driver, but it would still be nice to keep support for the deprecated binding, to avoid the requirement of updating kernel and DT in lock-step. regards Philipp From p.zabel at pengutronix.de Wed Mar 3 14:33:28 2021 From: p.zabel at pengutronix.de (Philipp Zabel) Date: Wed, 03 Mar 2021 15:33:28 +0100 Subject: [PATCH v3 3/5] reset: Add reset driver for IMX8MQ VPU block In-Reply-To: <20210301151754.104749-4-benjamin.gaignard@collabora.com> References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> <20210301151754.104749-4-benjamin.gaignard@collabora.com> Message-ID: <38119c7bab7b550cff0300b596611a7d9d3b6737.camel@pengutronix.de> On Mon, 2021-03-01 at 16:17 +0100, Benjamin Gaignard wrote: > IMX8MQ SoC got a dedicated hardware block to reset the video processor > units (G1 and G2). > > Signed-off-by: Benjamin Gaignard > --- > drivers/reset/Kconfig | 8 ++ > drivers/reset/Makefile | 1 + > drivers/reset/reset-imx8mq-vpu.c | 169 +++++++++++++++++++++++++++++++ > 3 files changed, 178 insertions(+) > create mode 100644 drivers/reset/reset-imx8mq-vpu.c > > diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig > index 71ab75a46491..fa95380b271a 100644 > --- a/drivers/reset/Kconfig > +++ b/drivers/reset/Kconfig > @@ -80,6 +80,14 @@ config RESET_IMX7 > help > This enables the reset controller driver for i.MX7 SoCs. > > +config RESET_VPU_IMX8MQ > + tristate "i.MX8MQ VPU Reset Driver" > + depends on HAS_IOMEM > + depends on (ARM64 && ARCH_MXC) || COMPILE_TEST > + select MFD_SYSCON > + help > + This enables the VPU reset controller driver for i.MX8MQ SoCs. > + > config RESET_INTEL_GW > bool "Intel Reset Controller Driver" > depends on OF && HAS_IOMEM > diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile > index 1054123fd187..6007e0cdfc05 100644 > --- a/drivers/reset/Makefile > +++ b/drivers/reset/Makefile > @@ -12,6 +12,7 @@ obj-$(CONFIG_RESET_BRCMSTB) += reset-brcmstb.o > obj-$(CONFIG_RESET_BRCMSTB_RESCAL) += reset-brcmstb-rescal.o > obj-$(CONFIG_RESET_HSDK) += reset-hsdk.o > obj-$(CONFIG_RESET_IMX7) += reset-imx7.o > +obj-$(CONFIG_RESET_VPU_IMX8MQ) += reset-imx8mq-vpu.o > obj-$(CONFIG_RESET_INTEL_GW) += reset-intel-gw.o > obj-$(CONFIG_RESET_LANTIQ) += reset-lantiq.o > obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o > diff --git a/drivers/reset/reset-imx8mq-vpu.c b/drivers/reset/reset-imx8mq-vpu.c > new file mode 100644 > index 000000000000..14c589f19266 > --- /dev/null > +++ b/drivers/reset/reset-imx8mq-vpu.c > @@ -0,0 +1,169 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* > + * Copyright (c) 2021, Collabora > + * > + * i.MX8MQ VPU Reset Controller driver > + * > + * Author: Benjamin Gaignard > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define CTRL_SOFT_RESET 0x00 > +#define RESET_G1 ((u32)BIT(1)) > +#define RESET_G2 ((u32)BIT(0)) > + > +#define CTRL_ENABLE 0x04 > +#define ENABLE_G1 BIT(1) > +#define ENABLE_G2 BIT(0) > + > +#define CTRL_G1_DEC_FUSE 0x08 > +#define CTRL_G1_PP_FUSE 0x0c > +#define CTRL_G2_DEC_FUSE 0x10 > + > +struct imx8mq_vpu_reset { > + struct reset_controller_dev rcdev; > + struct regmap *regmap; > + struct clk_bulk_data *clocks; > + int num_clocks; > + struct device *dev; > +}; > + > +static inline struct imx8mq_vpu_reset *to_imx8mq_vpu_reset(struct reset_controller_dev *rcdev) > +{ > + return container_of(rcdev, struct imx8mq_vpu_reset, rcdev); > +} > + > +static int imx8mq_vpu_reset_assert(struct reset_controller_dev *rcdev, > + unsigned long id) > +{ > + struct imx8mq_vpu_reset *reset = to_imx8mq_vpu_reset(rcdev); > + int ret = -EINVAL; > + > + ret = clk_bulk_prepare_enable(reset->num_clocks, reset->clocks); > + if (ret) { > + dev_err(reset->dev, "Failed to prepare clocks\n"); > + return ret; > + } > + > + switch (id) { > + case IMX8MQ_RESET_VPU_RESET_G1: > + ret = regmap_update_bits(reset->regmap, CTRL_SOFT_RESET, RESET_G1, ~RESET_G1); > + ret |= regmap_update_bits(reset->regmap, CTRL_ENABLE, ENABLE_G1, ENABLE_G1); > + break; > + case IMX8MQ_RESET_VPU_RESET_G2: > + ret = regmap_update_bits(reset->regmap, CTRL_SOFT_RESET, RESET_G2, ~RESET_G2); > + ret |= regmap_update_bits(reset->regmap, CTRL_ENABLE, ENABLE_G2, ENABLE_G2); This doesn't belong in reset_assert. > + break; > + } > + > + /* Set values of the fuse registers */ > + ret |= regmap_write(reset->regmap, CTRL_G1_DEC_FUSE, 0xffffffff); > + ret |= regmap_write(reset->regmap, CTRL_G1_PP_FUSE, 0xffffffff); > + ret |= regmap_write(reset->regmap, CTRL_G2_DEC_FUSE, 0xffffffff); Same as above, this doesn't belong in reset_assert. > + clk_bulk_disable_unprepare(reset->num_clocks, reset->clocks); Also I assume that only the VPU_DEC_ROOT clock is required to control these registers. Enabling the VPU_G1_ROOT and VPU_G2_ROOT clocks (presumably to make sure the resets propagate into the respective VPU core) would be the reset consumer's responsibility. regards Philipp From p.zabel at pengutronix.de Wed Mar 3 14:39:32 2021 From: p.zabel at pengutronix.de (Philipp Zabel) Date: Wed, 03 Mar 2021 15:39:32 +0100 Subject: [PATCH v3 4/5] media: hantro: Use reset driver In-Reply-To: <20210301151754.104749-5-benjamin.gaignard@collabora.com> References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> <20210301151754.104749-5-benjamin.gaignard@collabora.com> Message-ID: <29bf66f4b531ec701e85c23a411e40e3621b0ff8.camel@pengutronix.de> On Mon, 2021-03-01 at 16:17 +0100, Benjamin Gaignard wrote: > Rather use a reset like feature inside the driver use the reset > controller API to get the same result. > > Signed-off-by: Benjamin Gaignard > --- > drivers/staging/media/hantro/Kconfig | 1 + > drivers/staging/media/hantro/imx8m_vpu_hw.c | 61 ++++----------------- > 2 files changed, 12 insertions(+), 50 deletions(-) > > diff --git a/drivers/staging/media/hantro/Kconfig b/drivers/staging/media/hantro/Kconfig > index 5b6cf9f62b1a..dd1d4dde2658 100644 > --- a/drivers/staging/media/hantro/Kconfig > +++ b/drivers/staging/media/hantro/Kconfig > @@ -20,6 +20,7 @@ config VIDEO_HANTRO_IMX8M > bool "Hantro VPU i.MX8M support" > depends on VIDEO_HANTRO > depends on ARCH_MXC || COMPILE_TEST > + select RESET_VPU_IMX8MQ > default y > help > Enable support for i.MX8M SoCs. > diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c > index c222de075ef4..d5b4312b9391 100644 > --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c > +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c > @@ -7,49 +7,12 @@ > > #include > #include > +#include > > #include "hantro.h" > #include "hantro_jpeg.h" > #include "hantro_g1_regs.h" > > -#define CTRL_SOFT_RESET 0x00 > -#define RESET_G1 BIT(1) > -#define RESET_G2 BIT(0) > - > -#define CTRL_CLOCK_ENABLE 0x04 > -#define CLOCK_G1 BIT(1) > -#define CLOCK_G2 BIT(0) > - > -#define CTRL_G1_DEC_FUSE 0x08 > -#define CTRL_G1_PP_FUSE 0x0c > -#define CTRL_G2_DEC_FUSE 0x10 > - > -static void imx8m_soft_reset(struct hantro_dev *vpu, u32 reset_bits) > -{ > - u32 val; > - > - /* Assert */ > - val = readl(vpu->ctrl_base + CTRL_SOFT_RESET); > - val &= ~reset_bits; > - writel(val, vpu->ctrl_base + CTRL_SOFT_RESET); > - > - udelay(2); > - > - /* Release */ > - val = readl(vpu->ctrl_base + CTRL_SOFT_RESET); > - val |= reset_bits; > - writel(val, vpu->ctrl_base + CTRL_SOFT_RESET); > -} > - > -static void imx8m_clk_enable(struct hantro_dev *vpu, u32 clock_bits) > -{ > - u32 val; > - > - val = readl(vpu->ctrl_base + CTRL_CLOCK_ENABLE); > - val |= clock_bits; > - writel(val, vpu->ctrl_base + CTRL_CLOCK_ENABLE); The way it is implemented in the reset driver, the clocks are now ungated between assert and deassert instead of afterwards. Is this on purpose? regards Philipp From benjamin.gaignard at collabora.com Wed Mar 3 14:48:43 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 3 Mar 2021 15:48:43 +0100 Subject: [PATCH v3 4/5] media: hantro: Use reset driver In-Reply-To: <29bf66f4b531ec701e85c23a411e40e3621b0ff8.camel@pengutronix.de> References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> <20210301151754.104749-5-benjamin.gaignard@collabora.com> <29bf66f4b531ec701e85c23a411e40e3621b0ff8.camel@pengutronix.de> Message-ID: Le 03/03/2021 ? 15:39, Philipp Zabel a ?crit?: > On Mon, 2021-03-01 at 16:17 +0100, Benjamin Gaignard wrote: >> Rather use a reset like feature inside the driver use the reset >> controller API to get the same result. >> >> Signed-off-by: Benjamin Gaignard >> --- >> drivers/staging/media/hantro/Kconfig | 1 + >> drivers/staging/media/hantro/imx8m_vpu_hw.c | 61 ++++----------------- >> 2 files changed, 12 insertions(+), 50 deletions(-) >> >> diff --git a/drivers/staging/media/hantro/Kconfig b/drivers/staging/media/hantro/Kconfig >> index 5b6cf9f62b1a..dd1d4dde2658 100644 >> --- a/drivers/staging/media/hantro/Kconfig >> +++ b/drivers/staging/media/hantro/Kconfig >> @@ -20,6 +20,7 @@ config VIDEO_HANTRO_IMX8M >> bool "Hantro VPU i.MX8M support" >> depends on VIDEO_HANTRO >> depends on ARCH_MXC || COMPILE_TEST >> + select RESET_VPU_IMX8MQ >> default y >> help >> Enable support for i.MX8M SoCs. >> diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c >> index c222de075ef4..d5b4312b9391 100644 >> --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c >> +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c >> @@ -7,49 +7,12 @@ >> >> #include >> #include >> +#include >> >> #include "hantro.h" >> #include "hantro_jpeg.h" >> #include "hantro_g1_regs.h" >> >> -#define CTRL_SOFT_RESET 0x00 >> -#define RESET_G1 BIT(1) >> -#define RESET_G2 BIT(0) >> - >> -#define CTRL_CLOCK_ENABLE 0x04 >> -#define CLOCK_G1 BIT(1) >> -#define CLOCK_G2 BIT(0) >> - >> -#define CTRL_G1_DEC_FUSE 0x08 >> -#define CTRL_G1_PP_FUSE 0x0c >> -#define CTRL_G2_DEC_FUSE 0x10 >> - >> -static void imx8m_soft_reset(struct hantro_dev *vpu, u32 reset_bits) >> -{ >> - u32 val; >> - >> - /* Assert */ >> - val = readl(vpu->ctrl_base + CTRL_SOFT_RESET); >> - val &= ~reset_bits; >> - writel(val, vpu->ctrl_base + CTRL_SOFT_RESET); >> - >> - udelay(2); >> - >> - /* Release */ >> - val = readl(vpu->ctrl_base + CTRL_SOFT_RESET); >> - val |= reset_bits; >> - writel(val, vpu->ctrl_base + CTRL_SOFT_RESET); >> -} >> - >> -static void imx8m_clk_enable(struct hantro_dev *vpu, u32 clock_bits) >> -{ >> - u32 val; >> - >> - val = readl(vpu->ctrl_base + CTRL_CLOCK_ENABLE); >> - val |= clock_bits; >> - writel(val, vpu->ctrl_base + CTRL_CLOCK_ENABLE); > The way it is implemented in the reset driver, the clocks are now > ungated between assert and deassert instead of afterwards. Is this on > purpose? No and that could be changed on next version. Benjamin > > regards > Philipp > From benjamin.gaignard at collabora.com Wed Mar 3 15:20:34 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 3 Mar 2021 16:20:34 +0100 Subject: [PATCH v3 0/5] Reset driver for IMX8MQ VPU hardware block In-Reply-To: References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> Message-ID: <2d55ad69-9b93-ab0e-04af-cd775cc9248b@collabora.com> Le 03/03/2021 ? 15:17, Philipp Zabel a ?crit?: > Hi Benjamin, > > On Mon, 2021-03-01 at 16:17 +0100, Benjamin Gaignard wrote: >> The two VPUs inside IMX8MQ share the same control block which can be see >> as a reset hardware block. > This isn't a reset controller though. The control block also contains > clock gates of some sort and a filter register for the featureset fuses. > Those shouldn't be manipulated via the reset API. They are all part of the control block and of the reset process for this hardware that why I put them here. I guess it is border line :-) > >> In order to be able to add the second VPU (for HECV decoding) it will be >> more handy if the both VPU drivers instance don't have to share the >> control block registers. This lead to implement it as an independ reset >> driver and to change the VPU driver to use it. > Why not switch to a syscon regmap for the control block? That should > also allow to keep backwards compatibility with the old binding with > minimal effort. I will give a try in this direction. > >> Please note that this series break the compatibility between the DTB and >> kernel. This break is limited to IMX8MQ SoC and is done when the driver >> is still in staging directory. > I know in this case we are pretty sure there are no users of this > binding except for a staging driver, but it would still be nice to keep > support for the deprecated binding, to avoid the requirement of updating > kernel and DT in lock-step. If I want to use a syscon (or a reset) the driver must not ioremap the "ctrl" registers. It means that "ctrl" has to be removed from the driver requested reg-names (imx8mq_reg_names[]). Doing that break the kernel/DT compatibility. Somehow syscon and "ctrl" are exclusive. Benjamin > > regards > Philipp > From p.zabel at pengutronix.de Wed Mar 3 16:25:18 2021 From: p.zabel at pengutronix.de (Philipp Zabel) Date: Wed, 03 Mar 2021 17:25:18 +0100 Subject: [PATCH v3 0/5] Reset driver for IMX8MQ VPU hardware block In-Reply-To: <2d55ad69-9b93-ab0e-04af-cd775cc9248b@collabora.com> References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> <2d55ad69-9b93-ab0e-04af-cd775cc9248b@collabora.com> Message-ID: On Wed, 2021-03-03 at 16:20 +0100, Benjamin Gaignard wrote: > Le 03/03/2021 ? 15:17, Philipp Zabel a ?crit : > > Hi Benjamin, > > > > On Mon, 2021-03-01 at 16:17 +0100, Benjamin Gaignard wrote: > > > The two VPUs inside IMX8MQ share the same control block which can be see > > > as a reset hardware block. > > This isn't a reset controller though. The control block also contains > > clock gates of some sort and a filter register for the featureset fuses. > > Those shouldn't be manipulated via the reset API. > > They are all part of the control block and of the reset process for this > hardware that why I put them here. I guess it is border line :-) I'm pushing back to keep the reset control framework focused on controlling reset lines. Every side effect (such as the asymmetric clock ungating) in a random driver makes it harder to reason about behaviour at the API level, and to review patches for hardware I am not familiar with. > > > In order to be able to add the second VPU (for HECV decoding) it will be > > > more handy if the both VPU drivers instance don't have to share the > > > control block registers. This lead to implement it as an independ reset > > > driver and to change the VPU driver to use it. > > Why not switch to a syscon regmap for the control block? That should > > also allow to keep backwards compatibility with the old binding with > > minimal effort. > > I will give a try in this direction. Thank you. > > > Please note that this series break the compatibility between the DTB and > > > kernel. This break is limited to IMX8MQ SoC and is done when the driver > > > is still in staging directory. > > I know in this case we are pretty sure there are no users of this > > binding except for a staging driver, but it would still be nice to keep > > support for the deprecated binding, to avoid the requirement of updating > > kernel and DT in lock-step. > > If I want to use a syscon (or a reset) the driver must not ioremap the "ctrl" > registers. It means that "ctrl" has to be removed from the driver requested > reg-names (imx8mq_reg_names[]). Doing that break the kernel/DT compatibility. > Somehow syscon and "ctrl" are exclusive. The way the driver is set up currently, yes. You could add a bit of platform specific probe code, though, that would set up the regmap either by calling syscon_regmap_lookup_by_phandle(); for the new binding, or, if the phandle is not available, fall back to platform_get_resource_byname(..., "ctrl"); devm_ioremap_resource(); devm_regmap_init_mmio(); for the old binding. The actual codec .reset and variant .runtime_resume ops could be identical then. regards Philipp From gustavoars at kernel.org Thu Mar 4 02:02:28 2021 From: gustavoars at kernel.org (Gustavo A. R. Silva) Date: Wed, 3 Mar 2021 20:02:28 -0600 Subject: [PATCH][next] staging: rtl8188eu: Replace one-element array with flexible-array in struct ndis_802_11_var_ie Message-ID: <20210304020228.GA45139@embeddedor> There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use ?flexible array members?[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. Use flexible-array member in struct ndis_802_11_var_ie, instead of one-element array. Also, this helps with the ongoing efforts to enable -Warray-bounds by fixing the following warning: drivers/staging/rtl8188eu/core/rtw_wlan_util.c: In function ?HT_caps_handler?: drivers/staging/rtl8188eu/core/rtw_wlan_util.c:665:65: warning: array subscript 2 is above array bounds of ?u8[1]? {aka ?unsigned char[1]?} [-Warray-bounds] 665 | if ((pmlmeinfo->HT_caps.ampdu_params_info & 0x3) > (pIE->data[i] & 0x3)) | ~~~~~~~~~^~~ [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://www.kernel.org/doc/html/v5.9/process/deprecated.html#zero-length-and-one-element-arrays Link: https://github.com/KSPP/linux/issues/79 Link: https://github.com/KSPP/linux/issues/109 Signed-off-by: Gustavo A. R. Silva --- drivers/staging/rtl8188eu/include/wlan_bssdef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/include/wlan_bssdef.h b/drivers/staging/rtl8188eu/include/wlan_bssdef.h index 2c184ce8746b..350bbf9057b8 100644 --- a/drivers/staging/rtl8188eu/include/wlan_bssdef.h +++ b/drivers/staging/rtl8188eu/include/wlan_bssdef.h @@ -64,7 +64,7 @@ struct ndis_802_11_fixed_ie { struct ndis_802_11_var_ie { u8 ElementID; u8 Length; - u8 data[1]; + u8 data[]; }; /* -- 2.27.0 From johnpinto at jvpinto.com Thu Mar 4 07:26:27 2021 From: johnpinto at jvpinto.com (Hi) Date: Thu, 4 Mar 2021 07:26:27 +0000 Subject: Investment Partner Required. Message-ID: My name is Reem Hashimy, the Emirates Minister of State and Managing Director of the United Arab Emirates (Dubai) World Expo 2020 Committee which has been postponed to October 2021 to March 2022 because of the Covid-19 pandemic. I am writing to you to manage the funds I received as financial gratification from various foreign companies I assisted to receive a participation approval to the coming event. The amount is $44,762,906.00 United States dollars. But I can not personally manage the fund in my country because of the sensitive nature of my office and the certain restriction on married Muslim women. For this reason, an agreement was reached with a consulting firm to direct the various financial gifts into an open beneficiary account in my name with a bank where it will be possible for me to instruct the transfer of ownership right to a third party for investment purpose; which is the reason I am contacting you to receive the fund and manage it as my investment partner. Note that the fund is NOT connected to any criminal or terrorist activity. On your indication of interest with your information to include your nahme, your phone number and contact mailing address; I will instruct the consulting firm to process the fund from the bank to your country for investment purposes. Regards. Reem Hashimy. From johnpinto at jvpinto.com Thu Mar 4 07:26:27 2021 From: johnpinto at jvpinto.com (Hi) Date: Thu, 4 Mar 2021 07:26:27 +0000 Subject: Investment Partner Required. Message-ID: My name is Reem Hashimy, the Emirates Minister of State and Managing Director of the United Arab Emirates (Dubai) World Expo 2020 Committee which has been postponed to October 2021 to March 2022 because of the Covid-19 pandemic. I am writing to you to manage the funds I received as financial gratification from various foreign companies I assisted to receive a participation approval to the coming event. The amount is $44,762,906.00 United States dollars. But I can not personally manage the fund in my country because of the sensitive nature of my office and the certain restriction on married Muslim women. For this reason, an agreement was reached with a consulting firm to direct the various financial gifts into an open beneficiary account in my name with a bank where it will be possible for me to instruct the transfer of ownership right to a third party for investment purpose; which is the reason I am contacting you to receive the fund and manage it as my investment partner. Note that the fund is NOT connected to any criminal or terrorist activity. On your indication of interest with your information to include your nahme, your phone number and contact mailing address; I will instruct the consulting firm to process the fund from the bank to your country for investment purposes. Regards. Reem Hashimy. From contacto at beyoung.com.ar Wed Mar 3 18:10:51 2021 From: contacto at beyoung.com.ar (Mr. Scott Grog) Date: Wed, 3 Mar 2021 10:10:51 -0800 Subject: Read Carefully.. Message-ID: <20210304095520.9F14484311@smtp1.osuosl.org> This is National Crime Investigation Center USA. In our investigations from banks on International and National Funds Transfer (INFT) protocols in the past 10 years from all banks worldwide. We have come across your contact details and records with one of these Banks. In view of the carried investigations, we have contacted you confidentially for vital information toward your transaction with this bank. It was clear that the bank have delayed your payment thereby looking for a means to divert your fund to different individual account not belonging to you. However, all bank officials who mishandled your transaction has been duly sacked and management dissolved and dismissed from bank work as a result of this attempt. Upon our investigation conclusion, we found out that your transaction was legitimate and for this reason, a compensation amount of $3,150,567.00 (Three million one hundred and fifty thousand, five hundred and sixty seven dollars) has been allocated to you for immediate payment through our accredited bank, EURO BANK- PAYMENT REQUIREMENTS. Kindly contact the compensation paying officer with the below details. Name: Mr. Larry Ellis Email: info.larryellisdept.org at mail.com Thanks. Yours sincerely, Mr. Scott From contacto at beyoung.com.ar Wed Mar 3 18:10:51 2021 From: contacto at beyoung.com.ar (Mr. Scott Grog) Date: Wed, 3 Mar 2021 10:10:51 -0800 Subject: Read Carefully.. Message-ID: <20210304095520.AA92B4EBDE@smtp4.osuosl.org> This is National Crime Investigation Center USA. In our investigations from banks on International and National Funds Transfer (INFT) protocols in the past 10 years from all banks worldwide. We have come across your contact details and records with one of these Banks. In view of the carried investigations, we have contacted you confidentially for vital information toward your transaction with this bank. It was clear that the bank have delayed your payment thereby looking for a means to divert your fund to different individual account not belonging to you. However, all bank officials who mishandled your transaction has been duly sacked and management dissolved and dismissed from bank work as a result of this attempt. Upon our investigation conclusion, we found out that your transaction was legitimate and for this reason, a compensation amount of $3,150,567.00 (Three million one hundred and fifty thousand, five hundred and sixty seven dollars) has been allocated to you for immediate payment through our accredited bank, EURO BANK- PAYMENT REQUIREMENTS. Kindly contact the compensation paying officer with the below details. Name: Mr. Larry Ellis Email: info.larryellisdept.org at mail.com Thanks. Yours sincerely, Mr. Scott From jerome.pouiller at silabs.com Thu Mar 4 09:43:45 2021 From: jerome.pouiller at silabs.com (=?ISO-8859-1?Q?J=E9r=F4me?= Pouiller) Date: Thu, 04 Mar 2021 10:43:45 +0100 Subject: [PATCH] staging: wfx: remove unused included header files In-Reply-To: <1722736.fQpYkz0vEs@pc-42> References: <20210211143637.GA177425@LEGION> <1722736.fQpYkz0vEs@pc-42> Message-ID: <5120192.kWiexivLR2@pc-42> Hello Greg, On Tuesday 2 March 2021 16:01:25 CET J?r?me Pouiller wrote: > Hello Muhammad, > > Sorry, I am a bit late for the review of this patch. Thank you for your > contribution. > > On Thursday 11 February 2021 15:36:37 CET Muhammad Usama Anjum wrote: > > > > Many header files have been included, but never used. Those header > > files have been removed. > > > > Signed-off-by: Muhammad Usama Anjum > > --- > > drivers/staging/wfx/bh.c | 1 - > > drivers/staging/wfx/bh.h | 4 ---- > > drivers/staging/wfx/bus.h | 3 --- > > drivers/staging/wfx/bus_sdio.c | 6 ------ > > drivers/staging/wfx/bus_spi.c | 7 ------- > > drivers/staging/wfx/data_rx.c | 5 ----- > > drivers/staging/wfx/data_tx.c | 5 ----- > > drivers/staging/wfx/data_tx.h | 3 --- > > drivers/staging/wfx/debug.c | 6 ------ > > drivers/staging/wfx/fwio.c | 2 -- > > drivers/staging/wfx/hif_api_cmd.h | 4 ---- > > drivers/staging/wfx/hif_api_general.h | 9 --------- > > drivers/staging/wfx/hif_tx.c | 4 ---- > > drivers/staging/wfx/hif_tx_mib.c | 5 ----- > > drivers/staging/wfx/hwio.c | 3 --- > > drivers/staging/wfx/hwio.h | 2 -- > > drivers/staging/wfx/key.c | 2 -- > > drivers/staging/wfx/key.h | 2 -- > > drivers/staging/wfx/main.c | 7 ------- > > drivers/staging/wfx/main.h | 3 --- > > drivers/staging/wfx/queue.c | 4 ---- > > drivers/staging/wfx/queue.h | 3 --- > > drivers/staging/wfx/scan.h | 2 -- > > drivers/staging/wfx/sta.c | 6 ------ > > drivers/staging/wfx/sta.h | 2 -- > > drivers/staging/wfx/traces.h | 3 --- > > drivers/staging/wfx/wfx.h | 3 --- > > 27 files changed, 106 deletions(-) > > > > diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c > > index ed53d0b45592..cd6bcfdfbe9a 100644 > > --- a/drivers/staging/wfx/bh.c > > +++ b/drivers/staging/wfx/bh.c > > @@ -5,7 +5,6 @@ > > * Copyright (c) 2017-2020, Silicon Laboratories, Inc. > > * Copyright (c) 2010, ST-Ericsson > > */ > > -#include > > #include > > Though bh.c refers to gpiod_set_value_cansleep() > > > > #include "bh.h" > > diff --git a/drivers/staging/wfx/bh.h b/drivers/staging/wfx/bh.h > > index 78c49329e22a..92ef3298d4ac 100644 > > --- a/drivers/staging/wfx/bh.h > > +++ b/drivers/staging/wfx/bh.h > > @@ -8,10 +8,6 @@ > > #ifndef WFX_BH_H > > #define WFX_BH_H > > > > -#include > > -#include > > -#include > > - > > struct wfx_dev; > > > > struct wfx_hif { > > Ditto, bh.h refers to atomic_t, struct work_struct and struct > completion. If you try to compile bh.h alone (with something like > gcc -xc .../bh.h) it won't work. > > Maybe it works now because we are lucky in the order the headers are > included, but I think it is not sufficient. > > [... same problem repeats multiple times in the following ...] > Greg, if nobody has any opinion on that, I think that this patch should be reverted. -- J?r?me Pouiller From contacto at beyoung.com.ar Wed Mar 3 18:32:20 2021 From: contacto at beyoung.com.ar (Mr. Scott Grog) Date: Wed, 3 Mar 2021 10:32:20 -0800 Subject: Read Carefully.. Message-ID: <20210304105409.109A94312D@smtp2.osuosl.org> This is National Crime Investigation Center USA. In our investigations from banks on International and National Funds Transfer (INFT) protocols in the past 10 years from all banks worldwide. We have come across your contact details and records with one of these Banks. In view of the carried investigations, we have contacted you confidentially for vital information toward your transaction with this bank. It was clear that the bank have delayed your payment thereby looking for a means to divert your fund to different individual account not belonging to you. However, all bank officials who mishandled your transaction has been duly sacked and management dissolved and dismissed from bank work as a result of this attempt. Upon our investigation conclusion, we found out that your transaction was legitimate and for this reason, a compensation amount of $3,150,567.00 (Three million one hundred and fifty thousand, five hundred and sixty seven dollars) has been allocated to you for immediate payment through our accredited bank, EURO BANK- PAYMENT REQUIREMENTS. Kindly contact the compensation paying officer with the below details. Name: Mr. Larry Ellis Email: info.larryellisdept.org at mail.com Thanks. Yours sincerely, Mr. Scott From aford173 at gmail.com Thu Mar 4 12:52:34 2021 From: aford173 at gmail.com (Adam Ford) Date: Thu, 4 Mar 2021 06:52:34 -0600 Subject: [PATCH v3 0/5] Reset driver for IMX8MQ VPU hardware block In-Reply-To: References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> <2d55ad69-9b93-ab0e-04af-cd775cc9248b@collabora.com> Message-ID: On Wed, Mar 3, 2021 at 5:24 PM Philipp Zabel wrote: > > On Wed, 2021-03-03 at 16:20 +0100, Benjamin Gaignard wrote: > > Le 03/03/2021 ? 15:17, Philipp Zabel a ?crit : > > > Hi Benjamin, > > > > > > On Mon, 2021-03-01 at 16:17 +0100, Benjamin Gaignard wrote: > > > > The two VPUs inside IMX8MQ share the same control block which can be see > > > > as a reset hardware block. > > > This isn't a reset controller though. The control block also contains > > > clock gates of some sort and a filter register for the featureset fuses. > > > Those shouldn't be manipulated via the reset API. This driver is very similar to several other patches for clk_blk control [1] which contain both resets and clock-enables on the i.MX8MP, i.MX8MM and i.MX8MN. In those cases, there are some specific power domain controls that are needed, but I wonder if the approach to creating resets and clock enables could be used in a similar way if the IMX8MQ doesn't have the same quirks. In the case of the i.MX8M Mini, I think it has the same VPU. [1] - https://patchwork.kernel.org/project/linux-clk/patch/1599560691-3763-12-git-send-email-abel.vesa at nxp.com/ adam > > > > They are all part of the control block and of the reset process for this > > hardware that why I put them here. I guess it is border line :-) > > I'm pushing back to keep the reset control framework focused on > controlling reset lines. Every side effect (such as the asymmetric clock > ungating) in a random driver makes it harder to reason about behaviour > at the API level, and to review patches for hardware I am not familiar > with. > > > > > In order to be able to add the second VPU (for HECV decoding) it will be > > > > more handy if the both VPU drivers instance don't have to share the > > > > control block registers. This lead to implement it as an independ reset > > > > driver and to change the VPU driver to use it. > > > Why not switch to a syscon regmap for the control block? That should > > > also allow to keep backwards compatibility with the old binding with > > > minimal effort. > > > > I will give a try in this direction. > > Thank you. > > > > > Please note that this series break the compatibility between the DTB and > > > > kernel. This break is limited to IMX8MQ SoC and is done when the driver > > > > is still in staging directory. > > > I know in this case we are pretty sure there are no users of this > > > binding except for a staging driver, but it would still be nice to keep > > > support for the deprecated binding, to avoid the requirement of updating > > > kernel and DT in lock-step. > > > > If I want to use a syscon (or a reset) the driver must not ioremap the "ctrl" > > registers. It means that "ctrl" has to be removed from the driver requested > > reg-names (imx8mq_reg_names[]). Doing that break the kernel/DT compatibility. > > Somehow syscon and "ctrl" are exclusive. > > The way the driver is set up currently, yes. You could add a bit of > platform specific probe code, though, that would set up the regmap > either by calling > syscon_regmap_lookup_by_phandle(); > for the new binding, or, if the phandle is not available, fall back to > platform_get_resource_byname(..., "ctrl"); > devm_ioremap_resource(); > devm_regmap_init_mmio(); > for the old binding. > The actual codec .reset and variant .runtime_resume ops could be > identical then. > > regards > Philipp > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel at lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From johnpinto at jvpinto.com Thu Mar 4 17:07:53 2021 From: johnpinto at jvpinto.com (Hi) Date: Thu, 4 Mar 2021 17:07:53 +0000 Subject: Investment Partner Required. Message-ID: <6bf42a003633400fb1fe54805e4fe083@RW-EXC1.JVPinto.com> My name is Reem Hashimy, the Emirates Minister of State and Managing Director of the United Arab Emirates (Dubai) World Expo 2020 Committee which has been postponed to October 2021 to March 2022 because of the Covid-19 pandemic. I am writing to you to manage the funds I received as financial gratification from various foreign companies I assisted to receive a participation approval to the coming event. The amount is $44,762,906.00 United States dollars. But I can not personally manage the fund in my country because of the sensitive nature of my office and the certain restriction on married Muslim women. For this reason, an agreement was reached with a consulting firm to direct the various financial gifts into an open beneficiary account in my name with a bank where it will be possible for me to instruct the transfer of ownership right to a third party for investment purpose; which is the reason I am contacting you to receive the fund and manage it as my investment partner. Note that the fund is NOT connected to any criminal or terrorist activity. On your indication of interest with your information to include your nahme, your phone number and contact mailing address; I will instruct the consulting firm to process the fund from the bank to your country for investment purposes. Regards. Reem Hashimy. From ABELADO at osuosl.org Thu Mar 4 17:37:36 2021 From: ABELADO at osuosl.org (ABELADO at osuosl.org) Date: Thu, 04 Mar 2021 18:37:36 +0100 Subject: Preisgeldes Message-ID: <20210304174115.C32FA6F515@smtp3.osuosl.org> ABELADO ASOCIADOS Y ABOGADOS CALLE OLIVIA 113, MADRID 28037 SPAIN. TEL. 00 34 658830436 EMAIL- abeladofranciscocruz at gmail.com AKTENZEIHEN:GD/57-876/98-04 KUNDENNUMMER: WG-MB/NGHD-132 Abschlie?ende Mitteilung f?r die Zahlung des nicht beanspruchten Preisgeldes Wir m?chten Sie informieren, dass das B?ro des nicht Beanspruchten Preisgeldes in Spanien,unsere Anwaltskanzlei ernannt hat, als gesetzliche Berater zu handeln, in der Verarbeitung und der Zahlung eines Preisgeldes, das auf Ihrem Namen gutgeschrieben wurde, und nun seit ?ber zwei Jahren nicht beansprucht wurde. Der Gesamtbetrag der ihnen zusteht betr?gt momentan 8.540.225.10 EURO Das urspr?ngliche Preisgeld bertug 5.906.315,00 EURO. Diese Summe wurde fuer nun mehr als zwei Jahre,Gewinnbringend angelegt,daher die aufstockung auf die oben bennante Gesammtsumme. Entsprechend dem B?ros des nicht Beanspruchten Preisgeldes,wurde dieses Geld als nicht beanspruchten Gewinn einer Lotteriefirma bei ihnen zum verwalten niedergelegt und in ihrem namen versichert. Nach Ansicht der Lotteriefirma wurde ihnen das Geld nach einer Weihnachtsf?rderunglotterie zugesprochen. Die Kupons wurden von einer Investmentgesellschaft gekauft.Nach Ansicht der Lotteriefirma wurden sie damals Angeschrieben um Sie ?ber dieses Geld zu informieren es hat sich aber leider bis zum Ablauf der gesetzten Frist keiner gemeldet um den Gewinn zu Beanspruchen.. -------------- next part -------------- A non-text attachment was scrubbed... Name: ABELADO LETTER ESP.pdf Type: application/pdf Size: 122133 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ABELADO FORM ESP.pdf Type: application/pdf Size: 110304 bytes Desc: not available URL: From ABELADO at osuosl.org Thu Mar 4 17:37:36 2021 From: ABELADO at osuosl.org (ABELADO at osuosl.org) Date: Thu, 04 Mar 2021 18:37:36 +0100 Subject: Preisgeldes Message-ID: <20210304174116.2A3B84320C@smtp2.osuosl.org> ABELADO ASOCIADOS Y ABOGADOS CALLE OLIVIA 113, MADRID 28037 SPAIN. TEL. 00 34 658830436 EMAIL- abeladofranciscocruz at gmail.com AKTENZEIHEN:GD/57-876/98-04 KUNDENNUMMER: WG-MB/NGHD-132 Abschlie?ende Mitteilung f?r die Zahlung des nicht beanspruchten Preisgeldes Wir m?chten Sie informieren, dass das B?ro des nicht Beanspruchten Preisgeldes in Spanien,unsere Anwaltskanzlei ernannt hat, als gesetzliche Berater zu handeln, in der Verarbeitung und der Zahlung eines Preisgeldes, das auf Ihrem Namen gutgeschrieben wurde, und nun seit ?ber zwei Jahren nicht beansprucht wurde. Der Gesamtbetrag der ihnen zusteht betr?gt momentan 8.540.225.10 EURO Das urspr?ngliche Preisgeld bertug 5.906.315,00 EURO. Diese Summe wurde fuer nun mehr als zwei Jahre,Gewinnbringend angelegt,daher die aufstockung auf die oben bennante Gesammtsumme. Entsprechend dem B?ros des nicht Beanspruchten Preisgeldes,wurde dieses Geld als nicht beanspruchten Gewinn einer Lotteriefirma bei ihnen zum verwalten niedergelegt und in ihrem namen versichert. Nach Ansicht der Lotteriefirma wurde ihnen das Geld nach einer Weihnachtsf?rderunglotterie zugesprochen. Die Kupons wurden von einer Investmentgesellschaft gekauft.Nach Ansicht der Lotteriefirma wurden sie damals Angeschrieben um Sie ?ber dieses Geld zu informieren es hat sich aber leider bis zum Ablauf der gesetzten Frist keiner gemeldet um den Gewinn zu Beanspruchen.. -------------- next part -------------- A non-text attachment was scrubbed... Name: ABELADO LETTER ESP.pdf Type: application/pdf Size: 122133 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ABELADO FORM ESP.pdf Type: application/pdf Size: 110304 bytes Desc: not available URL: From baijiaju1990 at gmail.com Thu Mar 4 14:02:33 2021 From: baijiaju1990 at gmail.com (Jia-Ju Bai) Date: Thu, 4 Mar 2021 06:02:33 -0800 Subject: [PATCH] staging: media: omap4iss: fix error return code in iss_probe() Message-ID: <20210304140233.8030-1-baijiaju1990@gmail.com> When omap4iss_get() returns NULL, no error return code is assigned. To fix this bug, ret is assigned with -EINVAL as error return code. Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai --- drivers/staging/media/omap4iss/iss.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c index dae9073e7d3c..085397045b36 100644 --- a/drivers/staging/media/omap4iss/iss.c +++ b/drivers/staging/media/omap4iss/iss.c @@ -1236,8 +1236,10 @@ static int iss_probe(struct platform_device *pdev) if (ret < 0) goto error; - if (!omap4iss_get(iss)) + if (!omap4iss_get(iss)) { + ret = -EINVAL; goto error; + } ret = iss_reset(iss); if (ret < 0) -- 2.17.1 From dan.carpenter at oracle.com Fri Mar 5 08:12:49 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Fri, 5 Mar 2021 11:12:49 +0300 Subject: [PATCH] staging: rtl8192u: fix ->ssid overflow in r8192_wx_set_scan() Message-ID: We need to cap len at IW_ESSID_MAX_SIZE (32) to avoid memory corruption. This can be controlled by the user via the ioctl. Fixes: 5f53d8ca3d5d ("Staging: add rtl8192SU wireless usb driver") Signed-off-by: Dan Carpenter --- drivers/staging/rtl8192u/r8192U_wx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index 175bb8b15389..5211b2005763 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -331,8 +331,10 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, struct iw_scan_req *req = (struct iw_scan_req *)b; if (req->essid_len) { - ieee->current_network.ssid_len = req->essid_len; - memcpy(ieee->current_network.ssid, req->essid, req->essid_len); + int len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE); + + ieee->current_network.ssid_len = len; + memcpy(ieee->current_network.ssid, req->essid, len); } } -- 2.30.1 From dan.carpenter at oracle.com Fri Mar 5 08:22:28 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Fri, 5 Mar 2021 11:22:28 +0300 Subject: [PATCH] staging: rtl8192e: Fix possible buffer overflow in _rtl92e_wx_set_scan In-Reply-To: <20210301132535.GR2087@kadam> References: <20210226114829.316980-1-leegib@gmail.com> <20210226134333.GA2087@kadam> <20210226140526.GG2222@kadam> <20210301132535.GR2087@kadam> Message-ID: <20210305082228.GG2222@kadam> Actually, I looked through a bunch of these and they're mostly false positives outside of staging. I guess there are a few ways the ->ssid can be changed. Via netlink, from the network or from the an ioctl. I still have a couple questions, but so far as I can see it's mostly the ioctl which has problems. I really want Smatch to be able to figure the netlink stuff... That should be doable. regards, dan carpenter From dan.carpenter at oracle.com Fri Mar 5 08:56:32 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Fri, 5 Mar 2021 11:56:32 +0300 Subject: [PATCH] staging: rtl8188eu: fix potential memory corruption in rtw_check_beacon_data() Message-ID: The "ie_len" is a value in the 1-255 range that comes from the user. We have to cap it to ensure that it's not too large or it could lead to memory corruption. Fixes: 9a7fe54ddc3a ("staging: r8188eu: Add source files for new driver - part 1") Signed-off-by: Dan Carpenter --- drivers/staging/rtl8188eu/core/rtw_ap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index fa1e34a0d456..182bb944c9b3 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -791,6 +791,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_SSID, &ie_len, pbss_network->ie_length - _BEACON_IE_OFFSET_); if (p && ie_len > 0) { + ie_len = min_t(int, ie_len, sizeof(pbss_network->ssid.ssid)); memset(&pbss_network->ssid, 0, sizeof(struct ndis_802_11_ssid)); memcpy(pbss_network->ssid.ssid, p + 2, ie_len); pbss_network->ssid.ssid_length = ie_len; @@ -811,6 +812,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_SUPP_RATES, &ie_len, pbss_network->ie_length - _BEACON_IE_OFFSET_); if (p) { + ie_len = min_t(int, ie_len, NDIS_802_11_LENGTH_RATES_EX); memcpy(supportRate, p + 2, ie_len); supportRateNum = ie_len; } @@ -819,6 +821,8 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_EXT_SUPP_RATES, &ie_len, pbss_network->ie_length - _BEACON_IE_OFFSET_); if (p) { + ie_len = min_t(int, ie_len, + NDIS_802_11_LENGTH_RATES_EX - supportRateNum); memcpy(supportRate + supportRateNum, p + 2, ie_len); supportRateNum += ie_len; } @@ -934,6 +938,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) pht_cap->mcs.rx_mask[0] = 0xff; pht_cap->mcs.rx_mask[1] = 0x0; + ie_len = min_t(int, ie_len, sizeof(pmlmepriv->htpriv.ht_cap)); memcpy(&pmlmepriv->htpriv.ht_cap, p + 2, ie_len); } -- 2.30.1 From dan.carpenter at oracle.com Fri Mar 5 08:58:03 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Fri, 5 Mar 2021 11:58:03 +0300 Subject: [PATCH] staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan() Message-ID: This code has a check to prevent read overflow but it needs another check to prevent writing beyond the end of the ->ssid[] array. Fixes: a2c60d42d97c ("staging: r8188eu: Add files for new driver - part 16") Signed-off-by: Dan Carpenter --- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c index bf22f130d3e1..58954b88a817 100644 --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c @@ -1133,9 +1133,11 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, break; } sec_len = *(pos++); len -= 1; - if (sec_len > 0 && sec_len <= len) { + if (sec_len > 0 && + sec_len <= len && + sec_len <= 32) { ssid[ssid_index].ssid_length = sec_len; - memcpy(ssid[ssid_index].ssid, pos, ssid[ssid_index].ssid_length); + memcpy(ssid[ssid_index].ssid, pos, sec_len); ssid_index++; } pos += sec_len; -- 2.30.1 From benjamin.gaignard at collabora.com Fri Mar 5 09:35:44 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Fri, 5 Mar 2021 10:35:44 +0100 Subject: [PATCH v3 0/5] Reset driver for IMX8MQ VPU hardware block In-Reply-To: References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> <2d55ad69-9b93-ab0e-04af-cd775cc9248b@collabora.com> Message-ID: Le 03/03/2021 ? 17:25, Philipp Zabel a ?crit?: > On Wed, 2021-03-03 at 16:20 +0100, Benjamin Gaignard wrote: >> Le 03/03/2021 ? 15:17, Philipp Zabel a ?crit : >>> Hi Benjamin, >>> >>> On Mon, 2021-03-01 at 16:17 +0100, Benjamin Gaignard wrote: >>>> The two VPUs inside IMX8MQ share the same control block which can be see >>>> as a reset hardware block. >>> This isn't a reset controller though. The control block also contains >>> clock gates of some sort and a filter register for the featureset fuses. >>> Those shouldn't be manipulated via the reset API. >> They are all part of the control block and of the reset process for this >> hardware that why I put them here. I guess it is border line :-) > I'm pushing back to keep the reset control framework focused on > controlling reset lines. Every side effect (such as the asymmetric clock > ungating) in a random driver makes it harder to reason about behaviour > at the API level, and to review patches for hardware I am not familiar > with. > >>>> In order to be able to add the second VPU (for HECV decoding) it will be >>>> more handy if the both VPU drivers instance don't have to share the >>>> control block registers. This lead to implement it as an independ reset >>>> driver and to change the VPU driver to use it. >>> Why not switch to a syscon regmap for the control block? That should >>> also allow to keep backwards compatibility with the old binding with >>> minimal effort. >> I will give a try in this direction. > Thank you. > >>>> Please note that this series break the compatibility between the DTB and >>>> kernel. This break is limited to IMX8MQ SoC and is done when the driver >>>> is still in staging directory. >>> I know in this case we are pretty sure there are no users of this >>> binding except for a staging driver, but it would still be nice to keep >>> support for the deprecated binding, to avoid the requirement of updating >>> kernel and DT in lock-step. >> If I want to use a syscon (or a reset) the driver must not ioremap the "ctrl" >> registers. It means that "ctrl" has to be removed from the driver requested >> reg-names (imx8mq_reg_names[]). Doing that break the kernel/DT compatibility. >> Somehow syscon and "ctrl" are exclusive. > The way the driver is set up currently, yes. You could add a bit of > platform specific probe code, though, that would set up the regmap > either by calling > syscon_regmap_lookup_by_phandle(); > for the new binding, or, if the phandle is not available, fall back to > platform_get_resource_byname(..., "ctrl"); > devm_ioremap_resource(); > devm_regmap_init_mmio(); > for the old binding. > The actual codec .reset and variant .runtime_resume ops could be > identical then. I made it works with syscon and your proposal. The next version of the patches will be without reset and won't break DT compatibility. Thanks for your help, Benjamin > > regards > Philipp > From efremov at linux.com Fri Mar 5 15:50:01 2021 From: efremov at linux.com (Denis Efremov) Date: Fri, 5 Mar 2021 18:50:01 +0300 Subject: [PATCH] staging: rtl8723bs: remove duplicate pstat->hwaddr check Message-ID: <20210305155001.61951-1-efremov@linux.com> IS_MCAST(pstat->hwaddr) checked twice in a row in odm_RefreshRateAdaptiveMaskCE(). Remove the second check. Signed-off-by: Denis Efremov --- drivers/staging/rtl8723bs/hal/odm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm.c b/drivers/staging/rtl8723bs/hal/odm.c index f2a9e95a1563..5e432f1bc150 100644 --- a/drivers/staging/rtl8723bs/hal/odm.c +++ b/drivers/staging/rtl8723bs/hal/odm.c @@ -1114,8 +1114,6 @@ void odm_RefreshRateAdaptiveMaskCE(PDM_ODM_T pDM_Odm) if (IS_STA_VALID(pstat)) { if (IS_MCAST(pstat->hwaddr)) /* if (psta->mac_id == 1) */ continue; - if (IS_MCAST(pstat->hwaddr)) - continue; if (true == ODM_RAStateCheck(pDM_Odm, pstat->rssi_stat.UndecoratedSmoothedPWDB, false, &pstat->rssi_level)) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("RSSI:%d, RSSI_LEVEL:%d\n", pstat->rssi_stat.UndecoratedSmoothedPWDB, pstat->rssi_level)); -- 2.26.2 From leegib at gmail.com Fri Mar 5 15:00:14 2021 From: leegib at gmail.com (Lee) Date: Fri, 5 Mar 2021 15:00:14 +0000 Subject: [PATCH] staging: rtl8192e: Fix possible buffer overflow in _rtl92e_wx_set_scan In-Reply-To: <20210305082228.GG2222@kadam> References: <20210226114829.316980-1-leegib@gmail.com> <20210226134333.GA2087@kadam> <20210226140526.GG2222@kadam> <20210301132535.GR2087@kadam> <20210305082228.GG2222@kadam> Message-ID: <20210305150014.GA627584@ubuntudesktop> Hi Dan, Do you think any of these could be potential issues: driver/staging/ rtl8192e/rtllib_rx.c:2442 wlan-ng/cfg80211.c:316 rtl8723bs/os_dep/ioctl_cfg80211.c:1591 rtl8723bs/os_dep/ioctl_cfg80211.c:2738 and if so, findable via Smatch? Regards, Lee On Fri, Mar 05, 2021 at 11:22:28AM +0300, Dan Carpenter wrote: > Actually, I looked through a bunch of these and they're mostly false > positives outside of staging. I guess there are a few ways the ->ssid > can be changed. Via netlink, from the network or from the an ioctl. > > I still have a couple questions, but so far as I can see it's mostly the > ioctl which has problems. > > I really want Smatch to be able to figure the netlink stuff... That > should be doable. > > regards, > dan carpenter > From eantoranz at gmail.com Fri Mar 5 16:58:17 2021 From: eantoranz at gmail.com (Edmundo Carmona Antoranz) Date: Fri, 5 Mar 2021 10:58:17 -0600 Subject: [PATCH] staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan() In-Reply-To: References: Message-ID: On Fri, Mar 5, 2021 at 2:59 AM Dan Carpenter wrote: > - if (sec_len > 0 && sec_len <= len) { > + if (sec_len > 0 && > + sec_len <= len && > + sec_len <= 32) { I wonder if this could be reduced to (sec_len > 0 && sec_len <= min(len, 32)) from a stylistic POV? First attempt at something kernel related so I know there's plenty of things to learn (including patterns for problems like this and etiquette). BR From dan.carpenter at oracle.com Fri Mar 5 18:32:59 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Fri, 5 Mar 2021 21:32:59 +0300 Subject: [PATCH] staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan() In-Reply-To: References: Message-ID: <20210305183259.GE2087@kadam> On Fri, Mar 05, 2021 at 10:58:17AM -0600, Edmundo Carmona Antoranz wrote: > On Fri, Mar 5, 2021 at 2:59 AM Dan Carpenter wrote: > > - if (sec_len > 0 && sec_len <= len) { > > + if (sec_len > 0 && > > + sec_len <= len && > > + sec_len <= 32) { > > I wonder if this could be reduced to (sec_len > 0 && sec_len <= > min(len, 32)) from a stylistic POV? I kind of prefer it the way I wrote it. I prefer conditions split apart and done ploddingly, one at a time... You'll notice how I could have written it like: if (sec_len > 0 && sec_len <= len && sec_len <= 32) { But I really like my conditions to be spelled out so the "sec_len" is perfectly aligned in each part of the condition. Your way would be to combine two conditions into one part of a line and seems sneaky. > > First attempt at something kernel related so I know there's plenty of > things to learn (including patterns for problems like this and > etiquette). It's good that you're reviewing code... We try to be predictable though and no one would have predicted your response. Ideally patch review should be like, "Ugh! Why didn't I think of that? Of course, we should propagate the error code." Or "Oh, I didn't know checkpatch warns about that." The truth is that I don't always agree with all of Greg's reviews. He is more strict than I am about breaking up patches into multiple things. (It's a tricky line to define for me). But I can always predict what Greg will say in a review so that saves time when I know which patches he will accept and which he won't. regards, dan carpenter From eantoranz at gmail.com Fri Mar 5 18:55:16 2021 From: eantoranz at gmail.com (Edmundo Carmona Antoranz) Date: Fri, 5 Mar 2021 12:55:16 -0600 Subject: [PATCH] staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan() In-Reply-To: <20210305183259.GE2087@kadam> References: <20210305183259.GE2087@kadam> Message-ID: On Fri, Mar 5, 2021 at 12:33 PM Dan Carpenter wrote: > > It's good that you're reviewing code... Right now watching the patches flow feels like I'm just shadowing. Later, when I get the hang of it, I might try providing something on my own. I'll just watch things from a distance for the time being perhaps making questions here or there (like I just did). Just in case, my main point was to use a min() (or MIN? whatever way it's provided in the standard) to have only two conditions instead of three... .to keep them on separate lines, it could be done like this: if (sec_len > 0 && sec_len <= min(len, 32)) { _but_ I understand if you would rather keep the 3 conditions. Thanks for your comment. From fabioaiuto83 at gmail.com Fri Mar 5 19:17:16 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Fri, 5 Mar 2021 20:17:16 +0100 Subject: [PATCH] staging: rtl8723bs: removed unused code block Message-ID: <20210305191713.GA2466@agape.jhs> Removed conditional code block checked by unused CONFIG_TX_BCAST2UNI This patch does the cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c index 1c23fbe58881..a89b88eaed39 100644 --- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c @@ -212,9 +212,6 @@ int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev) && check_fwstate(pmlmepriv, WIFI_AP_STATE) == true && (IP_MCAST_MAC(pkt->data) || ICMPV6_MCAST_MAC(pkt->data) - #ifdef CONFIG_TX_BCAST2UNI - || is_broadcast_mac_addr(pkt->data) - #endif ) && padapter->registrypriv.wifi_spec == 0) { if (pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME / 4)) { -- 2.20.1 From gabriele.modena at gmail.com Fri Mar 5 19:55:09 2021 From: gabriele.modena at gmail.com (gabriele.modena at gmail.com) Date: Fri, 5 Mar 2021 20:55:09 +0100 Subject: [PATCH] staging: wimax: fix style check warnings Message-ID: <20210305195508.3543-1-gabriele.modena@gmail.com> From: Gabriele Modena Fix style warnings reported by checkpatch.pl on op-rfkill.c by moving */ on a separate line in a block comment, adding a missing blank line after declarations, and reformatting a quoted string split across lines. Signed-off-by: Gabriele Modena --- drivers/staging/wimax/op-rfkill.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wimax/op-rfkill.c b/drivers/staging/wimax/op-rfkill.c index 78b294481a59..52612ed09183 100644 --- a/drivers/staging/wimax/op-rfkill.c +++ b/drivers/staging/wimax/op-rfkill.c @@ -294,7 +294,8 @@ int wimax_rfkill(struct wimax_dev *wimax_dev, enum wimax_rf_state state) /* While initializing, < 1.4.3 wimax-tools versions use * this call to check if the device is a valid WiMAX * device; so we allow it to proceed always, - * considering the radios are all off. */ + * considering the radios are all off. + */ if (result == -ENOMEDIUM && state == WIMAX_RF_QUERY) result = WIMAX_RF_OFF << 1 | WIMAX_RF_OFF; goto error_not_ready; @@ -378,6 +379,7 @@ int wimax_rfkill_add(struct wimax_dev *wimax_dev) void wimax_rfkill_rm(struct wimax_dev *wimax_dev) { struct device *dev = wimax_dev_to_dev(wimax_dev); + d_fnstart(3, dev, "(wimax_dev %p)\n", wimax_dev); rfkill_unregister(wimax_dev->rfkill); rfkill_destroy(wimax_dev->rfkill); @@ -415,8 +417,7 @@ int wimax_gnl_doit_rfkill(struct sk_buff *skb, struct genl_info *info) dev = wimax_dev_to_dev(wimax_dev); result = -EINVAL; if (info->attrs[WIMAX_GNL_RFKILL_STATE] == NULL) { - dev_err(dev, "WIMAX_GNL_RFKILL: can't find RFKILL_STATE " - "attribute\n"); + dev_err(dev, "WIMAX_GNL_RFKILL: can't find RFKILL_STATE attribute\n"); goto error_no_pid; } new_state = nla_get_u32(info->attrs[WIMAX_GNL_RFKILL_STATE]); -- 2.11.0 From ahmedhussein44660 at gmail.com Fri Mar 5 22:07:35 2021 From: ahmedhussein44660 at gmail.com (Ahmed) Date: Sat, 6 Mar 2021 05:07:35 +0700 Subject: Assist me purchase a living home Message-ID: <20210305220735.CBC73843B5@smtp1.osuosl.org> Assist me purchase a living home, .I have huge sum in financial institution .Should there be a need for an evidence, or a prove of my seriousness and genuineness. I have a Certificate of Deposit as a prove of fund. am from Syria, (where I can invest to sustain my living until the political crisis in my country is over).Could you please send me an email on ( ahmedhussein44660 at gmail.com ) to enable me know you have received my email. Ahmed Hussein From ahmedhussein44660 at gmail.com Fri Mar 5 22:11:28 2021 From: ahmedhussein44660 at gmail.com (Ahmed) Date: Sat, 6 Mar 2021 05:11:28 +0700 Subject: Assist me purchase a living home Message-ID: <20210305221129.0EA406EAA1@smtp3.osuosl.org> Assist me purchase a living home, .I have huge sum in financial institution .Should there be a need for an evidence, or a prove of my seriousness and genuineness. I have a Certificate of Deposit as a prove of fund. am from Syria, (where I can invest to sustain my living until the political crisis in my country is over).Could you please send me an email on ( ahmedhussein44660 at gmail.com ) to enable me know you have received my email. Ahmed Hussein From ahmedhussein44660 at gmail.com Fri Mar 5 22:13:26 2021 From: ahmedhussein44660 at gmail.com (Ahmed) Date: Sat, 6 Mar 2021 05:13:26 +0700 Subject: Assist me purchase a living home Message-ID: <20210305221326.F3DEF6F6CD@smtp3.osuosl.org> Assist me purchase a living home, .I have huge sum in financial institution .Should there be a need for an evidence, or a prove of my seriousness and genuineness. I have a Certificate of Deposit as a prove of fund. am from Syria, (where I can invest to sustain my living until the political crisis in my country is over).Could you please send me an email on ( ahmedhussein44660 at gmail.com ) to enable me know you have received my email. Ahmed Hussein From robh at kernel.org Fri Mar 5 22:47:56 2021 From: robh at kernel.org (Rob Herring) Date: Fri, 5 Mar 2021 16:47:56 -0600 Subject: [PATCH v9 2/6] dt: bindings: add mt7621-clk device tree binding documentation In-Reply-To: <20210218070709.11932-3-sergio.paracuellos@gmail.com> References: <20210218070709.11932-1-sergio.paracuellos@gmail.com> <20210218070709.11932-3-sergio.paracuellos@gmail.com> Message-ID: <20210305224756.GA777984@robh.at.kernel.org> On Thu, Feb 18, 2021 at 08:07:05AM +0100, Sergio Paracuellos wrote: > Adds device tree binding documentation for clocks in the > MT7621 SOC. > > Signed-off-by: Sergio Paracuellos > --- > .../bindings/clock/mediatek,mt7621-clk.yaml | 66 +++++++++++++++++++ > 1 file changed, 66 insertions(+) > create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt7621-clk.yaml > > diff --git a/Documentation/devicetree/bindings/clock/mediatek,mt7621-clk.yaml b/Documentation/devicetree/bindings/clock/mediatek,mt7621-clk.yaml > new file mode 100644 > index 000000000000..842a0f2c9d40 > --- /dev/null > +++ b/Documentation/devicetree/bindings/clock/mediatek,mt7621-clk.yaml > @@ -0,0 +1,66 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/clock/mediatek,mt7621-clk.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: MT7621 Clock Device Tree Bindings > + > +maintainers: > + - Sergio Paracuellos > + > +description: | > + The MT7621 has a PLL controller from where the cpu clock is provided > + as well as derived clocks for the bus and the peripherals. It also > + can gate SoC device clocks. > + > + Each clock is assigned an identifier and client nodes use this identifier > + to specify the clock which they consume. > + > + All these identifiers could be found in: > + [1]: . > + > +properties: > + compatible: > + const: mediatek,mt7621-clk > + > + "#clock-cells": > + description: > + The first cell indicates the clock number, see [1] for available > + clocks. > + const: 1 > + > + ralink,sysctl: > + $ref: /schemas/types.yaml#/definitions/phandle > + description: > + phandle of syscon used to control system registers > + > + ralink,memctl: > + $ref: /schemas/types.yaml#/definitions/phandle > + description: > + phandle of syscon used to control memory registers I assume one of these phandles are the main registers for the clocks? Make this a child node and drop that phandle. > + > + clock-output-names: > + maxItems: 8 > + > +required: > + - compatible > + - '#clock-cells' > + - ralink,sysctl > + - ralink,memctl > + > +additionalProperties: false > + > +examples: > + - | > + #include > + > + pll { > + compatible = "mediatek,mt7621-clk"; > + #clock-cells = <1>; > + ralink,sysctl = <&sysc>; > + ralink,memctl = <&memc>; > + clock-output-names = "xtal", "cpu", "bus", > + "50m", "125m", "150m", > + "250m", "270m"; > + }; > -- > 2.25.1 > From gch981213 at gmail.com Sat Mar 6 01:52:48 2021 From: gch981213 at gmail.com (Chuanhong Guo) Date: Sat, 6 Mar 2021 09:52:48 +0800 Subject: [PATCH v9 2/6] dt: bindings: add mt7621-clk device tree binding documentation In-Reply-To: <20210305224756.GA777984@robh.at.kernel.org> References: <20210218070709.11932-1-sergio.paracuellos@gmail.com> <20210218070709.11932-3-sergio.paracuellos@gmail.com> <20210305224756.GA777984@robh.at.kernel.org> Message-ID: Hi Rob! On Sat, Mar 6, 2021 at 6:48 AM Rob Herring wrote: > > On Thu, Feb 18, 2021 at 08:07:05AM +0100, Sergio Paracuellos wrote: > > Adds device tree binding documentation for clocks in the > > MT7621 SOC. > > > > Signed-off-by: Sergio Paracuellos > > --- > > .../bindings/clock/mediatek,mt7621-clk.yaml | 66 +++++++++++++++++++ > > 1 file changed, 66 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt7621-clk.yaml > > > > diff --git a/Documentation/devicetree/bindings/clock/mediatek,mt7621-clk.yaml b/Documentation/devicetree/bindings/clock/mediatek,mt7621-clk.yaml > > new file mode 100644 > > index 000000000000..842a0f2c9d40 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/clock/mediatek,mt7621-clk.yaml > > @@ -0,0 +1,66 @@ > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/clock/mediatek,mt7621-clk.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: MT7621 Clock Device Tree Bindings > > + > > +maintainers: > > + - Sergio Paracuellos > > + > > +description: | > > + The MT7621 has a PLL controller from where the cpu clock is provided > > + as well as derived clocks for the bus and the peripherals. It also > > + can gate SoC device clocks. > > + > > + Each clock is assigned an identifier and client nodes use this identifier > > + to specify the clock which they consume. > > + > > + All these identifiers could be found in: > > + [1]: . > > + > > +properties: > > + compatible: > > + const: mediatek,mt7621-clk > > + > > + "#clock-cells": > > + description: > > + The first cell indicates the clock number, see [1] for available > > + clocks. > > + const: 1 > > + > > + ralink,sysctl: > > + $ref: /schemas/types.yaml#/definitions/phandle > > + description: > > + phandle of syscon used to control system registers > > + > > + ralink,memctl: > > + $ref: /schemas/types.yaml#/definitions/phandle > > + description: > > + phandle of syscon used to control memory registers > > I assume one of these phandles are the main registers for the clocks? > Make this a child node and drop that phandle. On MT7621, CPU clock can be chosen from 3 sources: crystal clock, a fixed 500MHz clock or a clock created by the memory controller. sysctl contains a bootstrap register to determine crystal clock, a clock mux for choosing between the 3 sources for CPU clock, and a clock gate register for various peripherals. The ralink,memctl phandle here is to read the cpu clock frequency from the memory controller. The original implementation hides this hardware detail to avoid splitting the driver into three just for the CPU clock. Is this approach okay and we can put it under sysctl node, or this driver needs to be further splitted? -- Regards, Chuanhong Guo From rsalinas at gpms.gob.ec Sat Mar 6 00:43:43 2021 From: rsalinas at gpms.gob.ec (ADRIAN TONGSON) Date: Fri, 05 Mar 2021 16:43:43 -0800 Subject: donation of 3,500,000.00 Message-ID: <20210306004355.160931A39A4@mail.gpms.gob.ec> Best regards, You have a donation of 3,500,000.00 I have volunteered to donate an amount of 3,500,000.00 to one of the selected 5 people to help during this pandemic. Come back to argue. This is your donation code: [NJ005USA00035] Come back with a reply for your gift. I wish you a nice day. Adrian Tongson. From rsalinas at gpms.gob.ec Sat Mar 6 00:43:23 2021 From: rsalinas at gpms.gob.ec (ADRIAN TONGSON) Date: Fri, 05 Mar 2021 16:43:23 -0800 Subject: donation of 3,500,000.00 Message-ID: <20210306004335.A42161A02DA@mail.gpms.gob.ec> Best regards, You have a donation of 3,500,000.00 I have volunteered to donate an amount of 3,500,000.00 to one of the selected 5 people to help during this pandemic. Come back to argue. This is your donation code: [NJ005USA00035] Come back with a reply for your gift. I wish you a nice day. Adrian Tongson. From nabil.ibn.mahmud at gmail.com Sat Mar 6 06:38:17 2021 From: nabil.ibn.mahmud at gmail.com (nabil5352) Date: Sat, 6 Mar 2021 12:38:17 +0600 Subject: [PATCH] Staging: android: ashmem: fixed a struct without const Message-ID: <20210306063817.674041-1-nabil.ibn.mahmud@gmail.com> Fixed a struct without const Signed-off-by: nabil5352 --- drivers/staging/android/ashmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index d66a64e42273..7854fd410efa 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -376,7 +376,7 @@ ashmem_vmfile_get_unmapped_area(struct file *file, unsigned long addr, static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) { - static struct file_operations vmfile_fops; + static const struct file_operations vmfile_fops; struct ashmem_area *asma = file->private_data; int ret = 0; -- 2.25.1 From sergio.paracuellos at gmail.com Sat Mar 6 07:12:43 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Sat, 6 Mar 2021 08:12:43 +0100 Subject: [PATCH v9 2/6] dt: bindings: add mt7621-clk device tree binding documentation In-Reply-To: <20210305224756.GA777984@robh.at.kernel.org> References: <20210218070709.11932-1-sergio.paracuellos@gmail.com> <20210218070709.11932-3-sergio.paracuellos@gmail.com> <20210305224756.GA777984@robh.at.kernel.org> Message-ID: Hi Rob, On Fri, Mar 5, 2021 at 11:47 PM Rob Herring wrote: [snip] > > + > > + ralink,sysctl: > > + $ref: /schemas/types.yaml#/definitions/phandle > > + description: > > + phandle of syscon used to control system registers > > + > > + ralink,memctl: > > + $ref: /schemas/types.yaml#/definitions/phandle > > + description: > > + phandle of syscon used to control memory registers > > I assume one of these phandles are the main registers for the clocks? > Make this a child node and drop that phandle. The 'ralink,sysctl' phandle is to read bootstrap register to be able to derive xtal and a clk gate register for the peripherals. The 'ralink,memctl' phandle is to read the cpu clock frequency from the memory controller. So there is not "main registers". I already put this as a child node in v4 and I was told to get rid of child nodes. I need this as a regmap to other DT node registers (sysctl, and memctl) to be able to use the driver without specific architecture operations and properly enable for COMPILE_TEST without dirty Makefile arch flags. Both sysctl and memctl has no other child nodes, and I think that's why I was told to avoid child nodes at the end. I explained here [0] current sysctl and memctl in the mt7621 device tree and my view of the need for this two syscons: [0]: https://lkml.org/lkml/2021/1/2/9 So to avoid to send again "a previous version" on this patch, please guide me in the correct thing to do. Stephen, Rob, I will be really happy with your help :) Best regards, Sergio Paracuellos > > > + > > + clock-output-names: > > + maxItems: 8 > > + > > +required: > > + - compatible > > + - '#clock-cells' > > + - ralink,sysctl > > + - ralink,memctl > > + > > +additionalProperties: false > > + > > +examples: > > + - | > > + #include > > + > > + pll { > > + compatible = "mediatek,mt7621-clk"; > > + #clock-cells = <1>; > > + ralink,sysctl = <&sysc>; > > + ralink,memctl = <&memc>; > > + clock-output-names = "xtal", "cpu", "bus", > > + "50m", "125m", "150m", > > + "250m", "270m"; > > + }; > > -- > > 2.25.1 > > From straube.linux at gmail.com Sat Mar 6 08:11:32 2021 From: straube.linux at gmail.com (Michael Straube) Date: Sat, 6 Mar 2021 09:11:32 +0100 Subject: [PATCH 1/2] staging: rtl8188eu: rename ODM_PhyStatusQuery() Message-ID: <20210306081133.1272-1-straube.linux@gmail.com> Rename ODM_PhyStatusQuery() to odm_phy_status_query() to avoid camel case. Signed-off-by: Michael Straube --- drivers/staging/rtl8188eu/hal/odm_hwconfig.c | 6 +++--- drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c | 4 ++-- drivers/staging/rtl8188eu/include/odm_hwconfig.h | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/odm_hwconfig.c b/drivers/staging/rtl8188eu/hal/odm_hwconfig.c index 65a346ae3cb0..c5af0c559cba 100644 --- a/drivers/staging/rtl8188eu/hal/odm_hwconfig.c +++ b/drivers/staging/rtl8188eu/hal/odm_hwconfig.c @@ -385,9 +385,9 @@ static void odm_Process_RSSIForDM(struct odm_dm_struct *dm_odm, } /* Endianness before calling this API */ -void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm, - struct odm_phy_status_info *pPhyInfo, - u8 *pPhyStatus, struct odm_per_pkt_info *pPktinfo) +void odm_phy_status_query(struct odm_dm_struct *dm_odm, + struct odm_phy_status_info *pPhyInfo, + u8 *pPhyStatus, struct odm_per_pkt_info *pPktinfo) { odm_RxPhyStatus92CSeries_Parsing(dm_odm, pPhyInfo, pPhyStatus, pPktinfo); diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c index 7d0135fde795..0d06cb54b1ad 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c @@ -171,8 +171,8 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, pkt_info.StationID = psta->mac_id; pkt_info.Rate = pattrib->mcs_rate; - ODM_PhyStatusQuery(&padapter->HalData->odmpriv, pPHYInfo, - (u8 *)pphy_status, &(pkt_info)); + odm_phy_status_query(&padapter->HalData->odmpriv, pPHYInfo, + (u8 *)pphy_status, &(pkt_info)); precvframe->psta = NULL; if (pkt_info.bPacketMatchBSSID && diff --git a/drivers/staging/rtl8188eu/include/odm_hwconfig.h b/drivers/staging/rtl8188eu/include/odm_hwconfig.h index 2cd8a47a3673..dc86e4058eff 100644 --- a/drivers/staging/rtl8188eu/include/odm_hwconfig.h +++ b/drivers/staging/rtl8188eu/include/odm_hwconfig.h @@ -93,9 +93,9 @@ struct phy_status_rpt { #endif }; -void ODM_PhyStatusQuery(struct odm_dm_struct *pDM_Odm, - struct odm_phy_status_info *pPhyInfo, - u8 *pPhyStatus, - struct odm_per_pkt_info *pPktinfo); +void odm_phy_status_query(struct odm_dm_struct *pDM_Odm, + struct odm_phy_status_info *pPhyInfo, + u8 *pPhyStatus, + struct odm_per_pkt_info *pPktinfo); #endif -- 2.30.1 From straube.linux at gmail.com Sat Mar 6 08:11:33 2021 From: straube.linux at gmail.com (Michael Straube) Date: Sat, 6 Mar 2021 09:11:33 +0100 Subject: [PATCH 2/2] staging: rtl8188eu: rename parameters of odm_phy_status_query() In-Reply-To: <20210306081133.1272-1-straube.linux@gmail.com> References: <20210306081133.1272-1-straube.linux@gmail.com> Message-ID: <20210306081133.1272-2-straube.linux@gmail.com> Rename parameters of odm_phy_status_query() to avoid camel case. pDM_Odm -> dm_odm pPhyInfo -> phy_info pPhyStatus -> phy_status pPktinfo -> pkt_info Signed-off-by: Michael Straube --- drivers/staging/rtl8188eu/hal/odm_hwconfig.c | 9 ++++----- drivers/staging/rtl8188eu/include/odm_hwconfig.h | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/odm_hwconfig.c b/drivers/staging/rtl8188eu/hal/odm_hwconfig.c index c5af0c559cba..684b6cec0f09 100644 --- a/drivers/staging/rtl8188eu/hal/odm_hwconfig.c +++ b/drivers/staging/rtl8188eu/hal/odm_hwconfig.c @@ -386,13 +386,12 @@ static void odm_Process_RSSIForDM(struct odm_dm_struct *dm_odm, /* Endianness before calling this API */ void odm_phy_status_query(struct odm_dm_struct *dm_odm, - struct odm_phy_status_info *pPhyInfo, - u8 *pPhyStatus, struct odm_per_pkt_info *pPktinfo) + struct odm_phy_status_info *phy_info, + u8 *phy_status, struct odm_per_pkt_info *pkt_info) { - odm_RxPhyStatus92CSeries_Parsing(dm_odm, pPhyInfo, pPhyStatus, - pPktinfo); + odm_RxPhyStatus92CSeries_Parsing(dm_odm, phy_info, phy_status, pkt_info); if (dm_odm->RSSI_test) ;/* Select the packets to do RSSI checking for antenna switching. */ else - odm_Process_RSSIForDM(dm_odm, pPhyInfo, pPktinfo); + odm_Process_RSSIForDM(dm_odm, phy_info, pkt_info); } diff --git a/drivers/staging/rtl8188eu/include/odm_hwconfig.h b/drivers/staging/rtl8188eu/include/odm_hwconfig.h index dc86e4058eff..4f4d3cfb6c77 100644 --- a/drivers/staging/rtl8188eu/include/odm_hwconfig.h +++ b/drivers/staging/rtl8188eu/include/odm_hwconfig.h @@ -93,9 +93,9 @@ struct phy_status_rpt { #endif }; -void odm_phy_status_query(struct odm_dm_struct *pDM_Odm, - struct odm_phy_status_info *pPhyInfo, - u8 *pPhyStatus, - struct odm_per_pkt_info *pPktinfo); +void odm_phy_status_query(struct odm_dm_struct *dm_odm, + struct odm_phy_status_info *phy_info, + u8 *phy_status, + struct odm_per_pkt_info *pkt_info); #endif -- 2.30.1 From gregkh at linuxfoundation.org Sat Mar 6 08:20:53 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Sat, 6 Mar 2021 09:20:53 +0100 Subject: [PATCH] Staging: android: ashmem: fixed a struct without const In-Reply-To: <20210306063817.674041-1-nabil.ibn.mahmud@gmail.com> References: <20210306063817.674041-1-nabil.ibn.mahmud@gmail.com> Message-ID: On Sat, Mar 06, 2021 at 12:38:17PM +0600, nabil5352 wrote: > Fixed a struct without const > > Signed-off-by: nabil5352 > --- > drivers/staging/android/ashmem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c > index d66a64e42273..7854fd410efa 100644 > --- a/drivers/staging/android/ashmem.c > +++ b/drivers/staging/android/ashmem.c > @@ -376,7 +376,7 @@ ashmem_vmfile_get_unmapped_area(struct file *file, unsigned long addr, > > static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) > { > - static struct file_operations vmfile_fops; > + static const struct file_operations vmfile_fops; > struct ashmem_area *asma = file->private_data; > int ret = 0; > It's a bit rude to submit patches that you have not at the very least, tried to build before sending it out to us, right? Please always do so. greg k-h From sergio.paracuellos at gmail.com Sat Mar 6 09:54:11 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Sat, 6 Mar 2021 10:54:11 +0100 Subject: [PATCH v9 2/6] dt: bindings: add mt7621-clk device tree binding documentation In-Reply-To: References: <20210218070709.11932-1-sergio.paracuellos@gmail.com> <20210218070709.11932-3-sergio.paracuellos@gmail.com> <20210305224756.GA777984@robh.at.kernel.org> Message-ID: Hi again, On Sat, Mar 6, 2021 at 8:12 AM Sergio Paracuellos wrote: > > Hi Rob, > > On Fri, Mar 5, 2021 at 11:47 PM Rob Herring wrote: > [snip] > > > + > > > + ralink,sysctl: > > > + $ref: /schemas/types.yaml#/definitions/phandle > > > + description: > > > + phandle of syscon used to control system registers > > > + > > > + ralink,memctl: > > > + $ref: /schemas/types.yaml#/definitions/phandle > > > + description: > > > + phandle of syscon used to control memory registers > > > > I assume one of these phandles are the main registers for the clocks? > > Make this a child node and drop that phandle. > > The 'ralink,sysctl' phandle is to read bootstrap register to be able > to derive xtal and a clk gate register for the peripherals. > The 'ralink,memctl' phandle is to read the cpu clock frequency from > the memory controller. > > So there is not "main registers". I already put this as a child node > in v4 and I was told to get rid of child nodes. I need this as a > regmap to other DT node registers (sysctl, and memctl) to be able to > use the driver without specific architecture operations and properly > enable for COMPILE_TEST without dirty Makefile arch flags. Both sysctl > and memctl has no other child nodes, and I think that's why I was told > to avoid child nodes at the end. I explained here [0] current sysctl > and memctl in the mt7621 device tree and my view of the need for this > two syscons: > > [0]: https://lkml.org/lkml/2021/1/2/9 > > So to avoid to send again "a previous version" on this patch, please > guide me in the correct thing to do. Stephen, Rob, I will be really > happy with your help :) Since there are no other child nodes for this sysc, should merge clock properties with this node in the following way a valid approach: sysc: sysc at 0 { compatible = "mediatek,mt7621-sysc", "syscon"; reg = <0x0 0x100>; #clock-cells = <1>; ralink,memctl = <&memc>; clock-output-names = "xtal", "cpu", "bus", "50m", "125m", "150m", "250m", "270m"; }; Consumer clock: node: node at 0 { ... clocks = <&sysc MT7621_CLK_WHATEVER>; ... }; If that is the case... and since 'sysc' is used as system control registers for all the rest of the world, where should be the yaml file with bindings placed? Thanks in advance again for your help. Best regards, Sergio Paracuellos > > Best regards, > Sergio Paracuellos > > > > > + > > > + clock-output-names: > > > + maxItems: 8 > > > + > > > +required: > > > + - compatible > > > + - '#clock-cells' > > > + - ralink,sysctl > > > + - ralink,memctl > > > + > > > +additionalProperties: false > > > + > > > +examples: > > > + - | > > > + #include > > > + > > > + pll { > > > + compatible = "mediatek,mt7621-clk"; > > > + #clock-cells = <1>; > > > + ralink,sysctl = <&sysc>; > > > + ralink,memctl = <&memc>; > > > + clock-output-names = "xtal", "cpu", "bus", > > > + "50m", "125m", "150m", > > > + "250m", "270m"; > > > + }; > > > -- > > > 2.25.1 > > > From menglong8.dong at gmail.com Sat Mar 6 12:11:04 2021 From: menglong8.dong at gmail.com (menglong8.dong at gmail.com) Date: Sat, 6 Mar 2021 04:11:04 -0800 Subject: [PATCH] media:atomisp: remove duplicate include in sh_css Message-ID: <20210306121104.218696-1-zhang.yunkai@zte.com.cn> From: Zhang Yunkai 'ia_css_isys.h' included in 'sh_css.c' is duplicated. It is also included in the 30th line. Signed-off-by: Zhang Yunkai --- drivers/staging/media/atomisp/pci/sh_css.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index ddee04c8248d..afddc54094e9 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -49,9 +49,6 @@ #include "ia_css_pipe_util.h" #include "ia_css_pipe_binarydesc.h" #include "ia_css_pipe_stagedesc.h" -#ifndef ISP2401 -#include "ia_css_isys.h" -#endif #include "tag.h" #include "assert_support.h" -- 2.25.1 From baijiaju1990 at gmail.com Sat Mar 6 13:22:45 2021 From: baijiaju1990 at gmail.com (Jia-Ju Bai) Date: Sat, 6 Mar 2021 05:22:45 -0800 Subject: [PATCH] staging: vc04_services: vchiq_arm: fix error return code of vchiq_release_internal() and vchiq_use_internal() Message-ID: <20210306132245.16811-1-baijiaju1990@gmail.com> When arm_state is NULL, no error return code of vchiq_release_internal() and vchiq_use_internal() is assigned. To fix this bug, ret is assigned with VCHIQ_ERROR. Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai --- .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 59e45dc03a97..8b2b4771f420 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -2332,8 +2332,10 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service, int *entity_uc; int local_uc; - if (!arm_state) + if (!arm_state) { + ret = VCHIQ_ERROR; goto out; + } vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); @@ -2389,8 +2391,10 @@ vchiq_release_internal(struct vchiq_state *state, struct vchiq_service *service) char entity[16]; int *entity_uc; - if (!arm_state) + if (!arm_state) { + ret = VCHIQ_ERROR; goto out; + } vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); -- 2.17.1 From bobdc9664 at seznam.cz Sat Mar 6 14:13:22 2021 From: bobdc9664 at seznam.cz (Giovanni Gherdovich) Date: Sat, 6 Mar 2021 15:13:22 +0100 Subject: [PATCH] staging: ralink-gdma: Check return code of device_reset Message-ID: <20210306141322.7516-1-bobdc9664@seznam.cz> The device_reset() function is marked as "__must_check", thus the static analysis tool "sparse" complains that in ralink-gdma its return value is ignored. Log a warning in case it returns an error. Signed-off-by: Giovanni Gherdovich --- drivers/staging/ralink-gdma/ralink-gdma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/ralink-gdma/ralink-gdma.c b/drivers/staging/ralink-gdma/ralink-gdma.c index 655df317d0ee..3c26b665ee7c 100644 --- a/drivers/staging/ralink-gdma/ralink-gdma.c +++ b/drivers/staging/ralink-gdma/ralink-gdma.c @@ -833,7 +833,9 @@ static int gdma_dma_probe(struct platform_device *pdev) return ret; } - device_reset(&pdev->dev); + ret = device_reset(&pdev->dev); + if (ret) + dev_err(&pdev->dev, "failed to reset: %d\n", ret); dd = &dma_dev->ddev; dma_cap_set(DMA_MEMCPY, dd->cap_mask); -- 2.26.2 From greg at kroah.com Sat Mar 6 17:26:05 2021 From: greg at kroah.com (Greg KH) Date: Sat, 6 Mar 2021 18:26:05 +0100 Subject: [PATCH] staging: wimax: fix style check warnings In-Reply-To: <20210305195508.3543-1-gabriele.modena@gmail.com> References: <20210305195508.3543-1-gabriele.modena@gmail.com> Message-ID: On Fri, Mar 05, 2021 at 08:55:09PM +0100, gabriele.modena at gmail.com wrote: > From: Gabriele Modena > > Fix style warnings reported by checkpatch.pl on op-rfkill.c > by moving */ on a separate line in a block comment, > adding a missing blank line after declarations, > and reformatting a quoted string split across lines. > > Signed-off-by: Gabriele Modena > --- > drivers/staging/wimax/op-rfkill.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/wimax/op-rfkill.c b/drivers/staging/wimax/op-rfkill.c > index 78b294481a59..52612ed09183 100644 > --- a/drivers/staging/wimax/op-rfkill.c > +++ b/drivers/staging/wimax/op-rfkill.c > @@ -294,7 +294,8 @@ int wimax_rfkill(struct wimax_dev *wimax_dev, enum wimax_rf_state state) > /* While initializing, < 1.4.3 wimax-tools versions use > * this call to check if the device is a valid WiMAX > * device; so we allow it to proceed always, > - * considering the radios are all off. */ > + * considering the radios are all off. > + */ > if (result == -ENOMEDIUM && state == WIMAX_RF_QUERY) > result = WIMAX_RF_OFF << 1 | WIMAX_RF_OFF; > goto error_not_ready; > @@ -378,6 +379,7 @@ int wimax_rfkill_add(struct wimax_dev *wimax_dev) > void wimax_rfkill_rm(struct wimax_dev *wimax_dev) > { > struct device *dev = wimax_dev_to_dev(wimax_dev); > + > d_fnstart(3, dev, "(wimax_dev %p)\n", wimax_dev); > rfkill_unregister(wimax_dev->rfkill); > rfkill_destroy(wimax_dev->rfkill); > @@ -415,8 +417,7 @@ int wimax_gnl_doit_rfkill(struct sk_buff *skb, struct genl_info *info) > dev = wimax_dev_to_dev(wimax_dev); > result = -EINVAL; > if (info->attrs[WIMAX_GNL_RFKILL_STATE] == NULL) { > - dev_err(dev, "WIMAX_GNL_RFKILL: can't find RFKILL_STATE " > - "attribute\n"); > + dev_err(dev, "WIMAX_GNL_RFKILL: can't find RFKILL_STATE attribute\n"); > goto error_no_pid; > } > new_state = nla_get_u32(info->attrs[WIMAX_GNL_RFKILL_STATE]); > -- > 2.11.0 > > _______________________________________________ > devel mailing list > devel at linuxdriverproject.org > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - Your patch did many different things all at once, making it difficult to review. All Linux kernel patches need to only do one thing at a time. If you need to do multiple things (such as clean up all coding style issues in a file/driver), do it in a sequence of patches, each one doing only one thing. This will make it easier to review the patches to ensure that they are correct, and to help alleviate any merge issues that larger patches can cause. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot From robh at kernel.org Sat Mar 6 20:20:22 2021 From: robh at kernel.org (Rob Herring) Date: Sat, 6 Mar 2021 13:20:22 -0700 Subject: [PATCH v10 8/9] dt-bindings: add documentation of xilinx clocking wizard In-Reply-To: <1614172241-17326-9-git-send-email-shubhrajyoti.datta@xilinx.com> References: <1614172241-17326-1-git-send-email-shubhrajyoti.datta@xilinx.com> <1614172241-17326-9-git-send-email-shubhrajyoti.datta@xilinx.com> Message-ID: <20210306202022.GA1146983@robh.at.kernel.org> On Wed, Feb 24, 2021 at 06:40:40PM +0530, Shubhrajyoti Datta wrote: > Add the devicetree binding for the xilinx clocking wizard. > > Signed-off-by: Shubhrajyoti Datta > --- > v6: > Fix a yaml warning > v7: > Add vendor prefix speed-grade > v8: > Fix the warnings > v10: > Add nr-outputs > > .../bindings/clock/xlnx,clocking-wizard.yaml | 72 ++++++++++++++++++++++ > 1 file changed, 72 insertions(+) > create mode 100644 Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml > > diff --git a/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml b/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml > new file mode 100644 > index 0000000..280eb09 > --- /dev/null > +++ b/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml > @@ -0,0 +1,72 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: "http://devicetree.org/schemas/clock/xlnx,clocking-wizard.yaml#" > +$schema: "http://devicetree.org/meta-schemas/core.yaml#" > + > +title: Xilinx clocking wizard > + > +maintainers: > + - Shubhrajyoti Datta > + > +description: > + The clocking wizard is a soft ip clocking block of Xilinx versal. It > + reads required input clock frequencies from the devicetree and acts as clock > + clock output. > + > +properties: > + compatible: > + const: xlnx,clocking-wizard Not very specific. Only 1 version of this h/w? > + > + reg: > + maxItems: 1 > + > + "#clock-cells": > + const: 1 > + > + clocks: > + items: > + - description: clock input > + - description: axi clock > + > + clock-names: > + items: > + - const: clk_in1 > + - const: s_axi_aclk > + > + > + xlnx,speed-grade: > + $ref: /schemas/types.yaml#/definitions/uint32 > + enum: [1, 2, 3] > + description: > + Speed grade of the device. Higher the speed grade faster is the FPGA device. How does one decide what value? > + > + nr-outputs: xlnx,nr-outputs > + $ref: /schemas/types.yaml#/definitions/uint32 > + enum: [1, 2, 3, 4, 5, 6, 7, 8] minimum: 1 maximum: 8 > + description: > + Number of outputs. > + > +required: > + - compatible > + - reg > + - "#clock-cells" > + - clocks > + - clock-names > + - xlnx,speed-grade > + - nr-outputs > + > +additionalProperties: false > + > +examples: > + - | > + wizard at b0000000 { clock-controller at ... > + compatible = "xlnx,clocking-wizard"; > + reg = <0xb0000000 0x10000>; > + #clock-cells = <1>; > + xlnx,speed-grade = <1>; > + nr-outputs = <6>; > + clock-names = "clk_in1", "s_axi_aclk"; > + clocks = <&clkc 15>, <&clkc 15>; > + }; > +... > -- > 2.1.1 > From lkp at intel.com Sun Mar 7 06:18:03 2021 From: lkp at intel.com (kernel test robot) Date: Sun, 7 Mar 2021 14:18:03 +0800 Subject: [PATCH] Staging: android: ashmem: fixed a struct without const In-Reply-To: <20210306063817.674041-1-nabil.ibn.mahmud@gmail.com> References: <20210306063817.674041-1-nabil.ibn.mahmud@gmail.com> Message-ID: <202103071426.PzUgoa20-lkp@intel.com> Hi nabil5352, Thank you for the patch! Yet something to improve: [auto build test ERROR on staging/staging-testing] url: https://github.com/0day-ci/linux/commits/nabil5352/Staging-android-ashmem-fixed-a-struct-without-const/20210307-103559 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 4e1c5d4c35d8d5a5f861019f1392ebaa0abb490b config: x86_64-randconfig-m001-20210307 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/4847faabe2fac6d0cf216c0d7ad02e0a263945b4 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review nabil5352/Staging-android-ashmem-fixed-a-struct-without-const/20210307-103559 git checkout 4847faabe2fac6d0cf216c0d7ad02e0a263945b4 # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): drivers/staging/android/ashmem.c: In function 'ashmem_mmap': >> drivers/staging/android/ashmem.c:430:16: error: assignment of read-only variable 'vmfile_fops' 430 | vmfile_fops = *vmfile->f_op; | ^ >> drivers/staging/android/ashmem.c:431:21: error: assignment of member 'mmap' in read-only object 431 | vmfile_fops.mmap = ashmem_vmfile_mmap; | ^ >> drivers/staging/android/ashmem.c:432:34: error: assignment of member 'get_unmapped_area' in read-only object 432 | vmfile_fops.get_unmapped_area = | ^ vim +/vmfile_fops +430 drivers/staging/android/ashmem.c 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 376 11980c2ac4ccfa Robert Love 2011-12-20 377 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) 11980c2ac4ccfa Robert Love 2011-12-20 378 { 4847faabe2fac6 nabil5352 2021-03-06 379 static const struct file_operations vmfile_fops; 11980c2ac4ccfa Robert Love 2011-12-20 380 struct ashmem_area *asma = file->private_data; 11980c2ac4ccfa Robert Love 2011-12-20 381 int ret = 0; 11980c2ac4ccfa Robert Love 2011-12-20 382 11980c2ac4ccfa Robert Love 2011-12-20 383 mutex_lock(&ashmem_mutex); 11980c2ac4ccfa Robert Love 2011-12-20 384 11980c2ac4ccfa Robert Love 2011-12-20 385 /* user needs to SET_SIZE before mapping */ 59848d6aded59a Alistair Strachan 2018-06-19 386 if (!asma->size) { 11980c2ac4ccfa Robert Love 2011-12-20 387 ret = -EINVAL; 11980c2ac4ccfa Robert Love 2011-12-20 388 goto out; 11980c2ac4ccfa Robert Love 2011-12-20 389 } 11980c2ac4ccfa Robert Love 2011-12-20 390 8632c614565d0c Alistair Strachan 2018-06-19 391 /* requested mapping size larger than object size */ 8632c614565d0c Alistair Strachan 2018-06-19 392 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) { 11980c2ac4ccfa Robert Love 2011-12-20 393 ret = -EINVAL; 11980c2ac4ccfa Robert Love 2011-12-20 394 goto out; 11980c2ac4ccfa Robert Love 2011-12-20 395 } 11980c2ac4ccfa Robert Love 2011-12-20 396 11980c2ac4ccfa Robert Love 2011-12-20 397 /* requested protection bits must match our allowed protection mask */ 59848d6aded59a Alistair Strachan 2018-06-19 398 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) & 59848d6aded59a Alistair Strachan 2018-06-19 399 calc_vm_prot_bits(PROT_MASK, 0)) { 11980c2ac4ccfa Robert Love 2011-12-20 400 ret = -EPERM; 11980c2ac4ccfa Robert Love 2011-12-20 401 goto out; 11980c2ac4ccfa Robert Love 2011-12-20 402 } 56f76fc68492af Arve Hj?nnev?g 2011-12-20 403 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask); 11980c2ac4ccfa Robert Love 2011-12-20 404 11980c2ac4ccfa Robert Love 2011-12-20 405 if (!asma->file) { 11980c2ac4ccfa Robert Love 2011-12-20 406 char *name = ASHMEM_NAME_DEF; 11980c2ac4ccfa Robert Love 2011-12-20 407 struct file *vmfile; 3e338d3c95c735 Suren Baghdasaryan 2020-07-30 408 struct inode *inode; 11980c2ac4ccfa Robert Love 2011-12-20 409 11980c2ac4ccfa Robert Love 2011-12-20 410 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0') 11980c2ac4ccfa Robert Love 2011-12-20 411 name = asma->name; 11980c2ac4ccfa Robert Love 2011-12-20 412 11980c2ac4ccfa Robert Love 2011-12-20 413 /* ... and allocate the backing shmem file */ 11980c2ac4ccfa Robert Love 2011-12-20 414 vmfile = shmem_file_setup(name, asma->size, vma->vm_flags); 7f44cb0ba88b40 Viresh Kumar 2015-07-31 415 if (IS_ERR(vmfile)) { 11980c2ac4ccfa Robert Love 2011-12-20 416 ret = PTR_ERR(vmfile); 11980c2ac4ccfa Robert Love 2011-12-20 417 goto out; 11980c2ac4ccfa Robert Love 2011-12-20 418 } 97fbfef6bd5978 Shuxiao Zhang 2017-04-06 419 vmfile->f_mode |= FMODE_LSEEK; 3e338d3c95c735 Suren Baghdasaryan 2020-07-30 420 inode = file_inode(vmfile); 3e338d3c95c735 Suren Baghdasaryan 2020-07-30 421 lockdep_set_class(&inode->i_rwsem, &backing_shmem_inode_class); 11980c2ac4ccfa Robert Love 2011-12-20 422 asma->file = vmfile; 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 423 /* 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 424 * override mmap operation of the vmfile so that it can't be 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 425 * remapped which would lead to creation of a new vma with no 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 426 * asma permission checks. Have to override get_unmapped_area 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 427 * as well to prevent VM_BUG_ON check for f_ops modification. 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 428 */ 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 429 if (!vmfile_fops.mmap) { 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @430 vmfile_fops = *vmfile->f_op; 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @431 vmfile_fops.mmap = ashmem_vmfile_mmap; 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @432 vmfile_fops.get_unmapped_area = 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 433 ashmem_vmfile_get_unmapped_area; 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 434 } 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 435 vmfile->f_op = &vmfile_fops; 11980c2ac4ccfa Robert Love 2011-12-20 436 } 11980c2ac4ccfa Robert Love 2011-12-20 437 get_file(asma->file); 11980c2ac4ccfa Robert Love 2011-12-20 438 11980c2ac4ccfa Robert Love 2011-12-20 439 /* 11980c2ac4ccfa Robert Love 2011-12-20 440 * XXX - Reworked to use shmem_zero_setup() instead of 11980c2ac4ccfa Robert Love 2011-12-20 441 * shmem_set_file while we're in staging. -jstultz 11980c2ac4ccfa Robert Love 2011-12-20 442 */ 11980c2ac4ccfa Robert Love 2011-12-20 443 if (vma->vm_flags & VM_SHARED) { 11980c2ac4ccfa Robert Love 2011-12-20 444 ret = shmem_zero_setup(vma); 11980c2ac4ccfa Robert Love 2011-12-20 445 if (ret) { 11980c2ac4ccfa Robert Love 2011-12-20 446 fput(asma->file); 11980c2ac4ccfa Robert Love 2011-12-20 447 goto out; 11980c2ac4ccfa Robert Love 2011-12-20 448 } 44960f2a7b63e2 John Stultz 2018-07-31 449 } else { 44960f2a7b63e2 John Stultz 2018-07-31 450 vma_set_anonymous(vma); 11980c2ac4ccfa Robert Love 2011-12-20 451 } 11980c2ac4ccfa Robert Love 2011-12-20 452 295992fb815e79 Christian K?nig 2020-09-14 453 vma_set_file(vma, asma->file); 295992fb815e79 Christian K?nig 2020-09-14 454 /* XXX: merge this with the get_file() above if possible */ 295992fb815e79 Christian K?nig 2020-09-14 455 fput(asma->file); 11980c2ac4ccfa Robert Love 2011-12-20 456 11980c2ac4ccfa Robert Love 2011-12-20 457 out: 11980c2ac4ccfa Robert Love 2011-12-20 458 mutex_unlock(&ashmem_mutex); 11980c2ac4ccfa Robert Love 2011-12-20 459 return ret; 11980c2ac4ccfa Robert Love 2011-12-20 460 } 11980c2ac4ccfa Robert Love 2011-12-20 461 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/gzip Size: 30002 bytes Desc: not available URL: From sergio.paracuellos at gmail.com Sun Mar 7 06:27:24 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Sun, 7 Mar 2021 07:27:24 +0100 Subject: [PATCH v9 2/6] dt: bindings: add mt7621-clk device tree binding documentation In-Reply-To: References: <20210218070709.11932-1-sergio.paracuellos@gmail.com> <20210218070709.11932-3-sergio.paracuellos@gmail.com> <20210305224756.GA777984@robh.at.kernel.org> Message-ID: Hi, On Sat, Mar 6, 2021 at 10:54 AM Sergio Paracuellos wrote: > > Hi again, > > On Sat, Mar 6, 2021 at 8:12 AM Sergio Paracuellos > wrote: > > > > Hi Rob, > > > > On Fri, Mar 5, 2021 at 11:47 PM Rob Herring wrote: > > [snip] > > > > + > > > > + ralink,sysctl: > > > > + $ref: /schemas/types.yaml#/definitions/phandle > > > > + description: > > > > + phandle of syscon used to control system registers > > > > + > > > > + ralink,memctl: > > > > + $ref: /schemas/types.yaml#/definitions/phandle > > > > + description: > > > > + phandle of syscon used to control memory registers > > > > > > I assume one of these phandles are the main registers for the clocks? > > > Make this a child node and drop that phandle. > > > > The 'ralink,sysctl' phandle is to read bootstrap register to be able > > to derive xtal and a clk gate register for the peripherals. > > The 'ralink,memctl' phandle is to read the cpu clock frequency from > > the memory controller. > > > > So there is not "main registers". I already put this as a child node > > in v4 and I was told to get rid of child nodes. I need this as a > > regmap to other DT node registers (sysctl, and memctl) to be able to > > use the driver without specific architecture operations and properly > > enable for COMPILE_TEST without dirty Makefile arch flags. Both sysctl > > and memctl has no other child nodes, and I think that's why I was told > > to avoid child nodes at the end. I explained here [0] current sysctl > > and memctl in the mt7621 device tree and my view of the need for this > > two syscons: > > > > [0]: https://lkml.org/lkml/2021/1/2/9 > > > > So to avoid to send again "a previous version" on this patch, please > > guide me in the correct thing to do. Stephen, Rob, I will be really > > happy with your help :) > > Since there are no other child nodes for this sysc, should merge clock > properties > with this node in the following way a valid approach: > > sysc: sysc at 0 { > compatible = "mediatek,mt7621-sysc", "syscon"; > reg = <0x0 0x100>; > #clock-cells = <1>; > ralink,memctl = <&memc>; > clock-output-names = "xtal", "cpu", "bus", > "50m", "125m", "150m", > "250m", "270m"; > }; > > Consumer clock: > > node: node at 0 { > ... > clocks = <&sysc MT7621_CLK_WHATEVER>; > ... > }; I have been reviewing bindings review comments along the time and I was already suggested to do this I am saying here (see [0]) but my mind seems that filtered it for any reason I don't really understand. Maybe I should sleep a bit more :). I will send v10 with these changes that hopefully will be the correct ones. Thanks and sorry for bothering you with already suggested things. Best regards, Sergio Paracuellos [0]: https://lkml.org/lkml/2020/12/31/206 > > If that is the case... and since 'sysc' is used as system control > registers for all the rest of the world, where should be the yaml file > with bindings placed? > > Thanks in advance again for your help. > > Best regards, > Sergio Paracuellos > > > > > Best regards, > > Sergio Paracuellos > > > > > > > + > > > > + clock-output-names: > > > > + maxItems: 8 > > > > + > > > > +required: > > > > + - compatible > > > > + - '#clock-cells' > > > > + - ralink,sysctl > > > > + - ralink,memctl > > > > + > > > > +additionalProperties: false > > > > + > > > > +examples: > > > > + - | > > > > + #include > > > > + > > > > + pll { > > > > + compatible = "mediatek,mt7621-clk"; > > > > + #clock-cells = <1>; > > > > + ralink,sysctl = <&sysc>; > > > > + ralink,memctl = <&memc>; > > > > + clock-output-names = "xtal", "cpu", "bus", > > > > + "50m", "125m", "150m", > > > > + "250m", "270m"; > > > > + }; > > > > -- > > > > 2.25.1 > > > > From sergio.paracuellos at gmail.com Sun Mar 7 07:04:22 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Sun, 7 Mar 2021 08:04:22 +0100 Subject: [PATCH v10 2/6] dt: bindings: add mt7621-sysc device tree binding documentation In-Reply-To: <20210307070426.15933-1-sergio.paracuellos@gmail.com> References: <20210307070426.15933-1-sergio.paracuellos@gmail.com> Message-ID: <20210307070426.15933-3-sergio.paracuellos@gmail.com> Adds device tree binding documentation for clocks in the MT7621 SOC. Signed-off-by: Sergio Paracuellos --- .../bindings/clock/mediatek,mt7621-sysc.yaml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml diff --git a/Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml b/Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml new file mode 100644 index 000000000000..ef2d71b23ba0 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml @@ -0,0 +1,68 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/mediatek,mt7621-sysc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MT7621 Clock Device Tree Bindings + +maintainers: + - Sergio Paracuellos + +description: | + The MT7621 has a PLL controller from where the cpu clock is provided + as well as derived clocks for the bus and the peripherals. It also + can gate SoC device clocks. + + Each clock is assigned an identifier and client nodes use this identifier + to specify the clock which they consume. + + All these identifiers could be found in: + [1]: . + + The clocks are provided inside a system controller node. + +properties: + compatible: + items: + - const: mediatek,mt7621-sysc + - const: syscon + + reg: + maxItems: 1 + + "#clock-cells": + description: + The first cell indicates the clock number, see [1] for available + clocks. + const: 1 + + ralink,memctl: + $ref: /schemas/types.yaml#/definitions/phandle + description: + phandle of syscon used to control memory registers + + clock-output-names: + maxItems: 8 + +required: + - compatible + - reg + - '#clock-cells' + - ralink,memctl + +additionalProperties: false + +examples: + - | + #include + + sysc: sysc at 0 { + compatible = "mediatek,mt7621-sysc", "syscon"; + reg = <0x0 0x100>; + #clock-cells = <1>; + ralink,memctl = <&memc>; + clock-output-names = "xtal", "cpu", "bus", + "50m", "125m", "150m", + "250m", "270m"; + }; -- 2.25.1 From sergio.paracuellos at gmail.com Sun Mar 7 07:04:20 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Sun, 7 Mar 2021 08:04:20 +0100 Subject: [PATCH v10 0/6] MIPS: ralink: add CPU clock detection and clock driver for MT7621 Message-ID: <20210307070426.15933-1-sergio.paracuellos@gmail.com> This patchset ports CPU clock detection for MT7621 from OpenWrt and adds a complete clock plan for the mt7621 SOC. The documentation for this SOC only talks about two registers regarding to the clocks: * SYSC_REG_CPLL_CLKCFG0 - provides some information about boostrapped refclock. PLL and dividers used for CPU and some sort of BUS (AHB?). * SYSC_REG_CPLL_CLKCFG1 - a banch of gates to enable/disable clocks for all or some ip cores. Registers needed for this driver to work are in two already mapped areas in its platform's device tree. These are 'sysc' and 'memc' nodes. Most of other drivers just make use of platform operations defined in 'asm/mach-ralink/ralink_regs.h' but this can be avoided declaring this two nodes to be accesible through syscon. Main registers for the clocks are in the sysc control node so this node is merged with clock properties and will also be the clock provider for the SoC. No documentation about a probably existent set of dividers for each ip core is included in the datasheets. So we cannot make anything better, AFAICT. Looking into driver code, and some openWRT patched there are another frequences which are used in some drivers (uart, sd...). According to all of this information the clock plan for this SoC is set as follows: - Main top clock "xtal" from where all the rest of the world is derived. - CPU clock "cpu" derived from "xtal" frequencies and a bunch of register reads and predividers. - BUS clock "bus" derived from "cpu" and with (cpu / 4) MHz. - Fixed clocks from "xtal": * "50m": 50 MHz. * "125m": 125 MHz. * "150m": 150 MHz. * "250m": 250 MHz. * "270m": 270 MHz. We also have a buch of gate clocks with their parents: - "hsdma": "150m" - "fe": "250m" - "sp_divtx": "270m" - "timer": "50m" - "pcm": "270m" - "pio": "50m" - "gdma": "bus" - "nand": "125m" - "i2c": "50m" - "i2s": "270m" - "spi": "bus" - "uart1": "50m" - "uart2": "50m" - "uart3": "50m" - "eth": "50m" - "pcie0": "125m" - "pcie1": "125m" - "pcie2": "125m" - "crypto": "250m" - "shxc": "50m" There was a previous attempt of doing this here[0] but the author (Chuanhong Guo) did not wanted to make assumptions of a clock plan for the platform that time. It seems that now he has a better idea of how the clocks are dispossed for this SoC so he share code[1] where some frequencies and clock parents for the gates are coded from a real mediatek private clock plan. I do really want this to be upstreamed so according to the comments in previous attempt[0] from Oleksij Rempel and the frequencies in code[1] I have tried to do this by myself. All of this patches have been tested in a GNUBee PC1 resulting in a working platform. Changes in v10: - Merge clock properties into 'sysc' system control node making this node a clock provider. - Update driver to use 'mediatek,mt7621-sysc' as compatible string. - Update documentation bindings and its related filename to 'mediatek,mt7621-sysc.yaml'. - Make use of 'linux/bitfields.h' header to avoid some preprocesor shift definitions and just use bit masks decreasing a bit LOC. Changes in v9: - Set two missing ret values to its related PTR_ERR in function 'mt7621_clk_probe' (also related with [3]). - Select MFC_SYSCON in Kconfig. Changes in v8: - Fix kernel test robot complain about the use of 'ret' variable initialized: see [3] Changes in v7: - Make use of CLK_OF_DECLARE_DRIVER instead of CLK_OF_DECLARE and register there only the top clocks that are needed in 'of_clk_init'. The rest of the clocks (fixed and gates) are now registered using a platform driver. Because we have avoid architecture dependent stuff now this has sense because we can enable this driver for COMPILE_TEST. - Convert fixed clocks and gates related function to receive a 'struct device' pointer instead of 'struct device_node' one. - Make use of dev_ APIS in stuff related with platform driver instead of use device_node related stuff. - Add new static global 'mt7621_clk_early' to store pointers to clk_hw registered at 'of_clk_init' stage. Make use of this in platform device probe function to properly copy this into the new required 'clk_data' to provide a properly hierarchy clock structure. - Rename 'mt7621_register_top_clocks' function into a more accurate name now which is 'mt7621_register_early_clocks'. - Enable driver for COMPILE_TEST. Changes in v6: - Rewrite bindings to properly access the registers needed for the driver making use of syscon for two different areas: 'sysc' and 'memc'. With this changes architecture dependent include 'asm/mach-ralink/ralink_regs.h' is not needed anymore because we access this two syscons using a phandle through kernel's regmap APIs. Explanation of this two areas is in [2]. - Add new 'mt7621_clk_priv' struct to store there pointers to regmap handlers to be able to use regmap operations from normal clock api functions. Add this pointer in 'mt7621_clk' and 'mt7621_clk_gate' before register its related clocks to make things work. - Add Greg's Acked-by in patches 4 and 5. - Rebase this series on the top of linux-next tag 'next-20210215'. v5 RESEND notes: - I am resending this as I was told to do that. - Please, take into account Rob's comments to DT node patch and my reply with explanation about how are the current device tree nodes for this architecture being used in [2]. Changes in v5: - Avoid the use of syscon. All drivers of this platform are just using platform operations defined in 'asm/mach-ralink/ralink_regs.h'. We also need them for some PLL registers that are not in the sys control area. Hence, since we must use this dependency avoid to define clock driver as a child of the sysc node in the device tree and follow current platform code style. - Update bindings documentation to don't refer the syscon and make remove 'clock-output-names' property from required ones. - Use 'asm/mach-ralink/ralink_regs.h' platform read and write operations instead of regmap from the syscon node. - Remove 'mt7621_clk_provider' and directly declare 'clk_hw_onecell_data' pointer in 'mt7621_clk_init' and pass from there into different register functions. Remove pointers to 'mt7621_clk_provider' in the rest fo structs used in this driver. - Remove MHZ macro and just pass values directly in hertzs. - Avoid 'CLK_IGNORE_UNUSED' flag for gates and add a new function called 'mt7621_prepare_enable_clocks' to prepare all of them to make clocks referenced and don't affect current driver code. - Remove COMPILE_TEST from Kconfig because of the use of especific arch stuff. - Fix commit message where a typo for "frequencies" word was present. - Make use of parent_clk_data in 'CLK_BASE' macro. - Remove MODULE_* macros from code since this is not a module. - Remove not needed includes. - Hardcode "xtal" as parent in FIXED macro. - Change 'else if' clause into 'if' clause since a return statement was being used in 'mt7621_xtal_recalc_rate'. NOTES: - Driver is still being declared using 'CLK_OF_DECLARE' for all the clocks. I have explored the possibility to make some of them available afterwards using 'CLK_OF_DECLARE_DRIVER' for top clocks and the rest using a platform driver. The resulting code was uglier since we only want to use the same device tree node and the top clocks must be copied again for the new platform register stuff to properly have a good hierarchy. New globals needs to be introduced and in this particular case I don't really see the benefits of doing in this way. I am totally ok to have all the clocks registered at early stage since from other drivers perspective we only really need to enable gates. So, I prefer to have them in that way if it is not a real problem, of course. Changes in v4: - Add Acked-by from Rob Herring for binding headers (PATCH 1/6). - Convert bindings to not use syscon phandle and declare clock as a child of the syscon node. Update device tree and binding doc accordly. - Make use of 'syscon_node_to_regmap' in driver code instead of get this using the phandle function. - Properly unregister clocks for the error path of the function 'mt7621_clk_init'. - Include ARRAY_SIZE of fixed clocks in the 'count' to kzalloc of 'clk_data'. - Add new patch changing invalid vendor 'mtk' in favour of 'mediatek' which is the one listed in 'vendor-prefixes.yaml'. Update mt7621 code accordly. I have added this patch inside this series because clk binding is referring syscon node and the string for that node was with not listed vendor. Hence update and have all of this correct in the same series. Changes in v3: - Fix compilation warnings reported by kernel test robot because of ignoring return values of 'of_clk_hw_register' in functions 'mt7621_register_top_clocks' and 'mt7621_gate_ops_init'. - Fix dts file and binding documentation 'clock-output-names'. Changes in v2: - Remove the following patches: * dt: bindings: add mt7621-pll device tree binding documentation. * MIPS: ralink: add clock device providing cpu/ahb/apb clock for mt7621. - Move all relevant clock code to 'drivers/clk/ralink/clk-mt7621.c' and unify there previous 'mt7621-pll' and 'mt7621-clk' into a unique driver and binding 'mt7621-clk'. - Driver is not a platform driver anymore and now make use of 'CLK_OF_DECLARE' because we need clocks available in 'plat_time_init' before setting up the timer for the GIC. - Use new fixed clocks as parents for different gates and deriving from 'xtal' using frequencies in[1]. - Adapt dts file and bindings header and documentation for new changes. - Change MAINTAINERS file to only contains clk-mt7621.c code and mediatek,mt7621-clk.yaml file. [0]: https://www.lkml.org/lkml/2019/7/23/1044 [1]: https://github.com/981213/linux/commit/2eca1f045e4c3db18c941135464c0d7422ad8133 [2]: https://lkml.org/lkml/2020/12/20/47 [3]: http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2021-February/150772.html Sergio Paracuellos (6): dt-bindings: clock: add dt binding header for mt7621 clocks dt: bindings: add mt7621-sysc device tree binding documentation clk: ralink: add clock driver for mt7621 SoC staging: mt7621-dts: make use of new 'mt7621-clk' staging: mt7621-dts: use valid vendor 'mediatek' instead of invalid 'mtk' MAINTAINERS: add MT7621 CLOCK maintainer .../bindings/clock/mediatek,mt7621-sysc.yaml | 68 +++ MAINTAINERS | 6 + arch/mips/ralink/mt7621.c | 6 +- drivers/clk/Kconfig | 1 + drivers/clk/Makefile | 1 + drivers/clk/ralink/Kconfig | 15 + drivers/clk/ralink/Makefile | 2 + drivers/clk/ralink/clk-mt7621.c | 528 ++++++++++++++++++ drivers/staging/mt7621-dts/gbpc1.dts | 11 - drivers/staging/mt7621-dts/mt7621.dtsi | 82 ++- include/dt-bindings/clock/mt7621-clk.h | 41 ++ 11 files changed, 702 insertions(+), 59 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml create mode 100644 drivers/clk/ralink/Kconfig create mode 100644 drivers/clk/ralink/Makefile create mode 100644 drivers/clk/ralink/clk-mt7621.c create mode 100644 include/dt-bindings/clock/mt7621-clk.h -- 2.25.1 From sergio.paracuellos at gmail.com Sun Mar 7 07:04:21 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Sun, 7 Mar 2021 08:04:21 +0100 Subject: [PATCH v10 1/6] dt-bindings: clock: add dt binding header for mt7621 clocks In-Reply-To: <20210307070426.15933-1-sergio.paracuellos@gmail.com> References: <20210307070426.15933-1-sergio.paracuellos@gmail.com> Message-ID: <20210307070426.15933-2-sergio.paracuellos@gmail.com> Adds dt binding header for 'mediatek,mt7621-clk' clocks. Acked-by: Rob Herring Signed-off-by: Sergio Paracuellos --- include/dt-bindings/clock/mt7621-clk.h | 41 ++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 include/dt-bindings/clock/mt7621-clk.h diff --git a/include/dt-bindings/clock/mt7621-clk.h b/include/dt-bindings/clock/mt7621-clk.h new file mode 100644 index 000000000000..1422badcf9de --- /dev/null +++ b/include/dt-bindings/clock/mt7621-clk.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Author: Sergio Paracuellos + */ + +#ifndef _DT_BINDINGS_CLK_MT7621_H +#define _DT_BINDINGS_CLK_MT7621_H + +#define MT7621_CLK_XTAL 0 +#define MT7621_CLK_CPU 1 +#define MT7621_CLK_BUS 2 +#define MT7621_CLK_50M 3 +#define MT7621_CLK_125M 4 +#define MT7621_CLK_150M 5 +#define MT7621_CLK_250M 6 +#define MT7621_CLK_270M 7 + +#define MT7621_CLK_HSDMA 8 +#define MT7621_CLK_FE 9 +#define MT7621_CLK_SP_DIVTX 10 +#define MT7621_CLK_TIMER 11 +#define MT7621_CLK_PCM 12 +#define MT7621_CLK_PIO 13 +#define MT7621_CLK_GDMA 14 +#define MT7621_CLK_NAND 15 +#define MT7621_CLK_I2C 16 +#define MT7621_CLK_I2S 17 +#define MT7621_CLK_SPI 18 +#define MT7621_CLK_UART1 19 +#define MT7621_CLK_UART2 20 +#define MT7621_CLK_UART3 21 +#define MT7621_CLK_ETH 22 +#define MT7621_CLK_PCIE0 23 +#define MT7621_CLK_PCIE1 24 +#define MT7621_CLK_PCIE2 25 +#define MT7621_CLK_CRYPTO 26 +#define MT7621_CLK_SHXC 27 + +#define MT7621_CLK_MAX 28 + +#endif /* _DT_BINDINGS_CLK_MT7621_H */ -- 2.25.1 From sergio.paracuellos at gmail.com Sun Mar 7 07:04:24 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Sun, 7 Mar 2021 08:04:24 +0100 Subject: [PATCH v10 4/6] staging: mt7621-dts: make use of new 'mt7621-clk' In-Reply-To: <20210307070426.15933-1-sergio.paracuellos@gmail.com> References: <20210307070426.15933-1-sergio.paracuellos@gmail.com> Message-ID: <20210307070426.15933-5-sergio.paracuellos@gmail.com> Clocks for SoC mt7621 have been properly integrated so there is no need to declare fixed clocks at all in the device tree. Remove all of them, add new device tree nodes for mt7621-clk and update the rest of the nodes to use them. Acked-by: Greg Kroah-Hartman Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-dts/gbpc1.dts | 11 ---- drivers/staging/mt7621-dts/mt7621.dtsi | 74 ++++++++++++-------------- 2 files changed, 33 insertions(+), 52 deletions(-) diff --git a/drivers/staging/mt7621-dts/gbpc1.dts b/drivers/staging/mt7621-dts/gbpc1.dts index a7c0d3115d72..7716d0efe524 100644 --- a/drivers/staging/mt7621-dts/gbpc1.dts +++ b/drivers/staging/mt7621-dts/gbpc1.dts @@ -100,17 +100,6 @@ partition at 50000 { }; }; -&sysclock { - compatible = "fixed-clock"; - /* This is normally 1/4 of cpuclock */ - clock-frequency = <225000000>; -}; - -&cpuclock { - compatible = "fixed-clock"; - clock-frequency = <900000000>; -}; - &pcie { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi index 16fc94f65486..b68183e7e6ad 100644 --- a/drivers/staging/mt7621-dts/mt7621.dtsi +++ b/drivers/staging/mt7621-dts/mt7621.dtsi @@ -1,5 +1,6 @@ #include #include +#include / { #address-cells = <1>; @@ -27,27 +28,6 @@ aliases { serial0 = &uartlite; }; - cpuclock: cpuclock at 0 { - #clock-cells = <0>; - compatible = "fixed-clock"; - - /* FIXME: there should be way to detect this */ - clock-frequency = <880000000>; - }; - - sysclock: sysclock at 0 { - #clock-cells = <0>; - compatible = "fixed-clock"; - - /* This is normally 1/4 of cpuclock */ - clock-frequency = <220000000>; - }; - - mmc_clock: mmc_clock at 0 { - #clock-cells = <0>; - compatible = "fixed-clock"; - clock-frequency = <48000000>; - }; mmc_fixed_3v3: fixedregulator at 0 { compatible = "regulator-fixed"; @@ -76,8 +56,13 @@ palmbus: palmbus at 1E000000 { #size-cells = <1>; sysc: sysc at 0 { - compatible = "mtk,mt7621-sysc"; + compatible = "mtk,mt7621-sysc", "syscon"; reg = <0x0 0x100>; + #clock-cells = <1>; + ralink,memctl = <&memc>; + clock-output-names = "xtal", "cpu", "bus", + "50m", "125m", "150m", + "250m", "270m"; }; wdt: wdt at 100 { @@ -101,8 +86,8 @@ i2c: i2c at 900 { compatible = "mediatek,mt7621-i2c"; reg = <0x900 0x100>; - clocks = <&sysclock>; - + clocks = <&sysc MT7621_CLK_I2C>; + clock-names = "i2c"; resets = <&rstctrl 16>; reset-names = "i2c"; @@ -119,8 +104,8 @@ i2s: i2s at a00 { compatible = "mediatek,mt7621-i2s"; reg = <0xa00 0x100>; - clocks = <&sysclock>; - + clocks = <&sysc MT7621_CLK_I2S>; + clock-names = "i2s"; resets = <&rstctrl 17>; reset-names = "i2s"; @@ -138,7 +123,7 @@ i2s: i2s at a00 { }; memc: memc at 5000 { - compatible = "mtk,mt7621-memc"; + compatible = "mtk,mt7621-memc", "syscon"; reg = <0x5000 0x1000>; }; @@ -156,8 +141,8 @@ uartlite: uartlite at c00 { compatible = "ns16550a"; reg = <0xc00 0x100>; - clocks = <&sysclock>; - clock-frequency = <50000000>; + clocks = <&sysc MT7621_CLK_UART1>; + clock-names = "uart1"; interrupt-parent = <&gic>; interrupts = ; @@ -173,7 +158,8 @@ spi0: spi at b00 { compatible = "ralink,mt7621-spi"; reg = <0xb00 0x100>; - clocks = <&sysclock>; + clocks = <&sysc MT7621_CLK_SPI>; + clock-names = "spi"; resets = <&rstctrl 18>; reset-names = "spi"; @@ -189,6 +175,8 @@ gdma: gdma at 2800 { compatible = "ralink,rt3883-gdma"; reg = <0x2800 0x800>; + clocks = <&sysc MT7621_CLK_GDMA>; + clock-names = "gdma"; resets = <&rstctrl 14>; reset-names = "dma"; @@ -206,6 +194,8 @@ hsdma: hsdma at 7000 { compatible = "mediatek,mt7621-hsdma"; reg = <0x7000 0x1000>; + clocks = <&sysc MT7621_CLK_HSDMA>; + clock-names = "hsdma"; resets = <&rstctrl 5>; reset-names = "hsdma"; @@ -311,11 +301,6 @@ rstctrl: rstctrl { #reset-cells = <1>; }; - clkctrl: clkctrl { - compatible = "ralink,rt2880-clock"; - #clock-cells = <1>; - }; - sdhci: sdhci at 1E130000 { status = "disabled"; @@ -334,7 +319,8 @@ sdhci: sdhci at 1E130000 { pinctrl-0 = <&sdhci_pins>; pinctrl-1 = <&sdhci_pins>; - clocks = <&mmc_clock &mmc_clock>; + clocks = <&sysc MT7621_CLK_SHXC>, + <&sysc MT7621_CLK_50M>; clock-names = "source", "hclk"; interrupt-parent = <&gic>; @@ -349,7 +335,7 @@ xhci: xhci at 1E1C0000 { 0x1e1d0700 0x0100>; reg-names = "mac", "ippc"; - clocks = <&sysclock>; + clocks = <&sysc MT7621_CLK_XTAL>; clock-names = "sys_ck"; interrupt-parent = <&gic>; @@ -368,7 +354,7 @@ gic: interrupt-controller at 1fbc0000 { timer { compatible = "mti,gic-timer"; interrupts = ; - clocks = <&cpuclock>; + clocks = <&sysc MT7621_CLK_CPU>; }; }; @@ -381,6 +367,9 @@ nand: nand at 1e003000 { 0x1e003800 0x800>; #address-cells = <1>; #size-cells = <1>; + + clocks = <&sysc MT7621_CLK_NAND>; + clock-names = "nand"; }; ethsys: syscon at 1e000000 { @@ -394,8 +383,9 @@ ethernet: ethernet at 1e100000 { compatible = "mediatek,mt7621-eth"; reg = <0x1e100000 0x10000>; - clocks = <&sysclock>; - clock-names = "ethif"; + clocks = <&sysc MT7621_CLK_FE>, + <&sysc MT7621_CLK_ETH>; + clock-names = "fe", "ethif"; #address-cells = <1>; #size-cells = <0>; @@ -521,7 +511,9 @@ GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH resets = <&rstctrl 24 &rstctrl 25 &rstctrl 26>; reset-names = "pcie0", "pcie1", "pcie2"; - clocks = <&clkctrl 24 &clkctrl 25 &clkctrl 26>; + clocks = <&sysc MT7621_CLK_PCIE0>, + <&sysc MT7621_CLK_PCIE1>, + <&sysc MT7621_CLK_PCIE2>; clock-names = "pcie0", "pcie1", "pcie2"; phys = <&pcie0_phy 1>, <&pcie2_phy 0>; phy-names = "pcie-phy0", "pcie-phy2"; -- 2.25.1 From sergio.paracuellos at gmail.com Sun Mar 7 07:04:23 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Sun, 7 Mar 2021 08:04:23 +0100 Subject: [PATCH v10 3/6] clk: ralink: add clock driver for mt7621 SoC In-Reply-To: <20210307070426.15933-1-sergio.paracuellos@gmail.com> References: <20210307070426.15933-1-sergio.paracuellos@gmail.com> Message-ID: <20210307070426.15933-4-sergio.paracuellos@gmail.com> The documentation for this SOC only talks about two registers regarding to the clocks: * SYSC_REG_CPLL_CLKCFG0 - provides some information about boostrapped refclock. PLL and dividers used for CPU and some sort of BUS. * SYSC_REG_CPLL_CLKCFG1 - a banch of gates to enable/disable clocks for all or some ip cores. Looking into driver code, and some openWRT patched there are another frequencies which are used in some drivers (uart, sd...). According to all of this information the clock plan for this SoC is set as follows: - Main top clock "xtal" from where all the rest of the world is derived. - CPU clock "cpu" derived from "xtal" frequencies and a bunch of register reads and predividers. - BUS clock "bus" derived from "cpu" and with (cpu / 4) MHz. - Fixed clocks from "xtal": * "50m": 50 MHz. * "125m": 125 MHz. * "150m": 150 MHz. * "250m": 250 MHz. * "270m": 270 MHz. We also have a buch of gate clocks with their parents: * "hsdma": "150m" * "fe": "250m" * "sp_divtx": "270m" * "timer": "50m" * "pcm": "270m" * "pio": "50m" * "gdma": "bus" * "nand": "125m" * "i2c": "50m" * "i2s": "270m" * "spi": "bus" * "uart1": "50m" * "uart2": "50m" * "uart3": "50m" * "eth": "50m" * "pcie0": "125m" * "pcie1": "125m" * "pcie2": "125m" * "crypto": "250m" * "shxc": "50m" With this information the clk driver will provide clock and gates functionality from a a set of hardcoded clocks allowing to define a nice device tree without fixed clocks. Signed-off-by: Sergio Paracuellos --- drivers/clk/Kconfig | 1 + drivers/clk/Makefile | 1 + drivers/clk/ralink/Kconfig | 15 + drivers/clk/ralink/Makefile | 2 + drivers/clk/ralink/clk-mt7621.c | 528 ++++++++++++++++++++++++++++++++ 5 files changed, 547 insertions(+) create mode 100644 drivers/clk/ralink/Kconfig create mode 100644 drivers/clk/ralink/Makefile create mode 100644 drivers/clk/ralink/clk-mt7621.c diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 7c5dc348c16f..70b23da997bf 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -382,6 +382,7 @@ source "drivers/clk/mediatek/Kconfig" source "drivers/clk/meson/Kconfig" source "drivers/clk/mvebu/Kconfig" source "drivers/clk/qcom/Kconfig" +source "drivers/clk/ralink/Kconfig" source "drivers/clk/renesas/Kconfig" source "drivers/clk/rockchip/Kconfig" source "drivers/clk/samsung/Kconfig" diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 5325847469e9..1b35ad852721 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -98,6 +98,7 @@ obj-$(CONFIG_COMMON_CLK_NXP) += nxp/ obj-$(CONFIG_MACH_PISTACHIO) += pistachio/ obj-$(CONFIG_COMMON_CLK_PXA) += pxa/ obj-$(CONFIG_COMMON_CLK_QCOM) += qcom/ +obj-y += ralink/ obj-y += renesas/ obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ obj-$(CONFIG_COMMON_CLK_SAMSUNG) += samsung/ diff --git a/drivers/clk/ralink/Kconfig b/drivers/clk/ralink/Kconfig new file mode 100644 index 000000000000..3e3f5cb9ad88 --- /dev/null +++ b/drivers/clk/ralink/Kconfig @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# MediaTek Mt7621 Clock Driver +# +menu "Clock driver for Mediatek mt7621 SoC" + depends on SOC_MT7621 || COMPILE_TEST + +config CLK_MT7621 + bool "Clock driver for MediaTek MT7621" + depends on SOC_MT7621 || COMPILE_TEST + default SOC_MT7621 + select MFD_SYSCON + help + This driver supports MediaTek MT7621 basic clocks. +endmenu diff --git a/drivers/clk/ralink/Makefile b/drivers/clk/ralink/Makefile new file mode 100644 index 000000000000..cf6f9216379d --- /dev/null +++ b/drivers/clk/ralink/Makefile @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_CLK_MT7621) += clk-mt7621.o diff --git a/drivers/clk/ralink/clk-mt7621.c b/drivers/clk/ralink/clk-mt7621.c new file mode 100644 index 000000000000..6aea5accd51c --- /dev/null +++ b/drivers/clk/ralink/clk-mt7621.c @@ -0,0 +1,528 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Mediatek MT7621 Clock Driver + * Author: Sergio Paracuellos + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Configuration registers */ +#define SYSC_REG_SYSTEM_CONFIG0 0x10 +#define SYSC_REG_SYSTEM_CONFIG1 0x14 +#define SYSC_REG_CLKCFG0 0x2c +#define SYSC_REG_CLKCFG1 0x30 +#define SYSC_REG_CUR_CLK_STS 0x44 +#define MEMC_REG_CPU_PLL 0x648 + +#define XTAL_MODE_SEL_MASK GENMASK(8, 6) +#define CPU_CLK_SEL_MASK GENMASK(31, 30) +#define CUR_CPU_FDIV_MASK GENMASK(12, 8) +#define CUR_CPU_FFRAC_MASK GENMASK(4, 0) +#define CPU_PLL_PREDIV_MASK GENMASK(13, 12) +#define CPU_PLL_FBDIV_MASK GENMASK(10, 4) + +struct mt7621_clk_priv { + struct regmap *sysc; + struct regmap *memc; +}; + +struct mt7621_clk { + struct clk_hw hw; + struct mt7621_clk_priv *priv; +}; + +struct mt7621_fixed_clk { + u8 idx; + const char *name; + const char *parent_name; + unsigned long rate; + struct clk_hw *hw; +}; + +struct mt7621_gate { + u8 idx; + const char *name; + const char *parent_name; + struct mt7621_clk_priv *priv; + u32 bit_idx; + struct clk_hw hw; +}; + +#define GATE(_id, _name, _pname, _shift) \ + { \ + .idx = _id, \ + .name = _name, \ + .parent_name = _pname, \ + .bit_idx = _shift \ + } + +static struct mt7621_gate mt7621_gates[] = { + GATE(MT7621_CLK_HSDMA, "hsdma", "150m", BIT(5)), + GATE(MT7621_CLK_FE, "fe", "250m", BIT(6)), + GATE(MT7621_CLK_SP_DIVTX, "sp_divtx", "270m", BIT(7)), + GATE(MT7621_CLK_TIMER, "timer", "50m", BIT(8)), + GATE(MT7621_CLK_PCM, "pcm", "270m", BIT(11)), + GATE(MT7621_CLK_PIO, "pio", "50m", BIT(13)), + GATE(MT7621_CLK_GDMA, "gdma", "bus", BIT(14)), + GATE(MT7621_CLK_NAND, "nand", "125m", BIT(15)), + GATE(MT7621_CLK_I2C, "i2c", "50m", BIT(16)), + GATE(MT7621_CLK_I2S, "i2s", "270m", BIT(17)), + GATE(MT7621_CLK_SPI, "spi", "bus", BIT(18)), + GATE(MT7621_CLK_UART1, "uart1", "50m", BIT(19)), + GATE(MT7621_CLK_UART2, "uart2", "50m", BIT(20)), + GATE(MT7621_CLK_UART3, "uart3", "50m", BIT(21)), + GATE(MT7621_CLK_ETH, "eth", "50m", BIT(23)), + GATE(MT7621_CLK_PCIE0, "pcie0", "125m", BIT(24)), + GATE(MT7621_CLK_PCIE1, "pcie1", "125m", BIT(25)), + GATE(MT7621_CLK_PCIE2, "pcie2", "125m", BIT(26)), + GATE(MT7621_CLK_CRYPTO, "crypto", "250m", BIT(29)), + GATE(MT7621_CLK_SHXC, "shxc", "50m", BIT(30)) +}; + +static inline struct mt7621_gate *to_mt7621_gate(struct clk_hw *hw) +{ + return container_of(hw, struct mt7621_gate, hw); +} + +static int mt7621_gate_enable(struct clk_hw *hw) +{ + struct mt7621_gate *clk_gate = to_mt7621_gate(hw); + struct regmap *sysc = clk_gate->priv->sysc; + + return regmap_update_bits(sysc, SYSC_REG_CLKCFG1, + clk_gate->bit_idx, clk_gate->bit_idx); +} + +static void mt7621_gate_disable(struct clk_hw *hw) +{ + struct mt7621_gate *clk_gate = to_mt7621_gate(hw); + struct regmap *sysc = clk_gate->priv->sysc; + + regmap_update_bits(sysc, SYSC_REG_CLKCFG1, clk_gate->bit_idx, 0); +} + +static int mt7621_gate_is_enabled(struct clk_hw *hw) +{ + struct mt7621_gate *clk_gate = to_mt7621_gate(hw); + struct regmap *sysc = clk_gate->priv->sysc; + u32 val; + + if (regmap_read(sysc, SYSC_REG_CLKCFG1, &val)) + return 0; + + return val & BIT(clk_gate->bit_idx); +} + +static const struct clk_ops mt7621_gate_ops = { + .enable = mt7621_gate_enable, + .disable = mt7621_gate_disable, + .is_enabled = mt7621_gate_is_enabled, +}; + +static int mt7621_gate_ops_init(struct device *dev, + struct mt7621_gate *sclk) +{ + struct clk_init_data init = { + .flags = CLK_SET_RATE_PARENT, + .num_parents = 1, + .parent_names = &sclk->parent_name, + .ops = &mt7621_gate_ops, + .name = sclk->name, + }; + + sclk->hw.init = &init; + return devm_clk_hw_register(dev, &sclk->hw); +} + +static int mt7621_register_gates(struct device *dev, + struct clk_hw_onecell_data *clk_data, + struct mt7621_clk_priv *priv) +{ + struct clk_hw **hws = clk_data->hws; + int ret, i; + + for (i = 0; i < ARRAY_SIZE(mt7621_gates); i++) { + struct mt7621_gate *sclk = &mt7621_gates[i]; + + sclk->priv = priv; + ret = mt7621_gate_ops_init(dev, sclk); + if (ret) { + dev_err(dev, "Couldn't register clock %s\n", sclk->name); + goto err_clk_unreg; + } + + hws[sclk->idx] = &sclk->hw; + } + + return 0; + +err_clk_unreg: + while (--i >= 0) { + struct mt7621_gate *sclk = &mt7621_gates[i]; + + clk_hw_unregister(&sclk->hw); + } + return ret; +} + +#define FIXED(_id, _name, _rate) \ + { \ + .idx = _id, \ + .name = _name, \ + .parent_name = "xtal", \ + .rate = _rate \ + } + +static struct mt7621_fixed_clk mt7621_fixed_clks[] = { + FIXED(MT7621_CLK_50M, "50m", 50000000), + FIXED(MT7621_CLK_125M, "125m", 125000000), + FIXED(MT7621_CLK_150M, "150m", 150000000), + FIXED(MT7621_CLK_250M, "250m", 250000000), + FIXED(MT7621_CLK_270M, "270m", 270000000), +}; + +static int mt7621_register_fixed_clocks(struct device *dev, + struct clk_hw_onecell_data *clk_data) +{ + struct clk_hw **hws = clk_data->hws; + int ret, i; + + for (i = 0; i < ARRAY_SIZE(mt7621_fixed_clks); i++) { + struct mt7621_fixed_clk *sclk = &mt7621_fixed_clks[i]; + + sclk->hw = clk_hw_register_fixed_rate(dev, sclk->name, + sclk->parent_name, 0, + sclk->rate); + if (IS_ERR(sclk->hw)) { + dev_err(dev, "Couldn't register clock %s\n", sclk->name); + ret = PTR_ERR(sclk->hw); + goto err_clk_unreg; + } + + hws[sclk->idx] = sclk->hw; + } + + return 0; + +err_clk_unreg: + while (--i >= 0) { + struct mt7621_fixed_clk *sclk = &mt7621_fixed_clks[i]; + + clk_hw_unregister_fixed_rate(sclk->hw); + } + return ret; +} + +static inline struct mt7621_clk *to_mt7621_clk(struct clk_hw *hw) +{ + return container_of(hw, struct mt7621_clk, hw); +} + +static unsigned long mt7621_xtal_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct mt7621_clk *clk = to_mt7621_clk(hw); + struct regmap *sysc = clk->priv->sysc; + u32 val; + + regmap_read(sysc, SYSC_REG_SYSTEM_CONFIG0, &val); + val = FIELD_GET(XTAL_MODE_SEL_MASK, val); + + if (val <= 2) + return 20000000; + if (val <= 5) + return 40000000; + + return 25000000; +} + +static unsigned long mt7621_cpu_recalc_rate(struct clk_hw *hw, + unsigned long xtal_clk) +{ + static const u32 prediv_tbl[] = { 0, 1, 2, 2 }; + struct mt7621_clk *clk = to_mt7621_clk(hw); + struct regmap *sysc = clk->priv->sysc; + struct regmap *memc = clk->priv->memc; + u32 clkcfg, clk_sel, curclk, ffiv, ffrac; + u32 pll, prediv, fbdiv; + unsigned long cpu_clk; + + regmap_read(sysc, SYSC_REG_CLKCFG0, &clkcfg); + clk_sel = FIELD_GET(CPU_CLK_SEL_MASK, clkcfg); + + regmap_read(sysc, SYSC_REG_CUR_CLK_STS, &curclk); + ffiv = FIELD_GET(CUR_CPU_FDIV_MASK, curclk); + ffrac = FIELD_GET(CUR_CPU_FFRAC_MASK, curclk); + + switch (clk_sel) { + case 0: + cpu_clk = 500000000; + break; + case 1: + regmap_read(memc, MEMC_REG_CPU_PLL, &pll); + fbdiv = FIELD_GET(CPU_PLL_FBDIV_MASK, pll); + prediv = FIELD_GET(CPU_PLL_PREDIV_MASK, pll); + cpu_clk = ((fbdiv + 1) * xtal_clk) >> prediv_tbl[prediv]; + break; + default: + cpu_clk = xtal_clk; + } + + return cpu_clk / ffiv * ffrac; +} + +static unsigned long mt7621_bus_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + return parent_rate / 4; +} + +#define CLK_BASE(_name, _parent, _recalc) { \ + .init = &(struct clk_init_data) { \ + .name = _name, \ + .ops = &(const struct clk_ops) { \ + .recalc_rate = _recalc, \ + }, \ + .parent_data = &(const struct clk_parent_data) { \ + .name = _parent, \ + .fw_name = _parent \ + }, \ + .num_parents = _parent ? 1 : 0 \ + }, \ +} + +static struct mt7621_clk mt7621_clks_base[] = { + { CLK_BASE("xtal", NULL, mt7621_xtal_recalc_rate) }, + { CLK_BASE("cpu", "xtal", mt7621_cpu_recalc_rate) }, + { CLK_BASE("bus", "cpu", mt7621_bus_recalc_rate) }, +}; + +static struct clk_hw *mt7621_clk_early[MT7621_CLK_MAX]; + +static int mt7621_register_early_clocks(struct device_node *np, + struct clk_hw_onecell_data *clk_data, + struct mt7621_clk_priv *priv) +{ + struct clk_hw **hws = clk_data->hws; + int ret, i, j; + + for (i = 0; i < ARRAY_SIZE(mt7621_clks_base); i++) { + struct mt7621_clk *sclk = &mt7621_clks_base[i]; + + sclk->priv = priv; + ret = of_clk_hw_register(np, &sclk->hw); + if (ret) { + pr_err("Couldn't register top clock %i\n", i); + goto err_clk_unreg; + } + + hws[i] = &sclk->hw; + mt7621_clk_early[i] = &sclk->hw; + } + + for (j = i; j < MT7621_CLK_MAX; j++) + mt7621_clk_early[j] = ERR_PTR(-EPROBE_DEFER); + + return 0; + +err_clk_unreg: + while (--i >= 0) { + struct mt7621_clk *sclk = &mt7621_clks_base[i]; + + clk_hw_unregister(&sclk->hw); + } + return ret; +} + +static int mt7621_prepare_enable_clocks(struct clk_hw_onecell_data *clk_data) +{ + int ret, i; + + for (i = 0; i < MT7621_CLK_MAX; i++) { + ret = clk_prepare_enable(clk_data->hws[i]->clk); + if (ret) { + pr_err("failed to enable clk: %d\n", ret); + goto err_clk_disable; + } + } + + return 0; + +err_clk_disable: + while (--i >= 0) + clk_disable_unprepare(clk_data->hws[i]->clk); + return ret; +} + +static void __init mt7621_clk_init(struct device_node *node) +{ + struct mt7621_clk_priv *priv; + struct clk_hw_onecell_data *clk_data; + int ret, i, count; + + priv = kzalloc(sizeof(*priv), GFP_KERNEL); + if (!priv) + return; + + priv->sysc = syscon_node_to_regmap(node); + if (IS_ERR(priv->sysc)) { + pr_err("Could not get sysc syscon regmap\n"); + goto free_clk_priv; + } + + priv->memc = syscon_regmap_lookup_by_phandle(node, "ralink,memctl"); + if (IS_ERR(priv->memc)) { + pr_err("Could not get memc syscon regmap\n"); + goto free_clk_priv; + } + + count = ARRAY_SIZE(mt7621_clks_base) + + ARRAY_SIZE(mt7621_fixed_clks) + ARRAY_SIZE(mt7621_gates); + clk_data = kzalloc(struct_size(clk_data, hws, count), GFP_KERNEL); + if (!clk_data) + goto free_clk_priv; + + ret = mt7621_register_early_clocks(node, clk_data, priv); + if (ret) { + pr_err("Couldn't register top clocks\n"); + goto free_clk_data; + } + + clk_data->num = count; + + ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); + if (ret) { + pr_err("Couldn't add clk hw provider\n"); + goto unreg_clk_top; + } + + return; + +unreg_clk_top: + for (i = 0; i < ARRAY_SIZE(mt7621_clks_base); i++) { + struct mt7621_clk *sclk = &mt7621_clks_base[i]; + + clk_hw_unregister(&sclk->hw); + } + +free_clk_data: + kfree(clk_data); + +free_clk_priv: + kfree(priv); +} +CLK_OF_DECLARE_DRIVER(mt7621_clk, "mediatek,mt7621-sysc", mt7621_clk_init); + +static int mt7621_clk_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + struct clk_hw_onecell_data *clk_data; + struct device *dev = &pdev->dev; + struct mt7621_clk_priv *priv; + int ret, i, count; + + priv = kzalloc(sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->sysc = syscon_node_to_regmap(np); + if (IS_ERR(priv->sysc)) { + ret = PTR_ERR(priv->sysc); + dev_err(dev, "Could not get sysc syscon regmap\n"); + goto free_clk_priv; + } + + priv->memc = syscon_regmap_lookup_by_phandle(np, "ralink,memctl"); + if (IS_ERR(priv->memc)) { + ret = PTR_ERR(priv->memc); + dev_err(dev, "Could not get memc syscon regmap\n"); + goto free_clk_priv; + } + + count = ARRAY_SIZE(mt7621_clks_base) + + ARRAY_SIZE(mt7621_fixed_clks) + ARRAY_SIZE(mt7621_gates); + clk_data = kzalloc(struct_size(clk_data, hws, count), GFP_KERNEL); + if (!clk_data) { + ret = -ENOMEM; + goto free_clk_priv; + } + + for (i = 0; i < ARRAY_SIZE(mt7621_clks_base); i++) + clk_data->hws[i] = mt7621_clk_early[i]; + + ret = mt7621_register_fixed_clocks(dev, clk_data); + if (ret) { + dev_err(dev, "Couldn't register fixed clocks\n"); + goto free_clk_data; + } + + ret = mt7621_register_gates(dev, clk_data, priv); + if (ret) { + dev_err(dev, "Couldn't register fixed clock gates\n"); + goto unreg_clk_fixed; + } + + clk_data->num = count; + + ret = mt7621_prepare_enable_clocks(clk_data); + if (ret) { + dev_err(dev, "Couldn't register fixed clock gates\n"); + goto unreg_clk_gates; + } + + ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, clk_data); + if (ret) { + dev_err(dev, "Couldn't add clk hw provider\n"); + goto disable_clks; + } + + return 0; + +disable_clks: + for (i = 0; i < MT7621_CLK_MAX; i++) + clk_disable_unprepare(clk_data->hws[i]->clk); + +unreg_clk_gates: + for (i = 0; i < ARRAY_SIZE(mt7621_gates); i++) { + struct mt7621_gate *sclk = &mt7621_gates[i]; + + clk_hw_unregister(&sclk->hw); + } + +unreg_clk_fixed: + for (i = 0; i < ARRAY_SIZE(mt7621_fixed_clks); i++) { + struct mt7621_fixed_clk *sclk = &mt7621_fixed_clks[i]; + + clk_hw_unregister_fixed_rate(sclk->hw); + } + +free_clk_data: + kfree(clk_data); + +free_clk_priv: + kfree(priv); + + return ret; +} + +static const struct of_device_id mt7621_clk_of_match[] = { + { .compatible = "mediatek,mt7621-sysc" }, + {}, +}; + +static struct platform_driver mt7621_clk_driver = { + .probe = mt7621_clk_probe, + .driver = { + .name = "mt7621-clk", + .of_match_table = mt7621_clk_of_match, + }, +}; +builtin_platform_driver(mt7621_clk_driver); -- 2.25.1 From sergio.paracuellos at gmail.com Sun Mar 7 07:04:25 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Sun, 7 Mar 2021 08:04:25 +0100 Subject: [PATCH v10 5/6] staging: mt7621-dts: use valid vendor 'mediatek' instead of invalid 'mtk' In-Reply-To: <20210307070426.15933-1-sergio.paracuellos@gmail.com> References: <20210307070426.15933-1-sergio.paracuellos@gmail.com> Message-ID: <20210307070426.15933-6-sergio.paracuellos@gmail.com> Vendor listed for mediatek in kernel vendor file 'vendor-prefixes.yaml' contains 'mediatek' as a valid vendor string. Some nodes in the device tree are using an invalid vendor string vfor 'mtk' instead. Fix all of them in dts file. Update also ralink mt7621 related code to properly match new strings. Even there are used in the device tree there are some strings that are not referred anywhere but have been also updated with new vendor name. These are 'mtk,mt7621-wdt', 'mtk,mt7621-nand', 'mtk,mt7621-mc', and 'mtk,mt7621-cpc'. Acked-by: Greg Kroah-Hartman Signed-off-by: Sergio Paracuellos --- arch/mips/ralink/mt7621.c | 6 +++--- drivers/staging/mt7621-dts/mt7621.dtsi | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/mips/ralink/mt7621.c b/arch/mips/ralink/mt7621.c index ca0ac607b0f3..5d74fc1c96ac 100644 --- a/arch/mips/ralink/mt7621.c +++ b/arch/mips/ralink/mt7621.c @@ -112,8 +112,8 @@ phys_addr_t mips_cpc_default_phys_base(void) void __init ralink_of_remap(void) { - rt_sysc_membase = plat_of_remap_node("mtk,mt7621-sysc"); - rt_memc_membase = plat_of_remap_node("mtk,mt7621-memc"); + rt_sysc_membase = plat_of_remap_node("mediatek,mt7621-sysc"); + rt_memc_membase = plat_of_remap_node("mediatek,mt7621-memc"); if (!rt_sysc_membase || !rt_memc_membase) panic("Failed to remap core resources"); @@ -181,7 +181,7 @@ void prom_soc_init(struct ralink_soc_info *soc_info) if (n0 == MT7621_CHIP_NAME0 && n1 == MT7621_CHIP_NAME1) { name = "MT7621"; - soc_info->compatible = "mtk,mt7621-soc"; + soc_info->compatible = "mediatek,mt7621-soc"; } else { panic("mt7621: unknown SoC, n0:%08x n1:%08x\n", n0, n1); } diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi index b68183e7e6ad..f0c9ae757bcd 100644 --- a/drivers/staging/mt7621-dts/mt7621.dtsi +++ b/drivers/staging/mt7621-dts/mt7621.dtsi @@ -56,7 +56,7 @@ palmbus: palmbus at 1E000000 { #size-cells = <1>; sysc: sysc at 0 { - compatible = "mtk,mt7621-sysc", "syscon"; + compatible = "mediatek,mt7621-sysc", "syscon"; reg = <0x0 0x100>; #clock-cells = <1>; ralink,memctl = <&memc>; @@ -66,7 +66,7 @@ sysc: sysc at 0 { }; wdt: wdt at 100 { - compatible = "mtk,mt7621-wdt"; + compatible = "mediatek,mt7621-wdt"; reg = <0x100 0x100>; }; @@ -123,17 +123,17 @@ i2s: i2s at a00 { }; memc: memc at 5000 { - compatible = "mtk,mt7621-memc", "syscon"; + compatible = "mediatek,mt7621-memc", "syscon"; reg = <0x5000 0x1000>; }; cpc: cpc at 1fbf0000 { - compatible = "mtk,mt7621-cpc"; + compatible = "mediatek,mt7621-cpc"; reg = <0x1fbf0000 0x8000>; }; mc: mc at 1fbf8000 { - compatible = "mtk,mt7621-mc"; + compatible = "mediatek,mt7621-mc"; reg = <0x1fbf8000 0x8000>; }; @@ -361,7 +361,7 @@ timer { nand: nand at 1e003000 { status = "disabled"; - compatible = "mtk,mt7621-nand"; + compatible = "mediatek,mt7621-nand"; bank-width = <2>; reg = <0x1e003000 0x800 0x1e003800 0x800>; -- 2.25.1 From sergio.paracuellos at gmail.com Sun Mar 7 07:04:26 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Sun, 7 Mar 2021 08:04:26 +0100 Subject: [PATCH v10 6/6] MAINTAINERS: add MT7621 CLOCK maintainer In-Reply-To: <20210307070426.15933-1-sergio.paracuellos@gmail.com> References: <20210307070426.15933-1-sergio.paracuellos@gmail.com> Message-ID: <20210307070426.15933-7-sergio.paracuellos@gmail.com> Adding myself as maintainer for mt7621 clock driver. Signed-off-by: Sergio Paracuellos --- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 809a68af5efd..be5ada6b4309 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11288,6 +11288,12 @@ L: linux-wireless at vger.kernel.org S: Maintained F: drivers/net/wireless/mediatek/mt7601u/ +MEDIATEK MT7621 CLOCK DRIVER +M: Sergio Paracuellos +S: Maintained +F: Documentation/devicetree/bindings/clock/mediatek,mt7621-clk.yaml +F: drivers/clk/ralink/clk-mt7621.c + MEDIATEK MT7621/28/88 I2C DRIVER M: Stefan Roese L: linux-i2c at vger.kernel.org -- 2.25.1 From marben at kukdong.co.id Sun Mar 7 16:54:17 2021 From: marben at kukdong.co.id (Hi) Date: Sun, 7 Mar 2021 16:54:17 -0000 Subject: How are you today? Message-ID: <20210307183020.6EB5860655@smtp3.osuosl.org> My name is Reem Hashimy, the Emirates Minister of State and Managing Director of the United Arab Emirates (Dubai) World Expo 2020 Committee which has been postponed to October 2021 to March 2022 because of the Covid-19 pandemic. I am writing to you to manage the funds I received as financial gratification from various foreign companies I assisted to receive a participation approval to the coming event. The amount is $44,762,906.00 United States dollars. But I can not personally manage the fund in my country because of the sensitive nature of my office and the certain restriction on married Muslim women. For this reason, an agreement was reached with a consulting firm to direct the various financial gifts into an open beneficiary account in my name with a bank where it will be possible for me to instruct the transfer of ownership right to a third party for investment purpose; which is the reason I am contacting you to receive the fund and manage it as my investment partner. Note that the fund is NOT connected to any criminal or terrorist activity. On your indication of interest with your information; I will instruct the consulting firm to process the fund to your country for investment purposes. Regards. Reem Hashimy. From no-reply at maximwealthlimited.com Sun Mar 7 19:22:57 2021 From: no-reply at maximwealthlimited.com (Elizabeth C Schroeder) Date: Sun, 7 Mar 2021 20:22:57 +0100 Subject: Private information ! Message-ID: <20210307192258.B2E811D2D79@smtp02-u01-tyo.paasmail.conoha.io> Hello Beloved in the lord Greetings in the name of our lord Jesus Christ. I am Mrs Elizabeth Schroder from Germany, a widow to late Dr. A. Schroder l am 51 years old and a converted born again Christian, suffering from long time cancer of the breast, from all indication my condition is really deteriorating and it is quite obvious that I might not live more than two (2) months, according to my doctor because the cancer has gotten to a very worst / dangerous stage. My late husband and my only child died last five years ago, his death was politically motivated. My late husband was a very rich and wealthy oil business man who was running his oil,Gold/Diamond Business here in West Africa Nigeria. After his death, I inherited all his business and wealth. My doctors has advised me that I may not live for more than two (2) months, so I now decided to divide the part of this wealth, to contribute to the development of the church in Africa, America, Asia, and Europe. I collected your email address during my desperate search on the internet and I prayed over it. I decided to donate the sum of $17,500,000.00 USD (Seventeen Million Five hundred thousand United States dollars) to the less privileged because I cannot take this money to the grave. Please I want you to note that this fund is lodged in a private bank here in Africa(Standard Trust Bank Africa). Once I hear from you, I will forward to you all the information's you will use to get this fund released from the bank and to be transferred to your bank account. I honestly pray that this money when transferred to you will be used for the said purpose because l have come to find out that wealth acquisition without Christ is vanity. May the grace of our lord Jesus the love of God and the fellowship of God be with you and your family. Reply me on my private email address zbthschroder1 at gmail.com Thanks and God bless you. Your beloved sister in Christ. Mrs. Elizabeth Schroder Donor From no-reply at maximwealthlimited.com Sun Mar 7 19:22:57 2021 From: no-reply at maximwealthlimited.com (Elizabeth C Schroeder) Date: Sun, 7 Mar 2021 20:22:57 +0100 Subject: Private information ! Message-ID: <20210307192258.B2E811D2D79@smtp02-u01-tyo.paasmail.conoha.io> Hello Beloved in the lord Greetings in the name of our lord Jesus Christ. I am Mrs Elizabeth Schroder from Germany, a widow to late Dr. A. Schroder l am 51 years old and a converted born again Christian, suffering from long time cancer of the breast, from all indication my condition is really deteriorating and it is quite obvious that I might not live more than two (2) months, according to my doctor because the cancer has gotten to a very worst / dangerous stage. My late husband and my only child died last five years ago, his death was politically motivated. My late husband was a very rich and wealthy oil business man who was running his oil,Gold/Diamond Business here in West Africa Nigeria. After his death, I inherited all his business and wealth. My doctors has advised me that I may not live for more than two (2) months, so I now decided to divide the part of this wealth, to contribute to the development of the church in Africa, America, Asia, and Europe. I collected your email address during my desperate search on the internet and I prayed over it. I decided to donate the sum of $17,500,000.00 USD (Seventeen Million Five hundred thousand United States dollars) to the less privileged because I cannot take this money to the grave. Please I want you to note that this fund is lodged in a private bank here in Africa(Standard Trust Bank Africa). Once I hear from you, I will forward to you all the information's you will use to get this fund released from the bank and to be transferred to your bank account. I honestly pray that this money when transferred to you will be used for the said purpose because l have come to find out that wealth acquisition without Christ is vanity. May the grace of our lord Jesus the love of God and the fellowship of God be with you and your family. Reply me on my private email address zbthschroder1 at gmail.com Thanks and God bless you. Your beloved sister in Christ. Mrs. Elizabeth Schroder Donor From no-reply at maximwealthlimited.com Sun Mar 7 19:40:46 2021 From: no-reply at maximwealthlimited.com (Elizabeth C Schroeder) Date: Sun, 7 Mar 2021 20:40:46 +0100 Subject: Private information ! Message-ID: <20210307194048.472B2205D2D@smtp02-u01-tyo.paasmail.conoha.io> Hello Beloved in the lord Greetings in the name of our lord Jesus Christ. I am Mrs Elizabeth Schroder from Germany, a widow to late Dr. A. Schroder l am 51 years old and a converted born again Christian, suffering from long time cancer of the breast, from all indication my condition is really deteriorating and it is quite obvious that I might not live more than two (2) months, according to my doctor because the cancer has gotten to a very worst / dangerous stage. My late husband and my only child died last five years ago, his death was politically motivated. My late husband was a very rich and wealthy oil business man who was running his oil,Gold/Diamond Business here in West Africa Nigeria. After his death, I inherited all his business and wealth. My doctors has advised me that I may not live for more than two (2) months, so I now decided to divide the part of this wealth, to contribute to the development of the church in Africa, America, Asia, and Europe. I collected your email address during my desperate search on the internet and I prayed over it. I decided to donate the sum of $17,500,000.00 USD (Seventeen Million Five hundred thousand United States dollars) to the less privileged because I cannot take this money to the grave. Please I want you to note that this fund is lodged in a private bank here in Africa(Standard Trust Bank Africa). Once I hear from you, I will forward to you all the information's you will use to get this fund released from the bank and to be transferred to your bank account. I honestly pray that this money when transferred to you will be used for the said purpose because l have come to find out that wealth acquisition without Christ is vanity. May the grace of our lord Jesus the love of God and the fellowship of God be with you and your family. Reply me on my private email address zbthschroder1 at gmail.com Thanks and God bless you. Your beloved sister in Christ. Mrs. Elizabeth Schroder Donor From nami at 5fafa.xyz Mon Mar 8 04:59:53 2021 From: nami at 5fafa.xyz (Ms. Melvida Bullock) Date: Mon, 8 Mar 2021 12:59:53 +0800 Subject: Greetings Dear Beloved: Message-ID: <20210308045959.4C262430E2@smtp2.osuosl.org> Dear Beloved, Life is gradually passing away from me as a result of my present medical condition and my personal doctor confided in me yesterday that I have only a few more weeks to live. In view of this setback, I want to donate my estate for humanitarian assistance, since this has always been the plan of my late husband and besides I have no child. In an effort to compliment the good work of our creator for humanity and the wish of my late Husband I donate the sum of 10,000,000.00 Euro (Ten Million EUR) to you. Upon your acknowledgement of this mail and informing me of your nationality and current place of resident, my Bank will facilitate due processes for transfer of this legacy to you. May God bless you as you use this money judiciously for the work of charity to help the less privileged. Sincere regards, Ms. Melvida Bullock Email: melvbullockzone123 at gmail.com From nami at 5fafa.xyz Mon Mar 8 05:06:16 2021 From: nami at 5fafa.xyz (Ms. Melvida Bullock) Date: Mon, 8 Mar 2021 13:06:16 +0800 Subject: Greetings Dear Beloved: Message-ID: <20210308050620.6013B430E4@smtp2.osuosl.org> Dear Beloved, Life is gradually passing away from me as a result of my present medical condition and my personal doctor confided in me yesterday that I have only a few more weeks to live. In view of this setback, I want to donate my estate for humanitarian assistance, since this has always been the plan of my late husband and besides I have no child. In an effort to compliment the good work of our creator for humanity and the wish of my late Husband I donate the sum of 10,000,000.00 Euro (Ten Million EUR) to you. Upon your acknowledgement of this mail and informing me of your nationality and current place of resident, my Bank will facilitate due processes for transfer of this legacy to you. May God bless you as you use this money judiciously for the work of charity to help the less privileged. Sincere regards, Ms. Melvida Bullock Email: melvbullockzone123 at gmail.com From gregkh at linuxfoundation.org Mon Mar 8 07:07:20 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Mon, 8 Mar 2021 08:07:20 +0100 Subject: [PATCH v10 5/9] staging: clocking-wizard: Add support for dynamic reconfiguration In-Reply-To: References: Message-ID: On Mon, Mar 08, 2021 at 02:59:47PM +0800, zhengxunli at mxic.com.tw wrote: > CONFIDENTIALITY NOTE: > > This e-mail and any attachments may contain confidential information > and/or personal data, which is protected by applicable laws. Please be > reminded that duplication, disclosure, distribution, or use of this e-mail > (and/or its attachments) or any part thereof is prohibited. If you receive > this e-mail in error, please notify us immediately and delete this mail as > well as its attachment(s) from your system. In addition, please be > informed that collection, processing, and/or use of personal data is > prohibited unless expressly permitted by personal data protection laws. > Thank you for your attention and cooperation. This footer is not compatible with Linux kernel development, sorry. Message is now deleted. greg k-h From zhengxunli at mxic.com.tw Mon Mar 8 06:59:47 2021 From: zhengxunli at mxic.com.tw (zhengxunli at mxic.com.tw) Date: Mon, 8 Mar 2021 14:59:47 +0800 Subject: [PATCH v10 5/9] staging: clocking-wizard: Add support for dynamic reconfiguration Message-ID: Hi Shubhrajyoti, My name is Zhengxun and I am the engineer from Macronix. We are using the platform PicoZed 7015/7030 SOM (System On Module), which is based on Xilinx Zynq?-7000 All Programmable (AP) SoC to verify our Flash dirver. Of course, we are also using your clock wizard, our version seems to be v5.2, but something went wrong. +static int clk_wzrd_dynamic_reconfig(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) +{ + int err; + u32 value; + unsigned long flags = 0; + struct clk_wzrd_divider *divider = to_clk_wzrd_divider(hw); + void __iomem *div_addr = divider->base + divider->offset; + + if (divider->lock) + spin_lock_irqsave(divider->lock, flags); + else + __acquire(divider->lock); + + value = DIV_ROUND_CLOSEST(parent_rate, rate); + + /* Cap the value to max */ + min_t(u32, value, WZRD_DR_MAX_INT_DIV_VALUE); + + /* Set divisor and clear phase offset */ + writel(value, div_addr); + writel(0x00, div_addr + WZRD_DR_DIV_TO_PHASE_OFFSET); Why phase always set to zero? We want to support DTR operation in Flash driver. Can you add a set_phase function to adjust the phase? + /* Check status register */ + err = readl_poll_timeout(divider->base + WZRD_DR_STATUS_REG_OFFSET, + value, value & WZRD_DR_LOCK_BIT_MASK, + WZRD_USEC_POLL, WZRD_TIMEOUT_POLL); + if (err) + goto err_reconfig; + + /* Initiate reconfiguration */ + writel(WZRD_DR_BEGIN_DYNA_RECONF, + divider->base + WZRD_DR_INIT_REG_OFFSET); + + /* Check status register */ + err = readl_poll_timeout(divider->base + WZRD_DR_STATUS_REG_OFFSET, + value, value & WZRD_DR_LOCK_BIT_MASK, + WZRD_USEC_POLL, WZRD_TIMEOUT_POLL); According to pg015-clk-wiz.pdf, Clocking Wizard v5.2 and later, need to write 0x00000007 followed by 0x00000002 into Clock Configuration Register 23, to consolidate the redundant bits that the IP has upgraded, right? Can you compatible to v5.2? +err_reconfig: + if (divider->lock) + spin_unlock_irqrestore(divider->lock, flags); + else + __release(divider->lock); + return err; +} Thanks, Zhengxun CONFIDENTIALITY NOTE: This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation. Macronix International Co., Ltd. ===================================================================== ============================================================================ CONFIDENTIALITY NOTE: This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation. Macronix International Co., Ltd. ===================================================================== From zhengfuqing at yandex.com Mon Mar 8 07:41:39 2021 From: zhengfuqing at yandex.com (zhengfuqing at yandex.com) Date: Mon, 08 Mar 2021 08:41:39 +0100 Subject: Saluti! Message-ID: <20210308074549.D1C5B6070F@smtp3.osuosl.org> Buona giornata, C'? una questione urgente, che si riferisce al trasferimento di una grande quantit? di denaro su un conto all'estero, con il tuo aiuto come partner straniero come beneficiario dei fondi. Se sei interessato, rispondi tramite la mia email privata qui sotto. E-mail: director.zheng at zhengfuqing.com I migliori saluti, Direttore esecutivo. ICBC. --- Avast ????????????????? https://www.avast.com/antivirus From zhengfuqing at yandex.com Mon Mar 8 07:41:39 2021 From: zhengfuqing at yandex.com (zhengfuqing at yandex.com) Date: Mon, 08 Mar 2021 08:41:39 +0100 Subject: Saluti! Message-ID: <20210308074702.49AEF4EBBD@smtp4.osuosl.org> Buona giornata, C'? una questione urgente, che si riferisce al trasferimento di una grande quantit? di denaro su un conto all'estero, con il tuo aiuto come partner straniero come beneficiario dei fondi. Se sei interessato, rispondi tramite la mia email privata qui sotto. E-mail: director.zheng at zhengfuqing.com I migliori saluti, Direttore esecutivo. ICBC. --- Avast ????????????????? https://www.avast.com/antivirus From dan.carpenter at oracle.com Mon Mar 8 07:57:35 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Mon, 8 Mar 2021 10:57:35 +0300 Subject: [PATCH] staging: rtl8192e: Fix possible buffer overflow in _rtl92e_wx_set_scan In-Reply-To: <20210305150014.GA627584@ubuntudesktop> References: <20210226114829.316980-1-leegib@gmail.com> <20210226134333.GA2087@kadam> <20210226140526.GG2222@kadam> <20210301132535.GR2087@kadam> <20210305082228.GG2222@kadam> <20210305150014.GA627584@ubuntudesktop> Message-ID: <20210308075735.GA21246@kadam> On Fri, Mar 05, 2021 at 03:00:14PM +0000, Lee wrote: > > Hi Dan, > > Do you think any of these could be potential issues: > > driver/staging/ > > rtl8192e/rtllib_rx.c:2442 memcpy(dst->ssid, src->ssid, src->ssid_len); Smatch says that at this point we know "src->ssid_len" is in the 1-32 range. This is without any fixes to how Smatch parses nl_len(). > wlan-ng/cfg80211.c:316 313 if (request->n_ssids > 0) { 314 msg1.scantype.data = P80211ENUM_scantype_active; 315 msg1.ssid.data.len = request->ssids->ssid_len; 316 memcpy(msg1.ssid.data.data, 317 request->ssids->ssid, request->ssids->ssid_len); 318 } else { The only thing Smatch knows about "request->ssids->ssid_len" is that it's 0-255. I had not marked "msg1.ssid.data.data" as a protected struct member so it didn't generate a warning. I think cfg80211_scan_request structs are filled out in a systematic way in ieee80211_request_ibss_scan() and they're bounds checked properly so this isn't a bug. > rtl8723bs/os_dep/ioctl_cfg80211.c:1591 > rtl8723bs/os_dep/ioctl_cfg80211.c:2738 Same. regards, dan carpenter From zhengfuqing at yandex.com Mon Mar 8 11:11:51 2021 From: zhengfuqing at yandex.com (zhengfuqing at yandex.com) Date: Mon, 08 Mar 2021 12:11:51 +0100 Subject: Saluti! Message-ID: <20210308111555.E2B6B606D6@smtp3.osuosl.org> Buona giornata, C'? una questione urgente, che si riferisce al trasferimento di una grande quantit? di denaro su un conto all'estero, con il tuo aiuto come partner straniero come beneficiario dei fondi. Se sei interessato, rispondi tramite la mia email privata qui sotto. E-mail: director.zheng at zhengfuqing.com I migliori saluti, Direttore esecutivo. ICBC. --- Avast ????????????????? https://www.avast.com/antivirus From dagostinelli at gmail.com Mon Mar 8 14:48:39 2021 From: dagostinelli at gmail.com (Darryl T. Agostinelli) Date: Mon, 8 Mar 2021 08:48:39 -0600 Subject: [PATCH] staging: wimax: i2400m: fix some incorrect type warnings Message-ID: <20210308144839.2364329-1-dagostinelli@gmail.com> Fix some "incorrect type in assignment" warnings reported by sparse in fw.c sparse warnings: wimax/i2400m/fw.c:266:27: warning: cast to restricted __le32 wimax/i2400m/fw.c:266:25: warning: incorrect type in assignment (different base types) wimax/i2400m/fw.c:267:27: warning: cast to restricted __le32 wimax/i2400m/fw.c:267:25: warning: incorrect type in assignment (different base types) wimax/i2400m/fw.c:268:27: warning: cast to restricted __le32 wimax/i2400m/fw.c:268:25: warning: incorrect type in assignment (different base types) wimax/i2400m/fw.c:269:27: warning: cast to restricted __le32 wimax/i2400m/fw.c:269:25: warning: incorrect type in assignment (different base types) Signed-off-by: Darryl T. Agostinelli --- drivers/staging/wimax/i2400m/fw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wimax/i2400m/fw.c b/drivers/staging/wimax/i2400m/fw.c index 92ea5c101e76..f0e43dbd02f6 100644 --- a/drivers/staging/wimax/i2400m/fw.c +++ b/drivers/staging/wimax/i2400m/fw.c @@ -263,10 +263,10 @@ int i2400m_barker_db_add(u32 barker_id) return result; } barker = i2400m_barker_db + i2400m_barker_db_used++; - barker->data[0] = le32_to_cpu(barker_id); - barker->data[1] = le32_to_cpu(barker_id); - barker->data[2] = le32_to_cpu(barker_id); - barker->data[3] = le32_to_cpu(barker_id); + barker->data[0] = cpu_to_le32(barker_id); + barker->data[1] = cpu_to_le32(barker_id); + barker->data[2] = cpu_to_le32(barker_id); + barker->data[3] = cpu_to_le32(barker_id); return 0; } -- 2.29.2 From aardelean at deviqon.com Mon Mar 8 14:54:52 2021 From: aardelean at deviqon.com (Alexandru Ardelean) Date: Mon, 8 Mar 2021 16:54:52 +0200 Subject: [PATCH 00/10] spi: finalize 'delay_usecs' removal/transition Message-ID: <20210308145502.1075689-1-aardelean@deviqon.com> A while back I started the introduction of the 'spi_delay' data type: https://lore.kernel.org/linux-spi/20190926105147.7839-1-alexandru.ardelean at analog.com/ Users of the 'delay_usecs' were removed from drivers. Now it's time to remove the 'delay_usecs' from the SPI subsystem and use only the 'delay' field. This changeset adapts all SPI drivers to do without 'delay_usecs'. Additionally, for greybus we need to adapt it to use the 'delay' in nano-seconds and convert it to micro-seconds. Alexandru Ardelean (10): spi: spi-axi-spi-engine: remove usage of delay_usecs spi: bcm63xx-spi: don't check 'delay_usecs' field spi: spi-bcm-qspi: replace 'delay_usecs' with 'delay.value' check spi: spi-sh: replace 'delay_usecs' with 'delay.value' in pr_debug spi: spi-tegra20-flash: don't check 'delay_usecs' field for spi transfer staging: greybus: spilib: use 'spi_delay_to_ns' for getting xfer delay spi: spi-falcon: remove check for 'delay_usecs' spi: fsl-espi: remove usage of 'delay_usecs' field spi: core: remove 'delay_usecs' field from spi_transfer spi: docs: update info about 'delay_usecs' Documentation/spi/spi-summary.rst | 7 +++++-- drivers/spi/spi-axi-spi-engine.c | 12 ++++-------- drivers/spi/spi-bcm-qspi.c | 2 +- drivers/spi/spi-bcm63xx.c | 2 +- drivers/spi/spi-falcon.c | 2 +- drivers/spi/spi-fsl-espi.c | 17 +++++------------ drivers/spi/spi-sh.c | 4 ++-- drivers/spi/spi-tegra20-sflash.c | 3 +-- drivers/spi/spi.c | 1 - drivers/staging/greybus/spilib.c | 5 ++++- include/linux/spi/spi.h | 12 ------------ 11 files changed, 24 insertions(+), 43 deletions(-) -- 2.29.2 From aardelean at deviqon.com Mon Mar 8 14:54:53 2021 From: aardelean at deviqon.com (Alexandru Ardelean) Date: Mon, 8 Mar 2021 16:54:53 +0200 Subject: [PATCH 01/10] spi: spi-axi-spi-engine: remove usage of delay_usecs In-Reply-To: <20210308145502.1075689-1-aardelean@deviqon.com> References: <20210308145502.1075689-1-aardelean@deviqon.com> Message-ID: <20210308145502.1075689-2-aardelean@deviqon.com> The 'delay_usecs' field was handled for backwards compatibility in case there were some users that still configured SPI delay transfers with this field. They should all be removed by now. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi-axi-spi-engine.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-engine.c index af86e6d6e16b..80c3e38f5c1b 100644 --- a/drivers/spi/spi-axi-spi-engine.c +++ b/drivers/spi/spi-axi-spi-engine.c @@ -170,14 +170,10 @@ static void spi_engine_gen_sleep(struct spi_engine_program *p, bool dry, unsigned int t; int delay; - if (xfer->delay_usecs) { - delay = xfer->delay_usecs; - } else { - delay = spi_delay_to_ns(&xfer->delay, xfer); - if (delay < 0) - return; - delay /= 1000; - } + delay = spi_delay_to_ns(&xfer->delay, xfer); + if (delay < 0) + return; + delay /= 1000; if (delay == 0) return; -- 2.29.2 From aardelean at deviqon.com Mon Mar 8 14:54:54 2021 From: aardelean at deviqon.com (Alexandru Ardelean) Date: Mon, 8 Mar 2021 16:54:54 +0200 Subject: [PATCH 02/10] spi: bcm63xx-spi: don't check 'delay_usecs' field In-Reply-To: <20210308145502.1075689-1-aardelean@deviqon.com> References: <20210308145502.1075689-1-aardelean@deviqon.com> Message-ID: <20210308145502.1075689-3-aardelean@deviqon.com> The 'delay_usecs' field was handled for backwards compatibility in case there were some users that still configured SPI delay transfers with this field. They should all be removed by now. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi-bcm63xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c index d08bb7600150..80fa0ef8909c 100644 --- a/drivers/spi/spi-bcm63xx.c +++ b/drivers/spi/spi-bcm63xx.c @@ -369,7 +369,7 @@ static int bcm63xx_spi_transfer_one(struct spi_master *master, } /* CS will be deasserted directly after transfer */ - if (t->delay_usecs || t->delay.value) { + if (t->delay.value) { dev_err(&spi->dev, "unable to keep CS asserted after transfer\n"); status = -EINVAL; goto exit; -- 2.29.2 From aardelean at deviqon.com Mon Mar 8 14:54:55 2021 From: aardelean at deviqon.com (Alexandru Ardelean) Date: Mon, 8 Mar 2021 16:54:55 +0200 Subject: [PATCH 03/10] spi: spi-bcm-qspi: replace 'delay_usecs' with 'delay.value' check In-Reply-To: <20210308145502.1075689-1-aardelean@deviqon.com> References: <20210308145502.1075689-1-aardelean@deviqon.com> Message-ID: <20210308145502.1075689-4-aardelean@deviqon.com> The 'delay_usecs' field is going away. The replacement for it is the 'delay' field. So, we should check for 'delay.value' being non-zero. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi-bcm-qspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c index 707fe3a5d8ef..a78e56f566dd 100644 --- a/drivers/spi/spi-bcm-qspi.c +++ b/drivers/spi/spi-bcm-qspi.c @@ -671,7 +671,7 @@ static int update_qspi_trans_byte_count(struct bcm_qspi *qspi, if (qt->byte >= qt->trans->len) { /* we're at the end of the spi_transfer */ /* in TX mode, need to pause for a delay or CS change */ - if (qt->trans->delay_usecs && + if (qt->trans->delay.value && (flags & TRANS_STATUS_BREAK_DELAY)) ret |= TRANS_STATUS_BREAK_DELAY; if (qt->trans->cs_change && -- 2.29.2 From aardelean at deviqon.com Mon Mar 8 14:54:56 2021 From: aardelean at deviqon.com (Alexandru Ardelean) Date: Mon, 8 Mar 2021 16:54:56 +0200 Subject: [PATCH 04/10] spi: spi-sh: replace 'delay_usecs' with 'delay.value' in pr_debug In-Reply-To: <20210308145502.1075689-1-aardelean@deviqon.com> References: <20210308145502.1075689-1-aardelean@deviqon.com> Message-ID: <20210308145502.1075689-5-aardelean@deviqon.com> The 'delay_usecs' field is going away. The replacement for it is the 'delay' field. So, we should print the 'delay.value' value instead. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi-sh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-sh.c b/drivers/spi/spi-sh.c index 15123a8f41e1..45f304935332 100644 --- a/drivers/spi/spi-sh.c +++ b/drivers/spi/spi-sh.c @@ -290,8 +290,8 @@ static void spi_sh_work(struct work_struct *work) list_for_each_entry(t, &mesg->transfers, transfer_list) { pr_debug("tx_buf = %p, rx_buf = %p\n", t->tx_buf, t->rx_buf); - pr_debug("len = %d, delay_usecs = %d\n", - t->len, t->delay_usecs); + pr_debug("len = %d, delay.value = %d\n", + t->len, t->delay.value); if (t->tx_buf) { ret = spi_sh_send(ss, mesg, t); -- 2.29.2 From aardelean at deviqon.com Mon Mar 8 14:54:57 2021 From: aardelean at deviqon.com (Alexandru Ardelean) Date: Mon, 8 Mar 2021 16:54:57 +0200 Subject: [PATCH 05/10] spi: spi-tegra20-flash: don't check 'delay_usecs' field for spi transfer In-Reply-To: <20210308145502.1075689-1-aardelean@deviqon.com> References: <20210308145502.1075689-1-aardelean@deviqon.com> Message-ID: <20210308145502.1075689-6-aardelean@deviqon.com> The 'delay_usecs' field was handled for backwards compatibility in case there were some users that still configured SPI delay transfers with this field. They should all be removed by now. So we can remove the 'delay_usecs' handling in this driver. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi-tegra20-sflash.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c index cfb7de737937..2888d8a8dc6d 100644 --- a/drivers/spi/spi-tegra20-sflash.c +++ b/drivers/spi/spi-tegra20-sflash.c @@ -341,8 +341,7 @@ static int tegra_sflash_transfer_one_message(struct spi_master *master, goto exit; } msg->actual_length += xfer->len; - if (xfer->cs_change && - (xfer->delay_usecs || xfer->delay.value)) { + if (xfer->cs_change && xfer->delay.value) { tegra_sflash_writel(tsd, tsd->def_command_reg, SPI_COMMAND); spi_transfer_delay_exec(xfer); -- 2.29.2 From aardelean at deviqon.com Mon Mar 8 14:54:58 2021 From: aardelean at deviqon.com (Alexandru Ardelean) Date: Mon, 8 Mar 2021 16:54:58 +0200 Subject: [PATCH 06/10] staging: greybus: spilib: use 'spi_delay_to_ns' for getting xfer delay In-Reply-To: <20210308145502.1075689-1-aardelean@deviqon.com> References: <20210308145502.1075689-1-aardelean@deviqon.com> Message-ID: <20210308145502.1075689-7-aardelean@deviqon.com> The intent is the removal of the 'delay_usecs' field from the spi_transfer struct, as there is a 'delay' field that does the same thing. The spi_delay_to_ns() can be used to get the transfer delay. It works by using the 'delay_usecs' field first (if it is non-zero), and finally uses the 'delay' field. Since the 'delay_usecs' field is going away, this change makes use of the spi_delay_to_ns() function. This also means dividing the return value of the function by 1000, to convert it to microseconds. To prevent any potential faults when converting to microseconds and since the result of spi_delay_to_ns() is int, the delay is being computed in 32 bits and then clamped between 0 & U16_MAX. Signed-off-by: Alexandru Ardelean --- drivers/staging/greybus/spilib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/greybus/spilib.c b/drivers/staging/greybus/spilib.c index 672d540d3365..30655153df6a 100644 --- a/drivers/staging/greybus/spilib.c +++ b/drivers/staging/greybus/spilib.c @@ -245,6 +245,7 @@ static struct gb_operation *gb_spi_operation_create(struct gb_spilib *spi, /* Fill in the transfers array */ xfer = spi->first_xfer; while (msg->state != GB_SPI_STATE_OP_DONE) { + int xfer_delay; if (xfer == spi->last_xfer) xfer_len = spi->last_xfer_size; else @@ -259,7 +260,9 @@ static struct gb_operation *gb_spi_operation_create(struct gb_spilib *spi, gb_xfer->speed_hz = cpu_to_le32(xfer->speed_hz); gb_xfer->len = cpu_to_le32(xfer_len); - gb_xfer->delay_usecs = cpu_to_le16(xfer->delay_usecs); + xfer_delay = spi_delay_to_ns(&xfer->delay, xfer) / 1000; + xfer_delay = clamp_t(u16, xfer_delay, 0, U16_MAX); + gb_xfer->delay_usecs = cpu_to_le16(xfer_delay); gb_xfer->cs_change = xfer->cs_change; gb_xfer->bits_per_word = xfer->bits_per_word; -- 2.29.2 From aardelean at deviqon.com Mon Mar 8 14:54:59 2021 From: aardelean at deviqon.com (Alexandru Ardelean) Date: Mon, 8 Mar 2021 16:54:59 +0200 Subject: [PATCH 07/10] spi: spi-falcon: remove check for 'delay_usecs' In-Reply-To: <20210308145502.1075689-1-aardelean@deviqon.com> References: <20210308145502.1075689-1-aardelean@deviqon.com> Message-ID: <20210308145502.1075689-8-aardelean@deviqon.com> The 'delay_usecs' field is being removed from the spi_transfer struct. This change removes it from the SPI Falcon driver. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi-falcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-falcon.c b/drivers/spi/spi-falcon.c index d3336a63f462..a7d4dffac66b 100644 --- a/drivers/spi/spi-falcon.c +++ b/drivers/spi/spi-falcon.c @@ -377,7 +377,7 @@ static int falcon_sflash_xfer_one(struct spi_master *master, m->actual_length += t->len; - WARN_ON(t->delay_usecs || t->delay.value || t->cs_change); + WARN_ON(t->delay.value || t->cs_change); spi_flags = 0; } -- 2.29.2 From aardelean at deviqon.com Mon Mar 8 14:55:00 2021 From: aardelean at deviqon.com (Alexandru Ardelean) Date: Mon, 8 Mar 2021 16:55:00 +0200 Subject: [PATCH 08/10] spi: fsl-espi: remove usage of 'delay_usecs' field In-Reply-To: <20210308145502.1075689-1-aardelean@deviqon.com> References: <20210308145502.1075689-1-aardelean@deviqon.com> Message-ID: <20210308145502.1075689-9-aardelean@deviqon.com> The 'delay_usecs' field is being removed from the spi_transfer struct. This change removes it from the SPI FSL ESPI driver. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi-fsl-espi.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index cf2b947c600e..f7066bef7b06 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -435,8 +435,7 @@ static int fsl_espi_trans(struct spi_message *m, struct spi_transfer *trans) static int fsl_espi_do_one_msg(struct spi_master *master, struct spi_message *m) { - unsigned int delay_usecs = 0, rx_nbits = 0; - unsigned int delay_nsecs = 0, delay_nsecs1 = 0; + unsigned int rx_nbits = 0, delay_nsecs = 0; struct spi_transfer *t, trans = {}; int ret; @@ -445,16 +444,10 @@ static int fsl_espi_do_one_msg(struct spi_master *master, goto out; list_for_each_entry(t, &m->transfers, transfer_list) { - if (t->delay_usecs) { - if (t->delay_usecs > delay_usecs) { - delay_usecs = t->delay_usecs; - delay_nsecs = delay_usecs * 1000; - } - } else { - delay_nsecs1 = spi_delay_to_ns(&t->delay, t); - if (delay_nsecs1 > delay_nsecs) - delay_nsecs = delay_nsecs1; - } + unsigned int delay = spi_delay_to_ns(&t->delay, t); + + if (delay > delay_nsecs) + delay_nsecs = delay; if (t->rx_nbits > rx_nbits) rx_nbits = t->rx_nbits; } -- 2.29.2 From aardelean at deviqon.com Mon Mar 8 14:55:01 2021 From: aardelean at deviqon.com (Alexandru Ardelean) Date: Mon, 8 Mar 2021 16:55:01 +0200 Subject: [PATCH 09/10] spi: core: remove 'delay_usecs' field from spi_transfer In-Reply-To: <20210308145502.1075689-1-aardelean@deviqon.com> References: <20210308145502.1075689-1-aardelean@deviqon.com> Message-ID: <20210308145502.1075689-10-aardelean@deviqon.com> The 'delay' field in the spi_transfer struct is meant to replace the 'delay_usecs' field. However some cleanup was required to remove the uses of 'delay_usecs'. Now that it's been cleaned up, we can remove it from the kernel tree. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi.c | 1 - include/linux/spi/spi.h | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index b08efe88ccd6..481427780162 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3178,7 +3178,6 @@ struct spi_replaced_transfers *spi_replace_transfers( /* clear cs_change and delay for all but the last */ if (i) { xfer->cs_change = false; - xfer->delay_usecs = 0; xfer->delay.value = 0; } } diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 592897fa4f03..ea1784a43267 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -832,9 +832,6 @@ extern void spi_res_release(struct spi_controller *ctlr, * @delay: delay to be introduced after this transfer before * (optionally) changing the chipselect status, then starting * the next transfer or completing this @spi_message. - * @delay_usecs: microseconds to delay after this transfer before - * (optionally) changing the chipselect status, then starting - * the next transfer or completing this @spi_message. * @word_delay: inter word delay to be introduced after each word size * (set by bits_per_word) transmission. * @effective_speed_hz: the effective SCK-speed that was used to @@ -946,7 +943,6 @@ struct spi_transfer { #define SPI_NBITS_DUAL 0x02 /* 2bits transfer */ #define SPI_NBITS_QUAD 0x04 /* 4bits transfer */ u8 bits_per_word; - u16 delay_usecs; struct spi_delay delay; struct spi_delay cs_change_delay; struct spi_delay word_delay; @@ -1060,14 +1056,6 @@ spi_transfer_del(struct spi_transfer *t) static inline int spi_transfer_delay_exec(struct spi_transfer *t) { - struct spi_delay d; - - if (t->delay_usecs) { - d.value = t->delay_usecs; - d.unit = SPI_DELAY_UNIT_USECS; - return spi_delay_exec(&d, NULL); - } - return spi_delay_exec(&t->delay, t); } -- 2.29.2 From aardelean at deviqon.com Mon Mar 8 14:55:02 2021 From: aardelean at deviqon.com (Alexandru Ardelean) Date: Mon, 8 Mar 2021 16:55:02 +0200 Subject: [PATCH 10/10] spi: docs: update info about 'delay_usecs' In-Reply-To: <20210308145502.1075689-1-aardelean@deviqon.com> References: <20210308145502.1075689-1-aardelean@deviqon.com> Message-ID: <20210308145502.1075689-11-aardelean@deviqon.com> The 'delay_usecs' field is no longer present on the spi_transfer struct. This change updates the doc to mention the usage of the (relatively) new 'delay' field. Signed-off-by: Alexandru Ardelean --- Documentation/spi/spi-summary.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Documentation/spi/spi-summary.rst b/Documentation/spi/spi-summary.rst index f1daffe10d78..d4239025461d 100644 --- a/Documentation/spi/spi-summary.rst +++ b/Documentation/spi/spi-summary.rst @@ -411,8 +411,11 @@ any more such messages. duplex (one pointer is NULL) transfers; + optionally defining short delays after transfers ... using - the spi_transfer.delay_usecs setting (this delay can be the - only protocol effect, if the buffer length is zero); + the spi_transfer.delay.value setting (this delay can be the + only protocol effect, if the buffer length is zero) ... + when specifying this delay the default spi_transfer.delay.unit + is microseconds, however this can be adjusted to clock cycles + or nanoseconds if needed; + whether the chipselect becomes inactive after a transfer and any delay ... by using the spi_transfer.cs_change flag; -- 2.29.2 From lars at metafoo.de Mon Mar 8 16:42:06 2021 From: lars at metafoo.de (Lars-Peter Clausen) Date: Mon, 8 Mar 2021 17:42:06 +0100 Subject: [PATCH 01/10] spi: spi-axi-spi-engine: remove usage of delay_usecs In-Reply-To: <20210308145502.1075689-2-aardelean@deviqon.com> References: <20210308145502.1075689-1-aardelean@deviqon.com> <20210308145502.1075689-2-aardelean@deviqon.com> Message-ID: <8a6ec9a1-71f8-ce1d-600a-66eba9244a54@metafoo.de> On 3/8/21 3:54 PM, Alexandru Ardelean wrote: > The 'delay_usecs' field was handled for backwards compatibility in case > there were some users that still configured SPI delay transfers with > this field. > > They should all be removed by now. > > Signed-off-by: Alexandru Ardelean > --- > drivers/spi/spi-axi-spi-engine.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-engine.c > index af86e6d6e16b..80c3e38f5c1b 100644 > --- a/drivers/spi/spi-axi-spi-engine.c > +++ b/drivers/spi/spi-axi-spi-engine.c > @@ -170,14 +170,10 @@ static void spi_engine_gen_sleep(struct spi_engine_program *p, bool dry, > unsigned int t; > int delay; > > - if (xfer->delay_usecs) { > - delay = xfer->delay_usecs; > - } else { > - delay = spi_delay_to_ns(&xfer->delay, xfer); > - if (delay < 0) > - return; > - delay /= 1000; > - } > + delay = spi_delay_to_ns(&xfer->delay, xfer); > + if (delay < 0) > + return; Bit of a nit, but this could be `delay <= 0` and then drop the check for `delay == 0` below. > + delay /= 1000; > > if (delay == 0) > return; From robh at kernel.org Mon Mar 8 18:22:17 2021 From: robh at kernel.org (Rob Herring) Date: Mon, 8 Mar 2021 11:22:17 -0700 Subject: [PATCH v3 0/5] Reset driver for IMX8MQ VPU hardware block In-Reply-To: <20210301151754.104749-1-benjamin.gaignard@collabora.com> References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> Message-ID: <20210308182217.GA2735443@robh.at.kernel.org> On Mon, Mar 01, 2021 at 04:17:49PM +0100, Benjamin Gaignard wrote: > The two VPUs inside IMX8MQ share the same control block which can be see > as a reset hardware block. > In order to be able to add the second VPU (for HECV decoding) it will be > more handy if the both VPU drivers instance don't have to share the > control block registers. This lead to implement it as an independ reset > driver and to change the VPU driver to use it. > > Please note that this series break the compatibility between the DTB and > kernel. This break is limited to IMX8MQ SoC and is done when the driver > is still in staging directory. As this information will be lost, please put in the binding and dts patch. > > version 3: > - Fix error in VPU example node > > version 2: > - Document the change in VPU bindings > > Benjamin Gaignard (5): > dt-bindings: reset: IMX8MQ VPU reset > dt-bindings: media: IMX8MQ VPU: document reset usage > reset: Add reset driver for IMX8MQ VPU block > media: hantro: Use reset driver > arm64: dts: imx8mq: Use reset driver for VPU hardware block > > .../bindings/media/nxp,imx8mq-vpu.yaml | 14 +- > .../bindings/reset/fsl,imx8mq-vpu-reset.yaml | 54 ++++++ > arch/arm64/boot/dts/freescale/imx8mq.dtsi | 31 +++- > drivers/reset/Kconfig | 8 + > drivers/reset/Makefile | 1 + > drivers/reset/reset-imx8mq-vpu.c | 169 ++++++++++++++++++ > drivers/staging/media/hantro/Kconfig | 1 + > drivers/staging/media/hantro/imx8m_vpu_hw.c | 61 ++----- > include/dt-bindings/reset/imx8mq-vpu-reset.h | 16 ++ > 9 files changed, 294 insertions(+), 61 deletions(-) > create mode 100644 Documentation/devicetree/bindings/reset/fsl,imx8mq-vpu-reset.yaml > create mode 100644 drivers/reset/reset-imx8mq-vpu.c > create mode 100644 include/dt-bindings/reset/imx8mq-vpu-reset.h > > -- > 2.25.1 > From robh at kernel.org Mon Mar 8 18:23:56 2021 From: robh at kernel.org (Rob Herring) Date: Mon, 8 Mar 2021 11:23:56 -0700 Subject: [PATCH v3 1/5] dt-bindings: reset: IMX8MQ VPU reset In-Reply-To: <20210301151754.104749-2-benjamin.gaignard@collabora.com> References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> <20210301151754.104749-2-benjamin.gaignard@collabora.com> Message-ID: <20210308182356.GB2735443@robh.at.kernel.org> On Mon, Mar 01, 2021 at 04:17:50PM +0100, Benjamin Gaignard wrote: > Document bindings for IMX8MQ VPU reset hardware block > > Signed-off-by: Benjamin Gaignard > --- > .../bindings/reset/fsl,imx8mq-vpu-reset.yaml | 54 +++++++++++++++++++ > include/dt-bindings/reset/imx8mq-vpu-reset.h | 16 ++++++ > 2 files changed, 70 insertions(+) > create mode 100644 Documentation/devicetree/bindings/reset/fsl,imx8mq-vpu-reset.yaml > create mode 100644 include/dt-bindings/reset/imx8mq-vpu-reset.h > > diff --git a/Documentation/devicetree/bindings/reset/fsl,imx8mq-vpu-reset.yaml b/Documentation/devicetree/bindings/reset/fsl,imx8mq-vpu-reset.yaml > new file mode 100644 > index 000000000000..00020421c0e3 > --- /dev/null > +++ b/Documentation/devicetree/bindings/reset/fsl,imx8mq-vpu-reset.yaml > @@ -0,0 +1,54 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/reset/fsl,imx8mq-vpu-reset.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Freescale i.MX8MQ VPU Reset Controller > + > +maintainers: > + - Benjamin Gaignard > + > +description: | > + The VPU reset controller is used to reset the video processor > + unit peripherals. Device nodes that need access to reset lines should > + specify them as a reset phandle in their corresponding node as > + specified in reset.txt. > + > + For list of all valid reset indices see > + for i.MX8MQ. > + > +properties: > + compatible: > + items: > + - const: fsl,imx8mq-vpu-reset > + - const: syscon Is there other functionality in the block? If so, add some details in 'description' above. > + > + reg: > + maxItems: 1 > + > + clocks: > + minItems: 1 > + maxItems: 3 Need to say what each clock is. > + > + '#reset-cells': > + const: 1 > + > +required: > + - compatible > + - reg > + - clocks > + - '#reset-cells' > + > +additionalProperties: false > + > +examples: > + - | > + #include > + > + vpu-reset at 38320000 { reset-controller at ... > + compatible = "fsl,imx8mq-vpu-reset", "syscon"; > + reg = <0x38320000 0x10000>; > + clocks = <&clk IMX8MQ_CLK_VPU_DEC_ROOT>; > + #reset-cells = <1>; > + }; > diff --git a/include/dt-bindings/reset/imx8mq-vpu-reset.h b/include/dt-bindings/reset/imx8mq-vpu-reset.h > new file mode 100644 > index 000000000000..efcbe18177fe > --- /dev/null > +++ b/include/dt-bindings/reset/imx8mq-vpu-reset.h > @@ -0,0 +1,16 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +/* > + * Copyright (c) 2021, Collabora > + * > + * i.MX7 System Reset Controller (SRC) driver > + * > + * Author: Benjamin Gaignard > + */ > + > +#ifndef DT_BINDINGS_VPU_RESET_IMX8MQ > +#define DT_BINDINGS_VPU_RESET_IMX8MQ > + > +#define IMX8MQ_RESET_VPU_RESET_G1 0 > +#define IMX8MQ_RESET_VPU_RESET_G2 1 > + > +#endif > -- > 2.25.1 > From robh at kernel.org Mon Mar 8 18:26:51 2021 From: robh at kernel.org (Rob Herring) Date: Mon, 8 Mar 2021 11:26:51 -0700 Subject: [PATCH v3 0/5] Reset driver for IMX8MQ VPU hardware block In-Reply-To: <20210308182217.GA2735443@robh.at.kernel.org> References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> <20210308182217.GA2735443@robh.at.kernel.org> Message-ID: <20210308182651.GA2741282@robh.at.kernel.org> On Mon, Mar 08, 2021 at 11:22:17AM -0700, Rob Herring wrote: > On Mon, Mar 01, 2021 at 04:17:49PM +0100, Benjamin Gaignard wrote: > > The two VPUs inside IMX8MQ share the same control block which can be see > > as a reset hardware block. > > In order to be able to add the second VPU (for HECV decoding) it will be > > more handy if the both VPU drivers instance don't have to share the > > control block registers. This lead to implement it as an independ reset > > driver and to change the VPU driver to use it. > > > > Please note that this series break the compatibility between the DTB and > > kernel. This break is limited to IMX8MQ SoC and is done when the driver > > is still in staging directory. > > As this information will be lost, please put in the binding and dts > patch. Actually, the adding the VPU reset binding doesn't break compatibility, so just the dts file changes needs it. > > > > > version 3: > > - Fix error in VPU example node > > > > version 2: > > - Document the change in VPU bindings > > > > Benjamin Gaignard (5): > > dt-bindings: reset: IMX8MQ VPU reset > > dt-bindings: media: IMX8MQ VPU: document reset usage > > reset: Add reset driver for IMX8MQ VPU block > > media: hantro: Use reset driver > > arm64: dts: imx8mq: Use reset driver for VPU hardware block > > > > .../bindings/media/nxp,imx8mq-vpu.yaml | 14 +- > > .../bindings/reset/fsl,imx8mq-vpu-reset.yaml | 54 ++++++ > > arch/arm64/boot/dts/freescale/imx8mq.dtsi | 31 +++- > > drivers/reset/Kconfig | 8 + > > drivers/reset/Makefile | 1 + > > drivers/reset/reset-imx8mq-vpu.c | 169 ++++++++++++++++++ > > drivers/staging/media/hantro/Kconfig | 1 + > > drivers/staging/media/hantro/imx8m_vpu_hw.c | 61 ++----- > > include/dt-bindings/reset/imx8mq-vpu-reset.h | 16 ++ > > 9 files changed, 294 insertions(+), 61 deletions(-) > > create mode 100644 Documentation/devicetree/bindings/reset/fsl,imx8mq-vpu-reset.yaml > > create mode 100644 drivers/reset/reset-imx8mq-vpu.c > > create mode 100644 include/dt-bindings/reset/imx8mq-vpu-reset.h > > > > -- > > 2.25.1 > > From robh at kernel.org Mon Mar 8 18:27:10 2021 From: robh at kernel.org (Rob Herring) Date: Mon, 8 Mar 2021 11:27:10 -0700 Subject: [PATCH v3 2/5] dt-bindings: media: IMX8MQ VPU: document reset usage In-Reply-To: <20210301151754.104749-3-benjamin.gaignard@collabora.com> References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> <20210301151754.104749-3-benjamin.gaignard@collabora.com> Message-ID: <20210308182710.GA2745438@robh.at.kernel.org> On Mon, 01 Mar 2021 16:17:51 +0100, Benjamin Gaignard wrote: > Document IMX8MQ VPU bindings to add the phandle to the reset driver. > > Provide an independent reset driver allow to the both VPUs to share > their control/reset hardware block. The reset driver replace what > was previously done be using the 'ctrl' registers inside the driver. > > This breaks the compatibility between DTB and kernel but the driver > is still in staging directory and limited to IMX8MQ SoC. > > Signed-off-by: Benjamin Gaignard > --- > version 3: > - Fix error in VPU example node > > .../devicetree/bindings/media/nxp,imx8mq-vpu.yaml | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > Reviewed-by: Rob Herring From robh at kernel.org Mon Mar 8 22:55:53 2021 From: robh at kernel.org (Rob Herring) Date: Mon, 8 Mar 2021 15:55:53 -0700 Subject: [PATCH v10 2/6] dt: bindings: add mt7621-sysc device tree binding documentation In-Reply-To: <20210307070426.15933-3-sergio.paracuellos@gmail.com> References: <20210307070426.15933-1-sergio.paracuellos@gmail.com> <20210307070426.15933-3-sergio.paracuellos@gmail.com> Message-ID: <20210308225553.GA3102663@robh.at.kernel.org> On Sun, 07 Mar 2021 08:04:22 +0100, Sergio Paracuellos wrote: > Adds device tree binding documentation for clocks in the > MT7621 SOC. > > Signed-off-by: Sergio Paracuellos > --- > .../bindings/clock/mediatek,mt7621-sysc.yaml | 68 +++++++++++++++++++ > 1 file changed, 68 insertions(+) > create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml > Reviewed-by: Rob Herring From viresh.kumar at linaro.org Tue Mar 9 04:28:09 2021 From: viresh.kumar at linaro.org (Viresh Kumar) Date: Tue, 9 Mar 2021 09:58:09 +0530 Subject: [PATCH 06/10] staging: greybus: spilib: use 'spi_delay_to_ns' for getting xfer delay In-Reply-To: <20210308145502.1075689-7-aardelean@deviqon.com> References: <20210308145502.1075689-1-aardelean@deviqon.com> <20210308145502.1075689-7-aardelean@deviqon.com> Message-ID: <20210309042809.dgop5dli36z27sj2@vireshk-i7> On 08-03-21, 16:54, Alexandru Ardelean wrote: > The intent is the removal of the 'delay_usecs' field from the > spi_transfer struct, as there is a 'delay' field that does the same > thing. > > The spi_delay_to_ns() can be used to get the transfer delay. It works by > using the 'delay_usecs' field first (if it is non-zero), and finally > uses the 'delay' field. > > Since the 'delay_usecs' field is going away, this change makes use of the > spi_delay_to_ns() function. This also means dividing the return value of > the function by 1000, to convert it to microseconds. > To prevent any potential faults when converting to microseconds and since > the result of spi_delay_to_ns() is int, the delay is being computed in 32 > bits and then clamped between 0 & U16_MAX. > > Signed-off-by: Alexandru Ardelean > --- > drivers/staging/greybus/spilib.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/greybus/spilib.c b/drivers/staging/greybus/spilib.c > index 672d540d3365..30655153df6a 100644 > --- a/drivers/staging/greybus/spilib.c > +++ b/drivers/staging/greybus/spilib.c > @@ -245,6 +245,7 @@ static struct gb_operation *gb_spi_operation_create(struct gb_spilib *spi, > /* Fill in the transfers array */ > xfer = spi->first_xfer; > while (msg->state != GB_SPI_STATE_OP_DONE) { > + int xfer_delay; > if (xfer == spi->last_xfer) > xfer_len = spi->last_xfer_size; > else > @@ -259,7 +260,9 @@ static struct gb_operation *gb_spi_operation_create(struct gb_spilib *spi, > > gb_xfer->speed_hz = cpu_to_le32(xfer->speed_hz); > gb_xfer->len = cpu_to_le32(xfer_len); > - gb_xfer->delay_usecs = cpu_to_le16(xfer->delay_usecs); > + xfer_delay = spi_delay_to_ns(&xfer->delay, xfer) / 1000; > + xfer_delay = clamp_t(u16, xfer_delay, 0, U16_MAX); > + gb_xfer->delay_usecs = cpu_to_le16(xfer_delay); > gb_xfer->cs_change = xfer->cs_change; > gb_xfer->bits_per_word = xfer->bits_per_word; Acked-by: Viresh Kumar -- viresh From sergio.paracuellos at gmail.com Tue Mar 9 05:22:20 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Tue, 9 Mar 2021 06:22:20 +0100 Subject: [PATCH v11 0/6] MIPS: ralink: add CPU clock detection and clock driver for MT7621 Message-ID: <20210309052226.29531-1-sergio.paracuellos@gmail.com> This patchset ports CPU clock detection for MT7621 from OpenWrt and adds a complete clock plan for the mt7621 SOC. The documentation for this SOC only talks about two registers regarding to the clocks: * SYSC_REG_CPLL_CLKCFG0 - provides some information about boostrapped refclock. PLL and dividers used for CPU and some sort of BUS (AHB?). * SYSC_REG_CPLL_CLKCFG1 - a banch of gates to enable/disable clocks for all or some ip cores. Registers needed for this driver to work are in two already mapped areas in its platform's device tree. These are 'sysc' and 'memc' nodes. Most of other drivers just make use of platform operations defined in 'asm/mach-ralink/ralink_regs.h' but this can be avoided declaring this two nodes to be accesible through syscon. Main registers for the clocks are in the sysc control node so this node is merged with clock properties and will also be the clock provider for the SoC. No documentation about a probably existent set of dividers for each ip core is included in the datasheets. So we cannot make anything better, AFAICT. Looking into driver code, and some openWRT patched there are another frequences which are used in some drivers (uart, sd...). According to all of this information the clock plan for this SoC is set as follows: - Main top clock "xtal" from where all the rest of the world is derived. - CPU clock "cpu" derived from "xtal" frequencies and a bunch of register reads and predividers. - BUS clock "bus" derived from "cpu" and with (cpu / 4) MHz. - Fixed clocks from "xtal": * "50m": 50 MHz. * "125m": 125 MHz. * "150m": 150 MHz. * "250m": 250 MHz. * "270m": 270 MHz. We also have a buch of gate clocks with their parents: - "hsdma": "150m" - "fe": "250m" - "sp_divtx": "270m" - "timer": "50m" - "pcm": "270m" - "pio": "50m" - "gdma": "bus" - "nand": "125m" - "i2c": "50m" - "i2s": "270m" - "spi": "bus" - "uart1": "50m" - "uart2": "50m" - "uart3": "50m" - "eth": "50m" - "pcie0": "125m" - "pcie1": "125m" - "pcie2": "125m" - "crypto": "250m" - "shxc": "50m" There was a previous attempt of doing this here[0] but the author (Chuanhong Guo) did not wanted to make assumptions of a clock plan for the platform that time. It seems that now he has a better idea of how the clocks are dispossed for this SoC so he share code[1] where some frequencies and clock parents for the gates are coded from a real mediatek private clock plan. I do really want this to be upstreamed so according to the comments in previous attempt[0] from Oleksij Rempel and the frequencies in code[1] I have tried to do this by myself. All of this patches have been tested in a GNUBee PC1 resulting in a working platform. Changes in v11: - Collect Rob's Reviewed-by in bindings documentation patch. - Fix MAINTAINERS patch using file 'mediatek,mt7621-sysc.yaml' for documentation bindings. Changes in v10: - Merge clock properties into 'sysc' system control node making this node a clock provider. - Update driver to use 'mediatek,mt7621-sysc' as compatible string. - Update documentation bindings and its related filename to 'mediatek,mt7621-sysc.yaml'. - Make use of 'linux/bitfields.h' header to avoid some preprocesor shift definitions and just use bit masks decreasing a bit LOC. Changes in v9: - Set two missing ret values to its related PTR_ERR in function 'mt7621_clk_probe' (also related with [3]). - Select MFC_SYSCON in Kconfig. Changes in v8: - Fix kernel test robot complain about the use of 'ret' variable initialized: see [3] Changes in v7: - Make use of CLK_OF_DECLARE_DRIVER instead of CLK_OF_DECLARE and register there only the top clocks that are needed in 'of_clk_init'. The rest of the clocks (fixed and gates) are now registered using a platform driver. Because we have avoid architecture dependent stuff now this has sense because we can enable this driver for COMPILE_TEST. - Convert fixed clocks and gates related function to receive a 'struct device' pointer instead of 'struct device_node' one. - Make use of dev_ APIS in stuff related with platform driver instead of use device_node related stuff. - Add new static global 'mt7621_clk_early' to store pointers to clk_hw registered at 'of_clk_init' stage. Make use of this in platform device probe function to properly copy this into the new required 'clk_data' to provide a properly hierarchy clock structure. - Rename 'mt7621_register_top_clocks' function into a more accurate name now which is 'mt7621_register_early_clocks'. - Enable driver for COMPILE_TEST. Changes in v6: - Rewrite bindings to properly access the registers needed for the driver making use of syscon for two different areas: 'sysc' and 'memc'. With this changes architecture dependent include 'asm/mach-ralink/ralink_regs.h' is not needed anymore because we access this two syscons using a phandle through kernel's regmap APIs. Explanation of this two areas is in [2]. - Add new 'mt7621_clk_priv' struct to store there pointers to regmap handlers to be able to use regmap operations from normal clock api functions. Add this pointer in 'mt7621_clk' and 'mt7621_clk_gate' before register its related clocks to make things work. - Add Greg's Acked-by in patches 4 and 5. - Rebase this series on the top of linux-next tag 'next-20210215'. v5 RESEND notes: - I am resending this as I was told to do that. - Please, take into account Rob's comments to DT node patch and my reply with explanation about how are the current device tree nodes for this architecture being used in [2]. Changes in v5: - Avoid the use of syscon. All drivers of this platform are just using platform operations defined in 'asm/mach-ralink/ralink_regs.h'. We also need them for some PLL registers that are not in the sys control area. Hence, since we must use this dependency avoid to define clock driver as a child of the sysc node in the device tree and follow current platform code style. - Update bindings documentation to don't refer the syscon and make remove 'clock-output-names' property from required ones. - Use 'asm/mach-ralink/ralink_regs.h' platform read and write operations instead of regmap from the syscon node. - Remove 'mt7621_clk_provider' and directly declare 'clk_hw_onecell_data' pointer in 'mt7621_clk_init' and pass from there into different register functions. Remove pointers to 'mt7621_clk_provider' in the rest fo structs used in this driver. - Remove MHZ macro and just pass values directly in hertzs. - Avoid 'CLK_IGNORE_UNUSED' flag for gates and add a new function called 'mt7621_prepare_enable_clocks' to prepare all of them to make clocks referenced and don't affect current driver code. - Remove COMPILE_TEST from Kconfig because of the use of especific arch stuff. - Fix commit message where a typo for "frequencies" word was present. - Make use of parent_clk_data in 'CLK_BASE' macro. - Remove MODULE_* macros from code since this is not a module. - Remove not needed includes. - Hardcode "xtal" as parent in FIXED macro. - Change 'else if' clause into 'if' clause since a return statement was being used in 'mt7621_xtal_recalc_rate'. NOTES: - Driver is still being declared using 'CLK_OF_DECLARE' for all the clocks. I have explored the possibility to make some of them available afterwards using 'CLK_OF_DECLARE_DRIVER' for top clocks and the rest using a platform driver. The resulting code was uglier since we only want to use the same device tree node and the top clocks must be copied again for the new platform register stuff to properly have a good hierarchy. New globals needs to be introduced and in this particular case I don't really see the benefits of doing in this way. I am totally ok to have all the clocks registered at early stage since from other drivers perspective we only really need to enable gates. So, I prefer to have them in that way if it is not a real problem, of course. Changes in v4: - Add Acked-by from Rob Herring for binding headers (PATCH 1/6). - Convert bindings to not use syscon phandle and declare clock as a child of the syscon node. Update device tree and binding doc accordly. - Make use of 'syscon_node_to_regmap' in driver code instead of get this using the phandle function. - Properly unregister clocks for the error path of the function 'mt7621_clk_init'. - Include ARRAY_SIZE of fixed clocks in the 'count' to kzalloc of 'clk_data'. - Add new patch changing invalid vendor 'mtk' in favour of 'mediatek' which is the one listed in 'vendor-prefixes.yaml'. Update mt7621 code accordly. I have added this patch inside this series because clk binding is referring syscon node and the string for that node was with not listed vendor. Hence update and have all of this correct in the same series. Changes in v3: - Fix compilation warnings reported by kernel test robot because of ignoring return values of 'of_clk_hw_register' in functions 'mt7621_register_top_clocks' and 'mt7621_gate_ops_init'. - Fix dts file and binding documentation 'clock-output-names'. Changes in v2: - Remove the following patches: * dt: bindings: add mt7621-pll device tree binding documentation. * MIPS: ralink: add clock device providing cpu/ahb/apb clock for mt7621. - Move all relevant clock code to 'drivers/clk/ralink/clk-mt7621.c' and unify there previous 'mt7621-pll' and 'mt7621-clk' into a unique driver and binding 'mt7621-clk'. - Driver is not a platform driver anymore and now make use of 'CLK_OF_DECLARE' because we need clocks available in 'plat_time_init' before setting up the timer for the GIC. - Use new fixed clocks as parents for different gates and deriving from 'xtal' using frequencies in[1]. - Adapt dts file and bindings header and documentation for new changes. - Change MAINTAINERS file to only contains clk-mt7621.c code and mediatek,mt7621-clk.yaml file. [0]: https://www.lkml.org/lkml/2019/7/23/1044 [1]: https://github.com/981213/linux/commit/2eca1f045e4c3db18c941135464c0d7422ad8133 [2]: https://lkml.org/lkml/2020/12/20/47 [3]: http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2021-February/150772.html Sergio Paracuellos (6): dt-bindings: clock: add dt binding header for mt7621 clocks dt: bindings: add mt7621-sysc device tree binding documentation clk: ralink: add clock driver for mt7621 SoC staging: mt7621-dts: make use of new 'mt7621-clk' staging: mt7621-dts: use valid vendor 'mediatek' instead of invalid 'mtk' MAINTAINERS: add MT7621 CLOCK maintainer .../bindings/clock/mediatek,mt7621-sysc.yaml | 68 +++ MAINTAINERS | 6 + arch/mips/ralink/mt7621.c | 6 +- drivers/clk/Kconfig | 1 + drivers/clk/Makefile | 1 + drivers/clk/ralink/Kconfig | 15 + drivers/clk/ralink/Makefile | 2 + drivers/clk/ralink/clk-mt7621.c | 528 ++++++++++++++++++ drivers/staging/mt7621-dts/gbpc1.dts | 11 - drivers/staging/mt7621-dts/mt7621.dtsi | 82 ++- include/dt-bindings/clock/mt7621-clk.h | 41 ++ 11 files changed, 702 insertions(+), 59 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml create mode 100644 drivers/clk/ralink/Kconfig create mode 100644 drivers/clk/ralink/Makefile create mode 100644 drivers/clk/ralink/clk-mt7621.c create mode 100644 include/dt-bindings/clock/mt7621-clk.h -- 2.25.1 From sergio.paracuellos at gmail.com Tue Mar 9 05:22:21 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Tue, 9 Mar 2021 06:22:21 +0100 Subject: [PATCH v11 1/6] dt-bindings: clock: add dt binding header for mt7621 clocks In-Reply-To: <20210309052226.29531-1-sergio.paracuellos@gmail.com> References: <20210309052226.29531-1-sergio.paracuellos@gmail.com> Message-ID: <20210309052226.29531-2-sergio.paracuellos@gmail.com> Adds dt binding header for 'mediatek,mt7621-clk' clocks. Acked-by: Rob Herring Signed-off-by: Sergio Paracuellos --- include/dt-bindings/clock/mt7621-clk.h | 41 ++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 include/dt-bindings/clock/mt7621-clk.h diff --git a/include/dt-bindings/clock/mt7621-clk.h b/include/dt-bindings/clock/mt7621-clk.h new file mode 100644 index 000000000000..1422badcf9de --- /dev/null +++ b/include/dt-bindings/clock/mt7621-clk.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Author: Sergio Paracuellos + */ + +#ifndef _DT_BINDINGS_CLK_MT7621_H +#define _DT_BINDINGS_CLK_MT7621_H + +#define MT7621_CLK_XTAL 0 +#define MT7621_CLK_CPU 1 +#define MT7621_CLK_BUS 2 +#define MT7621_CLK_50M 3 +#define MT7621_CLK_125M 4 +#define MT7621_CLK_150M 5 +#define MT7621_CLK_250M 6 +#define MT7621_CLK_270M 7 + +#define MT7621_CLK_HSDMA 8 +#define MT7621_CLK_FE 9 +#define MT7621_CLK_SP_DIVTX 10 +#define MT7621_CLK_TIMER 11 +#define MT7621_CLK_PCM 12 +#define MT7621_CLK_PIO 13 +#define MT7621_CLK_GDMA 14 +#define MT7621_CLK_NAND 15 +#define MT7621_CLK_I2C 16 +#define MT7621_CLK_I2S 17 +#define MT7621_CLK_SPI 18 +#define MT7621_CLK_UART1 19 +#define MT7621_CLK_UART2 20 +#define MT7621_CLK_UART3 21 +#define MT7621_CLK_ETH 22 +#define MT7621_CLK_PCIE0 23 +#define MT7621_CLK_PCIE1 24 +#define MT7621_CLK_PCIE2 25 +#define MT7621_CLK_CRYPTO 26 +#define MT7621_CLK_SHXC 27 + +#define MT7621_CLK_MAX 28 + +#endif /* _DT_BINDINGS_CLK_MT7621_H */ -- 2.25.1 From sergio.paracuellos at gmail.com Tue Mar 9 05:22:22 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Tue, 9 Mar 2021 06:22:22 +0100 Subject: [PATCH v11 2/6] dt: bindings: add mt7621-sysc device tree binding documentation In-Reply-To: <20210309052226.29531-1-sergio.paracuellos@gmail.com> References: <20210309052226.29531-1-sergio.paracuellos@gmail.com> Message-ID: <20210309052226.29531-3-sergio.paracuellos@gmail.com> Adds device tree binding documentation for clocks in the MT7621 SOC. Reviewed-by: Rob Herring Signed-off-by: Sergio Paracuellos --- .../bindings/clock/mediatek,mt7621-sysc.yaml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml diff --git a/Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml b/Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml new file mode 100644 index 000000000000..915f84efd763 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml @@ -0,0 +1,68 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/mediatek,mt7621-sysc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MT7621 Clock Device Tree Bindings + +maintainers: + - Sergio Paracuellos + +description: | + The MT7621 has a PLL controller from where the cpu clock is provided + as well as derived clocks for the bus and the peripherals. It also + can gate SoC device clocks. + + Each clock is assigned an identifier and client nodes use this identifier + to specify the clock which they consume. + + All these identifiers could be found in: + [1]: . + + The clocks are provided inside a system controller node. + +properties: + compatible: + items: + - const: mediatek,mt7621-sysc + - const: syscon + + reg: + maxItems: 1 + + "#clock-cells": + description: + The first cell indicates the clock number, see [1] for available + clocks. + const: 1 + + ralink,memctl: + $ref: /schemas/types.yaml#/definitions/phandle + description: + phandle of syscon used to control memory registers + + clock-output-names: + maxItems: 8 + +required: + - compatible + - reg + - '#clock-cells' + - ralink,memctl + +additionalProperties: false + +examples: + - | + #include + + sysc: sysc at 0 { + compatible = "mediatek,mt7621-sysc", "syscon"; + reg = <0x0 0x100>; + #clock-cells = <1>; + ralink,memctl = <&memc>; + clock-output-names = "xtal", "cpu", "bus", + "50m", "125m", "150m", + "250m", "270m"; + }; -- 2.25.1 From sergio.paracuellos at gmail.com Tue Mar 9 05:22:23 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Tue, 9 Mar 2021 06:22:23 +0100 Subject: [PATCH v11 3/6] clk: ralink: add clock driver for mt7621 SoC In-Reply-To: <20210309052226.29531-1-sergio.paracuellos@gmail.com> References: <20210309052226.29531-1-sergio.paracuellos@gmail.com> Message-ID: <20210309052226.29531-4-sergio.paracuellos@gmail.com> The documentation for this SOC only talks about two registers regarding to the clocks: * SYSC_REG_CPLL_CLKCFG0 - provides some information about boostrapped refclock. PLL and dividers used for CPU and some sort of BUS. * SYSC_REG_CPLL_CLKCFG1 - a banch of gates to enable/disable clocks for all or some ip cores. Looking into driver code, and some openWRT patched there are another frequencies which are used in some drivers (uart, sd...). According to all of this information the clock plan for this SoC is set as follows: - Main top clock "xtal" from where all the rest of the world is derived. - CPU clock "cpu" derived from "xtal" frequencies and a bunch of register reads and predividers. - BUS clock "bus" derived from "cpu" and with (cpu / 4) MHz. - Fixed clocks from "xtal": * "50m": 50 MHz. * "125m": 125 MHz. * "150m": 150 MHz. * "250m": 250 MHz. * "270m": 270 MHz. We also have a buch of gate clocks with their parents: * "hsdma": "150m" * "fe": "250m" * "sp_divtx": "270m" * "timer": "50m" * "pcm": "270m" * "pio": "50m" * "gdma": "bus" * "nand": "125m" * "i2c": "50m" * "i2s": "270m" * "spi": "bus" * "uart1": "50m" * "uart2": "50m" * "uart3": "50m" * "eth": "50m" * "pcie0": "125m" * "pcie1": "125m" * "pcie2": "125m" * "crypto": "250m" * "shxc": "50m" With this information the clk driver will provide clock and gates functionality from a a set of hardcoded clocks allowing to define a nice device tree without fixed clocks. Signed-off-by: Sergio Paracuellos --- drivers/clk/Kconfig | 1 + drivers/clk/Makefile | 1 + drivers/clk/ralink/Kconfig | 15 + drivers/clk/ralink/Makefile | 2 + drivers/clk/ralink/clk-mt7621.c | 528 ++++++++++++++++++++++++++++++++ 5 files changed, 547 insertions(+) create mode 100644 drivers/clk/ralink/Kconfig create mode 100644 drivers/clk/ralink/Makefile create mode 100644 drivers/clk/ralink/clk-mt7621.c diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 7c5dc348c16f..70b23da997bf 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -382,6 +382,7 @@ source "drivers/clk/mediatek/Kconfig" source "drivers/clk/meson/Kconfig" source "drivers/clk/mvebu/Kconfig" source "drivers/clk/qcom/Kconfig" +source "drivers/clk/ralink/Kconfig" source "drivers/clk/renesas/Kconfig" source "drivers/clk/rockchip/Kconfig" source "drivers/clk/samsung/Kconfig" diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 5325847469e9..1b35ad852721 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -98,6 +98,7 @@ obj-$(CONFIG_COMMON_CLK_NXP) += nxp/ obj-$(CONFIG_MACH_PISTACHIO) += pistachio/ obj-$(CONFIG_COMMON_CLK_PXA) += pxa/ obj-$(CONFIG_COMMON_CLK_QCOM) += qcom/ +obj-y += ralink/ obj-y += renesas/ obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ obj-$(CONFIG_COMMON_CLK_SAMSUNG) += samsung/ diff --git a/drivers/clk/ralink/Kconfig b/drivers/clk/ralink/Kconfig new file mode 100644 index 000000000000..3e3f5cb9ad88 --- /dev/null +++ b/drivers/clk/ralink/Kconfig @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# MediaTek Mt7621 Clock Driver +# +menu "Clock driver for Mediatek mt7621 SoC" + depends on SOC_MT7621 || COMPILE_TEST + +config CLK_MT7621 + bool "Clock driver for MediaTek MT7621" + depends on SOC_MT7621 || COMPILE_TEST + default SOC_MT7621 + select MFD_SYSCON + help + This driver supports MediaTek MT7621 basic clocks. +endmenu diff --git a/drivers/clk/ralink/Makefile b/drivers/clk/ralink/Makefile new file mode 100644 index 000000000000..cf6f9216379d --- /dev/null +++ b/drivers/clk/ralink/Makefile @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_CLK_MT7621) += clk-mt7621.o diff --git a/drivers/clk/ralink/clk-mt7621.c b/drivers/clk/ralink/clk-mt7621.c new file mode 100644 index 000000000000..6aea5accd51c --- /dev/null +++ b/drivers/clk/ralink/clk-mt7621.c @@ -0,0 +1,528 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Mediatek MT7621 Clock Driver + * Author: Sergio Paracuellos + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Configuration registers */ +#define SYSC_REG_SYSTEM_CONFIG0 0x10 +#define SYSC_REG_SYSTEM_CONFIG1 0x14 +#define SYSC_REG_CLKCFG0 0x2c +#define SYSC_REG_CLKCFG1 0x30 +#define SYSC_REG_CUR_CLK_STS 0x44 +#define MEMC_REG_CPU_PLL 0x648 + +#define XTAL_MODE_SEL_MASK GENMASK(8, 6) +#define CPU_CLK_SEL_MASK GENMASK(31, 30) +#define CUR_CPU_FDIV_MASK GENMASK(12, 8) +#define CUR_CPU_FFRAC_MASK GENMASK(4, 0) +#define CPU_PLL_PREDIV_MASK GENMASK(13, 12) +#define CPU_PLL_FBDIV_MASK GENMASK(10, 4) + +struct mt7621_clk_priv { + struct regmap *sysc; + struct regmap *memc; +}; + +struct mt7621_clk { + struct clk_hw hw; + struct mt7621_clk_priv *priv; +}; + +struct mt7621_fixed_clk { + u8 idx; + const char *name; + const char *parent_name; + unsigned long rate; + struct clk_hw *hw; +}; + +struct mt7621_gate { + u8 idx; + const char *name; + const char *parent_name; + struct mt7621_clk_priv *priv; + u32 bit_idx; + struct clk_hw hw; +}; + +#define GATE(_id, _name, _pname, _shift) \ + { \ + .idx = _id, \ + .name = _name, \ + .parent_name = _pname, \ + .bit_idx = _shift \ + } + +static struct mt7621_gate mt7621_gates[] = { + GATE(MT7621_CLK_HSDMA, "hsdma", "150m", BIT(5)), + GATE(MT7621_CLK_FE, "fe", "250m", BIT(6)), + GATE(MT7621_CLK_SP_DIVTX, "sp_divtx", "270m", BIT(7)), + GATE(MT7621_CLK_TIMER, "timer", "50m", BIT(8)), + GATE(MT7621_CLK_PCM, "pcm", "270m", BIT(11)), + GATE(MT7621_CLK_PIO, "pio", "50m", BIT(13)), + GATE(MT7621_CLK_GDMA, "gdma", "bus", BIT(14)), + GATE(MT7621_CLK_NAND, "nand", "125m", BIT(15)), + GATE(MT7621_CLK_I2C, "i2c", "50m", BIT(16)), + GATE(MT7621_CLK_I2S, "i2s", "270m", BIT(17)), + GATE(MT7621_CLK_SPI, "spi", "bus", BIT(18)), + GATE(MT7621_CLK_UART1, "uart1", "50m", BIT(19)), + GATE(MT7621_CLK_UART2, "uart2", "50m", BIT(20)), + GATE(MT7621_CLK_UART3, "uart3", "50m", BIT(21)), + GATE(MT7621_CLK_ETH, "eth", "50m", BIT(23)), + GATE(MT7621_CLK_PCIE0, "pcie0", "125m", BIT(24)), + GATE(MT7621_CLK_PCIE1, "pcie1", "125m", BIT(25)), + GATE(MT7621_CLK_PCIE2, "pcie2", "125m", BIT(26)), + GATE(MT7621_CLK_CRYPTO, "crypto", "250m", BIT(29)), + GATE(MT7621_CLK_SHXC, "shxc", "50m", BIT(30)) +}; + +static inline struct mt7621_gate *to_mt7621_gate(struct clk_hw *hw) +{ + return container_of(hw, struct mt7621_gate, hw); +} + +static int mt7621_gate_enable(struct clk_hw *hw) +{ + struct mt7621_gate *clk_gate = to_mt7621_gate(hw); + struct regmap *sysc = clk_gate->priv->sysc; + + return regmap_update_bits(sysc, SYSC_REG_CLKCFG1, + clk_gate->bit_idx, clk_gate->bit_idx); +} + +static void mt7621_gate_disable(struct clk_hw *hw) +{ + struct mt7621_gate *clk_gate = to_mt7621_gate(hw); + struct regmap *sysc = clk_gate->priv->sysc; + + regmap_update_bits(sysc, SYSC_REG_CLKCFG1, clk_gate->bit_idx, 0); +} + +static int mt7621_gate_is_enabled(struct clk_hw *hw) +{ + struct mt7621_gate *clk_gate = to_mt7621_gate(hw); + struct regmap *sysc = clk_gate->priv->sysc; + u32 val; + + if (regmap_read(sysc, SYSC_REG_CLKCFG1, &val)) + return 0; + + return val & BIT(clk_gate->bit_idx); +} + +static const struct clk_ops mt7621_gate_ops = { + .enable = mt7621_gate_enable, + .disable = mt7621_gate_disable, + .is_enabled = mt7621_gate_is_enabled, +}; + +static int mt7621_gate_ops_init(struct device *dev, + struct mt7621_gate *sclk) +{ + struct clk_init_data init = { + .flags = CLK_SET_RATE_PARENT, + .num_parents = 1, + .parent_names = &sclk->parent_name, + .ops = &mt7621_gate_ops, + .name = sclk->name, + }; + + sclk->hw.init = &init; + return devm_clk_hw_register(dev, &sclk->hw); +} + +static int mt7621_register_gates(struct device *dev, + struct clk_hw_onecell_data *clk_data, + struct mt7621_clk_priv *priv) +{ + struct clk_hw **hws = clk_data->hws; + int ret, i; + + for (i = 0; i < ARRAY_SIZE(mt7621_gates); i++) { + struct mt7621_gate *sclk = &mt7621_gates[i]; + + sclk->priv = priv; + ret = mt7621_gate_ops_init(dev, sclk); + if (ret) { + dev_err(dev, "Couldn't register clock %s\n", sclk->name); + goto err_clk_unreg; + } + + hws[sclk->idx] = &sclk->hw; + } + + return 0; + +err_clk_unreg: + while (--i >= 0) { + struct mt7621_gate *sclk = &mt7621_gates[i]; + + clk_hw_unregister(&sclk->hw); + } + return ret; +} + +#define FIXED(_id, _name, _rate) \ + { \ + .idx = _id, \ + .name = _name, \ + .parent_name = "xtal", \ + .rate = _rate \ + } + +static struct mt7621_fixed_clk mt7621_fixed_clks[] = { + FIXED(MT7621_CLK_50M, "50m", 50000000), + FIXED(MT7621_CLK_125M, "125m", 125000000), + FIXED(MT7621_CLK_150M, "150m", 150000000), + FIXED(MT7621_CLK_250M, "250m", 250000000), + FIXED(MT7621_CLK_270M, "270m", 270000000), +}; + +static int mt7621_register_fixed_clocks(struct device *dev, + struct clk_hw_onecell_data *clk_data) +{ + struct clk_hw **hws = clk_data->hws; + int ret, i; + + for (i = 0; i < ARRAY_SIZE(mt7621_fixed_clks); i++) { + struct mt7621_fixed_clk *sclk = &mt7621_fixed_clks[i]; + + sclk->hw = clk_hw_register_fixed_rate(dev, sclk->name, + sclk->parent_name, 0, + sclk->rate); + if (IS_ERR(sclk->hw)) { + dev_err(dev, "Couldn't register clock %s\n", sclk->name); + ret = PTR_ERR(sclk->hw); + goto err_clk_unreg; + } + + hws[sclk->idx] = sclk->hw; + } + + return 0; + +err_clk_unreg: + while (--i >= 0) { + struct mt7621_fixed_clk *sclk = &mt7621_fixed_clks[i]; + + clk_hw_unregister_fixed_rate(sclk->hw); + } + return ret; +} + +static inline struct mt7621_clk *to_mt7621_clk(struct clk_hw *hw) +{ + return container_of(hw, struct mt7621_clk, hw); +} + +static unsigned long mt7621_xtal_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct mt7621_clk *clk = to_mt7621_clk(hw); + struct regmap *sysc = clk->priv->sysc; + u32 val; + + regmap_read(sysc, SYSC_REG_SYSTEM_CONFIG0, &val); + val = FIELD_GET(XTAL_MODE_SEL_MASK, val); + + if (val <= 2) + return 20000000; + if (val <= 5) + return 40000000; + + return 25000000; +} + +static unsigned long mt7621_cpu_recalc_rate(struct clk_hw *hw, + unsigned long xtal_clk) +{ + static const u32 prediv_tbl[] = { 0, 1, 2, 2 }; + struct mt7621_clk *clk = to_mt7621_clk(hw); + struct regmap *sysc = clk->priv->sysc; + struct regmap *memc = clk->priv->memc; + u32 clkcfg, clk_sel, curclk, ffiv, ffrac; + u32 pll, prediv, fbdiv; + unsigned long cpu_clk; + + regmap_read(sysc, SYSC_REG_CLKCFG0, &clkcfg); + clk_sel = FIELD_GET(CPU_CLK_SEL_MASK, clkcfg); + + regmap_read(sysc, SYSC_REG_CUR_CLK_STS, &curclk); + ffiv = FIELD_GET(CUR_CPU_FDIV_MASK, curclk); + ffrac = FIELD_GET(CUR_CPU_FFRAC_MASK, curclk); + + switch (clk_sel) { + case 0: + cpu_clk = 500000000; + break; + case 1: + regmap_read(memc, MEMC_REG_CPU_PLL, &pll); + fbdiv = FIELD_GET(CPU_PLL_FBDIV_MASK, pll); + prediv = FIELD_GET(CPU_PLL_PREDIV_MASK, pll); + cpu_clk = ((fbdiv + 1) * xtal_clk) >> prediv_tbl[prediv]; + break; + default: + cpu_clk = xtal_clk; + } + + return cpu_clk / ffiv * ffrac; +} + +static unsigned long mt7621_bus_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + return parent_rate / 4; +} + +#define CLK_BASE(_name, _parent, _recalc) { \ + .init = &(struct clk_init_data) { \ + .name = _name, \ + .ops = &(const struct clk_ops) { \ + .recalc_rate = _recalc, \ + }, \ + .parent_data = &(const struct clk_parent_data) { \ + .name = _parent, \ + .fw_name = _parent \ + }, \ + .num_parents = _parent ? 1 : 0 \ + }, \ +} + +static struct mt7621_clk mt7621_clks_base[] = { + { CLK_BASE("xtal", NULL, mt7621_xtal_recalc_rate) }, + { CLK_BASE("cpu", "xtal", mt7621_cpu_recalc_rate) }, + { CLK_BASE("bus", "cpu", mt7621_bus_recalc_rate) }, +}; + +static struct clk_hw *mt7621_clk_early[MT7621_CLK_MAX]; + +static int mt7621_register_early_clocks(struct device_node *np, + struct clk_hw_onecell_data *clk_data, + struct mt7621_clk_priv *priv) +{ + struct clk_hw **hws = clk_data->hws; + int ret, i, j; + + for (i = 0; i < ARRAY_SIZE(mt7621_clks_base); i++) { + struct mt7621_clk *sclk = &mt7621_clks_base[i]; + + sclk->priv = priv; + ret = of_clk_hw_register(np, &sclk->hw); + if (ret) { + pr_err("Couldn't register top clock %i\n", i); + goto err_clk_unreg; + } + + hws[i] = &sclk->hw; + mt7621_clk_early[i] = &sclk->hw; + } + + for (j = i; j < MT7621_CLK_MAX; j++) + mt7621_clk_early[j] = ERR_PTR(-EPROBE_DEFER); + + return 0; + +err_clk_unreg: + while (--i >= 0) { + struct mt7621_clk *sclk = &mt7621_clks_base[i]; + + clk_hw_unregister(&sclk->hw); + } + return ret; +} + +static int mt7621_prepare_enable_clocks(struct clk_hw_onecell_data *clk_data) +{ + int ret, i; + + for (i = 0; i < MT7621_CLK_MAX; i++) { + ret = clk_prepare_enable(clk_data->hws[i]->clk); + if (ret) { + pr_err("failed to enable clk: %d\n", ret); + goto err_clk_disable; + } + } + + return 0; + +err_clk_disable: + while (--i >= 0) + clk_disable_unprepare(clk_data->hws[i]->clk); + return ret; +} + +static void __init mt7621_clk_init(struct device_node *node) +{ + struct mt7621_clk_priv *priv; + struct clk_hw_onecell_data *clk_data; + int ret, i, count; + + priv = kzalloc(sizeof(*priv), GFP_KERNEL); + if (!priv) + return; + + priv->sysc = syscon_node_to_regmap(node); + if (IS_ERR(priv->sysc)) { + pr_err("Could not get sysc syscon regmap\n"); + goto free_clk_priv; + } + + priv->memc = syscon_regmap_lookup_by_phandle(node, "ralink,memctl"); + if (IS_ERR(priv->memc)) { + pr_err("Could not get memc syscon regmap\n"); + goto free_clk_priv; + } + + count = ARRAY_SIZE(mt7621_clks_base) + + ARRAY_SIZE(mt7621_fixed_clks) + ARRAY_SIZE(mt7621_gates); + clk_data = kzalloc(struct_size(clk_data, hws, count), GFP_KERNEL); + if (!clk_data) + goto free_clk_priv; + + ret = mt7621_register_early_clocks(node, clk_data, priv); + if (ret) { + pr_err("Couldn't register top clocks\n"); + goto free_clk_data; + } + + clk_data->num = count; + + ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); + if (ret) { + pr_err("Couldn't add clk hw provider\n"); + goto unreg_clk_top; + } + + return; + +unreg_clk_top: + for (i = 0; i < ARRAY_SIZE(mt7621_clks_base); i++) { + struct mt7621_clk *sclk = &mt7621_clks_base[i]; + + clk_hw_unregister(&sclk->hw); + } + +free_clk_data: + kfree(clk_data); + +free_clk_priv: + kfree(priv); +} +CLK_OF_DECLARE_DRIVER(mt7621_clk, "mediatek,mt7621-sysc", mt7621_clk_init); + +static int mt7621_clk_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + struct clk_hw_onecell_data *clk_data; + struct device *dev = &pdev->dev; + struct mt7621_clk_priv *priv; + int ret, i, count; + + priv = kzalloc(sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->sysc = syscon_node_to_regmap(np); + if (IS_ERR(priv->sysc)) { + ret = PTR_ERR(priv->sysc); + dev_err(dev, "Could not get sysc syscon regmap\n"); + goto free_clk_priv; + } + + priv->memc = syscon_regmap_lookup_by_phandle(np, "ralink,memctl"); + if (IS_ERR(priv->memc)) { + ret = PTR_ERR(priv->memc); + dev_err(dev, "Could not get memc syscon regmap\n"); + goto free_clk_priv; + } + + count = ARRAY_SIZE(mt7621_clks_base) + + ARRAY_SIZE(mt7621_fixed_clks) + ARRAY_SIZE(mt7621_gates); + clk_data = kzalloc(struct_size(clk_data, hws, count), GFP_KERNEL); + if (!clk_data) { + ret = -ENOMEM; + goto free_clk_priv; + } + + for (i = 0; i < ARRAY_SIZE(mt7621_clks_base); i++) + clk_data->hws[i] = mt7621_clk_early[i]; + + ret = mt7621_register_fixed_clocks(dev, clk_data); + if (ret) { + dev_err(dev, "Couldn't register fixed clocks\n"); + goto free_clk_data; + } + + ret = mt7621_register_gates(dev, clk_data, priv); + if (ret) { + dev_err(dev, "Couldn't register fixed clock gates\n"); + goto unreg_clk_fixed; + } + + clk_data->num = count; + + ret = mt7621_prepare_enable_clocks(clk_data); + if (ret) { + dev_err(dev, "Couldn't register fixed clock gates\n"); + goto unreg_clk_gates; + } + + ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, clk_data); + if (ret) { + dev_err(dev, "Couldn't add clk hw provider\n"); + goto disable_clks; + } + + return 0; + +disable_clks: + for (i = 0; i < MT7621_CLK_MAX; i++) + clk_disable_unprepare(clk_data->hws[i]->clk); + +unreg_clk_gates: + for (i = 0; i < ARRAY_SIZE(mt7621_gates); i++) { + struct mt7621_gate *sclk = &mt7621_gates[i]; + + clk_hw_unregister(&sclk->hw); + } + +unreg_clk_fixed: + for (i = 0; i < ARRAY_SIZE(mt7621_fixed_clks); i++) { + struct mt7621_fixed_clk *sclk = &mt7621_fixed_clks[i]; + + clk_hw_unregister_fixed_rate(sclk->hw); + } + +free_clk_data: + kfree(clk_data); + +free_clk_priv: + kfree(priv); + + return ret; +} + +static const struct of_device_id mt7621_clk_of_match[] = { + { .compatible = "mediatek,mt7621-sysc" }, + {}, +}; + +static struct platform_driver mt7621_clk_driver = { + .probe = mt7621_clk_probe, + .driver = { + .name = "mt7621-clk", + .of_match_table = mt7621_clk_of_match, + }, +}; +builtin_platform_driver(mt7621_clk_driver); -- 2.25.1 From sergio.paracuellos at gmail.com Tue Mar 9 05:22:24 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Tue, 9 Mar 2021 06:22:24 +0100 Subject: [PATCH v11 4/6] staging: mt7621-dts: make use of new 'mt7621-clk' In-Reply-To: <20210309052226.29531-1-sergio.paracuellos@gmail.com> References: <20210309052226.29531-1-sergio.paracuellos@gmail.com> Message-ID: <20210309052226.29531-5-sergio.paracuellos@gmail.com> Clocks for SoC mt7621 have been properly integrated so there is no need to declare fixed clocks at all in the device tree. Remove all of them, add new device tree nodes for mt7621-clk and update the rest of the nodes to use them. Acked-by: Greg Kroah-Hartman Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-dts/gbpc1.dts | 11 ---- drivers/staging/mt7621-dts/mt7621.dtsi | 74 ++++++++++++-------------- 2 files changed, 33 insertions(+), 52 deletions(-) diff --git a/drivers/staging/mt7621-dts/gbpc1.dts b/drivers/staging/mt7621-dts/gbpc1.dts index a7c0d3115d72..7716d0efe524 100644 --- a/drivers/staging/mt7621-dts/gbpc1.dts +++ b/drivers/staging/mt7621-dts/gbpc1.dts @@ -100,17 +100,6 @@ partition at 50000 { }; }; -&sysclock { - compatible = "fixed-clock"; - /* This is normally 1/4 of cpuclock */ - clock-frequency = <225000000>; -}; - -&cpuclock { - compatible = "fixed-clock"; - clock-frequency = <900000000>; -}; - &pcie { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi index 16fc94f65486..b68183e7e6ad 100644 --- a/drivers/staging/mt7621-dts/mt7621.dtsi +++ b/drivers/staging/mt7621-dts/mt7621.dtsi @@ -1,5 +1,6 @@ #include #include +#include / { #address-cells = <1>; @@ -27,27 +28,6 @@ aliases { serial0 = &uartlite; }; - cpuclock: cpuclock at 0 { - #clock-cells = <0>; - compatible = "fixed-clock"; - - /* FIXME: there should be way to detect this */ - clock-frequency = <880000000>; - }; - - sysclock: sysclock at 0 { - #clock-cells = <0>; - compatible = "fixed-clock"; - - /* This is normally 1/4 of cpuclock */ - clock-frequency = <220000000>; - }; - - mmc_clock: mmc_clock at 0 { - #clock-cells = <0>; - compatible = "fixed-clock"; - clock-frequency = <48000000>; - }; mmc_fixed_3v3: fixedregulator at 0 { compatible = "regulator-fixed"; @@ -76,8 +56,13 @@ palmbus: palmbus at 1E000000 { #size-cells = <1>; sysc: sysc at 0 { - compatible = "mtk,mt7621-sysc"; + compatible = "mtk,mt7621-sysc", "syscon"; reg = <0x0 0x100>; + #clock-cells = <1>; + ralink,memctl = <&memc>; + clock-output-names = "xtal", "cpu", "bus", + "50m", "125m", "150m", + "250m", "270m"; }; wdt: wdt at 100 { @@ -101,8 +86,8 @@ i2c: i2c at 900 { compatible = "mediatek,mt7621-i2c"; reg = <0x900 0x100>; - clocks = <&sysclock>; - + clocks = <&sysc MT7621_CLK_I2C>; + clock-names = "i2c"; resets = <&rstctrl 16>; reset-names = "i2c"; @@ -119,8 +104,8 @@ i2s: i2s at a00 { compatible = "mediatek,mt7621-i2s"; reg = <0xa00 0x100>; - clocks = <&sysclock>; - + clocks = <&sysc MT7621_CLK_I2S>; + clock-names = "i2s"; resets = <&rstctrl 17>; reset-names = "i2s"; @@ -138,7 +123,7 @@ i2s: i2s at a00 { }; memc: memc at 5000 { - compatible = "mtk,mt7621-memc"; + compatible = "mtk,mt7621-memc", "syscon"; reg = <0x5000 0x1000>; }; @@ -156,8 +141,8 @@ uartlite: uartlite at c00 { compatible = "ns16550a"; reg = <0xc00 0x100>; - clocks = <&sysclock>; - clock-frequency = <50000000>; + clocks = <&sysc MT7621_CLK_UART1>; + clock-names = "uart1"; interrupt-parent = <&gic>; interrupts = ; @@ -173,7 +158,8 @@ spi0: spi at b00 { compatible = "ralink,mt7621-spi"; reg = <0xb00 0x100>; - clocks = <&sysclock>; + clocks = <&sysc MT7621_CLK_SPI>; + clock-names = "spi"; resets = <&rstctrl 18>; reset-names = "spi"; @@ -189,6 +175,8 @@ gdma: gdma at 2800 { compatible = "ralink,rt3883-gdma"; reg = <0x2800 0x800>; + clocks = <&sysc MT7621_CLK_GDMA>; + clock-names = "gdma"; resets = <&rstctrl 14>; reset-names = "dma"; @@ -206,6 +194,8 @@ hsdma: hsdma at 7000 { compatible = "mediatek,mt7621-hsdma"; reg = <0x7000 0x1000>; + clocks = <&sysc MT7621_CLK_HSDMA>; + clock-names = "hsdma"; resets = <&rstctrl 5>; reset-names = "hsdma"; @@ -311,11 +301,6 @@ rstctrl: rstctrl { #reset-cells = <1>; }; - clkctrl: clkctrl { - compatible = "ralink,rt2880-clock"; - #clock-cells = <1>; - }; - sdhci: sdhci at 1E130000 { status = "disabled"; @@ -334,7 +319,8 @@ sdhci: sdhci at 1E130000 { pinctrl-0 = <&sdhci_pins>; pinctrl-1 = <&sdhci_pins>; - clocks = <&mmc_clock &mmc_clock>; + clocks = <&sysc MT7621_CLK_SHXC>, + <&sysc MT7621_CLK_50M>; clock-names = "source", "hclk"; interrupt-parent = <&gic>; @@ -349,7 +335,7 @@ xhci: xhci at 1E1C0000 { 0x1e1d0700 0x0100>; reg-names = "mac", "ippc"; - clocks = <&sysclock>; + clocks = <&sysc MT7621_CLK_XTAL>; clock-names = "sys_ck"; interrupt-parent = <&gic>; @@ -368,7 +354,7 @@ gic: interrupt-controller at 1fbc0000 { timer { compatible = "mti,gic-timer"; interrupts = ; - clocks = <&cpuclock>; + clocks = <&sysc MT7621_CLK_CPU>; }; }; @@ -381,6 +367,9 @@ nand: nand at 1e003000 { 0x1e003800 0x800>; #address-cells = <1>; #size-cells = <1>; + + clocks = <&sysc MT7621_CLK_NAND>; + clock-names = "nand"; }; ethsys: syscon at 1e000000 { @@ -394,8 +383,9 @@ ethernet: ethernet at 1e100000 { compatible = "mediatek,mt7621-eth"; reg = <0x1e100000 0x10000>; - clocks = <&sysclock>; - clock-names = "ethif"; + clocks = <&sysc MT7621_CLK_FE>, + <&sysc MT7621_CLK_ETH>; + clock-names = "fe", "ethif"; #address-cells = <1>; #size-cells = <0>; @@ -521,7 +511,9 @@ GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH resets = <&rstctrl 24 &rstctrl 25 &rstctrl 26>; reset-names = "pcie0", "pcie1", "pcie2"; - clocks = <&clkctrl 24 &clkctrl 25 &clkctrl 26>; + clocks = <&sysc MT7621_CLK_PCIE0>, + <&sysc MT7621_CLK_PCIE1>, + <&sysc MT7621_CLK_PCIE2>; clock-names = "pcie0", "pcie1", "pcie2"; phys = <&pcie0_phy 1>, <&pcie2_phy 0>; phy-names = "pcie-phy0", "pcie-phy2"; -- 2.25.1 From sergio.paracuellos at gmail.com Tue Mar 9 05:22:25 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Tue, 9 Mar 2021 06:22:25 +0100 Subject: [PATCH v11 5/6] staging: mt7621-dts: use valid vendor 'mediatek' instead of invalid 'mtk' In-Reply-To: <20210309052226.29531-1-sergio.paracuellos@gmail.com> References: <20210309052226.29531-1-sergio.paracuellos@gmail.com> Message-ID: <20210309052226.29531-6-sergio.paracuellos@gmail.com> Vendor listed for mediatek in kernel vendor file 'vendor-prefixes.yaml' contains 'mediatek' as a valid vendor string. Some nodes in the device tree are using an invalid vendor string vfor 'mtk' instead. Fix all of them in dts file. Update also ralink mt7621 related code to properly match new strings. Even there are used in the device tree there are some strings that are not referred anywhere but have been also updated with new vendor name. These are 'mtk,mt7621-wdt', 'mtk,mt7621-nand', 'mtk,mt7621-mc', and 'mtk,mt7621-cpc'. Acked-by: Greg Kroah-Hartman Signed-off-by: Sergio Paracuellos --- arch/mips/ralink/mt7621.c | 6 +++--- drivers/staging/mt7621-dts/mt7621.dtsi | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/mips/ralink/mt7621.c b/arch/mips/ralink/mt7621.c index ca0ac607b0f3..5d74fc1c96ac 100644 --- a/arch/mips/ralink/mt7621.c +++ b/arch/mips/ralink/mt7621.c @@ -112,8 +112,8 @@ phys_addr_t mips_cpc_default_phys_base(void) void __init ralink_of_remap(void) { - rt_sysc_membase = plat_of_remap_node("mtk,mt7621-sysc"); - rt_memc_membase = plat_of_remap_node("mtk,mt7621-memc"); + rt_sysc_membase = plat_of_remap_node("mediatek,mt7621-sysc"); + rt_memc_membase = plat_of_remap_node("mediatek,mt7621-memc"); if (!rt_sysc_membase || !rt_memc_membase) panic("Failed to remap core resources"); @@ -181,7 +181,7 @@ void prom_soc_init(struct ralink_soc_info *soc_info) if (n0 == MT7621_CHIP_NAME0 && n1 == MT7621_CHIP_NAME1) { name = "MT7621"; - soc_info->compatible = "mtk,mt7621-soc"; + soc_info->compatible = "mediatek,mt7621-soc"; } else { panic("mt7621: unknown SoC, n0:%08x n1:%08x\n", n0, n1); } diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi index b68183e7e6ad..f0c9ae757bcd 100644 --- a/drivers/staging/mt7621-dts/mt7621.dtsi +++ b/drivers/staging/mt7621-dts/mt7621.dtsi @@ -56,7 +56,7 @@ palmbus: palmbus at 1E000000 { #size-cells = <1>; sysc: sysc at 0 { - compatible = "mtk,mt7621-sysc", "syscon"; + compatible = "mediatek,mt7621-sysc", "syscon"; reg = <0x0 0x100>; #clock-cells = <1>; ralink,memctl = <&memc>; @@ -66,7 +66,7 @@ sysc: sysc at 0 { }; wdt: wdt at 100 { - compatible = "mtk,mt7621-wdt"; + compatible = "mediatek,mt7621-wdt"; reg = <0x100 0x100>; }; @@ -123,17 +123,17 @@ i2s: i2s at a00 { }; memc: memc at 5000 { - compatible = "mtk,mt7621-memc", "syscon"; + compatible = "mediatek,mt7621-memc", "syscon"; reg = <0x5000 0x1000>; }; cpc: cpc at 1fbf0000 { - compatible = "mtk,mt7621-cpc"; + compatible = "mediatek,mt7621-cpc"; reg = <0x1fbf0000 0x8000>; }; mc: mc at 1fbf8000 { - compatible = "mtk,mt7621-mc"; + compatible = "mediatek,mt7621-mc"; reg = <0x1fbf8000 0x8000>; }; @@ -361,7 +361,7 @@ timer { nand: nand at 1e003000 { status = "disabled"; - compatible = "mtk,mt7621-nand"; + compatible = "mediatek,mt7621-nand"; bank-width = <2>; reg = <0x1e003000 0x800 0x1e003800 0x800>; -- 2.25.1 From sergio.paracuellos at gmail.com Tue Mar 9 05:22:26 2021 From: sergio.paracuellos at gmail.com (Sergio Paracuellos) Date: Tue, 9 Mar 2021 06:22:26 +0100 Subject: [PATCH v11 6/6] MAINTAINERS: add MT7621 CLOCK maintainer In-Reply-To: <20210309052226.29531-1-sergio.paracuellos@gmail.com> References: <20210309052226.29531-1-sergio.paracuellos@gmail.com> Message-ID: <20210309052226.29531-7-sergio.paracuellos@gmail.com> Adding myself as maintainer for mt7621 clock driver. Signed-off-by: Sergio Paracuellos --- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 809a68af5efd..ecad5d972122 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11288,6 +11288,12 @@ L: linux-wireless at vger.kernel.org S: Maintained F: drivers/net/wireless/mediatek/mt7601u/ +MEDIATEK MT7621 CLOCK DRIVER +M: Sergio Paracuellos +S: Maintained +F: Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml +F: drivers/clk/ralink/clk-mt7621.c + MEDIATEK MT7621/28/88 I2C DRIVER M: Stefan Roese L: linux-i2c at vger.kernel.org -- 2.25.1 From rmfrfs at gmail.com Tue Mar 9 09:29:32 2021 From: rmfrfs at gmail.com (Rui Miguel Silva) Date: Tue, 9 Mar 2021 09:29:32 +0000 Subject: [PATCH 06/10] staging: greybus: spilib: use 'spi_delay_to_ns' for getting xfer delay In-Reply-To: <20210309042809.dgop5dli36z27sj2@vireshk-i7> References: <20210308145502.1075689-1-aardelean@deviqon.com> <20210308145502.1075689-7-aardelean@deviqon.com> <20210309042809.dgop5dli36z27sj2@vireshk-i7> Message-ID: <20210309092932.kliwq6ylqlnpqekk@arch-thunder.localdomain> Hi, On Tue, Mar 09, 2021 at 09:58:09AM +0530, Viresh Kumar wrote: > On 08-03-21, 16:54, Alexandru Ardelean wrote: > > The intent is the removal of the 'delay_usecs' field from the > > spi_transfer struct, as there is a 'delay' field that does the same > > thing. > > > > The spi_delay_to_ns() can be used to get the transfer delay. It works by > > using the 'delay_usecs' field first (if it is non-zero), and finally > > uses the 'delay' field. > > > > Since the 'delay_usecs' field is going away, this change makes use of the > > spi_delay_to_ns() function. This also means dividing the return value of > > the function by 1000, to convert it to microseconds. > > To prevent any potential faults when converting to microseconds and since > > the result of spi_delay_to_ns() is int, the delay is being computed in 32 > > bits and then clamped between 0 & U16_MAX. > > > > Signed-off-by: Alexandru Ardelean > > --- > > drivers/staging/greybus/spilib.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/staging/greybus/spilib.c b/drivers/staging/greybus/spilib.c > > index 672d540d3365..30655153df6a 100644 > > --- a/drivers/staging/greybus/spilib.c > > +++ b/drivers/staging/greybus/spilib.c > > @@ -245,6 +245,7 @@ static struct gb_operation *gb_spi_operation_create(struct gb_spilib *spi, > > /* Fill in the transfers array */ > > xfer = spi->first_xfer; > > while (msg->state != GB_SPI_STATE_OP_DONE) { > > + int xfer_delay; > > if (xfer == spi->last_xfer) > > xfer_len = spi->last_xfer_size; > > else > > @@ -259,7 +260,9 @@ static struct gb_operation *gb_spi_operation_create(struct gb_spilib *spi, > > > > gb_xfer->speed_hz = cpu_to_le32(xfer->speed_hz); > > gb_xfer->len = cpu_to_le32(xfer_len); > > - gb_xfer->delay_usecs = cpu_to_le16(xfer->delay_usecs); > > + xfer_delay = spi_delay_to_ns(&xfer->delay, xfer) / 1000; > > + xfer_delay = clamp_t(u16, xfer_delay, 0, U16_MAX); > > + gb_xfer->delay_usecs = cpu_to_le16(xfer_delay); > > gb_xfer->cs_change = xfer->cs_change; > > gb_xfer->bits_per_word = xfer->bits_per_word; > > Acked-by: Viresh Kumar Acked-by: Rui Miguel Silva ------ Cheers, Rui From nsaenzjulienne at suse.de Tue Mar 9 09:59:00 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Tue, 09 Mar 2021 10:59:00 +0100 Subject: [PATCH v7 11/11] pwm: Add Raspberry Pi Firmware based PWM bus In-Reply-To: <20210118123244.13669-12-nsaenzjulienne@suse.de> References: <20210118123244.13669-1-nsaenzjulienne@suse.de> <20210118123244.13669-12-nsaenzjulienne@suse.de> Message-ID: <957566acbdbe1155eeb561c324d2404bbbf7e7af.camel@suse.de> On Mon, 2021-01-18 at 13:32 +0100, Nicolas Saenz Julienne wrote: > Adds support to control the PWM bus available in official Raspberry Pi > PoE HAT. Only RPi's co-processor has access to it, so commands have to > be sent through RPi's firmware mailbox interface. > > Signed-off-by: Nicolas Saenz Julienne > > --- ping :) > Changes since v6: > - Use %pe > - Round divisions properly > - Use dev_err_probe() > - Pass check_patch > > Changes since v3: > ?- Rename compatible string to be more explicit WRT to bus's limitations > > Changes since v2: > ?- Use devm_rpi_firmware_get() > ?- Rename driver > ?- Small cleanups > > Changes since v1: > ?- Use default pwm bindings and get rid of xlate() function > ?- Correct spelling errors > ?- Correct apply() function > ?- Round values > ?- Fix divisions in arm32 mode > ?- Small cleanups > > ?drivers/pwm/Kconfig | 9 ++ > ?drivers/pwm/Makefile | 1 + > ?drivers/pwm/pwm-raspberrypi-poe.c | 220 ++++++++++++++++++++++++++++++ > ?3 files changed, 230 insertions(+) > ?create mode 100644 drivers/pwm/pwm-raspberrypi-poe.c > > diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig > index 0937e1c047ac..75e2344703b3 100644 > --- a/drivers/pwm/Kconfig > +++ b/drivers/pwm/Kconfig > @@ -423,6 +423,15 @@ config PWM_PXA > ? To compile this driver as a module, choose M here: the module > ? will be called pwm-pxa. > ? > > +config PWM_RASPBERRYPI_POE > + tristate "Raspberry Pi Firwmware PoE Hat PWM support" > + # Make sure not 'y' when RASPBERRYPI_FIRMWARE is 'm'. This can only > + # happen when COMPILE_TEST=y, hence the added !RASPBERRYPI_FIRMWARE. > + depends on RASPBERRYPI_FIRMWARE || (COMPILE_TEST && !RASPBERRYPI_FIRMWARE) > + help > + Enable Raspberry Pi firmware controller PWM bus used to control the > + official RPI PoE hat > + > ?config PWM_RCAR > ? tristate "Renesas R-Car PWM support" > ? depends on ARCH_RENESAS || COMPILE_TEST > diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile > index 18b89d7fd092..ed28d7bd4c64 100644 > --- a/drivers/pwm/Makefile > +++ b/drivers/pwm/Makefile > @@ -38,6 +38,7 @@ obj-$(CONFIG_PWM_MXS) += pwm-mxs.o > ?obj-$(CONFIG_PWM_OMAP_DMTIMER) += pwm-omap-dmtimer.o > ?obj-$(CONFIG_PWM_PCA9685) += pwm-pca9685.o > ?obj-$(CONFIG_PWM_PXA) += pwm-pxa.o > +obj-$(CONFIG_PWM_RASPBERRYPI_POE) += pwm-raspberrypi-poe.o > ?obj-$(CONFIG_PWM_RCAR) += pwm-rcar.o > ?obj-$(CONFIG_PWM_RENESAS_TPU) += pwm-renesas-tpu.o > ?obj-$(CONFIG_PWM_ROCKCHIP) += pwm-rockchip.o > diff --git a/drivers/pwm/pwm-raspberrypi-poe.c b/drivers/pwm/pwm-raspberrypi-poe.c > new file mode 100644 > index 000000000000..ca845e8fabe6 > --- /dev/null > +++ b/drivers/pwm/pwm-raspberrypi-poe.c > @@ -0,0 +1,220 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright 2020 Nicolas Saenz Julienne > + * For more information on Raspberry Pi's PoE hat see: > + * https://www.raspberrypi.org/products/poe-hat/ > + * > + * Limitations: > + * - No disable bit, so a disabled PWM is simulated by duty_cycle 0 > + * - Only normal polarity > + * - Fixed 12.5 kHz period > + * > + * The current period is completed when HW is reconfigured. > + */ > + > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#define RPI_PWM_MAX_DUTY 255 > +#define RPI_PWM_PERIOD_NS 80000 /* 12.5 kHz */ > + > +#define RPI_PWM_CUR_DUTY_REG 0x0 > +#define RPI_PWM_DEF_DUTY_REG 0x1 > + > +struct raspberrypi_pwm { > + struct rpi_firmware *firmware; > + struct pwm_chip chip; > + unsigned int duty_cycle; > +}; > + > +struct raspberrypi_pwm_prop { > + __le32 reg; > + __le32 val; > + __le32 ret; > +} __packed; > + > +static inline > +struct raspberrypi_pwm *raspberrypi_pwm_from_chip(struct pwm_chip *chip) > +{ > + return container_of(chip, struct raspberrypi_pwm, chip); > +} > + > +static int raspberrypi_pwm_set_property(struct rpi_firmware *firmware, > + u32 reg, u32 val) > +{ > + struct raspberrypi_pwm_prop msg = { > + .reg = cpu_to_le32(reg), > + .val = cpu_to_le32(val), > + }; > + int ret; > + > + ret = rpi_firmware_property(firmware, RPI_FIRMWARE_SET_POE_HAT_VAL, > + &msg, sizeof(msg)); > + if (ret) > + return ret; > + if (msg.ret) > + return -EIO; > + > + return 0; > +} > + > +static int raspberrypi_pwm_get_property(struct rpi_firmware *firmware, > + u32 reg, u32 *val) > +{ > + struct raspberrypi_pwm_prop msg = { > + .reg = reg > + }; > + int ret; > + > + ret = rpi_firmware_property(firmware, RPI_FIRMWARE_GET_POE_HAT_VAL, > + &msg, sizeof(msg)); > + if (ret) > + return ret; > + if (msg.ret) > + return -EIO; > + > + *val = le32_to_cpu(msg.val); > + > + return 0; > +} > + > +static void raspberrypi_pwm_get_state(struct pwm_chip *chip, > + struct pwm_device *pwm, > + struct pwm_state *state) > +{ > + struct raspberrypi_pwm *rpipwm = raspberrypi_pwm_from_chip(chip); > + > + state->period = RPI_PWM_PERIOD_NS; > + state->duty_cycle = DIV_ROUND_UP(rpipwm->duty_cycle * RPI_PWM_PERIOD_NS, > + RPI_PWM_MAX_DUTY); > + state->enabled = !!(rpipwm->duty_cycle); > + state->polarity = PWM_POLARITY_NORMAL; > +} > + > +static int raspberrypi_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, > + const struct pwm_state *state) > +{ > + struct raspberrypi_pwm *rpipwm = raspberrypi_pwm_from_chip(chip); > + unsigned int duty_cycle; > + int ret; > + > + if (state->period < RPI_PWM_PERIOD_NS || > + state->polarity != PWM_POLARITY_NORMAL) > + return -EINVAL; > + > + if (!state->enabled) > + duty_cycle = 0; > + else if (state->duty_cycle < RPI_PWM_PERIOD_NS) > + duty_cycle = DIV_ROUND_DOWN_ULL(state->duty_cycle * RPI_PWM_MAX_DUTY, > + RPI_PWM_PERIOD_NS); > + else > + duty_cycle = RPI_PWM_MAX_DUTY; > + > + if (duty_cycle == rpipwm->duty_cycle) > + return 0; > + > + ret = raspberrypi_pwm_set_property(rpipwm->firmware, RPI_PWM_CUR_DUTY_REG, > + duty_cycle); > + if (ret) { > + dev_err(chip->dev, "Failed to set duty cycle: %pe\n", > + ERR_PTR(ret)); > + return ret; > + } > + > + /* > + * This sets the default duty cycle after resetting the board, we > + * updated it every time to mimic Raspberry Pi's downstream's driver > + * behaviour. > + */ > + ret = raspberrypi_pwm_set_property(rpipwm->firmware, RPI_PWM_DEF_DUTY_REG, > + duty_cycle); > + if (ret) { > + dev_err(chip->dev, "Failed to set default duty cycle: %pe\n", > + ERR_PTR(ret)); > + return ret; > + } > + > + rpipwm->duty_cycle = duty_cycle; > + > + return 0; > +} > + > +static const struct pwm_ops raspberrypi_pwm_ops = { > + .get_state = raspberrypi_pwm_get_state, > + .apply = raspberrypi_pwm_apply, > + .owner = THIS_MODULE, > +}; > + > +static int raspberrypi_pwm_probe(struct platform_device *pdev) > +{ > + struct device_node *firmware_node; > + struct device *dev = &pdev->dev; > + struct rpi_firmware *firmware; > + struct raspberrypi_pwm *rpipwm; > + int ret; > + > + firmware_node = of_get_parent(dev->of_node); > + if (!firmware_node) { > + dev_err(dev, "Missing firmware node\n"); > + return -ENOENT; > + } > + > + firmware = devm_rpi_firmware_get(&pdev->dev, firmware_node); > + of_node_put(firmware_node); > + if (!firmware) > + return dev_err_probe(dev, -EPROBE_DEFER, > + "Failed to get firmware handle\n"); > + > + rpipwm = devm_kzalloc(&pdev->dev, sizeof(*rpipwm), GFP_KERNEL); > + if (!rpipwm) > + return -ENOMEM; > + > + rpipwm->firmware = firmware; > + rpipwm->chip.dev = dev; > + rpipwm->chip.ops = &raspberrypi_pwm_ops; > + rpipwm->chip.base = -1; > + rpipwm->chip.npwm = RASPBERRYPI_FIRMWARE_PWM_NUM; > + > + platform_set_drvdata(pdev, rpipwm); > + > + ret = raspberrypi_pwm_get_property(rpipwm->firmware, RPI_PWM_CUR_DUTY_REG, > + &rpipwm->duty_cycle); > + if (ret) { > + dev_err(dev, "Failed to get duty cycle: %pe\n", ERR_PTR(ret)); > + return ret; > + } > + > + return pwmchip_add(&rpipwm->chip); > +} > + > +static int raspberrypi_pwm_remove(struct platform_device *pdev) > +{ > + struct raspberrypi_pwm *rpipwm = platform_get_drvdata(pdev); > + > + return pwmchip_remove(&rpipwm->chip); > +} > + > +static const struct of_device_id raspberrypi_pwm_of_match[] = { > + { .compatible = "raspberrypi,firmware-poe-pwm", }, > + { } > +}; > +MODULE_DEVICE_TABLE(of, raspberrypi_pwm_of_match); > + > +static struct platform_driver raspberrypi_pwm_driver = { > + .driver = { > + .name = "raspberrypi-poe-pwm", > + .of_match_table = raspberrypi_pwm_of_match, > + }, > + .probe = raspberrypi_pwm_probe, > + .remove = raspberrypi_pwm_remove, > +}; > +module_platform_driver(raspberrypi_pwm_driver); > + > +MODULE_AUTHOR("Nicolas Saenz Julienne "); > +MODULE_DESCRIPTION("Raspberry Pi Firmware Based PWM Bus Driver"); > +MODULE_LICENSE("GPL v2"); -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: This is a digitally signed message part URL: From eli.billauer at gmail.com Tue Mar 9 11:34:23 2021 From: eli.billauer at gmail.com (eli.billauer at gmail.com) Date: Tue, 9 Mar 2021 13:34:23 +0200 Subject: [PATCH v3 0/2] Submission of XillyUSB driver Message-ID: <20210309113425.61296-1-eli.billauer@gmail.com> From: Eli Billauer This is a resubmission of the XillyUSB driver, which is the USB variant of the existing Xillybus driver. Because these driver share some API related functions, this submission consists of two patches: (1) A patch moving away Xillybus' class related functions to a separate module file. (2) A patch adding the new XillyUSB driver, based upon this new separate module. As far as I can tell, the shared code between the Xillybus and XillyUSB drivers covers everything that makes sense to share. I submit XillyUSB as a staging driver, with the hope for a detailed review on this issue, as well as a general code audit. Thanks, Eli Eli Billauer (2): char: xillybus: Move class-related functions to new xillybus_class.c staging: Add driver for XillyUSB (Xillybus variant for USB) MAINTAINERS | 1 + drivers/char/xillybus/Kconfig | 4 + drivers/char/xillybus/Makefile | 1 + drivers/char/xillybus/xillybus.h | 10 +- drivers/char/xillybus/xillybus_class.c | 263 +++ drivers/char/xillybus/xillybus_core.c | 181 +- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/xillyusb/Kconfig | 20 + drivers/staging/xillyusb/Makefile | 6 + drivers/staging/xillyusb/TODO | 13 + drivers/staging/xillyusb/xillyusb.c | 2184 ++++++++++++++++++++++++ include/linux/xillybus_class.h | 30 + 13 files changed, 2549 insertions(+), 167 deletions(-) create mode 100644 drivers/char/xillybus/xillybus_class.c create mode 100644 drivers/staging/xillyusb/Kconfig create mode 100644 drivers/staging/xillyusb/Makefile create mode 100644 drivers/staging/xillyusb/TODO create mode 100644 drivers/staging/xillyusb/xillyusb.c create mode 100644 include/linux/xillybus_class.h -- 2.17.1 From eli.billauer at gmail.com Tue Mar 9 11:34:24 2021 From: eli.billauer at gmail.com (eli.billauer at gmail.com) Date: Tue, 9 Mar 2021 13:34:24 +0200 Subject: [PATCH v3 1/2] char: xillybus: Move class-related functions to new xillybus_class.c In-Reply-To: <20210309113425.61296-1-eli.billauer@gmail.com> References: <20210309113425.61296-1-eli.billauer@gmail.com> Message-ID: <20210309113425.61296-2-eli.billauer@gmail.com> From: Eli Billauer This patch is a preparation for adding another related driver, XillyUSB. In order to share some code between the existing Xillybus driver and the one to be added, some functions are moved to xillybus_class.c The header file, xillybus_class.h, is temporarily placed in include/linux/, because the new XillyUSB driver is intended as a staging driver for the time being. Signed-off-by: Eli Billauer --- Notes: Changelog: This patch did not exist prior to v3. drivers/char/xillybus/Kconfig | 4 + drivers/char/xillybus/Makefile | 1 + drivers/char/xillybus/xillybus.h | 10 +- drivers/char/xillybus/xillybus_class.c | 263 +++++++++++++++++++++++++ drivers/char/xillybus/xillybus_core.c | 181 +++-------------- include/linux/xillybus_class.h | 30 +++ 6 files changed, 322 insertions(+), 167 deletions(-) create mode 100644 drivers/char/xillybus/xillybus_class.c create mode 100644 include/linux/xillybus_class.h diff --git a/drivers/char/xillybus/Kconfig b/drivers/char/xillybus/Kconfig index 130dbdce858f..e7800f025249 100644 --- a/drivers/char/xillybus/Kconfig +++ b/drivers/char/xillybus/Kconfig @@ -3,10 +3,14 @@ # Xillybus devices # +config XILLYBUS_CLASS + tristate + config XILLYBUS tristate "Xillybus generic FPGA interface" depends on PCI || OF select CRC32 + select XILLYBUS_CLASS help Xillybus is a generic interface for peripherals designed on programmable logic (FPGA). The driver probes the hardware for diff --git a/drivers/char/xillybus/Makefile b/drivers/char/xillybus/Makefile index 099e9a3585fc..591615264591 100644 --- a/drivers/char/xillybus/Makefile +++ b/drivers/char/xillybus/Makefile @@ -3,6 +3,7 @@ # Makefile for Xillybus driver # +obj-$(CONFIG_XILLYBUS_CLASS) += xillybus_class.o obj-$(CONFIG_XILLYBUS) += xillybus_core.o obj-$(CONFIG_XILLYBUS_PCIE) += xillybus_pcie.o obj-$(CONFIG_XILLYBUS_OF) += xillybus_of.o diff --git a/drivers/char/xillybus/xillybus.h b/drivers/char/xillybus/xillybus.h index 8e3ed4d1bb7f..c63ffc56637c 100644 --- a/drivers/char/xillybus/xillybus.h +++ b/drivers/char/xillybus/xillybus.h @@ -30,7 +30,8 @@ struct xilly_buffer { struct xilly_idt_handle { unsigned char *chandesc; - unsigned char *idt; + unsigned char *names; + int names_len; int entries; }; @@ -94,7 +95,6 @@ struct xilly_endpoint { struct device *dev; struct xilly_endpoint_hardware *ephw; - struct list_head ep_list; int dma_using_dac; /* =1 if 64-bit DMA is used, =0 otherwise. */ __iomem void *registers; int fatal_error; @@ -102,12 +102,6 @@ struct xilly_endpoint { struct mutex register_mutex; wait_queue_head_t ep_wait; - /* Channels and message handling */ - struct cdev cdev; - - int major; - int lowest_minor; /* Highest minor = lowest_minor + num_channels - 1 */ - int num_channels; /* EXCLUDING message buffer */ struct xilly_channel **channels; int msg_counter; diff --git a/drivers/char/xillybus/xillybus_class.c b/drivers/char/xillybus/xillybus_class.c new file mode 100644 index 000000000000..f3cfb76623c8 --- /dev/null +++ b/drivers/char/xillybus/xillybus_class.c @@ -0,0 +1,263 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright 2021 Xillybus Ltd, http://xillybus.com + * + * Driver for the Xillybus class + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +MODULE_DESCRIPTION("Driver for Xillybus class"); +MODULE_AUTHOR("Eli Billauer, Xillybus Ltd."); +MODULE_VERSION("1.0"); +MODULE_ALIAS("xillybus_class"); +MODULE_LICENSE("GPL v2"); + +static DEFINE_MUTEX(unit_mutex); +static LIST_HEAD(unit_list); +static struct class *xillybus_class; + +#define UNITNAMELEN 16 + +struct xilly_unit { + struct list_head list_entry; + void *private_data; + + struct cdev *cdev; + char name[UNITNAMELEN]; + int major; + int lowest_minor; + int num_nodes; +}; + +int xillybus_init_chrdev(struct device *dev, + const struct file_operations *fops, + struct module *owner, + void *private_data, + unsigned char *idt, unsigned int len, + int num_nodes, + const char *prefix, bool enumerate) +{ + int rc; + dev_t mdev; + int i; + char devname[48]; + + struct device *device; + size_t namelen; + struct xilly_unit *unit, *u; + + unit = kzalloc(sizeof(*unit), GFP_KERNEL); + + if (!unit) + return -ENOMEM; + + mutex_lock(&unit_mutex); + + if (!enumerate) + snprintf(unit->name, UNITNAMELEN, "%s", prefix); + + for (i = 0; enumerate; i++) { + snprintf(unit->name, UNITNAMELEN, "%s_%02d", + prefix, i); + + enumerate = false; + list_for_each_entry(u, &unit_list, list_entry) + if (!strcmp(unit->name, u->name)) { + enumerate = true; + break; + } + } + + rc = alloc_chrdev_region(&mdev, 0, num_nodes, unit->name); + + if (rc) { + dev_warn(dev, "Failed to obtain major/minors"); + goto fail_obtain; + return rc; + } + + unit->major = MAJOR(mdev); + unit->lowest_minor = MINOR(mdev); + unit->num_nodes = num_nodes; + unit->private_data = private_data; + + unit->cdev = cdev_alloc(); + if (!unit->cdev) + goto unregister_chrdev; + + unit->cdev->ops = fops; + unit->cdev->owner = owner; + + rc = cdev_add(unit->cdev, MKDEV(unit->major, unit->lowest_minor), + unit->num_nodes); + if (rc) { + dev_err(dev, "Failed to add cdev.\n"); + /* kobject_put() is normally done by cdev_del() */ + kobject_put(&unit->cdev->kobj); + goto unregister_chrdev; + } + + for (i = 0; i < num_nodes; i++) { + namelen = strnlen(idt, len); + + if (namelen == len) { + dev_err(dev, "IDT's list of names is too short. This is exceptionally weird, because its CRC is OK\n"); + rc = -ENODEV; + goto unroll_device_create; + } + + snprintf(devname, sizeof(devname), "%s_%s", + unit->name, idt); + + len -= namelen + 1; + idt += namelen + 1; + + device = device_create(xillybus_class, + NULL, + MKDEV(unit->major, + i + unit->lowest_minor), + NULL, + "%s", devname); + + if (IS_ERR(device)) { + dev_err(dev, "Failed to create %s device. Aborting.\n", + devname); + rc = -ENODEV; + goto unroll_device_create; + } + } + + if (len) { + dev_err(dev, "IDT's list of names is too long. This is exceptionally weird, because its CRC is OK\n"); + rc = -ENODEV; + goto unroll_device_create; + } + + list_add_tail(&unit->list_entry, &unit_list); + + dev_info(dev, "Created %d device files.\n", num_nodes); + + mutex_unlock(&unit_mutex); + + return 0; + +unroll_device_create: + for (i--; i >= 0; i--) + device_destroy(xillybus_class, MKDEV(unit->major, + i + unit->lowest_minor)); + + cdev_del(unit->cdev); + +unregister_chrdev: + unregister_chrdev_region(MKDEV(unit->major, unit->lowest_minor), + unit->num_nodes); + +fail_obtain: + mutex_unlock(&unit_mutex); + + kfree(unit); + + return rc; +} +EXPORT_SYMBOL(xillybus_init_chrdev); + +void xillybus_cleanup_chrdev(void *private_data, + struct device *dev) +{ + int minor; + struct xilly_unit *unit; + bool found = false; + + mutex_lock(&unit_mutex); + + list_for_each_entry(unit, &unit_list, list_entry) + if (unit->private_data == private_data) { + found = true; + break; + } + + if (!found) { + dev_err(dev, "Weird bug: Failed to find unit\n"); + mutex_unlock(&unit_mutex); + return; + } + + for (minor = unit->lowest_minor; + minor < (unit->lowest_minor + unit->num_nodes); + minor++) + device_destroy(xillybus_class, MKDEV(unit->major, minor)); + + cdev_del(unit->cdev); + + unregister_chrdev_region(MKDEV(unit->major, unit->lowest_minor), + unit->num_nodes); + + dev_info(dev, "Removed %d device files.\n", + unit->num_nodes); + + list_del(&unit->list_entry); + kfree(unit); + + mutex_unlock(&unit_mutex); +} +EXPORT_SYMBOL(xillybus_cleanup_chrdev); + +int xillybus_find_inode(struct inode *inode, + void **private_data, int *index) +{ + int minor = iminor(inode); + int major = imajor(inode); + struct xilly_unit *unit; + bool found = false; + + mutex_lock(&unit_mutex); + + list_for_each_entry(unit, &unit_list, list_entry) + if (unit->major == major && + minor >= unit->lowest_minor && + minor < (unit->lowest_minor + unit->num_nodes)) { + found = true; + break; + } + + mutex_unlock(&unit_mutex); + + if (!found) + return -ENODEV; + + *private_data = unit->private_data; + *index = minor - unit->lowest_minor; + + return 0; +} +EXPORT_SYMBOL(xillybus_find_inode); + +static int __init xillybus_class_init(void) +{ + xillybus_class = class_create(THIS_MODULE, "xillybus"); + + if (IS_ERR(xillybus_class)) { + pr_warn("Failed to register xillybus class\n"); + + return PTR_ERR(xillybus_class); + } + return 0; +} + +static void __exit xillybus_class_exit(void) +{ + class_destroy(xillybus_class); +} + +module_init(xillybus_class_init); +module_exit(xillybus_class_exit); diff --git a/drivers/char/xillybus/xillybus_core.c b/drivers/char/xillybus/xillybus_core.c index 57fa68834981..57884fdd07d8 100644 --- a/drivers/char/xillybus/xillybus_core.c +++ b/drivers/char/xillybus/xillybus_core.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -30,10 +29,11 @@ #include #include #include "xillybus.h" +#include MODULE_DESCRIPTION("Xillybus core functions"); MODULE_AUTHOR("Eli Billauer, Xillybus Ltd."); -MODULE_VERSION("1.07"); +MODULE_VERSION("1.10"); MODULE_ALIAS("xillybus_core"); MODULE_LICENSE("GPL v2"); @@ -58,16 +58,6 @@ MODULE_LICENSE("GPL v2"); static const char xillyname[] = "xillybus"; -static struct class *xillybus_class; - -/* - * ep_list_lock is the last lock to be taken; No other lock requests are - * allowed while holding it. It merely protects list_of_endpoints, and not - * the endpoints listed in it. - */ - -static LIST_HEAD(list_of_endpoints); -static struct mutex ep_list_lock; static struct workqueue_struct *xillybus_wq; /* @@ -570,10 +560,8 @@ static int xilly_scan_idt(struct xilly_endpoint *endpoint, unsigned char *scan; int len; - scan = idt; - idt_handle->idt = idt; - - scan++; /* Skip version number */ + scan = idt + 1; + idt_handle->names = scan; while ((scan <= end_of_idt) && *scan) { while ((scan <= end_of_idt) && *scan++) @@ -581,6 +569,8 @@ static int xilly_scan_idt(struct xilly_endpoint *endpoint, count++; } + idt_handle->names_len = scan - idt_handle->names; + scan++; if (scan > end_of_idt) { @@ -1407,36 +1397,20 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf, static int xillybus_open(struct inode *inode, struct file *filp) { - int rc = 0; + int rc; unsigned long flags; - int minor = iminor(inode); - int major = imajor(inode); - struct xilly_endpoint *ep_iter, *endpoint = NULL; + struct xilly_endpoint *endpoint; struct xilly_channel *channel; + int index; - mutex_lock(&ep_list_lock); - - list_for_each_entry(ep_iter, &list_of_endpoints, ep_list) { - if ((ep_iter->major == major) && - (minor >= ep_iter->lowest_minor) && - (minor < (ep_iter->lowest_minor + - ep_iter->num_channels))) { - endpoint = ep_iter; - break; - } - } - mutex_unlock(&ep_list_lock); - - if (!endpoint) { - pr_err("xillybus: open() failed to find a device for major=%d and minor=%d\n", - major, minor); - return -ENODEV; - } + rc = xillybus_find_inode(inode, (void **)&endpoint, &index); + if (rc) + return rc; if (endpoint->fatal_error) return -EIO; - channel = endpoint->channels[1 + minor - endpoint->lowest_minor]; + channel = endpoint->channels[1 + index]; filp->private_data = channel; /* @@ -1799,95 +1773,6 @@ static const struct file_operations xillybus_fops = { .poll = xillybus_poll, }; -static int xillybus_init_chrdev(struct xilly_endpoint *endpoint, - const unsigned char *idt) -{ - int rc; - dev_t dev; - int devnum, i, minor, major; - char devname[48]; - struct device *device; - - rc = alloc_chrdev_region(&dev, 0, /* minor start */ - endpoint->num_channels, - xillyname); - if (rc) { - dev_warn(endpoint->dev, "Failed to obtain major/minors"); - return rc; - } - - endpoint->major = major = MAJOR(dev); - endpoint->lowest_minor = minor = MINOR(dev); - - cdev_init(&endpoint->cdev, &xillybus_fops); - endpoint->cdev.owner = endpoint->ephw->owner; - rc = cdev_add(&endpoint->cdev, MKDEV(major, minor), - endpoint->num_channels); - if (rc) { - dev_warn(endpoint->dev, "Failed to add cdev. Aborting.\n"); - goto unregister_chrdev; - } - - idt++; - - for (i = minor, devnum = 0; - devnum < endpoint->num_channels; - devnum++, i++) { - snprintf(devname, sizeof(devname)-1, "xillybus_%s", idt); - - devname[sizeof(devname)-1] = 0; /* Should never matter */ - - while (*idt++) - /* Skip to next */; - - device = device_create(xillybus_class, - NULL, - MKDEV(major, i), - NULL, - "%s", devname); - - if (IS_ERR(device)) { - dev_warn(endpoint->dev, - "Failed to create %s device. Aborting.\n", - devname); - rc = -ENODEV; - goto unroll_device_create; - } - } - - dev_info(endpoint->dev, "Created %d device files.\n", - endpoint->num_channels); - return 0; /* succeed */ - -unroll_device_create: - devnum--; i--; - for (; devnum >= 0; devnum--, i--) - device_destroy(xillybus_class, MKDEV(major, i)); - - cdev_del(&endpoint->cdev); -unregister_chrdev: - unregister_chrdev_region(MKDEV(major, minor), endpoint->num_channels); - - return rc; -} - -static void xillybus_cleanup_chrdev(struct xilly_endpoint *endpoint) -{ - int minor; - - for (minor = endpoint->lowest_minor; - minor < (endpoint->lowest_minor + endpoint->num_channels); - minor++) - device_destroy(xillybus_class, MKDEV(endpoint->major, minor)); - cdev_del(&endpoint->cdev); - unregister_chrdev_region(MKDEV(endpoint->major, - endpoint->lowest_minor), - endpoint->num_channels); - - dev_info(endpoint->dev, "Removed %d device files.\n", - endpoint->num_channels); -} - struct xilly_endpoint *xillybus_init_endpoint(struct pci_dev *pdev, struct device *dev, struct xilly_endpoint_hardware @@ -2027,28 +1912,20 @@ int xillybus_endpoint_discovery(struct xilly_endpoint *endpoint) if (rc) goto failed_idt; - /* - * endpoint is now completely configured. We put it on the list - * available to open() before registering the char device(s) - */ - - mutex_lock(&ep_list_lock); - list_add_tail(&endpoint->ep_list, &list_of_endpoints); - mutex_unlock(&ep_list_lock); + rc = xillybus_init_chrdev(dev, &xillybus_fops, + endpoint->ephw->owner, endpoint, + idt_handle.names, + idt_handle.names_len, + endpoint->num_channels, + xillyname, false); - rc = xillybus_init_chrdev(endpoint, idt_handle.idt); if (rc) - goto failed_chrdevs; + goto failed_idt; devres_release_group(dev, bootstrap_resources); return 0; -failed_chrdevs: - mutex_lock(&ep_list_lock); - list_del(&endpoint->ep_list); - mutex_unlock(&ep_list_lock); - failed_idt: xilly_quiesce(endpoint); flush_workqueue(xillybus_wq); @@ -2059,11 +1936,7 @@ EXPORT_SYMBOL(xillybus_endpoint_discovery); void xillybus_endpoint_remove(struct xilly_endpoint *endpoint) { - xillybus_cleanup_chrdev(endpoint); - - mutex_lock(&ep_list_lock); - list_del(&endpoint->ep_list); - mutex_unlock(&ep_list_lock); + xillybus_cleanup_chrdev(endpoint, endpoint->dev); xilly_quiesce(endpoint); @@ -2077,17 +1950,9 @@ EXPORT_SYMBOL(xillybus_endpoint_remove); static int __init xillybus_init(void) { - mutex_init(&ep_list_lock); - - xillybus_class = class_create(THIS_MODULE, xillyname); - if (IS_ERR(xillybus_class)) - return PTR_ERR(xillybus_class); - xillybus_wq = alloc_workqueue(xillyname, 0, 0); - if (!xillybus_wq) { - class_destroy(xillybus_class); + if (!xillybus_wq) return -ENOMEM; - } return 0; } @@ -2096,8 +1961,6 @@ static void __exit xillybus_exit(void) { /* flush_workqueue() was called for each endpoint released */ destroy_workqueue(xillybus_wq); - - class_destroy(xillybus_class); } module_init(xillybus_init); diff --git a/include/linux/xillybus_class.h b/include/linux/xillybus_class.h new file mode 100644 index 000000000000..5dbfdfc95c65 --- /dev/null +++ b/include/linux/xillybus_class.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright 2021 Xillybus Ltd, http://www.xillybus.com + * + * Header file for the Xillybus class + */ + +#ifndef __XILLYBUS_CLASS_H +#define __XILLYBUS_CLASS_H + +#include +#include +#include +#include + +int xillybus_init_chrdev(struct device *dev, + const struct file_operations *fops, + struct module *owner, + void *private_data, + unsigned char *idt, unsigned int len, + int num_nodes, + const char *prefix, bool enumerate); + +void xillybus_cleanup_chrdev(void *private_data, + struct device *dev); + +int xillybus_find_inode(struct inode *inode, + void **private_data, int *index); + +#endif /* __XILLYBUS_CLASS_H */ -- 2.17.1 From eli.billauer at gmail.com Tue Mar 9 11:34:25 2021 From: eli.billauer at gmail.com (eli.billauer at gmail.com) Date: Tue, 9 Mar 2021 13:34:25 +0200 Subject: [PATCH v3 2/2] staging: Add driver for XillyUSB (Xillybus variant for USB) In-Reply-To: <20210309113425.61296-1-eli.billauer@gmail.com> References: <20210309113425.61296-1-eli.billauer@gmail.com> Message-ID: <20210309113425.61296-3-eli.billauer@gmail.com> From: Eli Billauer The XillyUSB driver is the USB variant for the Xillybus FPGA IP core. Even though it presents a nearly identical API on the FPGA and host, it's almost a complete rewrite of the driver: The framework for exchanging data on a USB bus is fundamentally different from doing the same with a PCIe interface, which leaves very little in common between the existing driver and the new one for XillyUSB. Signed-off-by: Eli Billauer --- Notes: Changelog: v3: - Move to staging - Rely on xillybus_class for device file operations - Fix no return value bug in xillyusb_discovery() - Add module parameters for URB buffer size and count v2: - Add comment in Kconfig file, saying XILLYUSB really doesn't depend on XILLYBUS (following comment by Randy Dunlap) - Use SEEK_* predefined constants instead of numbers MAINTAINERS | 1 + drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/xillyusb/Kconfig | 20 + drivers/staging/xillyusb/Makefile | 6 + drivers/staging/xillyusb/TODO | 13 + drivers/staging/xillyusb/xillyusb.c | 2184 +++++++++++++++++++++++++++ 7 files changed, 2227 insertions(+) create mode 100644 drivers/staging/xillyusb/Kconfig create mode 100644 drivers/staging/xillyusb/Makefile create mode 100644 drivers/staging/xillyusb/TODO create mode 100644 drivers/staging/xillyusb/xillyusb.c diff --git a/MAINTAINERS b/MAINTAINERS index d92f85ca831d..1bf73b132e31 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19749,6 +19749,7 @@ M: Eli Billauer L: linux-kernel at vger.kernel.org S: Supported F: drivers/char/xillybus/ +F: drivers/staging/xillyusb/ XLP9XX I2C DRIVER M: George Cherian diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index b22f73d7bfc4..6fcbc6f90224 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -114,4 +114,6 @@ source "drivers/staging/wfx/Kconfig" source "drivers/staging/hikey9xx/Kconfig" +source "drivers/staging/xillyusb/Kconfig" + endif # STAGING diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 2245059e69c7..42dfd6a4ca28 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -47,3 +47,4 @@ obj-$(CONFIG_QLGE) += qlge/ obj-$(CONFIG_WIMAX) += wimax/ obj-$(CONFIG_WFX) += wfx/ obj-y += hikey9xx/ +obj-$(CONFIG_XILLYUSB) += xillyusb/ diff --git a/drivers/staging/xillyusb/Kconfig b/drivers/staging/xillyusb/Kconfig new file mode 100644 index 000000000000..af7251104b42 --- /dev/null +++ b/drivers/staging/xillyusb/Kconfig @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# XillyUSB devices +# + +config XILLYUSB + tristate "Xillybus generic FPGA interface for USB" + depends on USB + select CRC32 + select XILLYBUS_CLASS + help + XillyUSB is the Xillybus variant which uses USB for communicating + with the FPGA. + + Xillybus is a generic interface for peripherals designed on + programmable logic (FPGA). The driver probes the hardware for + its capabilities, and creates device files accordingly. + + Set to M if you want Xillybus to use USB for communicating with + the FPGA. diff --git a/drivers/staging/xillyusb/Makefile b/drivers/staging/xillyusb/Makefile new file mode 100644 index 000000000000..1b45211992f5 --- /dev/null +++ b/drivers/staging/xillyusb/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Makefile for XillyUSB driver +# + +obj-$(CONFIG_XILLYUSB) += xillyusb.o diff --git a/drivers/staging/xillyusb/TODO b/drivers/staging/xillyusb/TODO new file mode 100644 index 000000000000..0cb6a005ada4 --- /dev/null +++ b/drivers/staging/xillyusb/TODO @@ -0,0 +1,13 @@ +XillyUSB driver +=============== + +This driver is the USB counterpart for the driver at drivers/char/xillybus/. +See Documentation/driver-api/xillybus.rst. + +TODO +---- + - Enhance code reuse with the existing Xillybus driver. + + - General code review. + +Patches to: Eli Billauer \ No newline at end of file diff --git a/drivers/staging/xillyusb/xillyusb.c b/drivers/staging/xillyusb/xillyusb.c new file mode 100644 index 000000000000..bcf55c1a380d --- /dev/null +++ b/drivers/staging/xillyusb/xillyusb.c @@ -0,0 +1,2184 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright 2020 Xillybus Ltd, http://xillybus.com + * + * Driver for the XillyUSB FPGA/host framework. + * + * This driver interfaces with a special IP core in an FPGA, setting up + * a pipe between a hardware FIFO in the programmable logic and a device + * file in the host. The number of such pipes and their attributes are + * set up on the logic. This driver detects these automatically and + * creates the device files accordingly. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +MODULE_DESCRIPTION("Driver for XillyUSB FPGA IP Core"); +MODULE_AUTHOR("Eli Billauer, Xillybus Ltd."); +MODULE_VERSION("1.0"); +MODULE_ALIAS("xillyusb"); +MODULE_LICENSE("GPL v2"); + +static unsigned int urb_bufnum = 8; +module_param(urb_bufnum, uint, 0644); +MODULE_PARM_DESC(urb_bufnum, "Number of URB buffers to allocate for each endpoint"); + +static unsigned int urb_buforder = 4; +module_param(urb_buforder, uint, 0644); +MODULE_PARM_DESC(urb_buforder, "Size order of each URB buffer. The buffer size is 2^(urb_buforder+12) bytes"); + +#define XILLY_RX_TIMEOUT (10 * HZ / 1000) +#define XILLY_RESPONSE_TIMEOUT (500 * HZ / 1000) + +#define LOG2_IDT_FIFO_SIZE 16 +#define LOG2_INITIAL_FIFO_BUF_SIZE 16 + +#define MSG_EP_NUM 1 +#define IN_EP_NUM 1 + +static const char xillyname[] = "xillyusb"; +/* err_name is used in log messages, where dev_err() might fail */ +static const char *err_name = xillyname; + +static DEFINE_MUTEX(open_mutex); + +static unsigned int fifo_buf_order; + +#define USB_VENDOR_ID_XILINX 0x03fd +#define USB_VENDOR_ID_ALTERA 0x09fb + +#define USB_PRODUCT_ID_XILLYUSB 0xebbe + +static const struct usb_device_id xillyusb_table[] = { + { USB_DEVICE(USB_VENDOR_ID_XILINX, USB_PRODUCT_ID_XILLYUSB) }, + { USB_DEVICE(USB_VENDOR_ID_ALTERA, USB_PRODUCT_ID_XILLYUSB) }, + { } +}; + +MODULE_DEVICE_TABLE(usb, xillyusb_table); + +struct xillyusb_dev; + +struct xillyfifo { + unsigned int bufsize; /* In bytes, always a power of 2 */ + unsigned int bufnum; + unsigned int size; /* Lazy: Equals bufsize * bufnum */ + unsigned int buf_order; + atomic_t fill; /* Number of bytes in the FIFO */ + wait_queue_head_t waitq; + unsigned int readpos; + unsigned int readbuf; + unsigned int writepos; + unsigned int writebuf; + void **mem; +}; + +struct xillyusb_channel; + +struct xillyusb_endpoint { + struct xillyusb_dev *xdev; + + struct list_head buffers; + struct list_head filled_buffers; + spinlock_t buffers_lock; /* protect these two lists */ + + unsigned int order; + unsigned int buffer_size; + + unsigned int fill_mask; + + int outstanding_urbs; + + struct usb_anchor anchor; + + struct xillyfifo fifo; + + struct work_struct workitem; + bool shutting_down; + + u8 ep_num; +}; + +struct xillyusb_channel { + struct xillyusb_dev *xdev; + + struct xillyfifo *in_fifo; + struct xillyusb_endpoint *out_ep; + struct mutex lock; /* protect @out_ep and @in_fifo */ + + struct mutex in_mutex; /* serialize fops on FPGA to host stream */ + struct mutex out_mutex; /* serialize fops on host to FPGA stream */ + wait_queue_head_t flushq; + + int chan_idx; + + u32 in_consumed_bytes; + u32 in_current_checkpoint; + u32 out_bytes; + + unsigned int in_log2_element_size; + unsigned int out_log2_element_size; + unsigned int in_log2_fifo_size; + unsigned int out_log2_fifo_size; + + unsigned int read_data_ok; /* EOF not arrived (yet) */ + unsigned int poll_used; + unsigned int flushing; + unsigned int flushed; + unsigned int canceled; + + /* Bit fields protected by open_mutex except for initialization */ + unsigned readable:1; + unsigned writable:1; + unsigned open_for_read:1; + unsigned open_for_write:1; + unsigned in_synchronous:1; + unsigned out_synchronous:1; + unsigned in_seekable:1; + unsigned out_seekable:1; +}; + +struct xillybuffer { + struct list_head entry; + struct xillyusb_endpoint *ep; + void *buf; + unsigned int len; +}; + +struct xillyusb_dev { + struct xillyusb_channel *channels; + + struct usb_device *udev; + struct usb_interface *interface; + struct kref kref; + struct mutex io_mutex; /* synchronize I/O with disconnect */ + struct workqueue_struct *workq; + + int error; + spinlock_t error_lock; /* protect @error */ + struct work_struct wakeup_workitem; + + int num_channels; + + struct xillyusb_endpoint *msg_ep; + struct xillyusb_endpoint *in_ep; + + struct mutex msg_mutex; /* serialize opcode transmission */ + int in_bytes_left; + int leftover_chan_num; + unsigned int in_counter; + struct mutex process_in_mutex; /* synchronize wakeup_all() */ +}; + +/* FPGA to host opcodes */ +enum { + OPCODE_DATA = 0, + OPCODE_QUIESCE_ACK = 1, + OPCODE_EOF = 2, + OPCODE_REACHED_CHECKPOINT = 3, + OPCODE_CANCELED_CHECKPOINT = 4, +}; + +/* Host to FPGA opcodes */ +enum { + OPCODE_QUIESCE = 0, + OPCODE_REQ_IDT = 1, + OPCODE_SET_CHECKPOINT = 2, + OPCODE_CLOSE = 3, + OPCODE_SET_PUSH = 4, + OPCODE_UPDATE_PUSH = 5, + OPCODE_CANCEL_CHECKPOINT = 6, + OPCODE_SET_ADDR = 7, +}; + +/* + * fifo_write() and fifo_read() are NOT reentrant (i.e. concurrent multiple + * calls to each on the same FIFO is not allowed) however it's OK to have + * threads calling each of the two functions once on the same FIFO, and + * at the same time. + */ + +static int fifo_write(struct xillyfifo *fifo, + const void *data, unsigned int len, + int (*copier)(void *, const void *, int)) +{ + unsigned int done = 0; + unsigned int todo = len; + unsigned int nmax; + unsigned int writepos = fifo->writepos; + unsigned int writebuf = fifo->writebuf; + + nmax = fifo->size - atomic_read(&fifo->fill); + + while (1) { + unsigned int nrail = fifo->bufsize - writepos; + unsigned int n = min(todo, nmax); + + if (n == 0) { + /* + * Ensure copied data is visible before + * it's accounted for. + */ + smp_wmb(); + atomic_add(done, &fifo->fill); + + fifo->writepos = writepos; + fifo->writebuf = writebuf; + + return done; + } + + if (n > nrail) + n = nrail; + + if ((*copier)(fifo->mem[writebuf] + writepos, data + done, n)) + return -EFAULT; + + done += n; + todo -= n; + + writepos += n; + nmax -= n; + + if (writepos == fifo->bufsize) { + writepos = 0; + writebuf++; + + if (writebuf == fifo->bufnum) + writebuf = 0; + } + } +} + +static unsigned int fifo_read(struct xillyfifo *fifo, + void *data, unsigned int len, + int (*copier)(void *, const void *, int)) +{ + unsigned int done = 0; + unsigned int todo = len; + unsigned int fill; + unsigned int readpos = fifo->readpos; + unsigned int readbuf = fifo->readbuf; + + fill = atomic_read(&fifo->fill); + + /* Ensure that the data accounted for is synchronized in buffer */ + smp_rmb(); + + while (1) { + unsigned int nrail = fifo->bufsize - readpos; + unsigned int n = min(todo, fill); + + if (n == 0) { + atomic_sub(done, &fifo->fill); + + fifo->readpos = readpos; + fifo->readbuf = readbuf; + + return done; + } + + if (n > nrail) + n = nrail; + + if ((*copier)(data + done, fifo->mem[readbuf] + readpos, n)) + return -EFAULT; + + done += n; + todo -= n; + + readpos += n; + fill -= n; + + if (readpos == fifo->bufsize) { + readpos = 0; + readbuf++; + + if (readbuf == fifo->bufnum) + readbuf = 0; + } + } +} + +static int fifo_init(struct xillyfifo *fifo, + unsigned int log2_size) +{ + unsigned int log2_bufnum; + unsigned int buf_order; + int i; + + unsigned int log2_fifo_buf_size; + +retry: + log2_fifo_buf_size = fifo_buf_order + PAGE_SHIFT; + + if (log2_size > log2_fifo_buf_size) { + log2_bufnum = log2_size - log2_fifo_buf_size; + buf_order = fifo_buf_order; + fifo->bufsize = 1 << log2_fifo_buf_size; + } else { + log2_bufnum = 0; + buf_order = (log2_size > PAGE_SHIFT) ? + log2_size - PAGE_SHIFT : 0; + fifo->bufsize = 1 << log2_size; + } + + fifo->bufnum = 1 << log2_bufnum; + fifo->size = fifo->bufnum * fifo->bufsize; + fifo->buf_order = buf_order; + + fifo->mem = kmalloc_array(fifo->bufnum, sizeof(void *), GFP_KERNEL); + + if (!fifo->mem) + return -ENOMEM; + + for (i = 0; i < fifo->bufnum; i++) { + fifo->mem[i] = (void *) + __get_free_pages(GFP_KERNEL, buf_order); + + if (!fifo->mem[i]) + goto memfail; + } + + atomic_set(&fifo->fill, 0); + fifo->readpos = 0; + fifo->readbuf = 0; + fifo->writepos = 0; + fifo->writebuf = 0; + init_waitqueue_head(&fifo->waitq); + return 0; + +memfail: + for (i--; i >= 0; i--) + free_pages((unsigned long)fifo->mem[i], buf_order); + + kfree(fifo->mem); + fifo->mem = NULL; + + if (fifo_buf_order) { + fifo_buf_order--; + pr_warn("%s: Trying again to allocate FIFO %d bytes, now with segments of %d bytes each\n", + err_name, 1 << log2_size, + 1 << (fifo_buf_order + PAGE_SHIFT)); + goto retry; + } else { + pr_err("%s: Failed to allocate FIFO with %d bytes, despite attepts to chop it into small pieces.\n", + err_name, 1 << log2_size); + return -ENOMEM; + } +} + +static void fifo_mem_release(struct xillyfifo *fifo) +{ + int i; + + if (!fifo->mem) + return; + + for (i = 0; i < fifo->bufnum; i++) + free_pages((unsigned long)fifo->mem[i], fifo->buf_order); + + kfree(fifo->mem); +} + +/* + * Note that endpoint_dealloc() also frees fifo memory (if allocated), even + * though endpoint_alloc doesn't allocate that memory. + */ + +static void endpoint_dealloc(struct xillyusb_endpoint *ep) +{ + struct list_head *this, *next; + struct list_head *buffers = &ep->buffers; + unsigned int order = ep->order; + + ep->shutting_down = true; + + /* + * The first cancel_work_sync() doesn't just cancel a possibly running + * work item, but also ensures that if it's re-queued by a URB + * completer in a race condition, the next execution of the work item + * will see the ep->shutting_down as true, and do nothing. Hence we're + * sure all queued URBs are anchored and no new ones will be added + * after cancel_work_sync() returns. + * However a second cancel_work_sync() is still required if such race + * condition would re-queue the work item, since @ep is just about to + * be freed. + */ + + cancel_work_sync(&ep->workitem); + usb_kill_anchored_urbs(&ep->anchor); + cancel_work_sync(&ep->workitem); + + fifo_mem_release(&ep->fifo); + + list_for_each_safe(this, next, buffers) { + struct xillybuffer *xb = + list_entry(this, struct xillybuffer, entry); + + free_pages((unsigned long)xb->buf, order); + kfree(xb); + } + + kfree(ep); +} + +static struct xillyusb_endpoint +*endpoint_alloc(struct xillyusb_dev *xdev, + u8 ep_num, + void (*work)(struct work_struct *), + unsigned int order, + int bufnum) +{ + int i; + + struct xillyusb_endpoint *ep; + + ep = kzalloc(sizeof(*ep), GFP_KERNEL); + + if (!ep) + return NULL; + + INIT_LIST_HEAD(&ep->buffers); + INIT_LIST_HEAD(&ep->filled_buffers); + + spin_lock_init(&ep->buffers_lock); + + init_usb_anchor(&ep->anchor); + INIT_WORK(&ep->workitem, work); + + ep->order = order; + ep->buffer_size = 1 << (PAGE_SHIFT + order); + ep->outstanding_urbs = 0; + ep->xdev = xdev; + ep->ep_num = ep_num; + ep->shutting_down = false; + + for (i = 0; i < bufnum; i++) { + struct xillybuffer *xb; + unsigned long addr; + + xb = kzalloc(sizeof(*xb), GFP_KERNEL); + + if (!xb) { + endpoint_dealloc(ep); + return NULL; + } + + addr = __get_free_pages(GFP_KERNEL, order); + + if (!addr) { + kfree(xb); + endpoint_dealloc(ep); + return NULL; + } + + xb->buf = (void *)addr; + xb->ep = ep; + list_add_tail(&xb->entry, &ep->buffers); + } + return ep; +} + +static void cleanup_dev(struct kref *kref) +{ + struct xillyusb_dev *xdev = + container_of(kref, struct xillyusb_dev, kref); + + if (xdev->in_ep) + endpoint_dealloc(xdev->in_ep); + + if (xdev->msg_ep) + endpoint_dealloc(xdev->msg_ep); + + if (xdev->workq) + destroy_workqueue(xdev->workq); + + kfree(xdev->channels); /* Argument may be NULL, and that's fine */ + kfree(xdev); +} + +/* + * wakeup_all() is implemented as a work item, because of the need to be + * sure that bulk_in_work() sees xdev->error with a non-zero value if it + * runs after all read_data_ok have been cleared. xdev->error is assigned + * with this non-zero number prior to queueing the work, but it seems like + * only a mutex ensures this correct order of execution. + * + * In particular, the fact that wakeup_all() and bulk_in_work() are queued on + * the same workqueue makes their concurrent execution very unlikely, + * however the kernel's API doesn't seem to ensure this strictly. + * report_io_error() is possibly called in atomic context and can therefore + * not take a mutex. + */ + +static void wakeup_all(struct work_struct *work) +{ + int i; + struct xillyusb_dev *xdev = container_of(work, struct xillyusb_dev, + wakeup_workitem); + + mutex_lock(&xdev->process_in_mutex); + + for (i = 0; i < xdev->num_channels; i++) { + struct xillyusb_channel *chan = &xdev->channels[i]; + + mutex_lock(&chan->lock); + + if (chan->in_fifo) { + /* + * Fake an EOF: Even if such arrives, it won't be + * processed. + */ + chan->read_data_ok = 0; + wake_up_interruptible(&chan->in_fifo->waitq); + } + + if (chan->out_ep) + wake_up_interruptible(&chan->out_ep->fifo.waitq); + + mutex_unlock(&chan->lock); + + wake_up_interruptible(&chan->flushq); + } + + mutex_unlock(&xdev->process_in_mutex); + + wake_up_interruptible(&xdev->msg_ep->fifo.waitq); + + kref_put(&xdev->kref, cleanup_dev); +} + +static void report_io_error(struct xillyusb_dev *xdev, + int errcode) +{ + unsigned long flags; + bool do_once = false; + + spin_lock_irqsave(&xdev->error_lock, flags); + if (!xdev->error) { + xdev->error = errcode; + do_once = true; + } + spin_unlock_irqrestore(&xdev->error_lock, flags); + + if (do_once) { + kref_get(&xdev->kref); /* xdev is used by work item */ + queue_work(xdev->workq, &xdev->wakeup_workitem); + } +} + +/* + * safely_assign_in_fifo() changes the value of chan->in_fifo and ensures + * the previous pointer is never used after its return. + */ + +static void safely_assign_in_fifo(struct xillyusb_channel *chan, + struct xillyfifo *fifo) +{ + mutex_lock(&chan->lock); + chan->in_fifo = fifo; + mutex_unlock(&chan->lock); + + flush_work(&chan->xdev->in_ep->workitem); +} + +static int xilly_memcpy(void *dst, const void *src, int n) +{ + memcpy(dst, src, n); + return 0; +} + +static void bulk_in_completer(struct urb *urb) +{ + struct xillybuffer *xb = urb->context; + struct xillyusb_endpoint *ep = xb->ep; + unsigned long flags; + + if (urb->status) { + if (!(urb->status == -ENOENT || + urb->status == -ECONNRESET || + urb->status == -ESHUTDOWN)) + report_io_error(ep->xdev, -EIO); + + spin_lock_irqsave(&ep->buffers_lock, flags); + list_add_tail(&xb->entry, &ep->buffers); + ep->outstanding_urbs--; + spin_unlock_irqrestore(&ep->buffers_lock, flags); + + return; + } + + xb->len = urb->actual_length; + + spin_lock_irqsave(&ep->buffers_lock, flags); + list_add_tail(&xb->entry, &ep->filled_buffers); + spin_unlock_irqrestore(&ep->buffers_lock, flags); + + if (!ep->shutting_down) + queue_work(ep->xdev->workq, &ep->workitem); +} + +static void bulk_out_completer(struct urb *urb) +{ + struct xillybuffer *xb = urb->context; + struct xillyusb_endpoint *ep = xb->ep; + unsigned long flags; + + if (urb->status && + (!(urb->status == -ENOENT || + urb->status == -ECONNRESET || + urb->status == -ESHUTDOWN))) + report_io_error(ep->xdev, -EIO); + + spin_lock_irqsave(&ep->buffers_lock, flags); + list_add_tail(&xb->entry, &ep->buffers); + ep->outstanding_urbs--; + spin_unlock_irqrestore(&ep->buffers_lock, flags); + + if (!ep->shutting_down) + queue_work(ep->xdev->workq, &ep->workitem); +} + +static void try_queue_bulk_in(struct xillyusb_endpoint *ep) +{ + struct xillyusb_dev *xdev = ep->xdev; + struct xillybuffer *xb; + struct urb *urb; + + int rc; + unsigned long flags; + unsigned int bufsize = ep->buffer_size; + + if (ep->shutting_down) + return; + + mutex_lock(&xdev->io_mutex); + + if (!xdev->interface || xdev->error) + goto done; + + while (1) { + spin_lock_irqsave(&ep->buffers_lock, flags); + + if (list_empty(&ep->buffers)) { + spin_unlock_irqrestore(&ep->buffers_lock, flags); + goto done; + } + + xb = list_first_entry(&ep->buffers, struct xillybuffer, entry); + list_del(&xb->entry); + ep->outstanding_urbs++; + + spin_unlock_irqrestore(&ep->buffers_lock, flags); + + urb = usb_alloc_urb(0, GFP_KERNEL); + if (!urb) { + report_io_error(xdev, -ENOMEM); + goto relist; + } + + usb_fill_bulk_urb(urb, xdev->udev, + usb_rcvbulkpipe(xdev->udev, ep->ep_num), + xb->buf, bufsize, bulk_in_completer, xb); + + usb_anchor_urb(urb, &ep->anchor); + + rc = usb_submit_urb(urb, GFP_KERNEL); + + if (rc) { + report_io_error(xdev, (rc == -ENOMEM) ? -ENOMEM : + -EIO); + goto unanchor; + } + + usb_free_urb(urb); /* This just decrements reference count */ + } + +unanchor: + usb_unanchor_urb(urb); + usb_free_urb(urb); + +relist: + spin_lock_irqsave(&ep->buffers_lock, flags); + list_add_tail(&xb->entry, &ep->buffers); + ep->outstanding_urbs--; + spin_unlock_irqrestore(&ep->buffers_lock, flags); + +done: + mutex_unlock(&xdev->io_mutex); +} + +static void try_queue_bulk_out(struct xillyusb_endpoint *ep) +{ + struct xillyfifo *fifo = &ep->fifo; + struct xillyusb_dev *xdev = ep->xdev; + struct xillybuffer *xb; + struct urb *urb; + + int rc; + unsigned int fill; + unsigned long flags; + bool submitted = false; + + if (ep->shutting_down) + return; + + mutex_lock(&xdev->io_mutex); + + if (!xdev->interface || xdev->error) + goto done; + + fill = atomic_read(&fifo->fill) & ep->fill_mask; + + while (1) { + int count; + unsigned int max_read; + + if (fill == 0) + goto done; + + spin_lock_irqsave(&ep->buffers_lock, flags); + + if ((fill < ep->buffer_size && ep->outstanding_urbs) || + list_empty(&ep->buffers)) { + spin_unlock_irqrestore(&ep->buffers_lock, flags); + goto done; + } + + xb = list_first_entry(&ep->buffers, struct xillybuffer, entry); + list_del(&xb->entry); + ep->outstanding_urbs++; + + spin_unlock_irqrestore(&ep->buffers_lock, flags); + + max_read = min(fill, ep->buffer_size); + + count = fifo_read(&ep->fifo, xb->buf, max_read, xilly_memcpy); + + /* + * xilly_memcpy always returns 0 => fifo_read can't fail => + * count > 0 + */ + + urb = usb_alloc_urb(0, GFP_KERNEL); + if (!urb) { + report_io_error(xdev, -ENOMEM); + goto relist; + } + + usb_fill_bulk_urb(urb, xdev->udev, + usb_sndbulkpipe(xdev->udev, ep->ep_num), + xb->buf, count, bulk_out_completer, xb); + + usb_anchor_urb(urb, &ep->anchor); + + rc = usb_submit_urb(urb, GFP_KERNEL); + + if (rc) { + report_io_error(xdev, (rc == -ENOMEM) ? -ENOMEM : + -EIO); + goto unanchor; + } + + usb_free_urb(urb); /* This just decrements reference count */ + + fill -= count; + submitted = true; + } + +unanchor: + usb_unanchor_urb(urb); + usb_free_urb(urb); + +relist: + spin_lock_irqsave(&ep->buffers_lock, flags); + list_add_tail(&xb->entry, &ep->buffers); + ep->outstanding_urbs--; + spin_unlock_irqrestore(&ep->buffers_lock, flags); + +done: + mutex_unlock(&xdev->io_mutex); + + if (submitted) + wake_up_interruptible(&fifo->waitq); +} + +static void bulk_out_work(struct work_struct *work) +{ + struct xillyusb_endpoint *ep = container_of(work, + struct xillyusb_endpoint, + workitem); + try_queue_bulk_out(ep); +} + +static int process_in_opcode(struct xillyusb_dev *xdev, + int opcode, + int chan_num) +{ + struct xillyusb_channel *chan; + int chan_idx = chan_num >> 1; + + if (chan_idx >= xdev->num_channels) { + pr_err("%s: Received illegal channel ID %d from FPGA\n", + err_name, chan_num); + return -EIO; + } + + chan = &xdev->channels[chan_idx]; + + switch (opcode) { + case OPCODE_EOF: + if (!READ_ONCE(chan->read_data_ok)) { + pr_err("%s: Received unexpected EOF for channel %d\n", + err_name, chan_num); + return -EIO; + } + + /* + * A write memory barrier ensures that the FIFO's fill level + * is visible before read_data_ok turns zero, so the data in + * the FIFO isn't missed by the consumer. + */ + smp_wmb(); + WRITE_ONCE(chan->read_data_ok, 0); + wake_up_interruptible(&chan->in_fifo->waitq); + break; + + case OPCODE_REACHED_CHECKPOINT: + chan->flushing = 0; + wake_up_interruptible(&chan->flushq); + break; + + case OPCODE_CANCELED_CHECKPOINT: + chan->canceled = 1; + wake_up_interruptible(&chan->flushq); + break; + + default: + pr_err("%s: Received illegal opcode %d from FPGA\n", + err_name, opcode); + return -EIO; + } + + return 0; +} + +static int process_bulk_in(struct xillybuffer *xb) +{ + struct xillyusb_endpoint *ep = xb->ep; + struct xillyusb_dev *xdev = ep->xdev; + int dws = xb->len >> 2; + __le32 *p = xb->buf; + u32 ctrlword; + struct xillyusb_channel *chan; + struct xillyfifo *fifo; + int chan_num = 0, opcode; + int chan_idx; + int bytes, count, dwconsume; + int in_bytes_left = 0; + int rc; + + if ((dws << 2) != xb->len) { + pr_err("%s: Received BULK IN transfer with %d bytes, not a multiple of 4\n", + err_name, xb->len); + return -EIO; + } + + if (xdev->in_bytes_left) { + bytes = min(xdev->in_bytes_left, dws << 2); + in_bytes_left = xdev->in_bytes_left - bytes; + chan_num = xdev->leftover_chan_num; + goto resume_leftovers; + } + + while (dws) { + ctrlword = le32_to_cpu(*p++); + dws--; + + chan_num = ctrlword & 0xfff; + count = (ctrlword >> 12) & 0x3ff; + opcode = (ctrlword >> 24) & 0xf; + + if (opcode != OPCODE_DATA) { + unsigned int in_counter = xdev->in_counter++ & 0x3ff; + + if (count != in_counter) { + pr_err("%s: Expected opcode counter %d, got %d\n", + err_name, in_counter, count); + return -EIO; + } + + rc = process_in_opcode(xdev, opcode, chan_num); + + if (rc) + return rc; + + continue; + } + + bytes = min(count + 1, dws << 2); + in_bytes_left = count + 1 - bytes; + +resume_leftovers: + chan_idx = chan_num >> 1; + + if (!(chan_num & 1) || chan_idx >= xdev->num_channels || + !READ_ONCE(xdev->channels[chan_idx].read_data_ok)) { + pr_err("%s: Received illegal channel ID %d from FPGA\n", + err_name, chan_num); + return -EIO; + } + chan = &xdev->channels[chan_idx]; + + fifo = chan->in_fifo; + + if (unlikely(!fifo)) + return -EIO; /* We got really unexpected data */ + + if (bytes != fifo_write(fifo, p, bytes, xilly_memcpy)) { + pr_err("%s: Misbehaving FPGA overflew an upstream FIFO!\n", + err_name); + return -EIO; + } + + wake_up_interruptible(&fifo->waitq); + + dwconsume = (bytes + 3) >> 2; + dws -= dwconsume; + p += dwconsume; + } + + xdev->in_bytes_left = in_bytes_left; + xdev->leftover_chan_num = chan_num; + return 0; +} + +static void bulk_in_work(struct work_struct *work) +{ + struct xillyusb_endpoint *ep = + container_of(work, struct xillyusb_endpoint, workitem); + struct xillyusb_dev *xdev = ep->xdev; + unsigned long flags; + struct xillybuffer *xb; + bool consumed = false; + int rc = 0; + + mutex_lock(&xdev->process_in_mutex); + + spin_lock_irqsave(&ep->buffers_lock, flags); + + while (1) { + if (list_empty(&ep->filled_buffers)) { + spin_unlock_irqrestore(&ep->buffers_lock, flags); + + mutex_unlock(&xdev->process_in_mutex); + + if (consumed) + try_queue_bulk_in(ep); + + return; + } + + xb = list_first_entry(&ep->filled_buffers, struct xillybuffer, + entry); + list_del(&xb->entry); + + spin_unlock_irqrestore(&ep->buffers_lock, flags); + + consumed = true; + + if (!xdev->error) + rc = process_bulk_in(xb); + + if (rc) { + mutex_unlock(&xdev->process_in_mutex); + report_io_error(xdev, rc); + return; + } + + spin_lock_irqsave(&ep->buffers_lock, flags); + list_add_tail(&xb->entry, &ep->buffers); + ep->outstanding_urbs--; + } +} + +static int xillyusb_send_opcode(struct xillyusb_dev *xdev, + int chan_num, char opcode, u32 data) +{ + struct xillyusb_endpoint *ep = xdev->msg_ep; + struct xillyfifo *fifo = &ep->fifo; + __le32 msg[2]; + + int rc = 0; + + msg[0] = cpu_to_le32((chan_num & 0xfff) | + ((opcode & 0xf) << 24)); + msg[1] = cpu_to_le32(data); + + mutex_lock(&xdev->msg_mutex); + + /* + * The wait queue is woken with the interruptible variant, so the + * wait function matches, however returning because of an interrupt + * will mess things up considerably, in particular when the caller is + * the release method. And the xdev->error part prevents being stuck + * forever: Just pull the USB plug. + */ + + while (wait_event_interruptible(fifo->waitq, + ((atomic_read(&fifo->fill) + <= (fifo->size - 8)) || + xdev->error))) + ; /* Empty loop */ + + if (xdev->error) { + rc = xdev->error; + goto unlock_done; + } + + fifo_write(fifo, (void *)msg, 8, xilly_memcpy); + + try_queue_bulk_out(ep); + +unlock_done: + mutex_unlock(&xdev->msg_mutex); + + return rc; +} + +/* + * Note that flush_downstream() merely waits for the data to arrive to + * the application logic at the FPGA -- unlike PCIe Xillybus' counterpart, + * it does nothing to make it happen (and neither is it necessary). + * + * This function is not reentrant for the same @chan, but this is covered + * by the fact that for any given @chan, it's called either by the open, + * write, llseek and flush fops methods, which can't run in parallel (and the + * write + flush and llseek method handlers are protected with out_mutex). + * + * chan->flushed is there to avoid multiple flushes at the same position, + * in particular as a result of programs that close the file descriptor + * e.g. after a dup2() for redirection. + */ + +static int flush_downstream(struct xillyusb_channel *chan, + long timeout, + bool interruptible) +{ + struct xillyusb_dev *xdev = chan->xdev; + int chan_num = chan->chan_idx << 1; + long deadline, left_to_sleep; + int rc; + + if (chan->flushed) + return 0; + + deadline = jiffies + 1 + timeout; + + if (chan->flushing) { + long cancel_deadline = jiffies + 1 + XILLY_RESPONSE_TIMEOUT; + + chan->canceled = 0; + rc = xillyusb_send_opcode(xdev, chan_num, + OPCODE_CANCEL_CHECKPOINT, 0); + + if (rc) + return rc; /* Only real error, never -EINTR */ + + /* Ignoring interrupts. Cancellation must be handled */ + while (!chan->canceled) { + left_to_sleep = cancel_deadline - ((long)jiffies); + + if (left_to_sleep <= 0) { + report_io_error(xdev, -EIO); + pr_err("%s: Fatal error: Timed out on flush cancellation request.\n", + err_name); + return -EIO; + } + + rc = wait_event_interruptible_timeout(chan->flushq, + chan->canceled || + xdev->error, + left_to_sleep); + + if (xdev->error) + return xdev->error; + } + } + + chan->flushing = 1; + + /* + * The checkpoint is given in terms of data elements, not bytes. As + * a result, if less than an element's worth of data is stored in the + * FIFO, it's not flushed, including the flush before closing, which + * means that such data is lost. This is consistent with PCIe Xillybus. + */ + + rc = xillyusb_send_opcode(xdev, chan_num, + OPCODE_SET_CHECKPOINT, + chan->out_bytes >> + chan->out_log2_element_size); + + if (rc) + return rc; /* Only real error, never -EINTR */ + + if (!timeout) { + while (chan->flushing) { + rc = wait_event_interruptible(chan->flushq, + !chan->flushing || + xdev->error); + if (xdev->error) + return xdev->error; + + if (interruptible && rc) + return -EINTR; + } + + goto done; + } + + while (chan->flushing) { + left_to_sleep = deadline - ((long)jiffies); + + if (left_to_sleep <= 0) + return -ETIMEDOUT; + + rc = wait_event_interruptible_timeout(chan->flushq, + !chan->flushing || + xdev->error, + left_to_sleep); + + if (xdev->error) + return xdev->error; + + if (interruptible && rc < 0) + return -EINTR; + } + +done: + chan->flushed = 1; + return 0; +} + +/* request_read_anything(): Ask the FPGA for any little amount of data */ +static int request_read_anything(struct xillyusb_channel *chan, + char opcode) +{ + struct xillyusb_dev *xdev = chan->xdev; + unsigned int sh = chan->in_log2_element_size; + int chan_num = (chan->chan_idx << 1) | 1; + u32 mercy = chan->in_consumed_bytes + (2 << sh) - 1; + + return xillyusb_send_opcode(xdev, chan_num, opcode, mercy >> sh); +} + +static int xillyusb_open(struct inode *inode, struct file *filp) +{ + struct xillyusb_dev *xdev; + struct xillyusb_channel *chan; + struct xillyfifo *in_fifo = NULL; + struct xillyusb_endpoint *out_ep = NULL; + int rc; + int index; + + rc = xillybus_find_inode(inode, (void **)&xdev, &index); + if (rc) + return rc; + + chan = &xdev->channels[index]; + filp->private_data = chan; + + mutex_lock(&open_mutex); + + rc = -ENODEV; + + if (((filp->f_mode & FMODE_READ) && !chan->readable) || + ((filp->f_mode & FMODE_WRITE) && !chan->writable)) + goto unmutex_fail; + + if ((filp->f_flags & O_NONBLOCK) && (filp->f_mode & FMODE_READ) && + chan->in_synchronous) { + pr_err("%s: open() failed: O_NONBLOCK not allowed for read on this device\n", + err_name); + goto unmutex_fail; + } + + if ((filp->f_flags & O_NONBLOCK) && (filp->f_mode & FMODE_WRITE) && + chan->out_synchronous) { + pr_err("%s: open() failed: O_NONBLOCK not allowed for write on this device\n", + err_name); + goto unmutex_fail; + } + + rc = -EBUSY; + + if (((filp->f_mode & FMODE_READ) && chan->open_for_read) || + ((filp->f_mode & FMODE_WRITE) && chan->open_for_write)) + goto unmutex_fail; + + kref_get(&xdev->kref); + + if (filp->f_mode & FMODE_READ) + chan->open_for_read = 1; + + if (filp->f_mode & FMODE_WRITE) + chan->open_for_write = 1; + + mutex_unlock(&open_mutex); + + if (filp->f_mode & FMODE_WRITE) { + out_ep = endpoint_alloc(xdev, + (chan->chan_idx + 2) | USB_DIR_OUT, + bulk_out_work, + urb_buforder, urb_bufnum); + + if (!out_ep) { + rc = -ENOMEM; + goto unopen; + } + + rc = fifo_init(&out_ep->fifo, chan->out_log2_fifo_size); + + if (rc) + goto late_unopen; + + out_ep->fill_mask = -(1 << chan->out_log2_element_size); + chan->out_bytes = 0; + chan->flushed = 0; + + /* + * Sending a flush request to a previously closed stream + * effectively opens it, and also waits until the command is + * confirmed by the FPGA. The latter is necessary because the + * data is sent through a separate BULK OUT endpoint, and the + * xHCI controller is free to reorder transmissions. + * + * This can't go wrong unless there's a serious hardware error + * (or the computer is stuck for 500 ms?) + */ + rc = flush_downstream(chan, XILLY_RESPONSE_TIMEOUT, false); + + if (rc == -ETIMEDOUT) { + rc = -EIO; + report_io_error(xdev, rc); + pr_err("%s: Fatal error: Hardware timed out to open request.\n", + err_name); + } + + if (rc) + goto late_unopen; + } + + if (filp->f_mode & FMODE_READ) { + in_fifo = kzalloc(sizeof(*in_fifo), GFP_KERNEL); + + if (!in_fifo) { + rc = -ENOMEM; + goto late_unopen; + } + + rc = fifo_init(in_fifo, chan->in_log2_fifo_size); + + if (rc) { + kfree(in_fifo); + goto late_unopen; + } + } + + mutex_lock(&chan->lock); + if (in_fifo) { + chan->in_fifo = in_fifo; + chan->read_data_ok = 1; + } + if (out_ep) + chan->out_ep = out_ep; + mutex_unlock(&chan->lock); + + if (in_fifo) { + u32 in_checkpoint = 0; + + if (!chan->in_synchronous) + in_checkpoint = in_fifo->size >> + chan->in_log2_element_size; + + chan->in_consumed_bytes = 0; + chan->poll_used = 0; + chan->in_current_checkpoint = in_checkpoint; + rc = xillyusb_send_opcode(xdev, (chan->chan_idx << 1) | 1, + OPCODE_SET_CHECKPOINT, + in_checkpoint); + + if (rc) /* Failure guarantees that opcode wasn't sent */ + goto unfifo; + + /* + * In non-blocking mode, request the FPGA to send any data it + * has right away. Otherwise, the first read() will always + * return -EAGAIN, which is OK strictly speaking, but ugly. + * Checking and unrolling if this fails isn't worth the + * effort -- the error is propagated to the first read() + * anyhow. + */ + if (filp->f_flags & O_NONBLOCK) + request_read_anything(chan, OPCODE_SET_PUSH); + } + + return 0; + +unfifo: + if (in_fifo) { + chan->read_data_ok = 0; + safely_assign_in_fifo(chan, NULL); + fifo_mem_release(in_fifo); + } + + if (out_ep) { + mutex_lock(&chan->lock); + chan->out_ep = NULL; + mutex_unlock(&chan->lock); + } + +late_unopen: + if (out_ep) + endpoint_dealloc(out_ep); + +unopen: + mutex_lock(&open_mutex); + + if (filp->f_mode & FMODE_READ) + chan->open_for_read = 0; + + if (filp->f_mode & FMODE_WRITE) + chan->open_for_write = 0; + + mutex_unlock(&open_mutex); + + kref_put(&xdev->kref, cleanup_dev); + + return rc; + +unmutex_fail: + mutex_unlock(&open_mutex); + return rc; +} + +static int xilly_copy_to_user(void *dst, const void *src, int n) +{ + return copy_to_user((void __user *)dst, src, n); +} + +static ssize_t xillyusb_read(struct file *filp, char __user *userbuf, + size_t count, loff_t *f_pos) +{ + struct xillyusb_channel *chan = filp->private_data; + struct xillyusb_dev *xdev = chan->xdev; + struct xillyfifo *fifo = chan->in_fifo; + int chan_num = (chan->chan_idx << 1) | 1; + + long deadline, left_to_sleep; + int bytes_done = 0; + bool sent_set_push = false; + int rc; + + deadline = jiffies + 1 + XILLY_RX_TIMEOUT; + + rc = mutex_lock_interruptible(&chan->in_mutex); + + if (rc) + return rc; + + while (1) { + u32 fifo_checkpoint_bytes, complete_checkpoint_bytes; + u32 complete_checkpoint, fifo_checkpoint; + u32 checkpoint; + s32 diff, leap; + unsigned int sh = chan->in_log2_element_size; + bool checkpoint_for_complete; + + rc = fifo_read(fifo, (__force void *)userbuf + bytes_done, + count - bytes_done, xilly_copy_to_user); + + if (rc < 0) + break; + + bytes_done += rc; + chan->in_consumed_bytes += rc; + + left_to_sleep = deadline - ((long)jiffies); + + /* + * Some 32-bit arithmetics that may wrap. Note that + * complete_checkpoint is rounded up to the closest element + * boundary, because the read() can't be completed otherwise. + * fifo_checkpoint_bytes is rounded down, because it protects + * in_fifo from overflowing. + */ + + fifo_checkpoint_bytes = chan->in_consumed_bytes + fifo->size; + complete_checkpoint_bytes = + chan->in_consumed_bytes + count - bytes_done; + + fifo_checkpoint = fifo_checkpoint_bytes >> sh; + complete_checkpoint = + (complete_checkpoint_bytes + (1 << sh) - 1) >> sh; + + diff = (fifo_checkpoint - complete_checkpoint) << sh; + + if (chan->in_synchronous && diff >= 0) { + checkpoint = complete_checkpoint; + checkpoint_for_complete = true; + } else { + checkpoint = fifo_checkpoint; + checkpoint_for_complete = false; + } + + leap = (checkpoint - chan->in_current_checkpoint) << sh; + + /* + * To prevent flooding of OPCODE_SET_CHECKPOINT commands as + * data is consumed, it's issued only if it moves the + * checkpoint by at least an 8th of the FIFO's size, or if + * it's necessary to complete the number of bytes requested by + * the read() call. + * + * chan->read_data_ok is checked to spare an unnecessary + * submission after receiving EOF, however it's harmless if + * such slips away. + */ + + if (chan->read_data_ok && + (leap > (fifo->size >> 3) || + (checkpoint_for_complete && leap > 0))) { + chan->in_current_checkpoint = checkpoint; + rc = xillyusb_send_opcode(xdev, chan_num, + OPCODE_SET_CHECKPOINT, + checkpoint); + + if (rc) + break; + } + + if (bytes_done == count || + (left_to_sleep <= 0 && bytes_done)) + break; + + /* + * Reaching here means that the FIFO was empty at the call to + * fifo_read() above, but not necessarily right now. Error + * and EOF are checked and reported only now, so that no data + * that managed its way to the FIFO is lost. + */ + + if (!READ_ONCE(chan->read_data_ok)) { /* FPGA has sent EOF */ + /* Has data slipped into the FIFO since fifo_read()? */ + smp_rmb(); + if (atomic_read(&fifo->fill)) + continue; + + rc = 0; + break; + } + + if (xdev->error) { + rc = xdev->error; + break; + } + + if (filp->f_flags & O_NONBLOCK) { + rc = -EAGAIN; + break; + } + + if (left_to_sleep > 0) { + if (!sent_set_push) { + rc = xillyusb_send_opcode(xdev, chan_num, + OPCODE_SET_PUSH, + complete_checkpoint); + + if (rc) + break; + + sent_set_push = true; + } + + /* + * Note that when xdev->error is set (e.g. when the + * device is unplugged), read_data_ok turns zero and + * fifo->waitq is awaken. + * Therefore no special attention to xdev->error. + */ + + rc = wait_event_interruptible_timeout + (fifo->waitq, + atomic_read(&fifo->fill) || + !chan->read_data_ok, + left_to_sleep); + } else { /* bytes_done == 0 */ + /* Tell FPGA to send anything it has */ + rc = request_read_anything(chan, OPCODE_UPDATE_PUSH); + + if (rc) + break; + + rc = wait_event_interruptible + (fifo->waitq, + atomic_read(&fifo->fill) || + !chan->read_data_ok); + } + + if (rc < 0) { + rc = -EINTR; + break; + } + } + + if (((filp->f_flags & O_NONBLOCK) || chan->poll_used) && + !atomic_read(&fifo->fill)) + request_read_anything(chan, OPCODE_SET_PUSH); + + mutex_unlock(&chan->in_mutex); + + if (bytes_done) + return bytes_done; + + return rc; +} + +static int xillyusb_flush(struct file *filp, fl_owner_t id) +{ + struct xillyusb_channel *chan = filp->private_data; + int rc; + + if (!(filp->f_mode & FMODE_WRITE)) + return 0; + + rc = mutex_lock_interruptible(&chan->out_mutex); + + if (rc) + return rc; + + /* + * One second's timeout on flushing. Interrupts are ignored, because if + * the user pressed CTRL-C, that interrupt will still be in flight by + * the time we reach here, and the opportunity to flush is lost. + */ + rc = flush_downstream(chan, HZ, false); + + if (rc == -ETIMEDOUT) + pr_warn("%s: Timed out while flushing. Output data may be lost.\n", + err_name); + + mutex_unlock(&chan->out_mutex); + + return rc; +} + +static int xilly_copy_from_user(void *dst, const void *src, int n) +{ + return copy_from_user(dst, (const void __user *)src, n); +} + +static ssize_t xillyusb_write(struct file *filp, const char __user *userbuf, + size_t count, loff_t *f_pos) +{ + struct xillyusb_channel *chan = filp->private_data; + struct xillyusb_dev *xdev = chan->xdev; + struct xillyfifo *fifo = &chan->out_ep->fifo; + int rc; + + rc = mutex_lock_interruptible(&chan->out_mutex); + + if (rc) + return rc; + + while (1) { + if (xdev->error) { + rc = xdev->error; + break; + } + + if (count == 0) + break; + + rc = fifo_write(fifo, (__force void *)userbuf, count, + xilly_copy_from_user); + + if (rc != 0) + break; + + if (filp->f_flags & O_NONBLOCK) { + rc = -EAGAIN; + break; + } + + if (wait_event_interruptible + (fifo->waitq, + (atomic_read(&fifo->fill) != fifo->size) || + xdev->error)) { + rc = -EINTR; + break; + } + } + + if (rc < 0) + goto done; + + chan->out_bytes += rc; + + if (rc) { + try_queue_bulk_out(chan->out_ep); + chan->flushed = 0; + } + + if (chan->out_synchronous) { + int flush_rc = flush_downstream(chan, 0, true); + + if (flush_rc && !rc) + rc = flush_rc; + } + +done: + mutex_unlock(&chan->out_mutex); + + return rc; +} + +static int xillyusb_release(struct inode *inode, struct file *filp) +{ + struct xillyusb_channel *chan = filp->private_data; + struct xillyusb_dev *xdev = chan->xdev; + int rc_read = 0, rc_write = 0; + + if (filp->f_mode & FMODE_READ) { + struct xillyfifo *in_fifo = chan->in_fifo; + + rc_read = xillyusb_send_opcode(xdev, (chan->chan_idx << 1) | 1, + OPCODE_CLOSE, 0); + /* + * If rc_read is nonzero, xdev->error indicates a global + * device error. The error is reported later, so that + * resources are freed. + * + * Looping on wait_event_interruptible() kinda breaks the idea + * of being interruptible, and this should have been + * wait_event(). Only it's being waken with + * wake_up_interruptible() for the sake of other uses. If + * there's a global device error, chan->read_data_ok is + * deasserted and the wait queue is awaken, so this is covered. + */ + + while (wait_event_interruptible(in_fifo->waitq, + !chan->read_data_ok)) + ; /* Empty loop */ + + safely_assign_in_fifo(chan, NULL); + fifo_mem_release(in_fifo); + + mutex_lock(&open_mutex); + chan->open_for_read = 0; + mutex_unlock(&open_mutex); + } + + if (filp->f_mode & FMODE_WRITE) { + struct xillyusb_endpoint *ep = chan->out_ep; + /* + * chan->flushing isn't zeroed. If the pre-release flush timed + * out, a cancel request will be sent before the next + * OPCODE_SET_CHECKPOINT (i.e. when the file is opened again). + * This is despite that the FPGA forgets about the checkpoint + * request as the file closes. Still, in an exceptional race + * condition, the FPGA could send an OPCODE_REACHED_CHECKPOINT + * just before closing that would reach the host after the + * file has re-opened. + */ + + mutex_lock(&chan->lock); + chan->out_ep = NULL; + mutex_unlock(&chan->lock); + + endpoint_dealloc(ep); + + /* See comments on rc_read above */ + rc_write = xillyusb_send_opcode(xdev, chan->chan_idx << 1, + OPCODE_CLOSE, 0); + + mutex_lock(&open_mutex); + chan->open_for_write = 0; + mutex_unlock(&open_mutex); + } + + kref_put(&xdev->kref, cleanup_dev); + + return rc_read ? rc_read : rc_write; +} + +static loff_t xillyusb_llseek(struct file *filp, loff_t offset, int whence) +{ + struct xillyusb_channel *chan = filp->private_data; + struct xillyusb_dev *xdev = chan->xdev; + loff_t pos = filp->f_pos; + int rc = 0; + unsigned int log2_element_size = chan->readable ? + chan->in_log2_element_size : chan->out_log2_element_size; + + /* + * Take both mutexes not allowing interrupts, since it seems like + * common applications don't expect an -EINTR here. Besides, multiple + * access to a single file descriptor on seekable devices is a mess + * anyhow. + */ + + mutex_lock(&chan->out_mutex); + mutex_lock(&chan->in_mutex); + + switch (whence) { + case SEEK_SET: + pos = offset; + break; + case SEEK_CUR: + pos += offset; + break; + case SEEK_END: + pos = offset; /* Going to the end => to the beginning */ + break; + default: + rc = -EINVAL; + goto end; + } + + /* In any case, we must finish on an element boundary */ + if (pos & ((1 << log2_element_size) - 1)) { + rc = -EINVAL; + goto end; + } + + rc = xillyusb_send_opcode(xdev, chan->chan_idx << 1, + OPCODE_SET_ADDR, + pos >> log2_element_size); + + if (rc) + goto end; + + /* + * If the stream is writable (it most likely is), a flush request is + * sent to ensure that traffic on the stream's BULK OUT endpoint isn't + * sent before the position is updated on the FPGA -- otherwise that + * data could arrive before the position update. Since only + * synchronous streams can be seekable, flush_downstream() has already + * been called after the last write(), so flushing is completed + * virtually right away. Well, unless the last flush was interrupted, + * in which case we wait for up to 1000 ms, and return -ETIMEDOUT (!) + * if the flush was incomplete. No real-life application should ever + * get to this point. + */ + + if (chan->writable) { + chan->flushed = 0; + rc = flush_downstream(chan, HZ, false); + } + +end: + mutex_unlock(&chan->out_mutex); + mutex_unlock(&chan->in_mutex); + + if (rc) /* Return error after releasing mutexes */ + return rc; + + filp->f_pos = pos; + + return pos; +} + +static __poll_t xillyusb_poll(struct file *filp, poll_table *wait) +{ + struct xillyusb_channel *chan = filp->private_data; + __poll_t mask = 0; + + if (chan->in_fifo) + poll_wait(filp, &chan->in_fifo->waitq, wait); + + if (chan->out_ep) + poll_wait(filp, &chan->out_ep->fifo.waitq, wait); + + /* + * If this is the first time poll() is called, and the file is + * readable, set the relevant flag. Also tell the FPGA to send all it + * has, to kickstart the mechanism that ensures there's always some + * data in in_fifo unless the stream is dry end-to-end. Note that the + * first poll() may not return a EPOLLIN, even if there's data on the + * FPGA. Rather, the data will arrive soon, and trigger the relevant + * wait queue. + */ + + if (!chan->poll_used && chan->in_fifo) { + chan->poll_used = 1; + request_read_anything(chan, OPCODE_SET_PUSH); + } + + /* + * poll() won't play ball regarding read() channels which + * are synchronous. Allowing that will create situations where data has + * been delivered at the FPGA, and users expecting select() to wake up, + * which it may not. So make it never work. + */ + + if (chan->in_fifo && !chan->in_synchronous && + (atomic_read(&chan->in_fifo->fill) || !chan->read_data_ok)) + mask |= EPOLLIN | EPOLLRDNORM; + + if (chan->out_ep && + (atomic_read(&chan->out_ep->fifo.fill) != + chan->out_ep->fifo.size)) + mask |= EPOLLOUT | EPOLLWRNORM; + + if (chan->xdev->error) + mask |= EPOLLERR; + + return mask; +} + +static const struct file_operations xillyusb_fops = { + .owner = THIS_MODULE, + .read = xillyusb_read, + .write = xillyusb_write, + .open = xillyusb_open, + .flush = xillyusb_flush, + .release = xillyusb_release, + .llseek = xillyusb_llseek, + .poll = xillyusb_poll, +}; + +static int xillyusb_setup_base_eps(struct xillyusb_dev *xdev) +{ + xdev->msg_ep = endpoint_alloc(xdev, MSG_EP_NUM | USB_DIR_OUT, + bulk_out_work, 1, 2); + if (!xdev->msg_ep) + return -ENOMEM; + + if (fifo_init(&xdev->msg_ep->fifo, 13)) /* 8 kiB */ + goto dealloc; + + xdev->msg_ep->fill_mask = -8; /* 8 bytes granularity */ + + xdev->in_ep = endpoint_alloc(xdev, IN_EP_NUM | USB_DIR_IN, + bulk_in_work, urb_buforder, urb_bufnum); + if (!xdev->in_ep) + goto dealloc; + + try_queue_bulk_in(xdev->in_ep); + + return 0; + +dealloc: + endpoint_dealloc(xdev->msg_ep); /* Also frees FIFO mem if allocated */ + return -ENOMEM; +} + +static int setup_channels(struct xillyusb_dev *xdev, + __le16 *chandesc) +{ + struct xillyusb_channel *chan; + int i; + + chan = kcalloc(xdev->num_channels, sizeof(*chan), GFP_KERNEL); + if (!chan) + return -ENOMEM; + + xdev->channels = chan; + + for (i = 0; i < xdev->num_channels; i++, chan++) { + unsigned int in_desc = le16_to_cpu(*chandesc++); + unsigned int out_desc = le16_to_cpu(*chandesc++); + + chan->xdev = xdev; + mutex_init(&chan->in_mutex); + mutex_init(&chan->out_mutex); + mutex_init(&chan->lock); + init_waitqueue_head(&chan->flushq); + + chan->chan_idx = i; + + if (in_desc & 0x80) { /* Entry is valid */ + chan->readable = 1; + chan->in_synchronous = !!(in_desc & 0x40); + chan->in_seekable = !!(in_desc & 0x20); + chan->in_log2_element_size = in_desc & 0x0f; + chan->in_log2_fifo_size = ((in_desc >> 8) & 0x1f) + 16; + } + + if (out_desc & 0x80) { /* Entry is valid */ + chan->writable = 1; + chan->out_synchronous = !!(out_desc & 0x40); + chan->out_seekable = !!(out_desc & 0x20); + chan->out_log2_element_size = out_desc & 0x0f; + chan->out_log2_fifo_size = + ((out_desc >> 8) & 0x1f) + 16; + } + } + + return 0; +} + +static int xillyusb_discovery(struct usb_interface *interface) +{ + int rc; + struct xillyusb_dev *xdev = usb_get_intfdata(interface); + __le16 bogus_chandesc[2]; + struct xillyfifo idt_fifo; + struct xillyusb_channel *chan; + unsigned int idt_len, names_offset; + unsigned char *idt; + + rc = xillyusb_send_opcode(xdev, ~0, OPCODE_QUIESCE, 0); + + if (rc) { + dev_err(&interface->dev, "Failed to send quiesce request. Aborting.\n"); + return rc; + } + + /* Phase I: Set up one fake upstream channel and obtain IDT */ + + /* Set up a fake IDT with one async IN stream */ + xdev->num_channels = 1; + bogus_chandesc[0] = cpu_to_le16(0x80); + bogus_chandesc[1] = cpu_to_le16(0); + + rc = setup_channels(xdev, bogus_chandesc); + + if (rc) + return rc; + + rc = fifo_init(&idt_fifo, LOG2_IDT_FIFO_SIZE); + + if (rc) + return rc; + + chan = xdev->channels; + + chan->in_fifo = &idt_fifo; + chan->read_data_ok = 1; + + rc = xillyusb_send_opcode(xdev, ~0, OPCODE_REQ_IDT, 0); + + if (rc) { + dev_err(&interface->dev, "Failed to send IDT request. Aborting.\n"); + goto unfifo; + } + + rc = wait_event_interruptible_timeout(idt_fifo.waitq, + !chan->read_data_ok, + XILLY_RESPONSE_TIMEOUT); + + if (xdev->error) { + rc = xdev->error; + goto unfifo; + } + + if (rc < 0) { + rc = -EINTR; /* Interrupt on probe method? Interesting. */ + goto unfifo; + } + + if (chan->read_data_ok) { + rc = -ETIMEDOUT; + dev_err(&interface->dev, "No response from FPGA. Aborting.\n"); + goto unfifo; + } + + idt_len = atomic_read(&idt_fifo.fill); + idt = kmalloc(idt_len, GFP_KERNEL); + + if (!idt) { + rc = -ENOMEM; + goto unfifo; + } + + fifo_read(&idt_fifo, idt, idt_len, xilly_memcpy); + + if (crc32_le(~0, idt, idt_len) != 0) { + dev_err(&interface->dev, "IDT failed CRC check. Aborting.\n"); + rc = -ENODEV; + goto unidt; + } + + if (*idt > 0x90) { + dev_err(&interface->dev, "No support for IDT version 0x%02x. Maybe the xillyusb driver needs an upgarde. Aborting.\n", + (int)*idt); + rc = -ENODEV; + goto unidt; + } + + /* Phase II: Set up the streams as defined in IDT */ + + xdev->num_channels = le16_to_cpu(*((__le16 *)(idt + 1))); + names_offset = 3 + xdev->num_channels * 4; + idt_len -= 4; /* Exclude CRC */ + + if (idt_len < names_offset) { + dev_err(&interface->dev, "IDT too short. This is exceptionally weird, because its CRC is OK\n"); + rc = -ENODEV; + goto unidt; + } + + rc = setup_channels(xdev, (void *)idt + 3); + + if (rc) + goto unidt; + + /* + * Except for wildly misbehaving hardware, or if it was disconnected + * just after responding with the IDT, there is no reason for any + * work item to be running now. To be sure that xdev->channel + * is updated on anything that might run in parallel, flush the + * workqueue, which rarely does anything. + */ + flush_workqueue(xdev->workq); + + fifo_mem_release(&idt_fifo); + kfree(chan); + + rc = xillybus_init_chrdev(&interface->dev, &xillyusb_fops, + THIS_MODULE, xdev, + idt + names_offset, + idt_len - names_offset, + xdev->num_channels, + xillyname, true); + + kfree(idt); + + return rc; + +unidt: + kfree(idt); + +unfifo: + safely_assign_in_fifo(chan, NULL); + fifo_mem_release(&idt_fifo); + + return rc; +} + +static int xillyusb_probe(struct usb_interface *interface, + const struct usb_device_id *id) +{ + struct xillyusb_dev *xdev; + int rc; + + xdev = kzalloc(sizeof(*xdev), GFP_KERNEL); + if (!xdev) + return -ENOMEM; + + kref_init(&xdev->kref); + mutex_init(&xdev->io_mutex); + mutex_init(&xdev->process_in_mutex); + mutex_init(&xdev->msg_mutex); + + xdev->udev = usb_get_dev(interface_to_usbdev(interface)); + xdev->interface = interface; + xdev->error = 0; + spin_lock_init(&xdev->error_lock); + xdev->in_counter = 0; + xdev->in_bytes_left = 0; + xdev->workq = alloc_workqueue(xillyname, WQ_HIGHPRI, 0); + + if (!xdev->workq) { + dev_err(&interface->dev, "Failed to allocate work queue\n"); + rc = -ENOMEM; + goto fail; + } + + INIT_WORK(&xdev->wakeup_workitem, wakeup_all); + + usb_set_intfdata(interface, xdev); + + rc = xillyusb_setup_base_eps(xdev); + if (rc) + goto fail; + + rc = xillyusb_discovery(interface); + if (rc) + goto fail; + + return 0; + +fail: + usb_set_intfdata(interface, NULL); + kref_put(&xdev->kref, cleanup_dev); + return rc; +} + +static void xillyusb_disconnect(struct usb_interface *interface) +{ + struct xillyusb_dev *xdev; + + xdev = usb_get_intfdata(interface); + + xillybus_cleanup_chrdev(xdev, &interface->dev); + + /* + * Try to send OPCODE_QUIESCE, which will fail silently if the device + * was disconnected, but makes sense on module unload. + */ + + xillyusb_send_opcode(xdev, ~0, OPCODE_QUIESCE, 0); + + usb_set_intfdata(interface, NULL); + + report_io_error(xdev, -ENODEV); + + mutex_lock(&xdev->io_mutex); + xdev->interface = NULL; + mutex_unlock(&xdev->io_mutex); + + kref_put(&xdev->kref, cleanup_dev); +} + +static struct usb_driver xillyusb_driver = { + .name = xillyname, + .id_table = xillyusb_table, + .probe = xillyusb_probe, + .disconnect = xillyusb_disconnect, +}; + +static int __init xillyusb_init(void) +{ + int rc = 0; + + if (LOG2_INITIAL_FIFO_BUF_SIZE > PAGE_SHIFT) + fifo_buf_order = LOG2_INITIAL_FIFO_BUF_SIZE - PAGE_SHIFT; + else + fifo_buf_order = 0; + + rc = usb_register(&xillyusb_driver); + + return rc; +} + +static void __exit xillyusb_exit(void) +{ + usb_deregister(&xillyusb_driver); +} + +module_init(xillyusb_init); +module_exit(xillyusb_exit); -- 2.17.1 From selvakumar16197 at gmail.com Tue Mar 9 12:49:26 2021 From: selvakumar16197 at gmail.com (Selvakumar Elangovan) Date: Tue, 9 Mar 2021 18:19:26 +0530 Subject: [PATCH] staging: rtl8712: fixed whitespace coding style issue Message-ID: <20210309124926.14896-1-selvakumar16197@gmail.com> Removed additional whitspaces and added space around the binary operator in the rtl8712_xmit.h file Signed-off-by: Selvakumar Elangovan --- drivers/staging/rtl8712/rtl8712_xmit.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/rtl8712/rtl8712_xmit.h b/drivers/staging/rtl8712/rtl8712_xmit.h index 0b56bd3ac4d0..5cd651a0de75 100644 --- a/drivers/staging/rtl8712/rtl8712_xmit.h +++ b/drivers/staging/rtl8712/rtl8712_xmit.h @@ -36,10 +36,8 @@ #define MAX_AMSDU_XMITBUF_SZ 8704 #define MAX_TXAGG_XMITBUF_SZ 16384 /*16k*/ - #define tx_cmd tx_desc - /* *defined for TX DESC Operation */ @@ -89,10 +87,9 @@ struct tx_desc { __le32 txdw7; }; - union txdesc { struct tx_desc txdesc; - unsigned int value[TXDESC_SIZE>>2]; + unsigned int value[TXDESC_SIZE >> 2]; }; int r8712_xmitframe_complete(struct _adapter *padapter, -- 2.17.1 From selvakumar16197 at gmail.com Tue Mar 9 12:54:45 2021 From: selvakumar16197 at gmail.com (Selvakumar Elangovan) Date: Tue, 9 Mar 2021 18:24:45 +0530 Subject: [PATCH] staging: rtl8712: fixed whitespace coding style issue Message-ID: <20210309125445.15167-1-selvakumar16197@gmail.com> Removed additional whitspaces and added space around the binary operator in the rtl8712_xmit.h file Signed-off-by: Selvakumar Elangovan --- drivers/staging/rtl8712/rtl8712_xmit.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/rtl8712/rtl8712_xmit.h b/drivers/staging/rtl8712/rtl8712_xmit.h index 0b56bd3ac4d0..5cd651a0de75 100644 --- a/drivers/staging/rtl8712/rtl8712_xmit.h +++ b/drivers/staging/rtl8712/rtl8712_xmit.h @@ -36,10 +36,8 @@ #define MAX_AMSDU_XMITBUF_SZ 8704 #define MAX_TXAGG_XMITBUF_SZ 16384 /*16k*/ - #define tx_cmd tx_desc - /* *defined for TX DESC Operation */ @@ -89,10 +87,9 @@ struct tx_desc { __le32 txdw7; }; - union txdesc { struct tx_desc txdesc; - unsigned int value[TXDESC_SIZE>>2]; + unsigned int value[TXDESC_SIZE >> 2]; }; int r8712_xmitframe_complete(struct _adapter *padapter, -- 2.17.1 From gregkh at linuxfoundation.org Tue Mar 9 13:05:10 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 9 Mar 2021 14:05:10 +0100 Subject: [PATCH 06/10] staging: greybus: spilib: use 'spi_delay_to_ns' for getting xfer delay In-Reply-To: <20210308145502.1075689-7-aardelean@deviqon.com> References: <20210308145502.1075689-1-aardelean@deviqon.com> <20210308145502.1075689-7-aardelean@deviqon.com> Message-ID: On Mon, Mar 08, 2021 at 04:54:58PM +0200, Alexandru Ardelean wrote: > The intent is the removal of the 'delay_usecs' field from the > spi_transfer struct, as there is a 'delay' field that does the same > thing. > > The spi_delay_to_ns() can be used to get the transfer delay. It works by > using the 'delay_usecs' field first (if it is non-zero), and finally > uses the 'delay' field. > > Since the 'delay_usecs' field is going away, this change makes use of the > spi_delay_to_ns() function. This also means dividing the return value of > the function by 1000, to convert it to microseconds. > To prevent any potential faults when converting to microseconds and since > the result of spi_delay_to_ns() is int, the delay is being computed in 32 > bits and then clamped between 0 & U16_MAX. > > Signed-off-by: Alexandru Ardelean > --- > drivers/staging/greybus/spilib.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/greybus/spilib.c b/drivers/staging/greybus/spilib.c > index 672d540d3365..30655153df6a 100644 > --- a/drivers/staging/greybus/spilib.c > +++ b/drivers/staging/greybus/spilib.c > @@ -245,6 +245,7 @@ static struct gb_operation *gb_spi_operation_create(struct gb_spilib *spi, > /* Fill in the transfers array */ > xfer = spi->first_xfer; > while (msg->state != GB_SPI_STATE_OP_DONE) { > + int xfer_delay; > if (xfer == spi->last_xfer) > xfer_len = spi->last_xfer_size; > else > @@ -259,7 +260,9 @@ static struct gb_operation *gb_spi_operation_create(struct gb_spilib *spi, > > gb_xfer->speed_hz = cpu_to_le32(xfer->speed_hz); > gb_xfer->len = cpu_to_le32(xfer_len); > - gb_xfer->delay_usecs = cpu_to_le16(xfer->delay_usecs); > + xfer_delay = spi_delay_to_ns(&xfer->delay, xfer) / 1000; > + xfer_delay = clamp_t(u16, xfer_delay, 0, U16_MAX); > + gb_xfer->delay_usecs = cpu_to_le16(xfer_delay); > gb_xfer->cs_change = xfer->cs_change; > gb_xfer->bits_per_word = xfer->bits_per_word; > Acked-by: Greg Kroah-Hartman From gregkh at linuxfoundation.org Tue Mar 9 13:07:43 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 9 Mar 2021 14:07:43 +0100 Subject: [PATCH] staging: wfx: remove unused included header files In-Reply-To: <5120192.kWiexivLR2@pc-42> References: <20210211143637.GA177425@LEGION> <1722736.fQpYkz0vEs@pc-42> <5120192.kWiexivLR2@pc-42> Message-ID: On Thu, Mar 04, 2021 at 10:43:45AM +0100, J?r?me Pouiller wrote: > Hello Greg, > > On Tuesday 2 March 2021 16:01:25 CET J?r?me Pouiller wrote: > > Hello Muhammad, > > > > Sorry, I am a bit late for the review of this patch. Thank you for your > > contribution. > > > > On Thursday 11 February 2021 15:36:37 CET Muhammad Usama Anjum wrote: > > > > > > Many header files have been included, but never used. Those header > > > files have been removed. > > > > > > Signed-off-by: Muhammad Usama Anjum > > > --- > > > drivers/staging/wfx/bh.c | 1 - > > > drivers/staging/wfx/bh.h | 4 ---- > > > drivers/staging/wfx/bus.h | 3 --- > > > drivers/staging/wfx/bus_sdio.c | 6 ------ > > > drivers/staging/wfx/bus_spi.c | 7 ------- > > > drivers/staging/wfx/data_rx.c | 5 ----- > > > drivers/staging/wfx/data_tx.c | 5 ----- > > > drivers/staging/wfx/data_tx.h | 3 --- > > > drivers/staging/wfx/debug.c | 6 ------ > > > drivers/staging/wfx/fwio.c | 2 -- > > > drivers/staging/wfx/hif_api_cmd.h | 4 ---- > > > drivers/staging/wfx/hif_api_general.h | 9 --------- > > > drivers/staging/wfx/hif_tx.c | 4 ---- > > > drivers/staging/wfx/hif_tx_mib.c | 5 ----- > > > drivers/staging/wfx/hwio.c | 3 --- > > > drivers/staging/wfx/hwio.h | 2 -- > > > drivers/staging/wfx/key.c | 2 -- > > > drivers/staging/wfx/key.h | 2 -- > > > drivers/staging/wfx/main.c | 7 ------- > > > drivers/staging/wfx/main.h | 3 --- > > > drivers/staging/wfx/queue.c | 4 ---- > > > drivers/staging/wfx/queue.h | 3 --- > > > drivers/staging/wfx/scan.h | 2 -- > > > drivers/staging/wfx/sta.c | 6 ------ > > > drivers/staging/wfx/sta.h | 2 -- > > > drivers/staging/wfx/traces.h | 3 --- > > > drivers/staging/wfx/wfx.h | 3 --- > > > 27 files changed, 106 deletions(-) > > > > > > diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c > > > index ed53d0b45592..cd6bcfdfbe9a 100644 > > > --- a/drivers/staging/wfx/bh.c > > > +++ b/drivers/staging/wfx/bh.c > > > @@ -5,7 +5,6 @@ > > > * Copyright (c) 2017-2020, Silicon Laboratories, Inc. > > > * Copyright (c) 2010, ST-Ericsson > > > */ > > > -#include > > > #include > > > > Though bh.c refers to gpiod_set_value_cansleep() > > > > > > > #include "bh.h" > > > diff --git a/drivers/staging/wfx/bh.h b/drivers/staging/wfx/bh.h > > > index 78c49329e22a..92ef3298d4ac 100644 > > > --- a/drivers/staging/wfx/bh.h > > > +++ b/drivers/staging/wfx/bh.h > > > @@ -8,10 +8,6 @@ > > > #ifndef WFX_BH_H > > > #define WFX_BH_H > > > > > > -#include > > > -#include > > > -#include > > > - > > > struct wfx_dev; > > > > > > struct wfx_hif { > > > > Ditto, bh.h refers to atomic_t, struct work_struct and struct > > completion. If you try to compile bh.h alone (with something like > > gcc -xc .../bh.h) it won't work. > > > > Maybe it works now because we are lucky in the order the headers are > > included, but I think it is not sufficient. > > > > [... same problem repeats multiple times in the following ...] > > > > Greg, if nobody has any opinion on that, I think that this patch should > be reverted. Nothing is breaking, why should it be reverted? You never build a .h file alone :) Anyway, sure, I'll revert it, what is the commit id? thanks, greg k-h From gregkh at linuxfoundation.org Tue Mar 9 13:25:35 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 9 Mar 2021 14:25:35 +0100 Subject: [PATCH] staging: rtl8712: fixed whitespace coding style issue In-Reply-To: <20210309125445.15167-1-selvakumar16197@gmail.com> References: <20210309125445.15167-1-selvakumar16197@gmail.com> Message-ID: On Tue, Mar 09, 2021 at 06:24:45PM +0530, Selvakumar Elangovan wrote: > Removed additional whitspaces and added space around the binary operator in the rtl8712_xmit.h file Please wrap your changelog at 72 columns. And you are doing 2 different things in this patch, please only do one "logical" thing. And finally, you sent 2 copies of this patch, I don't know which to apply, so I'll drop both and wait for a v2. thanks, greg k-h From gregkh at linuxfoundation.org Tue Mar 9 13:26:55 2021 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Tue, 9 Mar 2021 14:26:55 +0100 Subject: [PATCH] staging: gasket: Fix sizeof() in gasket_handle_ioctl() In-Reply-To: References: Message-ID: On Fri, Jan 22, 2021 at 06:01:13PM +0300, Dan Carpenter wrote: > The "gasket_dev->num_page_tables" variable is an int but this is copying > sizeof(u64). On 32 bit systems this would end up disclosing a kernel > pointer to user space, but on 64 bit it copies zeroes from a struct > hole. > > Fixes: 9a69f5087ccc ("drivers/staging: Gasket driver framework + Apex driver") > Signed-off-by: Dan Carpenter > --- > This is an API change. Please review this carefully! Another potential > fix would be to make ->num_page_tables a long instead of an int. > > drivers/staging/gasket/gasket_ioctl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Looks like this driver is dead, with no response from anyone from Google. Should I just delete it? The goal of using normal apis and getting this out of staging seems to have totally died, so it shouldn't even still be living in the kernel tree. Even if having it here actually finds security issues that the authors missed like this :( So, any objection to me deleting it? thanks, greg k-h From jerome.pouiller at silabs.com Tue Mar 9 13:45:56 2021 From: jerome.pouiller at silabs.com (=?ISO-8859-1?Q?J=E9r=F4me?= Pouiller) Date: Tue, 09 Mar 2021 14:45:56 +0100 Subject: [PATCH] staging: wfx: remove unused included header files In-Reply-To: References: <20210211143637.GA177425@LEGION> <5120192.kWiexivLR2@pc-42> Message-ID: <2505525.pDR9D5mlbe@pc-42> On Tuesday 9 March 2021 14:07:43 CET Greg KH wrote: > On Thu, Mar 04, 2021 at 10:43:45AM +0100, J?r?me Pouiller wrote: > > Hello Greg, > > > > On Tuesday 2 March 2021 16:01:25 CET J?r?me Pouiller wrote: > > > Hello Muhammad, > > > > > > Sorry, I am a bit late for the review of this patch. Thank you for your > > > contribution. > > > > > > On Thursday 11 February 2021 15:36:37 CET Muhammad Usama Anjum wrote: > > > > > > > > Many header files have been included, but never used. Those header > > > > files have been removed. > > > > > > > > Signed-off-by: Muhammad Usama Anjum > > > > --- > > > > drivers/staging/wfx/bh.c | 1 - > > > > drivers/staging/wfx/bh.h | 4 ---- > > > > drivers/staging/wfx/bus.h | 3 --- > > > > drivers/staging/wfx/bus_sdio.c | 6 ------ > > > > drivers/staging/wfx/bus_spi.c | 7 ------- > > > > drivers/staging/wfx/data_rx.c | 5 ----- > > > > drivers/staging/wfx/data_tx.c | 5 ----- > > > > drivers/staging/wfx/data_tx.h | 3 --- > > > > drivers/staging/wfx/debug.c | 6 ------ > > > > drivers/staging/wfx/fwio.c | 2 -- > > > > drivers/staging/wfx/hif_api_cmd.h | 4 ---- > > > > drivers/staging/wfx/hif_api_general.h | 9 --------- > > > > drivers/staging/wfx/hif_tx.c | 4 ---- > > > > drivers/staging/wfx/hif_tx_mib.c | 5 ----- > > > > drivers/staging/wfx/hwio.c | 3 --- > > > > drivers/staging/wfx/hwio.h | 2 -- > > > > drivers/staging/wfx/key.c | 2 -- > > > > drivers/staging/wfx/key.h | 2 -- > > > > drivers/staging/wfx/main.c | 7 ------- > > > > drivers/staging/wfx/main.h | 3 --- > > > > drivers/staging/wfx/queue.c | 4 ---- > > > > drivers/staging/wfx/queue.h | 3 --- > > > > drivers/staging/wfx/scan.h | 2 -- > > > > drivers/staging/wfx/sta.c | 6 ------ > > > > drivers/staging/wfx/sta.h | 2 -- > > > > drivers/staging/wfx/traces.h | 3 --- > > > > drivers/staging/wfx/wfx.h | 3 --- > > > > 27 files changed, 106 deletions(-) > > > > > > > > diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c > > > > index ed53d0b45592..cd6bcfdfbe9a 100644 > > > > --- a/drivers/staging/wfx/bh.c > > > > +++ b/drivers/staging/wfx/bh.c > > > > @@ -5,7 +5,6 @@ > > > > * Copyright (c) 2017-2020, Silicon Laboratories, Inc. > > > > * Copyright (c) 2010, ST-Ericsson > > > > */ > > > > -#include > > > > #include > > > > > > Though bh.c refers to gpiod_set_value_cansleep() > > > > > > > > > > #include "bh.h" > > > > diff --git a/drivers/staging/wfx/bh.h b/drivers/staging/wfx/bh.h > > > > index 78c49329e22a..92ef3298d4ac 100644 > > > > --- a/drivers/staging/wfx/bh.h > > > > +++ b/drivers/staging/wfx/bh.h > > > > @@ -8,10 +8,6 @@ > > > > #ifndef WFX_BH_H > > > > #define WFX_BH_H > > > > > > > > -#include > > > > -#include > > > > -#include > > > > - > > > > struct wfx_dev; > > > > > > > > struct wfx_hif { > > > > > > Ditto, bh.h refers to atomic_t, struct work_struct and struct > > > completion. If you try to compile bh.h alone (with something like > > > gcc -xc .../bh.h) it won't work. > > > > > > Maybe it works now because we are lucky in the order the headers are > > > included, but I think it is not sufficient. > > > > > > [... same problem repeats multiple times in the following ...] > > > > > > > Greg, if nobody has any opinion on that, I think that this patch should > > be reverted. > > Nothing is breaking, why should it be reverted? Because it is less maintainable? > You never build a .h file alone :) hmmm... notwithstanding, I thing that the code should not depend on the order the headers are included. You don't? > Anyway, sure, I'll revert it, what is the commit id? commit 314fd52f01ea "staging: wfx: remove unused included header files" Thank you! -- J?r?me Pouiller From selvakumar16197 at gmail.com Tue Mar 9 14:17:21 2021 From: selvakumar16197 at gmail.com (Selvakumar Elangovan) Date: Tue, 9 Mar 2021 19:47:21 +0530 Subject: [PATCH v2] rtl8712: fixed whitespace coding style issue Message-ID: <20210309141721.16772-1-selvakumar16197@gmail.com> Removed additional whitespaces in the rtl8712_xmit.h file. Signed-off-by: Selvakumar Elangovan --- drivers/staging/rtl8712/rtl8712_xmit.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/rtl8712/rtl8712_xmit.h b/drivers/staging/rtl8712/rtl8712_xmit.h index 0b56bd3ac4d0..e4c0a4bf8388 100644 --- a/drivers/staging/rtl8712/rtl8712_xmit.h +++ b/drivers/staging/rtl8712/rtl8712_xmit.h @@ -36,10 +36,8 @@ #define MAX_AMSDU_XMITBUF_SZ 8704 #define MAX_TXAGG_XMITBUF_SZ 16384 /*16k*/ - #define tx_cmd tx_desc - /* *defined for TX DESC Operation */ @@ -89,7 +87,6 @@ struct tx_desc { __le32 txdw7; }; - union txdesc { struct tx_desc txdesc; unsigned int value[TXDESC_SIZE>>2]; -- 2.17.1 From selvakumar16197 at gmail.com Tue Mar 9 14:25:47 2021 From: selvakumar16197 at gmail.com (Selvakumar Elangovan) Date: Tue, 9 Mar 2021 19:55:47 +0530 Subject: [PATCH] staging: rtl8712: fixed no space coding style issue Message-ID: <20210309142547.16974-1-selvakumar16197@gmail.com> Added space around the binary operator for readability in rtl8712_xmit.h file Signed-off-by: Selvakumar Elangovan --- drivers/staging/rtl8712/rtl8712_xmit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8712/rtl8712_xmit.h b/drivers/staging/rtl8712/rtl8712_xmit.h index e4c0a4bf8388..5cd651a0de75 100644 --- a/drivers/staging/rtl8712/rtl8712_xmit.h +++ b/drivers/staging/rtl8712/rtl8712_xmit.h @@ -89,7 +89,7 @@ struct tx_desc { union txdesc { struct tx_desc txdesc; - unsigned int value[TXDESC_SIZE>>2]; + unsigned int value[TXDESC_SIZE >> 2]; }; int r8712_xmitframe_complete(struct _adapter *padapter, -- 2.17.1 From gregkh at linuxfoundation.org Tue Mar 9 14:43:19 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 9 Mar 2021 15:43:19 +0100 Subject: [PATCH v2] rtl8712: fixed whitespace coding style issue In-Reply-To: <20210309141721.16772-1-selvakumar16197@gmail.com> References: <20210309141721.16772-1-selvakumar16197@gmail.com> Message-ID: On Tue, Mar 09, 2021 at 07:47:21PM +0530, Selvakumar Elangovan wrote: > Removed additional whitespaces in the rtl8712_xmit.h file. > > Signed-off-by: Selvakumar Elangovan > --- > drivers/staging/rtl8712/rtl8712_xmit.h | 3 --- > 1 file changed, 3 deletions(-) What changed from v1? Always put that below the --- line. v3? thanks, greg k-h From gregkh at linuxfoundation.org Tue Mar 9 14:54:48 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 9 Mar 2021 15:54:48 +0100 Subject: [PATCH] staging: wfx: remove unused included header files In-Reply-To: <2505525.pDR9D5mlbe@pc-42> References: <20210211143637.GA177425@LEGION> <5120192.kWiexivLR2@pc-42> <2505525.pDR9D5mlbe@pc-42> Message-ID: On Tue, Mar 09, 2021 at 02:45:56PM +0100, J?r?me Pouiller wrote: > On Tuesday 9 March 2021 14:07:43 CET Greg KH wrote: > > On Thu, Mar 04, 2021 at 10:43:45AM +0100, J?r?me Pouiller wrote: > > > Hello Greg, > > > > > > On Tuesday 2 March 2021 16:01:25 CET J?r?me Pouiller wrote: > > > > Hello Muhammad, > > > > > > > > Sorry, I am a bit late for the review of this patch. Thank you for > your > > > > contribution. > > > > > > > > On Thursday 11 February 2021 15:36:37 CET Muhammad Usama Anjum > wrote: > > > > > > > > > > Many header files have been included, but never used. Those > header > > > > > files have been removed. > > > > > > > > > > Signed-off-by: Muhammad Usama Anjum > > > > > --- > > > > > drivers/staging/wfx/bh.c | 1 - > > > > > drivers/staging/wfx/bh.h | 4 ---- > > > > > drivers/staging/wfx/bus.h | 3 --- > > > > > drivers/staging/wfx/bus_sdio.c | 6 ------ > > > > > drivers/staging/wfx/bus_spi.c | 7 ------- > > > > > drivers/staging/wfx/data_rx.c | 5 ----- > > > > > drivers/staging/wfx/data_tx.c | 5 ----- > > > > > drivers/staging/wfx/data_tx.h | 3 --- > > > > > drivers/staging/wfx/debug.c | 6 ------ > > > > > drivers/staging/wfx/fwio.c | 2 -- > > > > > drivers/staging/wfx/hif_api_cmd.h | 4 ---- > > > > > drivers/staging/wfx/hif_api_general.h | 9 --------- > > > > > drivers/staging/wfx/hif_tx.c | 4 ---- > > > > > drivers/staging/wfx/hif_tx_mib.c | 5 ----- > > > > > drivers/staging/wfx/hwio.c | 3 --- > > > > > drivers/staging/wfx/hwio.h | 2 -- > > > > > drivers/staging/wfx/key.c | 2 -- > > > > > drivers/staging/wfx/key.h | 2 -- > > > > > drivers/staging/wfx/main.c | 7 ------- > > > > > drivers/staging/wfx/main.h | 3 --- > > > > > drivers/staging/wfx/queue.c | 4 ---- > > > > > drivers/staging/wfx/queue.h | 3 --- > > > > > drivers/staging/wfx/scan.h | 2 -- > > > > > drivers/staging/wfx/sta.c | 6 ------ > > > > > drivers/staging/wfx/sta.h | 2 -- > > > > > drivers/staging/wfx/traces.h | 3 --- > > > > > drivers/staging/wfx/wfx.h | 3 --- > > > > > 27 files changed, 106 deletions(-) > > > > > > > > > > diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c > > > > > index ed53d0b45592..cd6bcfdfbe9a 100644 > > > > > --- a/drivers/staging/wfx/bh.c > > > > > +++ b/drivers/staging/wfx/bh.c > > > > > @@ -5,7 +5,6 @@ > > > > > * Copyright (c) 2017-2020, Silicon Laboratories, Inc. > > > > > * Copyright (c) 2010, ST-Ericsson > > > > > */ > > > > > -#include > > > > > #include > > > > > > > > Though bh.c refers to gpiod_set_value_cansleep() > > > > > > > > > > > > > #include "bh.h" > > > > > diff --git a/drivers/staging/wfx/bh.h b/drivers/staging/wfx/bh.h > > > > > index 78c49329e22a..92ef3298d4ac 100644 > > > > > --- a/drivers/staging/wfx/bh.h > > > > > +++ b/drivers/staging/wfx/bh.h > > > > > @@ -8,10 +8,6 @@ > > > > > #ifndef WFX_BH_H > > > > > #define WFX_BH_H > > > > > > > > > > -#include > > > > > -#include > > > > > -#include > > > > > - > > > > > struct wfx_dev; > > > > > > > > > > struct wfx_hif { > > > > > > > > Ditto, bh.h refers to atomic_t, struct work_struct and struct > > > > completion. If you try to compile bh.h alone (with something like > > > > gcc -xc .../bh.h) it won't work. > > > > > > > > Maybe it works now because we are lucky in the order the headers > are > > > > included, but I think it is not sufficient. > > > > > > > > [... same problem repeats multiple times in the following ...] > > > > > > > > > > Greg, if nobody has any opinion on that, I think that this patch > should > > > be reverted. > > > > Nothing is breaking, why should it be reverted? > > Because it is less maintainable? > > > You never build a .h file alone :) > > hmmm... notwithstanding, I thing that the code should not depend on the > order the headers are included. You don't? > > > Anyway, sure, I'll revert it, what is the commit id? > > commit 314fd52f01ea "staging: wfx: remove unused included header files" Now reverted, thanks. greg k-h From selvakumar16197 at gmail.com Tue Mar 9 15:00:37 2021 From: selvakumar16197 at gmail.com (Selvakumar Elangovan) Date: Tue, 9 Mar 2021 20:30:37 +0530 Subject: [PATCH v3] staging: rtl8712: fixed whitespace coding style issue Message-ID: <20210309150037.17883-1-selvakumar16197@gmail.com> Removed additional whitespaces in the rtl8712_xmit.h file. Signed-off-by: Selvakumar Elangovan --- Changes in v3: - Done one logical changes instead of two different changes in the same patch. drivers/staging/rtl8712/rtl8712_xmit.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/rtl8712/rtl8712_xmit.h b/drivers/staging/rtl8712/rtl8712_xmit.h index 0b56bd3ac4d0..e4c0a4bf8388 100644 --- a/drivers/staging/rtl8712/rtl8712_xmit.h +++ b/drivers/staging/rtl8712/rtl8712_xmit.h @@ -36,10 +36,8 @@ #define MAX_AMSDU_XMITBUF_SZ 8704 #define MAX_TXAGG_XMITBUF_SZ 16384 /*16k*/ - #define tx_cmd tx_desc - /* *defined for TX DESC Operation */ @@ -89,7 +87,6 @@ struct tx_desc { __le32 txdw7; }; - union txdesc { struct tx_desc txdesc; unsigned int value[TXDESC_SIZE>>2]; -- 2.17.1 From tsbogend at alpha.franken.de Tue Mar 9 15:07:29 2021 From: tsbogend at alpha.franken.de (Thomas Bogendoerfer) Date: Tue, 9 Mar 2021 16:07:29 +0100 Subject: [PATCH v11 5/6] staging: mt7621-dts: use valid vendor 'mediatek' instead of invalid 'mtk' In-Reply-To: <20210309052226.29531-6-sergio.paracuellos@gmail.com> References: <20210309052226.29531-1-sergio.paracuellos@gmail.com> <20210309052226.29531-6-sergio.paracuellos@gmail.com> Message-ID: <20210309150729.GA12267@alpha.franken.de> On Tue, Mar 09, 2021 at 06:22:25AM +0100, Sergio Paracuellos wrote: > Vendor listed for mediatek in kernel vendor file 'vendor-prefixes.yaml' > contains 'mediatek' as a valid vendor string. Some nodes in the device > tree are using an invalid vendor string vfor 'mtk' instead. Fix all of > them in dts file. Update also ralink mt7621 related code to properly > match new strings. Even there are used in the device tree there are > some strings that are not referred anywhere but have been also updated > with new vendor name. These are 'mtk,mt7621-wdt', 'mtk,mt7621-nand', > 'mtk,mt7621-mc', and 'mtk,mt7621-cpc'. > > Acked-by: Greg Kroah-Hartman > Signed-off-by: Sergio Paracuellos > --- > arch/mips/ralink/mt7621.c | 6 +++--- Acked-by: Thomas Bogendoerfer Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ] From dan.carpenter at oracle.com Tue Mar 9 16:03:26 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Tue, 9 Mar 2021 19:03:26 +0300 Subject: [kbuild] Re: [PATCH v3 1/2] char: xillybus: Move class-related functions to new xillybus_class.c In-Reply-To: <20210309113425.61296-2-eli.billauer@gmail.com> Message-ID: <20210309160326.GD21246@kadam> url: https://github.com/0day-ci/linux/commits/eli-billauer-gmail-com/Submission-of-XillyUSB-driver/20210309-193645 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 080951f99de1e483a9a48f34c079b634f2912a54 config: x86_64-randconfig-m001-20210309 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter smatch warnings: drivers/char/xillybus/xillybus_class.c:86 xillybus_init_chrdev() warn: ignoring unreachable code. drivers/char/xillybus/xillybus_class.c:96 xillybus_init_chrdev() warn: missing error code 'rc' vim +86 drivers/char/xillybus/xillybus_class.c 10702b71f93292 Eli Billauer 2021-03-09 42 int xillybus_init_chrdev(struct device *dev, 10702b71f93292 Eli Billauer 2021-03-09 43 const struct file_operations *fops, 10702b71f93292 Eli Billauer 2021-03-09 44 struct module *owner, 10702b71f93292 Eli Billauer 2021-03-09 45 void *private_data, 10702b71f93292 Eli Billauer 2021-03-09 46 unsigned char *idt, unsigned int len, 10702b71f93292 Eli Billauer 2021-03-09 47 int num_nodes, 10702b71f93292 Eli Billauer 2021-03-09 48 const char *prefix, bool enumerate) 10702b71f93292 Eli Billauer 2021-03-09 49 { 10702b71f93292 Eli Billauer 2021-03-09 50 int rc; 10702b71f93292 Eli Billauer 2021-03-09 51 dev_t mdev; 10702b71f93292 Eli Billauer 2021-03-09 52 int i; 10702b71f93292 Eli Billauer 2021-03-09 53 char devname[48]; 10702b71f93292 Eli Billauer 2021-03-09 54 10702b71f93292 Eli Billauer 2021-03-09 55 struct device *device; 10702b71f93292 Eli Billauer 2021-03-09 56 size_t namelen; 10702b71f93292 Eli Billauer 2021-03-09 57 struct xilly_unit *unit, *u; 10702b71f93292 Eli Billauer 2021-03-09 58 10702b71f93292 Eli Billauer 2021-03-09 59 unit = kzalloc(sizeof(*unit), GFP_KERNEL); 10702b71f93292 Eli Billauer 2021-03-09 60 10702b71f93292 Eli Billauer 2021-03-09 61 if (!unit) 10702b71f93292 Eli Billauer 2021-03-09 62 return -ENOMEM; 10702b71f93292 Eli Billauer 2021-03-09 63 10702b71f93292 Eli Billauer 2021-03-09 64 mutex_lock(&unit_mutex); 10702b71f93292 Eli Billauer 2021-03-09 65 10702b71f93292 Eli Billauer 2021-03-09 66 if (!enumerate) 10702b71f93292 Eli Billauer 2021-03-09 67 snprintf(unit->name, UNITNAMELEN, "%s", prefix); 10702b71f93292 Eli Billauer 2021-03-09 68 10702b71f93292 Eli Billauer 2021-03-09 69 for (i = 0; enumerate; i++) { 10702b71f93292 Eli Billauer 2021-03-09 70 snprintf(unit->name, UNITNAMELEN, "%s_%02d", 10702b71f93292 Eli Billauer 2021-03-09 71 prefix, i); 10702b71f93292 Eli Billauer 2021-03-09 72 10702b71f93292 Eli Billauer 2021-03-09 73 enumerate = false; 10702b71f93292 Eli Billauer 2021-03-09 74 list_for_each_entry(u, &unit_list, list_entry) 10702b71f93292 Eli Billauer 2021-03-09 75 if (!strcmp(unit->name, u->name)) { 10702b71f93292 Eli Billauer 2021-03-09 76 enumerate = true; 10702b71f93292 Eli Billauer 2021-03-09 77 break; 10702b71f93292 Eli Billauer 2021-03-09 78 } 10702b71f93292 Eli Billauer 2021-03-09 79 } 10702b71f93292 Eli Billauer 2021-03-09 80 10702b71f93292 Eli Billauer 2021-03-09 81 rc = alloc_chrdev_region(&mdev, 0, num_nodes, unit->name); 10702b71f93292 Eli Billauer 2021-03-09 82 10702b71f93292 Eli Billauer 2021-03-09 83 if (rc) { 10702b71f93292 Eli Billauer 2021-03-09 84 dev_warn(dev, "Failed to obtain major/minors"); 10702b71f93292 Eli Billauer 2021-03-09 85 goto fail_obtain; ^^^^^^^^^^^^^^^^^ 10702b71f93292 Eli Billauer 2021-03-09 @86 return rc; ^^^^^^^^^^ Unreachable 10702b71f93292 Eli Billauer 2021-03-09 87 } 10702b71f93292 Eli Billauer 2021-03-09 88 10702b71f93292 Eli Billauer 2021-03-09 89 unit->major = MAJOR(mdev); 10702b71f93292 Eli Billauer 2021-03-09 90 unit->lowest_minor = MINOR(mdev); 10702b71f93292 Eli Billauer 2021-03-09 91 unit->num_nodes = num_nodes; 10702b71f93292 Eli Billauer 2021-03-09 92 unit->private_data = private_data; 10702b71f93292 Eli Billauer 2021-03-09 93 10702b71f93292 Eli Billauer 2021-03-09 94 unit->cdev = cdev_alloc(); 10702b71f93292 Eli Billauer 2021-03-09 95 if (!unit->cdev) 10702b71f93292 Eli Billauer 2021-03-09 @96 goto unregister_chrdev; "rc = -ENOMEM;" 10702b71f93292 Eli Billauer 2021-03-09 97 10702b71f93292 Eli Billauer 2021-03-09 98 unit->cdev->ops = fops; 10702b71f93292 Eli Billauer 2021-03-09 99 unit->cdev->owner = owner; 10702b71f93292 Eli Billauer 2021-03-09 100 10702b71f93292 Eli Billauer 2021-03-09 101 rc = cdev_add(unit->cdev, MKDEV(unit->major, unit->lowest_minor), 10702b71f93292 Eli Billauer 2021-03-09 102 unit->num_nodes); 10702b71f93292 Eli Billauer 2021-03-09 103 if (rc) { 10702b71f93292 Eli Billauer 2021-03-09 104 dev_err(dev, "Failed to add cdev.\n"); 10702b71f93292 Eli Billauer 2021-03-09 105 /* kobject_put() is normally done by cdev_del() */ 10702b71f93292 Eli Billauer 2021-03-09 106 kobject_put(&unit->cdev->kobj); 10702b71f93292 Eli Billauer 2021-03-09 107 goto unregister_chrdev; 10702b71f93292 Eli Billauer 2021-03-09 108 } 10702b71f93292 Eli Billauer 2021-03-09 109 10702b71f93292 Eli Billauer 2021-03-09 110 for (i = 0; i < num_nodes; i++) { 10702b71f93292 Eli Billauer 2021-03-09 111 namelen = strnlen(idt, len); 10702b71f93292 Eli Billauer 2021-03-09 112 10702b71f93292 Eli Billauer 2021-03-09 113 if (namelen == len) { 10702b71f93292 Eli Billauer 2021-03-09 114 dev_err(dev, "IDT's list of names is too short. This is exceptionally weird, because its CRC is OK\n"); 10702b71f93292 Eli Billauer 2021-03-09 115 rc = -ENODEV; 10702b71f93292 Eli Billauer 2021-03-09 116 goto unroll_device_create; 10702b71f93292 Eli Billauer 2021-03-09 117 } 10702b71f93292 Eli Billauer 2021-03-09 118 10702b71f93292 Eli Billauer 2021-03-09 119 snprintf(devname, sizeof(devname), "%s_%s", 10702b71f93292 Eli Billauer 2021-03-09 120 unit->name, idt); 10702b71f93292 Eli Billauer 2021-03-09 121 10702b71f93292 Eli Billauer 2021-03-09 122 len -= namelen + 1; 10702b71f93292 Eli Billauer 2021-03-09 123 idt += namelen + 1; 10702b71f93292 Eli Billauer 2021-03-09 124 10702b71f93292 Eli Billauer 2021-03-09 125 device = device_create(xillybus_class, 10702b71f93292 Eli Billauer 2021-03-09 126 NULL, 10702b71f93292 Eli Billauer 2021-03-09 127 MKDEV(unit->major, 10702b71f93292 Eli Billauer 2021-03-09 128 i + unit->lowest_minor), 10702b71f93292 Eli Billauer 2021-03-09 129 NULL, 10702b71f93292 Eli Billauer 2021-03-09 130 "%s", devname); 10702b71f93292 Eli Billauer 2021-03-09 131 10702b71f93292 Eli Billauer 2021-03-09 132 if (IS_ERR(device)) { 10702b71f93292 Eli Billauer 2021-03-09 133 dev_err(dev, "Failed to create %s device. Aborting.\n", 10702b71f93292 Eli Billauer 2021-03-09 134 devname); 10702b71f93292 Eli Billauer 2021-03-09 135 rc = -ENODEV; 10702b71f93292 Eli Billauer 2021-03-09 136 goto unroll_device_create; 10702b71f93292 Eli Billauer 2021-03-09 137 } 10702b71f93292 Eli Billauer 2021-03-09 138 } 10702b71f93292 Eli Billauer 2021-03-09 139 10702b71f93292 Eli Billauer 2021-03-09 140 if (len) { 10702b71f93292 Eli Billauer 2021-03-09 141 dev_err(dev, "IDT's list of names is too long. This is exceptionally weird, because its CRC is OK\n"); 10702b71f93292 Eli Billauer 2021-03-09 142 rc = -ENODEV; 10702b71f93292 Eli Billauer 2021-03-09 143 goto unroll_device_create; 10702b71f93292 Eli Billauer 2021-03-09 144 } 10702b71f93292 Eli Billauer 2021-03-09 145 10702b71f93292 Eli Billauer 2021-03-09 146 list_add_tail(&unit->list_entry, &unit_list); 10702b71f93292 Eli Billauer 2021-03-09 147 10702b71f93292 Eli Billauer 2021-03-09 148 dev_info(dev, "Created %d device files.\n", num_nodes); 10702b71f93292 Eli Billauer 2021-03-09 149 10702b71f93292 Eli Billauer 2021-03-09 150 mutex_unlock(&unit_mutex); 10702b71f93292 Eli Billauer 2021-03-09 151 10702b71f93292 Eli Billauer 2021-03-09 152 return 0; 10702b71f93292 Eli Billauer 2021-03-09 153 10702b71f93292 Eli Billauer 2021-03-09 154 unroll_device_create: 10702b71f93292 Eli Billauer 2021-03-09 155 for (i--; i >= 0; i--) 10702b71f93292 Eli Billauer 2021-03-09 156 device_destroy(xillybus_class, MKDEV(unit->major, 10702b71f93292 Eli Billauer 2021-03-09 157 i + unit->lowest_minor)); 10702b71f93292 Eli Billauer 2021-03-09 158 10702b71f93292 Eli Billauer 2021-03-09 159 cdev_del(unit->cdev); 10702b71f93292 Eli Billauer 2021-03-09 160 10702b71f93292 Eli Billauer 2021-03-09 161 unregister_chrdev: 10702b71f93292 Eli Billauer 2021-03-09 162 unregister_chrdev_region(MKDEV(unit->major, unit->lowest_minor), 10702b71f93292 Eli Billauer 2021-03-09 163 unit->num_nodes); 10702b71f93292 Eli Billauer 2021-03-09 164 10702b71f93292 Eli Billauer 2021-03-09 165 fail_obtain: 10702b71f93292 Eli Billauer 2021-03-09 166 mutex_unlock(&unit_mutex); 10702b71f93292 Eli Billauer 2021-03-09 167 10702b71f93292 Eli Billauer 2021-03-09 168 kfree(unit); 10702b71f93292 Eli Billauer 2021-03-09 169 10702b71f93292 Eli Billauer 2021-03-09 170 return rc; 10702b71f93292 Eli Billauer 2021-03-09 171 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/gzip Size: 41421 bytes Desc: not available URL: -------------- next part -------------- _______________________________________________ kbuild mailing list -- kbuild at lists.01.org To unsubscribe send an email to kbuild-leave at lists.01.org From wharms at bfs.de Tue Mar 9 16:57:59 2021 From: wharms at bfs.de (Walter Harms) Date: Tue, 9 Mar 2021 16:57:59 +0000 Subject: AW: [PATCH] staging: gasket: Fix sizeof() in gasket_handle_ioctl() In-Reply-To: References: , Message-ID: <8fda6445b7944426a45a944b777c52fe@bfs.de> why not mark it as "Deprecated" and remove it with the next version ? Maybe soneone will wakeup ? re, wh ________________________________________ Von: Greg Kroah-Hartman Gesendet: Dienstag, 9. M?rz 2021 14:26:55 An: Dan Carpenter Cc: Rob Springer; devel at driverdev.osuosl.org; kernel-janitors at vger.kernel.org; John Joseph; Simon Que; Richard Yeh; Todd Poynor Betreff: Re: [PATCH] staging: gasket: Fix sizeof() in gasket_handle_ioctl() On Fri, Jan 22, 2021 at 06:01:13PM +0300, Dan Carpenter wrote: > The "gasket_dev->num_page_tables" variable is an int but this is copying > sizeof(u64). On 32 bit systems this would end up disclosing a kernel > pointer to user space, but on 64 bit it copies zeroes from a struct > hole. > > Fixes: 9a69f5087ccc ("drivers/staging: Gasket driver framework + Apex driver") > Signed-off-by: Dan Carpenter > --- > This is an API change. Please review this carefully! Another potential > fix would be to make ->num_page_tables a long instead of an int. > > drivers/staging/gasket/gasket_ioctl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Looks like this driver is dead, with no response from anyone from Google. Should I just delete it? The goal of using normal apis and getting this out of staging seems to have totally died, so it shouldn't even still be living in the kernel tree. Even if having it here actually finds security issues that the authors missed like this :( So, any objection to me deleting it? thanks, greg k-h From gregkh at linuxfoundation.org Tue Mar 9 17:03:55 2021 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Tue, 9 Mar 2021 18:03:55 +0100 Subject: [PATCH] staging: gasket: Fix sizeof() in gasket_handle_ioctl() In-Reply-To: <8fda6445b7944426a45a944b777c52fe@bfs.de> References: <8fda6445b7944426a45a944b777c52fe@bfs.de> Message-ID: On Tue, Mar 09, 2021 at 04:57:59PM +0000, Walter Harms wrote: > why not mark it as "Deprecated" and remove it with the next version ? Maybe soneone will wakeup ? We don't really have a "Deprecated" marking, we just delete them :) thanks, greg k-h From lkp at intel.com Tue Mar 9 21:48:27 2021 From: lkp at intel.com (kernel test robot) Date: Wed, 10 Mar 2021 05:48:27 +0800 Subject: [staging:staging-next] BUILD SUCCESS e44ad3f1815837c681988aeeb899dcfab5e033ca Message-ID: <6047ed2b.7vCWRnPV1A9cGvGz%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-next branch HEAD: e44ad3f1815837c681988aeeb899dcfab5e033ca Merge v5.12-rc1 into staging-next elapsed time: 724m configs tested: 153 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig mips workpad_defconfig sh se7724_defconfig mips bigsur_defconfig mips ath25_defconfig m68k sun3_defconfig powerpc mpc866_ads_defconfig mips gcw0_defconfig arm lart_defconfig sh edosk7705_defconfig powerpc xes_mpc85xx_defconfig sh alldefconfig powerpc64 defconfig sh edosk7760_defconfig mips jmr3927_defconfig arm hisi_defconfig powerpc powernv_defconfig m68k apollo_defconfig arc vdk_hs38_smp_defconfig sparc sparc32_defconfig mips gpr_defconfig arm pxa3xx_defconfig m68k alldefconfig arm moxart_defconfig powerpc storcenter_defconfig arm ezx_defconfig mips lemote2f_defconfig powerpc tqm8541_defconfig powerpc pq2fads_defconfig arm stm32_defconfig mips decstation_r4k_defconfig powerpc amigaone_defconfig powerpc mvme5100_defconfig arc hsdk_defconfig arm multi_v5_defconfig sh ul2_defconfig ia64 allmodconfig mips db1xxx_defconfig ia64 tiger_defconfig mips qi_lb60_defconfig arm pxa255-idp_defconfig riscv nommu_k210_sdcard_defconfig xtensa iss_defconfig powerpc kmeter1_defconfig sh rts7751r2dplus_defconfig arm mxs_defconfig arm cerfcube_defconfig sh se7343_defconfig sh sh7785lcr_defconfig arm qcom_defconfig x86_64 allyesconfig arm realview_defconfig arm colibri_pxa270_defconfig arc nsimosci_hs_defconfig arm nhk8815_defconfig arc axs101_defconfig powerpc ge_imp3a_defconfig arm eseries_pxa_defconfig mips jazz_defconfig ia64 generic_defconfig mips tb0226_defconfig powerpc pcm030_defconfig um x86_64_defconfig mips rbtx49xx_defconfig arm integrator_defconfig mips cu1830-neo_defconfig sh se7722_defconfig nios2 3c120_defconfig powerpc linkstation_defconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig i386 allyesconfig sparc allyesconfig sparc defconfig i386 tinyconfig i386 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a005-20210309 i386 randconfig-a003-20210309 i386 randconfig-a002-20210309 i386 randconfig-a006-20210309 i386 randconfig-a004-20210309 i386 randconfig-a001-20210309 x86_64 randconfig-a013-20210309 x86_64 randconfig-a016-20210309 x86_64 randconfig-a015-20210309 x86_64 randconfig-a014-20210309 x86_64 randconfig-a011-20210309 x86_64 randconfig-a012-20210309 i386 randconfig-a016-20210309 i386 randconfig-a012-20210309 i386 randconfig-a014-20210309 i386 randconfig-a013-20210309 i386 randconfig-a011-20210309 i386 randconfig-a015-20210309 x86_64 randconfig-a006-20210308 x86_64 randconfig-a001-20210308 x86_64 randconfig-a004-20210308 x86_64 randconfig-a002-20210308 x86_64 randconfig-a005-20210308 x86_64 randconfig-a003-20210308 riscv nommu_k210_defconfig riscv allyesconfig riscv nommu_virt_defconfig riscv allnoconfig riscv defconfig riscv rv32_defconfig riscv allmodconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a006-20210309 x86_64 randconfig-a001-20210309 x86_64 randconfig-a004-20210309 x86_64 randconfig-a002-20210309 x86_64 randconfig-a005-20210309 x86_64 randconfig-a003-20210309 x86_64 randconfig-a013-20210308 x86_64 randconfig-a016-20210308 x86_64 randconfig-a015-20210308 x86_64 randconfig-a014-20210308 x86_64 randconfig-a011-20210308 x86_64 randconfig-a012-20210308 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From lkp at intel.com Tue Mar 9 21:48:25 2021 From: lkp at intel.com (kernel test robot) Date: Wed, 10 Mar 2021 05:48:25 +0800 Subject: [driver-core:debugfs_remove_return_value] BUILD SUCCESS c40789b66abfa790aff5464bcb94f8fff1551fd3 Message-ID: <6047ed29.bJaXFxWixXzRpQ9l%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git debugfs_remove_return_value branch HEAD: c40789b66abfa790aff5464bcb94f8fff1551fd3 x86/tools/relocs: add __printf attribute to die() elapsed time: 724m configs tested: 174 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig mips workpad_defconfig sh se7724_defconfig mips bigsur_defconfig mips ath25_defconfig m68k sun3_defconfig powerpc mpc866_ads_defconfig mips gcw0_defconfig arm lart_defconfig sh edosk7705_defconfig m68k hp300_defconfig powerpc adder875_defconfig powerpc mpc8313_rdb_defconfig powerpc ppc40x_defconfig mips pistachio_defconfig powerpc mpc837x_rdb_defconfig powerpc xes_mpc85xx_defconfig sh alldefconfig powerpc64 defconfig sh edosk7760_defconfig mips jmr3927_defconfig arm hisi_defconfig arm pxa3xx_defconfig m68k alldefconfig arm moxart_defconfig powerpc storcenter_defconfig arm ezx_defconfig mips lemote2f_defconfig arm mxs_defconfig sh microdev_defconfig mips capcella_defconfig arm mvebu_v7_defconfig xtensa cadence_csp_defconfig powerpc tqm8541_defconfig powerpc pq2fads_defconfig arm stm32_defconfig mips decstation_r4k_defconfig mips rt305x_defconfig powerpc powernv_defconfig sh se7751_defconfig mips maltaup_defconfig arm pxa255-idp_defconfig arm multi_v4t_defconfig powerpc amigaone_defconfig powerpc mvme5100_defconfig arc hsdk_defconfig arm multi_v5_defconfig sh ul2_defconfig ia64 allmodconfig mips db1xxx_defconfig ia64 tiger_defconfig mips qi_lb60_defconfig riscv nommu_k210_sdcard_defconfig xtensa iss_defconfig powerpc kmeter1_defconfig sh rts7751r2dplus_defconfig i386 defconfig microblaze defconfig powerpc ppc44x_defconfig powerpc mpc836x_mds_defconfig sh lboxre2_defconfig sh rts7751r2d1_defconfig powerpc ge_imp3a_defconfig arm hackkit_defconfig mips loongson1b_defconfig h8300 alldefconfig arm cerfcube_defconfig sh se7343_defconfig sh sh7785lcr_defconfig arm qcom_defconfig x86_64 allyesconfig arm realview_defconfig arm colibri_pxa270_defconfig arc nsimosci_hs_defconfig arm nhk8815_defconfig arc axs101_defconfig arm eseries_pxa_defconfig mips jazz_defconfig ia64 generic_defconfig mips tb0226_defconfig arm xcep_defconfig arc tb10x_defconfig arm ep93xx_defconfig powerpc stx_gp3_defconfig arm pxa910_defconfig powerpc icon_defconfig mips cu1830-neo_defconfig sh se7722_defconfig nios2 3c120_defconfig powerpc linkstation_defconfig m68k amiga_defconfig alpha allyesconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig i386 allyesconfig sparc allyesconfig sparc defconfig i386 tinyconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a005-20210309 i386 randconfig-a003-20210309 i386 randconfig-a002-20210309 i386 randconfig-a006-20210309 i386 randconfig-a004-20210309 i386 randconfig-a001-20210309 x86_64 randconfig-a013-20210309 x86_64 randconfig-a016-20210309 x86_64 randconfig-a015-20210309 x86_64 randconfig-a014-20210309 x86_64 randconfig-a011-20210309 x86_64 randconfig-a012-20210309 i386 randconfig-a016-20210309 i386 randconfig-a012-20210309 i386 randconfig-a014-20210309 i386 randconfig-a013-20210309 i386 randconfig-a011-20210309 i386 randconfig-a015-20210309 x86_64 randconfig-a006-20210308 x86_64 randconfig-a001-20210308 x86_64 randconfig-a004-20210308 x86_64 randconfig-a002-20210308 x86_64 randconfig-a005-20210308 x86_64 randconfig-a003-20210308 riscv nommu_k210_defconfig riscv allyesconfig riscv nommu_virt_defconfig riscv allnoconfig riscv defconfig riscv rv32_defconfig riscv allmodconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a006-20210309 x86_64 randconfig-a001-20210309 x86_64 randconfig-a004-20210309 x86_64 randconfig-a002-20210309 x86_64 randconfig-a005-20210309 x86_64 randconfig-a003-20210309 x86_64 randconfig-a013-20210308 x86_64 randconfig-a016-20210308 x86_64 randconfig-a015-20210308 x86_64 randconfig-a014-20210308 x86_64 randconfig-a011-20210308 x86_64 randconfig-a012-20210308 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From ribalda at chromium.org Wed Mar 10 00:16:46 2021 From: ribalda at chromium.org (Ricardo Ribalda) Date: Wed, 10 Mar 2021 01:16:46 +0100 Subject: [PATCH] media: staging/intel-ipu3: Fix set_fmt error handling Message-ID: <20210310001646.1026557-1-ribalda@chromium.org> If there in an error during a set_fmt, do not overwrite the previous sizes with the invalid config. Without this patch, v4l2-compliance ends up allocating 4GiB of RAM and causing the following OOPs [ 38.662975] ipu3-imgu 0000:00:05.0: swiotlb buffer is full (sz: 4096 bytes) [ 38.662980] DMA: Out of SW-IOMMU space for 4096 bytes at device 0000:00:05.0 [ 38.663010] general protection fault: 0000 [#1] PREEMPT SMP Cc: stable at vger.kernel.org Fixes: 6d5f26f2e045 ("media: staging/intel-ipu3-v4l: reduce kernel stack usage") Signed-off-by: Ricardo Ribalda --- drivers/staging/media/ipu3/ipu3-v4l2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c index 60aa02eb7d2a..e8944e489c56 100644 --- a/drivers/staging/media/ipu3/ipu3-v4l2.c +++ b/drivers/staging/media/ipu3/ipu3-v4l2.c @@ -669,6 +669,7 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, struct imgu_css_pipe *css_pipe = &imgu->css.pipes[pipe]; struct imgu_media_pipe *imgu_pipe = &imgu->imgu_pipe[pipe]; struct imgu_v4l2_subdev *imgu_sd = &imgu_pipe->imgu_sd; + struct v4l2_pix_format_mplane fmt_backup; dev_dbg(dev, "set fmt node [%u][%u](try = %u)", pipe, node, try); @@ -734,6 +735,7 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, ret = -EINVAL; goto out; } + fmt_backup = *fmts[css_q]; *fmts[css_q] = f->fmt.pix_mp; if (try) @@ -741,6 +743,9 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, else ret = imgu_css_fmt_set(&imgu->css, fmts, rects, pipe); + if (try || ret < 0) + *fmts[css_q] = fmt_backup; + /* ret is the binary number in the firmware blob */ if (ret < 0) goto out; -- 2.30.1.766.gb4fecdf3b7-goog From lkp at intel.com Wed Mar 10 02:05:35 2021 From: lkp at intel.com (kernel test robot) Date: Wed, 10 Mar 2021 10:05:35 +0800 Subject: [staging:staging-testing] BUILD SUCCESS 94984f1c5bdd827d01d3f6a6c72f9fdd2d213fee Message-ID: <6048296f.KCcWnyyRE1Uw0coE%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-testing branch HEAD: 94984f1c5bdd827d01d3f6a6c72f9fdd2d213fee staging: unisys: visornic: Fix repeated words in comments elapsed time: 725m configs tested: 134 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig mips workpad_defconfig sh se7724_defconfig mips bigsur_defconfig mips ath25_defconfig m68k sun3_defconfig arm pxa3xx_defconfig m68k alldefconfig arm moxart_defconfig powerpc storcenter_defconfig arm ezx_defconfig mips lemote2f_defconfig powerpc tqm8541_defconfig powerpc pq2fads_defconfig arm stm32_defconfig mips decstation_r4k_defconfig m68k m5307c3_defconfig powerpc arches_defconfig sh se7343_defconfig arm alldefconfig arm socfpga_defconfig arm pcm027_defconfig powerpc pseries_defconfig arm s5pv210_defconfig mips maltaup_xpa_defconfig mips vocore2_defconfig arm hisi_defconfig riscv nommu_k210_sdcard_defconfig xtensa iss_defconfig powerpc kmeter1_defconfig sh rts7751r2dplus_defconfig mips jmr3927_defconfig arm netwinder_defconfig arm viper_defconfig sh rts7751r2d1_defconfig powerpc ge_imp3a_defconfig arm hackkit_defconfig mips loongson1b_defconfig h8300 alldefconfig arm xcep_defconfig arc tb10x_defconfig arm ep93xx_defconfig powerpc stx_gp3_defconfig arm pxa910_defconfig powerpc icon_defconfig sh se7722_defconfig m68k amiga_defconfig powerpc mvme5100_defconfig alpha allyesconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig i386 allyesconfig sparc allyesconfig sparc defconfig i386 tinyconfig i386 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a005-20210309 i386 randconfig-a003-20210309 i386 randconfig-a002-20210309 i386 randconfig-a006-20210309 i386 randconfig-a004-20210309 i386 randconfig-a001-20210309 x86_64 randconfig-a013-20210309 x86_64 randconfig-a016-20210309 x86_64 randconfig-a015-20210309 x86_64 randconfig-a014-20210309 x86_64 randconfig-a011-20210309 x86_64 randconfig-a012-20210309 x86_64 randconfig-a006-20210308 x86_64 randconfig-a001-20210308 x86_64 randconfig-a004-20210308 x86_64 randconfig-a002-20210308 x86_64 randconfig-a005-20210308 x86_64 randconfig-a003-20210308 i386 randconfig-a016-20210309 i386 randconfig-a012-20210309 i386 randconfig-a014-20210309 i386 randconfig-a013-20210309 i386 randconfig-a011-20210309 i386 randconfig-a015-20210309 riscv nommu_k210_defconfig riscv allyesconfig riscv nommu_virt_defconfig riscv allnoconfig riscv defconfig riscv rv32_defconfig riscv allmodconfig x86_64 allyesconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a006-20210309 x86_64 randconfig-a001-20210309 x86_64 randconfig-a004-20210309 x86_64 randconfig-a002-20210309 x86_64 randconfig-a005-20210309 x86_64 randconfig-a003-20210309 x86_64 randconfig-a013-20210308 x86_64 randconfig-a016-20210308 x86_64 randconfig-a015-20210308 x86_64 randconfig-a014-20210308 x86_64 randconfig-a011-20210308 x86_64 randconfig-a012-20210308 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From lkp at intel.com Wed Mar 10 03:34:52 2021 From: lkp at intel.com (kernel test robot) Date: Wed, 10 Mar 2021 11:34:52 +0800 Subject: [staging:staging-linus] BUILD SUCCESS 102ac9067dcecbf6f521667dce2356809ba088e5 Message-ID: <60483e5c.VmwXDRn2YmreZnsk%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-linus branch HEAD: 102ac9067dcecbf6f521667dce2356809ba088e5 Revert "staging: wfx: remove unused included header files" elapsed time: 723m configs tested: 123 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig sparc allyesconfig mips db1xxx_defconfig powerpc tqm8540_defconfig powerpc ppc44x_defconfig powerpc pq2fads_defconfig powerpc obs600_defconfig powerpc holly_defconfig powerpc kmeter1_defconfig riscv rv32_defconfig arm mxs_defconfig sh microdev_defconfig mips capcella_defconfig arm mvebu_v7_defconfig xtensa cadence_csp_defconfig arm pxa_defconfig powerpc tqm8541_defconfig sh polaris_defconfig powerpc ep88xc_defconfig mips rbtx49xx_defconfig powerpc mpc512x_defconfig arm hackkit_defconfig sh j2_defconfig mips omega2p_defconfig arm versatile_defconfig sh sh7757lcr_defconfig sh defconfig powerpc mpc832x_rdb_defconfig arm cns3420vb_defconfig m68k m5275evb_defconfig h8300 defconfig mips bcm63xx_defconfig powerpc mpc832x_mds_defconfig arm s3c2410_defconfig mips ath79_defconfig riscv defconfig i386 allyesconfig m68k m5307c3_defconfig powerpc tqm5200_defconfig powerpc mpc8313_rdb_defconfig xtensa iss_defconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig sparc defconfig i386 tinyconfig i386 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a005-20210308 i386 randconfig-a003-20210308 i386 randconfig-a002-20210308 i386 randconfig-a006-20210308 i386 randconfig-a004-20210308 i386 randconfig-a001-20210308 i386 randconfig-a005-20210309 i386 randconfig-a003-20210309 i386 randconfig-a002-20210309 i386 randconfig-a006-20210309 i386 randconfig-a004-20210309 i386 randconfig-a001-20210309 x86_64 randconfig-a013-20210309 x86_64 randconfig-a016-20210309 x86_64 randconfig-a015-20210309 x86_64 randconfig-a014-20210309 x86_64 randconfig-a011-20210309 x86_64 randconfig-a012-20210309 x86_64 randconfig-a006-20210308 x86_64 randconfig-a001-20210308 x86_64 randconfig-a004-20210308 x86_64 randconfig-a002-20210308 x86_64 randconfig-a005-20210308 x86_64 randconfig-a003-20210308 i386 randconfig-a016-20210309 i386 randconfig-a012-20210309 i386 randconfig-a014-20210309 i386 randconfig-a013-20210309 i386 randconfig-a011-20210309 i386 randconfig-a015-20210309 riscv nommu_k210_defconfig riscv allyesconfig riscv nommu_virt_defconfig riscv allnoconfig riscv allmodconfig x86_64 allyesconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a006-20210309 x86_64 randconfig-a001-20210309 x86_64 randconfig-a004-20210309 x86_64 randconfig-a002-20210309 x86_64 randconfig-a005-20210309 x86_64 randconfig-a003-20210309 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From aardelean at deviqon.com Wed Mar 10 07:16:51 2021 From: aardelean at deviqon.com (Alexandru Ardelean) Date: Wed, 10 Mar 2021 09:16:51 +0200 Subject: [PATCH 01/10] spi: spi-axi-spi-engine: remove usage of delay_usecs In-Reply-To: <8a6ec9a1-71f8-ce1d-600a-66eba9244a54@metafoo.de> References: <20210308145502.1075689-1-aardelean@deviqon.com> <20210308145502.1075689-2-aardelean@deviqon.com> <8a6ec9a1-71f8-ce1d-600a-66eba9244a54@metafoo.de> Message-ID: On Mon, 8 Mar 2021 at 18:42, Lars-Peter Clausen wrote: > > On 3/8/21 3:54 PM, Alexandru Ardelean wrote: > > The 'delay_usecs' field was handled for backwards compatibility in case > > there were some users that still configured SPI delay transfers with > > this field. > > > > They should all be removed by now. > > > > Signed-off-by: Alexandru Ardelean > > --- > > drivers/spi/spi-axi-spi-engine.c | 12 ++++-------- > > 1 file changed, 4 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-engine.c > > index af86e6d6e16b..80c3e38f5c1b 100644 > > --- a/drivers/spi/spi-axi-spi-engine.c > > +++ b/drivers/spi/spi-axi-spi-engine.c > > @@ -170,14 +170,10 @@ static void spi_engine_gen_sleep(struct spi_engine_program *p, bool dry, > > unsigned int t; > > int delay; > > > > - if (xfer->delay_usecs) { > > - delay = xfer->delay_usecs; > > - } else { > > - delay = spi_delay_to_ns(&xfer->delay, xfer); > > - if (delay < 0) > > - return; > > - delay /= 1000; > > - } > > + delay = spi_delay_to_ns(&xfer->delay, xfer); > > + if (delay < 0) > > + return; > > Bit of a nit, but this could be `delay <= 0` and then drop the check for > `delay == 0` below. hmm, that's a bit debatable, because the `delay == 0` check comes after `delay /= 1000` ; to do what you're suggesting, it would probably need a DIV_ROUND_UP(delay, 1000) to make sure that even sub-microsecond delays don't become zero; if you're acking this suggestion i'll implement it; i'll wait a few more days to see if there are any other acks or complaints on the set before sending a V2; btw: this new spi_delay struct supports delays in microseconds, nanoseconds and clock cycles; at some point it may be interesting to use a `spi_delay_to_clk_cycles()` for this driver and other similar; > > > + delay /= 1000; > > > > if (delay == 0) > > return; > > From lars at metafoo.de Wed Mar 10 07:21:14 2021 From: lars at metafoo.de (Lars-Peter Clausen) Date: Wed, 10 Mar 2021 08:21:14 +0100 Subject: [PATCH 01/10] spi: spi-axi-spi-engine: remove usage of delay_usecs In-Reply-To: References: <20210308145502.1075689-1-aardelean@deviqon.com> <20210308145502.1075689-2-aardelean@deviqon.com> <8a6ec9a1-71f8-ce1d-600a-66eba9244a54@metafoo.de> Message-ID: On 3/10/21 8:16 AM, Alexandru Ardelean wrote: > On Mon, 8 Mar 2021 at 18:42, Lars-Peter Clausen wrote: >> On 3/8/21 3:54 PM, Alexandru Ardelean wrote: >>> The 'delay_usecs' field was handled for backwards compatibility in case >>> there were some users that still configured SPI delay transfers with >>> this field. >>> >>> They should all be removed by now. >>> >>> Signed-off-by: Alexandru Ardelean >>> --- >>> drivers/spi/spi-axi-spi-engine.c | 12 ++++-------- >>> 1 file changed, 4 insertions(+), 8 deletions(-) >>> >>> diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-engine.c >>> index af86e6d6e16b..80c3e38f5c1b 100644 >>> --- a/drivers/spi/spi-axi-spi-engine.c >>> +++ b/drivers/spi/spi-axi-spi-engine.c >>> @@ -170,14 +170,10 @@ static void spi_engine_gen_sleep(struct spi_engine_program *p, bool dry, >>> unsigned int t; >>> int delay; >>> >>> - if (xfer->delay_usecs) { >>> - delay = xfer->delay_usecs; >>> - } else { >>> - delay = spi_delay_to_ns(&xfer->delay, xfer); >>> - if (delay < 0) >>> - return; >>> - delay /= 1000; >>> - } >>> + delay = spi_delay_to_ns(&xfer->delay, xfer); >>> + if (delay < 0) >>> + return; >> Bit of a nit, but this could be `delay <= 0` and then drop the check for >> `delay == 0` below. > hmm, that's a bit debatable, because the `delay == 0` check comes > after `delay /= 1000` ; > to do what you're suggesting, it would probably need a > DIV_ROUND_UP(delay, 1000) to make sure that even sub-microsecond > delays don't become zero; Ah, true. Lets keep the code as it is. On the other hand you could argue that we should round up to ensure the delay is at least as long as requested. But that is something that should be changed independently from this series. From eli.billauer at gmail.com Wed Mar 10 08:06:57 2021 From: eli.billauer at gmail.com (Eli Billauer) Date: Wed, 10 Mar 2021 10:06:57 +0200 Subject: [kbuild] Re: [PATCH v3 1/2] char: xillybus: Move class-related functions to new xillybus_class.c In-Reply-To: <20210309160326.GD21246@kadam> References: <20210309160326.GD21246@kadam> Message-ID: <60487E21.4090700@gmail.com> On 09/03/21 18:03, Dan Carpenter wrote: > url:https://github.com/0day-ci/linux/commits/eli-billauer-gmail-com/Submission-of-XillyUSB-driver/20210309-193645 > base:https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 080951f99de1e483a9a48f34c079b634f2912a54 > config: x86_64-randconfig-m001-20210309 (attached as .config) > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > Reported-by: Dan Carpenter > > smatch warnings: > drivers/char/xillybus/xillybus_class.c:86 xillybus_init_chrdev() warn: ignoring unreachable code. > drivers/char/xillybus/xillybus_class.c:96 xillybus_init_chrdev() warn: missing error code 'rc' > Thanks a lot. I guess there's a patch v4 coming up. Regards, Eli From fabioaiuto83 at gmail.com Wed Mar 10 09:37:23 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Wed, 10 Mar 2021 10:37:23 +0100 Subject: [PATCH] staging: rtl8723bs: remove unused code block Message-ID: <20210310093719.GA8646@agape.jhs> Remove conditional code block checked by unused CONFIG_GPIO_WAKEUP Cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 8 --- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 69 ------------------- .../staging/rtl8723bs/include/rtl8723b_hal.h | 4 -- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 57 --------------- 4 files changed, 138 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index 86f31d98349a..0480e32701f0 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -1183,11 +1183,6 @@ static void rtl8723b_set_FwWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) u8 gpio_high_active = 0; /* 0: low active, 1: high active */ u8 magic_pkt = 0; -#ifdef CONFIG_GPIO_WAKEUP - gpionum = WAKEUP_GPIO_IDX; - sdio_wakeup_enable = 0; -#endif - #ifdef CONFIG_PNO_SUPPORT if (!ppwrpriv->wowlan_pno_enable) magic_pkt = 1; @@ -1358,9 +1353,6 @@ static void rtl8723b_set_FwAPWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn u8 gpionum = 0, gpio_dur = 0; u8 gpio_high_active = 1; /* 0: low active, 1: high active */ u8 gpio_pulse = bFuncEn; -#ifdef CONFIG_GPIO_WAKEUP - gpionum = WAKEUP_GPIO_IDX; -#endif DBG_871X("%s(): bFuncEn =%d\n", __func__, bFuncEn); diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index 718ee9eee87c..9dd3f3249e01 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -42,63 +42,6 @@ static u8 CardEnable(struct adapter *padapter) return ret; } -#ifdef CONFIG_GPIO_WAKEUP -/* we set it high under init and fw will */ -/* give us Low Pulse when host wake up */ -void HostWakeUpGpioClear(struct adapter *Adapter) -{ - u32 value32; - - value32 = rtw_read32(Adapter, REG_GPIO_PIN_CTRL_2); - - /* set GPIO 12 1 */ - value32 |= BIT(12);/* 4+8 */ - /* GPIO 12 out put */ - value32 |= BIT(20);/* 4+16 */ - - rtw_write32(Adapter, REG_GPIO_PIN_CTRL_2, value32); -} /* HostWakeUpGpioClear */ - -void HalSetOutPutGPIO(struct adapter *padapter, u8 index, u8 OutPutValue) -{ - if (index <= 7) { - /* config GPIO mode */ - rtw_write8(padapter, REG_GPIO_PIN_CTRL + 3, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 3) & ~BIT(index)); - - /* config GPIO Sel */ - /* 0: input */ - /* 1: output */ - rtw_write8(padapter, REG_GPIO_PIN_CTRL + 2, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 2) | BIT(index)); - - /* set output value */ - if (OutPutValue) - rtw_write8(padapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 1) | BIT(index)); - else - rtw_write8(padapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 1) & ~BIT(index)); - } else { - /* 88C Series: */ - /* index: 11~8 transform to 3~0 */ - /* 8723 Series: */ - /* index: 12~8 transform to 4~0 */ - index -= 8; - - /* config GPIO mode */ - rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 3, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 3) & ~BIT(index)); - - /* config GPIO Sel */ - /* 0: input */ - /* 1: output */ - rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 2, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 2) | BIT(index)); - - /* set output value */ - if (OutPutValue) - rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 1) | BIT(index)); - else - rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 1) & ~BIT(index)); - } -} -#endif - static u8 _InitPowerOn_8723BS(struct adapter *padapter) { @@ -190,10 +133,6 @@ u8 _InitPowerOn_8723BS(struct adapter *padapter) rtw_write8(padapter, REG_PAD_CTRL1_8723B, value8); /* DBG_8192C("%s: REG_PAD_CTRL1(0x%x) = 0x%02X\n", __func__, REG_PAD_CTRL1_8723B, rtw_read8(padapter, REG_PAD_CTRL1_8723B)); */ -#ifdef CONFIG_GPIO_WAKEUP - HostWakeUpGpioClear(padapter); -#endif - return _SUCCESS; } @@ -1609,10 +1548,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) DBG_871X_LEVEL(_drv_always_, "Re-download Normal FW!\n"); SetFwRelatedForWoWLAN8723b(padapter, false); } -#ifdef CONFIG_GPIO_WAKEUP - DBG_871X_LEVEL(_drv_always_, "Set Wake GPIO to high for default.\n"); - HalSetOutPutGPIO(padapter, WAKEUP_GPIO_IDX, 1); -#endif /* 5. Download reserved pages and report media status if needed. */ if ( @@ -1727,10 +1662,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) SetFwRelatedForWoWLAN8723b(padapter, false); -#ifdef CONFIG_GPIO_WAKEUP - DBG_871X_LEVEL(_drv_always_, "Set Wake GPIO to high for default.\n"); - HalSetOutPutGPIO(padapter, WAKEUP_GPIO_IDX, 1); -#endif /* CONFIG_GPIO_WAKEUP */ rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); issue_beacon(padapter, 0); break; diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index 8e6e972dd843..6f964f5c6578 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -268,10 +268,6 @@ void rtl8723bs_cancle_checkbthang_workqueue(struct adapter *adapter); void rtl8723bs_hal_check_bt_hang(struct adapter *adapter); #endif -#ifdef CONFIG_GPIO_WAKEUP -void HalSetOutPutGPIO(struct adapter *padapter, u8 index, u8 OutPutValue); -#endif - int FirmwareDownloadBT(struct adapter *adapter, struct rt_firmware *firmware); void CCX_FwC2HTxRpt_8723b(struct adapter *padapter, u8 *pdata, u8 len); diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c index 301ffff12e82..079e75164f1e 100644 --- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c +++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c @@ -117,55 +117,6 @@ static void sdio_free_irq(struct dvobj_priv *dvobj) } } -#ifdef CONFIG_GPIO_WAKEUP -extern unsigned int oob_irq; -static irqreturn_t gpio_hostwakeup_irq_thread(int irq, void *data) -{ - struct adapter *padapter = data; - DBG_871X_LEVEL(_drv_always_, "gpio_hostwakeup_irq_thread\n"); - /* Disable interrupt before calling handler */ - /* disable_irq_nosync(oob_irq); */ - rtw_lock_suspend_timeout(HZ/2); - return IRQ_HANDLED; -} - -static u8 gpio_hostwakeup_alloc_irq(struct adapter *padapter) -{ - int err; - - if (oob_irq == 0) { - DBG_871X("oob_irq ZERO!\n"); - return _FAIL; - } - /* dont set it IRQF_TRIGGER_LOW, or wowlan */ - /* power is high after suspend */ - /* and failing can prevent can not sleep issue if */ - /* wifi gpio12 pin is not linked with CPU */ - err = request_threaded_irq(oob_irq, gpio_hostwakeup_irq_thread, NULL, - /* IRQF_TRIGGER_LOW | IRQF_ONESHOT, */ - IRQF_TRIGGER_FALLING, - "rtw_wifi_gpio_wakeup", padapter); - if (err < 0) { - DBG_871X("Oops: can't allocate gpio irq %d err:%d\n", oob_irq, err); - return false; - } else { - DBG_871X("allocate gpio irq %d ok\n", oob_irq); - } - - enable_irq_wake(oob_irq); - return _SUCCESS; -} - -static void gpio_hostwakeup_free_irq(struct adapter *padapter) -{ - if (oob_irq == 0) - return; - - disable_irq_wake(oob_irq); - free_irq(oob_irq, padapter); -} -#endif - static u32 sdio_init(struct dvobj_priv *dvobj) { struct sdio_data *psdio_data; @@ -424,10 +375,6 @@ static void rtw_sdio_if1_deinit(struct adapter *if1) free_mlme_ap_info(if1); -#ifdef CONFIG_GPIO_WAKEUP - gpio_hostwakeup_free_irq(if1); -#endif - rtw_cancel_all_timer(if1); #ifdef CONFIG_WOWLAN @@ -482,10 +429,6 @@ static int rtw_drv_init( if (sdio_alloc_irq(dvobj) != _SUCCESS) goto free_if2; -#ifdef CONFIG_GPIO_WAKEUP - gpio_hostwakeup_alloc_irq(if1); -#endif - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-871x_drv - drv_init, success!\n")); rtw_ndev_notifier_register(); -- 2.20.1 From aardelean at deviqon.com Wed Mar 10 09:51:31 2021 From: aardelean at deviqon.com (Alexandru Ardelean) Date: Wed, 10 Mar 2021 11:51:31 +0200 Subject: [PATCH] staging: iio: ad9834: convert to device-managed functions in probe Message-ID: <20210310095131.47476-1-aardelean@deviqon.com> 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 --- drivers/staging/iio/frequency/ad9834.c | 64 +++++++++++++------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c index 262c3590e64e..b063cfd0e0e1 100644 --- a/drivers/staging/iio/frequency/ad9834.c +++ b/drivers/staging/iio/frequency/ad9834.c @@ -390,6 +390,20 @@ static const struct iio_info ad9833_info = { .attrs = &ad9833_attribute_group, }; +static void ad9834_disable_reg(void *data) +{ + struct regulator *reg = data; + + regulator_disable(reg); +} + +static void ad9834_disable_clk(void *data) +{ + struct clk *clk = data; + + clk_disable_unprepare(clk); +} + static int ad9834_probe(struct spi_device *spi) { struct ad9834_state *st; @@ -407,26 +421,33 @@ static int ad9834_probe(struct spi_device *spi) return ret; } + ret = devm_add_action_or_reset(&spi->dev, ad9834_disable_reg, reg); + if (ret) + return ret; + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); if (!indio_dev) { ret = -ENOMEM; - goto error_disable_reg; + return ret; } - spi_set_drvdata(spi, indio_dev); st = iio_priv(indio_dev); mutex_init(&st->lock); st->mclk = devm_clk_get(&spi->dev, NULL); if (IS_ERR(st->mclk)) { ret = PTR_ERR(st->mclk); - goto error_disable_reg; + return ret; } ret = clk_prepare_enable(st->mclk); if (ret) { dev_err(&spi->dev, "Failed to enable master clock\n"); - goto error_disable_reg; + return ret; } + ret = devm_add_action_or_reset(&spi->dev, ad9834_disable_clk, st->mclk); + if (ret) + return ret; + st->spi = spi; st->devid = spi_get_device_id(spi)->driver_data; st->reg = reg; @@ -470,48 +491,26 @@ static int ad9834_probe(struct spi_device *spi) ret = spi_sync(st->spi, &st->msg); if (ret) { dev_err(&spi->dev, "device init failed\n"); - goto error_clock_unprepare; + return ret; } ret = ad9834_write_frequency(st, AD9834_REG_FREQ0, 1000000); if (ret) - goto error_clock_unprepare; + return ret; ret = ad9834_write_frequency(st, AD9834_REG_FREQ1, 5000000); if (ret) - goto error_clock_unprepare; + return ret; ret = ad9834_write_phase(st, AD9834_REG_PHASE0, 512); if (ret) - goto error_clock_unprepare; + return ret; ret = ad9834_write_phase(st, AD9834_REG_PHASE1, 1024); if (ret) - goto error_clock_unprepare; - - ret = iio_device_register(indio_dev); - if (ret) - goto error_clock_unprepare; - - return 0; -error_clock_unprepare: - clk_disable_unprepare(st->mclk); -error_disable_reg: - regulator_disable(reg); - - return ret; -} - -static int ad9834_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad9834_state *st = iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - clk_disable_unprepare(st->mclk); - regulator_disable(st->reg); + return ret; - return 0; + return devm_iio_device_register(&spi->dev, indio_dev); } static const struct spi_device_id ad9834_id[] = { @@ -539,7 +538,6 @@ static struct spi_driver ad9834_driver = { .of_match_table = ad9834_of_match }, .probe = ad9834_probe, - .remove = ad9834_remove, .id_table = ad9834_id, }; module_spi_driver(ad9834_driver); -- 2.29.2 From atulgopinathan at gmail.com Wed Mar 10 10:43:54 2021 From: atulgopinathan at gmail.com (Atul Gopinathan) Date: Wed, 10 Mar 2021 16:13:54 +0530 Subject: [PATCH] staging: rtl8192u: ieee80211: Remove braces for single line blocks Message-ID: <20210310104353.14531-1-atulgopinathan@gmail.com> Remove braces around those `if` and `for` blocks which contain a single line and therefore fix the Checkpatch warning of the following type: "WARNING: braces {} are not necessary for single statement blocks" Signed-off-by: Atul Gopinathan --- .../staging/rtl8192u/ieee80211/ieee80211_rx.c | 42 ++++++++----------- .../staging/rtl8192u/ieee80211/ieee80211_tx.c | 4 +- .../staging/rtl8192u/ieee80211/ieee80211_wx.c | 6 +-- 3 files changed, 22 insertions(+), 30 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index b6fee7230ce0..b0e01ee65f7f 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -612,9 +612,9 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, pHTInfo->RxReorderDropCounter++; { int i; - for (i = 0; i < prxb->nr_subframes; i++) { + for (i = 0; i < prxb->nr_subframes; i++) dev_kfree_skb(prxb->subframes[i]); - } + kfree(prxb); prxb = NULL; } @@ -632,11 +632,11 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, pTS->rx_indicate_seq = (pTS->rx_indicate_seq + 1) % 4096; bMatchWinStart = true; } else if (SN_LESS(WinEnd, SeqNum)) { - if (SeqNum >= (WinSize - 1)) { + if (SeqNum >= (WinSize - 1)) pTS->rx_indicate_seq = SeqNum + 1 - WinSize; - } else { + else pTS->rx_indicate_seq = 4095 - (WinSize - (SeqNum + 1)) + 1; - } + IEEE80211_DEBUG(IEEE80211_DL_REORDER, "Window Shift! IndicateSeq: %d, NewSeq: %d\n", pTS->rx_indicate_seq, SeqNum); } @@ -674,9 +674,9 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, list_add_tail(&pReorderEntry->List, &ieee->RxReorder_Unused_List); { int i; - for (i = 0; i < prxb->nr_subframes; i++) { + for (i = 0; i < prxb->nr_subframes; i++) dev_kfree_skb(prxb->subframes[i]); - } + kfree(prxb); prxb = NULL; } @@ -693,9 +693,9 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): There is no reorder entry!! Packet is dropped!!\n"); { int i; - for (i = 0; i < prxb->nr_subframes; i++) { + for (i = 0; i < prxb->nr_subframes; i++) dev_kfree_skb(prxb->subframes[i]); - } + kfree(prxb); prxb = NULL; } @@ -785,13 +785,12 @@ static u8 parse_subframe(struct ieee80211_device *ieee, bIsAggregateFrame = true; } - if (IEEE80211_QOS_HAS_SEQ(fc)) { + if (IEEE80211_QOS_HAS_SEQ(fc)) LLCOffset += 2; - } - if (rx_stats->bContainHTC) { + if (rx_stats->bContainHTC) LLCOffset += HTCLNG; - } + // Null packet, don't indicate it to upper layer ChkLength = LLCOffset;/* + (Frame_WEP(frame)!=0 ?Adapter->MgntInfo.SecurityInfo.EncryptionHeadOverhead:0);*/ @@ -855,13 +854,11 @@ static u8 parse_subframe(struct ieee80211_device *ieee, if (skb->len != 0) { nPadding_Length = 4 - ((nSubframe_Length + ETHERNET_HEADER_SIZE) % 4); - if (nPadding_Length == 4) { + if (nPadding_Length == 4) nPadding_Length = 0; - } - if (skb->len < nPadding_Length) { + if (skb->len < nPadding_Length) return 0; - } skb_pull(skb, nPadding_Length); } @@ -1248,9 +1245,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, TID = Frame_QoSTID(skb->data); SeqNum = WLAN_GET_SEQ_SEQ(sc); GetTs(ieee, (struct ts_common_info **)&pTS, hdr->addr2, TID, RX_DIR, true); - if (TID != 0 && TID != 3) { + if (TID != 0 && TID != 3) ieee->bis_any_nonbepkts = true; - } } //added by amy for reorder /* skb: hdr + (possible reassembled) full plaintext payload */ @@ -1262,9 +1258,9 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, /* qos data packets & reserved bit is 1 */ if (parse_subframe(ieee, skb, rx_stats, rxb, src, dst) == 0) { /* only to free rxb, and not submit the packets to upper layer */ - for (i = 0; i < rxb->nr_subframes; i++) { + for (i = 0; i < rxb->nr_subframes; i++) dev_kfree_skb(rxb->subframes[i]); - } + kfree(rxb); rxb = NULL; goto rx_dropped; @@ -1523,11 +1519,9 @@ static inline void ieee80211_extract_country_ie( // some AP (e.g. Cisco 1242) don't include country IE in their // probe response frame. // - if (IS_EQUAL_CIE_SRC(ieee, addr2)) { + if (IS_EQUAL_CIE_SRC(ieee, addr2)) UPDATE_CIE_WATCHDOG(ieee); - } } - } int ieee80211_parse_info_param(struct ieee80211_device *ieee, diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index bd8914645e95..96e6aaf859ec 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -301,9 +301,9 @@ static void ieee80211_tx_query_agg_cap(struct ieee80211_device *ieee, if (is_multicast_ether_addr(hdr->addr1)) return; //check packet and mode later - if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { + if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) return; - } + if (pHTInfo->bCurrentAMPDUEnable) { if (!GetTs(ieee, (struct ts_common_info **)(&pTxTs), hdr->addr1, skb->priority, TX_DIR, true)) { printk("===>can't get TS\n"); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c index 22373c0afebc..78cc8f357bbc 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c @@ -184,9 +184,8 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, // printk("WPA IE\n"); u8 *p = buf; p += sprintf(p, "wpa_ie="); - for (i = 0; i < network->wpa_ie_len; i++) { + for (i = 0; i < network->wpa_ie_len; i++) p += sprintf(p, "%02x", network->wpa_ie[i]); - } memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVCUSTOM; @@ -199,9 +198,8 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, u8 *p = buf; p += sprintf(p, "rsn_ie="); - for (i = 0; i < network->rsn_ie_len; i++) { + for (i = 0; i < network->rsn_ie_len; i++) p += sprintf(p, "%02x", network->rsn_ie[i]); - } memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVCUSTOM; -- 2.27.0 From guolongji at uniontech.com Wed Mar 10 11:35:03 2021 From: guolongji at uniontech.com (Longji Guo) Date: Wed, 10 Mar 2021 19:35:03 +0800 Subject: [PATCH] Staging: rtl8723bs/core: fix coding style issue Message-ID: <20210310113503.1352-1-guolongji@uniontech.com> Move operators and spaces before tabs to fix coding style issues. Signed-off-by: Longji Guo --- drivers/staging/rtl8723bs/core/rtw_recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c index 3c9dbd7443d9..f249193edeb3 100644 --- a/drivers/staging/rtl8723bs/core/rtw_recv.c +++ b/drivers/staging/rtl8723bs/core/rtw_recv.c @@ -576,7 +576,7 @@ union recv_frame *portctrl(struct adapter *adapter, union recv_frame *precv_fram prtnframe = precv_frame; /* get ether_type */ - ptr = ptr+pfhdr->attrib.hdrlen+pfhdr->attrib.iv_len+LLC_HEADER_SIZE; + ptr = ptr + pfhdr->attrib.hdrlen + pfhdr->attrib.iv_len + LLC_HEADER_SIZE; memcpy(&be_tmp, ptr, 2); ether_type = ntohs(be_tmp); -- 2.30.1 From u.kleine-koenig at pengutronix.de Wed Mar 10 11:50:41 2021 From: u.kleine-koenig at pengutronix.de (Uwe =?utf-8?Q?Kleine-K=C3=B6nig?=) Date: Wed, 10 Mar 2021 12:50:41 +0100 Subject: [PATCH v7 11/11] pwm: Add Raspberry Pi Firmware based PWM bus In-Reply-To: <20210118123244.13669-12-nsaenzjulienne@suse.de> References: <20210118123244.13669-1-nsaenzjulienne@suse.de> <20210118123244.13669-12-nsaenzjulienne@suse.de> Message-ID: <20210310115041.s7tzvgdpksws6yss@pengutronix.de> Hello Nicolas, On Mon, Jan 18, 2021 at 01:32:44PM +0100, Nicolas Saenz Julienne wrote: > diff --git a/drivers/pwm/pwm-raspberrypi-poe.c b/drivers/pwm/pwm-raspberrypi-poe.c > new file mode 100644 > index 000000000000..ca845e8fabe6 > --- /dev/null > +++ b/drivers/pwm/pwm-raspberrypi-poe.c > @@ -0,0 +1,220 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright 2020 Nicolas Saenz Julienne > + * For more information on Raspberry Pi's PoE hat see: > + * https://www.raspberrypi.org/products/poe-hat/ > + * > + * Limitations: > + * - No disable bit, so a disabled PWM is simulated by duty_cycle 0 > + * - Only normal polarity > + * - Fixed 12.5 kHz period > + * > + * The current period is completed when HW is reconfigured. nice. > + */ > + > [...] > +static int raspberrypi_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, > + const struct pwm_state *state) > +{ > + struct raspberrypi_pwm *rpipwm = raspberrypi_pwm_from_chip(chip); > + unsigned int duty_cycle; > + int ret; > + > + if (state->period < RPI_PWM_PERIOD_NS || > + state->polarity != PWM_POLARITY_NORMAL) > + return -EINVAL; > + > + if (!state->enabled) > + duty_cycle = 0; > + else if (state->duty_cycle < RPI_PWM_PERIOD_NS) > + duty_cycle = DIV_ROUND_DOWN_ULL(state->duty_cycle * RPI_PWM_MAX_DUTY, > + RPI_PWM_PERIOD_NS); > + else > + duty_cycle = RPI_PWM_MAX_DUTY; > + > + if (duty_cycle == rpipwm->duty_cycle) > + return 0; > + > + ret = raspberrypi_pwm_set_property(rpipwm->firmware, RPI_PWM_CUR_DUTY_REG, > + duty_cycle); > + if (ret) { > + dev_err(chip->dev, "Failed to set duty cycle: %pe\n", > + ERR_PTR(ret)); > + return ret; > + } > + > + /* > + * This sets the default duty cycle after resetting the board, we > + * updated it every time to mimic Raspberry Pi's downstream's driver > + * behaviour. > + */ > + ret = raspberrypi_pwm_set_property(rpipwm->firmware, RPI_PWM_DEF_DUTY_REG, > + duty_cycle); > + if (ret) { > + dev_err(chip->dev, "Failed to set default duty cycle: %pe\n", > + ERR_PTR(ret)); > + return ret; This only has an effect for the next reboot, right? If so I wonder if it is a good idea in general. (Think: The current PWM setting enables a motor that makes a self-driving car move at 100 km/h. Consider the rpi crashes, do I want to car to pick up driving 100 km/h at power up even before Linux is up again?) And if we agree it's a good idea: Should raspberrypi_pwm_apply return 0 if setting the duty cycle succeeded and only setting the default didn't? Other than that the patch looks fine. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | https://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: not available URL: From fabioaiuto83 at gmail.com Wed Mar 10 15:37:21 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Wed, 10 Mar 2021 16:37:21 +0100 Subject: [PATCH] staging: rtl8723bs: align comments Message-ID: <20210310153717.GA5741@agape.jhs> fix the following checkpatch warnings: WARNING: Block comments use * on subsequent lines + /* + AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k -- WARNING: Block comments use * on subsequent lines +/* +op_mode Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_ap.c | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c index b6f944b37b08..3a0e4f64466a 100644 --- a/drivers/staging/rtl8723bs/core/rtw_ap.c +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c @@ -721,9 +721,9 @@ static void update_hw_ht_param(struct adapter *padapter) /* handle A-MPDU parameter field */ /* - AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k - AMPDU_para [4:2]:Min MPDU Start Spacing - */ + * AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k + * AMPDU_para [4:2]:Min MPDU Start Spacing + */ max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03; min_MPDU_spacing = ( @@ -1815,17 +1815,17 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) } /* -op_mode -Set to 0 (HT pure) under the following conditions - - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or - - all STAs in the BSS are 20 MHz HT in 20 MHz BSS -Set to 1 (HT non-member protection) if there may be non-HT STAs - in both the primary and the secondary channel -Set to 2 if only HT STAs are associated in BSS, - however and at least one 20 MHz HT STA is associated -Set to 3 (HT mixed mode) when one or more non-HT STAs are associated - (currently non-GF HT station is considered as non-HT STA also) -*/ + *op_mode + *Set to 0 (HT pure) under the following conditions + * - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or + * - all STAs in the BSS are 20 MHz HT in 20 MHz BSS + *Set to 1 (HT non-member protection) if there may be non-HT STAs + * in both the primary and the secondary channel + *Set to 2 if only HT STAs are associated in BSS, + * however and at least one 20 MHz HT STA is associated + *Set to 3 (HT mixed mode) when one or more non-HT STAs are associated + * (currently non-GF HT station is considered as non-HT STA also) + */ static int rtw_ht_operation_update(struct adapter *padapter) { u16 cur_op_mode, new_op_mode; -- 2.20.1 From gregkh at linuxfoundation.org Wed Mar 10 15:51:44 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Wed, 10 Mar 2021 16:51:44 +0100 Subject: [PATCH] staging: rtl8723bs: align comments In-Reply-To: <20210310153717.GA5741@agape.jhs> References: <20210310153717.GA5741@agape.jhs> Message-ID: On Wed, Mar 10, 2021 at 04:37:21PM +0100, Fabio Aiuto wrote: > fix the following checkpatch warnings: > > WARNING: Block comments use * on subsequent lines > + /* > + AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k > -- > WARNING: Block comments use * on subsequent lines > +/* > +op_mode > > Signed-off-by: Fabio Aiuto > --- > drivers/staging/rtl8723bs/core/rtw_ap.c | 28 ++++++++++++------------- > 1 file changed, 14 insertions(+), 14 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c > index b6f944b37b08..3a0e4f64466a 100644 > --- a/drivers/staging/rtl8723bs/core/rtw_ap.c > +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c > @@ -721,9 +721,9 @@ static void update_hw_ht_param(struct adapter *padapter) > > /* handle A-MPDU parameter field */ > /* > - AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k > - AMPDU_para [4:2]:Min MPDU Start Spacing > - */ > + * AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k > + * AMPDU_para [4:2]:Min MPDU Start Spacing > + */ > max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03; > > min_MPDU_spacing = ( > @@ -1815,17 +1815,17 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) > } > > /* > -op_mode > -Set to 0 (HT pure) under the following conditions > - - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or > - - all STAs in the BSS are 20 MHz HT in 20 MHz BSS > -Set to 1 (HT non-member protection) if there may be non-HT STAs > - in both the primary and the secondary channel > -Set to 2 if only HT STAs are associated in BSS, > - however and at least one 20 MHz HT STA is associated > -Set to 3 (HT mixed mode) when one or more non-HT STAs are associated > - (currently non-GF HT station is considered as non-HT STA also) > -*/ > + *op_mode > + *Set to 0 (HT pure) under the following conditions > + * - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or > + * - all STAs in the BSS are 20 MHz HT in 20 MHz BSS > + *Set to 1 (HT non-member protection) if there may be non-HT STAs > + * in both the primary and the secondary channel > + *Set to 2 if only HT STAs are associated in BSS, > + * however and at least one 20 MHz HT STA is associated > + *Set to 3 (HT mixed mode) when one or more non-HT STAs are associated > + * (currently non-GF HT station is considered as non-HT STA also) > + */ Add a space after the ' ' to make it look correct please. thanks, greg k-h From gregkh at linuxfoundation.org Wed Mar 10 16:04:17 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Wed, 10 Mar 2021 17:04:17 +0100 Subject: [PATCH] Match alignment with open parenthesis In-Reply-To: <20210221234409.11627-1-gmahak1@gmail.com> References: <20210221234409.11627-1-gmahak1@gmail.com> Message-ID: On Mon, Feb 22, 2021 at 05:14:09AM +0530, Mahak Gupta wrote: > This patches fixes the checks- 'Alignment should match open parenthesis' > of 'checkpatch.pl'. > > Signed-off-by: Mahak Gupta > --- > drivers/staging/octeon-usb/octeon-hcd.c | 32 +++++++++++++------------ > 1 file changed, 17 insertions(+), 15 deletions(-) This got lost as you didn't put the subsystem on the subject line :( Please resend with "staging: " as a prefix on the subject line so our tools can pick this up properly. thanks, greg k-h From dan.carpenter at oracle.com Wed Mar 10 17:48:30 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Wed, 10 Mar 2021 20:48:30 +0300 Subject: [PATCH] staging: rtl8723bs: align comments In-Reply-To: <20210310153717.GA5741@agape.jhs> References: <20210310153717.GA5741@agape.jhs> Message-ID: <20210310174830.GM2087@kadam> On Wed, Mar 10, 2021 at 04:37:21PM +0100, Fabio Aiuto wrote: > fix the following checkpatch warnings: > > WARNING: Block comments use * on subsequent lines > + /* > + AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k > -- > WARNING: Block comments use * on subsequent lines > +/* > +op_mode > > Signed-off-by: Fabio Aiuto > --- > drivers/staging/rtl8723bs/core/rtw_ap.c | 28 ++++++++++++------------- > 1 file changed, 14 insertions(+), 14 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c > index b6f944b37b08..3a0e4f64466a 100644 > --- a/drivers/staging/rtl8723bs/core/rtw_ap.c > +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c > @@ -721,9 +721,9 @@ static void update_hw_ht_param(struct adapter *padapter) > > /* handle A-MPDU parameter field */ > /* Combine these two comments into one mult-line comment. > - AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k > - AMPDU_para [4:2]:Min MPDU Start Spacing > - */ > + * AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k > + * AMPDU_para [4:2]:Min MPDU Start Spacing > + */ > max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03; > > min_MPDU_spacing = ( > @@ -1815,17 +1815,17 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) > } > > /* > -op_mode > -Set to 0 (HT pure) under the following conditions > - - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or > - - all STAs in the BSS are 20 MHz HT in 20 MHz BSS > -Set to 1 (HT non-member protection) if there may be non-HT STAs > - in both the primary and the secondary channel > -Set to 2 if only HT STAs are associated in BSS, > - however and at least one 20 MHz HT STA is associated > -Set to 3 (HT mixed mode) when one or more non-HT STAs are associated > - (currently non-GF HT station is considered as non-HT STA also) > -*/ > + *op_mode You need to have a space character after the '*'. /* * op_mode * Set to ... > + *Set to 0 (HT pure) under the following conditions > + * - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or > + * - all STAs in the BSS are 20 MHz HT in 20 MHz BSS > + *Set to 1 (HT non-member protection) if there may be non-HT STAs > + * in both the primary and the secondary channel > + *Set to 2 if only HT STAs are associated in BSS, > + * however and at least one 20 MHz HT STA is associated > + *Set to 3 (HT mixed mode) when one or more non-HT STAs are associated > + * (currently non-GF HT station is considered as non-HT STA also) > + */ regards, dan carpenter From lkp at intel.com Wed Mar 10 20:34:47 2021 From: lkp at intel.com (kernel test robot) Date: Thu, 11 Mar 2021 04:34:47 +0800 Subject: [staging:staging-linus] BUILD SUCCESS 16d7586dccf83785819f5b66f4d20fac9bfcd644 Message-ID: <60492d67.oys+Wk2VgJW7+wUA%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-linus branch HEAD: 16d7586dccf83785819f5b66f4d20fac9bfcd644 Revert "staging: wfx: remove unused included header files" elapsed time: 729m configs tested: 172 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig mips tb0287_defconfig mips cu1830-neo_defconfig powerpc mpc8540_ads_defconfig mips jazz_defconfig sh r7785rp_defconfig m68k hp300_defconfig powerpc adder875_defconfig powerpc mpc8313_rdb_defconfig powerpc ppc40x_defconfig mips pistachio_defconfig powerpc mpc837x_rdb_defconfig sh landisk_defconfig sh rsk7264_defconfig sh r7780mp_defconfig m68k mvme16x_defconfig powerpc mvme5100_defconfig arm mxs_defconfig sh microdev_defconfig mips capcella_defconfig arm mvebu_v7_defconfig xtensa cadence_csp_defconfig powerpc sam440ep_defconfig sh rts7751r2d1_defconfig sh se7206_defconfig sh sh7724_generic_defconfig m68k m5208evb_defconfig sh sh7770_generic_defconfig arm ezx_defconfig powerpc eiger_defconfig ia64 zx1_defconfig ia64 allmodconfig i386 defconfig arm hackkit_defconfig sh j2_defconfig mips omega2p_defconfig arm versatile_defconfig sh sh7757lcr_defconfig sh defconfig powerpc mpc832x_rdb_defconfig arm cns3420vb_defconfig m68k m5275evb_defconfig h8300 defconfig mips bcm63xx_defconfig mips maltasmvp_eva_defconfig h8300 h8300h-sim_defconfig mips gpr_defconfig powerpc64 alldefconfig sh se7705_defconfig powerpc asp8347_defconfig mips jmr3927_defconfig arc tb10x_defconfig s390 alldefconfig powerpc ge_imp3a_defconfig mips loongson1b_defconfig h8300 alldefconfig arm omap2plus_defconfig arm tct_hammer_defconfig arm lubbock_defconfig arm hisi_defconfig mips ip32_defconfig sh lboxre2_defconfig powerpc mpc832x_mds_defconfig arm s3c2410_defconfig mips ath79_defconfig riscv defconfig arm xcep_defconfig arm ep93xx_defconfig powerpc stx_gp3_defconfig arm pxa910_defconfig powerpc icon_defconfig m68k m5307c3_defconfig powerpc tqm5200_defconfig xtensa iss_defconfig sh ap325rxa_defconfig arm multi_v5_defconfig m68k m5272c3_defconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig i386 allyesconfig sparc allyesconfig sparc defconfig i386 tinyconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig x86_64 randconfig-a006-20210308 x86_64 randconfig-a001-20210308 x86_64 randconfig-a004-20210308 x86_64 randconfig-a002-20210308 x86_64 randconfig-a005-20210308 x86_64 randconfig-a003-20210308 i386 randconfig-a005-20210309 i386 randconfig-a003-20210309 i386 randconfig-a002-20210309 i386 randconfig-a006-20210309 i386 randconfig-a004-20210309 i386 randconfig-a001-20210309 i386 randconfig-a005-20210308 i386 randconfig-a003-20210308 i386 randconfig-a002-20210308 i386 randconfig-a006-20210308 i386 randconfig-a004-20210308 i386 randconfig-a001-20210308 x86_64 randconfig-a013-20210309 x86_64 randconfig-a016-20210309 x86_64 randconfig-a015-20210309 x86_64 randconfig-a014-20210309 x86_64 randconfig-a011-20210309 x86_64 randconfig-a012-20210309 x86_64 randconfig-a011-20210310 x86_64 randconfig-a016-20210310 x86_64 randconfig-a013-20210310 x86_64 randconfig-a015-20210310 x86_64 randconfig-a014-20210310 x86_64 randconfig-a012-20210310 i386 randconfig-a016-20210309 i386 randconfig-a012-20210309 i386 randconfig-a014-20210309 i386 randconfig-a013-20210309 i386 randconfig-a011-20210309 i386 randconfig-a015-20210309 riscv nommu_k210_defconfig riscv allyesconfig riscv nommu_virt_defconfig riscv allnoconfig riscv rv32_defconfig riscv allmodconfig x86_64 allyesconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a006-20210309 x86_64 randconfig-a001-20210309 x86_64 randconfig-a004-20210309 x86_64 randconfig-a002-20210309 x86_64 randconfig-a005-20210309 x86_64 randconfig-a003-20210309 x86_64 randconfig-a013-20210308 x86_64 randconfig-a016-20210308 x86_64 randconfig-a015-20210308 x86_64 randconfig-a014-20210308 x86_64 randconfig-a011-20210308 x86_64 randconfig-a012-20210308 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From fabioaiuto83 at gmail.com Wed Mar 10 21:58:32 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Wed, 10 Mar 2021 22:58:32 +0100 Subject: [PATCH] staging: rtl8723bs: align comments In-Reply-To: References: <20210310153717.GA5741@agape.jhs> Message-ID: <20210310160946.GA6421@agape.jhs> On Wed, Mar 10, 2021 at 04:51:44PM +0100, Greg KH wrote: > On Wed, Mar 10, 2021 at 04:37:21PM +0100, Fabio Aiuto wrote: > > fix the following checkpatch warnings: > > > > WARNING: Block comments use * on subsequent lines > > + /* > > + AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k > > -- > > WARNING: Block comments use * on subsequent lines > > +/* > > +op_mode > > > > Signed-off-by: Fabio Aiuto > > --- > > drivers/staging/rtl8723bs/core/rtw_ap.c | 28 ++++++++++++------------- > > 1 file changed, 14 insertions(+), 14 deletions(-) > > > > diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c > > index b6f944b37b08..3a0e4f64466a 100644 > > --- a/drivers/staging/rtl8723bs/core/rtw_ap.c > > +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c > > @@ -721,9 +721,9 @@ static void update_hw_ht_param(struct adapter *padapter) > > > > /* handle A-MPDU parameter field */ > > /* > > - AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k > > - AMPDU_para [4:2]:Min MPDU Start Spacing > > - */ > > + * AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k > > + * AMPDU_para [4:2]:Min MPDU Start Spacing > > + */ > > max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03; > > > > min_MPDU_spacing = ( > > @@ -1815,17 +1815,17 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) > > } > > > > /* > > -op_mode > > -Set to 0 (HT pure) under the following conditions > > - - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or > > - - all STAs in the BSS are 20 MHz HT in 20 MHz BSS > > -Set to 1 (HT non-member protection) if there may be non-HT STAs > > - in both the primary and the secondary channel > > -Set to 2 if only HT STAs are associated in BSS, > > - however and at least one 20 MHz HT STA is associated > > -Set to 3 (HT mixed mode) when one or more non-HT STAs are associated > > - (currently non-GF HT station is considered as non-HT STA also) > > -*/ > > + *op_mode > > + *Set to 0 (HT pure) under the following conditions > > + * - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or > > + * - all STAs in the BSS are 20 MHz HT in 20 MHz BSS > > + *Set to 1 (HT non-member protection) if there may be non-HT STAs > > + * in both the primary and the secondary channel > > + *Set to 2 if only HT STAs are associated in BSS, > > + * however and at least one 20 MHz HT STA is associated > > + *Set to 3 (HT mixed mode) when one or more non-HT STAs are associated > > + * (currently non-GF HT station is considered as non-HT STA also) > > + */ > > Add a space after the ' ' to make it look correct please. > > thanks, > > greg k-h I am sorry, I fear I don't understand, checkpatch.sh script says the patch is ok. Where have I to add a ' ' (a blank?)? thank you, fabio From lkp at intel.com Wed Mar 10 22:05:18 2021 From: lkp at intel.com (kernel test robot) Date: Thu, 11 Mar 2021 06:05:18 +0800 Subject: [staging:staging-next] BUILD SUCCESS c972c2d821ca3eda001a20dbe2ca0b4718838caf Message-ID: <6049429e.oS/zSk5zLyMxHmr5%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-next branch HEAD: c972c2d821ca3eda001a20dbe2ca0b4718838caf staging: unisys: visornic: Fix repeated words in comments elapsed time: 727m configs tested: 157 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig sparc allyesconfig mips db1xxx_defconfig powerpc tqm8540_defconfig powerpc ppc44x_defconfig mips tb0287_defconfig mips cu1830-neo_defconfig powerpc mpc8540_ads_defconfig mips jazz_defconfig sh r7785rp_defconfig m68k hp300_defconfig powerpc adder875_defconfig powerpc mpc8313_rdb_defconfig powerpc ppc40x_defconfig mips pistachio_defconfig powerpc mpc837x_rdb_defconfig sh landisk_defconfig sh rsk7264_defconfig sh r7780mp_defconfig m68k mvme16x_defconfig powerpc mvme5100_defconfig sh sh7770_generic_defconfig arm ezx_defconfig powerpc eiger_defconfig ia64 zx1_defconfig sh defconfig powerpc mpc832x_rdb_defconfig arm cns3420vb_defconfig m68k m5275evb_defconfig h8300 defconfig mips bcm63xx_defconfig mips maltasmvp_eva_defconfig h8300 h8300h-sim_defconfig mips gpr_defconfig powerpc64 alldefconfig powerpc tqm8541_defconfig sh urquell_defconfig arc vdk_hs38_smp_defconfig m68k bvme6000_defconfig x86_64 defconfig arm spear3xx_defconfig sh rts7751r2d1_defconfig powerpc ge_imp3a_defconfig arm hackkit_defconfig mips loongson1b_defconfig h8300 alldefconfig arm omap2plus_defconfig arm tct_hammer_defconfig arm lubbock_defconfig arm hisi_defconfig mips ip32_defconfig sh lboxre2_defconfig powerpc mpc832x_mds_defconfig arm s3c2410_defconfig mips ath79_defconfig riscv defconfig arm xcep_defconfig arc tb10x_defconfig arm ep93xx_defconfig powerpc stx_gp3_defconfig arm pxa910_defconfig powerpc icon_defconfig m68k m5307c3_defconfig powerpc tqm5200_defconfig xtensa iss_defconfig sh ap325rxa_defconfig arm multi_v5_defconfig m68k m5272c3_defconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig i386 allyesconfig sparc defconfig i386 tinyconfig i386 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig x86_64 randconfig-a006-20210308 x86_64 randconfig-a001-20210308 x86_64 randconfig-a004-20210308 x86_64 randconfig-a002-20210308 x86_64 randconfig-a005-20210308 x86_64 randconfig-a003-20210308 i386 randconfig-a005-20210309 i386 randconfig-a003-20210309 i386 randconfig-a002-20210309 i386 randconfig-a006-20210309 i386 randconfig-a004-20210309 i386 randconfig-a001-20210309 x86_64 randconfig-a013-20210309 x86_64 randconfig-a016-20210309 x86_64 randconfig-a015-20210309 x86_64 randconfig-a014-20210309 x86_64 randconfig-a011-20210309 x86_64 randconfig-a012-20210309 x86_64 randconfig-a011-20210310 x86_64 randconfig-a016-20210310 x86_64 randconfig-a013-20210310 x86_64 randconfig-a015-20210310 x86_64 randconfig-a014-20210310 x86_64 randconfig-a012-20210310 i386 randconfig-a016-20210309 i386 randconfig-a012-20210309 i386 randconfig-a014-20210309 i386 randconfig-a013-20210309 i386 randconfig-a011-20210309 i386 randconfig-a015-20210309 i386 randconfig-a016-20210308 i386 randconfig-a012-20210308 i386 randconfig-a014-20210308 i386 randconfig-a013-20210308 i386 randconfig-a011-20210308 i386 randconfig-a015-20210308 riscv nommu_k210_defconfig riscv allyesconfig riscv nommu_virt_defconfig riscv allnoconfig riscv rv32_defconfig riscv allmodconfig x86_64 allyesconfig x86_64 rhel-7.6-kselftests x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a013-20210308 x86_64 randconfig-a016-20210308 x86_64 randconfig-a015-20210308 x86_64 randconfig-a014-20210308 x86_64 randconfig-a011-20210308 x86_64 randconfig-a012-20210308 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From fabioaiuto83 at gmail.com Wed Mar 10 22:13:35 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Wed, 10 Mar 2021 23:13:35 +0100 Subject: [PATCH] staging: rtl8723bs: align comments In-Reply-To: References: <20210310153717.GA5741@agape.jhs> Message-ID: <20210310160946.GA6421@agape.jhs> On Wed, Mar 10, 2021 at 04:51:44PM +0100, Greg KH wrote: > On Wed, Mar 10, 2021 at 04:37:21PM +0100, Fabio Aiuto wrote: > > fix the following checkpatch warnings: > > > > WARNING: Block comments use * on subsequent lines > > + /* > > + AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k > > -- > > WARNING: Block comments use * on subsequent lines > > +/* > > +op_mode > > > > Signed-off-by: Fabio Aiuto > > --- > > drivers/staging/rtl8723bs/core/rtw_ap.c | 28 ++++++++++++------------- > > 1 file changed, 14 insertions(+), 14 deletions(-) > > > > diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c > > index b6f944b37b08..3a0e4f64466a 100644 > > --- a/drivers/staging/rtl8723bs/core/rtw_ap.c > > +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c > > @@ -721,9 +721,9 @@ static void update_hw_ht_param(struct adapter *padapter) > > > > /* handle A-MPDU parameter field */ > > /* > > - AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k > > - AMPDU_para [4:2]:Min MPDU Start Spacing > > - */ > > + * AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k > > + * AMPDU_para [4:2]:Min MPDU Start Spacing > > + */ > > max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03; > > > > min_MPDU_spacing = ( > > @@ -1815,17 +1815,17 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) > > } > > > > /* > > -op_mode > > -Set to 0 (HT pure) under the following conditions > > - - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or > > - - all STAs in the BSS are 20 MHz HT in 20 MHz BSS > > -Set to 1 (HT non-member protection) if there may be non-HT STAs > > - in both the primary and the secondary channel > > -Set to 2 if only HT STAs are associated in BSS, > > - however and at least one 20 MHz HT STA is associated > > -Set to 3 (HT mixed mode) when one or more non-HT STAs are associated > > - (currently non-GF HT station is considered as non-HT STA also) > > -*/ > > + *op_mode > > + *Set to 0 (HT pure) under the following conditions > > + * - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or > > + * - all STAs in the BSS are 20 MHz HT in 20 MHz BSS > > + *Set to 1 (HT non-member protection) if there may be non-HT STAs > > + * in both the primary and the secondary channel > > + *Set to 2 if only HT STAs are associated in BSS, > > + * however and at least one 20 MHz HT STA is associated > > + *Set to 3 (HT mixed mode) when one or more non-HT STAs are associated > > + * (currently non-GF HT station is considered as non-HT STA also) > > + */ > > Add a space after the ' ' to make it look correct please. > > thanks, > > greg k-h I am sorry, I fear I don't understand, checkpatch.sh script says the patch is ok. Where have I to add a ' ' (a blank?)? thank you, fabio From fabioaiuto83 at gmail.com Wed Mar 10 22:27:31 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Wed, 10 Mar 2021 23:27:31 +0100 Subject: [PATCH v2] staging: rtl8723bs: align and beautify comments Message-ID: <20210310222728.GA3246@agape.jhs> fix the following checkpatch warnings: WARNING: Block comments use * on subsequent lines + /* + AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k -- WARNING: Block comments use * on subsequent lines +/* +op_mode Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_ap.c | 32 ++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c index b6f944b37b08..6d203814260f 100644 --- a/drivers/staging/rtl8723bs/core/rtw_ap.c +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c @@ -719,11 +719,11 @@ static void update_hw_ht_param(struct adapter *padapter) DBG_871X("%s\n", __func__); - /* handle A-MPDU parameter field */ - /* - AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k - AMPDU_para [4:2]:Min MPDU Start Spacing - */ + /* handle A-MPDU parameter field + * + * AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k + * AMPDU_para [4:2]:Min MPDU Start Spacing + */ max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03; min_MPDU_spacing = ( @@ -1815,17 +1815,17 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) } /* -op_mode -Set to 0 (HT pure) under the following conditions - - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or - - all STAs in the BSS are 20 MHz HT in 20 MHz BSS -Set to 1 (HT non-member protection) if there may be non-HT STAs - in both the primary and the secondary channel -Set to 2 if only HT STAs are associated in BSS, - however and at least one 20 MHz HT STA is associated -Set to 3 (HT mixed mode) when one or more non-HT STAs are associated - (currently non-GF HT station is considered as non-HT STA also) -*/ + * op_mode + * Set to 0 (HT pure) under the following conditions + * - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or + * - all STAs in the BSS are 20 MHz HT in 20 MHz BSS + * Set to 1 (HT non-member protection) if there may be non-HT STAs + * in both the primary and the secondary channel + * Set to 2 if only HT STAs are associated in BSS, + * however and at least one 20 MHz HT STA is associated + * Set to 3 (HT mixed mode) when one or more non-HT STAs are associated + * (currently non-GF HT station is considered as non-HT STA also) + */ static int rtw_ht_operation_update(struct adapter *padapter) { u16 cur_op_mode, new_op_mode; -- 2.20.1 From dualli at chromium.org Wed Mar 10 22:52:48 2021 From: dualli at chromium.org (Li Li) Date: Wed, 10 Mar 2021 14:52:48 -0800 Subject: [PATCH v1 0/3] Binder: Enable App Freezing Capability Message-ID: <20210310225251.2577580-1-dualli@chromium.org> From: Li Li To improve the user experience when switching between recently used applications, the background applications which are not currently needed are cached in the memory. Normally, a well designed application will not consume valuable CPU resources in the background. However, it's possible some applications are not able or willing to behave as expected, wasting energy even after being cached. It is a good idea to freeze those applications when they're only being kept alive for the sake of faster startup and energy saving. These kernel patches will provide the necessary infrastructure for user space framework to freeze and thaw a cached process, check the current freezing status and correctly deal with outstanding binder transactions to frozen processes. Marco Ballesio (3): binder: BINDER_FREEZE ioctl binder: use EINTR for interrupted wait for work binder: BINDER_GET_FROZEN_INFO ioctl drivers/android/binder.c | 196 ++++++++++++++++++++++++++-- drivers/android/binder_internal.h | 18 +++ include/uapi/linux/android/binder.h | 20 +++ 3 files changed, 222 insertions(+), 12 deletions(-) -- 2.31.0.rc1.246.gcd05c9c855-goog From dualli at chromium.org Wed Mar 10 22:52:49 2021 From: dualli at chromium.org (Li Li) Date: Wed, 10 Mar 2021 14:52:49 -0800 Subject: [PATCH v1 1/3] binder: BINDER_FREEZE ioctl In-Reply-To: <20210310225251.2577580-1-dualli@chromium.org> References: <20210310225251.2577580-1-dualli@chromium.org> Message-ID: <20210310225251.2577580-2-dualli@chromium.org> From: Marco Ballesio Frozen tasks can't process binder transactions, so a way is required to inform transmitting ends of communication failures due to the frozen state of their receiving counterparts. Additionally, races are possible between transitions to frozen state and binder transactions enqueued to a specific process. Implement BINDER_FREEZE ioctl for user space to inform the binder driver about the intention to freeze or unfreeze a process. When the ioctl is called, block the caller until any pending binder transactions toward the target process are flushed. Return an error to transactions to processes marked as frozen. Signed-off-by: Marco Ballesio Co-developed-by: Todd Kjos Signed-off-by: Todd Kjos Signed-off-by: Li Li --- drivers/android/binder.c | 137 ++++++++++++++++++++++++++-- drivers/android/binder_internal.h | 12 +++ include/uapi/linux/android/binder.h | 13 +++ 3 files changed, 152 insertions(+), 10 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index c119736ca56a..9ec3ba038652 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -1506,6 +1506,10 @@ static void binder_free_transaction(struct binder_transaction *t) if (target_proc) { binder_inner_proc_lock(target_proc); + target_proc->outstanding_txns--; + WARN_ON(target_proc->outstanding_txns < 0); + if (!target_proc->outstanding_txns && target_proc->is_frozen) + wake_up_interruptible_all(&target_proc->freeze_wait); if (t->buffer) t->buffer->transaction = NULL; binder_inner_proc_unlock(target_proc); @@ -2331,10 +2335,11 @@ static int binder_fixup_parent(struct binder_transaction *t, * If the @thread parameter is not NULL, the transaction is always queued * to the waitlist of that specific thread. * - * Return: true if the transactions was successfully queued - * false if the target process or thread is dead + * Return: 0 if the transaction was successfully queued + * BR_DEAD_REPLY if the target process or thread is dead + * BR_FROZEN_REPLY if the target process or thread is frozen */ -static bool binder_proc_transaction(struct binder_transaction *t, +static int binder_proc_transaction(struct binder_transaction *t, struct binder_proc *proc, struct binder_thread *thread) { @@ -2354,10 +2359,13 @@ static bool binder_proc_transaction(struct binder_transaction *t, binder_inner_proc_lock(proc); - if (proc->is_dead || (thread && thread->is_dead)) { + if ((proc->is_frozen && !oneway) || proc->is_dead || + (thread && thread->is_dead)) { + bool proc_is_dead = proc->is_dead + || (thread && thread->is_dead); binder_inner_proc_unlock(proc); binder_node_unlock(node); - return false; + return proc_is_dead ? BR_DEAD_REPLY : BR_FROZEN_REPLY; } if (!thread && !pending_async) @@ -2373,10 +2381,11 @@ static bool binder_proc_transaction(struct binder_transaction *t, if (!pending_async) binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); + proc->outstanding_txns++; binder_inner_proc_unlock(proc); binder_node_unlock(node); - return true; + return 0; } /** @@ -3013,13 +3022,16 @@ static void binder_transaction(struct binder_proc *proc, if (reply) { binder_enqueue_thread_work(thread, tcomplete); binder_inner_proc_lock(target_proc); - if (target_thread->is_dead) { + if (target_thread->is_dead || target_proc->is_frozen) { + return_error = target_thread->is_dead ? + BR_DEAD_REPLY : BR_FROZEN_REPLY; binder_inner_proc_unlock(target_proc); goto err_dead_proc_or_thread; } BUG_ON(t->buffer->async_transaction != 0); binder_pop_transaction_ilocked(target_thread, in_reply_to); binder_enqueue_thread_work_ilocked(target_thread, &t->work); + target_proc->outstanding_txns++; binder_inner_proc_unlock(target_proc); wake_up_interruptible_sync(&target_thread->wait); binder_free_transaction(in_reply_to); @@ -3038,7 +3050,9 @@ static void binder_transaction(struct binder_proc *proc, t->from_parent = thread->transaction_stack; thread->transaction_stack = t; binder_inner_proc_unlock(proc); - if (!binder_proc_transaction(t, target_proc, target_thread)) { + return_error = binder_proc_transaction(t, + target_proc, target_thread); + if (return_error) { binder_inner_proc_lock(proc); binder_pop_transaction_ilocked(thread, t); binder_inner_proc_unlock(proc); @@ -3048,7 +3062,8 @@ static void binder_transaction(struct binder_proc *proc, BUG_ON(target_node == NULL); BUG_ON(t->buffer->async_transaction != 1); binder_enqueue_thread_work(thread, tcomplete); - if (!binder_proc_transaction(t, target_proc, NULL)) + return_error = binder_proc_transaction(t, target_proc, NULL); + if (return_error) goto err_dead_proc_or_thread; } if (target_thread) @@ -3065,7 +3080,6 @@ static void binder_transaction(struct binder_proc *proc, return; err_dead_proc_or_thread: - return_error = BR_DEAD_REPLY; return_error_line = __LINE__; binder_dequeue_work(proc, tcomplete); err_translate_failed: @@ -4298,6 +4312,7 @@ static void binder_free_proc(struct binder_proc *proc) BUG_ON(!list_empty(&proc->todo)); BUG_ON(!list_empty(&proc->delivered_death)); + WARN_ON(proc->outstanding_txns); device = container_of(proc->context, struct binder_device, context); if (refcount_dec_and_test(&device->ref)) { kfree(proc->context->name); @@ -4359,6 +4374,7 @@ static int binder_thread_release(struct binder_proc *proc, (t->to_thread == thread) ? "in" : "out"); if (t->to_thread == thread) { + thread->proc->outstanding_txns--; t->to_proc = NULL; t->to_thread = NULL; if (t->buffer) { @@ -4609,6 +4625,45 @@ static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, return 0; } +static int binder_ioctl_freeze(struct binder_freeze_info *info, + struct binder_proc *target_proc) +{ + int ret = 0; + + if (!info->enable) { + binder_inner_proc_lock(target_proc); + target_proc->is_frozen = false; + binder_inner_proc_unlock(target_proc); + return 0; + } + + /* + * Freezing the target. Prevent new transactions by + * setting frozen state. If timeout specified, wait + * for transactions to drain. + */ + binder_inner_proc_lock(target_proc); + target_proc->is_frozen = true; + binder_inner_proc_unlock(target_proc); + + if (info->timeout_ms > 0) + ret = wait_event_interruptible_timeout( + target_proc->freeze_wait, + (!target_proc->outstanding_txns), + msecs_to_jiffies(info->timeout_ms)); + + if (!ret && target_proc->outstanding_txns) + ret = -EAGAIN; + + if (ret < 0) { + binder_inner_proc_lock(target_proc); + target_proc->is_frozen = false; + binder_inner_proc_unlock(target_proc); + } + + return ret; +} + static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { int ret; @@ -4727,6 +4782,66 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) } break; } + case BINDER_FREEZE: { + struct binder_freeze_info info; + struct binder_proc **target_procs = NULL, *target_proc; + int target_procs_count = 0, i = 0; + + ret = 0; + + if (copy_from_user(&info, ubuf, sizeof(info))) { + ret = -EFAULT; + goto err; + } + + mutex_lock(&binder_procs_lock); + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { + if (target_proc->pid == info.pid) + target_procs_count++; + } + + if (target_procs_count == 0) { + mutex_unlock(&binder_procs_lock); + ret = -EINVAL; + goto err; + } + + target_procs = kcalloc(target_procs_count, + sizeof(struct binder_proc *), + GFP_KERNEL); + + if (!target_procs) { + mutex_unlock(&binder_procs_lock); + ret = -ENOMEM; + goto err; + } + + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { + if (target_proc->pid != info.pid) + continue; + + binder_inner_proc_lock(target_proc); + target_proc->tmp_ref++; + binder_inner_proc_unlock(target_proc); + + target_procs[i++] = target_proc; + } + mutex_unlock(&binder_procs_lock); + + for (i = 0; i < target_procs_count; i++) { + if (ret >= 0) + ret = binder_ioctl_freeze(&info, + target_procs[i]); + + binder_proc_dec_tmpref(target_procs[i]); + } + + kfree(target_procs); + + if (ret < 0) + goto err; + break; + } default: ret = -EINVAL; goto err; @@ -4823,6 +4938,7 @@ static int binder_open(struct inode *nodp, struct file *filp) get_task_struct(current->group_leader); proc->tsk = current->group_leader; INIT_LIST_HEAD(&proc->todo); + init_waitqueue_head(&proc->freeze_wait); proc->default_priority = task_nice(current); /* binderfs stashes devices in i_private */ if (is_binderfs_device(nodp)) { @@ -5035,6 +5151,7 @@ static void binder_deferred_release(struct binder_proc *proc) proc->tmp_ref++; proc->is_dead = true; + proc->is_frozen = false; threads = 0; active_transactions = 0; while ((n = rb_first(&proc->threads))) { diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h index 6cd79011e35d..e6a53e98c6da 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -367,9 +367,18 @@ struct binder_ref { * (protected by binder_deferred_lock) * @deferred_work: bitmap of deferred work to perform * (protected by binder_deferred_lock) + * @outstanding_txns: number of transactions to be transmitted before + * processes in freeze_wait are woken up + * (protected by @inner_lock) * @is_dead: process is dead and awaiting free * when outstanding transactions are cleaned up * (protected by @inner_lock) + * @is_frozen: process is frozen and unable to service + * binder transactions + * (protected by @inner_lock) + * @freeze_wait: waitqueue of processes waiting for all outstanding + * transactions to be processed + * (protected by @inner_lock) * @todo: list of work for this process * (protected by @inner_lock) * @stats: per-process binder statistics @@ -410,7 +419,10 @@ struct binder_proc { struct task_struct *tsk; struct hlist_node deferred_work_node; int deferred_work; + int outstanding_txns; bool is_dead; + bool is_frozen; + wait_queue_head_t freeze_wait; struct list_head todo; struct binder_stats stats; diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h index ec84ad106568..7eb5b818b3c1 100644 --- a/include/uapi/linux/android/binder.h +++ b/include/uapi/linux/android/binder.h @@ -217,6 +217,12 @@ struct binder_node_info_for_ref { __u32 reserved3; }; +struct binder_freeze_info { + __u32 pid; + __u32 enable; + __u32 timeout_ms; +}; + #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) @@ -227,6 +233,7 @@ struct binder_node_info_for_ref { #define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info) #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref) #define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object) +#define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info) /* * NOTE: Two special error codes you should check for when calling @@ -408,6 +415,12 @@ enum binder_driver_return_protocol { * The last transaction (either a bcTRANSACTION or * a bcATTEMPT_ACQUIRE) failed (e.g. out of memory). No parameters. */ + + BR_FROZEN_REPLY = _IO('r', 18), + /* + * The target of the last transaction (either a bcTRANSACTION or + * a bcATTEMPT_ACQUIRE) is frozen. No parameters. + */ }; enum binder_driver_command_protocol { -- 2.31.0.rc1.246.gcd05c9c855-goog From dualli at chromium.org Wed Mar 10 22:52:51 2021 From: dualli at chromium.org (Li Li) Date: Wed, 10 Mar 2021 14:52:51 -0800 Subject: [PATCH v1 3/3] binder: BINDER_GET_FROZEN_INFO ioctl In-Reply-To: <20210310225251.2577580-1-dualli@chromium.org> References: <20210310225251.2577580-1-dualli@chromium.org> Message-ID: <20210310225251.2577580-4-dualli@chromium.org> From: Marco Ballesio User space needs to know if binder transactions occurred to frozen processes. Introduce a new BINDER_GET_FROZEN ioctl and keep track of transactions occurring to frozen proceses. Signed-off-by: Marco Ballesio Signed-off-by: Li Li --- drivers/android/binder.c | 55 +++++++++++++++++++++++++++++ drivers/android/binder_internal.h | 6 ++++ include/uapi/linux/android/binder.h | 7 ++++ 3 files changed, 68 insertions(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 34c3e430a270..00c68b7eb553 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2358,6 +2358,10 @@ static int binder_proc_transaction(struct binder_transaction *t, } binder_inner_proc_lock(proc); + if (proc->is_frozen) { + proc->sync_recv |= !oneway; + proc->async_recv |= oneway; + } if ((proc->is_frozen && !oneway) || proc->is_dead || (thread && thread->is_dead)) { @@ -4632,6 +4636,8 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, if (!info->enable) { binder_inner_proc_lock(target_proc); + target_proc->sync_recv = false; + target_proc->async_recv = false; target_proc->is_frozen = false; binder_inner_proc_unlock(target_proc); return 0; @@ -4643,6 +4649,8 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, * for transactions to drain. */ binder_inner_proc_lock(target_proc); + target_proc->sync_recv = false; + target_proc->async_recv = false; target_proc->is_frozen = true; binder_inner_proc_unlock(target_proc); @@ -4664,6 +4672,33 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, return ret; } +static int binder_ioctl_get_freezer_info( + struct binder_frozen_status_info *info) +{ + struct binder_proc *target_proc; + bool found = false; + + info->sync_recv = 0; + info->async_recv = 0; + + mutex_lock(&binder_procs_lock); + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { + if (target_proc->pid == info->pid) { + found = true; + binder_inner_proc_lock(target_proc); + info->sync_recv |= target_proc->sync_recv; + info->async_recv |= target_proc->async_recv; + binder_inner_proc_unlock(target_proc); + } + } + mutex_unlock(&binder_procs_lock); + + if (!found) + return -EINVAL; + + return 0; +} + static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { int ret; @@ -4842,6 +4877,24 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) goto err; break; } + case BINDER_GET_FROZEN_INFO: { + struct binder_frozen_status_info info; + + if (copy_from_user(&info, ubuf, sizeof(info))) { + ret = -EFAULT; + goto err; + } + + ret = binder_ioctl_get_freezer_info(&info); + if (ret < 0) + goto err; + + if (copy_to_user(ubuf, &info, sizeof(info))) { + ret = -EFAULT; + goto err; + } + break; + } default: ret = -EINVAL; goto err; @@ -5152,6 +5205,8 @@ static void binder_deferred_release(struct binder_proc *proc) proc->is_dead = true; proc->is_frozen = false; + proc->sync_recv = false; + proc->async_recv = false; threads = 0; active_transactions = 0; while ((n = rb_first(&proc->threads))) { diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h index e6a53e98c6da..2872a7de68e1 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -376,6 +376,10 @@ struct binder_ref { * @is_frozen: process is frozen and unable to service * binder transactions * (protected by @inner_lock) + * @sync_recv: process received sync transactions since last frozen + * (protected by @inner_lock) + * @async_recv: process received async transactions since last frozen + * (protected by @inner_lock) * @freeze_wait: waitqueue of processes waiting for all outstanding * transactions to be processed * (protected by @inner_lock) @@ -422,6 +426,8 @@ struct binder_proc { int outstanding_txns; bool is_dead; bool is_frozen; + bool sync_recv; + bool async_recv; wait_queue_head_t freeze_wait; struct list_head todo; diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h index 7eb5b818b3c1..156070d18c4f 100644 --- a/include/uapi/linux/android/binder.h +++ b/include/uapi/linux/android/binder.h @@ -223,6 +223,12 @@ struct binder_freeze_info { __u32 timeout_ms; }; +struct binder_frozen_status_info { + __u32 pid; + __u32 sync_recv; + __u32 async_recv; +}; + #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) @@ -234,6 +240,7 @@ struct binder_freeze_info { #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref) #define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object) #define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info) +#define BINDER_GET_FROZEN_INFO _IOWR('b', 15, struct binder_frozen_status_info) /* * NOTE: Two special error codes you should check for when calling -- 2.31.0.rc1.246.gcd05c9c855-goog From dualli at chromium.org Wed Mar 10 22:52:50 2021 From: dualli at chromium.org (Li Li) Date: Wed, 10 Mar 2021 14:52:50 -0800 Subject: [PATCH v1 2/3] binder: use EINTR for interrupted wait for work In-Reply-To: <20210310225251.2577580-1-dualli@chromium.org> References: <20210310225251.2577580-1-dualli@chromium.org> Message-ID: <20210310225251.2577580-3-dualli@chromium.org> From: Marco Ballesio when interrupted by a signal, binder_wait_for_work currently returns -ERESTARTSYS. This error code isn't propagated to user space, but a way to handle interruption due to signals must be provided to code using this API. Replace this instance of -ERESTARTSYS with -EINTR, which is propagated to user space. Test: built, booted, interrupted a worker thread within binder_wait_for_work Signed-off-by: Marco Ballesio Signed-off-by: Li Li --- drivers/android/binder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 9ec3ba038652..34c3e430a270 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -3710,7 +3710,7 @@ static int binder_wait_for_work(struct binder_thread *thread, binder_inner_proc_lock(proc); list_del_init(&thread->waiting_thread_node); if (signal_pending(current)) { - ret = -ERESTARTSYS; + ret = -EINTR; break; } } @@ -4851,7 +4851,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) if (thread) thread->looper_need_return = false; wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2); - if (ret && ret != -ERESTARTSYS) + if (ret && ret != -EINTR) pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); err_unlocked: trace_binder_ioctl_done(ret); -- 2.31.0.rc1.246.gcd05c9c855-goog From Markintldmmutualcredit at consultant.com Thu Mar 11 00:45:28 2021 From: Markintldmmutualcredit at consultant.com (International Remittance Department.) Date: Wed, 10 Mar 2021 16:45:28 -0800 Subject: International Remittance Department Message-ID: <20210311004537.BC3C32C3CF@187119.cloudwaysapps.com> International Remittance Department. Int' London Mutual Credit Union Bank Add-4 Heaton Road Peckham, SE15 13TH London United Kingdom. Dear Beneficiary Your ATM Visa Card will be shipped through USPS to your Address. I am Mr. Roland de Marcellus, Acting Deputy Assistant Secretary of State for International Finance & Development (BUREAU OF ECONOMIC AND BUSINESS AFFAIRS). This is to inform you officially that after our investigations with the Federal Bureau of Investigation (FBI), Central Intelligence Agency (CIA), and other Security Agencies in the Countries for the year 2017 and 2018, we discovered that you have not yet received yours over due fund. I have made it my first point of call since taking office to settle all Outstanding Payments accrued to Individuals or Corporations with respect to local and overseas contract payment, Debt Rescheduling, and Outstanding Compensation payment. This is to make sure all Outstanding payments are settled this fiscal year 2018. On Behalf of the entire staff of the U.S. Department of State and the United Nations in collaboration with World Bank, we apologize for the delay in your contract paymen t, Winning or Inheritance funds from most the African Countries, and all the inconveniences you encountered while pursuing this payment. However, from the records of outstanding beneficiaries due for payment with the U.S Secretary of State, your name was discovered as next on the list of beneficiaries who has not yet received their payments. I have your file here in my office and it says that you are yet to receive your funds valued at US$1,850,000.00 (One Million, Eight Hundred And Fifty Thousand United States Dollars). This Funds will now be delivered to your designated address on your preferred payment option. We have perfected all modules on how to bring this fund to your designated address without any problem, but be aware that the United Nations and the United States Government have only authorized my office to release the Sum of US$1,850,000.00 to you as true beneficiary of the Funds. Note that your loaded ATM Visa Card will be mailed to you through Priority Mail Express (USP S) to your designated address immediately you admit full compliance to this email. Due to my busy schedules, you are advised to kindly get in contact with our correspondent Mr. Mark Christopher with the below details enclosed to help ensure safe mailing of your ATM Visa Card: ? Your Full Name: ? Your Contact House Address: ? Name of City of Residence: ? Country of Residence: ? Direct Mobile Telephone Number: ? ID Card, DL, or Passport Copy: ? Age and Occupation: Contact Mr. Mark Christopher immediately by emailing the address below: ? Name: Mr.Mark Christopher. ? Email: Markintldmmutualcredit at consultant.com ? Telephone: +1 (915) 229-3346/+447452378992 He is obliged to treat your case with utmost urgency as soon as you contact him and fill out your correct details including all reachable phone numbers for him to get in touch with you via phone and email. NOTE: Every documentation proof for your fund has been packaged and sealed to be mailed together with your Visa Card to your address. Therefore, the only obligation required of you by the laws of the Government of the United States and the financial Monetary Policy of the Supreme Court, states that; you as a beneficiary must officially obtain the irrevocable LEGAL STAY OF PROCEED from the Supreme Court of USA, as a means to justify the legitimacy, transparency and clean bill of funds from the USA so that by the time your funds gets to you, no authority will question the funds as it has been legally certified free from all financial Malpractices and facets. The LEGAL STAY OF PROCEED is valued at a cost of ($550) please take note of that. As soon as the above-mentioned $550 is received, The LEGAL STAY OF PROCEED will be secured on your behalf immediately. I need all the compliance that I can get from you to ensure we get this project accomplished. Personally, I am very sorry for the de lay you have gone through in the past years. Thanks for adhering to this instruction?which is meant for your sole benefit, once again accept my congratulations in advance. Thanks for your cooperation as your quick response to this email notice with adherence to the above instructions is highly anticipated. Yours Sincerely, Mr Roland de Marcellus. From lkp at intel.com Thu Mar 11 01:36:30 2021 From: lkp at intel.com (kernel test robot) Date: Thu, 11 Mar 2021 09:36:30 +0800 Subject: [staging:staging-testing] BUILD SUCCESS 31673785d5353b8a8e882fc51ef315cc197f4483 Message-ID: <6049741e.z9UTgvudV/5Nlx/D%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-testing branch HEAD: 31673785d5353b8a8e882fc51ef315cc197f4483 staging: dpaa2-switch: prevent joining a bridge while VLAN uppers are present elapsed time: 729m configs tested: 139 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig m68k hp300_defconfig powerpc adder875_defconfig powerpc mpc8313_rdb_defconfig powerpc ppc40x_defconfig mips pistachio_defconfig powerpc mpc837x_rdb_defconfig powerpc pq2fads_defconfig powerpc obs600_defconfig powerpc holly_defconfig powerpc kmeter1_defconfig riscv rv32_defconfig arm mxs_defconfig sh microdev_defconfig mips capcella_defconfig arm mvebu_v7_defconfig xtensa cadence_csp_defconfig arm pxa_defconfig powerpc tqm8541_defconfig sh polaris_defconfig powerpc ep88xc_defconfig mips rbtx49xx_defconfig powerpc mpc512x_defconfig sh se7750_defconfig arm eseries_pxa_defconfig sh alldefconfig powerpc katmai_defconfig m68k m5275evb_defconfig sh dreamcast_defconfig microblaze defconfig powerpc ppc44x_defconfig powerpc mpc836x_mds_defconfig sh lboxre2_defconfig sh rts7751r2d1_defconfig powerpc ge_imp3a_defconfig arm hackkit_defconfig mips loongson1b_defconfig h8300 alldefconfig arm xcep_defconfig arc tb10x_defconfig arm ep93xx_defconfig powerpc stx_gp3_defconfig arm pxa910_defconfig powerpc icon_defconfig arm colibri_pxa300_defconfig arm at91_dt_defconfig arm pcm027_defconfig sh rsk7201_defconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig i386 allyesconfig sparc allyesconfig sparc defconfig i386 tinyconfig i386 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a005-20210309 i386 randconfig-a003-20210309 i386 randconfig-a002-20210309 i386 randconfig-a006-20210309 i386 randconfig-a004-20210309 i386 randconfig-a001-20210309 x86_64 randconfig-a013-20210309 x86_64 randconfig-a016-20210309 x86_64 randconfig-a015-20210309 x86_64 randconfig-a014-20210309 x86_64 randconfig-a011-20210309 x86_64 randconfig-a012-20210309 x86_64 randconfig-a011-20210310 x86_64 randconfig-a016-20210310 x86_64 randconfig-a013-20210310 x86_64 randconfig-a015-20210310 x86_64 randconfig-a014-20210310 x86_64 randconfig-a012-20210310 i386 randconfig-a016-20210309 i386 randconfig-a012-20210309 i386 randconfig-a014-20210309 i386 randconfig-a013-20210309 i386 randconfig-a011-20210309 i386 randconfig-a015-20210309 x86_64 randconfig-a006-20210308 x86_64 randconfig-a001-20210308 x86_64 randconfig-a004-20210308 x86_64 randconfig-a002-20210308 x86_64 randconfig-a005-20210308 x86_64 randconfig-a003-20210308 riscv nommu_k210_defconfig riscv allyesconfig riscv nommu_virt_defconfig riscv allnoconfig riscv defconfig riscv allmodconfig x86_64 allyesconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a006-20210309 x86_64 randconfig-a001-20210309 x86_64 randconfig-a004-20210309 x86_64 randconfig-a002-20210309 x86_64 randconfig-a005-20210309 x86_64 randconfig-a003-20210309 x86_64 randconfig-a013-20210308 x86_64 randconfig-a016-20210308 x86_64 randconfig-a015-20210308 x86_64 randconfig-a014-20210308 x86_64 randconfig-a011-20210308 x86_64 randconfig-a012-20210308 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From "" at iperbole.bologna.it Thu Mar 11 05:33:01 2021 From: "" at iperbole.bologna.it (Hallo) Date: Wed, 10 Mar 2021 19:33:01 -1000 Subject: Hallo lieber Freund.. Message-ID: <20210311053303.AA900104BBCF@iperbole.bologna.it> Meine Namen sind Herr Yi Huiman, ehemaliger Pr?sident der Agricultural Bank of China und derzeitige China Securities Regulatory Commission (CSRC). Ich melde mich bei Ihnen bez?glich des Nachlasses eines verstorbenen Kunden, der vor 12 Jahren eine Investition unter die Leitung unserer Bank gestellt hat. In Bezug auf das oben genannte Thema hat der verstorbene Einleger nur in meiner Filiale eine Einzahlung von f?nfundvierzig Millionen, zweihundertf?nfundsiebzigtausend Dollar (45.275.000,00 USD) get?tigt. Vor einigen Monaten wurde ihm eine Reihe von Mitteilungen zugesandt, weil er nicht in Betrieb war das Konto und wir entdeckten sp?ter, dass der verstorbene Einleger an COVID-19-Komplikationen starb. Vor seinem Tod erw?hnte er in unseren Unterlagen weder einen Angeh?rigen noch einen Nutznie?er. Als sein pers?nlicher Kundenbetreuer und Finanzberater war die Sicherheitsfirma sowie das Management meiner Bank bis heute bei mir, um einen Angeh?rigen oder Beg?nstigten seines Nachlasses zur Verf?gung zu stellen In dieser Angelegenheit besteht kein Risiko, da ich den Schl?ssel zu den Fonds besitze und wir eine legitime Methode anwenden werden, da ich alle Papierarbeiten haben werde, um Sie zum n?chsten Angeh?rigen der Fonds zu machen, sobald ich eine Antwort von erhalte Sie. Ich werde Ihnen mehr ?ber diesen Vorschlag erz?hlen, den Sie unter meiner E-Mail-Adresse afc9414044 at gmail.com erreichen k?nnen Herr Yi Huiman Vorsitzender der China Securities Regulatory Commission (CSRC) Private E-Mail: info at huiman.cf From penghaob at uniontech.com Thu Mar 11 06:38:38 2021 From: penghaob at uniontech.com (Hao Peng) Date: Thu, 11 Mar 2021 14:38:38 +0800 Subject: [PATCH] staging: rtl8723bs: add initial value Message-ID: <20210311063838.19756-1-penghaob@uniontech.com> Add initial value for some uninitialized variable and array. Signed-off-by: Hao Peng --- drivers/staging/rtl8723bs/core/rtw_ap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c index b6f944b37b08..ceea160db38a 100644 --- a/drivers/staging/rtl8723bs/core/rtw_ap.c +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c @@ -206,8 +206,8 @@ void expire_timeout_chk(struct adapter *padapter) struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; u8 chk_alive_num = 0; - char chk_alive_list[NUM_STA]; - int i; + char chk_alive_list[NUM_STA] = {0}; + int i = 0; spin_lock_bh(&pstapriv->auth_list_lock); @@ -308,7 +308,7 @@ void expire_timeout_chk(struct adapter *padapter) } } if (pmlmeext->active_keep_alive_check) { - int stainfo_offset; + int stainfo_offset = 0; stainfo_offset = rtw_stainfo_offset(pstapriv, psta); if (stainfo_offset_valid(stainfo_offset)) -- 2.20.1 From gregkh at linuxfoundation.org Thu Mar 11 07:33:42 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Thu, 11 Mar 2021 08:33:42 +0100 Subject: [PATCH v1 1/3] binder: BINDER_FREEZE ioctl In-Reply-To: <20210310225251.2577580-2-dualli@chromium.org> References: <20210310225251.2577580-1-dualli@chromium.org> <20210310225251.2577580-2-dualli@chromium.org> Message-ID: On Wed, Mar 10, 2021 at 02:52:49PM -0800, Li Li wrote: > if (target_proc) { > binder_inner_proc_lock(target_proc); > + target_proc->outstanding_txns--; > + WARN_ON(target_proc->outstanding_txns < 0); WARN_* is a huge crutch, please just handle stuff like this properly and if you really need to, warn userspace (but what can they do about it?) You also just rebooted all systems that have panic-on-warn set, so if this can be triggered by userspace, you caused a DoS of things :( So please remove all of the WARN_ON() you add in this patch series to properly handle the error conditions and deal with them correctly. And if these were here just for debugging, hopefully the code works properly now and you do not need debugging anymore so they can all just be dropped. thanks, greg k-h From colin.king at canonical.com Thu Mar 11 09:33:04 2021 From: colin.king at canonical.com (Colin King) Date: Thu, 11 Mar 2021 09:33:04 +0000 Subject: [PATCH] staging: rtl8723bs: Fix spelling mistake "disabed" -> "disabled" Message-ID: <20210311093304.5573-1-colin.king@canonical.com> From: Colin Ian King There is a spelling mistake in a comment, fix it. Signed-off-by: Colin Ian King --- drivers/staging/rtl8723bs/include/wifi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h index fe984fcb66a9..4080803d9b1b 100644 --- a/drivers/staging/rtl8723bs/include/wifi.h +++ b/drivers/staging/rtl8723bs/include/wifi.h @@ -719,7 +719,7 @@ struct ADDBA_request { #define P2P_WILDCARD_SSID_LEN 7 -#define P2P_FINDPHASE_EX_NONE 0 /* default value, used when: (1)p2p disabed or (2)p2p enabled but only do 1 scan phase */ +#define P2P_FINDPHASE_EX_NONE 0 /* default value, used when: (1)p2p disabled or (2)p2p enabled but only do 1 scan phase */ #define P2P_FINDPHASE_EX_FULL 1 /* used when p2p enabled and want to do 1 scan phase and P2P_FINDPHASE_EX_MAX-1 find phase */ #define P2P_FINDPHASE_EX_SOCIAL_FIRST (P2P_FINDPHASE_EX_FULL+1) #define P2P_FINDPHASE_EX_MAX 4 -- 2.30.2 From dualli at chromium.org Thu Mar 11 09:36:26 2021 From: dualli at chromium.org (Li Li) Date: Thu, 11 Mar 2021 01:36:26 -0800 Subject: [PATCH v1 1/3] binder: BINDER_FREEZE ioctl In-Reply-To: References: <20210310225251.2577580-1-dualli@chromium.org> <20210310225251.2577580-2-dualli@chromium.org> Message-ID: On Wed, Mar 10, 2021 at 11:33 PM Greg KH wrote: > > On Wed, Mar 10, 2021 at 02:52:49PM -0800, Li Li wrote: > > if (target_proc) { > > binder_inner_proc_lock(target_proc); > > + target_proc->outstanding_txns--; > > + WARN_ON(target_proc->outstanding_txns < 0); > > WARN_* is a huge crutch, please just handle stuff like this properly and > if you really need to, warn userspace (but what can they do about it?) > > You also just rebooted all systems that have panic-on-warn set, so if > this can be triggered by userspace, you caused a DoS of things :( > > So please remove all of the WARN_ON() you add in this patch series to > properly handle the error conditions and deal with them correctly. > > And if these were here just for debugging, hopefully the code works > properly now and you do not need debugging anymore so they can all just > be dropped. When the target_proc is freed, there's no outstanding transactions already. The FREEZE ioctl from userspace won't trigger this. It's for debugging. And I'll remove it in v2. Thanks for the suggestion! From gregkh at linuxfoundation.org Thu Mar 11 09:44:28 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Thu, 11 Mar 2021 10:44:28 +0100 Subject: [PATCH v1 1/3] binder: BINDER_FREEZE ioctl In-Reply-To: References: <20210310225251.2577580-1-dualli@chromium.org> <20210310225251.2577580-2-dualli@chromium.org> Message-ID: On Thu, Mar 11, 2021 at 01:36:26AM -0800, Li Li wrote: > On Wed, Mar 10, 2021 at 11:33 PM Greg KH wrote: > > > > On Wed, Mar 10, 2021 at 02:52:49PM -0800, Li Li wrote: > > > if (target_proc) { > > > binder_inner_proc_lock(target_proc); > > > + target_proc->outstanding_txns--; > > > + WARN_ON(target_proc->outstanding_txns < 0); > > > > WARN_* is a huge crutch, please just handle stuff like this properly and > > if you really need to, warn userspace (but what can they do about it?) > > > > You also just rebooted all systems that have panic-on-warn set, so if > > this can be triggered by userspace, you caused a DoS of things :( > > > > So please remove all of the WARN_ON() you add in this patch series to > > properly handle the error conditions and deal with them correctly. > > > > And if these were here just for debugging, hopefully the code works > > properly now and you do not need debugging anymore so they can all just > > be dropped. > > When the target_proc is freed, there's no outstanding transactions already. > The FREEZE ioctl from userspace won't trigger this. It's for debugging. It's ok to test for this, to verify all is good, just do not reboot people's machines if the test fails :) thanks, greg k-h From eli.billauer at gmail.com Thu Mar 11 09:50:31 2021 From: eli.billauer at gmail.com (eli.billauer at gmail.com) Date: Thu, 11 Mar 2021 11:50:31 +0200 Subject: [PATCH v4 0/2] Submission of XillyUSB driver Message-ID: <20210311095033.20956-1-eli.billauer@gmail.com> From: Eli Billauer This is a resubmission of the XillyUSB driver, which is the USB variant of the existing Xillybus driver. Because these driver share some API related functions, this submission consists of two patches: (1) A patch moving away Xillybus' class related functions to a separate module file. (2) A patch adding the new XillyUSB driver, based upon this new separate module. As far as I can tell, the shared code between the Xillybus and XillyUSB drivers covers everything that makes sense to share. I submit XillyUSB as a staging driver, with the hope for a detailed review on this issue, as well as a general code audit. Thanks, Eli Eli Billauer (2): char: xillybus: Move class-related functions to new xillybus_class.c staging: Add driver for XillyUSB (Xillybus variant for USB) MAINTAINERS | 1 + drivers/char/xillybus/Kconfig | 4 + drivers/char/xillybus/Makefile | 1 + drivers/char/xillybus/xillybus.h | 10 +- drivers/char/xillybus/xillybus_class.c | 263 +++ drivers/char/xillybus/xillybus_core.c | 181 +- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/xillyusb/Kconfig | 20 + drivers/staging/xillyusb/Makefile | 6 + drivers/staging/xillyusb/TODO | 13 + drivers/staging/xillyusb/xillyusb.c | 2184 ++++++++++++++++++++++++ include/linux/xillybus_class.h | 30 + 13 files changed, 2549 insertions(+), 167 deletions(-) create mode 100644 drivers/char/xillybus/xillybus_class.c create mode 100644 drivers/staging/xillyusb/Kconfig create mode 100644 drivers/staging/xillyusb/Makefile create mode 100644 drivers/staging/xillyusb/TODO create mode 100644 drivers/staging/xillyusb/xillyusb.c create mode 100644 include/linux/xillybus_class.h -- 2.17.1 From eli.billauer at gmail.com Thu Mar 11 09:50:32 2021 From: eli.billauer at gmail.com (eli.billauer at gmail.com) Date: Thu, 11 Mar 2021 11:50:32 +0200 Subject: [PATCH v4 1/2] char: xillybus: Move class-related functions to new xillybus_class.c In-Reply-To: <20210311095033.20956-1-eli.billauer@gmail.com> References: <20210311095033.20956-1-eli.billauer@gmail.com> Message-ID: <20210311095033.20956-2-eli.billauer@gmail.com> From: Eli Billauer This patch is a preparation for adding another related driver, XillyUSB. In order to share some code between the existing Xillybus driver and the one to be added, some functions are moved to xillybus_class.c The header file, xillybus_class.h, is temporarily placed in include/linux/, because the new XillyUSB driver is intended as a staging driver for the time being. Signed-off-by: Eli Billauer --- Notes: Changelog: v4: - Fix error code return value bugs in xillybus_init_chrdev() as detected by Smatch test robot, and reported by Dan Carpenter. This patch did not exist prior to v3. drivers/char/xillybus/Kconfig | 4 + drivers/char/xillybus/Makefile | 1 + drivers/char/xillybus/xillybus.h | 10 +- drivers/char/xillybus/xillybus_class.c | 263 +++++++++++++++++++++++++ drivers/char/xillybus/xillybus_core.c | 181 +++-------------- include/linux/xillybus_class.h | 30 +++ 6 files changed, 322 insertions(+), 167 deletions(-) create mode 100644 drivers/char/xillybus/xillybus_class.c create mode 100644 include/linux/xillybus_class.h diff --git a/drivers/char/xillybus/Kconfig b/drivers/char/xillybus/Kconfig index 130dbdce858f..e7800f025249 100644 --- a/drivers/char/xillybus/Kconfig +++ b/drivers/char/xillybus/Kconfig @@ -3,10 +3,14 @@ # Xillybus devices # +config XILLYBUS_CLASS + tristate + config XILLYBUS tristate "Xillybus generic FPGA interface" depends on PCI || OF select CRC32 + select XILLYBUS_CLASS help Xillybus is a generic interface for peripherals designed on programmable logic (FPGA). The driver probes the hardware for diff --git a/drivers/char/xillybus/Makefile b/drivers/char/xillybus/Makefile index 099e9a3585fc..591615264591 100644 --- a/drivers/char/xillybus/Makefile +++ b/drivers/char/xillybus/Makefile @@ -3,6 +3,7 @@ # Makefile for Xillybus driver # +obj-$(CONFIG_XILLYBUS_CLASS) += xillybus_class.o obj-$(CONFIG_XILLYBUS) += xillybus_core.o obj-$(CONFIG_XILLYBUS_PCIE) += xillybus_pcie.o obj-$(CONFIG_XILLYBUS_OF) += xillybus_of.o diff --git a/drivers/char/xillybus/xillybus.h b/drivers/char/xillybus/xillybus.h index 8e3ed4d1bb7f..c63ffc56637c 100644 --- a/drivers/char/xillybus/xillybus.h +++ b/drivers/char/xillybus/xillybus.h @@ -30,7 +30,8 @@ struct xilly_buffer { struct xilly_idt_handle { unsigned char *chandesc; - unsigned char *idt; + unsigned char *names; + int names_len; int entries; }; @@ -94,7 +95,6 @@ struct xilly_endpoint { struct device *dev; struct xilly_endpoint_hardware *ephw; - struct list_head ep_list; int dma_using_dac; /* =1 if 64-bit DMA is used, =0 otherwise. */ __iomem void *registers; int fatal_error; @@ -102,12 +102,6 @@ struct xilly_endpoint { struct mutex register_mutex; wait_queue_head_t ep_wait; - /* Channels and message handling */ - struct cdev cdev; - - int major; - int lowest_minor; /* Highest minor = lowest_minor + num_channels - 1 */ - int num_channels; /* EXCLUDING message buffer */ struct xilly_channel **channels; int msg_counter; diff --git a/drivers/char/xillybus/xillybus_class.c b/drivers/char/xillybus/xillybus_class.c new file mode 100644 index 000000000000..f97edb719df1 --- /dev/null +++ b/drivers/char/xillybus/xillybus_class.c @@ -0,0 +1,263 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright 2021 Xillybus Ltd, http://xillybus.com + * + * Driver for the Xillybus class + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +MODULE_DESCRIPTION("Driver for Xillybus class"); +MODULE_AUTHOR("Eli Billauer, Xillybus Ltd."); +MODULE_VERSION("1.0"); +MODULE_ALIAS("xillybus_class"); +MODULE_LICENSE("GPL v2"); + +static DEFINE_MUTEX(unit_mutex); +static LIST_HEAD(unit_list); +static struct class *xillybus_class; + +#define UNITNAMELEN 16 + +struct xilly_unit { + struct list_head list_entry; + void *private_data; + + struct cdev *cdev; + char name[UNITNAMELEN]; + int major; + int lowest_minor; + int num_nodes; +}; + +int xillybus_init_chrdev(struct device *dev, + const struct file_operations *fops, + struct module *owner, + void *private_data, + unsigned char *idt, unsigned int len, + int num_nodes, + const char *prefix, bool enumerate) +{ + int rc; + dev_t mdev; + int i; + char devname[48]; + + struct device *device; + size_t namelen; + struct xilly_unit *unit, *u; + + unit = kzalloc(sizeof(*unit), GFP_KERNEL); + + if (!unit) + return -ENOMEM; + + mutex_lock(&unit_mutex); + + if (!enumerate) + snprintf(unit->name, UNITNAMELEN, "%s", prefix); + + for (i = 0; enumerate; i++) { + snprintf(unit->name, UNITNAMELEN, "%s_%02d", + prefix, i); + + enumerate = false; + list_for_each_entry(u, &unit_list, list_entry) + if (!strcmp(unit->name, u->name)) { + enumerate = true; + break; + } + } + + rc = alloc_chrdev_region(&mdev, 0, num_nodes, unit->name); + + if (rc) { + dev_warn(dev, "Failed to obtain major/minors"); + goto fail_obtain; + } + + unit->major = MAJOR(mdev); + unit->lowest_minor = MINOR(mdev); + unit->num_nodes = num_nodes; + unit->private_data = private_data; + + unit->cdev = cdev_alloc(); + if (!unit->cdev) { + rc = -ENOMEM; + goto unregister_chrdev; + } + unit->cdev->ops = fops; + unit->cdev->owner = owner; + + rc = cdev_add(unit->cdev, MKDEV(unit->major, unit->lowest_minor), + unit->num_nodes); + if (rc) { + dev_err(dev, "Failed to add cdev.\n"); + /* kobject_put() is normally done by cdev_del() */ + kobject_put(&unit->cdev->kobj); + goto unregister_chrdev; + } + + for (i = 0; i < num_nodes; i++) { + namelen = strnlen(idt, len); + + if (namelen == len) { + dev_err(dev, "IDT's list of names is too short. This is exceptionally weird, because its CRC is OK\n"); + rc = -ENODEV; + goto unroll_device_create; + } + + snprintf(devname, sizeof(devname), "%s_%s", + unit->name, idt); + + len -= namelen + 1; + idt += namelen + 1; + + device = device_create(xillybus_class, + NULL, + MKDEV(unit->major, + i + unit->lowest_minor), + NULL, + "%s", devname); + + if (IS_ERR(device)) { + dev_err(dev, "Failed to create %s device. Aborting.\n", + devname); + rc = -ENODEV; + goto unroll_device_create; + } + } + + if (len) { + dev_err(dev, "IDT's list of names is too long. This is exceptionally weird, because its CRC is OK\n"); + rc = -ENODEV; + goto unroll_device_create; + } + + list_add_tail(&unit->list_entry, &unit_list); + + dev_info(dev, "Created %d device files.\n", num_nodes); + + mutex_unlock(&unit_mutex); + + return 0; + +unroll_device_create: + for (i--; i >= 0; i--) + device_destroy(xillybus_class, MKDEV(unit->major, + i + unit->lowest_minor)); + + cdev_del(unit->cdev); + +unregister_chrdev: + unregister_chrdev_region(MKDEV(unit->major, unit->lowest_minor), + unit->num_nodes); + +fail_obtain: + mutex_unlock(&unit_mutex); + + kfree(unit); + + return rc; +} +EXPORT_SYMBOL(xillybus_init_chrdev); + +void xillybus_cleanup_chrdev(void *private_data, + struct device *dev) +{ + int minor; + struct xilly_unit *unit; + bool found = false; + + mutex_lock(&unit_mutex); + + list_for_each_entry(unit, &unit_list, list_entry) + if (unit->private_data == private_data) { + found = true; + break; + } + + if (!found) { + dev_err(dev, "Weird bug: Failed to find unit\n"); + mutex_unlock(&unit_mutex); + return; + } + + for (minor = unit->lowest_minor; + minor < (unit->lowest_minor + unit->num_nodes); + minor++) + device_destroy(xillybus_class, MKDEV(unit->major, minor)); + + cdev_del(unit->cdev); + + unregister_chrdev_region(MKDEV(unit->major, unit->lowest_minor), + unit->num_nodes); + + dev_info(dev, "Removed %d device files.\n", + unit->num_nodes); + + list_del(&unit->list_entry); + kfree(unit); + + mutex_unlock(&unit_mutex); +} +EXPORT_SYMBOL(xillybus_cleanup_chrdev); + +int xillybus_find_inode(struct inode *inode, + void **private_data, int *index) +{ + int minor = iminor(inode); + int major = imajor(inode); + struct xilly_unit *unit; + bool found = false; + + mutex_lock(&unit_mutex); + + list_for_each_entry(unit, &unit_list, list_entry) + if (unit->major == major && + minor >= unit->lowest_minor && + minor < (unit->lowest_minor + unit->num_nodes)) { + found = true; + break; + } + + mutex_unlock(&unit_mutex); + + if (!found) + return -ENODEV; + + *private_data = unit->private_data; + *index = minor - unit->lowest_minor; + + return 0; +} +EXPORT_SYMBOL(xillybus_find_inode); + +static int __init xillybus_class_init(void) +{ + xillybus_class = class_create(THIS_MODULE, "xillybus"); + + if (IS_ERR(xillybus_class)) { + pr_warn("Failed to register xillybus class\n"); + + return PTR_ERR(xillybus_class); + } + return 0; +} + +static void __exit xillybus_class_exit(void) +{ + class_destroy(xillybus_class); +} + +module_init(xillybus_class_init); +module_exit(xillybus_class_exit); diff --git a/drivers/char/xillybus/xillybus_core.c b/drivers/char/xillybus/xillybus_core.c index 57fa68834981..57884fdd07d8 100644 --- a/drivers/char/xillybus/xillybus_core.c +++ b/drivers/char/xillybus/xillybus_core.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -30,10 +29,11 @@ #include #include #include "xillybus.h" +#include MODULE_DESCRIPTION("Xillybus core functions"); MODULE_AUTHOR("Eli Billauer, Xillybus Ltd."); -MODULE_VERSION("1.07"); +MODULE_VERSION("1.10"); MODULE_ALIAS("xillybus_core"); MODULE_LICENSE("GPL v2"); @@ -58,16 +58,6 @@ MODULE_LICENSE("GPL v2"); static const char xillyname[] = "xillybus"; -static struct class *xillybus_class; - -/* - * ep_list_lock is the last lock to be taken; No other lock requests are - * allowed while holding it. It merely protects list_of_endpoints, and not - * the endpoints listed in it. - */ - -static LIST_HEAD(list_of_endpoints); -static struct mutex ep_list_lock; static struct workqueue_struct *xillybus_wq; /* @@ -570,10 +560,8 @@ static int xilly_scan_idt(struct xilly_endpoint *endpoint, unsigned char *scan; int len; - scan = idt; - idt_handle->idt = idt; - - scan++; /* Skip version number */ + scan = idt + 1; + idt_handle->names = scan; while ((scan <= end_of_idt) && *scan) { while ((scan <= end_of_idt) && *scan++) @@ -581,6 +569,8 @@ static int xilly_scan_idt(struct xilly_endpoint *endpoint, count++; } + idt_handle->names_len = scan - idt_handle->names; + scan++; if (scan > end_of_idt) { @@ -1407,36 +1397,20 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf, static int xillybus_open(struct inode *inode, struct file *filp) { - int rc = 0; + int rc; unsigned long flags; - int minor = iminor(inode); - int major = imajor(inode); - struct xilly_endpoint *ep_iter, *endpoint = NULL; + struct xilly_endpoint *endpoint; struct xilly_channel *channel; + int index; - mutex_lock(&ep_list_lock); - - list_for_each_entry(ep_iter, &list_of_endpoints, ep_list) { - if ((ep_iter->major == major) && - (minor >= ep_iter->lowest_minor) && - (minor < (ep_iter->lowest_minor + - ep_iter->num_channels))) { - endpoint = ep_iter; - break; - } - } - mutex_unlock(&ep_list_lock); - - if (!endpoint) { - pr_err("xillybus: open() failed to find a device for major=%d and minor=%d\n", - major, minor); - return -ENODEV; - } + rc = xillybus_find_inode(inode, (void **)&endpoint, &index); + if (rc) + return rc; if (endpoint->fatal_error) return -EIO; - channel = endpoint->channels[1 + minor - endpoint->lowest_minor]; + channel = endpoint->channels[1 + index]; filp->private_data = channel; /* @@ -1799,95 +1773,6 @@ static const struct file_operations xillybus_fops = { .poll = xillybus_poll, }; -static int xillybus_init_chrdev(struct xilly_endpoint *endpoint, - const unsigned char *idt) -{ - int rc; - dev_t dev; - int devnum, i, minor, major; - char devname[48]; - struct device *device; - - rc = alloc_chrdev_region(&dev, 0, /* minor start */ - endpoint->num_channels, - xillyname); - if (rc) { - dev_warn(endpoint->dev, "Failed to obtain major/minors"); - return rc; - } - - endpoint->major = major = MAJOR(dev); - endpoint->lowest_minor = minor = MINOR(dev); - - cdev_init(&endpoint->cdev, &xillybus_fops); - endpoint->cdev.owner = endpoint->ephw->owner; - rc = cdev_add(&endpoint->cdev, MKDEV(major, minor), - endpoint->num_channels); - if (rc) { - dev_warn(endpoint->dev, "Failed to add cdev. Aborting.\n"); - goto unregister_chrdev; - } - - idt++; - - for (i = minor, devnum = 0; - devnum < endpoint->num_channels; - devnum++, i++) { - snprintf(devname, sizeof(devname)-1, "xillybus_%s", idt); - - devname[sizeof(devname)-1] = 0; /* Should never matter */ - - while (*idt++) - /* Skip to next */; - - device = device_create(xillybus_class, - NULL, - MKDEV(major, i), - NULL, - "%s", devname); - - if (IS_ERR(device)) { - dev_warn(endpoint->dev, - "Failed to create %s device. Aborting.\n", - devname); - rc = -ENODEV; - goto unroll_device_create; - } - } - - dev_info(endpoint->dev, "Created %d device files.\n", - endpoint->num_channels); - return 0; /* succeed */ - -unroll_device_create: - devnum--; i--; - for (; devnum >= 0; devnum--, i--) - device_destroy(xillybus_class, MKDEV(major, i)); - - cdev_del(&endpoint->cdev); -unregister_chrdev: - unregister_chrdev_region(MKDEV(major, minor), endpoint->num_channels); - - return rc; -} - -static void xillybus_cleanup_chrdev(struct xilly_endpoint *endpoint) -{ - int minor; - - for (minor = endpoint->lowest_minor; - minor < (endpoint->lowest_minor + endpoint->num_channels); - minor++) - device_destroy(xillybus_class, MKDEV(endpoint->major, minor)); - cdev_del(&endpoint->cdev); - unregister_chrdev_region(MKDEV(endpoint->major, - endpoint->lowest_minor), - endpoint->num_channels); - - dev_info(endpoint->dev, "Removed %d device files.\n", - endpoint->num_channels); -} - struct xilly_endpoint *xillybus_init_endpoint(struct pci_dev *pdev, struct device *dev, struct xilly_endpoint_hardware @@ -2027,28 +1912,20 @@ int xillybus_endpoint_discovery(struct xilly_endpoint *endpoint) if (rc) goto failed_idt; - /* - * endpoint is now completely configured. We put it on the list - * available to open() before registering the char device(s) - */ - - mutex_lock(&ep_list_lock); - list_add_tail(&endpoint->ep_list, &list_of_endpoints); - mutex_unlock(&ep_list_lock); + rc = xillybus_init_chrdev(dev, &xillybus_fops, + endpoint->ephw->owner, endpoint, + idt_handle.names, + idt_handle.names_len, + endpoint->num_channels, + xillyname, false); - rc = xillybus_init_chrdev(endpoint, idt_handle.idt); if (rc) - goto failed_chrdevs; + goto failed_idt; devres_release_group(dev, bootstrap_resources); return 0; -failed_chrdevs: - mutex_lock(&ep_list_lock); - list_del(&endpoint->ep_list); - mutex_unlock(&ep_list_lock); - failed_idt: xilly_quiesce(endpoint); flush_workqueue(xillybus_wq); @@ -2059,11 +1936,7 @@ EXPORT_SYMBOL(xillybus_endpoint_discovery); void xillybus_endpoint_remove(struct xilly_endpoint *endpoint) { - xillybus_cleanup_chrdev(endpoint); - - mutex_lock(&ep_list_lock); - list_del(&endpoint->ep_list); - mutex_unlock(&ep_list_lock); + xillybus_cleanup_chrdev(endpoint, endpoint->dev); xilly_quiesce(endpoint); @@ -2077,17 +1950,9 @@ EXPORT_SYMBOL(xillybus_endpoint_remove); static int __init xillybus_init(void) { - mutex_init(&ep_list_lock); - - xillybus_class = class_create(THIS_MODULE, xillyname); - if (IS_ERR(xillybus_class)) - return PTR_ERR(xillybus_class); - xillybus_wq = alloc_workqueue(xillyname, 0, 0); - if (!xillybus_wq) { - class_destroy(xillybus_class); + if (!xillybus_wq) return -ENOMEM; - } return 0; } @@ -2096,8 +1961,6 @@ static void __exit xillybus_exit(void) { /* flush_workqueue() was called for each endpoint released */ destroy_workqueue(xillybus_wq); - - class_destroy(xillybus_class); } module_init(xillybus_init); diff --git a/include/linux/xillybus_class.h b/include/linux/xillybus_class.h new file mode 100644 index 000000000000..5dbfdfc95c65 --- /dev/null +++ b/include/linux/xillybus_class.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright 2021 Xillybus Ltd, http://www.xillybus.com + * + * Header file for the Xillybus class + */ + +#ifndef __XILLYBUS_CLASS_H +#define __XILLYBUS_CLASS_H + +#include +#include +#include +#include + +int xillybus_init_chrdev(struct device *dev, + const struct file_operations *fops, + struct module *owner, + void *private_data, + unsigned char *idt, unsigned int len, + int num_nodes, + const char *prefix, bool enumerate); + +void xillybus_cleanup_chrdev(void *private_data, + struct device *dev); + +int xillybus_find_inode(struct inode *inode, + void **private_data, int *index); + +#endif /* __XILLYBUS_CLASS_H */ -- 2.17.1 From eli.billauer at gmail.com Thu Mar 11 09:50:33 2021 From: eli.billauer at gmail.com (eli.billauer at gmail.com) Date: Thu, 11 Mar 2021 11:50:33 +0200 Subject: [PATCH v4 2/2] staging: Add driver for XillyUSB (Xillybus variant for USB) In-Reply-To: <20210311095033.20956-1-eli.billauer@gmail.com> References: <20210311095033.20956-1-eli.billauer@gmail.com> Message-ID: <20210311095033.20956-3-eli.billauer@gmail.com> From: Eli Billauer The XillyUSB driver is the USB variant for the Xillybus FPGA IP core. Even though it presents a nearly identical API on the FPGA and host, it's almost a complete rewrite of the driver: The framework for exchanging data on a USB bus is fundamentally different from doing the same with a PCIe interface, which leaves very little in common between the existing driver and the new one for XillyUSB. Signed-off-by: Eli Billauer --- Notes: Changelog: v4: (No changes) v3: - Move to staging - Rely on xillybus_class for device file operations - Fix no return value bug in xillyusb_discovery() - Add module parameters for URB buffer size and count v2: - Add comment in Kconfig file, saying XILLYUSB really doesn't depend on XILLYBUS (following comment by Randy Dunlap) - Use SEEK_* predefined constants instead of numbers MAINTAINERS | 1 + drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/xillyusb/Kconfig | 20 + drivers/staging/xillyusb/Makefile | 6 + drivers/staging/xillyusb/TODO | 13 + drivers/staging/xillyusb/xillyusb.c | 2184 +++++++++++++++++++++++++++ 7 files changed, 2227 insertions(+) create mode 100644 drivers/staging/xillyusb/Kconfig create mode 100644 drivers/staging/xillyusb/Makefile create mode 100644 drivers/staging/xillyusb/TODO create mode 100644 drivers/staging/xillyusb/xillyusb.c diff --git a/MAINTAINERS b/MAINTAINERS index d92f85ca831d..1bf73b132e31 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19749,6 +19749,7 @@ M: Eli Billauer L: linux-kernel at vger.kernel.org S: Supported F: drivers/char/xillybus/ +F: drivers/staging/xillyusb/ XLP9XX I2C DRIVER M: George Cherian diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index b22f73d7bfc4..6fcbc6f90224 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -114,4 +114,6 @@ source "drivers/staging/wfx/Kconfig" source "drivers/staging/hikey9xx/Kconfig" +source "drivers/staging/xillyusb/Kconfig" + endif # STAGING diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 2245059e69c7..42dfd6a4ca28 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -47,3 +47,4 @@ obj-$(CONFIG_QLGE) += qlge/ obj-$(CONFIG_WIMAX) += wimax/ obj-$(CONFIG_WFX) += wfx/ obj-y += hikey9xx/ +obj-$(CONFIG_XILLYUSB) += xillyusb/ diff --git a/drivers/staging/xillyusb/Kconfig b/drivers/staging/xillyusb/Kconfig new file mode 100644 index 000000000000..af7251104b42 --- /dev/null +++ b/drivers/staging/xillyusb/Kconfig @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# XillyUSB devices +# + +config XILLYUSB + tristate "Xillybus generic FPGA interface for USB" + depends on USB + select CRC32 + select XILLYBUS_CLASS + help + XillyUSB is the Xillybus variant which uses USB for communicating + with the FPGA. + + Xillybus is a generic interface for peripherals designed on + programmable logic (FPGA). The driver probes the hardware for + its capabilities, and creates device files accordingly. + + Set to M if you want Xillybus to use USB for communicating with + the FPGA. diff --git a/drivers/staging/xillyusb/Makefile b/drivers/staging/xillyusb/Makefile new file mode 100644 index 000000000000..1b45211992f5 --- /dev/null +++ b/drivers/staging/xillyusb/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Makefile for XillyUSB driver +# + +obj-$(CONFIG_XILLYUSB) += xillyusb.o diff --git a/drivers/staging/xillyusb/TODO b/drivers/staging/xillyusb/TODO new file mode 100644 index 000000000000..0cb6a005ada4 --- /dev/null +++ b/drivers/staging/xillyusb/TODO @@ -0,0 +1,13 @@ +XillyUSB driver +=============== + +This driver is the USB counterpart for the driver at drivers/char/xillybus/. +See Documentation/driver-api/xillybus.rst. + +TODO +---- + - Enhance code reuse with the existing Xillybus driver. + + - General code review. + +Patches to: Eli Billauer \ No newline at end of file diff --git a/drivers/staging/xillyusb/xillyusb.c b/drivers/staging/xillyusb/xillyusb.c new file mode 100644 index 000000000000..bcf55c1a380d --- /dev/null +++ b/drivers/staging/xillyusb/xillyusb.c @@ -0,0 +1,2184 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright 2020 Xillybus Ltd, http://xillybus.com + * + * Driver for the XillyUSB FPGA/host framework. + * + * This driver interfaces with a special IP core in an FPGA, setting up + * a pipe between a hardware FIFO in the programmable logic and a device + * file in the host. The number of such pipes and their attributes are + * set up on the logic. This driver detects these automatically and + * creates the device files accordingly. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +MODULE_DESCRIPTION("Driver for XillyUSB FPGA IP Core"); +MODULE_AUTHOR("Eli Billauer, Xillybus Ltd."); +MODULE_VERSION("1.0"); +MODULE_ALIAS("xillyusb"); +MODULE_LICENSE("GPL v2"); + +static unsigned int urb_bufnum = 8; +module_param(urb_bufnum, uint, 0644); +MODULE_PARM_DESC(urb_bufnum, "Number of URB buffers to allocate for each endpoint"); + +static unsigned int urb_buforder = 4; +module_param(urb_buforder, uint, 0644); +MODULE_PARM_DESC(urb_buforder, "Size order of each URB buffer. The buffer size is 2^(urb_buforder+12) bytes"); + +#define XILLY_RX_TIMEOUT (10 * HZ / 1000) +#define XILLY_RESPONSE_TIMEOUT (500 * HZ / 1000) + +#define LOG2_IDT_FIFO_SIZE 16 +#define LOG2_INITIAL_FIFO_BUF_SIZE 16 + +#define MSG_EP_NUM 1 +#define IN_EP_NUM 1 + +static const char xillyname[] = "xillyusb"; +/* err_name is used in log messages, where dev_err() might fail */ +static const char *err_name = xillyname; + +static DEFINE_MUTEX(open_mutex); + +static unsigned int fifo_buf_order; + +#define USB_VENDOR_ID_XILINX 0x03fd +#define USB_VENDOR_ID_ALTERA 0x09fb + +#define USB_PRODUCT_ID_XILLYUSB 0xebbe + +static const struct usb_device_id xillyusb_table[] = { + { USB_DEVICE(USB_VENDOR_ID_XILINX, USB_PRODUCT_ID_XILLYUSB) }, + { USB_DEVICE(USB_VENDOR_ID_ALTERA, USB_PRODUCT_ID_XILLYUSB) }, + { } +}; + +MODULE_DEVICE_TABLE(usb, xillyusb_table); + +struct xillyusb_dev; + +struct xillyfifo { + unsigned int bufsize; /* In bytes, always a power of 2 */ + unsigned int bufnum; + unsigned int size; /* Lazy: Equals bufsize * bufnum */ + unsigned int buf_order; + atomic_t fill; /* Number of bytes in the FIFO */ + wait_queue_head_t waitq; + unsigned int readpos; + unsigned int readbuf; + unsigned int writepos; + unsigned int writebuf; + void **mem; +}; + +struct xillyusb_channel; + +struct xillyusb_endpoint { + struct xillyusb_dev *xdev; + + struct list_head buffers; + struct list_head filled_buffers; + spinlock_t buffers_lock; /* protect these two lists */ + + unsigned int order; + unsigned int buffer_size; + + unsigned int fill_mask; + + int outstanding_urbs; + + struct usb_anchor anchor; + + struct xillyfifo fifo; + + struct work_struct workitem; + bool shutting_down; + + u8 ep_num; +}; + +struct xillyusb_channel { + struct xillyusb_dev *xdev; + + struct xillyfifo *in_fifo; + struct xillyusb_endpoint *out_ep; + struct mutex lock; /* protect @out_ep and @in_fifo */ + + struct mutex in_mutex; /* serialize fops on FPGA to host stream */ + struct mutex out_mutex; /* serialize fops on host to FPGA stream */ + wait_queue_head_t flushq; + + int chan_idx; + + u32 in_consumed_bytes; + u32 in_current_checkpoint; + u32 out_bytes; + + unsigned int in_log2_element_size; + unsigned int out_log2_element_size; + unsigned int in_log2_fifo_size; + unsigned int out_log2_fifo_size; + + unsigned int read_data_ok; /* EOF not arrived (yet) */ + unsigned int poll_used; + unsigned int flushing; + unsigned int flushed; + unsigned int canceled; + + /* Bit fields protected by open_mutex except for initialization */ + unsigned readable:1; + unsigned writable:1; + unsigned open_for_read:1; + unsigned open_for_write:1; + unsigned in_synchronous:1; + unsigned out_synchronous:1; + unsigned in_seekable:1; + unsigned out_seekable:1; +}; + +struct xillybuffer { + struct list_head entry; + struct xillyusb_endpoint *ep; + void *buf; + unsigned int len; +}; + +struct xillyusb_dev { + struct xillyusb_channel *channels; + + struct usb_device *udev; + struct usb_interface *interface; + struct kref kref; + struct mutex io_mutex; /* synchronize I/O with disconnect */ + struct workqueue_struct *workq; + + int error; + spinlock_t error_lock; /* protect @error */ + struct work_struct wakeup_workitem; + + int num_channels; + + struct xillyusb_endpoint *msg_ep; + struct xillyusb_endpoint *in_ep; + + struct mutex msg_mutex; /* serialize opcode transmission */ + int in_bytes_left; + int leftover_chan_num; + unsigned int in_counter; + struct mutex process_in_mutex; /* synchronize wakeup_all() */ +}; + +/* FPGA to host opcodes */ +enum { + OPCODE_DATA = 0, + OPCODE_QUIESCE_ACK = 1, + OPCODE_EOF = 2, + OPCODE_REACHED_CHECKPOINT = 3, + OPCODE_CANCELED_CHECKPOINT = 4, +}; + +/* Host to FPGA opcodes */ +enum { + OPCODE_QUIESCE = 0, + OPCODE_REQ_IDT = 1, + OPCODE_SET_CHECKPOINT = 2, + OPCODE_CLOSE = 3, + OPCODE_SET_PUSH = 4, + OPCODE_UPDATE_PUSH = 5, + OPCODE_CANCEL_CHECKPOINT = 6, + OPCODE_SET_ADDR = 7, +}; + +/* + * fifo_write() and fifo_read() are NOT reentrant (i.e. concurrent multiple + * calls to each on the same FIFO is not allowed) however it's OK to have + * threads calling each of the two functions once on the same FIFO, and + * at the same time. + */ + +static int fifo_write(struct xillyfifo *fifo, + const void *data, unsigned int len, + int (*copier)(void *, const void *, int)) +{ + unsigned int done = 0; + unsigned int todo = len; + unsigned int nmax; + unsigned int writepos = fifo->writepos; + unsigned int writebuf = fifo->writebuf; + + nmax = fifo->size - atomic_read(&fifo->fill); + + while (1) { + unsigned int nrail = fifo->bufsize - writepos; + unsigned int n = min(todo, nmax); + + if (n == 0) { + /* + * Ensure copied data is visible before + * it's accounted for. + */ + smp_wmb(); + atomic_add(done, &fifo->fill); + + fifo->writepos = writepos; + fifo->writebuf = writebuf; + + return done; + } + + if (n > nrail) + n = nrail; + + if ((*copier)(fifo->mem[writebuf] + writepos, data + done, n)) + return -EFAULT; + + done += n; + todo -= n; + + writepos += n; + nmax -= n; + + if (writepos == fifo->bufsize) { + writepos = 0; + writebuf++; + + if (writebuf == fifo->bufnum) + writebuf = 0; + } + } +} + +static unsigned int fifo_read(struct xillyfifo *fifo, + void *data, unsigned int len, + int (*copier)(void *, const void *, int)) +{ + unsigned int done = 0; + unsigned int todo = len; + unsigned int fill; + unsigned int readpos = fifo->readpos; + unsigned int readbuf = fifo->readbuf; + + fill = atomic_read(&fifo->fill); + + /* Ensure that the data accounted for is synchronized in buffer */ + smp_rmb(); + + while (1) { + unsigned int nrail = fifo->bufsize - readpos; + unsigned int n = min(todo, fill); + + if (n == 0) { + atomic_sub(done, &fifo->fill); + + fifo->readpos = readpos; + fifo->readbuf = readbuf; + + return done; + } + + if (n > nrail) + n = nrail; + + if ((*copier)(data + done, fifo->mem[readbuf] + readpos, n)) + return -EFAULT; + + done += n; + todo -= n; + + readpos += n; + fill -= n; + + if (readpos == fifo->bufsize) { + readpos = 0; + readbuf++; + + if (readbuf == fifo->bufnum) + readbuf = 0; + } + } +} + +static int fifo_init(struct xillyfifo *fifo, + unsigned int log2_size) +{ + unsigned int log2_bufnum; + unsigned int buf_order; + int i; + + unsigned int log2_fifo_buf_size; + +retry: + log2_fifo_buf_size = fifo_buf_order + PAGE_SHIFT; + + if (log2_size > log2_fifo_buf_size) { + log2_bufnum = log2_size - log2_fifo_buf_size; + buf_order = fifo_buf_order; + fifo->bufsize = 1 << log2_fifo_buf_size; + } else { + log2_bufnum = 0; + buf_order = (log2_size > PAGE_SHIFT) ? + log2_size - PAGE_SHIFT : 0; + fifo->bufsize = 1 << log2_size; + } + + fifo->bufnum = 1 << log2_bufnum; + fifo->size = fifo->bufnum * fifo->bufsize; + fifo->buf_order = buf_order; + + fifo->mem = kmalloc_array(fifo->bufnum, sizeof(void *), GFP_KERNEL); + + if (!fifo->mem) + return -ENOMEM; + + for (i = 0; i < fifo->bufnum; i++) { + fifo->mem[i] = (void *) + __get_free_pages(GFP_KERNEL, buf_order); + + if (!fifo->mem[i]) + goto memfail; + } + + atomic_set(&fifo->fill, 0); + fifo->readpos = 0; + fifo->readbuf = 0; + fifo->writepos = 0; + fifo->writebuf = 0; + init_waitqueue_head(&fifo->waitq); + return 0; + +memfail: + for (i--; i >= 0; i--) + free_pages((unsigned long)fifo->mem[i], buf_order); + + kfree(fifo->mem); + fifo->mem = NULL; + + if (fifo_buf_order) { + fifo_buf_order--; + pr_warn("%s: Trying again to allocate FIFO %d bytes, now with segments of %d bytes each\n", + err_name, 1 << log2_size, + 1 << (fifo_buf_order + PAGE_SHIFT)); + goto retry; + } else { + pr_err("%s: Failed to allocate FIFO with %d bytes, despite attepts to chop it into small pieces.\n", + err_name, 1 << log2_size); + return -ENOMEM; + } +} + +static void fifo_mem_release(struct xillyfifo *fifo) +{ + int i; + + if (!fifo->mem) + return; + + for (i = 0; i < fifo->bufnum; i++) + free_pages((unsigned long)fifo->mem[i], fifo->buf_order); + + kfree(fifo->mem); +} + +/* + * Note that endpoint_dealloc() also frees fifo memory (if allocated), even + * though endpoint_alloc doesn't allocate that memory. + */ + +static void endpoint_dealloc(struct xillyusb_endpoint *ep) +{ + struct list_head *this, *next; + struct list_head *buffers = &ep->buffers; + unsigned int order = ep->order; + + ep->shutting_down = true; + + /* + * The first cancel_work_sync() doesn't just cancel a possibly running + * work item, but also ensures that if it's re-queued by a URB + * completer in a race condition, the next execution of the work item + * will see the ep->shutting_down as true, and do nothing. Hence we're + * sure all queued URBs are anchored and no new ones will be added + * after cancel_work_sync() returns. + * However a second cancel_work_sync() is still required if such race + * condition would re-queue the work item, since @ep is just about to + * be freed. + */ + + cancel_work_sync(&ep->workitem); + usb_kill_anchored_urbs(&ep->anchor); + cancel_work_sync(&ep->workitem); + + fifo_mem_release(&ep->fifo); + + list_for_each_safe(this, next, buffers) { + struct xillybuffer *xb = + list_entry(this, struct xillybuffer, entry); + + free_pages((unsigned long)xb->buf, order); + kfree(xb); + } + + kfree(ep); +} + +static struct xillyusb_endpoint +*endpoint_alloc(struct xillyusb_dev *xdev, + u8 ep_num, + void (*work)(struct work_struct *), + unsigned int order, + int bufnum) +{ + int i; + + struct xillyusb_endpoint *ep; + + ep = kzalloc(sizeof(*ep), GFP_KERNEL); + + if (!ep) + return NULL; + + INIT_LIST_HEAD(&ep->buffers); + INIT_LIST_HEAD(&ep->filled_buffers); + + spin_lock_init(&ep->buffers_lock); + + init_usb_anchor(&ep->anchor); + INIT_WORK(&ep->workitem, work); + + ep->order = order; + ep->buffer_size = 1 << (PAGE_SHIFT + order); + ep->outstanding_urbs = 0; + ep->xdev = xdev; + ep->ep_num = ep_num; + ep->shutting_down = false; + + for (i = 0; i < bufnum; i++) { + struct xillybuffer *xb; + unsigned long addr; + + xb = kzalloc(sizeof(*xb), GFP_KERNEL); + + if (!xb) { + endpoint_dealloc(ep); + return NULL; + } + + addr = __get_free_pages(GFP_KERNEL, order); + + if (!addr) { + kfree(xb); + endpoint_dealloc(ep); + return NULL; + } + + xb->buf = (void *)addr; + xb->ep = ep; + list_add_tail(&xb->entry, &ep->buffers); + } + return ep; +} + +static void cleanup_dev(struct kref *kref) +{ + struct xillyusb_dev *xdev = + container_of(kref, struct xillyusb_dev, kref); + + if (xdev->in_ep) + endpoint_dealloc(xdev->in_ep); + + if (xdev->msg_ep) + endpoint_dealloc(xdev->msg_ep); + + if (xdev->workq) + destroy_workqueue(xdev->workq); + + kfree(xdev->channels); /* Argument may be NULL, and that's fine */ + kfree(xdev); +} + +/* + * wakeup_all() is implemented as a work item, because of the need to be + * sure that bulk_in_work() sees xdev->error with a non-zero value if it + * runs after all read_data_ok have been cleared. xdev->error is assigned + * with this non-zero number prior to queueing the work, but it seems like + * only a mutex ensures this correct order of execution. + * + * In particular, the fact that wakeup_all() and bulk_in_work() are queued on + * the same workqueue makes their concurrent execution very unlikely, + * however the kernel's API doesn't seem to ensure this strictly. + * report_io_error() is possibly called in atomic context and can therefore + * not take a mutex. + */ + +static void wakeup_all(struct work_struct *work) +{ + int i; + struct xillyusb_dev *xdev = container_of(work, struct xillyusb_dev, + wakeup_workitem); + + mutex_lock(&xdev->process_in_mutex); + + for (i = 0; i < xdev->num_channels; i++) { + struct xillyusb_channel *chan = &xdev->channels[i]; + + mutex_lock(&chan->lock); + + if (chan->in_fifo) { + /* + * Fake an EOF: Even if such arrives, it won't be + * processed. + */ + chan->read_data_ok = 0; + wake_up_interruptible(&chan->in_fifo->waitq); + } + + if (chan->out_ep) + wake_up_interruptible(&chan->out_ep->fifo.waitq); + + mutex_unlock(&chan->lock); + + wake_up_interruptible(&chan->flushq); + } + + mutex_unlock(&xdev->process_in_mutex); + + wake_up_interruptible(&xdev->msg_ep->fifo.waitq); + + kref_put(&xdev->kref, cleanup_dev); +} + +static void report_io_error(struct xillyusb_dev *xdev, + int errcode) +{ + unsigned long flags; + bool do_once = false; + + spin_lock_irqsave(&xdev->error_lock, flags); + if (!xdev->error) { + xdev->error = errcode; + do_once = true; + } + spin_unlock_irqrestore(&xdev->error_lock, flags); + + if (do_once) { + kref_get(&xdev->kref); /* xdev is used by work item */ + queue_work(xdev->workq, &xdev->wakeup_workitem); + } +} + +/* + * safely_assign_in_fifo() changes the value of chan->in_fifo and ensures + * the previous pointer is never used after its return. + */ + +static void safely_assign_in_fifo(struct xillyusb_channel *chan, + struct xillyfifo *fifo) +{ + mutex_lock(&chan->lock); + chan->in_fifo = fifo; + mutex_unlock(&chan->lock); + + flush_work(&chan->xdev->in_ep->workitem); +} + +static int xilly_memcpy(void *dst, const void *src, int n) +{ + memcpy(dst, src, n); + return 0; +} + +static void bulk_in_completer(struct urb *urb) +{ + struct xillybuffer *xb = urb->context; + struct xillyusb_endpoint *ep = xb->ep; + unsigned long flags; + + if (urb->status) { + if (!(urb->status == -ENOENT || + urb->status == -ECONNRESET || + urb->status == -ESHUTDOWN)) + report_io_error(ep->xdev, -EIO); + + spin_lock_irqsave(&ep->buffers_lock, flags); + list_add_tail(&xb->entry, &ep->buffers); + ep->outstanding_urbs--; + spin_unlock_irqrestore(&ep->buffers_lock, flags); + + return; + } + + xb->len = urb->actual_length; + + spin_lock_irqsave(&ep->buffers_lock, flags); + list_add_tail(&xb->entry, &ep->filled_buffers); + spin_unlock_irqrestore(&ep->buffers_lock, flags); + + if (!ep->shutting_down) + queue_work(ep->xdev->workq, &ep->workitem); +} + +static void bulk_out_completer(struct urb *urb) +{ + struct xillybuffer *xb = urb->context; + struct xillyusb_endpoint *ep = xb->ep; + unsigned long flags; + + if (urb->status && + (!(urb->status == -ENOENT || + urb->status == -ECONNRESET || + urb->status == -ESHUTDOWN))) + report_io_error(ep->xdev, -EIO); + + spin_lock_irqsave(&ep->buffers_lock, flags); + list_add_tail(&xb->entry, &ep->buffers); + ep->outstanding_urbs--; + spin_unlock_irqrestore(&ep->buffers_lock, flags); + + if (!ep->shutting_down) + queue_work(ep->xdev->workq, &ep->workitem); +} + +static void try_queue_bulk_in(struct xillyusb_endpoint *ep) +{ + struct xillyusb_dev *xdev = ep->xdev; + struct xillybuffer *xb; + struct urb *urb; + + int rc; + unsigned long flags; + unsigned int bufsize = ep->buffer_size; + + if (ep->shutting_down) + return; + + mutex_lock(&xdev->io_mutex); + + if (!xdev->interface || xdev->error) + goto done; + + while (1) { + spin_lock_irqsave(&ep->buffers_lock, flags); + + if (list_empty(&ep->buffers)) { + spin_unlock_irqrestore(&ep->buffers_lock, flags); + goto done; + } + + xb = list_first_entry(&ep->buffers, struct xillybuffer, entry); + list_del(&xb->entry); + ep->outstanding_urbs++; + + spin_unlock_irqrestore(&ep->buffers_lock, flags); + + urb = usb_alloc_urb(0, GFP_KERNEL); + if (!urb) { + report_io_error(xdev, -ENOMEM); + goto relist; + } + + usb_fill_bulk_urb(urb, xdev->udev, + usb_rcvbulkpipe(xdev->udev, ep->ep_num), + xb->buf, bufsize, bulk_in_completer, xb); + + usb_anchor_urb(urb, &ep->anchor); + + rc = usb_submit_urb(urb, GFP_KERNEL); + + if (rc) { + report_io_error(xdev, (rc == -ENOMEM) ? -ENOMEM : + -EIO); + goto unanchor; + } + + usb_free_urb(urb); /* This just decrements reference count */ + } + +unanchor: + usb_unanchor_urb(urb); + usb_free_urb(urb); + +relist: + spin_lock_irqsave(&ep->buffers_lock, flags); + list_add_tail(&xb->entry, &ep->buffers); + ep->outstanding_urbs--; + spin_unlock_irqrestore(&ep->buffers_lock, flags); + +done: + mutex_unlock(&xdev->io_mutex); +} + +static void try_queue_bulk_out(struct xillyusb_endpoint *ep) +{ + struct xillyfifo *fifo = &ep->fifo; + struct xillyusb_dev *xdev = ep->xdev; + struct xillybuffer *xb; + struct urb *urb; + + int rc; + unsigned int fill; + unsigned long flags; + bool submitted = false; + + if (ep->shutting_down) + return; + + mutex_lock(&xdev->io_mutex); + + if (!xdev->interface || xdev->error) + goto done; + + fill = atomic_read(&fifo->fill) & ep->fill_mask; + + while (1) { + int count; + unsigned int max_read; + + if (fill == 0) + goto done; + + spin_lock_irqsave(&ep->buffers_lock, flags); + + if ((fill < ep->buffer_size && ep->outstanding_urbs) || + list_empty(&ep->buffers)) { + spin_unlock_irqrestore(&ep->buffers_lock, flags); + goto done; + } + + xb = list_first_entry(&ep->buffers, struct xillybuffer, entry); + list_del(&xb->entry); + ep->outstanding_urbs++; + + spin_unlock_irqrestore(&ep->buffers_lock, flags); + + max_read = min(fill, ep->buffer_size); + + count = fifo_read(&ep->fifo, xb->buf, max_read, xilly_memcpy); + + /* + * xilly_memcpy always returns 0 => fifo_read can't fail => + * count > 0 + */ + + urb = usb_alloc_urb(0, GFP_KERNEL); + if (!urb) { + report_io_error(xdev, -ENOMEM); + goto relist; + } + + usb_fill_bulk_urb(urb, xdev->udev, + usb_sndbulkpipe(xdev->udev, ep->ep_num), + xb->buf, count, bulk_out_completer, xb); + + usb_anchor_urb(urb, &ep->anchor); + + rc = usb_submit_urb(urb, GFP_KERNEL); + + if (rc) { + report_io_error(xdev, (rc == -ENOMEM) ? -ENOMEM : + -EIO); + goto unanchor; + } + + usb_free_urb(urb); /* This just decrements reference count */ + + fill -= count; + submitted = true; + } + +unanchor: + usb_unanchor_urb(urb); + usb_free_urb(urb); + +relist: + spin_lock_irqsave(&ep->buffers_lock, flags); + list_add_tail(&xb->entry, &ep->buffers); + ep->outstanding_urbs--; + spin_unlock_irqrestore(&ep->buffers_lock, flags); + +done: + mutex_unlock(&xdev->io_mutex); + + if (submitted) + wake_up_interruptible(&fifo->waitq); +} + +static void bulk_out_work(struct work_struct *work) +{ + struct xillyusb_endpoint *ep = container_of(work, + struct xillyusb_endpoint, + workitem); + try_queue_bulk_out(ep); +} + +static int process_in_opcode(struct xillyusb_dev *xdev, + int opcode, + int chan_num) +{ + struct xillyusb_channel *chan; + int chan_idx = chan_num >> 1; + + if (chan_idx >= xdev->num_channels) { + pr_err("%s: Received illegal channel ID %d from FPGA\n", + err_name, chan_num); + return -EIO; + } + + chan = &xdev->channels[chan_idx]; + + switch (opcode) { + case OPCODE_EOF: + if (!READ_ONCE(chan->read_data_ok)) { + pr_err("%s: Received unexpected EOF for channel %d\n", + err_name, chan_num); + return -EIO; + } + + /* + * A write memory barrier ensures that the FIFO's fill level + * is visible before read_data_ok turns zero, so the data in + * the FIFO isn't missed by the consumer. + */ + smp_wmb(); + WRITE_ONCE(chan->read_data_ok, 0); + wake_up_interruptible(&chan->in_fifo->waitq); + break; + + case OPCODE_REACHED_CHECKPOINT: + chan->flushing = 0; + wake_up_interruptible(&chan->flushq); + break; + + case OPCODE_CANCELED_CHECKPOINT: + chan->canceled = 1; + wake_up_interruptible(&chan->flushq); + break; + + default: + pr_err("%s: Received illegal opcode %d from FPGA\n", + err_name, opcode); + return -EIO; + } + + return 0; +} + +static int process_bulk_in(struct xillybuffer *xb) +{ + struct xillyusb_endpoint *ep = xb->ep; + struct xillyusb_dev *xdev = ep->xdev; + int dws = xb->len >> 2; + __le32 *p = xb->buf; + u32 ctrlword; + struct xillyusb_channel *chan; + struct xillyfifo *fifo; + int chan_num = 0, opcode; + int chan_idx; + int bytes, count, dwconsume; + int in_bytes_left = 0; + int rc; + + if ((dws << 2) != xb->len) { + pr_err("%s: Received BULK IN transfer with %d bytes, not a multiple of 4\n", + err_name, xb->len); + return -EIO; + } + + if (xdev->in_bytes_left) { + bytes = min(xdev->in_bytes_left, dws << 2); + in_bytes_left = xdev->in_bytes_left - bytes; + chan_num = xdev->leftover_chan_num; + goto resume_leftovers; + } + + while (dws) { + ctrlword = le32_to_cpu(*p++); + dws--; + + chan_num = ctrlword & 0xfff; + count = (ctrlword >> 12) & 0x3ff; + opcode = (ctrlword >> 24) & 0xf; + + if (opcode != OPCODE_DATA) { + unsigned int in_counter = xdev->in_counter++ & 0x3ff; + + if (count != in_counter) { + pr_err("%s: Expected opcode counter %d, got %d\n", + err_name, in_counter, count); + return -EIO; + } + + rc = process_in_opcode(xdev, opcode, chan_num); + + if (rc) + return rc; + + continue; + } + + bytes = min(count + 1, dws << 2); + in_bytes_left = count + 1 - bytes; + +resume_leftovers: + chan_idx = chan_num >> 1; + + if (!(chan_num & 1) || chan_idx >= xdev->num_channels || + !READ_ONCE(xdev->channels[chan_idx].read_data_ok)) { + pr_err("%s: Received illegal channel ID %d from FPGA\n", + err_name, chan_num); + return -EIO; + } + chan = &xdev->channels[chan_idx]; + + fifo = chan->in_fifo; + + if (unlikely(!fifo)) + return -EIO; /* We got really unexpected data */ + + if (bytes != fifo_write(fifo, p, bytes, xilly_memcpy)) { + pr_err("%s: Misbehaving FPGA overflew an upstream FIFO!\n", + err_name); + return -EIO; + } + + wake_up_interruptible(&fifo->waitq); + + dwconsume = (bytes + 3) >> 2; + dws -= dwconsume; + p += dwconsume; + } + + xdev->in_bytes_left = in_bytes_left; + xdev->leftover_chan_num = chan_num; + return 0; +} + +static void bulk_in_work(struct work_struct *work) +{ + struct xillyusb_endpoint *ep = + container_of(work, struct xillyusb_endpoint, workitem); + struct xillyusb_dev *xdev = ep->xdev; + unsigned long flags; + struct xillybuffer *xb; + bool consumed = false; + int rc = 0; + + mutex_lock(&xdev->process_in_mutex); + + spin_lock_irqsave(&ep->buffers_lock, flags); + + while (1) { + if (list_empty(&ep->filled_buffers)) { + spin_unlock_irqrestore(&ep->buffers_lock, flags); + + mutex_unlock(&xdev->process_in_mutex); + + if (consumed) + try_queue_bulk_in(ep); + + return; + } + + xb = list_first_entry(&ep->filled_buffers, struct xillybuffer, + entry); + list_del(&xb->entry); + + spin_unlock_irqrestore(&ep->buffers_lock, flags); + + consumed = true; + + if (!xdev->error) + rc = process_bulk_in(xb); + + if (rc) { + mutex_unlock(&xdev->process_in_mutex); + report_io_error(xdev, rc); + return; + } + + spin_lock_irqsave(&ep->buffers_lock, flags); + list_add_tail(&xb->entry, &ep->buffers); + ep->outstanding_urbs--; + } +} + +static int xillyusb_send_opcode(struct xillyusb_dev *xdev, + int chan_num, char opcode, u32 data) +{ + struct xillyusb_endpoint *ep = xdev->msg_ep; + struct xillyfifo *fifo = &ep->fifo; + __le32 msg[2]; + + int rc = 0; + + msg[0] = cpu_to_le32((chan_num & 0xfff) | + ((opcode & 0xf) << 24)); + msg[1] = cpu_to_le32(data); + + mutex_lock(&xdev->msg_mutex); + + /* + * The wait queue is woken with the interruptible variant, so the + * wait function matches, however returning because of an interrupt + * will mess things up considerably, in particular when the caller is + * the release method. And the xdev->error part prevents being stuck + * forever: Just pull the USB plug. + */ + + while (wait_event_interruptible(fifo->waitq, + ((atomic_read(&fifo->fill) + <= (fifo->size - 8)) || + xdev->error))) + ; /* Empty loop */ + + if (xdev->error) { + rc = xdev->error; + goto unlock_done; + } + + fifo_write(fifo, (void *)msg, 8, xilly_memcpy); + + try_queue_bulk_out(ep); + +unlock_done: + mutex_unlock(&xdev->msg_mutex); + + return rc; +} + +/* + * Note that flush_downstream() merely waits for the data to arrive to + * the application logic at the FPGA -- unlike PCIe Xillybus' counterpart, + * it does nothing to make it happen (and neither is it necessary). + * + * This function is not reentrant for the same @chan, but this is covered + * by the fact that for any given @chan, it's called either by the open, + * write, llseek and flush fops methods, which can't run in parallel (and the + * write + flush and llseek method handlers are protected with out_mutex). + * + * chan->flushed is there to avoid multiple flushes at the same position, + * in particular as a result of programs that close the file descriptor + * e.g. after a dup2() for redirection. + */ + +static int flush_downstream(struct xillyusb_channel *chan, + long timeout, + bool interruptible) +{ + struct xillyusb_dev *xdev = chan->xdev; + int chan_num = chan->chan_idx << 1; + long deadline, left_to_sleep; + int rc; + + if (chan->flushed) + return 0; + + deadline = jiffies + 1 + timeout; + + if (chan->flushing) { + long cancel_deadline = jiffies + 1 + XILLY_RESPONSE_TIMEOUT; + + chan->canceled = 0; + rc = xillyusb_send_opcode(xdev, chan_num, + OPCODE_CANCEL_CHECKPOINT, 0); + + if (rc) + return rc; /* Only real error, never -EINTR */ + + /* Ignoring interrupts. Cancellation must be handled */ + while (!chan->canceled) { + left_to_sleep = cancel_deadline - ((long)jiffies); + + if (left_to_sleep <= 0) { + report_io_error(xdev, -EIO); + pr_err("%s: Fatal error: Timed out on flush cancellation request.\n", + err_name); + return -EIO; + } + + rc = wait_event_interruptible_timeout(chan->flushq, + chan->canceled || + xdev->error, + left_to_sleep); + + if (xdev->error) + return xdev->error; + } + } + + chan->flushing = 1; + + /* + * The checkpoint is given in terms of data elements, not bytes. As + * a result, if less than an element's worth of data is stored in the + * FIFO, it's not flushed, including the flush before closing, which + * means that such data is lost. This is consistent with PCIe Xillybus. + */ + + rc = xillyusb_send_opcode(xdev, chan_num, + OPCODE_SET_CHECKPOINT, + chan->out_bytes >> + chan->out_log2_element_size); + + if (rc) + return rc; /* Only real error, never -EINTR */ + + if (!timeout) { + while (chan->flushing) { + rc = wait_event_interruptible(chan->flushq, + !chan->flushing || + xdev->error); + if (xdev->error) + return xdev->error; + + if (interruptible && rc) + return -EINTR; + } + + goto done; + } + + while (chan->flushing) { + left_to_sleep = deadline - ((long)jiffies); + + if (left_to_sleep <= 0) + return -ETIMEDOUT; + + rc = wait_event_interruptible_timeout(chan->flushq, + !chan->flushing || + xdev->error, + left_to_sleep); + + if (xdev->error) + return xdev->error; + + if (interruptible && rc < 0) + return -EINTR; + } + +done: + chan->flushed = 1; + return 0; +} + +/* request_read_anything(): Ask the FPGA for any little amount of data */ +static int request_read_anything(struct xillyusb_channel *chan, + char opcode) +{ + struct xillyusb_dev *xdev = chan->xdev; + unsigned int sh = chan->in_log2_element_size; + int chan_num = (chan->chan_idx << 1) | 1; + u32 mercy = chan->in_consumed_bytes + (2 << sh) - 1; + + return xillyusb_send_opcode(xdev, chan_num, opcode, mercy >> sh); +} + +static int xillyusb_open(struct inode *inode, struct file *filp) +{ + struct xillyusb_dev *xdev; + struct xillyusb_channel *chan; + struct xillyfifo *in_fifo = NULL; + struct xillyusb_endpoint *out_ep = NULL; + int rc; + int index; + + rc = xillybus_find_inode(inode, (void **)&xdev, &index); + if (rc) + return rc; + + chan = &xdev->channels[index]; + filp->private_data = chan; + + mutex_lock(&open_mutex); + + rc = -ENODEV; + + if (((filp->f_mode & FMODE_READ) && !chan->readable) || + ((filp->f_mode & FMODE_WRITE) && !chan->writable)) + goto unmutex_fail; + + if ((filp->f_flags & O_NONBLOCK) && (filp->f_mode & FMODE_READ) && + chan->in_synchronous) { + pr_err("%s: open() failed: O_NONBLOCK not allowed for read on this device\n", + err_name); + goto unmutex_fail; + } + + if ((filp->f_flags & O_NONBLOCK) && (filp->f_mode & FMODE_WRITE) && + chan->out_synchronous) { + pr_err("%s: open() failed: O_NONBLOCK not allowed for write on this device\n", + err_name); + goto unmutex_fail; + } + + rc = -EBUSY; + + if (((filp->f_mode & FMODE_READ) && chan->open_for_read) || + ((filp->f_mode & FMODE_WRITE) && chan->open_for_write)) + goto unmutex_fail; + + kref_get(&xdev->kref); + + if (filp->f_mode & FMODE_READ) + chan->open_for_read = 1; + + if (filp->f_mode & FMODE_WRITE) + chan->open_for_write = 1; + + mutex_unlock(&open_mutex); + + if (filp->f_mode & FMODE_WRITE) { + out_ep = endpoint_alloc(xdev, + (chan->chan_idx + 2) | USB_DIR_OUT, + bulk_out_work, + urb_buforder, urb_bufnum); + + if (!out_ep) { + rc = -ENOMEM; + goto unopen; + } + + rc = fifo_init(&out_ep->fifo, chan->out_log2_fifo_size); + + if (rc) + goto late_unopen; + + out_ep->fill_mask = -(1 << chan->out_log2_element_size); + chan->out_bytes = 0; + chan->flushed = 0; + + /* + * Sending a flush request to a previously closed stream + * effectively opens it, and also waits until the command is + * confirmed by the FPGA. The latter is necessary because the + * data is sent through a separate BULK OUT endpoint, and the + * xHCI controller is free to reorder transmissions. + * + * This can't go wrong unless there's a serious hardware error + * (or the computer is stuck for 500 ms?) + */ + rc = flush_downstream(chan, XILLY_RESPONSE_TIMEOUT, false); + + if (rc == -ETIMEDOUT) { + rc = -EIO; + report_io_error(xdev, rc); + pr_err("%s: Fatal error: Hardware timed out to open request.\n", + err_name); + } + + if (rc) + goto late_unopen; + } + + if (filp->f_mode & FMODE_READ) { + in_fifo = kzalloc(sizeof(*in_fifo), GFP_KERNEL); + + if (!in_fifo) { + rc = -ENOMEM; + goto late_unopen; + } + + rc = fifo_init(in_fifo, chan->in_log2_fifo_size); + + if (rc) { + kfree(in_fifo); + goto late_unopen; + } + } + + mutex_lock(&chan->lock); + if (in_fifo) { + chan->in_fifo = in_fifo; + chan->read_data_ok = 1; + } + if (out_ep) + chan->out_ep = out_ep; + mutex_unlock(&chan->lock); + + if (in_fifo) { + u32 in_checkpoint = 0; + + if (!chan->in_synchronous) + in_checkpoint = in_fifo->size >> + chan->in_log2_element_size; + + chan->in_consumed_bytes = 0; + chan->poll_used = 0; + chan->in_current_checkpoint = in_checkpoint; + rc = xillyusb_send_opcode(xdev, (chan->chan_idx << 1) | 1, + OPCODE_SET_CHECKPOINT, + in_checkpoint); + + if (rc) /* Failure guarantees that opcode wasn't sent */ + goto unfifo; + + /* + * In non-blocking mode, request the FPGA to send any data it + * has right away. Otherwise, the first read() will always + * return -EAGAIN, which is OK strictly speaking, but ugly. + * Checking and unrolling if this fails isn't worth the + * effort -- the error is propagated to the first read() + * anyhow. + */ + if (filp->f_flags & O_NONBLOCK) + request_read_anything(chan, OPCODE_SET_PUSH); + } + + return 0; + +unfifo: + if (in_fifo) { + chan->read_data_ok = 0; + safely_assign_in_fifo(chan, NULL); + fifo_mem_release(in_fifo); + } + + if (out_ep) { + mutex_lock(&chan->lock); + chan->out_ep = NULL; + mutex_unlock(&chan->lock); + } + +late_unopen: + if (out_ep) + endpoint_dealloc(out_ep); + +unopen: + mutex_lock(&open_mutex); + + if (filp->f_mode & FMODE_READ) + chan->open_for_read = 0; + + if (filp->f_mode & FMODE_WRITE) + chan->open_for_write = 0; + + mutex_unlock(&open_mutex); + + kref_put(&xdev->kref, cleanup_dev); + + return rc; + +unmutex_fail: + mutex_unlock(&open_mutex); + return rc; +} + +static int xilly_copy_to_user(void *dst, const void *src, int n) +{ + return copy_to_user((void __user *)dst, src, n); +} + +static ssize_t xillyusb_read(struct file *filp, char __user *userbuf, + size_t count, loff_t *f_pos) +{ + struct xillyusb_channel *chan = filp->private_data; + struct xillyusb_dev *xdev = chan->xdev; + struct xillyfifo *fifo = chan->in_fifo; + int chan_num = (chan->chan_idx << 1) | 1; + + long deadline, left_to_sleep; + int bytes_done = 0; + bool sent_set_push = false; + int rc; + + deadline = jiffies + 1 + XILLY_RX_TIMEOUT; + + rc = mutex_lock_interruptible(&chan->in_mutex); + + if (rc) + return rc; + + while (1) { + u32 fifo_checkpoint_bytes, complete_checkpoint_bytes; + u32 complete_checkpoint, fifo_checkpoint; + u32 checkpoint; + s32 diff, leap; + unsigned int sh = chan->in_log2_element_size; + bool checkpoint_for_complete; + + rc = fifo_read(fifo, (__force void *)userbuf + bytes_done, + count - bytes_done, xilly_copy_to_user); + + if (rc < 0) + break; + + bytes_done += rc; + chan->in_consumed_bytes += rc; + + left_to_sleep = deadline - ((long)jiffies); + + /* + * Some 32-bit arithmetics that may wrap. Note that + * complete_checkpoint is rounded up to the closest element + * boundary, because the read() can't be completed otherwise. + * fifo_checkpoint_bytes is rounded down, because it protects + * in_fifo from overflowing. + */ + + fifo_checkpoint_bytes = chan->in_consumed_bytes + fifo->size; + complete_checkpoint_bytes = + chan->in_consumed_bytes + count - bytes_done; + + fifo_checkpoint = fifo_checkpoint_bytes >> sh; + complete_checkpoint = + (complete_checkpoint_bytes + (1 << sh) - 1) >> sh; + + diff = (fifo_checkpoint - complete_checkpoint) << sh; + + if (chan->in_synchronous && diff >= 0) { + checkpoint = complete_checkpoint; + checkpoint_for_complete = true; + } else { + checkpoint = fifo_checkpoint; + checkpoint_for_complete = false; + } + + leap = (checkpoint - chan->in_current_checkpoint) << sh; + + /* + * To prevent flooding of OPCODE_SET_CHECKPOINT commands as + * data is consumed, it's issued only if it moves the + * checkpoint by at least an 8th of the FIFO's size, or if + * it's necessary to complete the number of bytes requested by + * the read() call. + * + * chan->read_data_ok is checked to spare an unnecessary + * submission after receiving EOF, however it's harmless if + * such slips away. + */ + + if (chan->read_data_ok && + (leap > (fifo->size >> 3) || + (checkpoint_for_complete && leap > 0))) { + chan->in_current_checkpoint = checkpoint; + rc = xillyusb_send_opcode(xdev, chan_num, + OPCODE_SET_CHECKPOINT, + checkpoint); + + if (rc) + break; + } + + if (bytes_done == count || + (left_to_sleep <= 0 && bytes_done)) + break; + + /* + * Reaching here means that the FIFO was empty at the call to + * fifo_read() above, but not necessarily right now. Error + * and EOF are checked and reported only now, so that no data + * that managed its way to the FIFO is lost. + */ + + if (!READ_ONCE(chan->read_data_ok)) { /* FPGA has sent EOF */ + /* Has data slipped into the FIFO since fifo_read()? */ + smp_rmb(); + if (atomic_read(&fifo->fill)) + continue; + + rc = 0; + break; + } + + if (xdev->error) { + rc = xdev->error; + break; + } + + if (filp->f_flags & O_NONBLOCK) { + rc = -EAGAIN; + break; + } + + if (left_to_sleep > 0) { + if (!sent_set_push) { + rc = xillyusb_send_opcode(xdev, chan_num, + OPCODE_SET_PUSH, + complete_checkpoint); + + if (rc) + break; + + sent_set_push = true; + } + + /* + * Note that when xdev->error is set (e.g. when the + * device is unplugged), read_data_ok turns zero and + * fifo->waitq is awaken. + * Therefore no special attention to xdev->error. + */ + + rc = wait_event_interruptible_timeout + (fifo->waitq, + atomic_read(&fifo->fill) || + !chan->read_data_ok, + left_to_sleep); + } else { /* bytes_done == 0 */ + /* Tell FPGA to send anything it has */ + rc = request_read_anything(chan, OPCODE_UPDATE_PUSH); + + if (rc) + break; + + rc = wait_event_interruptible + (fifo->waitq, + atomic_read(&fifo->fill) || + !chan->read_data_ok); + } + + if (rc < 0) { + rc = -EINTR; + break; + } + } + + if (((filp->f_flags & O_NONBLOCK) || chan->poll_used) && + !atomic_read(&fifo->fill)) + request_read_anything(chan, OPCODE_SET_PUSH); + + mutex_unlock(&chan->in_mutex); + + if (bytes_done) + return bytes_done; + + return rc; +} + +static int xillyusb_flush(struct file *filp, fl_owner_t id) +{ + struct xillyusb_channel *chan = filp->private_data; + int rc; + + if (!(filp->f_mode & FMODE_WRITE)) + return 0; + + rc = mutex_lock_interruptible(&chan->out_mutex); + + if (rc) + return rc; + + /* + * One second's timeout on flushing. Interrupts are ignored, because if + * the user pressed CTRL-C, that interrupt will still be in flight by + * the time we reach here, and the opportunity to flush is lost. + */ + rc = flush_downstream(chan, HZ, false); + + if (rc == -ETIMEDOUT) + pr_warn("%s: Timed out while flushing. Output data may be lost.\n", + err_name); + + mutex_unlock(&chan->out_mutex); + + return rc; +} + +static int xilly_copy_from_user(void *dst, const void *src, int n) +{ + return copy_from_user(dst, (const void __user *)src, n); +} + +static ssize_t xillyusb_write(struct file *filp, const char __user *userbuf, + size_t count, loff_t *f_pos) +{ + struct xillyusb_channel *chan = filp->private_data; + struct xillyusb_dev *xdev = chan->xdev; + struct xillyfifo *fifo = &chan->out_ep->fifo; + int rc; + + rc = mutex_lock_interruptible(&chan->out_mutex); + + if (rc) + return rc; + + while (1) { + if (xdev->error) { + rc = xdev->error; + break; + } + + if (count == 0) + break; + + rc = fifo_write(fifo, (__force void *)userbuf, count, + xilly_copy_from_user); + + if (rc != 0) + break; + + if (filp->f_flags & O_NONBLOCK) { + rc = -EAGAIN; + break; + } + + if (wait_event_interruptible + (fifo->waitq, + (atomic_read(&fifo->fill) != fifo->size) || + xdev->error)) { + rc = -EINTR; + break; + } + } + + if (rc < 0) + goto done; + + chan->out_bytes += rc; + + if (rc) { + try_queue_bulk_out(chan->out_ep); + chan->flushed = 0; + } + + if (chan->out_synchronous) { + int flush_rc = flush_downstream(chan, 0, true); + + if (flush_rc && !rc) + rc = flush_rc; + } + +done: + mutex_unlock(&chan->out_mutex); + + return rc; +} + +static int xillyusb_release(struct inode *inode, struct file *filp) +{ + struct xillyusb_channel *chan = filp->private_data; + struct xillyusb_dev *xdev = chan->xdev; + int rc_read = 0, rc_write = 0; + + if (filp->f_mode & FMODE_READ) { + struct xillyfifo *in_fifo = chan->in_fifo; + + rc_read = xillyusb_send_opcode(xdev, (chan->chan_idx << 1) | 1, + OPCODE_CLOSE, 0); + /* + * If rc_read is nonzero, xdev->error indicates a global + * device error. The error is reported later, so that + * resources are freed. + * + * Looping on wait_event_interruptible() kinda breaks the idea + * of being interruptible, and this should have been + * wait_event(). Only it's being waken with + * wake_up_interruptible() for the sake of other uses. If + * there's a global device error, chan->read_data_ok is + * deasserted and the wait queue is awaken, so this is covered. + */ + + while (wait_event_interruptible(in_fifo->waitq, + !chan->read_data_ok)) + ; /* Empty loop */ + + safely_assign_in_fifo(chan, NULL); + fifo_mem_release(in_fifo); + + mutex_lock(&open_mutex); + chan->open_for_read = 0; + mutex_unlock(&open_mutex); + } + + if (filp->f_mode & FMODE_WRITE) { + struct xillyusb_endpoint *ep = chan->out_ep; + /* + * chan->flushing isn't zeroed. If the pre-release flush timed + * out, a cancel request will be sent before the next + * OPCODE_SET_CHECKPOINT (i.e. when the file is opened again). + * This is despite that the FPGA forgets about the checkpoint + * request as the file closes. Still, in an exceptional race + * condition, the FPGA could send an OPCODE_REACHED_CHECKPOINT + * just before closing that would reach the host after the + * file has re-opened. + */ + + mutex_lock(&chan->lock); + chan->out_ep = NULL; + mutex_unlock(&chan->lock); + + endpoint_dealloc(ep); + + /* See comments on rc_read above */ + rc_write = xillyusb_send_opcode(xdev, chan->chan_idx << 1, + OPCODE_CLOSE, 0); + + mutex_lock(&open_mutex); + chan->open_for_write = 0; + mutex_unlock(&open_mutex); + } + + kref_put(&xdev->kref, cleanup_dev); + + return rc_read ? rc_read : rc_write; +} + +static loff_t xillyusb_llseek(struct file *filp, loff_t offset, int whence) +{ + struct xillyusb_channel *chan = filp->private_data; + struct xillyusb_dev *xdev = chan->xdev; + loff_t pos = filp->f_pos; + int rc = 0; + unsigned int log2_element_size = chan->readable ? + chan->in_log2_element_size : chan->out_log2_element_size; + + /* + * Take both mutexes not allowing interrupts, since it seems like + * common applications don't expect an -EINTR here. Besides, multiple + * access to a single file descriptor on seekable devices is a mess + * anyhow. + */ + + mutex_lock(&chan->out_mutex); + mutex_lock(&chan->in_mutex); + + switch (whence) { + case SEEK_SET: + pos = offset; + break; + case SEEK_CUR: + pos += offset; + break; + case SEEK_END: + pos = offset; /* Going to the end => to the beginning */ + break; + default: + rc = -EINVAL; + goto end; + } + + /* In any case, we must finish on an element boundary */ + if (pos & ((1 << log2_element_size) - 1)) { + rc = -EINVAL; + goto end; + } + + rc = xillyusb_send_opcode(xdev, chan->chan_idx << 1, + OPCODE_SET_ADDR, + pos >> log2_element_size); + + if (rc) + goto end; + + /* + * If the stream is writable (it most likely is), a flush request is + * sent to ensure that traffic on the stream's BULK OUT endpoint isn't + * sent before the position is updated on the FPGA -- otherwise that + * data could arrive before the position update. Since only + * synchronous streams can be seekable, flush_downstream() has already + * been called after the last write(), so flushing is completed + * virtually right away. Well, unless the last flush was interrupted, + * in which case we wait for up to 1000 ms, and return -ETIMEDOUT (!) + * if the flush was incomplete. No real-life application should ever + * get to this point. + */ + + if (chan->writable) { + chan->flushed = 0; + rc = flush_downstream(chan, HZ, false); + } + +end: + mutex_unlock(&chan->out_mutex); + mutex_unlock(&chan->in_mutex); + + if (rc) /* Return error after releasing mutexes */ + return rc; + + filp->f_pos = pos; + + return pos; +} + +static __poll_t xillyusb_poll(struct file *filp, poll_table *wait) +{ + struct xillyusb_channel *chan = filp->private_data; + __poll_t mask = 0; + + if (chan->in_fifo) + poll_wait(filp, &chan->in_fifo->waitq, wait); + + if (chan->out_ep) + poll_wait(filp, &chan->out_ep->fifo.waitq, wait); + + /* + * If this is the first time poll() is called, and the file is + * readable, set the relevant flag. Also tell the FPGA to send all it + * has, to kickstart the mechanism that ensures there's always some + * data in in_fifo unless the stream is dry end-to-end. Note that the + * first poll() may not return a EPOLLIN, even if there's data on the + * FPGA. Rather, the data will arrive soon, and trigger the relevant + * wait queue. + */ + + if (!chan->poll_used && chan->in_fifo) { + chan->poll_used = 1; + request_read_anything(chan, OPCODE_SET_PUSH); + } + + /* + * poll() won't play ball regarding read() channels which + * are synchronous. Allowing that will create situations where data has + * been delivered at the FPGA, and users expecting select() to wake up, + * which it may not. So make it never work. + */ + + if (chan->in_fifo && !chan->in_synchronous && + (atomic_read(&chan->in_fifo->fill) || !chan->read_data_ok)) + mask |= EPOLLIN | EPOLLRDNORM; + + if (chan->out_ep && + (atomic_read(&chan->out_ep->fifo.fill) != + chan->out_ep->fifo.size)) + mask |= EPOLLOUT | EPOLLWRNORM; + + if (chan->xdev->error) + mask |= EPOLLERR; + + return mask; +} + +static const struct file_operations xillyusb_fops = { + .owner = THIS_MODULE, + .read = xillyusb_read, + .write = xillyusb_write, + .open = xillyusb_open, + .flush = xillyusb_flush, + .release = xillyusb_release, + .llseek = xillyusb_llseek, + .poll = xillyusb_poll, +}; + +static int xillyusb_setup_base_eps(struct xillyusb_dev *xdev) +{ + xdev->msg_ep = endpoint_alloc(xdev, MSG_EP_NUM | USB_DIR_OUT, + bulk_out_work, 1, 2); + if (!xdev->msg_ep) + return -ENOMEM; + + if (fifo_init(&xdev->msg_ep->fifo, 13)) /* 8 kiB */ + goto dealloc; + + xdev->msg_ep->fill_mask = -8; /* 8 bytes granularity */ + + xdev->in_ep = endpoint_alloc(xdev, IN_EP_NUM | USB_DIR_IN, + bulk_in_work, urb_buforder, urb_bufnum); + if (!xdev->in_ep) + goto dealloc; + + try_queue_bulk_in(xdev->in_ep); + + return 0; + +dealloc: + endpoint_dealloc(xdev->msg_ep); /* Also frees FIFO mem if allocated */ + return -ENOMEM; +} + +static int setup_channels(struct xillyusb_dev *xdev, + __le16 *chandesc) +{ + struct xillyusb_channel *chan; + int i; + + chan = kcalloc(xdev->num_channels, sizeof(*chan), GFP_KERNEL); + if (!chan) + return -ENOMEM; + + xdev->channels = chan; + + for (i = 0; i < xdev->num_channels; i++, chan++) { + unsigned int in_desc = le16_to_cpu(*chandesc++); + unsigned int out_desc = le16_to_cpu(*chandesc++); + + chan->xdev = xdev; + mutex_init(&chan->in_mutex); + mutex_init(&chan->out_mutex); + mutex_init(&chan->lock); + init_waitqueue_head(&chan->flushq); + + chan->chan_idx = i; + + if (in_desc & 0x80) { /* Entry is valid */ + chan->readable = 1; + chan->in_synchronous = !!(in_desc & 0x40); + chan->in_seekable = !!(in_desc & 0x20); + chan->in_log2_element_size = in_desc & 0x0f; + chan->in_log2_fifo_size = ((in_desc >> 8) & 0x1f) + 16; + } + + if (out_desc & 0x80) { /* Entry is valid */ + chan->writable = 1; + chan->out_synchronous = !!(out_desc & 0x40); + chan->out_seekable = !!(out_desc & 0x20); + chan->out_log2_element_size = out_desc & 0x0f; + chan->out_log2_fifo_size = + ((out_desc >> 8) & 0x1f) + 16; + } + } + + return 0; +} + +static int xillyusb_discovery(struct usb_interface *interface) +{ + int rc; + struct xillyusb_dev *xdev = usb_get_intfdata(interface); + __le16 bogus_chandesc[2]; + struct xillyfifo idt_fifo; + struct xillyusb_channel *chan; + unsigned int idt_len, names_offset; + unsigned char *idt; + + rc = xillyusb_send_opcode(xdev, ~0, OPCODE_QUIESCE, 0); + + if (rc) { + dev_err(&interface->dev, "Failed to send quiesce request. Aborting.\n"); + return rc; + } + + /* Phase I: Set up one fake upstream channel and obtain IDT */ + + /* Set up a fake IDT with one async IN stream */ + xdev->num_channels = 1; + bogus_chandesc[0] = cpu_to_le16(0x80); + bogus_chandesc[1] = cpu_to_le16(0); + + rc = setup_channels(xdev, bogus_chandesc); + + if (rc) + return rc; + + rc = fifo_init(&idt_fifo, LOG2_IDT_FIFO_SIZE); + + if (rc) + return rc; + + chan = xdev->channels; + + chan->in_fifo = &idt_fifo; + chan->read_data_ok = 1; + + rc = xillyusb_send_opcode(xdev, ~0, OPCODE_REQ_IDT, 0); + + if (rc) { + dev_err(&interface->dev, "Failed to send IDT request. Aborting.\n"); + goto unfifo; + } + + rc = wait_event_interruptible_timeout(idt_fifo.waitq, + !chan->read_data_ok, + XILLY_RESPONSE_TIMEOUT); + + if (xdev->error) { + rc = xdev->error; + goto unfifo; + } + + if (rc < 0) { + rc = -EINTR; /* Interrupt on probe method? Interesting. */ + goto unfifo; + } + + if (chan->read_data_ok) { + rc = -ETIMEDOUT; + dev_err(&interface->dev, "No response from FPGA. Aborting.\n"); + goto unfifo; + } + + idt_len = atomic_read(&idt_fifo.fill); + idt = kmalloc(idt_len, GFP_KERNEL); + + if (!idt) { + rc = -ENOMEM; + goto unfifo; + } + + fifo_read(&idt_fifo, idt, idt_len, xilly_memcpy); + + if (crc32_le(~0, idt, idt_len) != 0) { + dev_err(&interface->dev, "IDT failed CRC check. Aborting.\n"); + rc = -ENODEV; + goto unidt; + } + + if (*idt > 0x90) { + dev_err(&interface->dev, "No support for IDT version 0x%02x. Maybe the xillyusb driver needs an upgarde. Aborting.\n", + (int)*idt); + rc = -ENODEV; + goto unidt; + } + + /* Phase II: Set up the streams as defined in IDT */ + + xdev->num_channels = le16_to_cpu(*((__le16 *)(idt + 1))); + names_offset = 3 + xdev->num_channels * 4; + idt_len -= 4; /* Exclude CRC */ + + if (idt_len < names_offset) { + dev_err(&interface->dev, "IDT too short. This is exceptionally weird, because its CRC is OK\n"); + rc = -ENODEV; + goto unidt; + } + + rc = setup_channels(xdev, (void *)idt + 3); + + if (rc) + goto unidt; + + /* + * Except for wildly misbehaving hardware, or if it was disconnected + * just after responding with the IDT, there is no reason for any + * work item to be running now. To be sure that xdev->channel + * is updated on anything that might run in parallel, flush the + * workqueue, which rarely does anything. + */ + flush_workqueue(xdev->workq); + + fifo_mem_release(&idt_fifo); + kfree(chan); + + rc = xillybus_init_chrdev(&interface->dev, &xillyusb_fops, + THIS_MODULE, xdev, + idt + names_offset, + idt_len - names_offset, + xdev->num_channels, + xillyname, true); + + kfree(idt); + + return rc; + +unidt: + kfree(idt); + +unfifo: + safely_assign_in_fifo(chan, NULL); + fifo_mem_release(&idt_fifo); + + return rc; +} + +static int xillyusb_probe(struct usb_interface *interface, + const struct usb_device_id *id) +{ + struct xillyusb_dev *xdev; + int rc; + + xdev = kzalloc(sizeof(*xdev), GFP_KERNEL); + if (!xdev) + return -ENOMEM; + + kref_init(&xdev->kref); + mutex_init(&xdev->io_mutex); + mutex_init(&xdev->process_in_mutex); + mutex_init(&xdev->msg_mutex); + + xdev->udev = usb_get_dev(interface_to_usbdev(interface)); + xdev->interface = interface; + xdev->error = 0; + spin_lock_init(&xdev->error_lock); + xdev->in_counter = 0; + xdev->in_bytes_left = 0; + xdev->workq = alloc_workqueue(xillyname, WQ_HIGHPRI, 0); + + if (!xdev->workq) { + dev_err(&interface->dev, "Failed to allocate work queue\n"); + rc = -ENOMEM; + goto fail; + } + + INIT_WORK(&xdev->wakeup_workitem, wakeup_all); + + usb_set_intfdata(interface, xdev); + + rc = xillyusb_setup_base_eps(xdev); + if (rc) + goto fail; + + rc = xillyusb_discovery(interface); + if (rc) + goto fail; + + return 0; + +fail: + usb_set_intfdata(interface, NULL); + kref_put(&xdev->kref, cleanup_dev); + return rc; +} + +static void xillyusb_disconnect(struct usb_interface *interface) +{ + struct xillyusb_dev *xdev; + + xdev = usb_get_intfdata(interface); + + xillybus_cleanup_chrdev(xdev, &interface->dev); + + /* + * Try to send OPCODE_QUIESCE, which will fail silently if the device + * was disconnected, but makes sense on module unload. + */ + + xillyusb_send_opcode(xdev, ~0, OPCODE_QUIESCE, 0); + + usb_set_intfdata(interface, NULL); + + report_io_error(xdev, -ENODEV); + + mutex_lock(&xdev->io_mutex); + xdev->interface = NULL; + mutex_unlock(&xdev->io_mutex); + + kref_put(&xdev->kref, cleanup_dev); +} + +static struct usb_driver xillyusb_driver = { + .name = xillyname, + .id_table = xillyusb_table, + .probe = xillyusb_probe, + .disconnect = xillyusb_disconnect, +}; + +static int __init xillyusb_init(void) +{ + int rc = 0; + + if (LOG2_INITIAL_FIFO_BUF_SIZE > PAGE_SHIFT) + fifo_buf_order = LOG2_INITIAL_FIFO_BUF_SIZE - PAGE_SHIFT; + else + fifo_buf_order = 0; + + rc = usb_register(&xillyusb_driver); + + return rc; +} + +static void __exit xillyusb_exit(void) +{ + usb_deregister(&xillyusb_driver); +} + +module_init(xillyusb_init); +module_exit(xillyusb_exit); -- 2.17.1 From joe at perches.com Thu Mar 11 09:15:34 2021 From: joe at perches.com (Joe Perches) Date: Thu, 11 Mar 2021 01:15:34 -0800 Subject: [PATCH] staging: rtl8723bs: align comments In-Reply-To: <20210310174830.GM2087@kadam> References: <20210310153717.GA5741@agape.jhs> <20210310174830.GM2087@kadam> Message-ID: <379d4b58d82be1f871924c89e0db7bab367564fb.camel@perches.com> On Wed, 2021-03-10 at 20:48 +0300, Dan Carpenter wrote: > You need to have a space character after the '*'. Perhaps YA checkpatch test... --- scripts/checkpatch.pl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index f42e5ba16d9b..0de553d52605 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3876,6 +3876,21 @@ sub process { } } +# Independent comment lines should have a space after the comment initiator + if ($line =~ /^\+[ \t]*($;+)/) { #leading comment + my $comment = trim(substr($rawline, $-[1], $+[1] - $-[1])); + if ($comment =~ m{^(/\*|\*/|\*|//)(.*)}) { + my $init = $1; + my $rest = $2; + if ($init =~ m{^(?:/\*|\*|//)$} && + $rest ne '' && + $rest !~ /^[\s\*=\-]/) { + WARN("COMMENT_STYLE", + "Comments generally use whitespace after the comment initiator\n" . $herecurr); + } + } + } + # check for missing blank lines after struct/union declarations # with exceptions for various attributes and macros if ($prevline =~ /^[\+ ]};?\s*$/ && From nsaenzjulienne at suse.de Thu Mar 11 13:01:00 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Thu, 11 Mar 2021 14:01:00 +0100 Subject: [PATCH v7 11/11] pwm: Add Raspberry Pi Firmware based PWM bus In-Reply-To: <20210310115041.s7tzvgdpksws6yss@pengutronix.de> References: <20210118123244.13669-1-nsaenzjulienne@suse.de> <20210118123244.13669-12-nsaenzjulienne@suse.de> <20210310115041.s7tzvgdpksws6yss@pengutronix.de> Message-ID: Hi Uwe, thanks for taking the time to look into this. :) On Wed, 2021-03-10 at 12:50 +0100, Uwe Kleine-K?nig wrote: > Hello Nicolas, > > On Mon, Jan 18, 2021 at 01:32:44PM +0100, Nicolas Saenz Julienne wrote: [...] > > + /* > > + * This sets the default duty cycle after resetting the board, we > > + * updated it every time to mimic Raspberry Pi's downstream's driver > > + * behaviour. > > + */ > > + ret = raspberrypi_pwm_set_property(rpipwm->firmware, RPI_PWM_DEF_DUTY_REG, > > + duty_cycle); > > + if (ret) { > > + dev_err(chip->dev, "Failed to set default duty cycle: %pe\n", > > + ERR_PTR(ret)); > > + return ret; > > This only has an effect for the next reboot, right? It effects all reboots until it's further changed. > If so I wonder if it is a good idea in general. (Think: The current PWM > setting enables a motor that makes a self-driving car move at 100 km/h. > Consider the rpi crashes, do I want to car to pick up driving 100 km/h at > power up even before Linux is up again?) I get your point. But this isn't used as a general purpose PWM. For now the interface is solely there to drive a PWM fan that's arguably harmless. This doesn't mean that the RPi foundation will not reuse the firmware interface for other means in the future. In such case we can always use a new DT compatible and bypass this feature (the current DT string is 'raspberrypi,firmware-poe-pwm', which is specific to this use-case). My aim here is to be on par feature wise with RPi's downstream implementation. So as for them to be able to use it as is and avoid duplication. Now, if this is blocking the driver from being merged, I'd rather remove it. It'll be a patch for the downstream kernel to maintain, but better than nothing. > And if we agree it's a good idea: Should raspberrypi_pwm_apply return 0 if > setting the duty cycle succeeded and only setting the default didn't? Good point. I don't think so. We'd be also missing on the following by returning early: rpipwm->duty_cycle = duty_cycle; I propose to change it to a 'best effort' approach, if it fails, log it and continue successfully. Regards, Nicolas -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: This is a digitally signed message part URL: From u.kleine-koenig at pengutronix.de Thu Mar 11 13:18:45 2021 From: u.kleine-koenig at pengutronix.de (Uwe =?utf-8?Q?Kleine-K=C3=B6nig?=) Date: Thu, 11 Mar 2021 14:18:45 +0100 Subject: [PATCH v7 11/11] pwm: Add Raspberry Pi Firmware based PWM bus In-Reply-To: References: <20210118123244.13669-1-nsaenzjulienne@suse.de> <20210118123244.13669-12-nsaenzjulienne@suse.de> <20210310115041.s7tzvgdpksws6yss@pengutronix.de> Message-ID: <20210311131845.x3zybis3x2liu2uk@pengutronix.de> Hello Nicolas, On Thu, Mar 11, 2021 at 02:01:00PM +0100, Nicolas Saenz Julienne wrote: > On Wed, 2021-03-10 at 12:50 +0100, Uwe Kleine-K?nig wrote: > > On Mon, Jan 18, 2021 at 01:32:44PM +0100, Nicolas Saenz Julienne wrote: > > [...] > > > > + /* > > > + * This sets the default duty cycle after resetting the board, we > > > + * updated it every time to mimic Raspberry Pi's downstream's driver > > > + * behaviour. > > > + */ > > > + ret = raspberrypi_pwm_set_property(rpipwm->firmware, RPI_PWM_DEF_DUTY_REG, > > > + duty_cycle); > > > + if (ret) { > > > + dev_err(chip->dev, "Failed to set default duty cycle: %pe\n", > > > + ERR_PTR(ret)); > > > + return ret; > > > > This only has an effect for the next reboot, right? > > It effects all reboots until it's further changed. > > > If so I wonder if it is a good idea in general. (Think: The current PWM > > setting enables a motor that makes a self-driving car move at 100 km/h. > > Consider the rpi crashes, do I want to car to pick up driving 100 km/h at > > power up even before Linux is up again?) > > I get your point. But this isn't used as a general purpose PWM. For now the > interface is solely there to drive a PWM fan that's arguably harmless. This > doesn't mean that the RPi foundation will not reuse the firmware interface for > other means in the future. In such case we can always use a new DT compatible > and bypass this feature (the current DT string is > 'raspberrypi,firmware-poe-pwm', which is specific to this use-case). > > My aim here is to be on par feature wise with RPi's downstream implementation. Just because the downstream kernel does it should not be the (single) reason to do that. My gut feeling is: For a motor restoring the PWM config on reboot is bad and for a fan it doesn't really hurt if it doesn't restart automatically. So I'd prefer to to drop this feature. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | https://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: not available URL: From nsaenzjulienne at suse.de Thu Mar 11 13:41:10 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Thu, 11 Mar 2021 14:41:10 +0100 Subject: [PATCH v7 11/11] pwm: Add Raspberry Pi Firmware based PWM bus In-Reply-To: <20210311131845.x3zybis3x2liu2uk@pengutronix.de> References: <20210118123244.13669-1-nsaenzjulienne@suse.de> <20210118123244.13669-12-nsaenzjulienne@suse.de> <20210310115041.s7tzvgdpksws6yss@pengutronix.de> <20210311131845.x3zybis3x2liu2uk@pengutronix.de> Message-ID: <865b4bb56cb9b0a9041c61f1ae7c9c76e807ebd3.camel@suse.de> On Thu, 2021-03-11 at 14:18 +0100, Uwe Kleine-K?nig wrote: > Hello Nicolas, > > On Thu, Mar 11, 2021 at 02:01:00PM +0100, Nicolas Saenz Julienne wrote: > > On Wed, 2021-03-10 at 12:50 +0100, Uwe Kleine-K?nig wrote: > > > On Mon, Jan 18, 2021 at 01:32:44PM +0100, Nicolas Saenz Julienne wrote: > > > > [...] > > > > > > + /* > > > > + * This sets the default duty cycle after resetting the board, we > > > > + * updated it every time to mimic Raspberry Pi's downstream's driver > > > > + * behaviour. > > > > + */ > > > > + ret = raspberrypi_pwm_set_property(rpipwm->firmware, RPI_PWM_DEF_DUTY_REG, > > > > + duty_cycle); > > > > + if (ret) { > > > > + dev_err(chip->dev, "Failed to set default duty cycle: %pe\n", > > > > + ERR_PTR(ret)); > > > > + return ret; > > > > > > This only has an effect for the next reboot, right? > > > > It effects all reboots until it's further changed. > > > > > If so I wonder if it is a good idea in general. (Think: The current PWM > > > setting enables a motor that makes a self-driving car move at 100 km/h. > > > Consider the rpi crashes, do I want to car to pick up driving 100 km/h at > > > power up even before Linux is up again?) > > > > I get your point. But this isn't used as a general purpose PWM. For now the > > interface is solely there to drive a PWM fan that's arguably harmless. This > > doesn't mean that the RPi foundation will not reuse the firmware interface for > > other means in the future. In such case we can always use a new DT compatible > > and bypass this feature (the current DT string is > > 'raspberrypi,firmware-poe-pwm', which is specific to this use-case). > > > > My aim here is to be on par feature wise with RPi's downstream implementation. > > Just because the downstream kernel does it should not be the (single) > reason to do that. My gut feeling is: For a motor restoring the PWM > config on reboot is bad and for a fan it doesn't really hurt if it > doesn't restart automatically. So I'd prefer to to drop this feature. Fair enough, I'll remove it then. Regards, Nicolas -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: This is a digitally signed message part URL: From mail.amchurch.co.uk at osuosl.org Thu Mar 11 15:48:24 2021 From: mail.amchurch.co.uk at osuosl.org (Mrs E Schroeder) Date: Thu, 11 Mar 2021 16:48:24 +0100 Subject: An Appeal Message-ID: <20210311180832.7A69D4A810@smtp4.osuosl.org> Hello Beloved in the lord Greetings in the name of our lord Jesus Christ. I am Mrs Elizabeth Schroder from Germany, a widow to late Dr. A. Schroder l am 51 years old and a converted born again Christian, suffering from long time cancer of the breast, from all indication my condition is really deteriorating and it is quite obvious that I might not live more than two (2) months, according to my doctor because the cancer has gotten to a very worst / dangerous stage. My late husband and my only child died last five years ago, his death was politically motivated. My late husband was a very rich and wealthy oil business man who was running his oil,Gold/Diamond Business here in West Africa Nigeria. After his death, I inherited all his business and wealth. My doctors has advised me that I may not live for more than two (2) months, so I now decided to divide the part of this wealth, to contribute to the development of the church in Africa, America, Asia, and Europe. I collected your email address during my desperate search on the internet and I prayed over it. I decided to donate the sum of $17,500,000.00 USD (Seventeen Million Five hundred thousand United States dollars) to the less privileged because I cannot take this money to the grave. Please I want you to note that this fund is lodged in a private bank here in Africa(Standard Trust Bank Africa). Once I hear from you, I will forward to you all the information's you will use to get this fund released from the bank and to be transferred to your bank account. I honestly pray that this money when transferred to you will be used for the said purpose because l have come to find out that wealth acquisition without Christ is vanity. May the grace of our lord Jesus the love of God and the fellowship of God be with you and your family. Reply me on my private email address zbthschroder1 at gmail.com Thanks and God bless you. Your beloved sister in Christ. Mrs. Elizabeth Schroder Donor From mail.amchurch.co.uk at osuosl.org Thu Mar 11 15:48:24 2021 From: mail.amchurch.co.uk at osuosl.org (Mrs E Schroeder) Date: Thu, 11 Mar 2021 16:48:24 +0100 Subject: An Appeal Message-ID: <20210311180832.7B9C14EC62@smtp4.osuosl.org> Hello Beloved in the lord Greetings in the name of our lord Jesus Christ. I am Mrs Elizabeth Schroder from Germany, a widow to late Dr. A. Schroder l am 51 years old and a converted born again Christian, suffering from long time cancer of the breast, from all indication my condition is really deteriorating and it is quite obvious that I might not live more than two (2) months, according to my doctor because the cancer has gotten to a very worst / dangerous stage. My late husband and my only child died last five years ago, his death was politically motivated. My late husband was a very rich and wealthy oil business man who was running his oil,Gold/Diamond Business here in West Africa Nigeria. After his death, I inherited all his business and wealth. My doctors has advised me that I may not live for more than two (2) months, so I now decided to divide the part of this wealth, to contribute to the development of the church in Africa, America, Asia, and Europe. I collected your email address during my desperate search on the internet and I prayed over it. I decided to donate the sum of $17,500,000.00 USD (Seventeen Million Five hundred thousand United States dollars) to the less privileged because I cannot take this money to the grave. Please I want you to note that this fund is lodged in a private bank here in Africa(Standard Trust Bank Africa). Once I hear from you, I will forward to you all the information's you will use to get this fund released from the bank and to be transferred to your bank account. I honestly pray that this money when transferred to you will be used for the said purpose because l have come to find out that wealth acquisition without Christ is vanity. May the grace of our lord Jesus the love of God and the fellowship of God be with you and your family. Reply me on my private email address zbthschroder1 at gmail.com Thanks and God bless you. Your beloved sister in Christ. Mrs. Elizabeth Schroder Donor From dualli at chromium.org Thu Mar 11 18:46:26 2021 From: dualli at chromium.org (Li Li) Date: Thu, 11 Mar 2021 10:46:26 -0800 Subject: [PATCH v2 0/3] Binder: Enable App Freezing Capability Message-ID: <20210311184629.589725-1-dualli@chromium.org> From: Li Li To improve the user experience when switching between recently used applications, the background applications which are not currently needed are cached in the memory. Normally, a well designed application will not consume valuable CPU resources in the background. However, it's possible some applications are not able or willing to behave as expected, wasting energy even after being cached. It is a good idea to freeze those applications when they're only being kept alive for the sake of faster startup and energy saving. These kernel patches will provide the necessary infrastructure for user space framework to freeze and thaw a cached process, check the current freezing status and correctly deal with outstanding binder transactions to frozen processes. Changes in v2: avoid panic by using pr_warn for unexpected cases. Marco Ballesio (3): binder: BINDER_FREEZE ioctl binder: use EINTR for interrupted wait for work binder: BINDER_GET_FROZEN_INFO ioctl drivers/android/binder.c | 200 ++++++++++++++++++++++++++-- drivers/android/binder_internal.h | 18 +++ include/uapi/linux/android/binder.h | 20 +++ 3 files changed, 226 insertions(+), 12 deletions(-) -- 2.31.0.rc2.261.g7f71774620-goog From dualli at chromium.org Thu Mar 11 18:46:28 2021 From: dualli at chromium.org (Li Li) Date: Thu, 11 Mar 2021 10:46:28 -0800 Subject: [PATCH v2 2/3] binder: use EINTR for interrupted wait for work In-Reply-To: <20210311184629.589725-1-dualli@chromium.org> References: <20210311184629.589725-1-dualli@chromium.org> Message-ID: <20210311184629.589725-3-dualli@chromium.org> From: Marco Ballesio when interrupted by a signal, binder_wait_for_work currently returns -ERESTARTSYS. This error code isn't propagated to user space, but a way to handle interruption due to signals must be provided to code using this API. Replace this instance of -ERESTARTSYS with -EINTR, which is propagated to user space. Test: built, booted, interrupted a worker thread within binder_wait_for_work Signed-off-by: Marco Ballesio Signed-off-by: Li Li --- drivers/android/binder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 76ea558df03e..38bbf9a4ce99 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -3712,7 +3712,7 @@ static int binder_wait_for_work(struct binder_thread *thread, binder_inner_proc_lock(proc); list_del_init(&thread->waiting_thread_node); if (signal_pending(current)) { - ret = -ERESTARTSYS; + ret = -EINTR; break; } } @@ -4855,7 +4855,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) if (thread) thread->looper_need_return = false; wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2); - if (ret && ret != -ERESTARTSYS) + if (ret && ret != -EINTR) pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); err_unlocked: trace_binder_ioctl_done(ret); -- 2.31.0.rc2.261.g7f71774620-goog From dualli at chromium.org Thu Mar 11 18:46:27 2021 From: dualli at chromium.org (Li Li) Date: Thu, 11 Mar 2021 10:46:27 -0800 Subject: [PATCH v2 1/3] binder: BINDER_FREEZE ioctl In-Reply-To: <20210311184629.589725-1-dualli@chromium.org> References: <20210311184629.589725-1-dualli@chromium.org> Message-ID: <20210311184629.589725-2-dualli@chromium.org> From: Marco Ballesio Frozen tasks can't process binder transactions, so a way is required to inform transmitting ends of communication failures due to the frozen state of their receiving counterparts. Additionally, races are possible between transitions to frozen state and binder transactions enqueued to a specific process. Implement BINDER_FREEZE ioctl for user space to inform the binder driver about the intention to freeze or unfreeze a process. When the ioctl is called, block the caller until any pending binder transactions toward the target process are flushed. Return an error to transactions to processes marked as frozen. Signed-off-by: Marco Ballesio Co-developed-by: Todd Kjos Signed-off-by: Todd Kjos Signed-off-by: Li Li --- drivers/android/binder.c | 141 ++++++++++++++++++++++++++-- drivers/android/binder_internal.h | 12 +++ include/uapi/linux/android/binder.h | 13 +++ 3 files changed, 156 insertions(+), 10 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index c119736ca56a..76ea558df03e 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -1506,6 +1506,12 @@ static void binder_free_transaction(struct binder_transaction *t) if (target_proc) { binder_inner_proc_lock(target_proc); + target_proc->outstanding_txns--; + if (target_proc->outstanding_txns < 0) + pr_warn("%s: Unexpected outstanding_txns %d\n", + __func__, target_proc->outstanding_txns); + if (!target_proc->outstanding_txns && target_proc->is_frozen) + wake_up_interruptible_all(&target_proc->freeze_wait); if (t->buffer) t->buffer->transaction = NULL; binder_inner_proc_unlock(target_proc); @@ -2331,10 +2337,11 @@ static int binder_fixup_parent(struct binder_transaction *t, * If the @thread parameter is not NULL, the transaction is always queued * to the waitlist of that specific thread. * - * Return: true if the transactions was successfully queued - * false if the target process or thread is dead + * Return: 0 if the transaction was successfully queued + * BR_DEAD_REPLY if the target process or thread is dead + * BR_FROZEN_REPLY if the target process or thread is frozen */ -static bool binder_proc_transaction(struct binder_transaction *t, +static int binder_proc_transaction(struct binder_transaction *t, struct binder_proc *proc, struct binder_thread *thread) { @@ -2354,10 +2361,13 @@ static bool binder_proc_transaction(struct binder_transaction *t, binder_inner_proc_lock(proc); - if (proc->is_dead || (thread && thread->is_dead)) { + if ((proc->is_frozen && !oneway) || proc->is_dead || + (thread && thread->is_dead)) { + bool proc_is_dead = proc->is_dead + || (thread && thread->is_dead); binder_inner_proc_unlock(proc); binder_node_unlock(node); - return false; + return proc_is_dead ? BR_DEAD_REPLY : BR_FROZEN_REPLY; } if (!thread && !pending_async) @@ -2373,10 +2383,11 @@ static bool binder_proc_transaction(struct binder_transaction *t, if (!pending_async) binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); + proc->outstanding_txns++; binder_inner_proc_unlock(proc); binder_node_unlock(node); - return true; + return 0; } /** @@ -3013,13 +3024,16 @@ static void binder_transaction(struct binder_proc *proc, if (reply) { binder_enqueue_thread_work(thread, tcomplete); binder_inner_proc_lock(target_proc); - if (target_thread->is_dead) { + if (target_thread->is_dead || target_proc->is_frozen) { + return_error = target_thread->is_dead ? + BR_DEAD_REPLY : BR_FROZEN_REPLY; binder_inner_proc_unlock(target_proc); goto err_dead_proc_or_thread; } BUG_ON(t->buffer->async_transaction != 0); binder_pop_transaction_ilocked(target_thread, in_reply_to); binder_enqueue_thread_work_ilocked(target_thread, &t->work); + target_proc->outstanding_txns++; binder_inner_proc_unlock(target_proc); wake_up_interruptible_sync(&target_thread->wait); binder_free_transaction(in_reply_to); @@ -3038,7 +3052,9 @@ static void binder_transaction(struct binder_proc *proc, t->from_parent = thread->transaction_stack; thread->transaction_stack = t; binder_inner_proc_unlock(proc); - if (!binder_proc_transaction(t, target_proc, target_thread)) { + return_error = binder_proc_transaction(t, + target_proc, target_thread); + if (return_error) { binder_inner_proc_lock(proc); binder_pop_transaction_ilocked(thread, t); binder_inner_proc_unlock(proc); @@ -3048,7 +3064,8 @@ static void binder_transaction(struct binder_proc *proc, BUG_ON(target_node == NULL); BUG_ON(t->buffer->async_transaction != 1); binder_enqueue_thread_work(thread, tcomplete); - if (!binder_proc_transaction(t, target_proc, NULL)) + return_error = binder_proc_transaction(t, target_proc, NULL); + if (return_error) goto err_dead_proc_or_thread; } if (target_thread) @@ -3065,7 +3082,6 @@ static void binder_transaction(struct binder_proc *proc, return; err_dead_proc_or_thread: - return_error = BR_DEAD_REPLY; return_error_line = __LINE__; binder_dequeue_work(proc, tcomplete); err_translate_failed: @@ -4298,6 +4314,9 @@ static void binder_free_proc(struct binder_proc *proc) BUG_ON(!list_empty(&proc->todo)); BUG_ON(!list_empty(&proc->delivered_death)); + if (proc->outstanding_txns) + pr_warn("%s: Unexpected outstanding_txns %d\n", + __func__, proc->outstanding_txns); device = container_of(proc->context, struct binder_device, context); if (refcount_dec_and_test(&device->ref)) { kfree(proc->context->name); @@ -4359,6 +4378,7 @@ static int binder_thread_release(struct binder_proc *proc, (t->to_thread == thread) ? "in" : "out"); if (t->to_thread == thread) { + thread->proc->outstanding_txns--; t->to_proc = NULL; t->to_thread = NULL; if (t->buffer) { @@ -4609,6 +4629,45 @@ static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, return 0; } +static int binder_ioctl_freeze(struct binder_freeze_info *info, + struct binder_proc *target_proc) +{ + int ret = 0; + + if (!info->enable) { + binder_inner_proc_lock(target_proc); + target_proc->is_frozen = false; + binder_inner_proc_unlock(target_proc); + return 0; + } + + /* + * Freezing the target. Prevent new transactions by + * setting frozen state. If timeout specified, wait + * for transactions to drain. + */ + binder_inner_proc_lock(target_proc); + target_proc->is_frozen = true; + binder_inner_proc_unlock(target_proc); + + if (info->timeout_ms > 0) + ret = wait_event_interruptible_timeout( + target_proc->freeze_wait, + (!target_proc->outstanding_txns), + msecs_to_jiffies(info->timeout_ms)); + + if (!ret && target_proc->outstanding_txns) + ret = -EAGAIN; + + if (ret < 0) { + binder_inner_proc_lock(target_proc); + target_proc->is_frozen = false; + binder_inner_proc_unlock(target_proc); + } + + return ret; +} + static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { int ret; @@ -4727,6 +4786,66 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) } break; } + case BINDER_FREEZE: { + struct binder_freeze_info info; + struct binder_proc **target_procs = NULL, *target_proc; + int target_procs_count = 0, i = 0; + + ret = 0; + + if (copy_from_user(&info, ubuf, sizeof(info))) { + ret = -EFAULT; + goto err; + } + + mutex_lock(&binder_procs_lock); + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { + if (target_proc->pid == info.pid) + target_procs_count++; + } + + if (target_procs_count == 0) { + mutex_unlock(&binder_procs_lock); + ret = -EINVAL; + goto err; + } + + target_procs = kcalloc(target_procs_count, + sizeof(struct binder_proc *), + GFP_KERNEL); + + if (!target_procs) { + mutex_unlock(&binder_procs_lock); + ret = -ENOMEM; + goto err; + } + + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { + if (target_proc->pid != info.pid) + continue; + + binder_inner_proc_lock(target_proc); + target_proc->tmp_ref++; + binder_inner_proc_unlock(target_proc); + + target_procs[i++] = target_proc; + } + mutex_unlock(&binder_procs_lock); + + for (i = 0; i < target_procs_count; i++) { + if (ret >= 0) + ret = binder_ioctl_freeze(&info, + target_procs[i]); + + binder_proc_dec_tmpref(target_procs[i]); + } + + kfree(target_procs); + + if (ret < 0) + goto err; + break; + } default: ret = -EINVAL; goto err; @@ -4823,6 +4942,7 @@ static int binder_open(struct inode *nodp, struct file *filp) get_task_struct(current->group_leader); proc->tsk = current->group_leader; INIT_LIST_HEAD(&proc->todo); + init_waitqueue_head(&proc->freeze_wait); proc->default_priority = task_nice(current); /* binderfs stashes devices in i_private */ if (is_binderfs_device(nodp)) { @@ -5035,6 +5155,7 @@ static void binder_deferred_release(struct binder_proc *proc) proc->tmp_ref++; proc->is_dead = true; + proc->is_frozen = false; threads = 0; active_transactions = 0; while ((n = rb_first(&proc->threads))) { diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h index 6cd79011e35d..e6a53e98c6da 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -367,9 +367,18 @@ struct binder_ref { * (protected by binder_deferred_lock) * @deferred_work: bitmap of deferred work to perform * (protected by binder_deferred_lock) + * @outstanding_txns: number of transactions to be transmitted before + * processes in freeze_wait are woken up + * (protected by @inner_lock) * @is_dead: process is dead and awaiting free * when outstanding transactions are cleaned up * (protected by @inner_lock) + * @is_frozen: process is frozen and unable to service + * binder transactions + * (protected by @inner_lock) + * @freeze_wait: waitqueue of processes waiting for all outstanding + * transactions to be processed + * (protected by @inner_lock) * @todo: list of work for this process * (protected by @inner_lock) * @stats: per-process binder statistics @@ -410,7 +419,10 @@ struct binder_proc { struct task_struct *tsk; struct hlist_node deferred_work_node; int deferred_work; + int outstanding_txns; bool is_dead; + bool is_frozen; + wait_queue_head_t freeze_wait; struct list_head todo; struct binder_stats stats; diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h index ec84ad106568..7eb5b818b3c1 100644 --- a/include/uapi/linux/android/binder.h +++ b/include/uapi/linux/android/binder.h @@ -217,6 +217,12 @@ struct binder_node_info_for_ref { __u32 reserved3; }; +struct binder_freeze_info { + __u32 pid; + __u32 enable; + __u32 timeout_ms; +}; + #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) @@ -227,6 +233,7 @@ struct binder_node_info_for_ref { #define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info) #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref) #define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object) +#define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info) /* * NOTE: Two special error codes you should check for when calling @@ -408,6 +415,12 @@ enum binder_driver_return_protocol { * The last transaction (either a bcTRANSACTION or * a bcATTEMPT_ACQUIRE) failed (e.g. out of memory). No parameters. */ + + BR_FROZEN_REPLY = _IO('r', 18), + /* + * The target of the last transaction (either a bcTRANSACTION or + * a bcATTEMPT_ACQUIRE) is frozen. No parameters. + */ }; enum binder_driver_command_protocol { -- 2.31.0.rc2.261.g7f71774620-goog From dualli at chromium.org Thu Mar 11 18:46:29 2021 From: dualli at chromium.org (Li Li) Date: Thu, 11 Mar 2021 10:46:29 -0800 Subject: [PATCH v2 3/3] binder: BINDER_GET_FROZEN_INFO ioctl In-Reply-To: <20210311184629.589725-1-dualli@chromium.org> References: <20210311184629.589725-1-dualli@chromium.org> Message-ID: <20210311184629.589725-4-dualli@chromium.org> From: Marco Ballesio User space needs to know if binder transactions occurred to frozen processes. Introduce a new BINDER_GET_FROZEN ioctl and keep track of transactions occurring to frozen proceses. Signed-off-by: Marco Ballesio Signed-off-by: Li Li --- drivers/android/binder.c | 55 +++++++++++++++++++++++++++++ drivers/android/binder_internal.h | 6 ++++ include/uapi/linux/android/binder.h | 7 ++++ 3 files changed, 68 insertions(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 38bbf9a4ce99..b4999ed04b2e 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2360,6 +2360,10 @@ static int binder_proc_transaction(struct binder_transaction *t, } binder_inner_proc_lock(proc); + if (proc->is_frozen) { + proc->sync_recv |= !oneway; + proc->async_recv |= oneway; + } if ((proc->is_frozen && !oneway) || proc->is_dead || (thread && thread->is_dead)) { @@ -4636,6 +4640,8 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, if (!info->enable) { binder_inner_proc_lock(target_proc); + target_proc->sync_recv = false; + target_proc->async_recv = false; target_proc->is_frozen = false; binder_inner_proc_unlock(target_proc); return 0; @@ -4647,6 +4653,8 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, * for transactions to drain. */ binder_inner_proc_lock(target_proc); + target_proc->sync_recv = false; + target_proc->async_recv = false; target_proc->is_frozen = true; binder_inner_proc_unlock(target_proc); @@ -4668,6 +4676,33 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, return ret; } +static int binder_ioctl_get_freezer_info( + struct binder_frozen_status_info *info) +{ + struct binder_proc *target_proc; + bool found = false; + + info->sync_recv = 0; + info->async_recv = 0; + + mutex_lock(&binder_procs_lock); + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { + if (target_proc->pid == info->pid) { + found = true; + binder_inner_proc_lock(target_proc); + info->sync_recv |= target_proc->sync_recv; + info->async_recv |= target_proc->async_recv; + binder_inner_proc_unlock(target_proc); + } + } + mutex_unlock(&binder_procs_lock); + + if (!found) + return -EINVAL; + + return 0; +} + static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { int ret; @@ -4846,6 +4881,24 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) goto err; break; } + case BINDER_GET_FROZEN_INFO: { + struct binder_frozen_status_info info; + + if (copy_from_user(&info, ubuf, sizeof(info))) { + ret = -EFAULT; + goto err; + } + + ret = binder_ioctl_get_freezer_info(&info); + if (ret < 0) + goto err; + + if (copy_to_user(ubuf, &info, sizeof(info))) { + ret = -EFAULT; + goto err; + } + break; + } default: ret = -EINVAL; goto err; @@ -5156,6 +5209,8 @@ static void binder_deferred_release(struct binder_proc *proc) proc->is_dead = true; proc->is_frozen = false; + proc->sync_recv = false; + proc->async_recv = false; threads = 0; active_transactions = 0; while ((n = rb_first(&proc->threads))) { diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h index e6a53e98c6da..2872a7de68e1 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -376,6 +376,10 @@ struct binder_ref { * @is_frozen: process is frozen and unable to service * binder transactions * (protected by @inner_lock) + * @sync_recv: process received sync transactions since last frozen + * (protected by @inner_lock) + * @async_recv: process received async transactions since last frozen + * (protected by @inner_lock) * @freeze_wait: waitqueue of processes waiting for all outstanding * transactions to be processed * (protected by @inner_lock) @@ -422,6 +426,8 @@ struct binder_proc { int outstanding_txns; bool is_dead; bool is_frozen; + bool sync_recv; + bool async_recv; wait_queue_head_t freeze_wait; struct list_head todo; diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h index 7eb5b818b3c1..156070d18c4f 100644 --- a/include/uapi/linux/android/binder.h +++ b/include/uapi/linux/android/binder.h @@ -223,6 +223,12 @@ struct binder_freeze_info { __u32 timeout_ms; }; +struct binder_frozen_status_info { + __u32 pid; + __u32 sync_recv; + __u32 async_recv; +}; + #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) @@ -234,6 +240,7 @@ struct binder_freeze_info { #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref) #define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object) #define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info) +#define BINDER_GET_FROZEN_INFO _IOWR('b', 15, struct binder_frozen_status_info) /* * NOTE: Two special error codes you should check for when calling -- 2.31.0.rc2.261.g7f71774620-goog From penghaob at uniontech.com Fri Mar 12 00:59:34 2021 From: penghaob at uniontech.com (Hao Peng) Date: Fri, 12 Mar 2021 08:59:34 +0800 Subject: [PATCH] staging: rtl8723bs: remove extra space Message-ID: <20210312005934.21895-1-penghaob@uniontech.com> Remove extra space in hal_intf.c. Signed-off-by: Hao Peng --- drivers/staging/rtl8723bs/hal/hal_intf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c index ac3066a91c84..9fb377633852 100644 --- a/drivers/staging/rtl8723bs/hal/hal_intf.c +++ b/drivers/staging/rtl8723bs/hal/hal_intf.c @@ -116,7 +116,7 @@ uint rtw_hal_init(struct adapter *padapter) uint rtw_hal_deinit(struct adapter *padapter) { - uint status = _SUCCESS; + uint status = _SUCCESS; struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); status = padapter->HalFunc.hal_deinit(padapter); -- 2.20.1 From penghaob at uniontech.com Fri Mar 12 01:07:52 2021 From: penghaob at uniontech.com (Hao Peng) Date: Fri, 12 Mar 2021 09:07:52 +0800 Subject: [PATCH] staging: rtl8723bs: remove extra lines Message-ID: <20210312010752.27448-1-penghaob@uniontech.com> Remove extra lines in many functions in hal_intf.c. Signed-off-by: Hao Peng --- drivers/staging/rtl8723bs/hal/hal_intf.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c index 9fb377633852..e74e9c0608ee 100644 --- a/drivers/staging/rtl8723bs/hal/hal_intf.c +++ b/drivers/staging/rtl8723bs/hal/hal_intf.c @@ -111,7 +111,6 @@ uint rtw_hal_init(struct adapter *padapter) RT_TRACE(_module_hal_init_c_, _drv_err_, ("-rtl871x_hal_init:status = 0x%x\n", status)); return status; - } uint rtw_hal_deinit(struct adapter *padapter) @@ -180,7 +179,6 @@ void rtw_hal_enable_interrupt(struct adapter *padapter) padapter->HalFunc.enable_interrupt(padapter); else DBG_871X("%s: HalFunc.enable_interrupt is NULL!\n", __func__); - } void rtw_hal_disable_interrupt(struct adapter *padapter) @@ -189,7 +187,6 @@ void rtw_hal_disable_interrupt(struct adapter *padapter) padapter->HalFunc.disable_interrupt(padapter); else DBG_871X("%s: HalFunc.disable_interrupt is NULL!\n", __func__); - } u8 rtw_hal_check_ips_status(struct adapter *padapter) @@ -269,7 +266,6 @@ s32 rtw_hal_init_recv_priv(struct adapter *padapter) void rtw_hal_free_recv_priv(struct adapter *padapter) { - if (padapter->HalFunc.free_recv_priv) padapter->HalFunc.free_recv_priv(padapter); } @@ -358,7 +354,6 @@ void rtw_hal_dm_watchdog(struct adapter *padapter) { if (padapter->HalFunc.hal_dm_watchdog) padapter->HalFunc.hal_dm_watchdog(padapter); - } void rtw_hal_dm_watchdog_in_lps(struct adapter *padapter) @@ -422,7 +417,6 @@ s32 rtw_hal_macid_sleep(struct adapter *padapter, u32 macid) { u8 support; - support = false; rtw_hal_get_def_var(padapter, HAL_DEF_MACID_SLEEP, &support); if (false == support) @@ -437,7 +431,6 @@ s32 rtw_hal_macid_wakeup(struct adapter *padapter, u32 macid) { u8 support; - support = false; rtw_hal_get_def_var(padapter, HAL_DEF_MACID_SLEEP, &support); if (false == support) -- 2.20.1 From king at pemilra.fti.uajy.ac.id Fri Mar 12 02:08:08 2021 From: king at pemilra.fti.uajy.ac.id (IMF) Date: Fri, 12 Mar 2021 09:08:08 +0700 Subject: VERIFICATION AND APPROVAL OF YOUR PAYMENT FILE Message-ID: INTERNATIONAL FUNDS TRANSFER / AUDIT UNIT UNITED NATION (WORLD BANK ASSISTED PROGRAMME) DIRECTORATE OF INTERNATIONAL PAYMENT AND TRANSFERS. Ref: WB/NF/UN/XX027. ATTN: BENEFICIARY: This is to inform you that the regional verification office has received your message concerning the approved list of the United Nation Records of Outstanding Funds which your NAME/PARTICULARS WAS DISCOVERED AS NEXT ON THE APPROVED LIST., I have been assigned to direct you on the transfer of US$12,500,000.00 (TWELVE MILLION FIVE HUNDRED THOUSAND DOLLARS)into your Bank account. Note: YOU ARE THEREFORE STRONGLY ADVISE TO STOP FURTHER COMMUNICATION WITH ANY OTHER BANK OR INSTITUTION REGARDING THIS MATTER, FOR THE OVERALL SAFETY OF YOU AND YOUR FUND, you are hereby required to fill up the below application form for payment to enable the paying bank make the transfer into your bank account immediately. PERSONAL INFORMATION'S First Name: Last Name: Gender: Age: Marital Status: Contact Address: Nationality: Occupation: Mobile phone No: Have a nice day, Looking forward to your E-mail. United nation Approval No;UN5685P, White HouseApproved No:WH44CV, Reference No.-35460021, Allocation No: 674632 Password No: 339331 , Pin Code No: 55674 Certificate of Merit Payment No : 103 , Released Code No: 0763; NOTE: PLEASE BASE ON THE PRESURE WE ARE HAVING IN MAKING SURE ALL BENEFICIARY RECEIVED THERE PAYMENT, WE WILL ADVICE YOU URGENTLY COMPLY WITH THE ABOVE INSTRUCTION TO AVOID THE CANCELLATION OF YOUR FUND. AS [1]A MATTER OF URGENCY I WILL ADVICE YOU HAVE ALL THE ABOVE INSTRUCTION FOLLOWED AND AS URGENT AS POSIBLE TO AVOID CANCELLATION AND USING YOUR FUND TO PAY OTHER WHO HAS COMPLIED BEST REGARD. ANDREW TWEEDIE DIRECTOR INTERNATIONAL MONETARY FUND. From king at pemilra.fti.uajy.ac.id Fri Mar 12 02:08:08 2021 From: king at pemilra.fti.uajy.ac.id (IMF) Date: Fri, 12 Mar 2021 09:08:08 +0700 Subject: VERIFICATION AND APPROVAL OF YOUR PAYMENT FILE Message-ID: INTERNATIONAL FUNDS TRANSFER / AUDIT UNIT UNITED NATION (WORLD BANK ASSISTED PROGRAMME) DIRECTORATE OF INTERNATIONAL PAYMENT AND TRANSFERS. Ref: WB/NF/UN/XX027. ATTN: BENEFICIARY: This is to inform you that the regional verification office has received your message concerning the approved list of the United Nation Records of Outstanding Funds which your NAME/PARTICULARS WAS DISCOVERED AS NEXT ON THE APPROVED LIST., I have been assigned to direct you on the transfer of US$12,500,000.00 (TWELVE MILLION FIVE HUNDRED THOUSAND DOLLARS)into your Bank account. Note: YOU ARE THEREFORE STRONGLY ADVISE TO STOP FURTHER COMMUNICATION WITH ANY OTHER BANK OR INSTITUTION REGARDING THIS MATTER, FOR THE OVERALL SAFETY OF YOU AND YOUR FUND, you are hereby required to fill up the below application form for payment to enable the paying bank make the transfer into your bank account immediately. PERSONAL INFORMATION'S First Name: Last Name: Gender: Age: Marital Status: Contact Address: Nationality: Occupation: Mobile phone No: Have a nice day, Looking forward to your E-mail. United nation Approval No;UN5685P, White HouseApproved No:WH44CV, Reference No.-35460021, Allocation No: 674632 Password No: 339331 , Pin Code No: 55674 Certificate of Merit Payment No : 103 , Released Code No: 0763; NOTE: PLEASE BASE ON THE PRESURE WE ARE HAVING IN MAKING SURE ALL BENEFICIARY RECEIVED THERE PAYMENT, WE WILL ADVICE YOU URGENTLY COMPLY WITH THE ABOVE INSTRUCTION TO AVOID THE CANCELLATION OF YOUR FUND. AS [1]A MATTER OF URGENCY I WILL ADVICE YOU HAVE ALL THE ABOVE INSTRUCTION FOLLOWED AND AS URGENT AS POSIBLE TO AVOID CANCELLATION AND USING YOUR FUND TO PAY OTHER WHO HAS COMPLIED BEST REGARD. ANDREW TWEEDIE DIRECTOR INTERNATIONAL MONETARY FUND. From marcocesati at gmail.com Fri Mar 12 08:26:05 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:05 +0100 Subject: [PATCHSET] remove 153 useless typedefs in staging/rtl8723bs Message-ID: <20210312082638.25512-1-marco.cesati@gmail.com> This set of patches remove 153 useless typedef instructions in the staging/rtl8723bs source code, as identified by the checkpatch.pl script. Every patch is purely syntactical: it does not change the generated machine code. Furthermore, every single patch leaves the source code fully compilable, so that 'git bisect' will not be affected. [PATCH 01/33] staging: rtl8723bs: remove typedefs in HalBtcOutSrc.h [PATCH 02/33] staging: rtl8723bs: remove typedefs in rtw_mlme.h [PATCH 03/33] staging: rtl8723bs: remove typedefs in odm.h [PATCH 04/33] staging: rtl8723bs: remove typedefs in odm_CfoTracking.h [PATCH 05/33] staging: rtl8723bs: remove typedefs in odm_NoiseMonitor.h [PATCH 06/33] staging: rtl8723bs: remove typedefs in odm_interface.h [PATCH 07/33] staging: rtl8723bs: remove typedefs in odm_EdcaTurboCheck.h [PATCH 08/33] staging: rtl8723bs: remove typedefs in odm_HWConfig.h [PATCH 09/33] staging: rtl8723bs: remove typedefs in odm_types.h [PATCH 10/33] staging: rtl8723bs: remove typedefs in rtw_eeprom.h [PATCH 11/33] staging: rtl8723bs: remove typedefs in hal_com.h [PATCH 12/33] staging: rtl8723bs: remove typedefs in drv_types.h [PATCH 13/33] staging: rtl8723bs: remove typedefs in rtw_ht.h [PATCH 14/33] staging: rtl8723bs: remove typedefs in rtw_ioctl_set.h [PATCH 15/33] staging: rtl8723bs: remove typedefs in wlan_bssdef.h [PATCH 16/33] staging: rtl8723bs: remove typedefs in rtw_mp.h [PATCH 17/33] staging: rtl8723bs: remove typedefs in osdep_service.h [PATCH 18/33] staging: rtl8723bs: remove typedefs in rtw_security.h [PATCH 19/33] staging: rtl8723bs: remove typedefs in hal_com_h2c.h [PATCH 20/33] staging: rtl8723bs: remove typedefs in rtl8723b_xmit.h [PATCH 21/33] staging: rtl8723bs: remove typedefs in HalVerDef.h [PATCH 22/33] staging: rtl8723bs: remove typedefs in rtl8723b_hal.h [PATCH 23/33] staging: rtl8723bs: remove typedefs in rtw_mlme_ext.h [PATCH 24/33] staging: rtl8723bs: remove typedefs in HalPwrSeqCmd.h [PATCH 25/33] staging: rtl8723bs: remove typedefs in sta_info.h [PATCH 26/33] staging: rtl8723bs: remove typedefs in ieee80211.h [PATCH 27/33] staging: rtl8723bs: remove typedefs in basic_types.h [PATCH 28/33] staging: rtl8723bs: remove typedefs in osdep_service_linux.h [PATCH 29/33] staging: rtl8723bs: remove typedefs in rtw_efuse.h [PATCH 30/33] staging: rtl8723bs: remove typedefs in hal_btcoex.h [PATCH 31/33] staging: rtl8723bs: remove typedefs in odm_DIG.h [PATCH 32/33] staging: rtl8723bs: remove typedefs in hal_btcoex.c [PATCH 33/33] staging: rtl8723bs: remove typedefs in odm_DynamicBBPowerSaving.h Signed-off-by: Marco Cesati From marcocesati at gmail.com Fri Mar 12 08:26:07 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:07 +0100 Subject: [PATCH 02/33] staging: rtl8723bs: remove typedefs in rtw_mlme.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-3-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #84: FILE: include/rtw_mlme.h:84: +typedef enum _RT_SCAN_TYPE { WARNING: do not add new typedefs #137: FILE: include/rtw_mlme.h:137: +typedef struct _RT_LINK_DETECT_T { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 +- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 2 +- drivers/staging/rtl8723bs/include/rtw_mlme.h | 12 ++++++------ drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index 3443a5764c50..8ab5b38e8fc1 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -4272,7 +4272,7 @@ Following are some utility functions for WiFi MLME void site_survey(struct adapter *padapter) { unsigned char survey_channel = 0, val8; - RT_SCAN_TYPE ScanType = SCAN_PASSIVE; + enum RT_SCAN_TYPE ScanType = SCAN_PASSIVE; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u32 initialgain = 0; diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c index 7ac8a173245f..35d88832de0f 100644 --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c @@ -445,7 +445,7 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf) case BTC_GET_U4_WIFI_TRAFFIC_DIRECTION: { - PRT_LINK_DETECT_T plinkinfo; + struct RT_LINK_DETECT_T * plinkinfo; plinkinfo = &padapter->mlmepriv.LinkDetectInfo; if (plinkinfo->NumTxOkInPeriod > plinkinfo->NumRxOkInPeriod) diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h index d8655cb619a1..2f9c2a03e385 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mlme.h +++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h @@ -81,11 +81,11 @@ enum dot11AuthAlgrthmNum { }; /* Scan type including active and passive scan. */ -typedef enum _RT_SCAN_TYPE { +enum RT_SCAN_TYPE { SCAN_PASSIVE, SCAN_ACTIVE, SCAN_MIX, -} RT_SCAN_TYPE, *PRT_SCAN_TYPE; +}; enum _BAND { GHZ24_50 = 0, @@ -134,7 +134,7 @@ struct sitesurvey_ctrl { _timer sitesurvey_ctrl_timer; }; -typedef struct _RT_LINK_DETECT_T { +struct RT_LINK_DETECT_T { u32 NumTxOkInPeriod; u32 NumRxOkInPeriod; u32 NumRxUnicastOkInPeriod; @@ -147,7 +147,7 @@ typedef struct _RT_LINK_DETECT_T { /* u8 TrafficBusyState; */ u8 TrafficTransitionCount; u32 LowPowerTransitionCount; -} RT_LINK_DETECT_T, *PRT_LINK_DETECT_T; +}; struct profile_info { u8 ssidlen; @@ -385,12 +385,12 @@ struct mlme_priv { struct ht_priv htpriv; - RT_LINK_DETECT_T LinkDetectInfo; + struct RT_LINK_DETECT_T LinkDetectInfo; _timer dynamic_chk_timer; /* dynamic/periodic check timer */ u8 acm_mask; /* for wmm acm mask */ u8 ChannelPlan; - RT_SCAN_TYPE scan_mode; /* active: 1, passive: 0 */ + enum RT_SCAN_TYPE scan_mode; /* active: 1, passive: 0 */ u8 *wps_probe_req_ie; u32 wps_probe_req_ie_len; diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h index 1567831caf91..ed6b03c25367 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h @@ -419,7 +419,7 @@ struct mlme_ext_info { /* The channel information about this channel including joining, scanning, and power constraints. */ typedef struct _RT_CHANNEL_INFO { u8 ChannelNum; /* The channel number. */ - RT_SCAN_TYPE ScanType; /* Scan type such as passive or active scan. */ + enum RT_SCAN_TYPE ScanType; /* Scan type such as passive or active scan. */ } RT_CHANNEL_INFO, *PRT_CHANNEL_INFO; int rtw_ch_set_search_ch(RT_CHANNEL_INFO *ch_set, const u32 ch); -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:10 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:10 +0100 Subject: [PATCH 05/33] staging: rtl8723bs: remove typedefs in odm_NoiseMonitor.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-6-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #27: FILE: hal/odm_NoiseMonitor.h:27: +typedef struct _ODM_NOISE_MONITOR_ { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm.h | 2 +- drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h index 0b8693a9f862..9a73297f94d0 100644 --- a/drivers/staging/rtl8723bs/hal/odm.h +++ b/drivers/staging/rtl8723bs/hal/odm.h @@ -1076,7 +1076,7 @@ struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ u8 Adaptivity_IGI_upper; u8 NHM_cnt_0; - ODM_NOISE_MONITOR noise_level;/* ODM_MAX_CHANNEL_NUM]; */ + struct ODM_NOISE_MONITOR noise_level;/* ODM_MAX_CHANNEL_NUM]; */ /* */ /* 2 Define STA info. */ /* _ODM_STA_INFO */ diff --git a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.h b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.h index a7f13a85559c..0eb55d785c7f 100644 --- a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.h +++ b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.h @@ -24,10 +24,10 @@ struct noise_level { }; -typedef struct _ODM_NOISE_MONITOR_ { +struct ODM_NOISE_MONITOR { s8 noise[MAX_RF_PATH]; s16 noise_all; -} ODM_NOISE_MONITOR; +}; s16 ODM_InbandNoise_Monitor( void *pDM_VOID, -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:09 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:09 +0100 Subject: [PATCH 04/33] staging: rtl8723bs: remove typedefs in odm_CfoTracking.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-5-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #15: FILE: hal/odm_CfoTracking.h:15: +typedef struct _CFO_TRACKING_ { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm.h | 2 +- drivers/staging/rtl8723bs/hal/odm_CfoTracking.c | 12 ++++++------ drivers/staging/rtl8723bs/hal/odm_CfoTracking.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h index 494792162980..0b8693a9f862 100644 --- a/drivers/staging/rtl8723bs/hal/odm.h +++ b/drivers/staging/rtl8723bs/hal/odm.h @@ -1119,7 +1119,7 @@ struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ false_ALARM_STATISTICS FlaseAlmCntBuddyAdapter; struct SWAT_T DM_SWAT_Table; bool RSSI_test; - CFO_TRACKING DM_CfoTrack; + struct CFO_TRACKING DM_CfoTrack; EDCA_T DM_EDCA_Table; u32 WMMEDCA_BE; diff --git a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c index f1dd2df03730..a70b673bb4be 100644 --- a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c +++ b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c @@ -10,7 +10,7 @@ static void odm_SetCrystalCap(void *pDM_VOID, u8 CrystalCap) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; if (pCfoTrack->CrystalCap == CrystalCap) return; @@ -50,7 +50,7 @@ static u8 odm_GetDefaultCrytaltalCap(void *pDM_VOID) static void odm_SetATCStatus(void *pDM_VOID, bool ATCStatus) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; if (pCfoTrack->bATCStatus == ATCStatus) return; @@ -80,7 +80,7 @@ static bool odm_GetATCStatus(void *pDM_VOID) void ODM_CfoTrackingReset(void *pDM_VOID) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; pCfoTrack->DefXCap = odm_GetDefaultCrytaltalCap(pDM_Odm); pCfoTrack->bAdjust = true; @@ -92,7 +92,7 @@ void ODM_CfoTrackingReset(void *pDM_VOID) void ODM_CfoTrackingInit(void *pDM_VOID) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; pCfoTrack->DefXCap = pCfoTrack->CrystalCap = odm_GetDefaultCrytaltalCap(pDM_Odm); @@ -119,7 +119,7 @@ void ODM_CfoTrackingInit(void *pDM_VOID) void ODM_CfoTracking(void *pDM_VOID) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; int CFO_kHz_A, CFO_kHz_B, CFO_ave = 0; int CFO_ave_diff; int CrystalCap = (int)pCfoTrack->CrystalCap; @@ -299,7 +299,7 @@ void ODM_ParsingCFO(void *pDM_VOID, void *pPktinfo_VOID, s8 *pcfotail) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; struct odm_packet_info *pPktinfo = pPktinfo_VOID; - PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; u8 i; if (!(pDM_Odm->SupportAbility & ODM_BB_CFO_TRACKING)) diff --git a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.h b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.h index 81db63efe286..3c4e286436b8 100644 --- a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.h +++ b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.h @@ -12,7 +12,7 @@ #define CFO_TH_XTAL_LOW 10 /* kHz */ #define CFO_TH_ATC 80 /* kHz */ -typedef struct _CFO_TRACKING_ { +struct CFO_TRACKING { bool bATCStatus; bool largeCFOHit; bool bAdjust; @@ -25,7 +25,7 @@ typedef struct _CFO_TRACKING_ { bool bForceXtalCap; bool bReset; -} CFO_TRACKING, *PCFO_TRACKING; +}; void ODM_CfoTrackingReset(void *pDM_VOID ); -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:06 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:06 +0100 Subject: [PATCH 01/33] staging: rtl8723bs: remove typedefs in HalBtcOutSrc.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-2-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #47: FILE: hal/HalBtcOutSrc.h:47: +typedef enum _BTC_POWERSAVE_TYPE { WARNING: do not add new typedefs #54: FILE: hal/HalBtcOutSrc.h:54: +typedef enum _BTC_BT_REG_TYPE { WARNING: do not add new typedefs #63: FILE: hal/HalBtcOutSrc.h:63: +typedef enum _BTC_CHIP_INTERFACE { WARNING: do not add new typedefs #71: FILE: hal/HalBtcOutSrc.h:71: +typedef enum _BTC_CHIP_TYPE { WARNING: do not add new typedefs #81: FILE: hal/HalBtcOutSrc.h:81: +typedef enum _BTC_MSG_TYPE { WARNING: do not add new typedefs #167: FILE: hal/HalBtcOutSrc.h:167: +typedef struct _BTC_BOARD_INFO { WARNING: do not add new typedefs #177: FILE: hal/HalBtcOutSrc.h:177: +typedef enum _BTC_DBG_OPCODE { WARNING: do not add new typedefs #187: FILE: hal/HalBtcOutSrc.h:187: +typedef enum _BTC_RSSI_STATE { WARNING: do not add new typedefs #200: FILE: hal/HalBtcOutSrc.h:200: +typedef enum _BTC_WIFI_ROLE { WARNING: do not add new typedefs #208: FILE: hal/HalBtcOutSrc.h:208: +typedef enum _BTC_WIFI_BW_MODE { WARNING: do not add new typedefs #215: FILE: hal/HalBtcOutSrc.h:215: +typedef enum _BTC_WIFI_TRAFFIC_DIR { WARNING: do not add new typedefs #221: FILE: hal/HalBtcOutSrc.h:221: +typedef enum _BTC_WIFI_PNP { WARNING: do not add new typedefs #228: FILE: hal/HalBtcOutSrc.h:228: +typedef enum _BT_WIFI_COEX_STATE { WARNING: do not add new typedefs #239: FILE: hal/HalBtcOutSrc.h:239: +typedef enum _BTC_GET_TYPE { WARNING: do not add new typedefs #281: FILE: hal/HalBtcOutSrc.h:281: +typedef enum _BTC_SET_TYPE { WARNING: do not add new typedefs #321: FILE: hal/HalBtcOutSrc.h:321: +typedef enum _BTC_DBG_DISP_TYPE { WARNING: do not add new typedefs #328: FILE: hal/HalBtcOutSrc.h:328: +typedef enum _BTC_NOTIFY_TYPE_IPS { WARNING: do not add new typedefs #334: FILE: hal/HalBtcOutSrc.h:334: +typedef enum _BTC_NOTIFY_TYPE_LPS { WARNING: do not add new typedefs #340: FILE: hal/HalBtcOutSrc.h:340: +typedef enum _BTC_NOTIFY_TYPE_SCAN { WARNING: do not add new typedefs #346: FILE: hal/HalBtcOutSrc.h:346: +typedef enum _BTC_NOTIFY_TYPE_ASSOCIATE { WARNING: do not add new typedefs #352: FILE: hal/HalBtcOutSrc.h:352: +typedef enum _BTC_NOTIFY_TYPE_MEDIA_STATUS { WARNING: do not add new typedefs #358: FILE: hal/HalBtcOutSrc.h:358: +typedef enum _BTC_NOTIFY_TYPE_SPECIAL_PACKET { WARNING: do not add new typedefs #366: FILE: hal/HalBtcOutSrc.h:366: +typedef enum _BTC_NOTIFY_TYPE_STACK_OPERATION { WARNING: do not add new typedefs #374: FILE: hal/HalBtcOutSrc.h:374: +typedef enum _BTC_ANTENNA_POS { WARNING: do not add new typedefs #412: FILE: hal/HalBtcOutSrc.h:412: +typedef struct _BTC_BT_INFO { WARNING: do not add new typedefs #440: FILE: hal/HalBtcOutSrc.h:440: +typedef struct _BTC_STACK_INFO { WARNING: do not add new typedefs #455: FILE: hal/HalBtcOutSrc.h:455: +typedef struct _BTC_BT_LINK_INFO { WARNING: do not add new typedefs #468: FILE: hal/HalBtcOutSrc.h:468: +typedef struct _BTC_STATISTICS { WARNING: do not add new typedefs #487: FILE: hal/HalBtcOutSrc.h:487: +typedef struct _BTC_COEXIST { Signed-off-by: Marco Cesati --- .../staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 148 ++++++++-------- .../staging/rtl8723bs/hal/HalBtc8723b1Ant.h | 28 ++-- .../staging/rtl8723bs/hal/HalBtc8723b2Ant.c | 138 +++++++-------- .../staging/rtl8723bs/hal/HalBtc8723b2Ant.h | 28 ++-- drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h | 158 +++++++++--------- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 122 +++++++------- 6 files changed, 311 insertions(+), 311 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c index ef8c6a0f31ae..87dc63408133 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c @@ -151,7 +151,7 @@ static u8 halbtc8723b1ant_BtRssiState( } static void halbtc8723b1ant_UpdateRaMask( - PBTC_COEXIST pBtCoexist, bool bForceExec, u32 disRateMask + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u32 disRateMask ) { pCoexDm->curRaMask = disRateMask; @@ -166,7 +166,7 @@ static void halbtc8723b1ant_UpdateRaMask( } static void halbtc8723b1ant_AutoRateFallbackRetry( - PBTC_COEXIST pBtCoexist, bool bForceExec, u8 type + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 type ) { bool bWifiUnderBMode = false; @@ -204,7 +204,7 @@ static void halbtc8723b1ant_AutoRateFallbackRetry( } static void halbtc8723b1ant_RetryLimit( - PBTC_COEXIST pBtCoexist, bool bForceExec, u8 type + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 type ) { pCoexDm->curRetryLimitType = type; @@ -231,7 +231,7 @@ static void halbtc8723b1ant_RetryLimit( } static void halbtc8723b1ant_AmpduMaxTime( - PBTC_COEXIST pBtCoexist, bool bForceExec, u8 type + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 type ) { pCoexDm->curAmpduTimeType = type; @@ -257,7 +257,7 @@ static void halbtc8723b1ant_AmpduMaxTime( } static void halbtc8723b1ant_LimitedTx( - PBTC_COEXIST pBtCoexist, + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 raMaskType, u8 arfrType, @@ -285,7 +285,7 @@ static void halbtc8723b1ant_LimitedTx( } static void halbtc8723b1ant_LimitedRx( - PBTC_COEXIST pBtCoexist, + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bRejApAggPkt, bool bBtCtrlAggBufSize, @@ -314,7 +314,7 @@ static void halbtc8723b1ant_LimitedRx( } -static void halbtc8723b1ant_QueryBtInfo(PBTC_COEXIST pBtCoexist) +static void halbtc8723b1ant_QueryBtInfo(struct BTC_COEXIST * pBtCoexist) { u8 H2C_Parameter[1] = {0}; @@ -331,7 +331,7 @@ static void halbtc8723b1ant_QueryBtInfo(PBTC_COEXIST pBtCoexist) pBtCoexist->fBtcFillH2c(pBtCoexist, 0x61, 1, H2C_Parameter); } -static void halbtc8723b1ant_MonitorBtCtr(PBTC_COEXIST pBtCoexist) +static void halbtc8723b1ant_MonitorBtCtr(struct BTC_COEXIST * pBtCoexist) { u32 regHPTxRx, regLPTxRx, u4Tmp; u32 regHPTx = 0, regHPRx = 0, regLPTx = 0, regLPRx = 0; @@ -392,7 +392,7 @@ static void halbtc8723b1ant_MonitorBtCtr(PBTC_COEXIST pBtCoexist) } -static void halbtc8723b1ant_MonitorWiFiCtr(PBTC_COEXIST pBtCoexist) +static void halbtc8723b1ant_MonitorWiFiCtr(struct BTC_COEXIST * pBtCoexist) { s32 wifiRssi = 0; bool bWifiBusy = false, bWifiUnderBMode = false; @@ -478,7 +478,7 @@ static void halbtc8723b1ant_MonitorWiFiCtr(PBTC_COEXIST pBtCoexist) } -static bool halbtc8723b1ant_IsWifiStatusChanged(PBTC_COEXIST pBtCoexist) +static bool halbtc8723b1ant_IsWifiStatusChanged(struct BTC_COEXIST * pBtCoexist) { static bool bPreWifiBusy, bPreUnder4way, bPreBtHsOn; bool bWifiBusy = false, bUnder4way = false, bBtHsOn = false; @@ -513,9 +513,9 @@ static bool halbtc8723b1ant_IsWifiStatusChanged(PBTC_COEXIST pBtCoexist) return false; } -static void halbtc8723b1ant_UpdateBtLinkInfo(PBTC_COEXIST pBtCoexist) +static void halbtc8723b1ant_UpdateBtLinkInfo(struct BTC_COEXIST * pBtCoexist) { - PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bBtHsOn = false; pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); @@ -577,9 +577,9 @@ static void halbtc8723b1ant_UpdateBtLinkInfo(PBTC_COEXIST pBtCoexist) pBtLinkInfo->bHidOnly = false; } -static u8 halbtc8723b1ant_ActionAlgorithm(PBTC_COEXIST pBtCoexist) +static u8 halbtc8723b1ant_ActionAlgorithm(struct BTC_COEXIST * pBtCoexist) { - PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bBtHsOn = false; u8 algorithm = BT_8723B_1ANT_COEX_ALGO_UNDEFINED; u8 numOfDiffProfile = 0; @@ -805,7 +805,7 @@ static u8 halbtc8723b1ant_ActionAlgorithm(PBTC_COEXIST pBtCoexist) } static void halbtc8723b1ant_SetSwPenaltyTxRateAdaptive( - PBTC_COEXIST pBtCoexist, bool bLowPenaltyRa + struct BTC_COEXIST * pBtCoexist, bool bLowPenaltyRa ) { u8 H2C_Parameter[6] = {0}; @@ -833,7 +833,7 @@ static void halbtc8723b1ant_SetSwPenaltyTxRateAdaptive( } static void halbtc8723b1ant_LowPenaltyRa( - PBTC_COEXIST pBtCoexist, bool bForceExec, bool bLowPenaltyRa + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bLowPenaltyRa ) { pCoexDm->bCurLowPenaltyRa = bLowPenaltyRa; @@ -850,7 +850,7 @@ static void halbtc8723b1ant_LowPenaltyRa( } static void halbtc8723b1ant_SetCoexTable( - PBTC_COEXIST pBtCoexist, + struct BTC_COEXIST * pBtCoexist, u32 val0x6c0, u32 val0x6c4, u32 val0x6c8, @@ -887,7 +887,7 @@ static void halbtc8723b1ant_SetCoexTable( } static void halbtc8723b1ant_CoexTable( - PBTC_COEXIST pBtCoexist, + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u32 val0x6c0, u32 val0x6c4, @@ -930,7 +930,7 @@ static void halbtc8723b1ant_CoexTable( } static void halbtc8723b1ant_CoexTableWithType( - PBTC_COEXIST pBtCoexist, bool bForceExec, u8 type + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 type ) { BTC_PRINT( @@ -988,7 +988,7 @@ static void halbtc8723b1ant_CoexTableWithType( } static void halbtc8723b1ant_SetFwIgnoreWlanAct( - PBTC_COEXIST pBtCoexist, bool bEnable + struct BTC_COEXIST * pBtCoexist, bool bEnable ) { u8 H2C_Parameter[1] = {0}; @@ -1009,7 +1009,7 @@ static void halbtc8723b1ant_SetFwIgnoreWlanAct( } static void halbtc8723b1ant_IgnoreWlanAct( - PBTC_COEXIST pBtCoexist, bool bForceExec, bool bEnable + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bEnable ) { BTC_PRINT( @@ -1043,7 +1043,7 @@ static void halbtc8723b1ant_IgnoreWlanAct( } static void halbtc8723b1ant_SetLpsRpwm( - PBTC_COEXIST pBtCoexist, u8 lpsVal, u8 rpwmVal + struct BTC_COEXIST * pBtCoexist, u8 lpsVal, u8 rpwmVal ) { u8 lps = lpsVal; @@ -1054,7 +1054,7 @@ static void halbtc8723b1ant_SetLpsRpwm( } static void halbtc8723b1ant_LpsRpwm( - PBTC_COEXIST pBtCoexist, bool bForceExec, u8 lpsVal, u8 rpwmVal + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 lpsVal, u8 rpwmVal ) { BTC_PRINT( @@ -1105,7 +1105,7 @@ static void halbtc8723b1ant_LpsRpwm( } static void halbtc8723b1ant_SwMechanism( - PBTC_COEXIST pBtCoexist, bool bLowPenaltyRA + struct BTC_COEXIST * pBtCoexist, bool bLowPenaltyRA ) { BTC_PRINT( @@ -1118,10 +1118,10 @@ static void halbtc8723b1ant_SwMechanism( } static void halbtc8723b1ant_SetAntPath( - PBTC_COEXIST pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff + struct BTC_COEXIST * pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff ) { - PBTC_BOARD_INFO pBoardInfo = &pBtCoexist->boardInfo; + struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; u32 fwVer = 0, u4Tmp = 0, cntBtCalChk = 0; bool bPgExtSwitch = false; bool bUseExtSwitch = false; @@ -1307,7 +1307,7 @@ static void halbtc8723b1ant_SetAntPath( } static void halbtc8723b1ant_SetFwPstdma( - PBTC_COEXIST pBtCoexist, u8 byte1, u8 byte2, u8 byte3, u8 byte4, u8 byte5 + struct BTC_COEXIST * pBtCoexist, u8 byte1, u8 byte2, u8 byte3, u8 byte4, u8 byte5 ) { u8 H2C_Parameter[5] = {0}; @@ -1361,10 +1361,10 @@ static void halbtc8723b1ant_SetFwPstdma( static void halbtc8723b1ant_PsTdma( - PBTC_COEXIST pBtCoexist, bool bForceExec, bool bTurnOn, u8 type + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bTurnOn, u8 type ) { - PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bWifiBusy = false; u8 rssiAdjustVal = 0; u8 psTdmaByte4Val = 0x50, psTdmaByte0Val = 0x51, psTdmaByte3Val = 0x10; @@ -1661,7 +1661,7 @@ static void halbtc8723b1ant_PsTdma( pCoexDm->prePsTdma = pCoexDm->curPsTdma; } -static bool halbtc8723b1ant_IsCommonAction(PBTC_COEXIST pBtCoexist) +static bool halbtc8723b1ant_IsCommonAction(struct BTC_COEXIST * pBtCoexist) { bool bCommon = false, bWifiConnected = false, bWifiBusy = false; @@ -1752,7 +1752,7 @@ static bool halbtc8723b1ant_IsCommonAction(PBTC_COEXIST pBtCoexist) static void halbtc8723b1ant_TdmaDurationAdjustForAcl( - PBTC_COEXIST pBtCoexist, u8 wifiStatus + struct BTC_COEXIST * pBtCoexist, u8 wifiStatus ) { static s32 up, dn, m, n, WaitCount; @@ -1941,7 +1941,7 @@ static void halbtc8723b1ant_TdmaDurationAdjustForAcl( } static void halbtc8723b1ant_PsTdmaCheckForPowerSaveState( - PBTC_COEXIST pBtCoexist, bool bNewPsState + struct BTC_COEXIST * pBtCoexist, bool bNewPsState ) { u8 lpsMode = 0x0; @@ -1963,7 +1963,7 @@ static void halbtc8723b1ant_PsTdmaCheckForPowerSaveState( } static void halbtc8723b1ant_PowerSaveState( - PBTC_COEXIST pBtCoexist, u8 psType, u8 lpsVal, u8 rpwmVal + struct BTC_COEXIST * pBtCoexist, u8 psType, u8 lpsVal, u8 rpwmVal ) { bool bLowPwrDisable = false; @@ -2011,7 +2011,7 @@ static void halbtc8723b1ant_PowerSaveState( /* Non-Software Coex Mechanism start */ /* */ /* */ -static void halbtc8723b1ant_ActionWifiMultiPort(PBTC_COEXIST pBtCoexist) +static void halbtc8723b1ant_ActionWifiMultiPort(struct BTC_COEXIST * pBtCoexist) { halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2019,15 +2019,15 @@ static void halbtc8723b1ant_ActionWifiMultiPort(PBTC_COEXIST pBtCoexist) halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); } -static void halbtc8723b1ant_ActionHs(PBTC_COEXIST pBtCoexist) +static void halbtc8723b1ant_ActionHs(struct BTC_COEXIST * pBtCoexist) { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 5); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); } -static void halbtc8723b1ant_ActionBtInquiry(PBTC_COEXIST pBtCoexist) +static void halbtc8723b1ant_ActionBtInquiry(struct BTC_COEXIST * pBtCoexist) { - PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bWifiConnected = false; bool bApEnable = false; bool bWifiBusy = false; @@ -2067,10 +2067,10 @@ static void halbtc8723b1ant_ActionBtInquiry(PBTC_COEXIST pBtCoexist) } static void halbtc8723b1ant_ActionBtScoHidOnlyBusy( - PBTC_COEXIST pBtCoexist, u8 wifiStatus + struct BTC_COEXIST * pBtCoexist, u8 wifiStatus ) { - PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bWifiConnected = false; pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); @@ -2087,12 +2087,12 @@ static void halbtc8723b1ant_ActionBtScoHidOnlyBusy( } static void halbtc8723b1ant_ActionWifiConnectedBtAclBusy( - PBTC_COEXIST pBtCoexist, u8 wifiStatus + struct BTC_COEXIST * pBtCoexist, u8 wifiStatus ) { u8 btRssiState; - PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; btRssiState = halbtc8723b1ant_BtRssiState(2, 28, 0); if ((pCoexSta->lowPriorityRx >= 1000) && (pCoexSta->lowPriorityRx != 65535)) @@ -2141,7 +2141,7 @@ static void halbtc8723b1ant_ActionWifiConnectedBtAclBusy( } } -static void halbtc8723b1ant_ActionWifiNotConnected(PBTC_COEXIST pBtCoexist) +static void halbtc8723b1ant_ActionWifiNotConnected(struct BTC_COEXIST * pBtCoexist) { /* power save state */ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2152,10 +2152,10 @@ static void halbtc8723b1ant_ActionWifiNotConnected(PBTC_COEXIST pBtCoexist) } static void halbtc8723b1ant_ActionWifiNotConnectedScan( - PBTC_COEXIST pBtCoexist + struct BTC_COEXIST * pBtCoexist ) { - PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2186,10 +2186,10 @@ static void halbtc8723b1ant_ActionWifiNotConnectedScan( } static void halbtc8723b1ant_ActionWifiNotConnectedAssoAuth( - PBTC_COEXIST pBtCoexist + struct BTC_COEXIST * pBtCoexist ) { - PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2210,9 +2210,9 @@ static void halbtc8723b1ant_ActionWifiNotConnectedAssoAuth( } } -static void halbtc8723b1ant_ActionWifiConnectedScan(PBTC_COEXIST pBtCoexist) +static void halbtc8723b1ant_ActionWifiConnectedScan(struct BTC_COEXIST * pBtCoexist) { - PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2243,10 +2243,10 @@ static void halbtc8723b1ant_ActionWifiConnectedScan(PBTC_COEXIST pBtCoexist) } static void halbtc8723b1ant_ActionWifiConnectedSpecialPacket( - PBTC_COEXIST pBtCoexist + struct BTC_COEXIST * pBtCoexist ) { - PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2267,7 +2267,7 @@ static void halbtc8723b1ant_ActionWifiConnectedSpecialPacket( } } -static void halbtc8723b1ant_ActionWifiConnected(PBTC_COEXIST pBtCoexist) +static void halbtc8723b1ant_ActionWifiConnected(struct BTC_COEXIST * pBtCoexist) { bool bWifiBusy = false; bool bScan = false, bLink = false, bRoam = false; @@ -2387,7 +2387,7 @@ static void halbtc8723b1ant_ActionWifiConnected(PBTC_COEXIST pBtCoexist) } } -static void halbtc8723b1ant_RunSwCoexistMechanism(PBTC_COEXIST pBtCoexist) +static void halbtc8723b1ant_RunSwCoexistMechanism(struct BTC_COEXIST * pBtCoexist) { u8 algorithm = 0; @@ -2446,9 +2446,9 @@ static void halbtc8723b1ant_RunSwCoexistMechanism(PBTC_COEXIST pBtCoexist) } } -static void halbtc8723b1ant_RunCoexistMechanism(PBTC_COEXIST pBtCoexist) +static void halbtc8723b1ant_RunCoexistMechanism(struct BTC_COEXIST * pBtCoexist) { - PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bWifiConnected = false, bBtHsOn = false; bool bIncreaseScanDevNum = false; bool bBtCtrlAggBufSize = false; @@ -2579,7 +2579,7 @@ static void halbtc8723b1ant_RunCoexistMechanism(PBTC_COEXIST pBtCoexist) halbtc8723b1ant_ActionWifiConnected(pBtCoexist); } -static void halbtc8723b1ant_InitCoexDm(PBTC_COEXIST pBtCoexist) +static void halbtc8723b1ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist) { /* force to reset coex mechanism */ @@ -2593,7 +2593,7 @@ static void halbtc8723b1ant_InitCoexDm(PBTC_COEXIST pBtCoexist) } static void halbtc8723b1ant_InitHwConfig( - PBTC_COEXIST pBtCoexist, + struct BTC_COEXIST * pBtCoexist, bool bBackUp, bool bWifiOnly ) @@ -2648,9 +2648,9 @@ static void halbtc8723b1ant_InitHwConfig( /* */ /* extern function start with EXhalbtc8723b1ant_ */ /* */ -void EXhalbtc8723b1ant_PowerOnSetting(PBTC_COEXIST pBtCoexist) +void EXhalbtc8723b1ant_PowerOnSetting(struct BTC_COEXIST * pBtCoexist) { - PBTC_BOARD_INFO pBoardInfo = &pBtCoexist->boardInfo; + struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; u8 u1Tmp = 0x0; u16 u2Tmp = 0x0; @@ -2700,12 +2700,12 @@ void EXhalbtc8723b1ant_PowerOnSetting(PBTC_COEXIST pBtCoexist) } } -void EXhalbtc8723b1ant_InitHwConfig(PBTC_COEXIST pBtCoexist, bool bWifiOnly) +void EXhalbtc8723b1ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool bWifiOnly) { halbtc8723b1ant_InitHwConfig(pBtCoexist, true, bWifiOnly); } -void EXhalbtc8723b1ant_InitCoexDm(PBTC_COEXIST pBtCoexist) +void EXhalbtc8723b1ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist) { BTC_PRINT( BTC_MSG_INTERFACE, @@ -2720,11 +2720,11 @@ void EXhalbtc8723b1ant_InitCoexDm(PBTC_COEXIST pBtCoexist) halbtc8723b1ant_QueryBtInfo(pBtCoexist); } -void EXhalbtc8723b1ant_DisplayCoexInfo(PBTC_COEXIST pBtCoexist) +void EXhalbtc8723b1ant_DisplayCoexInfo(struct BTC_COEXIST * pBtCoexist) { - PBTC_BOARD_INFO pBoardInfo = &pBtCoexist->boardInfo; - PBTC_STACK_INFO pStackInfo = &pBtCoexist->stackInfo; - PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; + struct BTC_STACK_INFO * pStackInfo = &pBtCoexist->stackInfo; + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; u8 *cliBuf = pBtCoexist->cliBuf; u8 u1Tmp[4], i, btInfoExt, psTdmaCase = 0; u16 u2Tmp[4]; @@ -3183,7 +3183,7 @@ void EXhalbtc8723b1ant_DisplayCoexInfo(PBTC_COEXIST pBtCoexist) } -void EXhalbtc8723b1ant_IpsNotify(PBTC_COEXIST pBtCoexist, u8 type) +void EXhalbtc8723b1ant_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) { if (pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm) return; @@ -3209,7 +3209,7 @@ void EXhalbtc8723b1ant_IpsNotify(PBTC_COEXIST pBtCoexist, u8 type) } } -void EXhalbtc8723b1ant_LpsNotify(PBTC_COEXIST pBtCoexist, u8 type) +void EXhalbtc8723b1ant_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) { if (pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm) return; @@ -3227,7 +3227,7 @@ void EXhalbtc8723b1ant_LpsNotify(PBTC_COEXIST pBtCoexist, u8 type) } } -void EXhalbtc8723b1ant_ScanNotify(PBTC_COEXIST pBtCoexist, u8 type) +void EXhalbtc8723b1ant_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type) { bool bWifiConnected = false, bBtHsOn = false; u32 wifiLinkStatus = 0; @@ -3317,7 +3317,7 @@ void EXhalbtc8723b1ant_ScanNotify(PBTC_COEXIST pBtCoexist, u8 type) } } -void EXhalbtc8723b1ant_ConnectNotify(PBTC_COEXIST pBtCoexist, u8 type) +void EXhalbtc8723b1ant_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 type) { bool bWifiConnected = false, bBtHsOn = false; u32 wifiLinkStatus = 0; @@ -3374,7 +3374,7 @@ void EXhalbtc8723b1ant_ConnectNotify(PBTC_COEXIST pBtCoexist, u8 type) } } -void EXhalbtc8723b1ant_MediaStatusNotify(PBTC_COEXIST pBtCoexist, u8 type) +void EXhalbtc8723b1ant_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, u8 type) { u8 H2C_Parameter[3] = {0}; u32 wifiBw; @@ -3444,7 +3444,7 @@ void EXhalbtc8723b1ant_MediaStatusNotify(PBTC_COEXIST pBtCoexist, u8 type) pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter); } -void EXhalbtc8723b1ant_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 type) +void EXhalbtc8723b1ant_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 type) { bool bBtHsOn = false; u32 wifiLinkStatus = 0; @@ -3533,7 +3533,7 @@ void EXhalbtc8723b1ant_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 type) } void EXhalbtc8723b1ant_BtInfoNotify( - PBTC_COEXIST pBtCoexist, u8 *tmpBuf, u8 length + struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length ) { u8 btInfo = 0; @@ -3698,7 +3698,7 @@ void EXhalbtc8723b1ant_BtInfoNotify( halbtc8723b1ant_RunCoexistMechanism(pBtCoexist); } -void EXhalbtc8723b1ant_HaltNotify(PBTC_COEXIST pBtCoexist) +void EXhalbtc8723b1ant_HaltNotify(struct BTC_COEXIST * pBtCoexist) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n")); @@ -3713,7 +3713,7 @@ void EXhalbtc8723b1ant_HaltNotify(PBTC_COEXIST pBtCoexist) pBtCoexist->bStopCoexDm = true; } -void EXhalbtc8723b1ant_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState) +void EXhalbtc8723b1ant_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify\n")); @@ -3735,7 +3735,7 @@ void EXhalbtc8723b1ant_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState) } } -void EXhalbtc8723b1ant_Periodical(PBTC_COEXIST pBtCoexist) +void EXhalbtc8723b1ant_Periodical(struct BTC_COEXIST * pBtCoexist) { static u8 disVerInfoCnt; u32 fwVer = 0, btPatchVer = 0; diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h index 661f0cd6aa06..a104d138eb63 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h @@ -167,19 +167,19 @@ struct COEX_STA_8723B_1ANT { /* */ /* The following is interface which will notify coex module. */ /* */ -void EXhalbtc8723b1ant_PowerOnSetting(PBTC_COEXIST pBtCoexist); -void EXhalbtc8723b1ant_InitHwConfig(PBTC_COEXIST pBtCoexist, bool bWifiOnly); -void EXhalbtc8723b1ant_InitCoexDm(PBTC_COEXIST pBtCoexist); -void EXhalbtc8723b1ant_IpsNotify(PBTC_COEXIST pBtCoexist, u8 type); -void EXhalbtc8723b1ant_LpsNotify(PBTC_COEXIST pBtCoexist, u8 type); -void EXhalbtc8723b1ant_ScanNotify(PBTC_COEXIST pBtCoexist, u8 type); -void EXhalbtc8723b1ant_ConnectNotify(PBTC_COEXIST pBtCoexist, u8 type); -void EXhalbtc8723b1ant_MediaStatusNotify(PBTC_COEXIST pBtCoexist, u8 type); -void EXhalbtc8723b1ant_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 type); +void EXhalbtc8723b1ant_PowerOnSetting(struct BTC_COEXIST * pBtCoexist); +void EXhalbtc8723b1ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool bWifiOnly); +void EXhalbtc8723b1ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist); +void EXhalbtc8723b1ant_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); +void EXhalbtc8723b1ant_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); +void EXhalbtc8723b1ant_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type); +void EXhalbtc8723b1ant_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 type); +void EXhalbtc8723b1ant_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, u8 type); +void EXhalbtc8723b1ant_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 type); void EXhalbtc8723b1ant_BtInfoNotify( - PBTC_COEXIST pBtCoexist, u8 *tmpBuf, u8 length + struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length ); -void EXhalbtc8723b1ant_HaltNotify(PBTC_COEXIST pBtCoexist); -void EXhalbtc8723b1ant_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState); -void EXhalbtc8723b1ant_Periodical(PBTC_COEXIST pBtCoexist); -void EXhalbtc8723b1ant_DisplayCoexInfo(PBTC_COEXIST pBtCoexist); +void EXhalbtc8723b1ant_HaltNotify(struct BTC_COEXIST * pBtCoexist); +void EXhalbtc8723b1ant_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState); +void EXhalbtc8723b1ant_Periodical(struct BTC_COEXIST * pBtCoexist); +void EXhalbtc8723b1ant_DisplayCoexInfo(struct BTC_COEXIST * pBtCoexist); diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c index 0ca14f445882..cd09e6e288fc 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c @@ -108,7 +108,7 @@ static u8 halbtc8723b2ant_BtRssiState( } static u8 halbtc8723b2ant_WifiRssiState( - PBTC_COEXIST pBtCoexist, + struct BTC_COEXIST * pBtCoexist, u8 index, u8 levelNum, u8 rssiThresh, @@ -189,7 +189,7 @@ static u8 halbtc8723b2ant_WifiRssiState( } static void halbtc8723b2ant_LimitedRx( - PBTC_COEXIST pBtCoexist, + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bRejApAggPkt, bool bBtCtrlAggBufSize, @@ -212,7 +212,7 @@ static void halbtc8723b2ant_LimitedRx( pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL); } -static void halbtc8723b2ant_MonitorBtCtr(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_MonitorBtCtr(struct BTC_COEXIST * pBtCoexist) { u32 regHPTxRx, regLPTxRx, u4Tmp; u32 regHPTx = 0, regHPRx = 0, regLPTx = 0, regLPRx = 0; @@ -262,7 +262,7 @@ static void halbtc8723b2ant_MonitorBtCtr(PBTC_COEXIST pBtCoexist) pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); } -static void halbtc8723b2ant_QueryBtInfo(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_QueryBtInfo(struct BTC_COEXIST * pBtCoexist) { u8 H2C_Parameter[1] = {0}; @@ -279,7 +279,7 @@ static void halbtc8723b2ant_QueryBtInfo(PBTC_COEXIST pBtCoexist) pBtCoexist->fBtcFillH2c(pBtCoexist, 0x61, 1, H2C_Parameter); } -static bool halbtc8723b2ant_IsWifiStatusChanged(PBTC_COEXIST pBtCoexist) +static bool halbtc8723b2ant_IsWifiStatusChanged(struct BTC_COEXIST * pBtCoexist) { static bool bPreWifiBusy, bPreUnder4way, bPreBtHsOn; bool bWifiBusy = false, bUnder4way = false, bBtHsOn = false; @@ -310,9 +310,9 @@ static bool halbtc8723b2ant_IsWifiStatusChanged(PBTC_COEXIST pBtCoexist) return false; } -static void halbtc8723b2ant_UpdateBtLinkInfo(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_UpdateBtLinkInfo(struct BTC_COEXIST * pBtCoexist) { - PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bBtHsOn = false; pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); @@ -374,9 +374,9 @@ static void halbtc8723b2ant_UpdateBtLinkInfo(PBTC_COEXIST pBtCoexist) pBtLinkInfo->bHidOnly = false; } -static u8 halbtc8723b2ant_ActionAlgorithm(PBTC_COEXIST pBtCoexist) +static u8 halbtc8723b2ant_ActionAlgorithm(struct BTC_COEXIST * pBtCoexist) { - PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bBtHsOn = false; u8 algorithm = BT_8723B_2ANT_COEX_ALGO_UNDEFINED; u8 numOfDiffProfile = 0; @@ -549,7 +549,7 @@ static u8 halbtc8723b2ant_ActionAlgorithm(PBTC_COEXIST pBtCoexist) } static void halbtc8723b2ant_SetFwDacSwingLevel( - PBTC_COEXIST pBtCoexist, u8 dacSwingLvl + struct BTC_COEXIST * pBtCoexist, u8 dacSwingLvl ) { u8 H2C_Parameter[1] = {0}; @@ -573,7 +573,7 @@ static void halbtc8723b2ant_SetFwDacSwingLevel( } static void halbtc8723b2ant_SetFwDecBtPwr( - PBTC_COEXIST pBtCoexist, u8 decBtPwrLvl + struct BTC_COEXIST * pBtCoexist, u8 decBtPwrLvl ) { u8 H2C_Parameter[1] = {0}; @@ -594,7 +594,7 @@ static void halbtc8723b2ant_SetFwDecBtPwr( } static void halbtc8723b2ant_DecBtPwr( - PBTC_COEXIST pBtCoexist, bool bForceExec, u8 decBtPwrLvl + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 decBtPwrLvl ) { BTC_PRINT( @@ -628,7 +628,7 @@ static void halbtc8723b2ant_DecBtPwr( } static void halbtc8723b2ant_FwDacSwingLvl( - PBTC_COEXIST pBtCoexist, bool bForceExec, u8 fwDacSwingLvl + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 fwDacSwingLvl ) { BTC_PRINT( @@ -663,7 +663,7 @@ static void halbtc8723b2ant_FwDacSwingLvl( } static void halbtc8723b2ant_SetSwRfRxLpfCorner( - PBTC_COEXIST pBtCoexist, + struct BTC_COEXIST * pBtCoexist, bool bRxRfShrinkOn ) { @@ -686,7 +686,7 @@ static void halbtc8723b2ant_SetSwRfRxLpfCorner( } static void halbtc8723b2ant_RfShrink( - PBTC_COEXIST pBtCoexist, bool bForceExec, bool bRxRfShrinkOn + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bRxRfShrinkOn ) { BTC_PRINT( @@ -720,7 +720,7 @@ static void halbtc8723b2ant_RfShrink( } static void halbtc8723b2ant_SetSwPenaltyTxRateAdaptive( - PBTC_COEXIST pBtCoexist, bool bLowPenaltyRa + struct BTC_COEXIST * pBtCoexist, bool bLowPenaltyRa ) { u8 H2C_Parameter[6] = {0}; @@ -748,7 +748,7 @@ static void halbtc8723b2ant_SetSwPenaltyTxRateAdaptive( } static void halbtc8723b2ant_LowPenaltyRa( - PBTC_COEXIST pBtCoexist, bool bForceExec, bool bLowPenaltyRa + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bLowPenaltyRa ) { /* return; */ @@ -782,7 +782,7 @@ static void halbtc8723b2ant_LowPenaltyRa( pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa; } -static void halbtc8723b2ant_SetDacSwingReg(PBTC_COEXIST pBtCoexist, u32 level) +static void halbtc8723b2ant_SetDacSwingReg(struct BTC_COEXIST * pBtCoexist, u32 level) { u8 val = (u8)level; @@ -795,7 +795,7 @@ static void halbtc8723b2ant_SetDacSwingReg(PBTC_COEXIST pBtCoexist, u32 level) } static void halbtc8723b2ant_SetSwFullTimeDacSwing( - PBTC_COEXIST pBtCoexist, bool bSwDacSwingOn, u32 swDacSwingLvl + struct BTC_COEXIST * pBtCoexist, bool bSwDacSwingOn, u32 swDacSwingLvl ) { if (bSwDacSwingOn) @@ -806,7 +806,7 @@ static void halbtc8723b2ant_SetSwFullTimeDacSwing( static void halbtc8723b2ant_DacSwing( - PBTC_COEXIST pBtCoexist, + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bDacSwingOn, u32 dacSwingLvl @@ -850,7 +850,7 @@ static void halbtc8723b2ant_DacSwing( } static void halbtc8723b2ant_SetAgcTable( - PBTC_COEXIST pBtCoexist, bool bAgcTableEn + struct BTC_COEXIST * pBtCoexist, bool bAgcTableEn ) { u8 rssiAdjustVal = 0; @@ -910,7 +910,7 @@ static void halbtc8723b2ant_SetAgcTable( } static void halbtc8723b2ant_AgcTable( - PBTC_COEXIST pBtCoexist, bool bForceExec, bool bAgcTableEn + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bAgcTableEn ) { BTC_PRINT( @@ -944,7 +944,7 @@ static void halbtc8723b2ant_AgcTable( } static void halbtc8723b2ant_SetCoexTable( - PBTC_COEXIST pBtCoexist, + struct BTC_COEXIST * pBtCoexist, u32 val0x6c0, u32 val0x6c4, u32 val0x6c8, @@ -981,7 +981,7 @@ static void halbtc8723b2ant_SetCoexTable( } static void halbtc8723b2ant_CoexTable( - PBTC_COEXIST pBtCoexist, + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u32 val0x6c0, u32 val0x6c4, @@ -1047,7 +1047,7 @@ static void halbtc8723b2ant_CoexTable( } static void halbtc8723b2ant_CoexTableWithType( - PBTC_COEXIST pBtCoexist, bool bForceExec, u8 type + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 type ) { switch (type) { @@ -1096,7 +1096,7 @@ static void halbtc8723b2ant_CoexTableWithType( } static void halbtc8723b2ant_SetFwIgnoreWlanAct( - PBTC_COEXIST pBtCoexist, bool bEnable + struct BTC_COEXIST * pBtCoexist, bool bEnable ) { u8 H2C_Parameter[1] = {0}; @@ -1117,7 +1117,7 @@ static void halbtc8723b2ant_SetFwIgnoreWlanAct( } static void halbtc8723b2ant_IgnoreWlanAct( - PBTC_COEXIST pBtCoexist, bool bForceExec, bool bEnable + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bEnable ) { BTC_PRINT( @@ -1145,7 +1145,7 @@ static void halbtc8723b2ant_IgnoreWlanAct( } static void halbtc8723b2ant_SetFwPstdma( - PBTC_COEXIST pBtCoexist, + struct BTC_COEXIST * pBtCoexist, u8 byte1, u8 byte2, u8 byte3, @@ -1184,7 +1184,7 @@ static void halbtc8723b2ant_SetFwPstdma( } static void halbtc8723b2ant_SwMechanism1( - PBTC_COEXIST pBtCoexist, + struct BTC_COEXIST * pBtCoexist, bool bShrinkRxLPF, bool bLowPenaltyRA, bool bLimitedDIG, @@ -1196,7 +1196,7 @@ static void halbtc8723b2ant_SwMechanism1( } static void halbtc8723b2ant_SwMechanism2( - PBTC_COEXIST pBtCoexist, + struct BTC_COEXIST * pBtCoexist, bool bAGCTableShift, bool bADCBackOff, bool bSWDACSwing, @@ -1208,10 +1208,10 @@ static void halbtc8723b2ant_SwMechanism2( } static void halbtc8723b2ant_SetAntPath( - PBTC_COEXIST pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff + struct BTC_COEXIST * pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff ) { - PBTC_BOARD_INFO pBoardInfo = &pBtCoexist->boardInfo; + struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; u32 fwVer = 0, u4Tmp = 0; bool bPgExtSwitch = false; bool bUseExtSwitch = false; @@ -1302,7 +1302,7 @@ static void halbtc8723b2ant_SetAntPath( } static void halbtc8723b2ant_PsTdma( - PBTC_COEXIST pBtCoexist, bool bForceExec, bool bTurnOn, u8 type + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bTurnOn, u8 type ) { BTC_PRINT( @@ -1434,7 +1434,7 @@ static void halbtc8723b2ant_PsTdma( pCoexDm->prePsTdma = pCoexDm->curPsTdma; } -static void halbtc8723b2ant_CoexAllOff(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_CoexAllOff(struct BTC_COEXIST * pBtCoexist) { /* fw all off */ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, false, 1); @@ -1450,7 +1450,7 @@ static void halbtc8723b2ant_CoexAllOff(PBTC_COEXIST pBtCoexist) halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0); } -static void halbtc8723b2ant_InitCoexDm(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist) { /* force to reset coex mechanism */ @@ -1462,7 +1462,7 @@ static void halbtc8723b2ant_InitCoexDm(PBTC_COEXIST pBtCoexist) halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); } -static void halbtc8723b2ant_ActionBtInquiry(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_ActionBtInquiry(struct BTC_COEXIST * pBtCoexist) { bool bWifiConnected = false; bool bLowPwrDisable = true; @@ -1490,7 +1490,7 @@ static void halbtc8723b2ant_ActionBtInquiry(PBTC_COEXIST pBtCoexist) halbtc8723b2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_AUX, false, false); } -static bool halbtc8723b2ant_IsCommonAction(PBTC_COEXIST pBtCoexist) +static bool halbtc8723b2ant_IsCommonAction(struct BTC_COEXIST * pBtCoexist) { u8 btRssiState = BTC_RSSI_STATE_HIGH; bool bCommon = false, bWifiConnected = false, bWifiBusy = false; @@ -1591,7 +1591,7 @@ static bool halbtc8723b2ant_IsCommonAction(PBTC_COEXIST pBtCoexist) } static void halbtc8723b2ant_TdmaDurationAdjust( - PBTC_COEXIST pBtCoexist, bool bScoHid, bool bTxPause, u8 maxInterval + struct BTC_COEXIST * pBtCoexist, bool bScoHid, bool bTxPause, u8 maxInterval ) { static s32 up, dn, m, n, WaitCount; @@ -2041,7 +2041,7 @@ static void halbtc8723b2ant_TdmaDurationAdjust( } /* SCO only or SCO+PAN(HS) */ -static void halbtc8723b2ant_ActionSco(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_ActionSco(struct BTC_COEXIST * pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2096,7 +2096,7 @@ static void halbtc8723b2ant_ActionSco(PBTC_COEXIST pBtCoexist) } -static void halbtc8723b2ant_ActionHid(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_ActionHid(struct BTC_COEXIST * pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2157,7 +2157,7 @@ static void halbtc8723b2ant_ActionHid(PBTC_COEXIST pBtCoexist) } /* A2DP only / PAN(EDR) only/ A2DP+PAN(HS) */ -static void halbtc8723b2ant_ActionA2dp(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_ActionA2dp(struct BTC_COEXIST * pBtCoexist) { u8 wifiRssiState, wifiRssiState1, btRssiState; u32 wifiBw; @@ -2238,7 +2238,7 @@ static void halbtc8723b2ant_ActionA2dp(PBTC_COEXIST pBtCoexist) } } -static void halbtc8723b2ant_ActionA2dpPanHs(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_ActionA2dpPanHs(struct BTC_COEXIST * pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2288,7 +2288,7 @@ static void halbtc8723b2ant_ActionA2dpPanHs(PBTC_COEXIST pBtCoexist) } } -static void halbtc8723b2ant_ActionPanEdr(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_ActionPanEdr(struct BTC_COEXIST * pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2346,7 +2346,7 @@ static void halbtc8723b2ant_ActionPanEdr(PBTC_COEXIST pBtCoexist) /* PAN(HS) only */ -static void halbtc8723b2ant_ActionPanHs(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_ActionPanHs(struct BTC_COEXIST * pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2396,7 +2396,7 @@ static void halbtc8723b2ant_ActionPanHs(PBTC_COEXIST pBtCoexist) } /* PAN(EDR)+A2DP */ -static void halbtc8723b2ant_ActionPanEdrA2dp(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_ActionPanEdrA2dp(struct BTC_COEXIST * pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2457,7 +2457,7 @@ static void halbtc8723b2ant_ActionPanEdrA2dp(PBTC_COEXIST pBtCoexist) } } -static void halbtc8723b2ant_ActionPanEdrHid(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_ActionPanEdrHid(struct BTC_COEXIST * pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2521,7 +2521,7 @@ static void halbtc8723b2ant_ActionPanEdrHid(PBTC_COEXIST pBtCoexist) } /* HID+A2DP+PAN(EDR) */ -static void halbtc8723b2ant_ActionHidA2dpPanEdr(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_ActionHidA2dpPanEdr(struct BTC_COEXIST * pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2581,7 +2581,7 @@ static void halbtc8723b2ant_ActionHidA2dpPanEdr(PBTC_COEXIST pBtCoexist) } } -static void halbtc8723b2ant_ActionHidA2dp(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_ActionHidA2dp(struct BTC_COEXIST * pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2656,7 +2656,7 @@ static void halbtc8723b2ant_ActionHidA2dp(PBTC_COEXIST pBtCoexist) } } -static void halbtc8723b2ant_RunCoexistMechanism(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_RunCoexistMechanism(struct BTC_COEXIST * pBtCoexist) { u8 algorithm = 0; @@ -2755,7 +2755,7 @@ static void halbtc8723b2ant_RunCoexistMechanism(PBTC_COEXIST pBtCoexist) } } -static void halbtc8723b2ant_WifiOffHwCfg(PBTC_COEXIST pBtCoexist) +static void halbtc8723b2ant_WifiOffHwCfg(struct BTC_COEXIST * pBtCoexist) { bool bIsInMpMode = false; u8 H2C_Parameter[2] = {0}; @@ -2780,7 +2780,7 @@ static void halbtc8723b2ant_WifiOffHwCfg(PBTC_COEXIST pBtCoexist) pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1); /* BT select s0/s1 is controlled by WiFi */ } -static void halbtc8723b2ant_InitHwConfig(PBTC_COEXIST pBtCoexist, bool bBackUp) +static void halbtc8723b2ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool bBackUp) { u8 u1Tmp = 0; @@ -2814,9 +2814,9 @@ static void halbtc8723b2ant_InitHwConfig(PBTC_COEXIST pBtCoexist, bool bBackUp) /* */ /* extern function start with EXhalbtc8723b2ant_ */ /* */ -void EXhalbtc8723b2ant_PowerOnSetting(PBTC_COEXIST pBtCoexist) +void EXhalbtc8723b2ant_PowerOnSetting(struct BTC_COEXIST * pBtCoexist) { - PBTC_BOARD_INFO pBoardInfo = &pBtCoexist->boardInfo; + struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; u8 u1Tmp = 0x4; /* Set BIT2 by default since it's 2ant case */ u16 u2Tmp = 0x0; @@ -2866,23 +2866,23 @@ void EXhalbtc8723b2ant_PowerOnSetting(PBTC_COEXIST pBtCoexist) } } -void EXhalbtc8723b2ant_InitHwConfig(PBTC_COEXIST pBtCoexist, bool bWifiOnly) +void EXhalbtc8723b2ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool bWifiOnly) { halbtc8723b2ant_InitHwConfig(pBtCoexist, true); } -void EXhalbtc8723b2ant_InitCoexDm(PBTC_COEXIST pBtCoexist) +void EXhalbtc8723b2ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n")); halbtc8723b2ant_InitCoexDm(pBtCoexist); } -void EXhalbtc8723b2ant_DisplayCoexInfo(PBTC_COEXIST pBtCoexist) +void EXhalbtc8723b2ant_DisplayCoexInfo(struct BTC_COEXIST * pBtCoexist) { - PBTC_BOARD_INFO pBoardInfo = &pBtCoexist->boardInfo; - PBTC_STACK_INFO pStackInfo = &pBtCoexist->stackInfo; - PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; + struct BTC_STACK_INFO * pStackInfo = &pBtCoexist->stackInfo; + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; u8 *cliBuf = pBtCoexist->cliBuf; u8 u1Tmp[4], i, btInfoExt, psTdmaCase = 0; u32 u4Tmp[4]; @@ -3259,7 +3259,7 @@ void EXhalbtc8723b2ant_DisplayCoexInfo(PBTC_COEXIST pBtCoexist) } -void EXhalbtc8723b2ant_IpsNotify(PBTC_COEXIST pBtCoexist, u8 type) +void EXhalbtc8723b2ant_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) { if (BTC_IPS_ENTER == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS ENTER notify\n")); @@ -3276,7 +3276,7 @@ void EXhalbtc8723b2ant_IpsNotify(PBTC_COEXIST pBtCoexist, u8 type) } } -void EXhalbtc8723b2ant_LpsNotify(PBTC_COEXIST pBtCoexist, u8 type) +void EXhalbtc8723b2ant_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) { if (BTC_LPS_ENABLE == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS ENABLE notify\n")); @@ -3287,7 +3287,7 @@ void EXhalbtc8723b2ant_LpsNotify(PBTC_COEXIST pBtCoexist, u8 type) } } -void EXhalbtc8723b2ant_ScanNotify(PBTC_COEXIST pBtCoexist, u8 type) +void EXhalbtc8723b2ant_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type) { if (BTC_SCAN_START == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n")); @@ -3296,7 +3296,7 @@ void EXhalbtc8723b2ant_ScanNotify(PBTC_COEXIST pBtCoexist, u8 type) } } -void EXhalbtc8723b2ant_ConnectNotify(PBTC_COEXIST pBtCoexist, u8 type) +void EXhalbtc8723b2ant_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 type) { if (BTC_ASSOCIATE_START == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n")); @@ -3305,7 +3305,7 @@ void EXhalbtc8723b2ant_ConnectNotify(PBTC_COEXIST pBtCoexist, u8 type) } } -void EXhalbtc8723b2ant_MediaStatusNotify(PBTC_COEXIST pBtCoexist, u8 type) +void EXhalbtc8723b2ant_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, u8 type) { u8 H2C_Parameter[3] = {0}; u32 wifiBw; @@ -3351,7 +3351,7 @@ void EXhalbtc8723b2ant_MediaStatusNotify(PBTC_COEXIST pBtCoexist, u8 type) pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter); } -void EXhalbtc8723b2ant_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 type) +void EXhalbtc8723b2ant_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 type) { if (type == BTC_PACKET_DHCP) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], DHCP Packet notify\n")); @@ -3359,7 +3359,7 @@ void EXhalbtc8723b2ant_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 type) } void EXhalbtc8723b2ant_BtInfoNotify( - PBTC_COEXIST pBtCoexist, u8 *tmpBuf, u8 length + struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length ) { u8 btInfo = 0; @@ -3503,7 +3503,7 @@ void EXhalbtc8723b2ant_BtInfoNotify( halbtc8723b2ant_RunCoexistMechanism(pBtCoexist); } -void EXhalbtc8723b2ant_HaltNotify(PBTC_COEXIST pBtCoexist) +void EXhalbtc8723b2ant_HaltNotify(struct BTC_COEXIST * pBtCoexist) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n")); @@ -3514,7 +3514,7 @@ void EXhalbtc8723b2ant_HaltNotify(PBTC_COEXIST pBtCoexist) EXhalbtc8723b2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT); } -void EXhalbtc8723b2ant_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState) +void EXhalbtc8723b2ant_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify\n")); @@ -3528,7 +3528,7 @@ void EXhalbtc8723b2ant_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState) } } -void EXhalbtc8723b2ant_Periodical(PBTC_COEXIST pBtCoexist) +void EXhalbtc8723b2ant_Periodical(struct BTC_COEXIST * pBtCoexist) { static u8 disVerInfoCnt; u32 fwVer = 0, btPatchVer = 0; diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h index 9d4b5f51bd18..6375acede94c 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h @@ -129,19 +129,19 @@ struct COEX_STA_8723B_2ANT { /* */ /* The following is interface which will notify coex module. */ /* */ -void EXhalbtc8723b2ant_PowerOnSetting(PBTC_COEXIST pBtCoexist); -void EXhalbtc8723b2ant_InitHwConfig(PBTC_COEXIST pBtCoexist, bool bWifiOnly); -void EXhalbtc8723b2ant_InitCoexDm(PBTC_COEXIST pBtCoexist); -void EXhalbtc8723b2ant_IpsNotify(PBTC_COEXIST pBtCoexist, u8 type); -void EXhalbtc8723b2ant_LpsNotify(PBTC_COEXIST pBtCoexist, u8 type); -void EXhalbtc8723b2ant_ScanNotify(PBTC_COEXIST pBtCoexist, u8 type); -void EXhalbtc8723b2ant_ConnectNotify(PBTC_COEXIST pBtCoexist, u8 type); -void EXhalbtc8723b2ant_MediaStatusNotify(PBTC_COEXIST pBtCoexist, u8 type); -void EXhalbtc8723b2ant_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 type); +void EXhalbtc8723b2ant_PowerOnSetting(struct BTC_COEXIST * pBtCoexist); +void EXhalbtc8723b2ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool bWifiOnly); +void EXhalbtc8723b2ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist); +void EXhalbtc8723b2ant_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); +void EXhalbtc8723b2ant_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); +void EXhalbtc8723b2ant_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type); +void EXhalbtc8723b2ant_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 type); +void EXhalbtc8723b2ant_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, u8 type); +void EXhalbtc8723b2ant_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 type); void EXhalbtc8723b2ant_BtInfoNotify( - PBTC_COEXIST pBtCoexist, u8 *tmpBuf, u8 length + struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length ); -void EXhalbtc8723b2ant_HaltNotify(PBTC_COEXIST pBtCoexist); -void EXhalbtc8723b2ant_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState); -void EXhalbtc8723b2ant_Periodical(PBTC_COEXIST pBtCoexist); -void EXhalbtc8723b2ant_DisplayCoexInfo(PBTC_COEXIST pBtCoexist); +void EXhalbtc8723b2ant_HaltNotify(struct BTC_COEXIST * pBtCoexist); +void EXhalbtc8723b2ant_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState); +void EXhalbtc8723b2ant_Periodical(struct BTC_COEXIST * pBtCoexist); +void EXhalbtc8723b2ant_DisplayCoexInfo(struct BTC_COEXIST * pBtCoexist); diff --git a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h index c758d143c57f..2c4c7b064073 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h +++ b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h @@ -44,31 +44,31 @@ #define BTC_ANT_WIFI_AT_CPL_MAIN 0 #define BTC_ANT_WIFI_AT_CPL_AUX 1 -typedef enum _BTC_POWERSAVE_TYPE { +enum BTC_POWERSAVE_TYPE { BTC_PS_WIFI_NATIVE = 0, /* wifi original power save behavior */ BTC_PS_LPS_ON = 1, BTC_PS_LPS_OFF = 2, BTC_PS_MAX -} BTC_POWERSAVE_TYPE, *PBTC_POWERSAVE_TYPE; +}; -typedef enum _BTC_BT_REG_TYPE { +enum BTC_BT_REG_TYPE { BTC_BT_REG_RF = 0, BTC_BT_REG_MODEM = 1, BTC_BT_REG_BLUEWIZE = 2, BTC_BT_REG_VENDOR = 3, BTC_BT_REG_LE = 4, BTC_BT_REG_MAX -} BTC_BT_REG_TYPE, *PBTC_BT_REG_TYPE; +}; -typedef enum _BTC_CHIP_INTERFACE { +enum BTC_CHIP_INTERFACE { BTC_INTF_UNKNOWN = 0, BTC_INTF_PCI = 1, BTC_INTF_USB = 2, BTC_INTF_SDIO = 3, BTC_INTF_MAX -} BTC_CHIP_INTERFACE, *PBTC_CHIP_INTERFACE; +}; -typedef enum _BTC_CHIP_TYPE { +enum BTC_CHIP_TYPE { BTC_CHIP_UNDEF = 0, BTC_CHIP_CSR_BC4 = 1, BTC_CHIP_CSR_BC8 = 2, @@ -76,13 +76,13 @@ typedef enum _BTC_CHIP_TYPE { BTC_CHIP_RTL8821 = 4, BTC_CHIP_RTL8723B = 5, BTC_CHIP_MAX -} BTC_CHIP_TYPE, *PBTC_CHIP_TYPE; +}; -typedef enum _BTC_MSG_TYPE { +enum BTC_MSG_TYPE { BTC_MSG_INTERFACE = 0x0, BTC_MSG_ALGORITHM = 0x1, BTC_MSG_MAX -} BTC_MSG_TYPE; +}; extern u32 GLBtcDbgType[]; /* following is for BTC_MSG_INTERFACE */ @@ -164,7 +164,7 @@ extern u32 GLBtcDbgType[]; no_printk("%s %p %zu", _TitleString, _HexData, _HexDataLen) #endif -typedef struct _BTC_BOARD_INFO { +struct BTC_BOARD_INFO { /* The following is some board information */ u8 btChipType; u8 pgAntNum; /* pg ant number */ @@ -172,9 +172,9 @@ typedef struct _BTC_BOARD_INFO { u8 btdmAntPos; /* Bryant Add to indicate Antenna Position for (pgAntNum = 2) && (btdmAntNum = 1) (DPDT+1Ant case) */ u8 singleAntPath; /* current used for 8723b only, 1 =>s0, 0 =>s1 */ /* bool bBtExist; */ -} BTC_BOARD_INFO, *PBTC_BOARD_INFO; +}; -typedef enum _BTC_DBG_OPCODE { +enum BTC_DBG_OPCODE { BTC_DBG_SET_COEX_NORMAL = 0x0, BTC_DBG_SET_COEX_WIFI_ONLY = 0x1, BTC_DBG_SET_COEX_BT_ONLY = 0x2, @@ -182,9 +182,9 @@ typedef enum _BTC_DBG_OPCODE { BTC_DBG_SET_COEX_BT_AFH_MAP = 0x4, BTC_DBG_SET_COEX_BT_IGNORE_WLAN_ACT = 0x5, BTC_DBG_MAX -} BTC_DBG_OPCODE, *PBTC_DBG_OPCODE; +}; -typedef enum _BTC_RSSI_STATE { +enum BTC_RSSI_STATE { BTC_RSSI_STATE_HIGH = 0x0, BTC_RSSI_STATE_MEDIUM = 0x1, BTC_RSSI_STATE_LOW = 0x2, @@ -192,40 +192,40 @@ typedef enum _BTC_RSSI_STATE { BTC_RSSI_STATE_STAY_MEDIUM = 0x4, BTC_RSSI_STATE_STAY_LOW = 0x5, BTC_RSSI_MAX -} BTC_RSSI_STATE, *PBTC_RSSI_STATE; +}; #define BTC_RSSI_HIGH(_rssi_) ((_rssi_ == BTC_RSSI_STATE_HIGH || _rssi_ == BTC_RSSI_STATE_STAY_HIGH) ? true : false) #define BTC_RSSI_MEDIUM(_rssi_) ((_rssi_ == BTC_RSSI_STATE_MEDIUM || _rssi_ == BTC_RSSI_STATE_STAY_MEDIUM) ? true : false) #define BTC_RSSI_LOW(_rssi_) ((_rssi_ == BTC_RSSI_STATE_LOW || _rssi_ == BTC_RSSI_STATE_STAY_LOW) ? true : false) -typedef enum _BTC_WIFI_ROLE { +enum BTC_WIFI_ROLE { BTC_ROLE_STATION = 0x0, BTC_ROLE_AP = 0x1, BTC_ROLE_IBSS = 0x2, BTC_ROLE_HS_MODE = 0x3, BTC_ROLE_MAX -} BTC_WIFI_ROLE, *PBTC_WIFI_ROLE; +}; -typedef enum _BTC_WIFI_BW_MODE { +enum BTC_WIFI_BW_MODE { BTC_WIFI_BW_LEGACY = 0x0, BTC_WIFI_BW_HT20 = 0x1, BTC_WIFI_BW_HT40 = 0x2, BTC_WIFI_BW_MAX -} BTC_WIFI_BW_MODE, *PBTC_WIFI_BW_MODE; +}; -typedef enum _BTC_WIFI_TRAFFIC_DIR { +enum BTC_WIFI_TRAFFIC_DIR { BTC_WIFI_TRAFFIC_TX = 0x0, BTC_WIFI_TRAFFIC_RX = 0x1, BTC_WIFI_TRAFFIC_MAX -} BTC_WIFI_TRAFFIC_DIR, *PBTC_WIFI_TRAFFIC_DIR; +}; -typedef enum _BTC_WIFI_PNP { +enum BTC_WIFI_PNP { BTC_WIFI_PNP_WAKE_UP = 0x0, BTC_WIFI_PNP_SLEEP = 0x1, BTC_WIFI_PNP_MAX -} BTC_WIFI_PNP, *PBTC_WIFI_PNP; +}; /* for 8723b-d cut large current issue */ -typedef enum _BT_WIFI_COEX_STATE { +enum BT_WIFI_COEX_STATE { BTC_WIFI_STAT_INIT, BTC_WIFI_STAT_IQK, BTC_WIFI_STAT_NORMAL_OFF, @@ -233,10 +233,10 @@ typedef enum _BT_WIFI_COEX_STATE { BTC_WIFI_STAT_NORMAL, BTC_WIFI_STAT_ANT_DIV, BTC_WIFI_STAT_MAX -} BT_WIFI_COEX_STATE, *PBT_WIFI_COEX_STATE; +}; /* defined for BFP_BTC_GET */ -typedef enum _BTC_GET_TYPE { +enum BTC_GET_TYPE { /* type bool */ BTC_GET_BL_HS_OPERATION, BTC_GET_BL_HS_CONNECTING, @@ -275,10 +275,10 @@ typedef enum _BTC_GET_TYPE { BTC_GET_U1_LPS_MODE, BTC_GET_MAX -} BTC_GET_TYPE, *PBTC_GET_TYPE; +}; /* defined for BFP_BTC_SET */ -typedef enum _BTC_SET_TYPE { +enum BTC_SET_TYPE { /* type bool */ BTC_SET_BL_BT_DISABLE, BTC_SET_BL_BT_TRAFFIC_BUSY, @@ -316,65 +316,65 @@ typedef enum _BTC_SET_TYPE { BTC_SET_ACT_CTRL_8723B_ANT, /* */ BTC_SET_MAX -} BTC_SET_TYPE, *PBTC_SET_TYPE; +}; -typedef enum _BTC_DBG_DISP_TYPE { +enum BTC_DBG_DISP_TYPE { BTC_DBG_DISP_COEX_STATISTICS = 0x0, BTC_DBG_DISP_BT_LINK_INFO = 0x1, BTC_DBG_DISP_FW_PWR_MODE_CMD = 0x2, BTC_DBG_DISP_MAX -} BTC_DBG_DISP_TYPE, *PBTC_DBG_DISP_TYPE; +}; -typedef enum _BTC_NOTIFY_TYPE_IPS { +enum BTC_NOTIFY_TYPE_IPS { BTC_IPS_LEAVE = 0x0, BTC_IPS_ENTER = 0x1, BTC_IPS_MAX -} BTC_NOTIFY_TYPE_IPS, *PBTC_NOTIFY_TYPE_IPS; +}; -typedef enum _BTC_NOTIFY_TYPE_LPS { +enum BTC_NOTIFY_TYPE_LPS { BTC_LPS_DISABLE = 0x0, BTC_LPS_ENABLE = 0x1, BTC_LPS_MAX -} BTC_NOTIFY_TYPE_LPS, *PBTC_NOTIFY_TYPE_LPS; +}; -typedef enum _BTC_NOTIFY_TYPE_SCAN { +enum BTC_NOTIFY_TYPE_SCAN { BTC_SCAN_FINISH = 0x0, BTC_SCAN_START = 0x1, BTC_SCAN_MAX -} BTC_NOTIFY_TYPE_SCAN, *PBTC_NOTIFY_TYPE_SCAN; +}; -typedef enum _BTC_NOTIFY_TYPE_ASSOCIATE { +enum BTC_NOTIFY_TYPE_ASSOCIATE { BTC_ASSOCIATE_FINISH = 0x0, BTC_ASSOCIATE_START = 0x1, BTC_ASSOCIATE_MAX -} BTC_NOTIFY_TYPE_ASSOCIATE, *PBTC_NOTIFY_TYPE_ASSOCIATE; +}; -typedef enum _BTC_NOTIFY_TYPE_MEDIA_STATUS { +enum BTC_NOTIFY_TYPE_MEDIA_STATUS { BTC_MEDIA_DISCONNECT = 0x0, BTC_MEDIA_CONNECT = 0x1, BTC_MEDIA_MAX -} BTC_NOTIFY_TYPE_MEDIA_STATUS, *PBTC_NOTIFY_TYPE_MEDIA_STATUS; +}; -typedef enum _BTC_NOTIFY_TYPE_SPECIAL_PACKET { +enum BTC_NOTIFY_TYPE_SPECIAL_PACKET { BTC_PACKET_UNKNOWN = 0x0, BTC_PACKET_DHCP = 0x1, BTC_PACKET_ARP = 0x2, BTC_PACKET_EAPOL = 0x3, BTC_PACKET_MAX -} BTC_NOTIFY_TYPE_SPECIAL_PACKET, *PBTC_NOTIFY_TYPE_SPECIAL_PACKET; +}; -typedef enum _BTC_NOTIFY_TYPE_STACK_OPERATION { +enum BTC_NOTIFY_TYPE_STACK_OPERATION { BTC_STACK_OP_NONE = 0x0, BTC_STACK_OP_INQ_PAGE_PAIR_START = 0x1, BTC_STACK_OP_INQ_PAGE_PAIR_FINISH = 0x2, BTC_STACK_OP_MAX -} BTC_NOTIFY_TYPE_STACK_OPERATION, *PBTC_NOTIFY_TYPE_STACK_OPERATION; +}; /* Bryant Add */ -typedef enum _BTC_ANTENNA_POS { +enum BTC_ANTENNA_POS { BTC_ANTENNA_AT_MAIN_PORT = 0x1, BTC_ANTENNA_AT_AUX_PORT = 0x2, -} BTC_ANTENNA_POS, *PBTC_ANTENNA_POS; +}; typedef u8 (*BFP_BTC_R1)(void *pBtcContext, u32 RegAddr); typedef u16(*BFP_BTC_R2)(void *pBtcContext, u32 RegAddr); @@ -409,7 +409,7 @@ typedef void (*BFP_BTC_SET_BT_REG)( typedef u32 (*BFP_BTC_GET_BT_REG)(void *pBtcContext, u8 regType, u32 offset); typedef void (*BFP_BTC_DISP_DBG_MSG)(void *pBtCoexist, u8 dispType); -typedef struct _BTC_BT_INFO { +struct BTC_BT_INFO { bool bBtDisabled; u8 rssiAdjustForAgcTableOn; u8 rssiAdjustFor1AntCoexType; @@ -435,9 +435,9 @@ typedef struct _BTC_BT_INFO { u8 lpsVal; u8 rpwmVal; u32 raMask; -} BTC_BT_INFO, *PBTC_BT_INFO; +}; -typedef struct _BTC_STACK_INFO { +struct BTC_STACK_INFO { bool bProfileNotified; u16 hciVersion; /* stack hci version */ u8 numOfLink; @@ -450,9 +450,9 @@ typedef struct _BTC_STACK_INFO { bool bPanExist; bool bUnknownAclExist; s8 minBtRssi; -} BTC_STACK_INFO, *PBTC_STACK_INFO; +}; -typedef struct _BTC_BT_LINK_INFO { +struct BTC_BT_LINK_INFO { bool bBtLinkExist; bool bScoExist; bool bScoOnly; @@ -463,9 +463,9 @@ typedef struct _BTC_BT_LINK_INFO { bool bPanExist; bool bPanOnly; bool bSlaveRole; -} BTC_BT_LINK_INFO, *PBTC_BT_LINK_INFO; +}; -typedef struct _BTC_STATISTICS { +struct BTC_STATISTICS { u32 cntBind; u32 cntPowerOn; u32 cntInitHwConfig; @@ -482,22 +482,22 @@ typedef struct _BTC_STATISTICS { u32 cntCoexDmSwitch; u32 cntStackOperationNotify; u32 cntDbgCtrl; -} BTC_STATISTICS, *PBTC_STATISTICS; +}; -typedef struct _BTC_COEXIST { +struct BTC_COEXIST { bool bBinded; /* make sure only one adapter can bind the data context */ void *Adapter; /* default adapter */ - BTC_BOARD_INFO boardInfo; - BTC_BT_INFO btInfo; /* some bt info referenced by non-bt module */ - BTC_STACK_INFO stackInfo; - BTC_BT_LINK_INFO btLinkInfo; - BTC_CHIP_INTERFACE chipInterface; + struct BTC_BOARD_INFO boardInfo; + struct BTC_BT_INFO btInfo; /* some bt info referenced by non-bt module */ + struct BTC_STACK_INFO stackInfo; + struct BTC_BT_LINK_INFO btLinkInfo; + enum BTC_CHIP_INTERFACE chipInterface; bool bInitilized; bool bStopCoexDm; bool bManualControl; u8 *cliBuf; - BTC_STATISTICS statistics; + struct BTC_STATISTICS statistics; u8 pwrModeVal[10]; /* function pointers */ @@ -528,30 +528,30 @@ typedef struct _BTC_COEXIST { BFP_BTC_GET_BT_REG fBtcGetBtReg; BFP_BTC_SET_BT_REG fBtcSetBtReg; -} BTC_COEXIST, *PBTC_COEXIST; +}; -extern BTC_COEXIST GLBtCoexist; +extern struct BTC_COEXIST GLBtCoexist; -void EXhalbtcoutsrc_PowerOnSetting(PBTC_COEXIST pBtCoexist); -void EXhalbtcoutsrc_InitHwConfig(PBTC_COEXIST pBtCoexist, u8 bWifiOnly); -void EXhalbtcoutsrc_InitCoexDm(PBTC_COEXIST pBtCoexist); -void EXhalbtcoutsrc_IpsNotify(PBTC_COEXIST pBtCoexist, u8 type); -void EXhalbtcoutsrc_LpsNotify(PBTC_COEXIST pBtCoexist, u8 type); -void EXhalbtcoutsrc_ScanNotify(PBTC_COEXIST pBtCoexist, u8 type); -void EXhalbtcoutsrc_ConnectNotify(PBTC_COEXIST pBtCoexist, u8 action); +void EXhalbtcoutsrc_PowerOnSetting(struct BTC_COEXIST * pBtCoexist); +void EXhalbtcoutsrc_InitHwConfig(struct BTC_COEXIST * pBtCoexist, u8 bWifiOnly); +void EXhalbtcoutsrc_InitCoexDm(struct BTC_COEXIST * pBtCoexist); +void EXhalbtcoutsrc_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); +void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); +void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type); +void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 action); void EXhalbtcoutsrc_MediaStatusNotify( - PBTC_COEXIST pBtCoexist, RT_MEDIA_STATUS mediaStatus + struct BTC_COEXIST * pBtCoexist, RT_MEDIA_STATUS mediaStatus ); -void EXhalbtcoutsrc_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 pktType); +void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 pktType); void EXhalbtcoutsrc_BtInfoNotify( - PBTC_COEXIST pBtCoexist, u8 *tmpBuf, u8 length + struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length ); -void EXhalbtcoutsrc_HaltNotify(PBTC_COEXIST pBtCoexist); -void EXhalbtcoutsrc_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState); -void EXhalbtcoutsrc_Periodical(PBTC_COEXIST pBtCoexist); +void EXhalbtcoutsrc_HaltNotify(struct BTC_COEXIST * pBtCoexist); +void EXhalbtcoutsrc_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState); +void EXhalbtcoutsrc_Periodical(struct BTC_COEXIST * pBtCoexist); void EXhalbtcoutsrc_SetChipType(u8 chipType); void EXhalbtcoutsrc_SetAntNum(u8 type, u8 antNum); void EXhalbtcoutsrc_SetSingleAntPath(u8 singleAntPath); -void EXhalbtcoutsrc_DisplayBtCoexInfo(PBTC_COEXIST pBtCoexist); +void EXhalbtcoutsrc_DisplayBtCoexInfo(struct BTC_COEXIST * pBtCoexist); #endif diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c index 3705a60a0546..7ac8a173245f 100644 --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c @@ -13,7 +13,7 @@ /* Global variables */ -BTC_COEXIST GLBtCoexist; +struct BTC_COEXIST GLBtCoexist; static u8 GLBtcWiFiInScanState; static u8 GLBtcWiFiInIQKState; @@ -67,7 +67,7 @@ void DBG_BT_INFO(u8 *dbgmsg) /* */ /* Debug related function */ /* */ -static u8 halbtcoutsrc_IsBtCoexistAvailable(PBTC_COEXIST pBtCoexist) +static u8 halbtcoutsrc_IsBtCoexistAvailable(struct BTC_COEXIST * pBtCoexist) { if (!pBtCoexist->bBinded || !pBtCoexist->Adapter) return false; @@ -101,7 +101,7 @@ static void halbtcoutsrc_DbgInit(void) 0; } -static void halbtcoutsrc_LeaveLps(PBTC_COEXIST pBtCoexist) +static void halbtcoutsrc_LeaveLps(struct BTC_COEXIST * pBtCoexist) { struct adapter *padapter; @@ -114,7 +114,7 @@ static void halbtcoutsrc_LeaveLps(PBTC_COEXIST pBtCoexist) rtw_btcoex_LPS_Leave(padapter); } -static void halbtcoutsrc_EnterLps(PBTC_COEXIST pBtCoexist) +static void halbtcoutsrc_EnterLps(struct BTC_COEXIST * pBtCoexist) { struct adapter *padapter; @@ -127,7 +127,7 @@ static void halbtcoutsrc_EnterLps(PBTC_COEXIST pBtCoexist) rtw_btcoex_LPS_Enter(padapter); } -static void halbtcoutsrc_NormalLps(PBTC_COEXIST pBtCoexist) +static void halbtcoutsrc_NormalLps(struct BTC_COEXIST * pBtCoexist) { struct adapter *padapter; @@ -149,7 +149,7 @@ static void halbtcoutsrc_NormalLps(PBTC_COEXIST pBtCoexist) * Constraint: * 1. this function will request pwrctrl->lock */ -static void halbtcoutsrc_LeaveLowPower(PBTC_COEXIST pBtCoexist) +static void halbtcoutsrc_LeaveLowPower(struct BTC_COEXIST * pBtCoexist) { struct adapter *padapter; s32 ready; @@ -184,7 +184,7 @@ static void halbtcoutsrc_LeaveLowPower(PBTC_COEXIST pBtCoexist) * Constraint: * 1. this function will request pwrctrl->lock */ -static void halbtcoutsrc_NormalLowPower(PBTC_COEXIST pBtCoexist) +static void halbtcoutsrc_NormalLowPower(struct BTC_COEXIST * pBtCoexist) { struct adapter *padapter; @@ -193,7 +193,7 @@ static void halbtcoutsrc_NormalLowPower(PBTC_COEXIST pBtCoexist) rtw_unregister_task_alive(padapter, BTCOEX_ALIVE); } -static void halbtcoutsrc_DisableLowPower(PBTC_COEXIST pBtCoexist, u8 bLowPwrDisable) +static void halbtcoutsrc_DisableLowPower(struct BTC_COEXIST * pBtCoexist, u8 bLowPwrDisable) { pBtCoexist->btInfo.bBtDisableLowPwr = bLowPwrDisable; if (bLowPwrDisable) @@ -202,7 +202,7 @@ static void halbtcoutsrc_DisableLowPower(PBTC_COEXIST pBtCoexist, u8 bLowPwrDisa halbtcoutsrc_NormalLowPower(pBtCoexist); /* original 32k low power behavior. */ } -static void halbtcoutsrc_AggregationCheck(PBTC_COEXIST pBtCoexist) +static void halbtcoutsrc_AggregationCheck(struct BTC_COEXIST * pBtCoexist) { struct adapter *padapter; bool bNeedToAct; @@ -280,7 +280,7 @@ static u32 _halbtcoutsrc_GetWifiLinkStatus(struct adapter *padapter) return portConnectedStatus; } -static u32 halbtcoutsrc_GetWifiLinkStatus(PBTC_COEXIST pBtCoexist) +static u32 halbtcoutsrc_GetWifiLinkStatus(struct BTC_COEXIST * pBtCoexist) { /* */ /* return value: */ @@ -308,7 +308,7 @@ static u32 halbtcoutsrc_GetWifiLinkStatus(PBTC_COEXIST pBtCoexist) return retVal; } -static u32 halbtcoutsrc_GetBtPatchVer(PBTC_COEXIST pBtCoexist) +static u32 halbtcoutsrc_GetBtPatchVer(struct BTC_COEXIST * pBtCoexist) { return pBtCoexist->btInfo.btRealFwVer; } @@ -339,7 +339,7 @@ static u8 halbtcoutsrc_GetWifiScanAPNum(struct adapter *padapter) static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; struct adapter *padapter; struct hal_com_data *pHalData; struct mlme_ext_priv *mlmeext; @@ -349,7 +349,7 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf) u8 ret; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return false; @@ -507,14 +507,14 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf) static u8 halbtcoutsrc_Set(void *pBtcContext, u8 setType, void *pInBuf) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; struct adapter *padapter; u8 *pu8; u32 *pU4Tmp; u8 ret; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; padapter = pBtCoexist->Adapter; pu8 = pInBuf; pU4Tmp = pInBuf; @@ -642,7 +642,7 @@ static u8 halbtcoutsrc_Set(void *pBtcContext, u8 setType, void *pInBuf) return ret; } -static void halbtcoutsrc_DisplayFwPwrModeCmd(PBTC_COEXIST pBtCoexist) +static void halbtcoutsrc_DisplayFwPwrModeCmd(struct BTC_COEXIST * pBtCoexist) { u8 *cliBuf = pBtCoexist->cliBuf; @@ -658,11 +658,11 @@ static void halbtcoutsrc_DisplayFwPwrModeCmd(PBTC_COEXIST pBtCoexist) /* */ static u8 halbtcoutsrc_Read1Byte(void *pBtcContext, u32 RegAddr) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; struct adapter *padapter; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; padapter = pBtCoexist->Adapter; return rtw_read8(padapter, RegAddr); @@ -670,11 +670,11 @@ static u8 halbtcoutsrc_Read1Byte(void *pBtcContext, u32 RegAddr) static u16 halbtcoutsrc_Read2Byte(void *pBtcContext, u32 RegAddr) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; struct adapter *padapter; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; padapter = pBtCoexist->Adapter; return rtw_read16(padapter, RegAddr); @@ -682,11 +682,11 @@ static u16 halbtcoutsrc_Read2Byte(void *pBtcContext, u32 RegAddr) static u32 halbtcoutsrc_Read4Byte(void *pBtcContext, u32 RegAddr) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; struct adapter *padapter; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; padapter = pBtCoexist->Adapter; return rtw_read32(padapter, RegAddr); @@ -694,11 +694,11 @@ static u32 halbtcoutsrc_Read4Byte(void *pBtcContext, u32 RegAddr) static void halbtcoutsrc_Write1Byte(void *pBtcContext, u32 RegAddr, u8 Data) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; struct adapter *padapter; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; padapter = pBtCoexist->Adapter; rtw_write8(padapter, RegAddr, Data); @@ -706,13 +706,13 @@ static void halbtcoutsrc_Write1Byte(void *pBtcContext, u32 RegAddr, u8 Data) static void halbtcoutsrc_BitMaskWrite1Byte(void *pBtcContext, u32 regAddr, u8 bitMask, u8 data1b) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; struct adapter *padapter; u8 originalValue, bitShift; u8 i; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; padapter = pBtCoexist->Adapter; originalValue = 0; bitShift = 0; @@ -734,11 +734,11 @@ static void halbtcoutsrc_BitMaskWrite1Byte(void *pBtcContext, u32 regAddr, u8 bi static void halbtcoutsrc_Write2Byte(void *pBtcContext, u32 RegAddr, u16 Data) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST *pBtCoexist; struct adapter *padapter; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; padapter = pBtCoexist->Adapter; rtw_write16(padapter, RegAddr, Data); @@ -746,11 +746,11 @@ static void halbtcoutsrc_Write2Byte(void *pBtcContext, u32 RegAddr, u16 Data) static void halbtcoutsrc_Write4Byte(void *pBtcContext, u32 RegAddr, u32 Data) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; struct adapter *padapter; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; padapter = pBtCoexist->Adapter; rtw_write32(padapter, RegAddr, Data); @@ -758,7 +758,7 @@ static void halbtcoutsrc_Write4Byte(void *pBtcContext, u32 RegAddr, u32 Data) static void halbtcoutsrc_WriteLocalReg1Byte(void *pBtcContext, u32 RegAddr, u8 Data) { - PBTC_COEXIST pBtCoexist = (PBTC_COEXIST)pBtcContext; + struct BTC_COEXIST * pBtCoexist = (struct BTC_COEXIST *)pBtcContext; struct adapter *Adapter = pBtCoexist->Adapter; if (BTC_INTF_SDIO == pBtCoexist->chipInterface) @@ -769,11 +769,11 @@ static void halbtcoutsrc_WriteLocalReg1Byte(void *pBtcContext, u32 RegAddr, u8 D static void halbtcoutsrc_SetBbReg(void *pBtcContext, u32 RegAddr, u32 BitMask, u32 Data) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; struct adapter *padapter; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; padapter = pBtCoexist->Adapter; PHY_SetBBReg(padapter, RegAddr, BitMask, Data); @@ -782,11 +782,11 @@ static void halbtcoutsrc_SetBbReg(void *pBtcContext, u32 RegAddr, u32 BitMask, u static u32 halbtcoutsrc_GetBbReg(void *pBtcContext, u32 RegAddr, u32 BitMask) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; struct adapter *padapter; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; padapter = pBtCoexist->Adapter; return PHY_QueryBBReg(padapter, RegAddr, BitMask); @@ -794,11 +794,11 @@ static u32 halbtcoutsrc_GetBbReg(void *pBtcContext, u32 RegAddr, u32 BitMask) static void halbtcoutsrc_SetRfReg(void *pBtcContext, u8 eRFPath, u32 RegAddr, u32 BitMask, u32 Data) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; struct adapter *padapter; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; padapter = pBtCoexist->Adapter; PHY_SetRFReg(padapter, eRFPath, RegAddr, BitMask, Data); @@ -806,11 +806,11 @@ static void halbtcoutsrc_SetRfReg(void *pBtcContext, u8 eRFPath, u32 RegAddr, u3 static u32 halbtcoutsrc_GetRfReg(void *pBtcContext, u8 eRFPath, u32 RegAddr, u32 BitMask) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; struct adapter *padapter; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; padapter = pBtCoexist->Adapter; return PHY_QueryRFReg(padapter, eRFPath, RegAddr, BitMask); @@ -818,7 +818,7 @@ static u32 halbtcoutsrc_GetRfReg(void *pBtcContext, u8 eRFPath, u32 RegAddr, u32 static void halbtcoutsrc_SetBtReg(void *pBtcContext, u8 RegType, u32 RegAddr, u32 Data) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; struct adapter *padapter; u8 CmdBuffer1[4] = {0}; u8 CmdBuffer2[4] = {0}; @@ -827,7 +827,7 @@ static void halbtcoutsrc_SetBtReg(void *pBtcContext, u8 RegType, u32 RegAddr, u3 u8 OperVer = 0; u8 ReqNum = 0; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; padapter = pBtCoexist->Adapter; CmdBuffer1[0] |= (OperVer & 0x0f); /* Set OperVer */ @@ -854,11 +854,11 @@ static u32 halbtcoutsrc_GetBtReg(void *pBtcContext, u8 RegType, u32 RegAddr) static void halbtcoutsrc_FillH2cCmd(void *pBtcContext, u8 elementId, u32 cmdLen, u8 *pCmdBuffer) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; struct adapter *padapter; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; padapter = pBtCoexist->Adapter; rtw_hal_fill_h2c_cmd(padapter, elementId, cmdLen, pCmdBuffer); @@ -866,10 +866,10 @@ static void halbtcoutsrc_FillH2cCmd(void *pBtcContext, u8 elementId, u32 cmdLen, static void halbtcoutsrc_DisplayDbgMsg(void *pBtcContext, u8 dispType) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; - pBtCoexist = (PBTC_COEXIST)pBtcContext; + pBtCoexist = (struct BTC_COEXIST *)pBtcContext; switch (dispType) { case BTC_DBG_DISP_COEX_STATISTICS: break; @@ -888,7 +888,7 @@ static void halbtcoutsrc_DisplayDbgMsg(void *pBtcContext, u8 dispType) /* */ static u8 EXhalbtcoutsrc_BindBtCoexWithAdapter(void *padapter) { - PBTC_COEXIST pBtCoexist = &GLBtCoexist; + struct BTC_COEXIST * pBtCoexist = &GLBtCoexist; if (pBtCoexist->bBinded) return false; @@ -914,7 +914,7 @@ static u8 EXhalbtcoutsrc_BindBtCoexWithAdapter(void *padapter) void hal_btcoex_Initialize(void *padapter) { - PBTC_COEXIST pBtCoexist; + struct BTC_COEXIST * pBtCoexist; memset(&GLBtCoexist, 0, sizeof(GLBtCoexist)); @@ -960,7 +960,7 @@ void hal_btcoex_Initialize(void *padapter) GLBtcWiFiInIQKState = false; } -void EXhalbtcoutsrc_PowerOnSetting(PBTC_COEXIST pBtCoexist) +void EXhalbtcoutsrc_PowerOnSetting(struct BTC_COEXIST * pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -972,7 +972,7 @@ void EXhalbtcoutsrc_PowerOnSetting(PBTC_COEXIST pBtCoexist) EXhalbtc8723b1ant_PowerOnSetting(pBtCoexist); } -void EXhalbtcoutsrc_InitHwConfig(PBTC_COEXIST pBtCoexist, u8 bWifiOnly) +void EXhalbtcoutsrc_InitHwConfig(struct BTC_COEXIST * pBtCoexist, u8 bWifiOnly) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -985,7 +985,7 @@ void EXhalbtcoutsrc_InitHwConfig(PBTC_COEXIST pBtCoexist, u8 bWifiOnly) EXhalbtc8723b1ant_InitHwConfig(pBtCoexist, bWifiOnly); } -void EXhalbtcoutsrc_InitCoexDm(PBTC_COEXIST pBtCoexist) +void EXhalbtcoutsrc_InitCoexDm(struct BTC_COEXIST * pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -1000,7 +1000,7 @@ void EXhalbtcoutsrc_InitCoexDm(PBTC_COEXIST pBtCoexist) pBtCoexist->bInitilized = true; } -void EXhalbtcoutsrc_IpsNotify(PBTC_COEXIST pBtCoexist, u8 type) +void EXhalbtcoutsrc_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) { u8 ipsType; @@ -1027,7 +1027,7 @@ void EXhalbtcoutsrc_IpsNotify(PBTC_COEXIST pBtCoexist, u8 type) /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_LpsNotify(PBTC_COEXIST pBtCoexist, u8 type) +void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) { u8 lpsType; @@ -1050,7 +1050,7 @@ void EXhalbtcoutsrc_LpsNotify(PBTC_COEXIST pBtCoexist, u8 type) EXhalbtc8723b1ant_LpsNotify(pBtCoexist, lpsType); } -void EXhalbtcoutsrc_ScanNotify(PBTC_COEXIST pBtCoexist, u8 type) +void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type) { u8 scanType; @@ -1079,7 +1079,7 @@ void EXhalbtcoutsrc_ScanNotify(PBTC_COEXIST pBtCoexist, u8 type) /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_ConnectNotify(PBTC_COEXIST pBtCoexist, u8 action) +void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 action) { u8 assoType; @@ -1105,7 +1105,7 @@ void EXhalbtcoutsrc_ConnectNotify(PBTC_COEXIST pBtCoexist, u8 action) /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_MediaStatusNotify(PBTC_COEXIST pBtCoexist, RT_MEDIA_STATUS mediaStatus) +void EXhalbtcoutsrc_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, RT_MEDIA_STATUS mediaStatus) { u8 mStatus; @@ -1132,7 +1132,7 @@ void EXhalbtcoutsrc_MediaStatusNotify(PBTC_COEXIST pBtCoexist, RT_MEDIA_STATUS m /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 pktType) +void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 pktType) { u8 packetType; @@ -1163,7 +1163,7 @@ void EXhalbtcoutsrc_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 pktType) /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_BtInfoNotify(PBTC_COEXIST pBtCoexist, u8 *tmpBuf, u8 length) +void EXhalbtcoutsrc_BtInfoNotify(struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -1181,7 +1181,7 @@ void EXhalbtcoutsrc_BtInfoNotify(PBTC_COEXIST pBtCoexist, u8 *tmpBuf, u8 length) /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_HaltNotify(PBTC_COEXIST pBtCoexist) +void EXhalbtcoutsrc_HaltNotify(struct BTC_COEXIST * pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -1194,7 +1194,7 @@ void EXhalbtcoutsrc_HaltNotify(PBTC_COEXIST pBtCoexist) pBtCoexist->bBinded = false; } -void EXhalbtcoutsrc_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState) +void EXhalbtcoutsrc_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -1210,7 +1210,7 @@ void EXhalbtcoutsrc_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState) EXhalbtc8723b2ant_PnpNotify(pBtCoexist, pnpState); } -void EXhalbtcoutsrc_Periodical(PBTC_COEXIST pBtCoexist) +void EXhalbtcoutsrc_Periodical(struct BTC_COEXIST * pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -1255,7 +1255,7 @@ void EXhalbtcoutsrc_SetSingleAntPath(u8 singleAntPath) GLBtCoexist.boardInfo.singleAntPath = singleAntPath; } -void EXhalbtcoutsrc_DisplayBtCoexInfo(PBTC_COEXIST pBtCoexist) +void EXhalbtcoutsrc_DisplayBtCoexInfo(struct BTC_COEXIST * pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:11 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:11 +0100 Subject: [PATCH 06/33] staging: rtl8723bs: remove typedefs in odm_interface.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-7-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #42: FILE: hal/odm_interface.h:42: +typedef enum _ODM_H2C_CMD { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_interface.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_interface.h b/drivers/staging/rtl8723bs/hal/odm_interface.h index 63f374f0bda7..b129eb81bca0 100644 --- a/drivers/staging/rtl8723bs/hal/odm_interface.h +++ b/drivers/staging/rtl8723bs/hal/odm_interface.h @@ -39,13 +39,13 @@ ODM_REG(DIG, _pDM_Odm) #define ODM_REG(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _reg) #define ODM_BIT(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _bit) -typedef enum _ODM_H2C_CMD { +enum ODM_H2C_CMD { ODM_H2C_RSSI_REPORT = 0, ODM_H2C_PSD_RESULT = 1, ODM_H2C_PathDiv = 2, ODM_H2C_WIFI_CALIBRATION = 3, ODM_MAX_H2CCMD -} ODM_H2C_CMD; +}; #endif /* __ODM_INTERFACE_H__ */ -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:13 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:13 +0100 Subject: [PATCH 08/33] staging: rtl8723bs: remove typedefs in odm_HWConfig.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-9-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #33: FILE: hal/odm_HWConfig.h:33: +typedef struct _Phy_Rx_AGC_Info { WARNING: do not add new typedefs #41: FILE: hal/odm_HWConfig.h:41: +typedef struct _Phy_Status_Rpt_8192cd { WARNING: do not add new typedefs #80: FILE: hal/odm_HWConfig.h:80: +typedef struct _Phy_Status_Rpt_8812 { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_HWConfig.c | 2 +- drivers/staging/rtl8723bs/hal/odm_HWConfig.h | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c index 308f65ee7c99..41c33ae96c5a 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c @@ -90,7 +90,7 @@ static void odm_RxPhyStatus92CSeries_Parsing( bool isCCKrate = false; u8 rf_rx_num = 0; u8 LNA_idx, VGA_idx; - PPHY_STATUS_RPT_8192CD_T pPhyStaRpt = (PPHY_STATUS_RPT_8192CD_T)pPhyStatus; + struct PHY_STATUS_RPT_8192CD_T * pPhyStaRpt = (struct PHY_STATUS_RPT_8192CD_T *)pPhyStatus; isCCKrate = pPktinfo->data_rate <= DESC_RATE11M; pPhyInfo->rx_mimo_signal_quality[ODM_RF_PATH_A] = -1; diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.h b/drivers/staging/rtl8723bs/hal/odm_HWConfig.h index 2e2ffbf31f89..cd8c51e6b4b5 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.h +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.h @@ -30,16 +30,16 @@ /* structure and define */ /* */ -typedef struct _Phy_Rx_AGC_Info { +struct PHY_RX_AGC_INFO_T { #if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE) u8 gain:7, trsw:1; #else u8 trsw:1, gain:7; #endif -} PHY_RX_AGC_INFO_T, *pPHY_RX_AGC_INFO_T; +}; -typedef struct _Phy_Status_Rpt_8192cd { - PHY_RX_AGC_INFO_T path_agc[2]; +struct PHY_STATUS_RPT_8192CD_T { + struct PHY_RX_AGC_INFO_T path_agc[2]; u8 ch_corr[2]; u8 cck_sig_qual_ofdm_pwdb_all; u8 cck_agc_rpt_ofdm_cfosho_a; @@ -74,10 +74,10 @@ typedef struct _Phy_Status_Rpt_8192cd { u8 sgi_en:1; u8 antsel_rx_keep_2:1; /* ex_intf_flg:1; */ #endif -} PHY_STATUS_RPT_8192CD_T, *PPHY_STATUS_RPT_8192CD_T; +}; -typedef struct _Phy_Status_Rpt_8812 { +struct PHY_STATUS_RPT_8812_T { /* 2012.05.24 LukeLee: This structure should take big/little endian in consideration later..... */ /* DWORD 0 */ @@ -118,7 +118,7 @@ typedef struct _Phy_Status_Rpt_8812 { u8 antidx_anta:3; u8 antidx_antb:3; u8 resvd_1:2; -} PHY_STATUS_RPT_8812_T, *PPHY_STATUS_RPT_8812_T; +}; void ODM_PhyStatusQuery( -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:12 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:12 +0100 Subject: [PATCH 07/33] staging: rtl8723bs: remove typedefs in odm_EdcaTurboCheck.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-8-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #11: FILE: hal/odm_EdcaTurboCheck.h:11: +typedef struct _EDCA_TURBO_ { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm.h | 2 +- drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h index 9a73297f94d0..0e2868bc405a 100644 --- a/drivers/staging/rtl8723bs/hal/odm.h +++ b/drivers/staging/rtl8723bs/hal/odm.h @@ -1121,7 +1121,7 @@ struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ bool RSSI_test; struct CFO_TRACKING DM_CfoTrack; - EDCA_T DM_EDCA_Table; + struct EDCA_T DM_EDCA_Table; u32 WMMEDCA_BE; struct PATHDIV_T DM_PathDiv; /* Copy from SD4 structure */ diff --git a/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.h b/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.h index bc574d2ad065..09764431c4d6 100644 --- a/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.h +++ b/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.h @@ -8,12 +8,12 @@ #ifndef __ODMEDCATURBOCHECK_H__ #define __ODMEDCATURBOCHECK_H__ -typedef struct _EDCA_TURBO_ { +struct EDCA_T { /* _EDCA_TURBO_ */ bool bCurrentTurboEDCA; bool bIsCurRDLState; u32 prv_traffic_idx; /* edca turbo */ -} EDCA_T, *pEDCA_T; +}; void odm_EdcaTurboCheck(void *pDM_VOID); void ODM_EdcaTurboInit(void *pDM_VOID); -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:14 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:14 +0100 Subject: [PATCH 09/33] staging: rtl8723bs: remove typedefs in odm_types.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-10-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #18: FILE: hal/odm_types.h:18: +typedef enum _HAL_STATUS { WARNING: do not add new typedefs #33: FILE: hal/odm_types.h:33: +typedef enum _RT_SPINLOCK_TYPE { WARNING: do not add new typedefs #77: FILE: hal/odm_types.h:77: + typedef struct timer_list RT_TIMER, *PRT_TIMER; WARNING: do not add new typedefs #78: FILE: hal/odm_types.h:78: + typedef void *RT_TIMER_CALL_BACK; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm.h | 18 +++++++++--------- drivers/staging/rtl8723bs/hal/odm_HWConfig.c | 6 +++--- drivers/staging/rtl8723bs/hal/odm_HWConfig.h | 8 ++++---- drivers/staging/rtl8723bs/hal/odm_types.h | 10 ++++------ 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h index 0e2868bc405a..52e66d1e466c 100644 --- a/drivers/staging/rtl8723bs/hal/odm.h +++ b/drivers/staging/rtl8723bs/hal/odm.h @@ -107,7 +107,7 @@ struct RXHP_T { bool First_time_enter; bool RXHP_enable; u8 TP_Mode; - RT_TIMER PSDTimer; + struct timer_list PSDTimer; }; #define ASSOCIATE_ENTRY_NUM 32 /* Max size of AsocEntry[]. */ @@ -169,8 +169,8 @@ struct SWAT_T { /* _SW_Antenna_Switch_ */ u8 TrafficLoad; u8 Train_time; u8 Train_time_flag; - RT_TIMER SwAntennaSwitchTimer; - RT_TIMER SwAntennaSwitchTimer_8723B; + struct timer_list SwAntennaSwitchTimer; + struct timer_list SwAntennaSwitchTimer_8723B; u32 PktCnt_SWAntDivByCtrlFrame; bool bSWAntDivByCtrlFrame; }; @@ -868,7 +868,7 @@ struct ANT_DETECTED_INFO { /* 2011/09/22 MH Copy from SD4 defined structure. We use to support PHY DM integration. */ /* */ struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ - /* RT_TIMER FastAntTrainingTimer; */ + /* struct timer_list FastAntTrainingTimer; */ /* */ /* Add for different team use temporarily */ /* */ @@ -1146,14 +1146,14 @@ struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ /* PSD */ bool bUserAssignLevel; - RT_TIMER PSDTimer; + struct timer_list PSDTimer; u8 RSSI_BT; /* come from BT */ bool bPSDinProcess; bool bPSDactive; bool bDMInitialGainEnable; /* MPT DIG */ - RT_TIMER MPT_DIGTimer; + struct timer_list MPT_DIGTimer; /* for rate adaptive, in fact, 88c/92c fw will handle this */ u8 bUseRAMask; @@ -1194,10 +1194,10 @@ struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ /* */ /* ODM relative time. */ - RT_TIMER PathDivSwitchTimer; + struct timer_list PathDivSwitchTimer; /* 2011.09.27 add for Path Diversity */ - RT_TIMER CCKPathDiversityTimer; - RT_TIMER FastAntTrainingTimer; + struct timer_list CCKPathDiversityTimer; + struct timer_list FastAntTrainingTimer; /* ODM relative workitem. */ diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c index 41c33ae96c5a..de63e4a2932e 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c @@ -430,7 +430,7 @@ void ODM_PhyStatusQuery( /* */ /* */ -HAL_STATUS ODM_ConfigRFWithHeaderFile( +enum HAL_STATUS ODM_ConfigRFWithHeaderFile( struct DM_ODM_T * pDM_Odm, enum ODM_RF_Config_Type ConfigType, enum ODM_RF_RADIO_PATH_E eRFPath @@ -450,7 +450,7 @@ HAL_STATUS ODM_ConfigRFWithHeaderFile( return HAL_STATUS_SUCCESS; } -HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T * pDM_Odm) +enum HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T * pDM_Odm) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===>ODM_ConfigRFWithTxPwrTrackHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip")); @@ -464,7 +464,7 @@ HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T * pDM_Odm) return HAL_STATUS_SUCCESS; } -HAL_STATUS ODM_ConfigBBWithHeaderFile( +enum HAL_STATUS ODM_ConfigBBWithHeaderFile( struct DM_ODM_T * pDM_Odm, enum ODM_BB_Config_Type ConfigType ) { diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.h b/drivers/staging/rtl8723bs/hal/odm_HWConfig.h index cd8c51e6b4b5..d4d53839a3f9 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.h +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.h @@ -128,19 +128,19 @@ void ODM_PhyStatusQuery( struct odm_packet_info *pPktinfo ); -HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T * pDM_Odm); +enum HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T * pDM_Odm); -HAL_STATUS ODM_ConfigRFWithHeaderFile( +enum HAL_STATUS ODM_ConfigRFWithHeaderFile( struct DM_ODM_T * pDM_Odm, enum ODM_RF_Config_Type ConfigType, enum ODM_RF_RADIO_PATH_E eRFPath ); -HAL_STATUS ODM_ConfigBBWithHeaderFile( +enum HAL_STATUS ODM_ConfigBBWithHeaderFile( struct DM_ODM_T * pDM_Odm, enum ODM_BB_Config_Type ConfigType ); -HAL_STATUS ODM_ConfigFWWithHeaderFile( +enum HAL_STATUS ODM_ConfigFWWithHeaderFile( struct DM_ODM_T * pDM_Odm, enum ODM_FW_Config_Type ConfigType, u8 *pFirmware, diff --git a/drivers/staging/rtl8723bs/hal/odm_types.h b/drivers/staging/rtl8723bs/hal/odm_types.h index c79fc1813c3f..72c7e971ac96 100644 --- a/drivers/staging/rtl8723bs/hal/odm_types.h +++ b/drivers/staging/rtl8723bs/hal/odm_types.h @@ -15,7 +15,7 @@ #define GET_ODM(__padapter) ((PDM_ODM_T)(&((GET_HAL_DATA(__padapter))->odmpriv))) -typedef enum _HAL_STATUS { +enum HAL_STATUS { HAL_STATUS_SUCCESS, HAL_STATUS_FAILURE, /*RT_STATUS_PENDING, @@ -24,13 +24,13 @@ typedef enum _HAL_STATUS { RT_STATUS_INVALID_PARAMETER, RT_STATUS_NOT_SUPPORT, RT_STATUS_OS_API_FAILED,*/ -} HAL_STATUS, *PHAL_STATUS; +}; /* */ /* Declare for ODM spin lock definition temporarily from compile pass. */ /* */ -typedef enum _RT_SPINLOCK_TYPE { +enum RT_SPINLOCK_TYPE { RT_TX_SPINLOCK = 1, RT_RX_SPINLOCK = 2, RT_RM_SPINLOCK = 3, @@ -66,7 +66,7 @@ typedef enum _RT_SPINLOCK_TYPE { RT_PENDED_OID_SPINLOCK = 39, RT_CHNLLIST_SPINLOCK = 40, RT_INDIC_SPINLOCK = 41, /* protect indication */ -} RT_SPINLOCK_TYPE; +}; #if defined(__LITTLE_ENDIAN) #define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE @@ -74,8 +74,6 @@ typedef enum _RT_SPINLOCK_TYPE { #define ODM_ENDIAN_TYPE ODM_ENDIAN_BIG #endif - typedef struct timer_list RT_TIMER, *PRT_TIMER; - typedef void *RT_TIMER_CALL_BACK; #define STA_INFO_T struct sta_info #define PSTA_INFO_T struct sta_info * -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:15 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:15 +0100 Subject: [PATCH 10/33] staging: rtl8723bs: remove typedefs in rtw_eeprom.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-11-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #45: FILE: include/rtw_eeprom.h:45: +typedef enum _RT_CUSTOMER_ID { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtw_eeprom.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_eeprom.h b/drivers/staging/rtl8723bs/include/rtw_eeprom.h index 78f34f6cebb4..fb619e83217a 100644 --- a/drivers/staging/rtl8723bs/include/rtw_eeprom.h +++ b/drivers/staging/rtl8723bs/include/rtw_eeprom.h @@ -42,7 +42,7 @@ /* Besides, CustomerID of registry has precedence of that of EEPROM. */ /* defined below. 060703, by rcnjko. */ /* */ -typedef enum _RT_CUSTOMER_ID { +enum RT_CUSTOMER_ID { RT_CID_DEFAULT = 0, RT_CID_8187_ALPHA0 = 1, RT_CID_8187_SERCOMM_PS = 2, @@ -90,7 +90,7 @@ typedef enum _RT_CUSTOMER_ID { RT_CID_819x_ALPHA_Dlink = 44,/* add by ylb 20121012 for customer led for alpha */ RT_CID_WNC_NEC = 45,/* add by page for NEC */ RT_CID_DNI_BUFFALO = 46,/* add by page for NEC */ -} RT_CUSTOMER_ID, *PRT_CUSTOMER_ID; +}; struct eeprom_priv { u8 bautoload_fail_flag; -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:08 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:08 +0100 Subject: [PATCH 03/33] staging: rtl8723bs: remove typedefs in odm.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-4-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #95: FILE: hal/odm.h:95: +typedef struct _Rate_Adaptive_Table_ { WARNING: do not add new typedefs #99: FILE: hal/odm.h:99: +typedef struct _RX_High_Power_ { WARNING: do not add new typedefs #129: FILE: hal/odm.h:129: +typedef struct _SW_Antenna_Switch_ { WARNING: do not add new typedefs #181: FILE: hal/odm.h:181: +typedef struct _ODM_RATE_ADAPTIVE { WARNING: do not add new typedefs #280: FILE: hal/odm.h:280: +typedef enum tag_Dynamic_ODM_Support_Ability_Type { WARNING: do not add new typedefs #300: FILE: hal/odm.h:300: +typedef struct _ODM_STA_INFO { WARNING: do not add new typedefs #328: FILE: hal/odm.h:328: +typedef enum _ODM_Common_Info_Definition { WARNING: do not add new typedefs #418: FILE: hal/odm.h:418: +typedef enum _ODM_Support_Ability_Definition { WARNING: do not add new typedefs #449: FILE: hal/odm.h:449: +typedef enum tag_ODM_Support_Interface_Definition { WARNING: do not add new typedefs #455: FILE: hal/odm.h:455: +typedef enum tag_ODM_Support_IC_Type_Definition { WARNING: do not add new typedefs #460: FILE: hal/odm.h:460: +typedef enum tag_ODM_Cut_Version_Definition { WARNING: do not add new typedefs #475: FILE: hal/odm.h:475: +typedef enum tag_ODM_Fab_Version_Definition { WARNING: do not add new typedefs #484: FILE: hal/odm.h:484: +typedef enum tag_ODM_RF_Path_Bit_Definition { WARNING: do not add new typedefs #495: FILE: hal/odm.h:495: +typedef enum tag_ODM_RF_Type_Definition { WARNING: do not add new typedefs #516: FILE: hal/odm.h:516: +typedef enum tag_ODM_MAC_PHY_Mode_Definition { WARNING: do not add new typedefs #522: FILE: hal/odm.h:522: +typedef enum tag_BT_Coexist_Definition { WARNING: do not add new typedefs #530: FILE: hal/odm.h:530: +typedef enum tag_Operation_Mode_Definition { WARNING: do not add new typedefs #543: FILE: hal/odm.h:543: +typedef enum tag_Wireless_Mode_Definition { WARNING: do not add new typedefs #555: FILE: hal/odm.h:555: +typedef enum tag_Band_Type_Definition { WARNING: do not add new typedefs #563: FILE: hal/odm.h:563: +typedef enum tag_Secondary_Channel_Offset_Definition { WARNING: do not add new typedefs #570: FILE: hal/odm.h:570: +typedef enum tag_Security_Definition { WARNING: do not add new typedefs #582: FILE: hal/odm.h:582: +typedef enum tag_Bandwidth_Definition { WARNING: do not add new typedefs #593: FILE: hal/odm.h:593: +typedef enum tag_Board_Definition { WARNING: do not add new typedefs #605: FILE: hal/odm.h:605: +typedef enum tag_ODM_Package_Definition { WARNING: do not add new typedefs #612: FILE: hal/odm.h:612: +typedef enum tag_ODM_TYPE_GPA_Definition { WARNING: do not add new typedefs #617: FILE: hal/odm.h:617: +typedef enum tag_ODM_TYPE_APA_Definition { WARNING: do not add new typedefs #622: FILE: hal/odm.h:622: +typedef enum tag_ODM_TYPE_GLNA_Definition { WARNING: do not add new typedefs #629: FILE: hal/odm.h:629: +typedef enum tag_ODM_TYPE_ALNA_Definition { WARNING: do not add new typedefs #637: FILE: hal/odm.h:637: +typedef enum tag_CCA_Path { WARNING: do not add new typedefs #643: FILE: hal/odm.h:643: +typedef struct _ODM_RA_Info_ { WARNING: do not add new typedefs #675: FILE: hal/odm.h:675: +typedef struct _IQK_MATRIX_REGS_SETTING { WARNING: do not add new typedefs #683: FILE: hal/odm.h:683: +typedef struct ODM_RF_Calibration_Structure { WARNING: do not add new typedefs #788: FILE: hal/odm.h:788: +typedef struct _FAST_ANTENNA_TRAINNING_ { WARNING: do not add new typedefs #828: FILE: hal/odm.h:828: +typedef enum _FAT_STATE { WARNING: do not add new typedefs #833: FILE: hal/odm.h:833: +typedef enum _ANT_DIV_TYPE { WARNING: do not add new typedefs #843: FILE: hal/odm.h:843: +typedef struct _ODM_PATH_DIVERSITY_ { WARNING: do not add new typedefs #852: FILE: hal/odm.h:852: +typedef enum _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE { WARNING: do not add new typedefs #860: FILE: hal/odm.h:860: +typedef struct _ANT_DETECTED_INFO { WARNING: do not add new typedefs #870: FILE: hal/odm.h:870: +typedef struct DM_Out_Source_Dynamic_Mechanism_Structure { WARNING: do not add new typedefs #1229: FILE: hal/odm.h:1229: + typedef enum _ODM_RF_CONTENT { WARNING: do not add new typedefs #1236: FILE: hal/odm.h:1236: +typedef enum _ODM_BB_Config_Type { WARNING: do not add new typedefs #1246: FILE: hal/odm.h:1246: +typedef enum _ODM_RF_Config_Type { WARNING: do not add new typedefs #1251: FILE: hal/odm.h:1251: +typedef enum _ODM_FW_Config_Type { WARNING: do not add new typedefs #1262: FILE: hal/odm.h:1262: +typedef enum _RT_STATUS { WARNING: do not add new typedefs #1319: FILE: hal/odm.h:1319: +typedef enum tag_1R_CCA_Type_Definition { WARNING: do not add new typedefs #1325: FILE: hal/odm.h:1325: +typedef enum tag_RF_Type_Definition { WARNING: do not add new typedefs #1334: FILE: hal/odm.h:1334: +typedef enum tag_SW_Antenna_Switch_Definition { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/core/rtw_odm.c | 6 +- .../staging/rtl8723bs/hal/HalHWImg8723B_BB.c | 10 +- .../staging/rtl8723bs/hal/HalHWImg8723B_BB.h | 6 +- .../staging/rtl8723bs/hal/HalHWImg8723B_MAC.c | 6 +- .../staging/rtl8723bs/hal/HalHWImg8723B_MAC.h | 2 +- .../staging/rtl8723bs/hal/HalHWImg8723B_RF.c | 12 +- .../staging/rtl8723bs/hal/HalHWImg8723B_RF.h | 6 +- drivers/staging/rtl8723bs/hal/HalPhyRf.c | 6 +- drivers/staging/rtl8723bs/hal/HalPhyRf.h | 12 +- .../staging/rtl8723bs/hal/HalPhyRf_8723B.c | 52 ++-- .../staging/rtl8723bs/hal/HalPhyRf_8723B.h | 8 +- drivers/staging/rtl8723bs/hal/hal_com.c | 10 +- .../staging/rtl8723bs/hal/hal_com_phycfg.c | 6 +- drivers/staging/rtl8723bs/hal/odm.c | 100 +++---- drivers/staging/rtl8723bs/hal/odm.h | 246 +++++++++--------- .../staging/rtl8723bs/hal/odm_CfoTracking.c | 16 +- drivers/staging/rtl8723bs/hal/odm_DIG.c | 40 +-- .../rtl8723bs/hal/odm_DynamicBBPowerSaving.c | 4 +- .../rtl8723bs/hal/odm_DynamicTxPower.c | 2 +- .../rtl8723bs/hal/odm_EdcaTurboCheck.c | 6 +- drivers/staging/rtl8723bs/hal/odm_HWConfig.c | 20 +- drivers/staging/rtl8723bs/hal/odm_HWConfig.h | 18 +- .../staging/rtl8723bs/hal/odm_NoiseMonitor.c | 2 +- drivers/staging/rtl8723bs/hal/odm_PathDiv.c | 4 +- .../rtl8723bs/hal/odm_RegConfig8723B.c | 16 +- .../rtl8723bs/hal/odm_RegConfig8723B.h | 16 +- drivers/staging/rtl8723bs/hal/odm_debug.c | 2 +- drivers/staging/rtl8723bs/hal/odm_debug.h | 2 +- drivers/staging/rtl8723bs/hal/rtl8723b_dm.c | 10 +- .../staging/rtl8723bs/hal/rtl8723b_phycfg.c | 4 +- drivers/staging/rtl8723bs/include/hal_data.h | 2 +- 31 files changed, 326 insertions(+), 326 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_odm.c b/drivers/staging/rtl8723bs/core/rtw_odm.c index 93e8f17d2574..87fed69e64d7 100644 --- a/drivers/staging/rtl8723bs/core/rtw_odm.c +++ b/drivers/staging/rtl8723bs/core/rtw_odm.c @@ -152,7 +152,7 @@ inline void rtw_odm_ability_set(struct adapter *adapter, u32 ability) void rtw_odm_adaptivity_parm_msg(void *sel, struct adapter *adapter) { struct hal_com_data *pHalData = GET_HAL_DATA(adapter); - DM_ODM_T *odm = &pHalData->odmpriv; + struct DM_ODM_T *odm = &pHalData->odmpriv; DBG_871X_SEL_NL(sel, "%10s %16s %8s %10s %11s %14s\n", "TH_L2H_ini", "TH_EDCCA_HL_diff", "IGI_Base", @@ -173,7 +173,7 @@ void rtw_odm_adaptivity_parm_set(struct adapter *adapter, s8 TH_L2H_ini, u8 IGI_LowerBound) { struct hal_com_data *pHalData = GET_HAL_DATA(adapter); - DM_ODM_T *odm = &pHalData->odmpriv; + struct DM_ODM_T *odm = &pHalData->odmpriv; odm->TH_L2H_ini = TH_L2H_ini; odm->TH_EDCCA_HL_diff = TH_EDCCA_HL_diff; @@ -186,7 +186,7 @@ void rtw_odm_adaptivity_parm_set(struct adapter *adapter, s8 TH_L2H_ini, void rtw_odm_get_perpkt_rssi(void *sel, struct adapter *adapter) { struct hal_com_data *hal_data = GET_HAL_DATA(adapter); - DM_ODM_T *odm = &hal_data->odmpriv; + struct DM_ODM_T *odm = &hal_data->odmpriv; DBG_871X_SEL_NL(sel, "RxRate = %s, RSSI_A = %d(%%), RSSI_B = %d(%%)\n", HDATA_RATE(odm->RxRate), odm->RSSI_A, odm->RSSI_B); diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c index 19856e806b1f..a31ab66941ac 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c @@ -9,7 +9,7 @@ #include "odm_precomp.h" static bool CheckPositive( - PDM_ODM_T pDM_Odm, const u32 Condition1, const u32 Condition2 + struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 ) { u8 _BoardType = @@ -112,7 +112,7 @@ static bool CheckPositive( } static bool CheckNegative( - PDM_ODM_T pDM_Odm, const u32 Condition1, const u32 Condition2 + struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 ) { return true; @@ -257,7 +257,7 @@ static u32 Array_MP_8723B_AGC_TAB[] = { }; -void ODM_ReadAndConfig_MP_8723B_AGC_TAB(PDM_ODM_T pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_AGC_TAB(struct DM_ODM_T * pDM_Odm) { u32 i = 0; u32 ArrayLen = ARRAY_SIZE(Array_MP_8723B_AGC_TAB); @@ -526,7 +526,7 @@ static u32 Array_MP_8723B_PHY_REG[] = { }; -void ODM_ReadAndConfig_MP_8723B_PHY_REG(PDM_ODM_T pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_PHY_REG(struct DM_ODM_T * pDM_Odm) { u32 i = 0; u32 ArrayLen = ARRAY_SIZE(Array_MP_8723B_PHY_REG); @@ -606,7 +606,7 @@ static u32 Array_MP_8723B_PHY_REG_PG[] = { 0, 0, 0, 0x00000e14, 0xffffffff, 0x26303436 }; -void ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(PDM_ODM_T pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(struct DM_ODM_T * pDM_Odm) { u32 i = 0; u32 *Array = Array_MP_8723B_PHY_REG_PG; diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.h b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.h index c1fbe91cd4f3..69485ce3a408 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.h +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.h @@ -15,7 +15,7 @@ void ODM_ReadAndConfig_MP_8723B_AGC_TAB(/* TC: Test Chip, MP: MP Chip */ - PDM_ODM_T pDM_Odm + struct DM_ODM_T * pDM_Odm ); /****************************************************************************** @@ -24,7 +24,7 @@ ODM_ReadAndConfig_MP_8723B_AGC_TAB(/* TC: Test Chip, MP: MP Chip */ void ODM_ReadAndConfig_MP_8723B_PHY_REG(/* TC: Test Chip, MP: MP Chip */ - PDM_ODM_T pDM_Odm + struct DM_ODM_T * pDM_Odm ); /****************************************************************************** @@ -33,7 +33,7 @@ ODM_ReadAndConfig_MP_8723B_PHY_REG(/* TC: Test Chip, MP: MP Chip */ void ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(/* TC: Test Chip, MP: MP Chip */ - PDM_ODM_T pDM_Odm + struct DM_ODM_T * pDM_Odm ); u32 ODM_GetVersion_MP_8723B_PHY_REG_PG(void); diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c index b80c5b11796b..3408dee976a1 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c @@ -9,7 +9,7 @@ #include "odm_precomp.h" static bool CheckPositive( - PDM_ODM_T pDM_Odm, const u32 Condition1, const u32 Condition2 + struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 ) { u8 _BoardType = @@ -111,7 +111,7 @@ static bool CheckPositive( } static bool CheckNegative( - PDM_ODM_T pDM_Odm, const u32 Condition1, const u32 Condition2 + struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 ) { return true; @@ -228,7 +228,7 @@ static u32 Array_MP_8723B_MAC_REG[] = { }; -void ODM_ReadAndConfig_MP_8723B_MAC_REG(PDM_ODM_T pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_MAC_REG(struct DM_ODM_T * pDM_Odm) { u32 i = 0; u32 ArrayLen = ARRAY_SIZE(Array_MP_8723B_MAC_REG); diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.h b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.h index 788fdca1337b..de7502232b7a 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.h +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.h @@ -15,6 +15,6 @@ void ODM_ReadAndConfig_MP_8723B_MAC_REG(/* TC: Test Chip, MP: MP Chip */ - PDM_ODM_T pDM_Odm + struct DM_ODM_T * pDM_Odm ); #endif diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c index 426f68b8f0d2..963a08fc9032 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c @@ -9,7 +9,7 @@ #include "odm_precomp.h" static bool CheckPositive( - PDM_ODM_T pDM_Odm, const u32 Condition1, const u32 Condition2 + struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 ) { u8 _BoardType = @@ -121,7 +121,7 @@ static bool CheckPositive( } static bool CheckNegative( - PDM_ODM_T pDM_Odm, const u32 Condition1, const u32 Condition2 + struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 ) { return true; @@ -259,7 +259,7 @@ static u32 Array_MP_8723B_RadioA[] = { }; -void ODM_ReadAndConfig_MP_8723B_RadioA(PDM_ODM_T pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_RadioA(struct DM_ODM_T * pDM_Odm) { u32 i = 0; u32 ArrayLen = ARRAY_SIZE(Array_MP_8723B_RadioA); @@ -420,9 +420,9 @@ static u8 gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_SDIO_8723B[] = { 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15 }; -void ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO(PDM_ODM_T pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO(struct DM_ODM_T * pDM_Odm) { - PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); ODM_RT_TRACE( pDM_Odm, @@ -755,7 +755,7 @@ static u8 *Array_MP_8723B_TXPWR_LMT[] = { "MKK", "2.4G", "40M", "HT", "2T", "14", "63" }; -void ODM_ReadAndConfig_MP_8723B_TXPWR_LMT(PDM_ODM_T pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_TXPWR_LMT(struct DM_ODM_T * pDM_Odm) { u32 i = 0; u8 **Array = Array_MP_8723B_TXPWR_LMT; diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.h b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.h index 36a47437f974..9f86f199d4fd 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.h +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.h @@ -15,7 +15,7 @@ void ODM_ReadAndConfig_MP_8723B_RadioA(/* TC: Test Chip, MP: MP Chip */ - PDM_ODM_T pDM_Odm + struct DM_ODM_T * pDM_Odm ); /****************************************************************************** @@ -24,7 +24,7 @@ ODM_ReadAndConfig_MP_8723B_RadioA(/* TC: Test Chip, MP: MP Chip */ void ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO(/* TC: Test Chip, MP: MP Chip */ - PDM_ODM_T pDM_Odm + struct DM_ODM_T * pDM_Odm ); u32 ODM_GetVersion_MP_8723B_TxPowerTrack_SDIO(void); @@ -34,7 +34,7 @@ u32 ODM_GetVersion_MP_8723B_TxPowerTrack_SDIO(void); void ODM_ReadAndConfig_MP_8723B_TXPWR_LMT(/* TC: Test Chip, MP: MP Chip */ - PDM_ODM_T pDM_Odm + struct DM_ODM_T * pDM_Odm ); u32 ODM_GetVersion_MP_8723B_TXPWR_LMT(void); diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf.c b/drivers/staging/rtl8723bs/hal/HalPhyRf.c index 491bf735c6f1..80ae4d0933f4 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf.c +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf.c @@ -23,7 +23,7 @@ } while (0) -void ConfigureTxpowerTrack(PDM_ODM_T pDM_Odm, struct TXPWRTRACK_CFG * pConfig) +void ConfigureTxpowerTrack(struct DM_ODM_T * pDM_Odm, struct TXPWRTRACK_CFG * pConfig) { ConfigureTxpowerTrack_8723B(pConfig); } @@ -36,7 +36,7 @@ void ConfigureTxpowerTrack(PDM_ODM_T pDM_Odm, struct TXPWRTRACK_CFG * pConfig) /* NOTE: If Tx BB swing or Tx scaling is varified during run-time, still */ /* need to call this function. */ /* */ -void ODM_ClearTxPowerTrackingState(PDM_ODM_T pDM_Odm) +void ODM_ClearTxPowerTrackingState(struct DM_ODM_T * pDM_Odm) { struct hal_com_data *pHalData = GET_HAL_DATA(pDM_Odm->Adapter); u8 p = 0; @@ -74,7 +74,7 @@ void ODM_TXPowerTrackingCallback_ThermalMeter(struct adapter *Adapter) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; u8 ThermalValue = 0, delta, delta_LCK, delta_IQK, p = 0, i = 0; u8 ThermalValue_AVG_count = 0; diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf.h b/drivers/staging/rtl8723bs/hal/HalPhyRf.h index 5adccb981845..93659222d678 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf.h +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf.h @@ -19,10 +19,10 @@ enum PWRTRACK_METHOD { MIX_MODE }; -typedef void (*FuncSetPwr)(PDM_ODM_T, enum PWRTRACK_METHOD, u8, u8); -typedef void (*FuncIQK)(PDM_ODM_T, u8, u8, u8); -typedef void (*FuncLCK)(PDM_ODM_T); -typedef void (*FuncSwing)(PDM_ODM_T, u8 **, u8 **, u8 **, u8 **); +typedef void (*FuncSetPwr)(struct DM_ODM_T *, enum PWRTRACK_METHOD, u8, u8); +typedef void (*FuncIQK)(struct DM_ODM_T *, u8, u8, u8); +typedef void (*FuncLCK)(struct DM_ODM_T *); +typedef void (*FuncSwing)(struct DM_ODM_T *, u8 **, u8 **, u8 **, u8 **); struct TXPWRTRACK_CFG { u8 SwingTableSize_CCK; @@ -37,10 +37,10 @@ struct TXPWRTRACK_CFG { FuncSwing GetDeltaSwingTable; }; -void ConfigureTxpowerTrack(PDM_ODM_T pDM_Odm, struct TXPWRTRACK_CFG * pConfig); +void ConfigureTxpowerTrack(struct DM_ODM_T * pDM_Odm, struct TXPWRTRACK_CFG * pConfig); -void ODM_ClearTxPowerTrackingState(PDM_ODM_T pDM_Odm); +void ODM_ClearTxPowerTrackingState(struct DM_ODM_T * pDM_Odm); void ODM_TXPowerTrackingCallback_ThermalMeter(struct adapter *Adapter); diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c index d8b3b2095544..dfff2bb56b63 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c @@ -54,7 +54,7 @@ static u8 DeltaSwingTableIdx_2GA_P_8188E[] = { static void setIqkMatrix_8723B( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, u8 OFDM_index, u8 RFPath, s32 IqkResult_X, @@ -135,7 +135,7 @@ static void setIqkMatrix_8723B( } -static void setCCKFilterCoefficient(PDM_ODM_T pDM_Odm, u8 CCKSwingIndex) +static void setCCKFilterCoefficient(struct DM_ODM_T * pDM_Odm, u8 CCKSwingIndex) { if (!pDM_Odm->RFCalibrateInfo.bCCKinCH14) { rtw_write8(pDM_Odm->Adapter, 0xa22, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][0]); @@ -159,7 +159,7 @@ static void setCCKFilterCoefficient(PDM_ODM_T pDM_Odm, u8 CCKSwingIndex) } void DoIQK_8723B( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, u8 DeltaThermalIndex, u8 ThermalValue, u8 Threshold @@ -185,7 +185,7 @@ void DoIQK_8723B( * *---------------------------------------------------------------------------*/ void ODM_TxPwrTrackSetPwr_8723B( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, enum PWRTRACK_METHOD Method, u8 RFPath, u8 ChannelMappedIndex @@ -360,7 +360,7 @@ void ODM_TxPwrTrackSetPwr_8723B( } static void GetDeltaSwingTable_8723B( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, u8 **TemperatureUP_A, u8 **TemperatureDOWN_A, u8 **TemperatureUP_B, @@ -368,7 +368,7 @@ static void GetDeltaSwingTable_8723B( ) { struct adapter *Adapter = pDM_Odm->Adapter; - PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); u16 rate = *(pDM_Odm->pForcedDataRate); u8 channel = pHalData->CurrentChannel; @@ -437,7 +437,7 @@ static u8 phy_PathA_IQK_8723B( u8 result = 0x00; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; /* Save RF Path */ Path_SEL_BB = PHY_QueryBBReg(pDM_Odm->Adapter, 0x948, bMaskDWord); @@ -548,7 +548,7 @@ static u8 phy_PathA_RxIQK8723B( u32 regEAC, regE94, regE9C, regEA4, u4tmp, tmp, Path_SEL_BB; u8 result = 0x00; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; /* ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK!\n")); */ @@ -762,7 +762,7 @@ static u8 phy_PathB_IQK_8723B(struct adapter *padapter) u32 regEAC, regE94, regE9C, tmp, Path_SEL_BB/*, regEC4, regECC, Path_SEL_BB*/; u8 result = 0x00; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK!\n")); @@ -869,7 +869,7 @@ static u8 phy_PathB_RxIQK8723B(struct adapter *padapter, bool configPathB) u32 regE94, regE9C, regEA4, regEAC, u4tmp, tmp, Path_SEL_BB; u8 result = 0x00; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; /* ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B Rx IQK!\n")); */ @@ -1092,9 +1092,9 @@ static void _PHY_PathAFillIQKMatrix8723B( u32 Oldval_0, X, TX0_A, reg; s32 Y, TX0_C; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; - PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQ Calibration %s !\n", (bIQKOK)?"Success":"Failed")); @@ -1172,9 +1172,9 @@ static void _PHY_PathBFillIQKMatrix8723B( u32 Oldval_1, X, TX1_A, reg; s32 Y, TX1_C; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; - PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQ Calibration %s !\n", (bIQKOK)?"Success":"Failed")); @@ -1247,10 +1247,10 @@ static void _PHY_PathBFillIQKMatrix8723B( /* */ /* MP Already declare in odm.c */ -void ODM_SetIQCbyRFpath(PDM_ODM_T pDM_Odm, u32 RFpath) +void ODM_SetIQCbyRFpath(struct DM_ODM_T * pDM_Odm, u32 RFpath) { - PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); if ( (pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC80][VAL] != 0x0) && @@ -1292,7 +1292,7 @@ static void _PHY_SaveADDARegisters8723B( { u32 i; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; if (!ODM_CheckPowerStatus(padapter)) return; @@ -1310,7 +1310,7 @@ static void _PHY_SaveMACRegisters8723B( { u32 i; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Save MAC parameters.\n")); for (i = 0 ; i < (IQK_MAC_REG_NUM - 1); i++) { @@ -1330,7 +1330,7 @@ static void _PHY_ReloadADDARegisters8723B( { u32 i; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Reload ADDA power saving parameters !\n")); for (i = 0 ; i < RegiesterNum; i++) { @@ -1360,7 +1360,7 @@ static void _PHY_PathADDAOn8723B( u32 pathOn; u32 i; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("ADDA ON.\n")); @@ -1384,7 +1384,7 @@ static void _PHY_MACSettingCalibration8723B( { u32 i = 0; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("MAC settings for Calibration.\n")); @@ -1489,7 +1489,7 @@ static void phy_IQCalibrate_8723B( ) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; u32 i; u8 PathAOK, PathBOK; @@ -1697,7 +1697,7 @@ static void phy_IQCalibrate_8723B( } -static void phy_LCCalibrate_8723B(PDM_ODM_T pDM_Odm, bool is2T) +static void phy_LCCalibrate_8723B(struct DM_ODM_T * pDM_Odm, bool is2T) { u8 tmpReg; u32 RF_Amode = 0, RF_Bmode = 0, LC_Cal; @@ -1784,7 +1784,7 @@ void PHY_IQCalibrate_8723B( { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; s32 result[4][8]; /* last is final result */ u8 i, final_candidate; @@ -1830,7 +1830,7 @@ void PHY_IQCalibrate_8723B( if (bRestore) { u32 offset, data; u8 path, bResult = SUCCESS; - PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); path = (PHY_QueryBBReg(pDM_Odm->Adapter, rS0S1_PathSwitch, bMaskByte0) == 0x00) ? ODM_RF_PATH_A : ODM_RF_PATH_B; @@ -2038,7 +2038,7 @@ void PHY_IQCalibrate_8723B( } -void PHY_LCCalibrate_8723B(PDM_ODM_T pDM_Odm) +void PHY_LCCalibrate_8723B(struct DM_ODM_T * pDM_Odm) { bool bSingleTone = false, bCarrierSuppression = false; u32 timeout = 2000, timecount = 0; diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h index c61d39acb6a4..80cb446db5fa 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h @@ -19,14 +19,14 @@ void ConfigureTxpowerTrack_8723B(struct TXPWRTRACK_CFG * pConfig); void DoIQK_8723B( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, u8 DeltaThermalIndex, u8 ThermalValue, u8 Threshold ); void ODM_TxPwrTrackSetPwr_8723B( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, enum PWRTRACK_METHOD Method, u8 RFPath, u8 ChannelMappedIndex @@ -41,12 +41,12 @@ void PHY_IQCalibrate_8723B( u8 RF_Path ); -void ODM_SetIQCbyRFpath(PDM_ODM_T pDM_Odm, u32 RFpath); +void ODM_SetIQCbyRFpath(struct DM_ODM_T * pDM_Odm, u32 RFpath); /* */ /* LC calibrate */ /* */ -void PHY_LCCalibrate_8723B(PDM_ODM_T pDM_Odm); +void PHY_LCCalibrate_8723B(struct DM_ODM_T * pDM_Odm); /* */ /* AP calibrate */ diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 173ccaba2537..34b8354dbc03 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -1008,7 +1008,7 @@ void hw_var_port_switch(struct adapter *adapter) void SetHwReg(struct adapter *adapter, u8 variable, u8 *val) { struct hal_com_data *hal_data = GET_HAL_DATA(adapter); - DM_ODM_T *odm = &(hal_data->odmpriv); + struct DM_ODM_T *odm = &(hal_data->odmpriv); switch (variable) { case HW_VAR_PORT_SWITCH: @@ -1088,7 +1088,7 @@ void SetHwReg(struct adapter *adapter, u8 variable, u8 *val) void GetHwReg(struct adapter *adapter, u8 variable, u8 *val) { struct hal_com_data *hal_data = GET_HAL_DATA(adapter); - DM_ODM_T *odm = &(hal_data->odmpriv); + struct DM_ODM_T *odm = &(hal_data->odmpriv); switch (variable) { case HW_VAR_BASIC_RATE: @@ -1119,7 +1119,7 @@ u8 SetHalDefVar( ) { struct hal_com_data *hal_data = GET_HAL_DATA(adapter); - DM_ODM_T *odm = &(hal_data->odmpriv); + struct DM_ODM_T *odm = &(hal_data->odmpriv); u8 bResult = _SUCCESS; switch (variable) { @@ -1204,7 +1204,7 @@ u8 GetHalDefVar( ) { struct hal_com_data *hal_data = GET_HAL_DATA(adapter); - DM_ODM_T *odm = &(hal_data->odmpriv); + struct DM_ODM_T *odm = &(hal_data->odmpriv); u8 bResult = _SUCCESS; switch (variable) { @@ -1289,7 +1289,7 @@ void SetHalODMVar( ) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T podmpriv = &pHalData->odmpriv; + struct DM_ODM_T * podmpriv = &pHalData->odmpriv; /* _irqL irqL; */ switch (eVariable) { case HAL_ODM_STA_INFO: diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 10250642d30a..2bf4689dc08e 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -270,7 +270,7 @@ u8 PHY_GetRateSectionIndexOfTxPowerByRate( ) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; u8 index = 0; if (pDM_Odm->PhyRegPgVersion == 0) { @@ -795,7 +795,7 @@ void PHY_StoreTxPowerByRate( ) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; if (pDM_Odm->PhyRegPgVersion > 0) PHY_StoreTxPowerByRateNew(padapter, Band, RfPath, TxNum, RegAddr, BitMask, Data); @@ -1188,7 +1188,7 @@ u8 PHY_GetTxPowerIndexBase( s8 PHY_GetTxPowerTrackingOffset(struct adapter *padapter, u8 RFPath, u8 Rate) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; s8 offset = 0; if (pDM_Odm->RFCalibrateInfo.TxPowerTrackControl == false) diff --git a/drivers/staging/rtl8723bs/hal/odm.c b/drivers/staging/rtl8723bs/hal/odm.c index 5e432f1bc150..4c8f86fd22a3 100644 --- a/drivers/staging/rtl8723bs/hal/odm.c +++ b/drivers/staging/rtl8723bs/hal/odm.c @@ -282,13 +282,13 @@ u32 TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE] = { /* Local Function predefine. */ /* START------------COMMON INFO RELATED--------------- */ -void odm_CommonInfoSelfInit(PDM_ODM_T pDM_Odm); +void odm_CommonInfoSelfInit(struct DM_ODM_T * pDM_Odm); -void odm_CommonInfoSelfUpdate(PDM_ODM_T pDM_Odm); +void odm_CommonInfoSelfUpdate(struct DM_ODM_T * pDM_Odm); -void odm_CmnInfoInit_Debug(PDM_ODM_T pDM_Odm); +void odm_CmnInfoInit_Debug(struct DM_ODM_T * pDM_Odm); -void odm_BasicDbgMessage(PDM_ODM_T pDM_Odm); +void odm_BasicDbgMessage(struct DM_ODM_T * pDM_Odm); /* END------------COMMON INFO RELATED--------------- */ @@ -302,17 +302,17 @@ void odm_BasicDbgMessage(PDM_ODM_T pDM_Odm); /* Remove BB power Saving by YuChen */ /* END---------BB POWER SAVE----------------------- */ -void odm_RefreshRateAdaptiveMaskCE(PDM_ODM_T pDM_Odm); +void odm_RefreshRateAdaptiveMaskCE(struct DM_ODM_T * pDM_Odm); /* Remove by YuChen */ -void odm_RSSIMonitorInit(PDM_ODM_T pDM_Odm); +void odm_RSSIMonitorInit(struct DM_ODM_T * pDM_Odm); -void odm_RSSIMonitorCheckCE(PDM_ODM_T pDM_Odm); +void odm_RSSIMonitorCheckCE(struct DM_ODM_T * pDM_Odm); -void odm_RSSIMonitorCheck(PDM_ODM_T pDM_Odm); +void odm_RSSIMonitorCheck(struct DM_ODM_T * pDM_Odm); -void odm_SwAntDetectInit(PDM_ODM_T pDM_Odm); +void odm_SwAntDetectInit(struct DM_ODM_T * pDM_Odm); void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext); @@ -320,14 +320,14 @@ void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext); void odm_GlobalAdapterCheck(void); -void odm_RefreshRateAdaptiveMask(PDM_ODM_T pDM_Odm); +void odm_RefreshRateAdaptiveMask(struct DM_ODM_T * pDM_Odm); -void ODM_TXPowerTrackingCheck(PDM_ODM_T pDM_Odm); +void ODM_TXPowerTrackingCheck(struct DM_ODM_T * pDM_Odm); -void odm_RateAdaptiveMaskInit(PDM_ODM_T pDM_Odm); +void odm_RateAdaptiveMaskInit(struct DM_ODM_T * pDM_Odm); -void odm_TXPowerTrackingInit(PDM_ODM_T pDM_Odm); +void odm_TXPowerTrackingInit(struct DM_ODM_T * pDM_Odm); /* Remove Edca by Yu Chen */ @@ -335,10 +335,10 @@ void odm_TXPowerTrackingInit(PDM_ODM_T pDM_Odm); #define RxDefaultAnt1 0x65a9 #define RxDefaultAnt2 0x569a -void odm_InitHybridAntDiv(PDM_ODM_T pDM_Odm); +void odm_InitHybridAntDiv(struct DM_ODM_T * pDM_Odm); bool odm_StaDefAntSel( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, u32 OFDM_Ant1_Cnt, u32 OFDM_Ant2_Cnt, u32 CCK_Ant1_Cnt, @@ -346,11 +346,11 @@ bool odm_StaDefAntSel( u8 *pDefAnt ); -void odm_SetRxIdleAnt(PDM_ODM_T pDM_Odm, u8 Ant, bool bDualPath); +void odm_SetRxIdleAnt(struct DM_ODM_T * pDM_Odm, u8 Ant, bool bDualPath); -void odm_HwAntDiv(PDM_ODM_T pDM_Odm); +void odm_HwAntDiv(struct DM_ODM_T * pDM_Odm); /* */ @@ -360,7 +360,7 @@ void odm_HwAntDiv(PDM_ODM_T pDM_Odm); /* */ /* 2011/09/21 MH Add to describe different team necessary resource allocate?? */ /* */ -void ODM_DMInit(PDM_ODM_T pDM_Odm) +void ODM_DMInit(struct DM_ODM_T * pDM_Odm) { odm_CommonInfoSelfInit(pDM_Odm); @@ -390,7 +390,7 @@ void ODM_DMInit(PDM_ODM_T pDM_Odm) /* You can not add any dummy function here, be care, you can only use DM structure */ /* to perform any new ODM_DM. */ /* */ -void ODM_DMWatchdog(PDM_ODM_T pDM_Odm) +void ODM_DMWatchdog(struct DM_ODM_T * pDM_Odm) { odm_CommonInfoSelfUpdate(pDM_Odm); odm_BasicDbgMessage(pDM_Odm); @@ -445,7 +445,7 @@ void ODM_DMWatchdog(PDM_ODM_T pDM_Odm) /* */ /* Init /.. Fixed HW value. Only init time. */ /* */ -void ODM_CmnInfoInit(PDM_ODM_T pDM_Odm, ODM_CMNINFO_E CmnInfo, u32 Value) +void ODM_CmnInfoInit(struct DM_ODM_T * pDM_Odm, enum ODM_CMNINFO_E CmnInfo, u32 Value) { /* */ /* This section is used for init value */ @@ -519,16 +519,16 @@ void ODM_CmnInfoInit(PDM_ODM_T pDM_Odm, ODM_CMNINFO_E CmnInfo, u32 Value) break; case ODM_CMNINFO_GPA: - pDM_Odm->TypeGPA = (ODM_TYPE_GPA_E)Value; + pDM_Odm->TypeGPA = (enum ODM_TYPE_GPA_E)Value; break; case ODM_CMNINFO_APA: - pDM_Odm->TypeAPA = (ODM_TYPE_APA_E)Value; + pDM_Odm->TypeAPA = (enum ODM_TYPE_APA_E)Value; break; case ODM_CMNINFO_GLNA: - pDM_Odm->TypeGLNA = (ODM_TYPE_GLNA_E)Value; + pDM_Odm->TypeGLNA = (enum ODM_TYPE_GLNA_E)Value; break; case ODM_CMNINFO_ALNA: - pDM_Odm->TypeALNA = (ODM_TYPE_ALNA_E)Value; + pDM_Odm->TypeALNA = (enum ODM_TYPE_ALNA_E)Value; break; case ODM_CMNINFO_EXT_TRSW: @@ -557,7 +557,7 @@ void ODM_CmnInfoInit(PDM_ODM_T pDM_Odm, ODM_CMNINFO_E CmnInfo, u32 Value) } -void ODM_CmnInfoHook(PDM_ODM_T pDM_Odm, ODM_CMNINFO_E CmnInfo, void *pValue) +void ODM_CmnInfoHook(struct DM_ODM_T * pDM_Odm, enum ODM_CMNINFO_E CmnInfo, void *pValue) { /* */ /* Hook call by reference pointer. */ @@ -686,8 +686,8 @@ void ODM_CmnInfoHook(PDM_ODM_T pDM_Odm, ODM_CMNINFO_E CmnInfo, void *pValue) void ODM_CmnInfoPtrArrayHook( - PDM_ODM_T pDM_Odm, - ODM_CMNINFO_E CmnInfo, + struct DM_ODM_T * pDM_Odm, + enum ODM_CMNINFO_E CmnInfo, u16 Index, void *pValue ) @@ -714,7 +714,7 @@ void ODM_CmnInfoPtrArrayHook( /* */ /* Update Band/CHannel/.. The values are dynamic but non-per-packet. */ /* */ -void ODM_CmnInfoUpdate(PDM_ODM_T pDM_Odm, u32 CmnInfo, u64 Value) +void ODM_CmnInfoUpdate(struct DM_ODM_T * pDM_Odm, u32 CmnInfo, u64 Value) { /* */ /* This init variable may be changed in run time. */ @@ -828,7 +828,7 @@ void ODM_CmnInfoUpdate(PDM_ODM_T pDM_Odm, u32 CmnInfo, u64 Value) } -void odm_CommonInfoSelfInit(PDM_ODM_T pDM_Odm) +void odm_CommonInfoSelfInit(struct DM_ODM_T * pDM_Odm) { pDM_Odm->bCckHighPower = (bool) PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG(CCK_RPT_FORMAT, pDM_Odm), ODM_BIT(CCK_RPT_FORMAT, pDM_Odm)); pDM_Odm->RFPathRxEnable = (u8) PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG(BB_RX_PATH, pDM_Odm), ODM_BIT(BB_RX_PATH, pDM_Odm)); @@ -838,7 +838,7 @@ void odm_CommonInfoSelfInit(PDM_ODM_T pDM_Odm) pDM_Odm->TxRate = 0xFF; } -void odm_CommonInfoSelfUpdate(PDM_ODM_T pDM_Odm) +void odm_CommonInfoSelfUpdate(struct DM_ODM_T * pDM_Odm) { u8 EntryCnt = 0; u8 i; @@ -864,7 +864,7 @@ void odm_CommonInfoSelfUpdate(PDM_ODM_T pDM_Odm) pDM_Odm->bOneEntryOnly = false; } -void odm_CmnInfoInit_Debug(PDM_ODM_T pDM_Odm) +void odm_CmnInfoInit_Debug(struct DM_ODM_T * pDM_Odm) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_CmnInfoInit_Debug ==>\n")); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("SupportPlatform =%d\n", pDM_Odm->SupportPlatform)); @@ -885,7 +885,7 @@ void odm_CmnInfoInit_Debug(PDM_ODM_T pDM_Odm) } -void odm_BasicDbgMessage(PDM_ODM_T pDM_Odm) +void odm_BasicDbgMessage(struct DM_ODM_T * pDM_Odm) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_BasicDbgMsg ==>\n")); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("bLinked = %d, RSSI_Min = %d,\n", @@ -932,9 +932,9 @@ void odm_BasicDbgMessage(PDM_ODM_T pDM_Odm) /* 3 Rate Adaptive */ /* 3 ============================================================ */ -void odm_RateAdaptiveMaskInit(PDM_ODM_T pDM_Odm) +void odm_RateAdaptiveMaskInit(struct DM_ODM_T * pDM_Odm) { - PODM_RATE_ADAPTIVE pOdmRA = &pDM_Odm->RateAdaptive; + struct ODM_RATE_ADAPTIVE * pOdmRA = &pDM_Odm->RateAdaptive; pOdmRA->Type = DM_Type_ByDriver; if (pOdmRA->Type == DM_Type_ByDriver) @@ -950,7 +950,7 @@ void odm_RateAdaptiveMaskInit(PDM_ODM_T pDM_Odm) } u32 ODM_Get_Rate_Bitmap( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, u32 macid, u32 ra_mask, u8 rssi_level @@ -1080,7 +1080,7 @@ u32 ODM_Get_Rate_Bitmap( * * -------------------------------------------------------------------------- */ -void odm_RefreshRateAdaptiveMask(PDM_ODM_T pDM_Odm) +void odm_RefreshRateAdaptiveMask(struct DM_ODM_T * pDM_Odm) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, ("odm_RefreshRateAdaptiveMask()---------->\n")); @@ -1091,7 +1091,7 @@ void odm_RefreshRateAdaptiveMask(PDM_ODM_T pDM_Odm) odm_RefreshRateAdaptiveMaskCE(pDM_Odm); } -void odm_RefreshRateAdaptiveMaskCE(PDM_ODM_T pDM_Odm) +void odm_RefreshRateAdaptiveMaskCE(struct DM_ODM_T * pDM_Odm) { u8 i; struct adapter *padapter = pDM_Odm->Adapter; @@ -1128,13 +1128,13 @@ void odm_RefreshRateAdaptiveMaskCE(PDM_ODM_T pDM_Odm) /* Return Value: bool */ /* - true: RATRState is changed. */ bool ODM_RAStateCheck( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, s32 RSSI, bool bForceUpdate, u8 *pRATRState ) { - PODM_RATE_ADAPTIVE pRA = &pDM_Odm->RateAdaptive; + struct ODM_RATE_ADAPTIVE * pRA = &pDM_Odm->RateAdaptive; const u8 GoUpGap = 5; u8 HighRSSIThreshForRA = pRA->HighRSSIThresh; u8 LowRSSIThreshForRA = pRA->LowRSSIThresh; @@ -1193,15 +1193,15 @@ bool ODM_RAStateCheck( /* 3 RSSI Monitor */ /* 3 ============================================================ */ -void odm_RSSIMonitorInit(PDM_ODM_T pDM_Odm) +void odm_RSSIMonitorInit(struct DM_ODM_T * pDM_Odm) { - pRA_T pRA_Table = &pDM_Odm->DM_RA_Table; + struct RA_T * pRA_Table = &pDM_Odm->DM_RA_Table; pRA_Table->firstconnect = false; } -void odm_RSSIMonitorCheck(PDM_ODM_T pDM_Odm) +void odm_RSSIMonitorCheck(struct DM_ODM_T * pDM_Odm) { if (!(pDM_Odm->SupportAbility & ODM_BB_RSSI_MONITOR)) return; @@ -1214,7 +1214,7 @@ static void FindMinimumRSSI(struct adapter *padapter) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; - PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + struct DM_ODM_T * pDM_Odm = &(pHalData->odmpriv); /* 1 1.Determine the minimum RSSI */ @@ -1231,7 +1231,7 @@ static void FindMinimumRSSI(struct adapter *padapter) /* ODM_RT_TRACE(pDM_Odm, COMP_DIG, DBG_LOUD, ("MinUndecoratedPWDBForDM =%d\n", pHalData->MinUndecoratedPWDBForDM)); */ } -void odm_RSSIMonitorCheckCE(PDM_ODM_T pDM_Odm) +void odm_RSSIMonitorCheckCE(struct DM_ODM_T * pDM_Odm) { struct adapter *Adapter = pDM_Odm->Adapter; struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); @@ -1240,7 +1240,7 @@ void odm_RSSIMonitorCheckCE(PDM_ODM_T pDM_Odm) int tmpEntryMaxPWDB = 0, tmpEntryMinPWDB = 0xff; u8 sta_cnt = 0; u32 PWDB_rssi[NUM_STA] = {0};/* 0~15]:MACID, [16~31]:PWDB_rssi */ - pRA_T pRA_Table = &pDM_Odm->DM_RA_Table; + struct RA_T * pRA_Table = &pDM_Odm->DM_RA_Table; if (pDM_Odm->bLinked != true) return; @@ -1303,7 +1303,7 @@ void odm_RSSIMonitorCheckCE(PDM_ODM_T pDM_Odm) /* 3 Tx Power Tracking */ /* 3 ============================================================ */ -static u8 getSwingIndex(PDM_ODM_T pDM_Odm) +static u8 getSwingIndex(struct DM_ODM_T * pDM_Odm) { struct adapter *Adapter = pDM_Odm->Adapter; u8 i = 0; @@ -1327,7 +1327,7 @@ static u8 getSwingIndex(PDM_ODM_T pDM_Odm) return i; } -void odm_TXPowerTrackingInit(PDM_ODM_T pDM_Odm) +void odm_TXPowerTrackingInit(struct DM_ODM_T * pDM_Odm) { u8 defaultSwingIndex = getSwingIndex(pDM_Odm); u8 p = 0; @@ -1371,7 +1371,7 @@ void odm_TXPowerTrackingInit(PDM_ODM_T pDM_Odm) } -void ODM_TXPowerTrackingCheck(PDM_ODM_T pDM_Odm) +void ODM_TXPowerTrackingCheck(struct DM_ODM_T * pDM_Odm) { struct adapter *Adapter = pDM_Odm->Adapter; @@ -1395,9 +1395,9 @@ void ODM_TXPowerTrackingCheck(PDM_ODM_T pDM_Odm) /* 3 ============================================================ */ /* 3 SW Antenna Diversity */ /* 3 ============================================================ */ -void odm_SwAntDetectInit(PDM_ODM_T pDM_Odm) +void odm_SwAntDetectInit(struct DM_ODM_T * pDM_Odm) { - pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; + struct SWAT_T * pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; pDM_SWAT_Table->SWAS_NoLink_BK_Reg92c = rtw_read32(pDM_Odm->Adapter, rDPDT_control); pDM_SWAT_Table->PreAntenna = MAIN_ANT; diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h index 16e8f66a3171..494792162980 100644 --- a/drivers/staging/rtl8723bs/hal/odm.h +++ b/drivers/staging/rtl8723bs/hal/odm.h @@ -92,11 +92,11 @@ struct dynamic_primary_CCA { u8 MF_state; }; -typedef struct _Rate_Adaptive_Table_ { +struct RA_T { u8 firstconnect; -} RA_T, *pRA_T; +}; -typedef struct _RX_High_Power_ { +struct RXHP_T { u8 RXHP_flag; u8 PSD_func_trigger; u8 PSD_bitmap_RXHP[80]; @@ -108,7 +108,7 @@ typedef struct _RX_High_Power_ { bool RXHP_enable; u8 TP_Mode; RT_TIMER PSDTimer; -} RXHP_T, *pRXHP_T; +}; #define ASSOCIATE_ENTRY_NUM 32 /* Max size of AsocEntry[]. */ #define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM @@ -126,7 +126,7 @@ typedef struct _RX_High_Power_ { #define TRAFFIC_HIGH 1 #define TRAFFIC_UltraLOW 2 -typedef struct _SW_Antenna_Switch_ { +struct SWAT_T { /* _SW_Antenna_Switch_ */ u8 Double_chk_flag; u8 try_flag; s32 PreRSSI; @@ -173,12 +173,12 @@ typedef struct _SW_Antenna_Switch_ { RT_TIMER SwAntennaSwitchTimer_8723B; u32 PktCnt_SWAntDivByCtrlFrame; bool bSWAntDivByCtrlFrame; -} SWAT_T, *pSWAT_T; +}; /* Remove Edca by YuChen */ -typedef struct _ODM_RATE_ADAPTIVE { +struct ODM_RATE_ADAPTIVE { u8 Type; /* DM_Type_ByFW/DM_Type_ByDriver */ u8 LdpcThres; /* if RSSI > LdpcThres => switch from LPDC to BCC */ bool bUseLdpc; @@ -187,7 +187,7 @@ typedef struct _ODM_RATE_ADAPTIVE { u8 LowRSSIThresh; /* if RSSI <= LowRSSIThresh => RATRState is DM_RATR_STA_LOW */ u8 RATRState; /* Current RSSI level, DM_RATR_STA_HIGH/DM_RATR_STA_MIDDLE/DM_RATR_STA_LOW */ -} ODM_RATE_ADAPTIVE, *PODM_RATE_ADAPTIVE; +}; #define IQK_MAC_REG_NUM 4 #define IQK_ADDA_REG_NUM 16 @@ -277,7 +277,7 @@ struct odm_mac_status_info { u8 test; }; -typedef enum tag_Dynamic_ODM_Support_Ability_Type { +enum ODM_Ability_E { /* tag_Dynamic_ODM_Support_Ability_Type */ /* BB Team */ ODM_DIG = 0x00000001, ODM_HIGH_POWER = 0x00000002, @@ -291,13 +291,13 @@ typedef enum tag_Dynamic_ODM_Support_Ability_Type { ODM_2TPATHDIV = 0x00000200, ODM_1TPATHDIV = 0x00000400, ODM_PSD2AFH = 0x00000800 -} ODM_Ability_E; +}; /* */ /* 2011/20/20 MH For MP driver RT_WLAN_STA = STA_INFO_T */ /* Please declare below ODM relative info in your STA info structure. */ /* */ -typedef struct _ODM_STA_INFO { +struct ODM_STA_INFO_T { /* Driver Write */ bool bUsed; /* record the sta status link or not? */ /* u8 WirelessMode; */ @@ -320,12 +320,12 @@ typedef struct _ODM_STA_INFO { /* */ /* ODM Write Wilson will handle this part(said by Luke.Lee) */ /* TX_RPT_T pTxRpt; Define in IC folder. Move lower layer. */ -} ODM_STA_INFO_T, *PODM_STA_INFO_T; +}; /* */ /* 2011/10/20 MH Define Common info enum for all team. */ /* */ -typedef enum _ODM_Common_Info_Definition { +enum ODM_CMNINFO_E { /* Fixed value: */ /* HOOK BEFORE REG INIT----------- */ @@ -412,10 +412,10 @@ typedef enum _ODM_Common_Info_Definition { ODM_CMNINFO_MAC_STATUS, ODM_CMNINFO_MAX, -} ODM_CMNINFO_E; +}; /* 2011/10/20 MH Define ODM support ability. ODM_CMNINFO_ABILITY */ -typedef enum _ODM_Support_Ability_Definition { +enum ODM_ABILITY_E { /* _ODM_Support_Ability_Definition */ /* */ /* BB ODM section BIT 0-15 */ /* */ @@ -443,21 +443,21 @@ typedef enum _ODM_Support_Ability_Definition { ODM_RF_TX_PWR_TRACK = BIT24, ODM_RF_RX_GAIN_TRACK = BIT25, ODM_RF_CALIBRATION = BIT26, -} ODM_ABILITY_E; +}; /* ODM_CMNINFO_INTERFACE */ -typedef enum tag_ODM_Support_Interface_Definition { +enum ODM_INTERFACE_E { /* tag_ODM_Support_Interface_Definition */ ODM_ITRF_SDIO = 0x4, ODM_ITRF_ALL = 0x7, -} ODM_INTERFACE_E; +}; /* ODM_CMNINFO_IC_TYPE */ -typedef enum tag_ODM_Support_IC_Type_Definition { +enum ODM_IC_TYPE_E { /* tag_ODM_Support_IC_Type_Definition */ ODM_RTL8723B = BIT8, -} ODM_IC_TYPE_E; +}; /* ODM_CMNINFO_CUT_VER */ -typedef enum tag_ODM_Cut_Version_Definition { +enum ODM_CUT_VERSION_E { /* tag_ODM_Cut_Version_Definition */ ODM_CUT_A = 0, ODM_CUT_B = 1, ODM_CUT_C = 2, @@ -469,19 +469,19 @@ typedef enum tag_ODM_Cut_Version_Definition { ODM_CUT_J = 9, ODM_CUT_K = 10, ODM_CUT_TEST = 15, -} ODM_CUT_VERSION_E; +}; /* ODM_CMNINFO_FAB_VER */ -typedef enum tag_ODM_Fab_Version_Definition { +enum ODM_FAB_E { /* tag_ODM_Fab_Version_Definition */ ODM_TSMC = 0, ODM_UMC = 1, -} ODM_FAB_E; +}; /* ODM_CMNINFO_RF_TYPE */ /* */ /* For example 1T2R (A+AB = BIT0|BIT4|BIT5) */ /* */ -typedef enum tag_ODM_RF_Path_Bit_Definition { +enum ODM_RF_PATH_E { /* tag_ODM_RF_Path_Bit_Definition */ ODM_RF_TX_A = BIT0, ODM_RF_TX_B = BIT1, ODM_RF_TX_C = BIT2, @@ -490,9 +490,9 @@ typedef enum tag_ODM_RF_Path_Bit_Definition { ODM_RF_RX_B = BIT5, ODM_RF_RX_C = BIT6, ODM_RF_RX_D = BIT7, -} ODM_RF_PATH_E; +}; -typedef enum tag_ODM_RF_Type_Definition { +enum ODM_RF_TYPE_E { /* tag_ODM_RF_Type_Definition */ ODM_1T1R = 0, ODM_1T2R = 1, ODM_2T2R = 2, @@ -501,7 +501,7 @@ typedef enum tag_ODM_RF_Type_Definition { ODM_3T3R = 5, ODM_3T4R = 6, ODM_4T4R = 7, -} ODM_RF_TYPE_E; +}; /* */ /* ODM Dynamic common info value definition */ @@ -513,21 +513,21 @@ typedef enum tag_ODM_RF_Type_Definition { /* DUALMAC_SINGLEPHY, */ /* MACPHY_MODE_8192D,*PMACPHY_MODE_8192D; */ /* Above is the original define in MP driver. Please use the same define. THX. */ -typedef enum tag_ODM_MAC_PHY_Mode_Definition { +enum ODM_MAC_PHY_MODE_E { /* tag_ODM_MAC_PHY_Mode_Definition */ ODM_SMSP = 0, ODM_DMSP = 1, ODM_DMDP = 2, -} ODM_MAC_PHY_MODE_E; +}; -typedef enum tag_BT_Coexist_Definition { +enum ODM_BT_COEXIST_E { /* tag_BT_Coexist_Definition */ ODM_BT_BUSY = 1, ODM_BT_ON = 2, ODM_BT_OFF = 3, ODM_BT_NONE = 4, -} ODM_BT_COEXIST_E; +}; /* ODM_CMNINFO_OP_MODE */ -typedef enum tag_Operation_Mode_Definition { +enum ODM_OPERATION_MODE_E { /* tag_Operation_Mode_Definition */ ODM_NO_LINK = BIT0, ODM_LINK = BIT1, ODM_SCAN = BIT2, @@ -537,10 +537,10 @@ typedef enum tag_Operation_Mode_Definition { ODM_AD_HOC = BIT6, ODM_WIFI_DIRECT = BIT7, ODM_WIFI_DISPLAY = BIT8, -} ODM_OPERATION_MODE_E; +}; /* ODM_CMNINFO_WM_MODE */ -typedef enum tag_Wireless_Mode_Definition { +enum ODM_WIRELESS_MODE_E { /* tag_Wireless_Mode_Definition */ ODM_WM_UNKNOWN = 0x0, ODM_WM_B = BIT0, ODM_WM_G = BIT1, @@ -549,25 +549,25 @@ typedef enum tag_Wireless_Mode_Definition { ODM_WM_N5G = BIT4, ODM_WM_AUTO = BIT5, ODM_WM_AC = BIT6, -} ODM_WIRELESS_MODE_E; +}; /* ODM_CMNINFO_BAND */ -typedef enum tag_Band_Type_Definition { +enum ODM_BAND_TYPE_E { /* tag_Band_Type_Definition */ ODM_BAND_2_4G = 0, ODM_BAND_5G, ODM_BAND_ON_BOTH, ODM_BANDMAX -} ODM_BAND_TYPE_E; +}; /* ODM_CMNINFO_SEC_CHNL_OFFSET */ -typedef enum tag_Secondary_Channel_Offset_Definition { +enum ODM_SEC_CHNL_OFFSET_E { /* tag_Secondary_Channel_Offset_Definition */ ODM_DONT_CARE = 0, ODM_BELOW = 1, ODM_ABOVE = 2 -} ODM_SEC_CHNL_OFFSET_E; +}; /* ODM_CMNINFO_SEC_MODE */ -typedef enum tag_Security_Definition { +enum ODM_SECURITY_E { /* tag_Security_Definition */ ODM_SEC_OPEN = 0, ODM_SEC_WEP40 = 1, ODM_SEC_TKIP = 2, @@ -576,21 +576,21 @@ typedef enum tag_Security_Definition { ODM_SEC_WEP104 = 5, ODM_WEP_WPA_MIXED = 6, /* WEP + WPA */ ODM_SEC_SMS4 = 7, -} ODM_SECURITY_E; +}; /* ODM_CMNINFO_BW */ -typedef enum tag_Bandwidth_Definition { +enum ODM_BW_E { /* tag_Bandwidth_Definition */ ODM_BW20M = 0, ODM_BW40M = 1, ODM_BW80M = 2, ODM_BW160M = 3, ODM_BW10M = 4, -} ODM_BW_E; +}; /* ODM_CMNINFO_BOARD_TYPE */ /* For non-AC-series IC , ODM_BOARD_5G_EXT_PA and ODM_BOARD_5G_EXT_LNA are ignored */ /* For AC-series IC, external PA & LNA can be indivisuallly added on 2.4G and/or 5G */ -typedef enum tag_Board_Definition { +enum ODM_BOARD_TYPE_E { /* tag_Board_Definition */ ODM_BOARD_DEFAULT = 0, /* The DEFAULT case. */ ODM_BOARD_MINICARD = BIT(0), /* 0 = non-mini card, 1 = mini card. */ ODM_BOARD_SLIM = BIT(1), /* 0 = non-slim card, 1 = slim card */ @@ -600,47 +600,47 @@ typedef enum tag_Board_Definition { ODM_BOARD_EXT_TRSW = BIT(5), /* 0 = no ext-TRSW, 1 = existing ext-TRSW */ ODM_BOARD_EXT_PA_5G = BIT(6), /* 0 = no 5G ext-PA, 1 = existing 5G ext-PA */ ODM_BOARD_EXT_LNA_5G = BIT(7), /* 0 = no 5G ext-LNA, 1 = existing 5G ext-LNA */ -} ODM_BOARD_TYPE_E; +}; -typedef enum tag_ODM_Package_Definition { +enum ODM_Package_TYPE_E { /* tag_ODM_Package_Definition */ ODM_PACKAGE_DEFAULT = 0, ODM_PACKAGE_QFN68 = BIT(0), ODM_PACKAGE_TFBGA90 = BIT(1), ODM_PACKAGE_TFBGA79 = BIT(2), -} ODM_Package_TYPE_E; +}; -typedef enum tag_ODM_TYPE_GPA_Definition { +enum ODM_TYPE_GPA_E { /* tag_ODM_TYPE_GPA_Definition */ TYPE_GPA0 = 0, TYPE_GPA1 = BIT(1)|BIT(0) -} ODM_TYPE_GPA_E; +}; -typedef enum tag_ODM_TYPE_APA_Definition { +enum ODM_TYPE_APA_E { /* tag_ODM_TYPE_APA_Definition */ TYPE_APA0 = 0, TYPE_APA1 = BIT(1)|BIT(0) -} ODM_TYPE_APA_E; +}; -typedef enum tag_ODM_TYPE_GLNA_Definition { +enum ODM_TYPE_GLNA_E { /* tag_ODM_TYPE_GLNA_Definition */ TYPE_GLNA0 = 0, TYPE_GLNA1 = BIT(2)|BIT(0), TYPE_GLNA2 = BIT(3)|BIT(1), TYPE_GLNA3 = BIT(3)|BIT(2)|BIT(1)|BIT(0) -} ODM_TYPE_GLNA_E; +}; -typedef enum tag_ODM_TYPE_ALNA_Definition { +enum ODM_TYPE_ALNA_E { /* tag_ODM_TYPE_ALNA_Definition */ TYPE_ALNA0 = 0, TYPE_ALNA1 = BIT(2)|BIT(0), TYPE_ALNA2 = BIT(3)|BIT(1), TYPE_ALNA3 = BIT(3)|BIT(2)|BIT(1)|BIT(0) -} ODM_TYPE_ALNA_E; +}; /* ODM_CMNINFO_ONE_PATH_CCA */ -typedef enum tag_CCA_Path { +enum ODM_CCA_PATH_E { /* tag_CCA_Path */ ODM_CCA_2R = 0, ODM_CCA_1R_A = 1, ODM_CCA_1R_B = 2, -} ODM_CCA_PATH_E; +}; -typedef struct _ODM_RA_Info_ { +struct ODM_RA_INFO_T { /* _ODM_RA_Info_ */ u8 RateID; u32 RateMask; u32 RAUseRate; @@ -670,17 +670,17 @@ typedef struct _ODM_RA_Info_ { u8 PTModeSS; /* decide whitch rate should do PT */ u8 RAstage; /* StageRA, decide how many times RA will be done between PT */ u8 PTSmoothFactor; -} ODM_RA_INFO_T, *PODM_RA_INFO_T; +}; -typedef struct _IQK_MATRIX_REGS_SETTING { +struct IQK_MATRIX_REGS_SETTING { /* _IQK_MATRIX_REGS_SETTING */ bool bIQKDone; s32 Value[3][IQK_Matrix_REG_NUM]; bool bBWIqkResultSaved[3]; -} IQK_MATRIX_REGS_SETTING, *PIQK_MATRIX_REGS_SETTING; +}; /* Remove PATHDIV_PARA struct to odm_PathDiv.h */ -typedef struct ODM_RF_Calibration_Structure { +struct ODM_RF_CAL_T { /* ODM_RF_Calibration_Structure */ /* for tx power tracking */ u32 RegA24; /* for TempCCK */ @@ -724,7 +724,7 @@ typedef struct ODM_RF_Calibration_Structure { u8 ThermalValue_HP[HP_THERMAL_NUM]; u8 ThermalValue_HP_index; - IQK_MATRIX_REGS_SETTING IQKMatrixRegSetting[IQK_Matrix_Settings_NUM]; + struct IQK_MATRIX_REGS_SETTING IQKMatrixRegSetting[IQK_Matrix_Settings_NUM]; bool bNeedIQK; bool bIQKInProgress; u8 Delta_IQK; @@ -780,12 +780,12 @@ typedef struct ODM_RF_Calibration_Structure { u32 TxLOK[2]; -} ODM_RF_CAL_T, *PODM_RF_CAL_T; +}; /* */ /* ODM Dynamic common info value definition */ /* */ -typedef struct _FAST_ANTENNA_TRAINNING_ { +struct FAT_T { /* _FAST_ANTENNA_TRAINNING_ */ u8 Bssid[6]; u8 antsel_rx_keep_0; u8 antsel_rx_keep_1; @@ -823,14 +823,14 @@ typedef struct _FAST_ANTENNA_TRAINNING_ { u32 MainAnt_CtrlFrame_Cnt; u32 AuxAnt_CtrlFrame_Cnt; -} FAT_T, *pFAT_T; +}; -typedef enum _FAT_STATE { +enum FAT_STATE_E { FAT_NORMAL_STATE = 0, FAT_TRAINING_STATE = 1, -} FAT_STATE_E, *PFAT_STATE_E; +}; -typedef enum _ANT_DIV_TYPE { +enum ANT_DIV_TYPE_E { NO_ANTDIV = 0xFF, CG_TRX_HW_ANTDIV = 0x01, CGCS_RX_HW_ANTDIV = 0x02, @@ -838,36 +838,36 @@ typedef enum _ANT_DIV_TYPE { CG_TRX_SMART_ANTDIV = 0x04, CGCS_RX_SW_ANTDIV = 0x05, S0S1_SW_ANTDIV = 0x06 /* 8723B intrnal switch S0 S1 */ -} ANT_DIV_TYPE_E, *PANT_DIV_TYPE_E; +}; -typedef struct _ODM_PATH_DIVERSITY_ { +struct PATHDIV_T { /* _ODM_PATH_DIVERSITY_ */ u8 RespTxPath; u8 PathSel[ODM_ASSOCIATE_ENTRY_NUM]; u32 PathA_Sum[ODM_ASSOCIATE_ENTRY_NUM]; u32 PathB_Sum[ODM_ASSOCIATE_ENTRY_NUM]; u32 PathA_Cnt[ODM_ASSOCIATE_ENTRY_NUM]; u32 PathB_Cnt[ODM_ASSOCIATE_ENTRY_NUM]; -} PATHDIV_T, *pPATHDIV_T; +}; -typedef enum _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE { +enum PHY_REG_PG_TYPE { /* _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE */ PHY_REG_PG_RELATIVE_VALUE = 0, PHY_REG_PG_EXACT_VALUE = 1 -} PHY_REG_PG_TYPE; +}; /* */ /* Antenna detection information from single tone mechanism, added by Roger, 2012.11.27. */ /* */ -typedef struct _ANT_DETECTED_INFO { +struct ANT_DETECTED_INFO { bool bAntDetected; u32 dBForAntA; u32 dBForAntB; u32 dBForAntO; -} ANT_DETECTED_INFO, *PANT_DETECTED_INFO; +}; /* */ /* 2011/09/22 MH Copy from SD4 defined structure. We use to support PHY DM integration. */ /* */ -typedef struct DM_Out_Source_Dynamic_Mechanism_Structure { +struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ /* RT_TIMER FastAntTrainingTimer; */ /* */ /* Add for different team use temporarily */ @@ -876,7 +876,7 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure { /* WHen you use Adapter or priv pointer, you must make sure the pointer is ready. */ bool odm_ready; - PHY_REG_PG_TYPE PhyRegPgValueType; + enum PHY_REG_PG_TYPE PhyRegPgValueType; u8 PhyRegPgVersion; u64 DebugComponents; @@ -1109,21 +1109,21 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure { /* */ /* ODM Structure */ /* */ - FAT_T DM_FatTable; + struct FAT_T DM_FatTable; DIG_T DM_DigTable; PS_T DM_PSTable; struct dynamic_primary_CCA DM_PriCCA; - RXHP_T DM_RXHP_Table; - RA_T DM_RA_Table; + struct RXHP_T DM_RXHP_Table; + struct RA_T DM_RA_Table; false_ALARM_STATISTICS FalseAlmCnt; false_ALARM_STATISTICS FlaseAlmCntBuddyAdapter; - SWAT_T DM_SWAT_Table; + struct SWAT_T DM_SWAT_Table; bool RSSI_test; CFO_TRACKING DM_CfoTrack; EDCA_T DM_EDCA_Table; u32 WMMEDCA_BE; - PATHDIV_T DM_PathDiv; + struct PATHDIV_T DM_PathDiv; /* Copy from SD4 structure */ /* */ /* ================================================== */ @@ -1158,11 +1158,11 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure { /* for rate adaptive, in fact, 88c/92c fw will handle this */ u8 bUseRAMask; - ODM_RATE_ADAPTIVE RateAdaptive; + struct ODM_RATE_ADAPTIVE RateAdaptive; - ANT_DETECTED_INFO AntDetectedInfo; /* Antenna detected information for RSSI tool */ + struct ANT_DETECTED_INFO AntDetectedInfo; /* Antenna detected information for RSSI tool */ - ODM_RF_CAL_T RFCalibrateInfo; + struct ODM_RF_CAL_T RFCalibrateInfo; /* */ /* TX power tracking */ @@ -1204,11 +1204,11 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure { #if (BEAMFORMING_SUPPORT == 1) RT_BEAMFORMING_INFO BeamformingInfo; #endif -} DM_ODM_T, *PDM_ODM_T; /* DM_Dynamic_Mechanism_Structure */ +}; #define ODM_RF_PATH_MAX 2 -typedef enum _ODM_RF_RADIO_PATH { +enum ODM_RF_RADIO_PATH_E { ODM_RF_PATH_A = 0, /* Radio Path A */ ODM_RF_PATH_B = 1, /* Radio Path B */ ODM_RF_PATH_C = 2, /* Radio Path C */ @@ -1224,16 +1224,16 @@ typedef enum _ODM_RF_RADIO_PATH { ODM_RF_PATH_BCD, ODM_RF_PATH_ABCD, /* ODM_RF_PATH_MAX, Max RF number 90 support */ -} ODM_RF_RADIO_PATH_E, *PODM_RF_RADIO_PATH_E; +}; - typedef enum _ODM_RF_CONTENT { + enum ODM_RF_CONTENT { odm_radioa_txt = 0x1000, odm_radiob_txt = 0x1001, odm_radioc_txt = 0x1002, odm_radiod_txt = 0x1003 -} ODM_RF_CONTENT; +}; -typedef enum _ODM_BB_Config_Type { +enum ODM_BB_Config_Type { CONFIG_BB_PHY_REG, CONFIG_BB_AGC_TAB, CONFIG_BB_AGC_TAB_2G, @@ -1241,14 +1241,14 @@ typedef enum _ODM_BB_Config_Type { CONFIG_BB_PHY_REG_PG, CONFIG_BB_PHY_REG_MP, CONFIG_BB_AGC_TAB_DIFF, -} ODM_BB_Config_Type, *PODM_BB_Config_Type; +}; -typedef enum _ODM_RF_Config_Type { +enum ODM_RF_Config_Type { CONFIG_RF_RADIO, CONFIG_RF_TXPWR_LMT, -} ODM_RF_Config_Type, *PODM_RF_Config_Type; +}; -typedef enum _ODM_FW_Config_Type { +enum ODM_FW_Config_Type { CONFIG_FW_NIC, CONFIG_FW_NIC_2, CONFIG_FW_AP, @@ -1256,10 +1256,10 @@ typedef enum _ODM_FW_Config_Type { CONFIG_FW_WoWLAN_2, CONFIG_FW_AP_WoWLAN, CONFIG_FW_BT, -} ODM_FW_Config_Type; +}; /* Status code */ -typedef enum _RT_STATUS { +enum RT_STATUS { RT_STATUS_SUCCESS, RT_STATUS_FAILURE, RT_STATUS_PENDING, @@ -1268,7 +1268,7 @@ typedef enum _RT_STATUS { RT_STATUS_INVALID_PARAMETER, RT_STATUS_NOT_SUPPORT, RT_STATUS_OS_API_FAILED, -} RT_STATUS, *PRT_STATUS; +}; #ifdef REMOVE_PACK #pragma pack() @@ -1316,26 +1316,26 @@ typedef enum _RT_STATUS { /* 3 BB Power Save */ /* 3 =========================================================== */ -typedef enum tag_1R_CCA_Type_Definition { +enum DM_1R_CCA_E { /* tag_1R_CCA_Type_Definition */ CCA_1R = 0, CCA_2R = 1, CCA_MAX = 2, -} DM_1R_CCA_E; +}; -typedef enum tag_RF_Type_Definition { +enum DM_RF_E { /* tag_RF_Type_Definition */ RF_Save = 0, RF_Normal = 1, RF_MAX = 2, -} DM_RF_E; +}; /* 3 =========================================================== */ /* 3 Antenna Diversity */ /* 3 =========================================================== */ -typedef enum tag_SW_Antenna_Switch_Definition { +enum DM_SWAS_E { /* tag_SW_Antenna_Switch_Definition */ Antenna_A = 1, Antenna_B = 2, Antenna_MAX = 3, -} DM_SWAS_E; +}; /* Maximal number of antenna detection mechanism needs to perform, added by Roger, 2011.12.28. */ #define MAX_ANTENNA_DETECTION_CNT 10 @@ -1368,10 +1368,10 @@ extern u32 TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE]; /* Remove BB power saving by Yuchen */ #define dm_CheckTXPowerTracking ODM_TXPowerTrackingCheck -void ODM_TXPowerTrackingCheck(PDM_ODM_T pDM_Odm); +void ODM_TXPowerTrackingCheck(struct DM_ODM_T * pDM_Odm); bool ODM_RAStateCheck( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, s32 RSSI, bool bForceUpdate, u8 *pRATRState @@ -1379,13 +1379,13 @@ bool ODM_RAStateCheck( #define dm_SWAW_RSSI_Check ODM_SwAntDivChkPerPktRssi void ODM_SwAntDivChkPerPktRssi( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, u8 StationID, struct odm_phy_info *pPhyInfo ); u32 ODM_Get_Rate_Bitmap( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, u32 macid, u32 ra_mask, u8 rssi_level @@ -1395,38 +1395,38 @@ u32 ODM_Get_Rate_Bitmap( BEAMFORMING_CAP Beamforming_GetEntryBeamCapByMacId(PMGNT_INFO pMgntInfo, u8 MacId); #endif -void odm_TXPowerTrackingInit(PDM_ODM_T pDM_Odm); +void odm_TXPowerTrackingInit(struct DM_ODM_T * pDM_Odm); -void ODM_DMInit(PDM_ODM_T pDM_Odm); +void ODM_DMInit(struct DM_ODM_T * pDM_Odm); -void ODM_DMWatchdog(PDM_ODM_T pDM_Odm); /* For common use in the future */ +void ODM_DMWatchdog(struct DM_ODM_T * pDM_Odm); /* For common use in the future */ -void ODM_CmnInfoInit(PDM_ODM_T pDM_Odm, ODM_CMNINFO_E CmnInfo, u32 Value); +void ODM_CmnInfoInit(struct DM_ODM_T * pDM_Odm, enum ODM_CMNINFO_E CmnInfo, u32 Value); -void ODM_CmnInfoHook(PDM_ODM_T pDM_Odm, ODM_CMNINFO_E CmnInfo, void *pValue); +void ODM_CmnInfoHook(struct DM_ODM_T * pDM_Odm, enum ODM_CMNINFO_E CmnInfo, void *pValue); void ODM_CmnInfoPtrArrayHook( - PDM_ODM_T pDM_Odm, - ODM_CMNINFO_E CmnInfo, + struct DM_ODM_T * pDM_Odm, + enum ODM_CMNINFO_E CmnInfo, u16 Index, void *pValue ); -void ODM_CmnInfoUpdate(PDM_ODM_T pDM_Odm, u32 CmnInfo, u64 Value); +void ODM_CmnInfoUpdate(struct DM_ODM_T * pDM_Odm, u32 CmnInfo, u64 Value); -void ODM_InitAllTimers(PDM_ODM_T pDM_Odm); +void ODM_InitAllTimers(struct DM_ODM_T * pDM_Odm); -void ODM_CancelAllTimers(PDM_ODM_T pDM_Odm); +void ODM_CancelAllTimers(struct DM_ODM_T * pDM_Odm); -void ODM_ReleaseAllTimers(PDM_ODM_T pDM_Odm); +void ODM_ReleaseAllTimers(struct DM_ODM_T * pDM_Odm); void ODM_AntselStatistics_88C( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, u8 MacId, u32 PWDBAll, bool isCCKrate ); -void ODM_DynamicARFBSelect(PDM_ODM_T pDM_Odm, u8 rate, bool Collision_State); +void ODM_DynamicARFBSelect(struct DM_ODM_T * pDM_Odm, u8 rate, bool Collision_State); #endif diff --git a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c index 3ea1972545e5..f1dd2df03730 100644 --- a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c +++ b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c @@ -9,7 +9,7 @@ static void odm_SetCrystalCap(void *pDM_VOID, u8 CrystalCap) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; if (pCfoTrack->CrystalCap == CrystalCap) @@ -39,7 +39,7 @@ static void odm_SetCrystalCap(void *pDM_VOID, u8 CrystalCap) static u8 odm_GetDefaultCrytaltalCap(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; struct adapter *Adapter = pDM_Odm->Adapter; struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); @@ -49,7 +49,7 @@ static u8 odm_GetDefaultCrytaltalCap(void *pDM_VOID) static void odm_SetATCStatus(void *pDM_VOID, bool ATCStatus) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; if (pCfoTrack->bATCStatus == ATCStatus) @@ -67,7 +67,7 @@ static void odm_SetATCStatus(void *pDM_VOID, bool ATCStatus) static bool odm_GetATCStatus(void *pDM_VOID) { bool ATCStatus; - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ATCStatus = (bool)PHY_QueryBBReg( pDM_Odm->Adapter, @@ -79,7 +79,7 @@ static bool odm_GetATCStatus(void *pDM_VOID) void ODM_CfoTrackingReset(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; pCfoTrack->DefXCap = odm_GetDefaultCrytaltalCap(pDM_Odm); @@ -91,7 +91,7 @@ void ODM_CfoTrackingReset(void *pDM_VOID) void ODM_CfoTrackingInit(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; pCfoTrack->DefXCap = @@ -118,7 +118,7 @@ void ODM_CfoTrackingInit(void *pDM_VOID) void ODM_CfoTracking(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; int CFO_kHz_A, CFO_kHz_B, CFO_ave = 0; int CFO_ave_diff; @@ -297,7 +297,7 @@ void ODM_CfoTracking(void *pDM_VOID) void ODM_ParsingCFO(void *pDM_VOID, void *pPktinfo_VOID, s8 *pcfotail) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; struct odm_packet_info *pPktinfo = pPktinfo_VOID; PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; u8 i; diff --git a/drivers/staging/rtl8723bs/hal/odm_DIG.c b/drivers/staging/rtl8723bs/hal/odm_DIG.c index 40fe43c62c45..6b8b6da6dbcc 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DIG.c +++ b/drivers/staging/rtl8723bs/hal/odm_DIG.c @@ -11,7 +11,7 @@ void odm_NHMCounterStatisticsInit(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; /* PHY parameters initialize for n series */ rtw_write16(pDM_Odm->Adapter, ODM_REG_NHM_TIMER_11N+2, 0x2710); /* 0x894[31:16]= 0x2710 Time duration for NHM unit: 4us, 0x2710 =40ms */ @@ -27,7 +27,7 @@ void odm_NHMCounterStatisticsInit(void *pDM_VOID) void odm_NHMCounterStatistics(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; /* Get NHM report */ odm_GetNHMCounterStatistics(pDM_Odm); @@ -38,7 +38,7 @@ void odm_NHMCounterStatistics(void *pDM_VOID) void odm_GetNHMCounterStatistics(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; u32 value32 = 0; value32 = PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG_NHM_CNT_11N, bMaskDWord); @@ -48,7 +48,7 @@ void odm_GetNHMCounterStatistics(void *pDM_VOID) void odm_NHMCounterStatisticsReset(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_NHM_TH9_TH10_11N, BIT1, 0); PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_NHM_TH9_TH10_11N, BIT1, 1); @@ -56,7 +56,7 @@ void odm_NHMCounterStatisticsReset(void *pDM_VOID) void odm_NHMBBInit(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; pDM_Odm->adaptivity_flag = 0; pDM_Odm->tolerance_cnt = 3; @@ -69,7 +69,7 @@ void odm_NHMBBInit(void *pDM_VOID) /* */ void odm_NHMBB(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; /* u8 test_status; */ /* Pfalse_ALARM_STATISTICS pFalseAlmCnt = &(pDM_Odm->FalseAlmCnt); */ @@ -133,7 +133,7 @@ void odm_NHMBB(void *pDM_VOID) void odm_SearchPwdBLowerBound(void *pDM_VOID, u8 IGI_target) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; u32 value32 = 0; u8 cnt, IGI; bool bAdjust = true; @@ -205,7 +205,7 @@ void odm_SearchPwdBLowerBound(void *pDM_VOID, u8 IGI_target) void odm_AdaptivityInit(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; if (pDM_Odm->Carrier_Sense_enable == false) pDM_Odm->TH_L2H_ini = 0xf7; /* -7 */ @@ -233,7 +233,7 @@ void odm_AdaptivityInit(void *pDM_VOID) void odm_Adaptivity(void *pDM_VOID, u8 IGI) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; s8 TH_L2H_dmc, TH_H2L_dmc; s8 Diff, IGI_target; bool EDCCA_State = false; @@ -322,7 +322,7 @@ void odm_Adaptivity(void *pDM_VOID, u8 IGI) void ODM_Write_DIG(void *pDM_VOID, u8 CurrentIGI) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; if (pDM_DigTable->bStopDIG) { @@ -362,7 +362,7 @@ void odm_PauseDIG( u8 IGIValue ) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; static bool bPaused; @@ -435,7 +435,7 @@ void odm_PauseDIG( bool odm_DigAbort(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; /* SupportAbility */ if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) { @@ -466,7 +466,7 @@ bool odm_DigAbort(void *pDM_VOID) void odm_DIGInit(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; pDM_DigTable->bStopDIG = false; @@ -504,7 +504,7 @@ void odm_DIGInit(void *pDM_VOID) void odm_DIG(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; /* Common parameters */ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; @@ -823,7 +823,7 @@ void odm_DIG(void *pDM_VOID) void odm_DIGbyRSSI_LPS(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; Pfalse_ALARM_STATISTICS pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; u8 RSSI_Lower = DM_DIG_MIN_NIC; /* 0x1E or 0x1C */ @@ -892,7 +892,7 @@ void odm_DIGbyRSSI_LPS(void *pDM_VOID) void odm_FalseAlarmCounterStatistics(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; Pfalse_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); u32 ret_value; @@ -1062,7 +1062,7 @@ void odm_FAThresholdCheck( u32 *dm_FA_thres ) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; if (pDM_Odm->bLinked && (bPerformance || bDFSBand)) { /* For NIC */ @@ -1078,7 +1078,7 @@ void odm_FAThresholdCheck( u8 odm_ForbiddenIGICheck(void *pDM_VOID, u8 DIG_Dynamic_MIN, u8 CurrentIGI) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; Pfalse_ALARM_STATISTICS pFalseAlmCnt = &(pDM_Odm->FalseAlmCnt); u8 rx_gain_range_min = pDM_DigTable->rx_gain_range_min; @@ -1134,7 +1134,7 @@ u8 odm_ForbiddenIGICheck(void *pDM_VOID, u8 DIG_Dynamic_MIN, u8 CurrentIGI) void odm_CCKPacketDetectionThresh(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; Pfalse_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); u8 CurCCK_CCAThres; @@ -1195,7 +1195,7 @@ void odm_CCKPacketDetectionThresh(void *pDM_VOID) void ODM_Write_CCK_CCA_Thres(void *pDM_VOID, u8 CurCCK_CCAThres) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; /* modify by Guo.Mingzhi 2012-01-03 */ diff --git a/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c b/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c index e18c9d65eee2..cc0bf4c1c777 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c +++ b/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c @@ -9,7 +9,7 @@ void odm_DynamicBBPowerSavingInit(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; pDM_PSTable->PreCCAState = CCA_MAX; @@ -22,7 +22,7 @@ void odm_DynamicBBPowerSavingInit(void *pDM_VOID) void ODM_RF_Saving(void *pDM_VOID, u8 bForceInNormal) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; u8 Rssi_Up_bound = 30; u8 Rssi_Low_bound = 25; diff --git a/drivers/staging/rtl8723bs/hal/odm_DynamicTxPower.c b/drivers/staging/rtl8723bs/hal/odm_DynamicTxPower.c index 17f90f4cc1ad..adb57e9af408 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DynamicTxPower.c +++ b/drivers/staging/rtl8723bs/hal/odm_DynamicTxPower.c @@ -9,7 +9,7 @@ void odm_DynamicTxPowerInit(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; struct adapter *Adapter = pDM_Odm->Adapter; struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); diff --git a/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.c b/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.c index b7ebce7a6ff9..61c447b00ff7 100644 --- a/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.c +++ b/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.c @@ -31,7 +31,7 @@ static u32 edca_setting_DL[HT_IOT_PEER_MAX] = { void ODM_EdcaTurboInit(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; struct adapter *Adapter = pDM_Odm->Adapter; pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = false; @@ -58,7 +58,7 @@ void odm_EdcaTurboCheck(void *pDM_VOID) * operate at the same time. In stage2/3, we need to prove universal * interface and merge all HW dynamic mechanism. */ - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("odm_EdcaTurboCheck ========================>\n")); @@ -73,7 +73,7 @@ void odm_EdcaTurboCheck(void *pDM_VOID) void odm_EdcaTurboCheckCE(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; struct adapter *Adapter = pDM_Odm->Adapter; struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(Adapter); struct recv_priv *precvpriv = &(Adapter->recvpriv); diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c index 9c190b1024d8..308f65ee7c99 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c @@ -23,7 +23,7 @@ static u8 odm_QueryRxPwrPercentage(s8 AntPower) } -s32 odm_SignalScaleMapping(PDM_ODM_T pDM_Odm, s32 CurrSig) +s32 odm_SignalScaleMapping(struct DM_ODM_T * pDM_Odm, s32 CurrSig) { s32 RetSig = 0; @@ -77,7 +77,7 @@ static u8 odm_EVMdbToPercentage(s8 Value) } static void odm_RxPhyStatus92CSeries_Parsing( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, struct odm_phy_info *pPhyInfo, u8 *pPhyStatus, struct odm_packet_info *pPktinfo @@ -247,7 +247,7 @@ static void odm_RxPhyStatus92CSeries_Parsing( } static void odm_Process_RSSIForDM( - PDM_ODM_T pDM_Odm, struct odm_phy_info *pPhyInfo, struct odm_packet_info *pPktinfo + struct DM_ODM_T * pDM_Odm, struct odm_phy_info *pPhyInfo, struct odm_packet_info *pPktinfo ) { @@ -401,7 +401,7 @@ static void odm_Process_RSSIForDM( /* Endianness before calling this API */ /* */ static void ODM_PhyStatusQuery_92CSeries( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, struct odm_phy_info *pPhyInfo, u8 *pPhyStatus, struct odm_packet_info *pPktinfo @@ -415,7 +415,7 @@ static void ODM_PhyStatusQuery_92CSeries( } void ODM_PhyStatusQuery( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, struct odm_phy_info *pPhyInfo, u8 *pPhyStatus, struct odm_packet_info *pPktinfo @@ -431,9 +431,9 @@ void ODM_PhyStatusQuery( /* */ HAL_STATUS ODM_ConfigRFWithHeaderFile( - PDM_ODM_T pDM_Odm, - ODM_RF_Config_Type ConfigType, - ODM_RF_RADIO_PATH_E eRFPath + struct DM_ODM_T * pDM_Odm, + enum ODM_RF_Config_Type ConfigType, + enum ODM_RF_RADIO_PATH_E eRFPath ) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, @@ -450,7 +450,7 @@ HAL_STATUS ODM_ConfigRFWithHeaderFile( return HAL_STATUS_SUCCESS; } -HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(PDM_ODM_T pDM_Odm) +HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T * pDM_Odm) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===>ODM_ConfigRFWithTxPwrTrackHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip")); @@ -465,7 +465,7 @@ HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(PDM_ODM_T pDM_Odm) } HAL_STATUS ODM_ConfigBBWithHeaderFile( - PDM_ODM_T pDM_Odm, ODM_BB_Config_Type ConfigType + struct DM_ODM_T * pDM_Odm, enum ODM_BB_Config_Type ConfigType ) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.h b/drivers/staging/rtl8723bs/hal/odm_HWConfig.h index 945366bc37ce..2e2ffbf31f89 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.h +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.h @@ -122,31 +122,31 @@ typedef struct _Phy_Status_Rpt_8812 { void ODM_PhyStatusQuery( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, struct odm_phy_info *pPhyInfo, u8 *pPhyStatus, struct odm_packet_info *pPktinfo ); -HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(PDM_ODM_T pDM_Odm); +HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T * pDM_Odm); HAL_STATUS ODM_ConfigRFWithHeaderFile( - PDM_ODM_T pDM_Odm, - ODM_RF_Config_Type ConfigType, - ODM_RF_RADIO_PATH_E eRFPath + struct DM_ODM_T * pDM_Odm, + enum ODM_RF_Config_Type ConfigType, + enum ODM_RF_RADIO_PATH_E eRFPath ); HAL_STATUS ODM_ConfigBBWithHeaderFile( - PDM_ODM_T pDM_Odm, ODM_BB_Config_Type ConfigType + struct DM_ODM_T * pDM_Odm, enum ODM_BB_Config_Type ConfigType ); HAL_STATUS ODM_ConfigFWWithHeaderFile( - PDM_ODM_T pDM_Odm, - ODM_FW_Config_Type ConfigType, + struct DM_ODM_T * pDM_Odm, + enum ODM_FW_Config_Type ConfigType, u8 *pFirmware, u32 *pSize ); -s32 odm_SignalScaleMapping(PDM_ODM_T pDM_Odm, s32 CurrSig); +s32 odm_SignalScaleMapping(struct DM_ODM_T * pDM_Odm, s32 CurrSig); #endif diff --git a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c index 6ca799816c08..7743540b7817 100644 --- a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c +++ b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c @@ -19,7 +19,7 @@ #define ValidCnt 5 static s16 odm_InbandNoise_Monitor_NSeries( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, u8 bPauseDIG, u8 IGIValue, u32 max_time diff --git a/drivers/staging/rtl8723bs/hal/odm_PathDiv.c b/drivers/staging/rtl8723bs/hal/odm_PathDiv.c index 4d22360934f6..e04676533815 100644 --- a/drivers/staging/rtl8723bs/hal/odm_PathDiv.c +++ b/drivers/staging/rtl8723bs/hal/odm_PathDiv.c @@ -9,7 +9,7 @@ void odm_PathDiversityInit(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; if (!(pDM_Odm->SupportAbility & ODM_BB_PATH_DIV)) ODM_RT_TRACE( @@ -22,7 +22,7 @@ void odm_PathDiversityInit(void *pDM_VOID) void odm_PathDiversity(void *pDM_VOID) { - PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; if (!(pDM_Odm->SupportAbility & ODM_BB_PATH_DIV)) ODM_RT_TRACE( diff --git a/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.c b/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.c index 39f989bf3410..84b77a5c2a44 100644 --- a/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.c +++ b/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.c @@ -8,10 +8,10 @@ #include "odm_precomp.h" void odm_ConfigRFReg_8723B( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, u32 Addr, u32 Data, - ODM_RF_RADIO_PATH_E RF_PATH, + enum ODM_RF_RADIO_PATH_E RF_PATH, u32 RegAddr ) { @@ -106,7 +106,7 @@ void odm_ConfigRFReg_8723B( } -void odm_ConfigRF_RadioA_8723B(PDM_ODM_T pDM_Odm, u32 Addr, u32 Data) +void odm_ConfigRF_RadioA_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u32 Data) { u32 content = 0x1000; /* RF_Content: radioa_txt */ u32 maskforPhySet = (u32)(content&0xE000); @@ -131,7 +131,7 @@ void odm_ConfigRF_RadioA_8723B(PDM_ODM_T pDM_Odm, u32 Addr, u32 Data) ); } -void odm_ConfigMAC_8723B(PDM_ODM_T pDM_Odm, u32 Addr, u8 Data) +void odm_ConfigMAC_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u8 Data) { rtw_write8(pDM_Odm->Adapter, Addr, Data); ODM_RT_TRACE( @@ -147,7 +147,7 @@ void odm_ConfigMAC_8723B(PDM_ODM_T pDM_Odm, u32 Addr, u8 Data) } void odm_ConfigBB_AGC_8723B( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, u32 Addr, u32 Bitmask, u32 Data @@ -170,7 +170,7 @@ void odm_ConfigBB_AGC_8723B( } void odm_ConfigBB_PHY_REG_PG_8723B( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, u32 Band, u32 RfPath, u32 TxNum, @@ -198,7 +198,7 @@ void odm_ConfigBB_PHY_REG_PG_8723B( } void odm_ConfigBB_PHY_8723B( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, u32 Addr, u32 Bitmask, u32 Data @@ -226,7 +226,7 @@ void odm_ConfigBB_PHY_8723B( } void odm_ConfigBB_TXPWR_LMT_8723B( - PDM_ODM_T pDM_Odm, + struct DM_ODM_T * pDM_Odm, u8 *Regulation, u8 *Band, u8 *Bandwidth, diff --git a/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h b/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h index 07b585950cf9..d7747100a917 100644 --- a/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h +++ b/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h @@ -7,24 +7,24 @@ #ifndef __INC_ODM_REGCONFIG_H_8723B #define __INC_ODM_REGCONFIG_H_8723B -void odm_ConfigRFReg_8723B(PDM_ODM_T pDM_Odm, +void odm_ConfigRFReg_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u32 Data, - ODM_RF_RADIO_PATH_E RF_PATH, + enum ODM_RF_RADIO_PATH_E RF_PATH, u32 RegAddr ); -void odm_ConfigRF_RadioA_8723B(PDM_ODM_T pDM_Odm, u32 Addr, u32 Data); +void odm_ConfigRF_RadioA_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u32 Data); -void odm_ConfigMAC_8723B(PDM_ODM_T pDM_Odm, u32 Addr, u8 Data); +void odm_ConfigMAC_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u8 Data); -void odm_ConfigBB_AGC_8723B(PDM_ODM_T pDM_Odm, +void odm_ConfigBB_AGC_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u32 Bitmask, u32 Data ); -void odm_ConfigBB_PHY_REG_PG_8723B(PDM_ODM_T pDM_Odm, +void odm_ConfigBB_PHY_REG_PG_8723B(struct DM_ODM_T * pDM_Odm, u32 Band, u32 RfPath, u32 TxNum, @@ -33,13 +33,13 @@ void odm_ConfigBB_PHY_REG_PG_8723B(PDM_ODM_T pDM_Odm, u32 Data ); -void odm_ConfigBB_PHY_8723B(PDM_ODM_T pDM_Odm, +void odm_ConfigBB_PHY_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u32 Bitmask, u32 Data ); -void odm_ConfigBB_TXPWR_LMT_8723B(PDM_ODM_T pDM_Odm, +void odm_ConfigBB_TXPWR_LMT_8723B(struct DM_ODM_T * pDM_Odm, u8 *Regulation, u8 *Band, u8 *Bandwidth, diff --git a/drivers/staging/rtl8723bs/hal/odm_debug.c b/drivers/staging/rtl8723bs/hal/odm_debug.c index b92422c8fb8e..050aae37494e 100644 --- a/drivers/staging/rtl8723bs/hal/odm_debug.c +++ b/drivers/staging/rtl8723bs/hal/odm_debug.c @@ -7,7 +7,7 @@ #include "odm_precomp.h" -void ODM_InitDebugSetting(PDM_ODM_T pDM_Odm) +void ODM_InitDebugSetting(struct DM_ODM_T * pDM_Odm) { pDM_Odm->DebugLevel = ODM_DBG_LOUD; diff --git a/drivers/staging/rtl8723bs/hal/odm_debug.h b/drivers/staging/rtl8723bs/hal/odm_debug.h index a7381173d1a3..adb63ecc0b3e 100644 --- a/drivers/staging/rtl8723bs/hal/odm_debug.h +++ b/drivers/staging/rtl8723bs/hal/odm_debug.h @@ -162,6 +162,6 @@ no_printk("%s %p", title_str, ptr) #endif -void ODM_InitDebugSetting(PDM_ODM_T pDM_Odm); +void ODM_InitDebugSetting(struct DM_ODM_T * pDM_Odm); #endif /* __ODM_DBG_H__ */ diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c index 650fbedd34e8..9df5b1240de2 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c @@ -25,7 +25,7 @@ static void Init_ODM_ComInfo_8723b(struct adapter *Adapter) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + struct DM_ODM_T * pDM_Odm = &(pHalData->odmpriv); struct dm_priv *pdmpriv = &pHalData->dmpriv; u8 cut_ver, fab_ver; @@ -74,7 +74,7 @@ static void Update_ODM_ComInfo_8723b(struct adapter *Adapter) struct dvobj_priv *dvobj = adapter_to_dvobj(Adapter); struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(Adapter); struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + struct DM_ODM_T * pDM_Odm = &(pHalData->odmpriv); struct dm_priv *pdmpriv = &pHalData->dmpriv; int i; u8 zero = 0; @@ -129,7 +129,7 @@ void rtl8723b_InitHalDm(struct adapter *Adapter) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; - PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + struct DM_ODM_T * pDM_Odm = &(pHalData->odmpriv); pdmpriv->DM_Type = DM_Type_ByDriver; pdmpriv->DMFlag = DYNAMIC_FUNC_DISABLE; @@ -203,7 +203,7 @@ void rtl8723b_hal_dm_in_lps(struct adapter *padapter) u32 PWDB_rssi = 0; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info *psta = NULL; @@ -229,7 +229,7 @@ void rtl8723b_HalDmWatchDog_in_LPS(struct adapter *Adapter) struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; struct sta_priv *pstapriv = &Adapter->stapriv; struct sta_info *psta = NULL; diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c index 22365926a9f8..d67eb83e4011 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c @@ -594,8 +594,8 @@ u8 PHY_GetTxPowerIndex( void PHY_SetTxPowerLevel8723B(struct adapter *Adapter, u8 Channel) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct FAT_T * pDM_FatTable = &pDM_Odm->DM_FatTable; u8 RFPath = ODM_RF_PATH_A; if (pHalData->AntDivCfg) {/* antenna diversity Enable */ diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h index fa5d70016f05..04efd09fc628 100644 --- a/drivers/staging/rtl8723bs/include/hal_data.h +++ b/drivers/staging/rtl8723bs/include/hal_data.h @@ -431,7 +431,7 @@ struct hal_com_data { u32 sdio_tx_max_len[SDIO_MAX_TX_QUEUE];/* H, N, L, used for sdio tx aggregation max length per queue */ struct dm_priv dmpriv; - DM_ODM_T odmpriv; + struct DM_ODM_T odmpriv; /* For bluetooth co-existance */ BT_COEXIST bt_coexist; -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:16 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:16 +0100 Subject: [PATCH 11/33] staging: rtl8723bs: remove typedefs in hal_com.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-12-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #168: FILE: include/hal_com.h:168: +typedef enum _RT_MEDIA_STATUS { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h | 2 +- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 2 +- drivers/staging/rtl8723bs/include/hal_com.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h index 2c4c7b064073..6d60ad11588f 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h +++ b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h @@ -540,7 +540,7 @@ void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type); void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 action); void EXhalbtcoutsrc_MediaStatusNotify( - struct BTC_COEXIST * pBtCoexist, RT_MEDIA_STATUS mediaStatus + struct BTC_COEXIST * pBtCoexist, enum RT_MEDIA_STATUS mediaStatus ); void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 pktType); void EXhalbtcoutsrc_BtInfoNotify( diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c index 35d88832de0f..c0dcde0c0f9d 100644 --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c @@ -1105,7 +1105,7 @@ void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 action) /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, RT_MEDIA_STATUS mediaStatus) +void EXhalbtcoutsrc_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, enum RT_MEDIA_STATUS mediaStatus) { u8 mStatus; diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h index fe7e2efce0e3..5c4268955275 100644 --- a/drivers/staging/rtl8723bs/include/hal_com.h +++ b/drivers/staging/rtl8723bs/include/hal_com.h @@ -165,10 +165,10 @@ enum{ UP_LINK, DOWN_LINK, }; -typedef enum _RT_MEDIA_STATUS { +enum RT_MEDIA_STATUS { RT_MEDIA_DISCONNECT = 0, RT_MEDIA_CONNECT = 1 -} RT_MEDIA_STATUS; +}; #define MAX_DLFW_PAGE_SIZE 4096 /* @ page : 4k bytes */ enum FIRMWARE_SOURCE { -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:17 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:17 +0100 Subject: [PATCH 12/33] staging: rtl8723bs: remove typedefs in drv_types.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-13-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #374: FILE: include/drv_types.h:374: +typedef enum _DRIVER_STATE { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/drv_types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h index cfde6e3ba400..59d7e22cddca 100644 --- a/drivers/staging/rtl8723bs/include/drv_types.h +++ b/drivers/staging/rtl8723bs/include/drv_types.h @@ -371,11 +371,11 @@ enum ADAPTER_TYPE { MAX_ADAPTER = 0xFF, }; -typedef enum _DRIVER_STATE { +enum DRIVER_STATE { DRIVER_NORMAL = 0, DRIVER_DISAPPEAR = 1, DRIVER_REPLACE_DONGLE = 2, -} DRIVER_STATE; +}; struct adapter { int DriverState;/* for disable driver using module, use dongle to replace module. */ -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:19 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:19 +0100 Subject: [PATCH 14/33] staging: rtl8723bs: remove typedefs in rtw_ioctl_set.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-15-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #13: FILE: include/rtw_ioctl_set.h:13: +typedef struct _BSSIDInfo { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtw_ioctl_set.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h index f0457e91d00f..b0cdee2df638 100644 --- a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h +++ b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h @@ -10,10 +10,10 @@ typedef u8 NDIS_802_11_PMKID_VALUE[16]; -typedef struct _BSSIDInfo { +struct BSSIDInfo { NDIS_802_11_MAC_ADDRESS BSSID; NDIS_802_11_PMKID_VALUE PMKID; -} BSSIDInfo, *PBSSIDInfo; +}; u8 rtw_set_802_11_authentication_mode(struct adapter *pdapter, enum NDIS_802_11_AUTHENTICATION_MODE authmode); -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:18 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:18 +0100 Subject: [PATCH 13/33] staging: rtl8723bs: remove typedefs in rtw_ht.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-14-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #40: FILE: include/rtw_ht.h:40: +typedef enum AGGRE_SIZE { WARNING: do not add new typedefs #51: FILE: include/rtw_ht.h:51: +typedef enum _RT_HT_INF0_CAP { WARNING: do not add new typedefs #62: FILE: include/rtw_ht.h:62: +typedef enum _RT_HT_INF1_CAP { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtw_ht.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_ht.h b/drivers/staging/rtl8723bs/include/rtw_ht.h index a72f51031f89..bce5bff3b844 100644 --- a/drivers/staging/rtl8723bs/include/rtw_ht.h +++ b/drivers/staging/rtl8723bs/include/rtw_ht.h @@ -37,7 +37,7 @@ struct ht_priv { }; -typedef enum AGGRE_SIZE { +enum AGGRE_SIZE_E { HT_AGG_SIZE_8K = 0, HT_AGG_SIZE_16K = 1, HT_AGG_SIZE_32K = 2, @@ -46,9 +46,9 @@ typedef enum AGGRE_SIZE { VHT_AGG_SIZE_256K = 5, VHT_AGG_SIZE_512K = 6, VHT_AGG_SIZE_1024K = 7, -} AGGRE_SIZE_E, *PAGGRE_SIZE_E; +}; -typedef enum _RT_HT_INF0_CAP { +enum RT_HT_INF0_CAPBILITY { RT_HT_CAP_USE_TURBO_AGGR = 0x01, RT_HT_CAP_USE_LONG_PREAMBLE = 0x02, RT_HT_CAP_USE_AMPDU = 0x04, @@ -57,13 +57,13 @@ typedef enum _RT_HT_INF0_CAP { RT_HT_CAP_USE_92SE = 0x20, RT_HT_CAP_USE_88C_92C = 0x40, RT_HT_CAP_USE_AP_CLIENT_MODE = 0x80, /* AP team request to reserve this bit, by Emily */ -} RT_HT_INF0_CAPBILITY, *PRT_HT_INF0_CAPBILITY; +}; -typedef enum _RT_HT_INF1_CAP { +enum RT_HT_INF1_CAPBILITY { RT_HT_CAP_USE_VIDEO_CLIENT = 0x01, RT_HT_CAP_USE_JAGUAR_BCUT = 0x02, RT_HT_CAP_USE_JAGUAR_CCUT = 0x04, -} RT_HT_INF1_CAPBILITY, *PRT_HT_INF1_CAPBILITY; +}; #define LDPC_HT_ENABLE_RX BIT0 #define LDPC_HT_ENABLE_TX BIT1 -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:20 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:20 +0100 Subject: [PATCH 15/33] staging: rtl8723bs: remove typedefs in wlan_bssdef.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-16-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #130: FILE: include/wlan_bssdef.h:130: +typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION { WARNING: do not add new typedefs #148: FILE: include/wlan_bssdef.h:148: +typedef struct _NDIS_802_11_KEY { WARNING: do not add new typedefs #157: FILE: include/wlan_bssdef.h:157: +typedef struct _NDIS_802_11_REMOVE_KEY { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/wlan_bssdef.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/wlan_bssdef.h b/drivers/staging/rtl8723bs/include/wlan_bssdef.h index 27cd2c5d90af..b9bc8ba21914 100644 --- a/drivers/staging/rtl8723bs/include/wlan_bssdef.h +++ b/drivers/staging/rtl8723bs/include/wlan_bssdef.h @@ -127,7 +127,7 @@ struct ndis_801_11_ai_resfi { u16 AssociationId; }; -typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION { +struct NDIS_802_11_ASSOCIATION_INFORMATION { u32 Length; u16 AvailableRequestFixedIEs; struct ndis_802_11_ai_reqfi RequestFixedIEs; @@ -137,7 +137,7 @@ typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION { struct ndis_801_11_ai_resfi ResponseFixedIEs; u32 ResponseIELength; u32 OffsetResponseIEs; -} NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION; +}; enum NDIS_802_11_RELOAD_DEFAULTS { Ndis802_11ReloadWEPKeys @@ -145,20 +145,20 @@ enum NDIS_802_11_RELOAD_DEFAULTS { /* Key mapping keys require a BSSID */ -typedef struct _NDIS_802_11_KEY { +struct NDIS_802_11_KEY { u32 Length; /* Length of this structure */ u32 KeyIndex; u32 KeyLength; /* length of key in bytes */ NDIS_802_11_MAC_ADDRESS BSSID; unsigned long long KeyRSC; u8 KeyMaterial[32]; /* variable length depending on above field */ -} NDIS_802_11_KEY, *PNDIS_802_11_KEY; +}; -typedef struct _NDIS_802_11_REMOVE_KEY { +struct NDIS_802_11_REMOVE_KEY { u32 Length; /* Length of this structure */ u32 KeyIndex; NDIS_802_11_MAC_ADDRESS BSSID; -} NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY; +}; struct ndis_802_11_wep { u32 Length; /* Length of this structure */ -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:21 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:21 +0100 Subject: [PATCH 16/33] staging: rtl8723bs: remove typedefs in rtw_mp.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-17-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #52: FILE: include/rtw_mp.h:52: +typedef struct _MPT_CONTEXT { WARNING: do not add new typedefs #268: FILE: include/rtw_mp.h:268: +typedef struct _IOCMD_STRUCT_ { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtw_mp.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_mp.h b/drivers/staging/rtl8723bs/include/rtw_mp.h index 2ea7100c3a4c..6cf598439e5c 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mp.h +++ b/drivers/staging/rtl8723bs/include/rtw_mp.h @@ -49,7 +49,7 @@ struct mp_tx { #define MP_MAX_LINES_BYTES 256 typedef void (*MPT_WORK_ITEM_HANDLER)(void *Adapter); -typedef struct _MPT_CONTEXT { +struct MPT_CONTEXT { /* Indicate if we have started Mass Production Test. */ bool bMassProdTest; @@ -148,7 +148,7 @@ typedef struct _MPT_CONTEXT { u32 mptOutLen; u8 mptOutBuf[100]; -} MPT_CONTEXT, *PMPT_CONTEXT; +}; /* endif */ /* E-Fuse */ @@ -260,16 +260,16 @@ struct mp_priv { bool bSetRxBssid; bool bTxBufCkFail; - MPT_CONTEXT MptCtx; + struct MPT_CONTEXT MptCtx; u8 *TXradomBuffer; }; -typedef struct _IOCMD_STRUCT_ { +struct IOCMD_STRUCT { u8 cmdclass; u16 value; u8 index; -} IOCMD_STRUCT; +}; struct rf_reg_param { u32 path; -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:22 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:22 +0100 Subject: [PATCH 17/33] staging: rtl8723bs: remove typedefs in osdep_service.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-18-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #83: FILE: include/osdep_service.h:83: +typedef enum mstat_status { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/osdep_service.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/osdep_service.h b/drivers/staging/rtl8723bs/include/osdep_service.h index dcc3cdce6d4b..c241bb66a23e 100644 --- a/drivers/staging/rtl8723bs/include/osdep_service.h +++ b/drivers/staging/rtl8723bs/include/osdep_service.h @@ -80,11 +80,11 @@ enum mstat_f { #define mstat_tf_idx(flags) ((flags)&0xff) #define mstat_ff_idx(flags) (((flags)&0xff00) >> 8) -typedef enum mstat_status { +enum MSTAT_STATUS { MSTAT_ALLOC_SUCCESS = 0, MSTAT_ALLOC_FAIL, MSTAT_FREE -} MSTAT_STATUS; +}; #define rtw_mstat_update(flag, status, sz) do {} while (0) #define rtw_mstat_dump(sel) do {} while (0) -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:23 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:23 +0100 Subject: [PATCH 18/33] staging: rtl8723bs: remove typedefs in rtw_security.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-19-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #87: FILE: include/rtw_security.h:87: +typedef struct _RT_PMKID_LIST { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtw_security.h | 6 +++--- drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 2 +- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 2 +- drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_security.h b/drivers/staging/rtl8723bs/include/rtw_security.h index 85ffd4ec4ce5..6c1483989ea3 100644 --- a/drivers/staging/rtl8723bs/include/rtw_security.h +++ b/drivers/staging/rtl8723bs/include/rtw_security.h @@ -84,14 +84,14 @@ union Keytype { }; -typedef struct _RT_PMKID_LIST { +struct RT_PMKID_LIST { u8 bUsed; u8 Bssid[6]; u8 PMKID[16]; u8 SsidBuf[33]; u8 *ssid_octet; u16 ssid_length; -} RT_PMKID_LIST, *PRT_PMKID_LIST; +}; struct security_priv { @@ -166,7 +166,7 @@ struct security_priv { u32 btkip_countermeasure_time; /* For WPA2 Pre-Authentication. */ - RT_PMKID_LIST PMKIDList[NUM_PMKID_CACHE]; /* Renamed from PreAuthKey[NUM_PRE_AUTH_KEY]. Annie, 2006-10-13. */ + struct RT_PMKID_LIST PMKIDList[NUM_PMKID_CACHE]; /* Renamed from PreAuthKey[NUM_PRE_AUTH_KEY]. Annie, 2006-10-13. */ u8 PMKIDIndex; u8 bWepDefaultKeyIdxSet; diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index ff164a8c8679..f0e38303022d 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -2346,7 +2346,7 @@ static int cfg80211_rtw_flush_pmksa(struct wiphy *wiphy, DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - memset(&psecuritypriv->PMKIDList[0], 0x00, sizeof(RT_PMKID_LIST) * NUM_PMKID_CACHE); + memset(&psecuritypriv->PMKIDList[0], 0x00, sizeof(struct RT_PMKID_LIST) * NUM_PMKID_CACHE); psecuritypriv->PMKIDIndex = 0; return 0; diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index 78ba2423ed65..e1d168d6ac86 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -999,7 +999,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev, } } else if (pPMK->cmd == IW_PMKSA_FLUSH) { DBG_871X("[rtw_wx_set_pmkid] IW_PMKSA_FLUSH!\n"); - memset(&psecuritypriv->PMKIDList[0], 0x00, sizeof(RT_PMKID_LIST) * NUM_PMKID_CACHE); + memset(&psecuritypriv->PMKIDList[0], 0x00, sizeof(struct RT_PMKID_LIST) * NUM_PMKID_CACHE); psecuritypriv->PMKIDIndex = 0; intReturn = true; } diff --git a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c index 20899b2cff43..ac3ae26fc385 100644 --- a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c @@ -65,7 +65,7 @@ void rtw_os_indicate_scan_done(struct adapter *padapter, bool aborted) indicate_wx_scan_complete_event(padapter); } -static RT_PMKID_LIST backupPMKIDList[NUM_PMKID_CACHE]; +static struct RT_PMKID_LIST backupPMKIDList[NUM_PMKID_CACHE]; void rtw_reset_securitypriv(struct adapter *adapter) { u8 backupPMKIDIndex = 0; @@ -84,7 +84,7 @@ void rtw_reset_securitypriv(struct adapter *adapter) /* Backup the btkip_countermeasure information. */ /* When the countermeasure is trigger, the driver have to disconnect with AP for 60 seconds. */ - memcpy(&backupPMKIDList[0], &adapter->securitypriv.PMKIDList[0], sizeof(RT_PMKID_LIST) * NUM_PMKID_CACHE); + memcpy(&backupPMKIDList[0], &adapter->securitypriv.PMKIDList[0], sizeof(struct RT_PMKID_LIST) * NUM_PMKID_CACHE); backupPMKIDIndex = adapter->securitypriv.PMKIDIndex; backupTKIPCountermeasure = adapter->securitypriv.btkip_countermeasure; backupTKIPcountermeasure_time = adapter->securitypriv.btkip_countermeasure_time; @@ -96,7 +96,7 @@ void rtw_reset_securitypriv(struct adapter *adapter) /* Added by Albert 2009/02/18 */ /* Restore the PMK information to securitypriv structure for the following connection. */ - memcpy(&adapter->securitypriv.PMKIDList[0], &backupPMKIDList[0], sizeof(RT_PMKID_LIST) * NUM_PMKID_CACHE); + memcpy(&adapter->securitypriv.PMKIDList[0], &backupPMKIDList[0], sizeof(struct RT_PMKID_LIST) * NUM_PMKID_CACHE); adapter->securitypriv.PMKIDIndex = backupPMKIDIndex; adapter->securitypriv.btkip_countermeasure = backupTKIPCountermeasure; adapter->securitypriv.btkip_countermeasure_time = backupTKIPcountermeasure_time; @@ -127,7 +127,7 @@ void rtw_reset_securitypriv(struct adapter *adapter) void rtw_os_indicate_disconnect(struct adapter *adapter) { - /* RT_PMKID_LIST backupPMKIDList[ NUM_PMKID_CACHE ]; */ + /* struct RT_PMKID_LIST backupPMKIDList[ NUM_PMKID_CACHE ]; */ netif_carrier_off(adapter->pnetdev); /* Do it first for tx broadcast pkt after disconnection issue! */ -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:24 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:24 +0100 Subject: [PATCH 19/33] staging: rtl8723bs: remove typedefs in hal_com_h2c.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-20-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #251: FILE: include/hal_com_h2c.h:251: +typedef struct _RSVDPAGE_LOC { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 20 +++++++++---------- .../staging/rtl8723bs/include/hal_com_h2c.h | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index 86f31d98349a..515b56ae9df0 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -832,7 +832,7 @@ void CheckFwRsvdPageContent(struct adapter *Adapter) { } -static void rtl8723b_set_FwRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_LOC rsvdpageloc) +static void rtl8723b_set_FwRsvdPage_cmd(struct adapter *padapter, struct RSVDPAGE_LOC *rsvdpageloc) { u8 u1H2CRsvdPageParm[H2C_RSVDPAGE_LOC_LEN] = {0}; @@ -851,7 +851,7 @@ static void rtl8723b_set_FwRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_LOC FillH2CCmd8723B(padapter, H2C_8723B_RSVD_PAGE, H2C_RSVDPAGE_LOC_LEN, u1H2CRsvdPageParm); } -static void rtl8723b_set_FwAoacRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_LOC rsvdpageloc) +static void rtl8723b_set_FwAoacRsvdPage_cmd(struct adapter *padapter, struct RSVDPAGE_LOC *rsvdpageloc) { #ifdef CONFIG_WOWLAN struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -891,7 +891,7 @@ static void rtl8723b_set_FwAoacRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_ #ifdef CONFIG_AP_WOWLAN static void rtl8723b_set_ap_wow_rsvdpage_cmd( - struct adapter *padapter, PRSVDPAGE_LOC rsvdpageloc + struct adapter *padapter, struct RSVDPAGE_LOC *rsvdpageloc ) { u8 header; @@ -1284,7 +1284,7 @@ static void rtl8723b_set_FwAOACGlobalInfo_Cmd(struct adapter *padapter, u8 grou } #ifdef CONFIG_PNO_SUPPORT -static void rtl8723b_set_FwScanOffloadInfo_cmd(struct adapter *padapter, PRSVDPAGE_LOC rsvdpageloc, u8 enable) +static void rtl8723b_set_FwScanOffloadInfo_cmd(struct adapter *padapter, struct RSVDPAGE_LOC *rsvdpageloc, u8 enable) { u8 u1H2CScanOffloadInfoParm[H2C_SCAN_OFFLOAD_CTRL_LEN] = {0}; @@ -1444,7 +1444,7 @@ static void rtl8723b_set_FwRsvdPagePkt( u8 TotalPageNum = 0, CurtPktPageNum = 0, RsvdPageNum = 0; u16 BufIndex, PageSize = 128; u32 TotalPacketLen, MaxRsvdPageBufSize = 0; - RSVDPAGE_LOC RsvdPageLoc; + struct RSVDPAGE_LOC RsvdPageLoc; #ifdef CONFIG_WOWLAN u32 ARPLegnth = 0, GTKLegnth = 0; u8 currentip[4]; @@ -1474,7 +1474,7 @@ static void rtl8723b_set_FwRsvdPagePkt( } ReservedPagePacket = pcmdframe->buf_addr; - memset(&RsvdPageLoc, 0, sizeof(RSVDPAGE_LOC)); + memset(&RsvdPageLoc, 0, sizeof(struct RSVDPAGE_LOC)); /* 3 (1) beacon */ BufIndex = TxDescOffset; @@ -1829,7 +1829,7 @@ static void rtl8723b_set_AP_FwRsvdPagePkt( u8 currentip[4]; u16 BufIndex, PageSize = 128; u32 TotalPacketLen = 0, MaxRsvdPageBufSize = 0; - RSVDPAGE_LOC RsvdPageLoc; + struct RSVDPAGE_LOC RsvdPageLoc; /* DBG_871X("%s---->\n", __func__); */ DBG_8192C("+" FUNC_ADPT_FMT ": iface_type =%d\n", @@ -1851,7 +1851,7 @@ static void rtl8723b_set_AP_FwRsvdPagePkt( } ReservedPagePacket = pcmdframe->buf_addr; - memset(&RsvdPageLoc, 0, sizeof(RSVDPAGE_LOC)); + memset(&RsvdPageLoc, 0, sizeof(struct RSVDPAGE_LOC)); /* 3 (1) beacon */ BufIndex = TxDescOffset; @@ -2136,7 +2136,7 @@ static void SetFwRsvdPagePkt_BTCoex(struct adapter *padapter) u8 TotalPageNum = 0, CurtPktPageNum = 0, RsvdPageNum = 0; u16 BufIndex, PageSize; u32 TotalPacketLen, MaxRsvdPageBufSize = 0; - RSVDPAGE_LOC RsvdPageLoc; + struct RSVDPAGE_LOC RsvdPageLoc; /* DBG_8192C("+" FUNC_ADPT_FMT "\n", FUNC_ADPT_ARG(padapter)); */ @@ -2156,7 +2156,7 @@ static void SetFwRsvdPagePkt_BTCoex(struct adapter *padapter) } ReservedPagePacket = pcmdframe->buf_addr; - memset(&RsvdPageLoc, 0, sizeof(RSVDPAGE_LOC)); + memset(&RsvdPageLoc, 0, sizeof(struct RSVDPAGE_LOC)); /* 3 (1) beacon */ BufIndex = TxDescOffset; diff --git a/drivers/staging/rtl8723bs/include/hal_com_h2c.h b/drivers/staging/rtl8723bs/include/hal_com_h2c.h index b951bc288b89..8970c59388bb 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_h2c.h +++ b/drivers/staging/rtl8723bs/include/hal_com_h2c.h @@ -248,7 +248,7 @@ enum h2c_cmd { /* */ /* Structure -------------------------------------------------- */ /* */ -typedef struct _RSVDPAGE_LOC { +struct RSVDPAGE_LOC { u8 LocProbeRsp; u8 LocPsPoll; u8 LocNullData; @@ -275,7 +275,7 @@ typedef struct _RSVDPAGE_LOC { #ifdef CONFIG_AP_WOWLAN u8 LocApOffloadBCN; #endif /* CONFIG_AP_WOWLAN */ -} RSVDPAGE_LOC, *PRSVDPAGE_LOC; +}; #endif #if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:25 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:25 +0100 Subject: [PATCH 20/33] staging: rtl8723bs: remove typedefs in rtl8723b_xmit.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-21-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #62: FILE: include/rtl8723b_xmit.h:62: +typedef struct txdesc_8723b { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 8 ++++---- drivers/staging/rtl8723bs/include/rtl8723b_xmit.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 84e963909283..26f432ea7012 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -2999,7 +2999,7 @@ static u8 fill_txdesc_sectype(struct pkt_attrib *pattrib) return sectype; } -static void fill_txdesc_vcs_8723b(struct adapter *padapter, struct pkt_attrib *pattrib, PTXDESC_8723B ptxdesc) +static void fill_txdesc_vcs_8723b(struct adapter *padapter, struct pkt_attrib *pattrib, struct TXDESC_8723B *ptxdesc) { /* DBG_8192C("cvs_mode =%d\n", pattrib->vcs_mode); */ @@ -3032,7 +3032,7 @@ static void fill_txdesc_vcs_8723b(struct adapter *padapter, struct pkt_attrib *p } } -static void fill_txdesc_phy_8723b(struct adapter *padapter, struct pkt_attrib *pattrib, PTXDESC_8723B ptxdesc) +static void fill_txdesc_phy_8723b(struct adapter *padapter, struct pkt_attrib *pattrib, struct TXDESC_8723B *ptxdesc) { /* DBG_8192C("bwmode =%d, ch_off =%d\n", pattrib->bwmode, pattrib->ch_offset); */ @@ -3052,7 +3052,7 @@ static void rtl8723b_fill_default_txdesc( struct mlme_ext_priv *pmlmeext; struct mlme_ext_info *pmlmeinfo; struct pkt_attrib *pattrib; - PTXDESC_8723B ptxdesc; + struct TXDESC_8723B *ptxdesc; s32 bmcst; memset(pbuf, 0, TXDESC_SIZE); @@ -3065,7 +3065,7 @@ static void rtl8723b_fill_default_txdesc( pattrib = &pxmitframe->attrib; bmcst = IS_MCAST(pattrib->ra); - ptxdesc = (PTXDESC_8723B)pbuf; + ptxdesc = (struct TXDESC_8723B *)pbuf; if (pxmitframe->frame_tag == DATA_FRAMETAG) { u8 drv_userate = 0; diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h b/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h index 243d36d9bc7b..45573336ead2 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h @@ -59,7 +59,7 @@ /* */ /* defined for TX DESC Operation */ /* */ -typedef struct txdesc_8723b { +struct TXDESC_8723B { /* Offset 0 */ u32 pktlen:16; u32 offset:8; @@ -175,7 +175,7 @@ typedef struct txdesc_8723b { u32 txbf_path:1; u32 seq:12; u32 final_data_rate:8; -} TXDESC_8723B, *PTXDESC_8723B; +}; #ifndef __INC_HAL8723BDESC_H #define __INC_HAL8723BDESC_H -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:26 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:26 +0100 Subject: [PATCH 21/33] staging: rtl8723bs: remove typedefs in HalVerDef.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-22-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #11: FILE: include/HalVerDef.h:11: +typedef enum tag_HAL_IC_Type_Definition { WARNING: do not add new typedefs #25: FILE: include/HalVerDef.h:25: +typedef enum tag_HAL_CHIP_Type_Definition { WARNING: do not add new typedefs #32: FILE: include/HalVerDef.h:32: +typedef enum tag_HAL_Cut_Version_Definition { WARNING: do not add new typedefs #47: FILE: include/HalVerDef.h:47: +typedef enum tag_HAL_Manufacturer_Version_Definition { WARNING: do not add new typedefs #53: FILE: include/HalVerDef.h:53: +typedef enum tag_HAL_RF_Type_Definition { WARNING: do not add new typedefs #64: FILE: include/HalVerDef.h:64: +typedef struct tag_HAL_VERSION { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/hal_com.c | 2 +- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 4 +- drivers/staging/rtl8723bs/include/HalVerDef.h | 44 +++++++++---------- drivers/staging/rtl8723bs/include/hal_com.h | 2 +- drivers/staging/rtl8723bs/include/hal_data.h | 2 +- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 34b8354dbc03..9eaf35e8e442 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -38,7 +38,7 @@ void rtw_hal_data_deinit(struct adapter *padapter) } -void dump_chip_info(HAL_VERSION ChipVersion) +void dump_chip_info(struct HAL_VERSION ChipVersion) { char buf[128]; size_t cnt = 0; diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 26f432ea7012..55c95b38a452 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -1880,10 +1880,10 @@ static bool Hal_EfusePgPacketWrite_BT( return true; } -static HAL_VERSION ReadChipVersion8723B(struct adapter *padapter) +static struct HAL_VERSION ReadChipVersion8723B(struct adapter *padapter) { u32 value32; - HAL_VERSION ChipVersion; + struct HAL_VERSION ChipVersion; struct hal_com_data *pHalData; /* YJ, TODO, move read chip type here */ diff --git a/drivers/staging/rtl8723bs/include/HalVerDef.h b/drivers/staging/rtl8723bs/include/HalVerDef.h index b4744be2cbe1..11055147a2a2 100644 --- a/drivers/staging/rtl8723bs/include/HalVerDef.h +++ b/drivers/staging/rtl8723bs/include/HalVerDef.h @@ -8,7 +8,7 @@ #define __HAL_VERSION_DEF_H__ /* HAL_IC_TYPE_E */ -typedef enum tag_HAL_IC_Type_Definition { +enum HAL_IC_TYPE_E { /* tag_HAL_IC_Type_Definition */ CHIP_8192S = 0, CHIP_8188C = 1, CHIP_8192C = 2, @@ -19,17 +19,17 @@ typedef enum tag_HAL_IC_Type_Definition { CHIP_8821 = 7, CHIP_8723B = 8, CHIP_8192E = 9, -} HAL_IC_TYPE_E; +}; /* HAL_CHIP_TYPE_E */ -typedef enum tag_HAL_CHIP_Type_Definition { +enum HAL_CHIP_TYPE_E { /* tag_HAL_CHIP_Type_Definition */ TEST_CHIP = 0, NORMAL_CHIP = 1, FPGA = 2, -} HAL_CHIP_TYPE_E; +}; /* HAL_CUT_VERSION_E */ -typedef enum tag_HAL_Cut_Version_Definition { +enum HAL_CUT_VERSION_E { /* tag_HAL_Cut_Version_Definition */ A_CUT_VERSION = 0, B_CUT_VERSION = 1, C_CUT_VERSION = 2, @@ -41,16 +41,16 @@ typedef enum tag_HAL_Cut_Version_Definition { I_CUT_VERSION = 8, J_CUT_VERSION = 9, K_CUT_VERSION = 10, -} HAL_CUT_VERSION_E; +}; /* HAL_Manufacturer */ -typedef enum tag_HAL_Manufacturer_Version_Definition { +enum HAL_VENDOR_E { /* tag_HAL_Manufacturer_Version_Definition */ CHIP_VENDOR_TSMC = 0, CHIP_VENDOR_UMC = 1, CHIP_VENDOR_SMIC = 2, -} HAL_VENDOR_E; +}; -typedef enum tag_HAL_RF_Type_Definition { +enum HAL_RF_TYPE_E { /* tag_HAL_RF_Type_Definition */ RF_TYPE_1T1R = 0, RF_TYPE_1T2R = 1, RF_TYPE_2T2R = 2, @@ -59,26 +59,26 @@ typedef enum tag_HAL_RF_Type_Definition { RF_TYPE_3T3R = 5, RF_TYPE_3T4R = 6, RF_TYPE_4T4R = 7, -} HAL_RF_TYPE_E; +}; -typedef struct tag_HAL_VERSION { - HAL_IC_TYPE_E ICType; - HAL_CHIP_TYPE_E ChipType; - HAL_CUT_VERSION_E CUTVersion; - HAL_VENDOR_E VendorType; - HAL_RF_TYPE_E RFType; +struct HAL_VERSION { /* tag_HAL_VERSION */ + enum HAL_IC_TYPE_E ICType; + enum HAL_CHIP_TYPE_E ChipType; + enum HAL_CUT_VERSION_E CUTVersion; + enum HAL_VENDOR_E VendorType; + enum HAL_RF_TYPE_E RFType; u8 ROMVer; -} HAL_VERSION, *PHAL_VERSION; +}; /* VERSION_8192C VersionID; */ /* HAL_VERSION VersionID; */ /* Get element */ -#define GET_CVID_IC_TYPE(version) ((HAL_IC_TYPE_E)((version).ICType)) -#define GET_CVID_CHIP_TYPE(version) ((HAL_CHIP_TYPE_E)((version).ChipType)) -#define GET_CVID_RF_TYPE(version) ((HAL_RF_TYPE_E)((version).RFType)) -#define GET_CVID_MANUFACTUER(version) ((HAL_VENDOR_E)((version).VendorType)) -#define GET_CVID_CUT_VERSION(version) ((HAL_CUT_VERSION_E)((version).CUTVersion)) +#define GET_CVID_IC_TYPE(version) ((enum HAL_IC_TYPE_E)((version).ICType)) +#define GET_CVID_CHIP_TYPE(version) ((enum HAL_CHIP_TYPE_E)((version).ChipType)) +#define GET_CVID_RF_TYPE(version) ((enum HAL_RF_TYPE_E)((version).RFType)) +#define GET_CVID_MANUFACTUER(version) ((enum HAL_VENDOR_E)((version).VendorType)) +#define GET_CVID_CUT_VERSION(version) ((enum HAL_CUT_VERSION_E)((version).CUTVersion)) #define GET_CVID_ROM_VERSION(version) (((version).ROMVer) & ROM_VERSION_MASK) /* */ diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h index 5c4268955275..c4b83eb16326 100644 --- a/drivers/staging/rtl8723bs/include/hal_com.h +++ b/drivers/staging/rtl8723bs/include/hal_com.h @@ -193,7 +193,7 @@ enum FIRMWARE_SOURCE { u8 rtw_hal_data_init(struct adapter *padapter); void rtw_hal_data_deinit(struct adapter *padapter); -void dump_chip_info(HAL_VERSION ChipVersion); +void dump_chip_info(struct HAL_VERSION ChipVersion); u8 /* return the final channel plan decision */ hal_com_config_channel_plan( diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h index 04efd09fc628..c933dc6cada2 100644 --- a/drivers/staging/rtl8723bs/include/hal_data.h +++ b/drivers/staging/rtl8723bs/include/hal_data.h @@ -176,7 +176,7 @@ struct dm_priv { struct hal_com_data { - HAL_VERSION VersionID; + struct HAL_VERSION VersionID; enum RT_MULTI_FUNC MultiFunc; /* For multi-function consideration. */ enum RT_POLARITY_CTL PolarityCtl; /* For Wifi PDn Polarity control. */ enum RT_REGULATOR_MODE RegulatorMode; /* switching regulator or LDO */ -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:27 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:27 +0100 Subject: [PATCH 22/33] staging: rtl8723bs: remove typedefs in rtl8723b_hal.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-23-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #173: FILE: include/rtl8723b_hal.h:173: +typedef enum _C2H_EVT { WARNING: do not add new typedefs #189: FILE: include/rtl8723b_hal.h:189: +typedef struct _C2H_EVT_HDR { WARNING: do not add new typedefs #195: FILE: include/rtl8723b_hal.h:195: +typedef enum tag_Package_Definition { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 4 ++-- drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c | 2 +- drivers/staging/rtl8723bs/include/rtl8723b_hal.h | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 55c95b38a452..8d4b87131f54 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -3706,7 +3706,7 @@ s32 c2h_handler_8723b(struct adapter *padapter, u8 *buf) return ret; } -static void process_c2h_event(struct adapter *padapter, PC2H_EVT_HDR pC2hEvent, u8 *c2hBuf) +static void process_c2h_event(struct adapter *padapter, struct C2H_EVT_HDR *pC2hEvent, u8 *c2hBuf) { u8 index = 0; @@ -3750,7 +3750,7 @@ static void process_c2h_event(struct adapter *padapter, PC2H_EVT_HDR pC2hEvent, void C2HPacketHandler_8723B(struct adapter *padapter, u8 *pbuffer, u16 length) { - C2H_EVT_HDR C2hEvent; + struct C2H_EVT_HDR C2hEvent; u8 *tmpBuf = NULL; #ifdef CONFIG_WOWLAN struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c index 2d15a5f7648d..415e519e8aa0 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c @@ -349,7 +349,7 @@ static void rtl8723bs_recv_tasklet(struct tasklet_struct *t) RT_TRACE(_module_rtl871x_recv_c_, _drv_dump_, ("%s: rtw_recv_entry(precvframe) != _SUCCESS\n", __func__)); } } else if (pattrib->pkt_rpt_type == C2H_PACKET) { - C2H_EVT_HDR C2hEvent; + struct C2H_EVT_HDR C2hEvent; u16 len_c2h = pattrib->pkt_len; u8 *pbuf_c2h = precvframe->u.hdr.rx_data; diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index 8e6e972dd843..03024eea46d2 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -170,7 +170,7 @@ struct rt_firmware_hdr { /* Description: Determine the types of C2H events that are the same in driver * and FW; First constructed by tynli. 2009.10.09. */ -typedef enum _C2H_EVT { +enum C2H_EVT { C2H_DBG = 0, C2H_TSF = 1, C2H_AP_RPT_RSP = 2, @@ -184,21 +184,21 @@ typedef enum _C2H_EVT { C2H_HW_INFO_EXCH = 10, C2H_8723B_BT_MP_INFO = 11, MAX_C2HEVENT -} C2H_EVT; +}; -typedef struct _C2H_EVT_HDR { +struct C2H_EVT_HDR { u8 CmdID; u8 CmdLen; u8 CmdSeq; -} __attribute__((__packed__)) C2H_EVT_HDR, *PC2H_EVT_HDR; +} __attribute__((__packed__)); -typedef enum tag_Package_Definition { +enum PACKAGE_TYPE_E { /* tag_Package_Definition */ PACKAGE_DEFAULT, PACKAGE_QFN68, PACKAGE_TFBGA90, PACKAGE_TFBGA80, PACKAGE_TFBGA79 -} PACKAGE_TYPE_E; +}; #define INCLUDE_MULTI_FUNC_BT(_Adapter) \ (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_BT) -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:28 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:28 +0100 Subject: [PATCH 23/33] staging: rtl8723bs: remove typedefs in rtw_mlme_ext.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-24-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #118: FILE: include/rtw_mlme_ext.h:118: +typedef enum _RT_CHANNEL_DOMAIN { WARNING: do not add new typedefs #186: FILE: include/rtw_mlme_ext.h:186: +typedef enum _RT_CHANNEL_DOMAIN_2G { WARNING: do not add new typedefs #198: FILE: include/rtw_mlme_ext.h:198: +typedef enum _RT_CHANNEL_DOMAIN_5G { WARNING: do not add new typedefs #241: FILE: include/rtw_mlme_ext.h:241: +typedef struct _RT_CHANNEL_PLAN { WARNING: do not add new typedefs #246: FILE: include/rtw_mlme_ext.h:246: +typedef struct _RT_CHANNEL_PLAN_2G { WARNING: do not add new typedefs #251: FILE: include/rtw_mlme_ext.h:251: +typedef struct _RT_CHANNEL_PLAN_5G { WARNING: do not add new typedefs #256: FILE: include/rtw_mlme_ext.h:256: +typedef struct _RT_CHANNEL_PLAN_MAP { WARNING: do not add new typedefs #273: FILE: include/rtw_mlme_ext.h:273: +typedef enum _HT_IOT_PEER { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 24 +++++------ .../staging/rtl8723bs/include/rtw_mlme_ext.h | 40 +++++++++---------- drivers/staging/rtl8723bs/os_dep/wifi_regd.c | 2 +- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index 8ab5b38e8fc1..f542805a461c 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -71,7 +71,7 @@ static unsigned char REALTEK_96B_IE[] = {0x00, 0xe0, 0x4c, 0x02, 0x01, 0x20}; /******************************************************** ChannelPlan definitions *********************************************************/ -static RT_CHANNEL_PLAN_2G RTW_ChannelPlan2G[RT_CHANNEL_DOMAIN_2G_MAX] = { +static struct RT_CHANNEL_PLAN_2G RTW_ChannelPlan2G[RT_CHANNEL_DOMAIN_2G_MAX] = { {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, /* 0x00, RT_CHANNEL_DOMAIN_2G_WORLD , Passive scan CH 12, 13 */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, /* 0x01, RT_CHANNEL_DOMAIN_2G_ETSI1 */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 11}, /* 0x02, RT_CHANNEL_DOMAIN_2G_FCC1 */ @@ -81,7 +81,7 @@ static RT_CHANNEL_PLAN_2G RTW_ChannelPlan2G[RT_CHANNEL_DOMAIN_2G_MAX] = { {{}, 0}, /* 0x06, RT_CHANNEL_DOMAIN_2G_NULL */ }; -static RT_CHANNEL_PLAN_5G RTW_ChannelPlan5G[RT_CHANNEL_DOMAIN_5G_MAX] = { +static struct RT_CHANNEL_PLAN_5G RTW_ChannelPlan5G[RT_CHANNEL_DOMAIN_5G_MAX] = { {{}, 0}, /* 0x00, RT_CHANNEL_DOMAIN_5G_NULL */ {{36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}, 19}, /* 0x01, RT_CHANNEL_DOMAIN_5G_ETSI1 */ {{36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165}, 24}, /* 0x02, RT_CHANNEL_DOMAIN_5G_ETSI2 */ @@ -121,7 +121,7 @@ static RT_CHANNEL_PLAN_5G RTW_ChannelPlan5G[RT_CHANNEL_DOMAIN_5G_MAX] = { {{36, 40, 44, 48, 149, 153, 157, 161}, 8}, /* 0x22, RT_CHANNEL_DOMAIN_5G_FCC4_NO_DFS */ }; -static RT_CHANNEL_PLAN_MAP RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = { +static struct RT_CHANNEL_PLAN_MAP RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = { /* 0x00 ~ 0x1F , Old Define ===== */ {0x02, 0x20}, /* 0x00, RT_CHANNEL_DOMAIN_FCC */ {0x02, 0x0A}, /* 0x01, RT_CHANNEL_DOMAIN_IC */ @@ -209,7 +209,7 @@ static RT_CHANNEL_PLAN_MAP RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = { }; /* use the combination for max channel numbers */ -static RT_CHANNEL_PLAN_MAP RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE = {0x03, 0x02}; +static struct RT_CHANNEL_PLAN_MAP RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE = {0x03, 0x02}; /* Search the @param ch in given @param ch_set * @ch_set: the given channel set @@ -217,7 +217,7 @@ static RT_CHANNEL_PLAN_MAP RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE = {0x03, 0x02}; * * return the index of channel_num in channel_set, -1 if not found */ -int rtw_ch_set_search_ch(RT_CHANNEL_INFO *ch_set, const u32 ch) +int rtw_ch_set_search_ch(struct RT_CHANNEL_INFO *ch_set, const u32 ch) { int i; @@ -325,7 +325,7 @@ static void init_mlme_ext_priv_value(struct adapter *padapter) pmlmeext->action_public_dialog_token = 0xff; } -static int has_channel(RT_CHANNEL_INFO *channel_set, +static int has_channel(struct RT_CHANNEL_INFO *channel_set, u8 chanset_size, u8 chan) { @@ -340,7 +340,7 @@ static int has_channel(RT_CHANNEL_INFO *channel_set, return 0; } -static void init_channel_list(struct adapter *padapter, RT_CHANNEL_INFO *channel_set, +static void init_channel_list(struct adapter *padapter, struct RT_CHANNEL_INFO *channel_set, u8 chanset_size, struct p2p_channels *channel_list) { @@ -392,13 +392,13 @@ static void init_channel_list(struct adapter *padapter, RT_CHANNEL_INFO *channel } -static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, RT_CHANNEL_INFO *channel_set) +static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, struct RT_CHANNEL_INFO *channel_set) { u8 index, chanset_size = 0; u8 b5GBand = false, b2_4GBand = false; u8 Index2G = 0, Index5G = 0; - memset(channel_set, 0, sizeof(RT_CHANNEL_INFO)*MAX_CHANNEL_NUM); + memset(channel_set, 0, sizeof(struct RT_CHANNEL_INFO)*MAX_CHANNEL_NUM); if (ChannelPlan >= RT_CHANNEL_DOMAIN_MAX && ChannelPlan != RT_CHANNEL_DOMAIN_REALTEK_DEFINE) { DBG_871X("ChannelPlan ID %x error !!!!!\n", ChannelPlan); @@ -4767,7 +4767,7 @@ static void process_80211d(struct adapter *padapter, struct wlan_bssid_ex *bssid { struct registry_priv *pregistrypriv; struct mlme_ext_priv *pmlmeext; - RT_CHANNEL_INFO *chplan_new; + struct RT_CHANNEL_INFO *chplan_new; u8 channel; u8 i; @@ -4780,8 +4780,8 @@ static void process_80211d(struct adapter *padapter, struct wlan_bssid_ex *bssid (!pmlmeext->update_channel_plan_by_ap_done)) { u8 *ie, *p; u32 len; - RT_CHANNEL_PLAN chplan_ap; - RT_CHANNEL_INFO chplan_sta[MAX_CHANNEL_NUM]; + struct RT_CHANNEL_PLAN chplan_ap; + struct RT_CHANNEL_INFO chplan_sta[MAX_CHANNEL_NUM]; u8 country[4]; u8 fcn; /* first channel number */ u8 noc; /* number of channel */ diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h index ed6b03c25367..6aa3805b7abd 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h @@ -115,7 +115,7 @@ extern unsigned char WMM_PARA_OUI[]; /* If you just wnat to customize the acitions(scan period or join actions) about one of the channel plan, */ /* customize them in RT_CHANNEL_INFO in the RT_CHANNEL_LIST. */ /* */ -typedef enum _RT_CHANNEL_DOMAIN { +enum RT_CHANNEL_DOMAIN { /* old channel plan mapping ===== */ RT_CHANNEL_DOMAIN_FCC = 0x00, RT_CHANNEL_DOMAIN_IC = 0x01, @@ -181,9 +181,9 @@ typedef enum _RT_CHANNEL_DOMAIN { /* Add new channel plan above this line =============== */ RT_CHANNEL_DOMAIN_MAX, RT_CHANNEL_DOMAIN_REALTEK_DEFINE = 0x7F, -} RT_CHANNEL_DOMAIN, *PRT_CHANNEL_DOMAIN; +}; -typedef enum _RT_CHANNEL_DOMAIN_2G { +enum RT_CHANNEL_DOMAIN_2G { RT_CHANNEL_DOMAIN_2G_WORLD = 0x00, /* Worldwird 13 */ RT_CHANNEL_DOMAIN_2G_ETSI1 = 0x01, /* Europe */ RT_CHANNEL_DOMAIN_2G_FCC1 = 0x02, /* US */ @@ -193,9 +193,9 @@ typedef enum _RT_CHANNEL_DOMAIN_2G { RT_CHANNEL_DOMAIN_2G_NULL = 0x06, /* Add new channel plan above this line =============== */ RT_CHANNEL_DOMAIN_2G_MAX, -} RT_CHANNEL_DOMAIN_2G, *PRT_CHANNEL_DOMAIN_2G; +}; -typedef enum _RT_CHANNEL_DOMAIN_5G { +enum RT_CHANNEL_DOMAIN_5G { RT_CHANNEL_DOMAIN_5G_NULL = 0x00, RT_CHANNEL_DOMAIN_5G_ETSI1 = 0x01, /* Europe */ RT_CHANNEL_DOMAIN_5G_ETSI2 = 0x02, /* Australia, New Zealand */ @@ -234,29 +234,29 @@ typedef enum _RT_CHANNEL_DOMAIN_5G { RT_CHANNEL_DOMAIN_5G_JAPAN_NO_DFS = 0x21, RT_CHANNEL_DOMAIN_5G_FCC4_NO_DFS = 0x22, RT_CHANNEL_DOMAIN_5G_MAX, -} RT_CHANNEL_DOMAIN_5G, *PRT_CHANNEL_DOMAIN_5G; +}; #define rtw_is_channel_plan_valid(chplan) (chplan < RT_CHANNEL_DOMAIN_MAX || chplan == RT_CHANNEL_DOMAIN_REALTEK_DEFINE) -typedef struct _RT_CHANNEL_PLAN { +struct RT_CHANNEL_PLAN { unsigned char Channel[MAX_CHANNEL_NUM]; unsigned char Len; -} RT_CHANNEL_PLAN, *PRT_CHANNEL_PLAN; +}; -typedef struct _RT_CHANNEL_PLAN_2G { +struct RT_CHANNEL_PLAN_2G { unsigned char Channel[MAX_CHANNEL_NUM_2G]; unsigned char Len; -} RT_CHANNEL_PLAN_2G, *PRT_CHANNEL_PLAN_2G; +}; -typedef struct _RT_CHANNEL_PLAN_5G { +struct RT_CHANNEL_PLAN_5G { unsigned char Channel[MAX_CHANNEL_NUM_5G]; unsigned char Len; -} RT_CHANNEL_PLAN_5G, *PRT_CHANNEL_PLAN_5G; +}; -typedef struct _RT_CHANNEL_PLAN_MAP { +struct RT_CHANNEL_PLAN_MAP { unsigned char Index2G; unsigned char Index5G; -} RT_CHANNEL_PLAN_MAP, *PRT_CHANNEL_PLAN_MAP; +}; enum Associated_AP { atherosAP = 0, @@ -270,7 +270,7 @@ enum Associated_AP { maxAP, }; -typedef enum _HT_IOT_PEER { +enum HT_IOT_PEER_E { HT_IOT_PEER_UNKNOWN = 0, HT_IOT_PEER_REALTEK = 1, HT_IOT_PEER_REALTEK_92SE = 2, @@ -290,7 +290,7 @@ typedef enum _HT_IOT_PEER { HT_IOT_PEER_REALTEK_JAGUAR_BCUTAP = 16, HT_IOT_PEER_REALTEK_JAGUAR_CCUTAP = 17, HT_IOT_PEER_MAX = 18 -} HT_IOT_PEER_E, *PHTIOT_PEER_E; +}; enum SCAN_STATE { @@ -417,12 +417,12 @@ struct mlme_ext_info { }; /* The channel information about this channel including joining, scanning, and power constraints. */ -typedef struct _RT_CHANNEL_INFO { +struct RT_CHANNEL_INFO { u8 ChannelNum; /* The channel number. */ enum RT_SCAN_TYPE ScanType; /* Scan type such as passive or active scan. */ -} RT_CHANNEL_INFO, *PRT_CHANNEL_INFO; +}; -int rtw_ch_set_search_ch(RT_CHANNEL_INFO *ch_set, const u32 ch); +int rtw_ch_set_search_ch(struct RT_CHANNEL_INFO *ch_set, const u32 ch); bool rtw_mlme_band_check(struct adapter *adapter, const u32 ch); /* P2P_MAX_REG_CLASSES - Maximum number of regulatory classes */ @@ -474,7 +474,7 @@ struct mlme_ext_priv { unsigned char cur_wireless_mode; /* NETWORK_TYPE */ unsigned char max_chan_nums; - RT_CHANNEL_INFO channel_set[MAX_CHANNEL_NUM]; + struct RT_CHANNEL_INFO channel_set[MAX_CHANNEL_NUM]; struct p2p_channels channel_list; unsigned char basicrate[NumRates]; unsigned char datarate[NumRates]; diff --git a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c index 3f04b7a954ba..b3d87a971398 100644 --- a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c +++ b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c @@ -61,7 +61,7 @@ static void _rtw_reg_apply_flags(struct wiphy *wiphy) { struct adapter *padapter = wiphy_to_adapter(wiphy); struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - RT_CHANNEL_INFO *channel_set = pmlmeext->channel_set; + struct RT_CHANNEL_INFO *channel_set = pmlmeext->channel_set; u8 max_chan_nums = pmlmeext->max_chan_nums; struct ieee80211_supported_band *sband; -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:29 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:29 +0100 Subject: [PATCH 24/33] staging: rtl8723bs: remove typedefs in HalPwrSeqCmd.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-25-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #85: FILE: include/HalPwrSeqCmd.h:85: +typedef enum _PWRSEQ_CMD_DELAY_UNIT_ { WARNING: do not add new typedefs #90: FILE: include/HalPwrSeqCmd.h:90: +typedef struct _WL_PWR_CFG_ { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c | 4 ++-- drivers/staging/rtl8723bs/hal/hal_pwr_seq.c | 22 +++++++++---------- .../staging/rtl8723bs/include/HalPwrSeqCmd.h | 10 ++++----- .../staging/rtl8723bs/include/hal_pwr_seq.h | 22 +++++++++---------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c b/drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c index 3b34a516075f..c1c9914d9b49 100644 --- a/drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c +++ b/drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c @@ -39,10 +39,10 @@ u8 HalPwrSeqCmdParsing( u8 CutVersion, u8 FabVersion, u8 InterfaceType, - WLAN_PWR_CFG PwrSeqCmd[] + struct WLAN_PWR_CFG PwrSeqCmd[] ) { - WLAN_PWR_CFG PwrCfgCmd; + struct WLAN_PWR_CFG PwrCfgCmd; u8 bPollingBit = false; u32 AryIdx = 0; u8 value = 0; diff --git a/drivers/staging/rtl8723bs/hal/hal_pwr_seq.c b/drivers/staging/rtl8723bs/hal/hal_pwr_seq.c index 589e7aae7bbd..2a80da26f572 100644 --- a/drivers/staging/rtl8723bs/hal/hal_pwr_seq.c +++ b/drivers/staging/rtl8723bs/hal/hal_pwr_seq.c @@ -21,7 +21,7 @@ Major Change History: /* drivers should parse below arrays and do the corresponding actions */ /* 3 Power on Array */ -WLAN_PWR_CFG rtl8723B_power_on_flow[ +struct WLAN_PWR_CFG rtl8723B_power_on_flow[ RTL8723B_TRANS_CARDEMU_TO_ACT_STEPS+ RTL8723B_TRANS_END_STEPS ] = { @@ -30,7 +30,7 @@ WLAN_PWR_CFG rtl8723B_power_on_flow[ }; /* 3Radio off GPIO Array */ -WLAN_PWR_CFG rtl8723B_radio_off_flow[ +struct WLAN_PWR_CFG rtl8723B_radio_off_flow[ RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+ RTL8723B_TRANS_END_STEPS ] = { @@ -39,7 +39,7 @@ WLAN_PWR_CFG rtl8723B_radio_off_flow[ }; /* 3Card Disable Array */ -WLAN_PWR_CFG rtl8723B_card_disable_flow[ +struct WLAN_PWR_CFG rtl8723B_card_disable_flow[ RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+ RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+ RTL8723B_TRANS_END_STEPS @@ -50,7 +50,7 @@ WLAN_PWR_CFG rtl8723B_card_disable_flow[ }; /* 3 Card Enable Array */ -WLAN_PWR_CFG rtl8723B_card_enable_flow[ +struct WLAN_PWR_CFG rtl8723B_card_enable_flow[ RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+ RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+ RTL8723B_TRANS_END_STEPS @@ -61,7 +61,7 @@ WLAN_PWR_CFG rtl8723B_card_enable_flow[ }; /* 3Suspend Array */ -WLAN_PWR_CFG rtl8723B_suspend_flow[ +struct WLAN_PWR_CFG rtl8723B_suspend_flow[ RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+ RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+ RTL8723B_TRANS_END_STEPS @@ -72,7 +72,7 @@ WLAN_PWR_CFG rtl8723B_suspend_flow[ }; /* 3 Resume Array */ -WLAN_PWR_CFG rtl8723B_resume_flow[ +struct WLAN_PWR_CFG rtl8723B_resume_flow[ RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+ RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+ RTL8723B_TRANS_END_STEPS @@ -83,7 +83,7 @@ WLAN_PWR_CFG rtl8723B_resume_flow[ }; /* 3HWPDN Array */ -WLAN_PWR_CFG rtl8723B_hwpdn_flow[ +struct WLAN_PWR_CFG rtl8723B_hwpdn_flow[ RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+ RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+ RTL8723B_TRANS_END_STEPS @@ -94,7 +94,7 @@ WLAN_PWR_CFG rtl8723B_hwpdn_flow[ }; /* 3 Enter LPS */ -WLAN_PWR_CFG rtl8723B_enter_lps_flow[ +struct WLAN_PWR_CFG rtl8723B_enter_lps_flow[ RTL8723B_TRANS_ACT_TO_LPS_STEPS+RTL8723B_TRANS_END_STEPS ] = { /* FW behavior */ @@ -103,7 +103,7 @@ WLAN_PWR_CFG rtl8723B_enter_lps_flow[ }; /* 3 Leave LPS */ -WLAN_PWR_CFG rtl8723B_leave_lps_flow[ +struct WLAN_PWR_CFG rtl8723B_leave_lps_flow[ RTL8723B_TRANS_LPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS ] = { /* FW behavior */ @@ -112,7 +112,7 @@ WLAN_PWR_CFG rtl8723B_leave_lps_flow[ }; /* 3 Enter SW LPS */ -WLAN_PWR_CFG rtl8723B_enter_swlps_flow[ +struct WLAN_PWR_CFG rtl8723B_enter_swlps_flow[ RTL8723B_TRANS_ACT_TO_SWLPS_STEPS+RTL8723B_TRANS_END_STEPS ] = { /* SW behavior */ @@ -121,7 +121,7 @@ WLAN_PWR_CFG rtl8723B_enter_swlps_flow[ }; /* 3 Leave SW LPS */ -WLAN_PWR_CFG rtl8723B_leave_swlps_flow[ +struct WLAN_PWR_CFG rtl8723B_leave_swlps_flow[ RTL8723B_TRANS_SWLPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS ] = { /* SW behavior */ diff --git a/drivers/staging/rtl8723bs/include/HalPwrSeqCmd.h b/drivers/staging/rtl8723bs/include/HalPwrSeqCmd.h index 459f2f9d4bbb..56c87ed17e48 100644 --- a/drivers/staging/rtl8723bs/include/HalPwrSeqCmd.h +++ b/drivers/staging/rtl8723bs/include/HalPwrSeqCmd.h @@ -82,12 +82,12 @@ #define PWR_CUT_ALL_MSK 0xFF -typedef enum _PWRSEQ_CMD_DELAY_UNIT_ { +enum PWRSEQ_CMD_DELAY_UNIT { PWRSEQ_DELAY_US, PWRSEQ_DELAY_MS, -} PWRSEQ_DELAY_UNIT; +}; -typedef struct _WL_PWR_CFG_ { +struct WLAN_PWR_CFG { u16 offset; u8 cut_msk; u8 fab_msk:4; @@ -96,7 +96,7 @@ typedef struct _WL_PWR_CFG_ { u8 cmd:4; u8 msk; u8 value; -} WLAN_PWR_CFG, *PWLAN_PWR_CFG; +}; #define GET_PWR_CFG_OFFSET(__PWR_CMD) __PWR_CMD.offset @@ -117,6 +117,6 @@ u8 HalPwrSeqCmdParsing( u8 CutVersion, u8 FabVersion, u8 InterfaceType, - WLAN_PWR_CFG PwrCfgCmd[]); + struct WLAN_PWR_CFG PwrCfgCmd[]); #endif diff --git a/drivers/staging/rtl8723bs/include/hal_pwr_seq.h b/drivers/staging/rtl8723bs/include/hal_pwr_seq.h index 28aca047dce6..7c5fbf0b9736 100644 --- a/drivers/staging/rtl8723bs/include/hal_pwr_seq.h +++ b/drivers/staging/rtl8723bs/include/hal_pwr_seq.h @@ -219,15 +219,15 @@ {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, 0, PWR_CMD_END, 0, 0}, -extern WLAN_PWR_CFG rtl8723B_power_on_flow[RTL8723B_TRANS_CARDEMU_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723B_radio_off_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723B_card_disable_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723B_card_enable_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723B_suspend_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723B_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723B_resume_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723B_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723B_hwpdn_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723B_enter_lps_flow[RTL8723B_TRANS_ACT_TO_LPS_STEPS+RTL8723B_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723B_leave_lps_flow[RTL8723B_TRANS_LPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723B_enter_swlps_flow[RTL8723B_TRANS_ACT_TO_SWLPS_STEPS+RTL8723B_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723B_leave_swlps_flow[RTL8723B_TRANS_SWLPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct WLAN_PWR_CFG rtl8723B_power_on_flow[RTL8723B_TRANS_CARDEMU_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct WLAN_PWR_CFG rtl8723B_radio_off_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct WLAN_PWR_CFG rtl8723B_card_disable_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct WLAN_PWR_CFG rtl8723B_card_enable_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct WLAN_PWR_CFG rtl8723B_suspend_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct WLAN_PWR_CFG rtl8723B_resume_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct WLAN_PWR_CFG rtl8723B_hwpdn_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct WLAN_PWR_CFG rtl8723B_enter_lps_flow[RTL8723B_TRANS_ACT_TO_LPS_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct WLAN_PWR_CFG rtl8723B_leave_lps_flow[RTL8723B_TRANS_LPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct WLAN_PWR_CFG rtl8723B_enter_swlps_flow[RTL8723B_TRANS_ACT_TO_SWLPS_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct WLAN_PWR_CFG rtl8723B_leave_swlps_flow[RTL8723B_TRANS_SWLPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS]; #endif -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:31 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:31 +0100 Subject: [PATCH 26/33] staging: rtl8723bs: remove typedefs in ieee80211.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-27-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #128: FILE: include/ieee80211.h:128: +typedef enum _RATEID_IDX_ { WARNING: do not add new typedefs #142: FILE: include/ieee80211.h:142: +typedef enum _RATR_TABLE_MODE { WARNING: do not add new typedefs #986: FILE: include/ieee80211.h:986: +typedef enum { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 } ParseRes; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 2 +- drivers/staging/rtl8723bs/include/ieee80211.h | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c index be4cffce4f5d..a2a97826197a 100644 --- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c @@ -958,7 +958,7 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, * @show_errors: Whether to show parsing errors in debug log * Returns: Parsing result */ -ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len, +enum ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len, struct rtw_ieee802_11_elems *elems, int show_errors) { diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h index f80db2c984a4..10b599f835bb 100644 --- a/drivers/staging/rtl8723bs/include/ieee80211.h +++ b/drivers/staging/rtl8723bs/include/ieee80211.h @@ -125,7 +125,7 @@ extern u8 RSN_CIPHER_SUITE_CCMP[]; extern u8 RSN_CIPHER_SUITE_WEP104[]; -typedef enum _RATEID_IDX_ { +enum RATEID_IDX { RATEID_IDX_BGN_40M_2SS = 0, RATEID_IDX_BGN_40M_1SS = 1, RATEID_IDX_BGN_20M_2SS_BN = 2, @@ -137,9 +137,9 @@ typedef enum _RATEID_IDX_ { RATEID_IDX_B = 8, RATEID_IDX_VHT_2SS = 9, RATEID_IDX_VHT_1SS = 10, -} RATEID_IDX, *PRATEID_IDX; +}; -typedef enum _RATR_TABLE_MODE { +enum RATR_TABLE_MODE { RATR_INX_WIRELESS_NGB = 0, /* BGN 40 Mhz 2SS 1SS */ RATR_INX_WIRELESS_NG = 1, /* GN or N */ RATR_INX_WIRELESS_NB = 2, /* BGN 20 Mhz 2SS 1SS or BN */ @@ -149,7 +149,7 @@ typedef enum _RATR_TABLE_MODE { RATR_INX_WIRELESS_B = 6, RATR_INX_WIRELESS_MC = 7, RATR_INX_WIRELESS_AC_N = 8, -} RATR_TABLE_MODE, *PRATR_TABLE_MODE; +}; enum NETWORK_TYPE { @@ -983,9 +983,9 @@ struct rtw_ieee802_11_elems { u8 vht_op_mode_notify_len; }; -typedef enum { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 } ParseRes; +enum ParseRes { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 }; -ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len, +enum ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len, struct rtw_ieee802_11_elems *elems, int show_errors); -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:30 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:30 +0100 Subject: [PATCH 25/33] staging: rtl8723bs: remove typedefs in sta_info.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-26-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #34: FILE: include/sta_info.h:34: +typedef struct _RSSI_STA { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/sta_info.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/sta_info.h b/drivers/staging/rtl8723bs/include/sta_info.h index 734f4e2ecd66..1dbbe6cbf174 100644 --- a/drivers/staging/rtl8723bs/include/sta_info.h +++ b/drivers/staging/rtl8723bs/include/sta_info.h @@ -31,13 +31,13 @@ struct wlan_acl_pool { struct __queue acl_node_q; }; -typedef struct _RSSI_STA { +struct RSSI_STA { s32 UndecoratedSmoothedPWDB; s32 UndecoratedSmoothedCCK; s32 UndecoratedSmoothedOFDM; u64 PacketMap; u8 ValidBit; -} RSSI_STA, *PRSSI_STA; +}; struct stainfo_stats { @@ -196,7 +196,7 @@ struct sta_info { u32 assoc_req_len; /* for DM */ - RSSI_STA rssi_stat; + struct RSSI_STA rssi_stat; /* ODM_STA_INFO_T */ /* ================ODM Relative Info ======================= */ -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:34 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:34 +0100 Subject: [PATCH 29/33] staging: rtl8723bs: remove typedefs in rtw_efuse.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-30-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #60: FILE: include/rtw_efuse.h:60: +typedef struct PG_PKT_STRUCT_A { WARNING: do not add new typedefs #68: FILE: include/rtw_efuse.h:68: +typedef struct _EFUSE_HAL { Signed-off-by: Marco Cesati --- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 28 +++++++++---------- drivers/staging/rtl8723bs/include/hal_data.h | 2 +- drivers/staging/rtl8723bs/include/rtw_efuse.h | 8 +++--- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 8d4b87131f54..a8f56eeb576f 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -583,7 +583,7 @@ static u8 hal_EfuseSwitchToBank( u32 value32 = 0; #ifdef HAL_EFUSE_MEMORY struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal; + struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; #endif @@ -864,7 +864,7 @@ static void hal_ReadEFuse_WiFi( { #ifdef HAL_EFUSE_MEMORY struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal; + struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; #endif u8 *efuseTbl = NULL; u16 eFuse_Addr = 0; @@ -1003,7 +1003,7 @@ static void hal_ReadEFuse_BT( { #ifdef HAL_EFUSE_MEMORY struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal; + struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; #endif u8 *efuseTbl; u8 bank; @@ -1146,7 +1146,7 @@ static u16 hal_EfuseGetCurrentSize_WiFi( { #ifdef HAL_EFUSE_MEMORY struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal; + struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; #endif u16 efuse_addr = 0; u16 start_addr = 0; /* for debug */ @@ -1244,7 +1244,7 @@ static u16 hal_EfuseGetCurrentSize_BT(struct adapter *padapter, u8 bPseudoTest) { #ifdef HAL_EFUSE_MEMORY struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal; + struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; #endif u16 btusedbytes; u16 efuse_addr; @@ -1549,7 +1549,7 @@ static void hal_EfuseConstructPGPkt( u8 offset, u8 word_en, u8 *pData, - PPGPKT_STRUCT pTargetPkt + struct PGPKT_STRUCT * pTargetPkt ) { memset(pTargetPkt->data, 0xFF, PGPKT_DATA_SIZE); @@ -1563,12 +1563,12 @@ static u8 hal_EfusePartialWriteCheck( struct adapter *padapter, u8 efuseType, u16 *pAddr, - PPGPKT_STRUCT pTargetPkt, + struct PGPKT_STRUCT * pTargetPkt, u8 bPseudoTest ) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal; + struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; u8 bRet = false; u16 startAddr = 0, efuse_max_available_len = 0, efuse_max = 0; u8 efuse_data = 0; @@ -1681,7 +1681,7 @@ static u8 hal_EfusePgPacketWrite1ByteHeader( struct adapter *padapter, u8 efuseType, u16 *pAddr, - PPGPKT_STRUCT pTargetPkt, + struct PGPKT_STRUCT * pTargetPkt, u8 bPseudoTest ) { @@ -1718,7 +1718,7 @@ static u8 hal_EfusePgPacketWrite2ByteHeader( struct adapter *padapter, u8 efuseType, u16 *pAddr, - PPGPKT_STRUCT pTargetPkt, + struct PGPKT_STRUCT * pTargetPkt, u8 bPseudoTest ) { @@ -1785,7 +1785,7 @@ static u8 hal_EfusePgPacketWriteHeader( struct adapter *padapter, u8 efuseType, u16 *pAddr, - PPGPKT_STRUCT pTargetPkt, + struct PGPKT_STRUCT * pTargetPkt, u8 bPseudoTest ) { @@ -1803,7 +1803,7 @@ static u8 hal_EfusePgPacketWriteData( struct adapter *padapter, u8 efuseType, u16 *pAddr, - PPGPKT_STRUCT pTargetPkt, + struct PGPKT_STRUCT * pTargetPkt, u8 bPseudoTest ) { @@ -1830,7 +1830,7 @@ static s32 Hal_EfusePgPacketWrite( bool bPseudoTest ) { - PGPKT_STRUCT targetPkt; + struct PGPKT_STRUCT targetPkt; u16 startAddr = 0; u8 efuseType = EFUSE_WIFI; @@ -1859,7 +1859,7 @@ static bool Hal_EfusePgPacketWrite_BT( bool bPseudoTest ) { - PGPKT_STRUCT targetPkt; + struct PGPKT_STRUCT targetPkt; u16 startAddr = 0; u8 efuseType = EFUSE_BT; diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h index 9c21208765ef..7fa384dd07ac 100644 --- a/drivers/staging/rtl8723bs/include/hal_data.h +++ b/drivers/staging/rtl8723bs/include/hal_data.h @@ -233,7 +233,7 @@ struct hal_com_data { bool EepromOrEfuse; u8 EfuseUsedPercentage; u16 EfuseUsedBytes; - EFUSE_HAL EfuseHal; + struct EFUSE_HAL EfuseHal; /* 3 [2.4G] */ u8 Index24G_CCK_Base[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; diff --git a/drivers/staging/rtl8723bs/include/rtw_efuse.h b/drivers/staging/rtl8723bs/include/rtw_efuse.h index 4abcbbc8f513..3c6673910574 100644 --- a/drivers/staging/rtl8723bs/include/rtw_efuse.h +++ b/drivers/staging/rtl8723bs/include/rtw_efuse.h @@ -57,15 +57,15 @@ enum _EFUSE_DEF_TYPE { #define EFUSE_MAX_WORD_UNIT 4 /*------------------------------Define structure----------------------------*/ -typedef struct PG_PKT_STRUCT_A { +struct PGPKT_STRUCT { u8 offset; u8 word_en; u8 data[8]; u8 word_cnts; -} PGPKT_STRUCT, *PPGPKT_STRUCT; +}; /*------------------------------Define structure----------------------------*/ -typedef struct _EFUSE_HAL { +struct EFUSE_HAL { u8 fakeEfuseBank; u32 fakeEfuseUsedBytes; u8 fakeEfuseContent[EFUSE_MAX_HW_SIZE]; @@ -82,7 +82,7 @@ typedef struct _EFUSE_HAL { u8 fakeBTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE]; u8 fakeBTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN]; u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN]; -} EFUSE_HAL, *PEFUSE_HAL; +}; /*------------------------Export global variable----------------------------*/ -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:32 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:32 +0100 Subject: [PATCH 27/33] staging: rtl8723bs: remove typedefs in basic_types.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-28-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #16: FILE: include/basic_types.h:16: +typedef signed int sint; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/core/rtw_ap.c | 2 +- .../staging/rtl8723bs/core/rtw_ieee80211.c | 6 +- .../staging/rtl8723bs/core/rtw_ioctl_set.c | 2 +- drivers/staging/rtl8723bs/core/rtw_mlme.c | 16 ++-- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 6 +- drivers/staging/rtl8723bs/core/rtw_recv.c | 82 ++++++++--------- drivers/staging/rtl8723bs/core/rtw_security.c | 88 +++++++++---------- drivers/staging/rtl8723bs/core/rtw_xmit.c | 38 ++++---- drivers/staging/rtl8723bs/hal/hal_intf.c | 2 +- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 4 +- .../staging/rtl8723bs/include/basic_types.h | 2 - drivers/staging/rtl8723bs/include/ieee80211.h | 4 +- .../staging/rtl8723bs/include/recv_osdep.h | 2 +- drivers/staging/rtl8723bs/include/rtw_cmd.h | 2 +- drivers/staging/rtl8723bs/include/rtw_mlme.h | 26 +++--- drivers/staging/rtl8723bs/include/rtw_recv.h | 14 +-- drivers/staging/rtl8723bs/include/rtw_xmit.h | 26 +++--- .../staging/rtl8723bs/include/xmit_osdep.h | 2 +- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 4 +- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 2 +- drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 2 +- 21 files changed, 165 insertions(+), 167 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c index b6f944b37b08..7c765380a8c1 100644 --- a/drivers/staging/rtl8723bs/core/rtw_ap.c +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c @@ -85,7 +85,7 @@ static void update_BCNTIM(struct adapter *padapter) premainder_ie = p + tim_ielen; - tim_ie_offset = (sint)(p - pie); + tim_ie_offset = (signed int)(p - pie); remainder_ielen = pnetwork_mlmeext->IELength - tim_ie_offset - tim_ielen; diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c index a2a97826197a..cccbea555a32 100644 --- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c @@ -120,7 +120,7 @@ u8 *rtw_set_fixed_ie(unsigned char *pbuf, unsigned int len, unsigned char *sourc /* rtw_set_ie will update frame length */ u8 *rtw_set_ie(u8 *pbuf, - sint index, + signed int index, uint len, u8 *source, uint *frlen) /* frame length */ @@ -140,9 +140,9 @@ u8 *rtw_set_ie(u8 *pbuf, /*---------------------------------------------------------------------------- index: the information element id index, limit is the limit for search -----------------------------------------------------------------------------*/ -u8 *rtw_get_ie(u8 *pbuf, sint index, sint *len, sint limit) +u8 *rtw_get_ie(u8 *pbuf, signed int index, signed int *len, signed int limit) { - sint tmp, i; + signed int tmp, i; u8 *p; if (limit < 1) diff --git a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c index 1cfdf7c93662..c9418bfb2a00 100644 --- a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c +++ b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c @@ -567,7 +567,7 @@ u8 rtw_set_802_11_authentication_mode(struct adapter *padapter, enum NDIS_802_11 u8 rtw_set_802_11_add_wep(struct adapter *padapter, struct ndis_802_11_wep *wep) { - sint keyid, res; + signed int keyid, res; struct security_priv *psecuritypriv = &(padapter->securitypriv); u8 ret = _SUCCESS; diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index 2c9425e2a1e9..57370091dc9f 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -298,9 +298,9 @@ void rtw_free_network_queue(struct adapter *padapter, u8 isfreeall) spin_unlock_bh(&scanned_queue->lock); } -sint rtw_if_up(struct adapter *padapter) +signed int rtw_if_up(struct adapter *padapter) { - sint res; + signed int res; if (padapter->bDriverStopped || padapter->bSurpriseRemoved || (check_fwstate(&padapter->mlmepriv, _FW_LINKED) == false)) { @@ -2129,12 +2129,12 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) return ret; } -sint rtw_set_auth(struct adapter *adapter, struct security_priv *psecuritypriv) +signed int rtw_set_auth(struct adapter *adapter, struct security_priv *psecuritypriv) { struct cmd_obj *pcmd; struct setauth_parm *psetauthparm; struct cmd_priv *pcmdpriv = &(adapter->cmdpriv); - sint res = _SUCCESS; + signed int res = _SUCCESS; pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); if (!pcmd) { @@ -2167,13 +2167,13 @@ sint rtw_set_auth(struct adapter *adapter, struct security_priv *psecuritypriv) return res; } -sint rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, sint keyid, u8 set_tx, bool enqueue) +signed int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, signed int keyid, u8 set_tx, bool enqueue) { u8 keylen; struct cmd_obj *pcmd; struct setkey_parm *psetkeyparm; struct cmd_priv *pcmdpriv = &(adapter->cmdpriv); - sint res = _SUCCESS; + signed int res = _SUCCESS; psetkeyparm = rtw_zmalloc(sizeof(struct setkey_parm)); if (!psetkeyparm) { @@ -2342,7 +2342,7 @@ static int rtw_append_pmkid(struct adapter *Adapter, int iEntry, u8 *ie, uint ie return ie_len; } -sint rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_len) +signed int rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_len) { u8 authmode = 0x0; uint ielength; @@ -2976,7 +2976,7 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network) } -sint rtw_linked_check(struct adapter *padapter) +signed int rtw_linked_check(struct adapter *padapter) { if ((check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true) || (check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE) == true)) { diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index f542805a461c..ca79e60838fe 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -2398,7 +2398,7 @@ s32 dump_mgntframe_and_wait_ack(struct adapter *padapter, struct xmit_frame *pmg static int update_hidden_ssid(u8 *ies, u32 ies_len, u8 hidden_ssid_mode) { u8 *ssid_ie; - sint ssid_len_ori; + signed int ssid_len_ori; int len_diff = 0; ssid_ie = rtw_get_ie(ies, WLAN_EID_SSID, &ssid_len_ori, ies_len); @@ -2686,8 +2686,8 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p /* retrieve SSID IE from cur_network->Ssid */ { u8 *ssid_ie; - sint ssid_ielen; - sint ssid_ielen_diff; + signed int ssid_ielen; + signed int ssid_ielen_diff; u8 buf[MAX_IE_SZ]; u8 *ies = pmgntframe->buf_addr+TXDESC_OFFSET+sizeof(struct ieee80211_hdr_3addr); diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c index f35a134bb75f..c8353405d11f 100644 --- a/drivers/staging/rtl8723bs/core/rtw_recv.c +++ b/drivers/staging/rtl8723bs/core/rtw_recv.c @@ -30,11 +30,11 @@ void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv) _rtw_init_queue(&psta_recvpriv->defrag_q); } -sint _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) +signed int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) { - sint i; + signed int i; union recv_frame *precvframe; - sint res = _SUCCESS; + signed int res = _SUCCESS; spin_lock_init(&precvpriv->lock); @@ -168,7 +168,7 @@ int rtw_free_recvframe(union recv_frame *precvframe, struct __queue *pfree_recv_ -sint _rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *queue) +signed int _rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *queue) { struct adapter *padapter = precvframe->u.hdr.adapter; @@ -187,9 +187,9 @@ sint _rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *queue) return _SUCCESS; } -sint rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *queue) +signed int rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *queue) { - sint ret; + signed int ret; /* _spinlock(&pfree_recv_queue->lock); */ spin_lock_bh(&queue->lock); @@ -201,7 +201,7 @@ sint rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *queue) } /* -sint rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *queue) +signed int rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *queue) { return rtw_free_recvframe(precvframe, queue); } @@ -255,7 +255,7 @@ u32 rtw_free_uc_swdec_pending_queue(struct adapter *adapter) } -sint rtw_enqueue_recvbuf_to_head(struct recv_buf *precvbuf, struct __queue *queue) +signed int rtw_enqueue_recvbuf_to_head(struct recv_buf *precvbuf, struct __queue *queue) { spin_lock_bh(&queue->lock); @@ -267,7 +267,7 @@ sint rtw_enqueue_recvbuf_to_head(struct recv_buf *precvbuf, struct __queue *queu return _SUCCESS; } -sint rtw_enqueue_recvbuf(struct recv_buf *precvbuf, struct __queue *queue) +signed int rtw_enqueue_recvbuf(struct recv_buf *precvbuf, struct __queue *queue) { spin_lock_bh(&queue->lock); @@ -305,11 +305,11 @@ struct recv_buf *rtw_dequeue_recvbuf(struct __queue *queue) } -sint recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe); -sint recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe) +signed int recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe); +signed int recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe) { - sint i, res = _SUCCESS; + signed int i, res = _SUCCESS; u32 datalen; u8 miccode[8]; u8 bmic_err = false, brpt_micerror = true; @@ -606,10 +606,10 @@ union recv_frame *portctrl(struct adapter *adapter, union recv_frame *precv_fram return prtnframe; } -sint recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcache *prxcache); -sint recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcache *prxcache) +signed int recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcache *prxcache); +signed int recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcache *prxcache) { - sint tid = precv_frame->u.hdr.attrib.priority; + signed int tid = precv_frame->u.hdr.attrib.priority; u16 seq_ctrl = ((precv_frame->u.hdr.attrib.seq_num&0xffff) << 4) | (precv_frame->u.hdr.attrib.frag_num & 0xf); @@ -755,20 +755,20 @@ void count_rx_stats(struct adapter *padapter, union recv_frame *prframe, struct traffic_check_for_leave_lps(padapter, false, 0); } -sint sta2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame, +signed int sta2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame, struct sta_info **psta); -sint sta2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame, +signed int sta2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame, struct sta_info **psta) { u8 *ptr = precv_frame->u.hdr.rx_data; - sint ret = _SUCCESS; + signed int ret = _SUCCESS; struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; struct sta_priv *pstapriv = &adapter->stapriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; u8 *mybssid = get_bssid(pmlmepriv); u8 *myhwaddr = myid(&adapter->eeprompriv); u8 *sta_addr = NULL; - sint bmcast = IS_MCAST(pattrib->dst); + signed int bmcast = IS_MCAST(pattrib->dst); /* DBG_871X("[%s] %d, seqnum:%d\n", __func__, __LINE__, pattrib->seq_num); */ @@ -850,19 +850,19 @@ sint sta2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame, return ret; } -sint ap2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame, +signed int ap2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame, struct sta_info **psta); -sint ap2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame, +signed int ap2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame, struct sta_info **psta) { u8 *ptr = precv_frame->u.hdr.rx_data; struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; - sint ret = _SUCCESS; + signed int ret = _SUCCESS; struct sta_priv *pstapriv = &adapter->stapriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; u8 *mybssid = get_bssid(pmlmepriv); u8 *myhwaddr = myid(&adapter->eeprompriv); - sint bmcast = IS_MCAST(pattrib->dst); + signed int bmcast = IS_MCAST(pattrib->dst); if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) && (check_fwstate(pmlmepriv, _FW_LINKED) == true || @@ -992,9 +992,9 @@ sint ap2sta_data_frame(struct adapter *adapter, union recv_frame *precv_frame, return ret; } -sint sta2ap_data_frame(struct adapter *adapter, union recv_frame *precv_frame, +signed int sta2ap_data_frame(struct adapter *adapter, union recv_frame *precv_frame, struct sta_info **psta); -sint sta2ap_data_frame(struct adapter *adapter, union recv_frame *precv_frame, +signed int sta2ap_data_frame(struct adapter *adapter, union recv_frame *precv_frame, struct sta_info **psta) { u8 *ptr = precv_frame->u.hdr.rx_data; @@ -1002,7 +1002,7 @@ sint sta2ap_data_frame(struct adapter *adapter, union recv_frame *precv_frame, struct sta_priv *pstapriv = &adapter->stapriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; unsigned char *mybssid = get_bssid(pmlmepriv); - sint ret = _SUCCESS; + signed int ret = _SUCCESS; if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { /* For AP mode, RA =BSSID, TX =STA(SRC_ADDR), A3 =DST_ADDR */ @@ -1049,8 +1049,8 @@ sint sta2ap_data_frame(struct adapter *adapter, union recv_frame *precv_frame, return ret; } -sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_frame); -sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_frame) +signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_frame); +signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_frame) { struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; struct sta_priv *pstapriv = &padapter->stapriv; @@ -1187,8 +1187,8 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_ } union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union recv_frame *precv_frame); -sint validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_frame); -sint validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_frame) +signed int validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_frame); +signed int validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_frame) { /* struct mlme_priv *pmlmepriv = &adapter->mlmepriv; */ @@ -1227,8 +1227,8 @@ sint validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_ } -sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_frame); -sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_frame) +signed int validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_frame); +signed int validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_frame) { u8 bretry; u8 *psa, *pda, *pbssid; @@ -1236,7 +1236,7 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f u8 *ptr = precv_frame->u.hdr.rx_data; struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; struct security_priv *psecuritypriv = &adapter->securitypriv; - sint ret = _SUCCESS; + signed int ret = _SUCCESS; bretry = GetRetry(ptr); pda = get_da(ptr); @@ -1364,7 +1364,7 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f return ret; } -static sint validate_80211w_mgmt(struct adapter *adapter, union recv_frame *precv_frame) +static signed int validate_80211w_mgmt(struct adapter *adapter, union recv_frame *precv_frame) { struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; @@ -1410,7 +1410,7 @@ static sint validate_80211w_mgmt(struct adapter *adapter, union recv_frame *prec } } else if (IS_MCAST(GetAddr1Ptr(ptr)) && (subtype == WIFI_DEAUTH || subtype == WIFI_DISASSOC)) { - sint BIP_ret = _SUCCESS; + signed int BIP_ret = _SUCCESS; /* verify BIP MME IE of broadcast/multicast de-auth/disassoc packet */ BIP_ret = rtw_BIP_verify(adapter, (u8 *)precv_frame); if (BIP_ret == _FAIL) { @@ -1459,8 +1459,8 @@ static inline void dump_rx_packet(u8 *ptr) DBG_871X("#############################\n"); } -sint validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame); -sint validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame) +signed int validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame); +signed int validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame) { /* shall check frame subtype, to / from ds, da, bssid */ @@ -1468,7 +1468,7 @@ sint validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame) u8 type; u8 subtype; - sint retval = _SUCCESS; + signed int retval = _SUCCESS; u8 bDumpRxPkt; struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; @@ -1559,10 +1559,10 @@ sint validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame) /* remove the wlanhdr and add the eth_hdr */ -sint wlanhdr_to_ethhdr(union recv_frame *precvframe); -sint wlanhdr_to_ethhdr(union recv_frame *precvframe) +signed int wlanhdr_to_ethhdr(union recv_frame *precvframe); +signed int wlanhdr_to_ethhdr(union recv_frame *precvframe) { - sint rmv_len; + signed int rmv_len; u16 eth_type, len; u8 bsnaphdr; u8 *psnap_type; diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c index a311595deafb..4550113a55a2 100644 --- a/drivers/staging/rtl8723bs/core/rtw_security.c +++ b/drivers/staging/rtl8723bs/core/rtw_security.c @@ -148,7 +148,7 @@ static void arcfour_encrypt(struct arc4context *parc4ctx, u8 *dest, u8 *src, u32 dest[i] = src[i] ^ (unsigned char)arcfour_byte(parc4ctx); } -static sint bcrc32initialized; +static signed int bcrc32initialized; static u32 crc32_table[256]; @@ -162,7 +162,7 @@ static void crc32_init(void) if (bcrc32initialized == 1) return; else { - sint i, j; + signed int i, j; u32 c; u8 *p = (u8 *)&c, *p1; u8 k; @@ -184,7 +184,7 @@ static void crc32_init(void) } } -static __le32 getcrc32(u8 *buf, sint len) +static __le32 getcrc32(u8 *buf, signed int len) { u8 *p; u32 crc; @@ -209,7 +209,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) unsigned char crc[4]; struct arc4context mycontext; - sint curfragnum, length; + signed int curfragnum, length; u32 keylength; u8 *pframe, *payload, *iv; /* wepkey */ @@ -266,7 +266,7 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe) /* exclude ICV */ u8 crc[4]; struct arc4context mycontext; - sint length; + signed int length; u32 keylength; u8 *pframe, *payload, *iv, wepkey[16]; u8 keyindex; @@ -549,7 +549,7 @@ static const unsigned short Sbox1[2][256] = { /* Sbox for hash (can be in R */ static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32) { - sint i; + signed int i; /* Initialize the 80 bits of P1K[] from IV32 and TA[0..5] */ p1k[0] = Lo16(iv32); @@ -597,7 +597,7 @@ static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32) */ static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16) { - sint i; + signed int i; u16 PPK[6]; /* temporary key for mixing */ /* Note: all adds in the PPK[] equations below are mod 2**16 */ @@ -651,7 +651,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe) u8 crc[4]; u8 hw_hdr_offset = 0; struct arc4context mycontext; - sint curfragnum, length; + signed int curfragnum, length; u8 *pframe, *payload, *iv, *prwskey; union pn48 dot11txpn; @@ -727,7 +727,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe) u8 ttkey[16]; u8 crc[4]; struct arc4context mycontext; - sint length; + signed int length; u8 *pframe, *payload, *iv, *prwskey; union pn48 dot11txpn; @@ -874,31 +874,31 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe) static void bitwise_xor(u8 *ina, u8 *inb, u8 *out); static void construct_mic_iv(u8 *mic_header1, - sint qc_exists, - sint a4_exists, + signed int qc_exists, + signed int a4_exists, u8 *mpdu, uint payload_length, u8 *pn_vector, uint frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */ static void construct_mic_header1(u8 *mic_header1, - sint header_length, + signed int header_length, u8 *mpdu, uint frtype); /* for CONFIG_IEEE80211W, none 11w also can use */ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, - sint a4_exists, - sint qc_exists); + signed int a4_exists, + signed int qc_exists); static void construct_ctr_preload(u8 *ctr_preload, - sint a4_exists, - sint qc_exists, + signed int a4_exists, + signed int qc_exists, u8 *mpdu, u8 *pn_vector, - sint c, + signed int c, uint frtype); /* for CONFIG_IEEE80211W, none 11w also can use */ static void xor_128(u8 *a, u8 *b, u8 *out); static void xor_32(u8 *a, u8 *b, u8 *out); static u8 sbox(u8 a); -static void next_key(u8 *key, sint round); +static void next_key(u8 *key, signed int round); static void byte_sub(u8 *in, u8 *out); static void shift_row(u8 *in, u8 *out); static void mix_column(u8 *in, u8 *out); @@ -912,7 +912,7 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext); /****************************************/ static void xor_128(u8 *a, u8 *b, u8 *out) { - sint i; + signed int i; for (i = 0; i < 16; i++) out[i] = a[i] ^ b[i]; @@ -921,7 +921,7 @@ static void xor_128(u8 *a, u8 *b, u8 *out) static void xor_32(u8 *a, u8 *b, u8 *out) { - sint i; + signed int i; for (i = 0; i < 4; i++) out[i] = a[i] ^ b[i]; @@ -930,11 +930,11 @@ static void xor_32(u8 *a, u8 *b, u8 *out) static u8 sbox(u8 a) { - return sbox_table[(sint)a]; + return sbox_table[(signed int)a]; } -static void next_key(u8 *key, sint round) +static void next_key(u8 *key, signed int round) { u8 rcon; u8 sbox_key[4]; @@ -961,7 +961,7 @@ static void next_key(u8 *key, sint round) static void byte_sub(u8 *in, u8 *out) { - sint i; + signed int i; for (i = 0; i < 16; i++) out[i] = sbox(in[i]); @@ -990,7 +990,7 @@ static void shift_row(u8 *in, u8 *out) static void mix_column(u8 *in, u8 *out) { - sint i; + signed int i; u8 add1b[4]; u8 add1bf7[4]; u8 rotl[4]; @@ -1047,8 +1047,8 @@ static void mix_column(u8 *in, u8 *out) static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext) { - sint round; - sint i; + signed int round; + signed int i; u8 intermediatea[16]; u8 intermediateb[16]; u8 round_key[16]; @@ -1084,14 +1084,14 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext) /* nonce */ /************************************************/ static void construct_mic_iv(u8 *mic_iv, - sint qc_exists, - sint a4_exists, + signed int qc_exists, + signed int a4_exists, u8 *mpdu, uint payload_length, u8 *pn_vector, uint frtype) /* add for CONFIG_IEEE80211W, none 11w also can use */ { - sint i; + signed int i; mic_iv[0] = 0x59; @@ -1128,7 +1128,7 @@ static void construct_mic_iv(u8 *mic_iv, /* Build AAD SC, A1, A2 */ /************************************************/ static void construct_mic_header1(u8 *mic_header1, - sint header_length, + signed int header_length, u8 *mpdu, uint frtype) /* for CONFIG_IEEE80211W, none 11w also can use */ { @@ -1163,10 +1163,10 @@ static void construct_mic_header1(u8 *mic_header1, /************************************************/ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, - sint a4_exists, - sint qc_exists) + signed int a4_exists, + signed int qc_exists) { - sint i; + signed int i; for (i = 0; i < 16; i++) mic_header2[i] = 0x00; @@ -1208,14 +1208,14 @@ static void construct_mic_header2(u8 *mic_header2, /* nonce */ /************************************************/ static void construct_ctr_preload(u8 *ctr_preload, - sint a4_exists, - sint qc_exists, + signed int a4_exists, + signed int qc_exists, u8 *mpdu, u8 *pn_vector, - sint c, + signed int c, uint frtype) /* for CONFIG_IEEE80211W, none 11w also can use */ { - sint i = 0; + signed int i = 0; for (i = 0; i < 16; i++) ctr_preload[i] = 0x00; @@ -1250,13 +1250,13 @@ static void construct_ctr_preload(u8 *ctr_preload, /************************************/ static void bitwise_xor(u8 *ina, u8 *inb, u8 *out) { - sint i; + signed int i; for (i = 0; i < 16; i++) out[i] = ina[i] ^ inb[i]; } -static sint aes_cipher(u8 *key, uint hdrlen, +static signed int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) { uint qc_exists, a4_exists, i, j, payload_remainder, @@ -1428,7 +1428,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe) /* unsigned char message[MAX_MSG_SIZE]; */ /* Intermediate Buffers */ - sint curfragnum, length; + signed int curfragnum, length; u8 *pframe, *prwskey; /* *payload,*iv */ u8 hw_hdr_offset = 0; struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib; @@ -1471,13 +1471,13 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe) return res; } -static sint aes_decipher(u8 *key, uint hdrlen, +static signed int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) { static u8 message[MAX_MSG_SIZE]; uint qc_exists, a4_exists, i, j, payload_remainder, num_blocks, payload_index; - sint res = _SUCCESS; + signed int res = _SUCCESS; u8 pn_vector[6]; u8 mic_iv[16]; u8 mic_header1[16]; @@ -1704,7 +1704,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe) /* Intermediate Buffers */ - sint length; + signed int length; u8 *pframe, *prwskey; /* *payload,*iv */ struct sta_info *stainfo; struct rx_pkt_attrib *prxattrib = &((union recv_frame *)precvframe)->u.hdr.attrib; @@ -2241,7 +2241,7 @@ int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac) void rtw_sec_restore_wep_key(struct adapter *adapter) { struct security_priv *securitypriv = &(adapter->securitypriv); - sint keyid; + signed int keyid; if ((_WEP40_ == securitypriv->dot11PrivacyAlgrthm) || (_WEP104_ == securitypriv->dot11PrivacyAlgrthm)) { for (keyid = 0; keyid < 4; keyid++) { diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c index 19aecbabbc4d..0644b85c6f4c 100644 --- a/drivers/staging/rtl8723bs/core/rtw_xmit.c +++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c @@ -38,7 +38,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter) int i; struct xmit_buf *pxmitbuf; struct xmit_frame *pxframe; - sint res = _SUCCESS; + signed int res = _SUCCESS; spin_lock_init(&pxmitpriv->lock); spin_lock_init(&pxmitpriv->lock_sctx); @@ -476,10 +476,10 @@ static void update_attrib_phy_info(struct adapter *padapter, struct pkt_attrib * static s32 update_attrib_sec_info(struct adapter *padapter, struct pkt_attrib *pattrib, struct sta_info *psta) { - sint res = _SUCCESS; + signed int res = _SUCCESS; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; - sint bmcast = IS_MCAST(pattrib->ra); + signed int bmcast = IS_MCAST(pattrib->ra); memset(pattrib->dot118021x_UncstKey.skey, 0, 16); memset(pattrib->dot11tkiptxmickey.skey, 0, 16); @@ -647,11 +647,11 @@ static s32 update_attrib(struct adapter *padapter, _pkt *pkt, struct pkt_attrib struct sta_info *psta = NULL; struct ethhdr etherhdr; - sint bmcast; + signed int bmcast; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct qos_priv *pqospriv = &pmlmepriv->qospriv; - sint res = _SUCCESS; + signed int res = _SUCCESS; _rtw_open_pktfile(pkt, &pktfile); _rtw_pktfile_read(&pktfile, (u8 *)ðerhdr, ETH_HLEN); @@ -793,7 +793,7 @@ static s32 update_attrib(struct adapter *padapter, _pkt *pkt, struct pkt_attrib static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitframe) { - sint curfragnum, length; + signed int curfragnum, length; u8 *pframe, *payload, mic[8]; struct mic_data micdata; struct pkt_attrib *pattrib = &pxmitframe->attrib; @@ -801,7 +801,7 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr struct xmit_priv *pxmitpriv = &padapter->xmitpriv; u8 priority[4] = {0x0, 0x0, 0x0, 0x0}; u8 hw_hdr_offset = 0; - sint bmcst = IS_MCAST(pattrib->ra); + signed int bmcst = IS_MCAST(pattrib->ra); hw_hdr_offset = TXDESC_OFFSET; @@ -922,7 +922,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct qos_priv *pqospriv = &pmlmepriv->qospriv; u8 qos_option = false; - sint res = _SUCCESS; + signed int res = _SUCCESS; __le16 *fctrl = &pwlanhdr->frame_control; memset(hdr, 0, WLANHDR_OFFSET); @@ -1416,7 +1416,7 @@ void rtw_update_protection(struct adapter *padapter, u8 *ie, uint ie_len) { uint protection; u8 *perp; - sint erp_len; + signed int erp_len; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct registry_priv *pregistrypriv = &padapter->registrypriv; @@ -1884,7 +1884,7 @@ s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitfram return _SUCCESS; } -struct tx_servq *rtw_get_sta_pending(struct adapter *padapter, struct sta_info *psta, sint up, u8 *ac) +struct tx_servq *rtw_get_sta_pending(struct adapter *padapter, struct sta_info *psta, signed int up, u8 *ac) { struct tx_servq *ptxservq = NULL; @@ -1933,7 +1933,7 @@ s32 rtw_xmit_classifier(struct adapter *padapter, struct xmit_frame *pxmitframe) struct tx_servq *ptxservq; struct pkt_attrib *pattrib = &pxmitframe->attrib; struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits; - sint res = _SUCCESS; + signed int res = _SUCCESS; psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); if (pattrib->psta != psta) { @@ -2014,9 +2014,9 @@ void rtw_free_hwxmits(struct adapter *padapter) kfree(pxmitpriv->hwxmits); } -void rtw_init_hwxmits(struct hw_xmit *phwxmit, sint entry) +void rtw_init_hwxmits(struct hw_xmit *phwxmit, signed int entry) { - sint i; + signed int i; for (i = 0; i < entry; i++, phwxmit++) phwxmit->accnt = 0; @@ -2163,14 +2163,14 @@ inline bool xmitframe_hiq_filter(struct xmit_frame *xmitframe) return allow; } -sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_frame *pxmitframe) +signed int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_frame *pxmitframe) { - sint ret = false; + signed int ret = false; struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; struct pkt_attrib *pattrib = &pxmitframe->attrib; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - sint bmcst = IS_MCAST(pattrib->ra); + signed int bmcst = IS_MCAST(pattrib->ra); bool update_tim = false; if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == false) @@ -2286,7 +2286,7 @@ sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fr static void dequeue_xmitframes_to_sleeping_queue(struct adapter *padapter, struct sta_info *psta, struct __queue *pframequeue) { - sint ret; + signed int ret; struct list_head *plist, *phead; u8 ac_index; struct tx_servq *ptxservq; @@ -2639,10 +2639,10 @@ struct xmit_buf *dequeue_pending_xmitbuf_under_survey(struct xmit_priv *pxmitpri return pxmitbuf; } -sint check_pending_xmitbuf(struct xmit_priv *pxmitpriv) +signed int check_pending_xmitbuf(struct xmit_priv *pxmitpriv) { struct __queue *pqueue; - sint ret = false; + signed int ret = false; pqueue = &pxmitpriv->pending_xmitbuf_queue; diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c index ac3066a91c84..b3c40dde2cb5 100644 --- a/drivers/staging/rtl8723bs/hal/hal_intf.c +++ b/drivers/staging/rtl8723bs/hal/hal_intf.c @@ -65,7 +65,7 @@ static void rtw_hal_init_opmode(struct adapter *padapter) { enum NDIS_802_11_NETWORK_INFRASTRUCTURE networkType = Ndis802_11InfrastructureMax; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - sint fw_state; + signed int fw_state; fw_state = get_fwstate(pmlmepriv); diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index 515b56ae9df0..d8b764fc97ea 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -788,8 +788,8 @@ static void ConstructProbeRsp(struct adapter *padapter, u8 *pframe, u32 *pLength /* retrieve SSID IE from cur_network->Ssid */ { u8 *ssid_ie; - sint ssid_ielen; - sint ssid_ielen_diff; + signed int ssid_ielen; + signed int ssid_ielen_diff; u8 buf[MAX_IE_SZ]; u8 *ies = pframe + sizeof(struct ieee80211_hdr_3addr); diff --git a/drivers/staging/rtl8723bs/include/basic_types.h b/drivers/staging/rtl8723bs/include/basic_types.h index bab9811aeb5f..d0b2ec25327a 100644 --- a/drivers/staging/rtl8723bs/include/basic_types.h +++ b/drivers/staging/rtl8723bs/include/basic_types.h @@ -13,8 +13,6 @@ #include -typedef signed int sint; - #define FIELD_OFFSET(s, field) ((__kernel_ssize_t)&((s*)(0))->field) #define SIZE_PTR __kernel_size_t diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h index 10b599f835bb..bda5712aac62 100644 --- a/drivers/staging/rtl8723bs/include/ieee80211.h +++ b/drivers/staging/rtl8723bs/include/ieee80211.h @@ -990,7 +990,7 @@ enum ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len, int show_errors); u8 *rtw_set_fixed_ie(unsigned char *pbuf, unsigned int len, unsigned char *source, unsigned int *frlen); -u8 *rtw_set_ie(u8 *pbuf, sint index, uint len, u8 *source, uint *frlen); +u8 *rtw_set_ie(u8 *pbuf, signed int index, uint len, u8 *source, uint *frlen); enum secondary_ch_offset { SCN = 0, /* no secondary channel */ @@ -998,7 +998,7 @@ enum secondary_ch_offset { SCB = 3, /* secondary channel below */ }; -u8 *rtw_get_ie(u8*pbuf, sint index, sint *len, sint limit); +u8 *rtw_get_ie(u8*pbuf, signed int index, signed int *len, signed int limit); u8 *rtw_get_ie_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, u8 oui_len, u8 *ie, uint *ielen); int rtw_ies_remove_ie(u8 *ies, uint *ies_len, uint offset, u8 eid, u8 *oui, u8 oui_len); diff --git a/drivers/staging/rtl8723bs/include/recv_osdep.h b/drivers/staging/rtl8723bs/include/recv_osdep.h index e85aafc93f6d..5f686cb339ba 100644 --- a/drivers/staging/rtl8723bs/include/recv_osdep.h +++ b/drivers/staging/rtl8723bs/include/recv_osdep.h @@ -8,7 +8,7 @@ #define __RECV_OSDEP_H_ -extern sint _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter); +extern signed int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter); extern void _rtw_free_recv_priv(struct recv_priv *precvpriv); diff --git a/drivers/staging/rtl8723bs/include/rtw_cmd.h b/drivers/staging/rtl8723bs/include/rtw_cmd.h index 56c77bc7ca81..f2459ad8c1e8 100644 --- a/drivers/staging/rtl8723bs/include/rtw_cmd.h +++ b/drivers/staging/rtl8723bs/include/rtw_cmd.h @@ -265,7 +265,7 @@ Command-Event Mode #define RTW_SSID_SCAN_AMOUNT 9 /* for WEXT_CSCAN_AMOUNT 9 */ #define RTW_CHANNEL_SCAN_AMOUNT (14+37) struct sitesurvey_parm { - sint scan_mode; /* active: 1, passive: 0 */ + signed int scan_mode; /* active: 1, passive: 0 */ u8 ssid_num; u8 ch_num; struct ndis_802_11_ssid ssid[RTW_SSID_SCAN_AMOUNT]; diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h index 2f9c2a03e385..18f1653fc975 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mlme.h +++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h @@ -130,7 +130,7 @@ SHALL not lock up more than one locks at a time! struct sitesurvey_ctrl { u64 last_tx_pkts; uint last_rx_pkts; - sint traffic_busy; + signed int traffic_busy; _timer sitesurvey_ctrl_timer; }; @@ -330,7 +330,7 @@ enum { struct mlme_priv { _lock lock; - sint fw_state; /* shall we protect this variable? maybe not necessarily... */ + signed int fw_state; /* shall we protect this variable? maybe not necessarily... */ u8 bScanInProcess; u8 to_join; /* flag */ @@ -490,9 +490,9 @@ extern int rtw_init_mlme_priv(struct adapter *adapter);/* (struct mlme_priv *pm extern void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv); -extern sint rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv); -extern sint rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, sint keyid, u8 set_tx, bool enqueue); -extern sint rtw_set_auth(struct adapter *adapter, struct security_priv *psecuritypriv); +extern signed int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv); +extern signed int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, signed int keyid, u8 set_tx, bool enqueue); +extern signed int rtw_set_auth(struct adapter *adapter, struct security_priv *psecuritypriv); static inline u8 *get_bssid(struct mlme_priv *pmlmepriv) { /* if sta_mode:pmlmepriv->cur_network.network.MacAddress => bssid */ @@ -500,7 +500,7 @@ static inline u8 *get_bssid(struct mlme_priv *pmlmepriv) return pmlmepriv->cur_network.network.MacAddress; } -static inline sint check_fwstate(struct mlme_priv *pmlmepriv, sint state) +static inline signed int check_fwstate(struct mlme_priv *pmlmepriv, signed int state) { if (pmlmepriv->fw_state & state) return true; @@ -508,7 +508,7 @@ static inline sint check_fwstate(struct mlme_priv *pmlmepriv, sint state) return false; } -static inline sint get_fwstate(struct mlme_priv *pmlmepriv) +static inline signed int get_fwstate(struct mlme_priv *pmlmepriv) { return pmlmepriv->fw_state; } @@ -520,7 +520,7 @@ static inline sint get_fwstate(struct mlme_priv *pmlmepriv) * ### NOTE:#### (!!!!) * MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock */ -static inline void set_fwstate(struct mlme_priv *pmlmepriv, sint state) +static inline void set_fwstate(struct mlme_priv *pmlmepriv, signed int state) { pmlmepriv->fw_state |= state; /* FOR HW integration */ @@ -528,7 +528,7 @@ static inline void set_fwstate(struct mlme_priv *pmlmepriv, sint state) pmlmepriv->bScanInProcess = true; } -static inline void _clr_fwstate_(struct mlme_priv *pmlmepriv, sint state) +static inline void _clr_fwstate_(struct mlme_priv *pmlmepriv, signed int state) { pmlmepriv->fw_state &= ~state; /* FOR HW integration */ @@ -540,7 +540,7 @@ static inline void _clr_fwstate_(struct mlme_priv *pmlmepriv, sint state) * No Limit on the calling context, * therefore set it to be the critical section... */ -static inline void clr_fwstate(struct mlme_priv *pmlmepriv, sint state) +static inline void clr_fwstate(struct mlme_priv *pmlmepriv, signed int state) { spin_lock_bh(&pmlmepriv->lock); if (check_fwstate(pmlmepriv, state) == true) @@ -548,7 +548,7 @@ static inline void clr_fwstate(struct mlme_priv *pmlmepriv, sint state) spin_unlock_bh(&pmlmepriv->lock); } -static inline void set_scanned_network_val(struct mlme_priv *pmlmepriv, sint val) +static inline void set_scanned_network_val(struct mlme_priv *pmlmepriv, signed int val) { spin_lock_bh(&pmlmepriv->lock); pmlmepriv->num_of_scanned = val; @@ -600,9 +600,9 @@ extern void _rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_ne extern struct wlan_network *_rtw_find_network(struct __queue *scanned_queue, u8 *addr); -extern sint rtw_if_up(struct adapter *padapter); +extern signed int rtw_if_up(struct adapter *padapter); -sint rtw_linked_check(struct adapter *padapter); +signed int rtw_linked_check(struct adapter *padapter); u8 *rtw_get_capability_from_ie(u8 *ie); u8 *rtw_get_beacon_interval_from_ie(u8 *ie); diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h index b4aeb44d5d6e..7737e3a0e105 100644 --- a/drivers/staging/rtl8723bs/include/rtw_recv.h +++ b/drivers/staging/rtl8723bs/include/rtw_recv.h @@ -276,7 +276,7 @@ struct recv_priv { struct sta_recv_priv { _lock lock; - sint option; + signed int option; /* struct __queue blk_strms[MAX_RX_NUMBLKS]; */ struct __queue defrag_q; /* keeping the fragment frame until defrag */ @@ -393,8 +393,8 @@ extern int rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *q extern void rtw_free_recvframe_queue(struct __queue *pframequeue, struct __queue *pfree_recv_queue); u32 rtw_free_uc_swdec_pending_queue(struct adapter *adapter); -sint rtw_enqueue_recvbuf_to_head(struct recv_buf *precvbuf, struct __queue *queue); -sint rtw_enqueue_recvbuf(struct recv_buf *precvbuf, struct __queue *queue); +signed int rtw_enqueue_recvbuf_to_head(struct recv_buf *precvbuf, struct __queue *queue); +signed int rtw_enqueue_recvbuf(struct recv_buf *precvbuf, struct __queue *queue); struct recv_buf *rtw_dequeue_recvbuf(struct __queue *queue); void rtw_reordering_ctrl_timeout_handler(struct timer_list *t); @@ -419,7 +419,7 @@ static inline u8 *get_recvframe_data(union recv_frame *precvframe) } -static inline u8 *recvframe_pull(union recv_frame *precvframe, sint sz) +static inline u8 *recvframe_pull(union recv_frame *precvframe, signed int sz) { /* rx_data += sz; move rx_data sz bytes hereafter */ @@ -444,7 +444,7 @@ static inline u8 *recvframe_pull(union recv_frame *precvframe, sint sz) } -static inline u8 *recvframe_put(union recv_frame *precvframe, sint sz) +static inline u8 *recvframe_put(union recv_frame *precvframe, signed int sz) { /* rx_tai += sz; move rx_tail sz bytes hereafter */ @@ -473,7 +473,7 @@ static inline u8 *recvframe_put(union recv_frame *precvframe, sint sz) -static inline u8 *recvframe_pull_tail(union recv_frame *precvframe, sint sz) +static inline u8 *recvframe_pull_tail(union recv_frame *precvframe, signed int sz) { /* rmv data from rx_tail (by yitsen) */ @@ -507,7 +507,7 @@ static inline union recv_frame *rxmem_to_recvframe(u8 *rxmem) } -static inline sint get_recvframe_len(union recv_frame *precvframe) +static inline signed int get_recvframe_len(union recv_frame *precvframe) { return precvframe->u.hdr.len; } diff --git a/drivers/staging/rtl8723bs/include/rtw_xmit.h b/drivers/staging/rtl8723bs/include/rtw_xmit.h index c04318573f8f..db5884a8a707 100644 --- a/drivers/staging/rtl8723bs/include/rtw_xmit.h +++ b/drivers/staging/rtl8723bs/include/rtw_xmit.h @@ -132,7 +132,7 @@ struct hw_xmit { /* struct list_head pending; */ struct __queue *sta_queue; /* struct hw_txqueue *phwtxqueue; */ - /* sint txcmdcnt; */ + /* signed int txcmdcnt; */ int accnt; }; @@ -313,8 +313,8 @@ struct tx_servq { struct sta_xmit_priv { _lock lock; - sint option; - sint apsd_setting; /* When bit mask is on, the associated edca queue supports APSD. */ + signed int option; + signed int apsd_setting; /* When bit mask is on, the associated edca queue supports APSD. */ /* struct tx_servq blk_q[MAX_NUMBLKS]; */ @@ -336,14 +336,14 @@ struct sta_xmit_priv { struct hw_txqueue { - volatile sint head; - volatile sint tail; - volatile sint free_sz; /* in units of 64 bytes */ - volatile sint free_cmdsz; - volatile sint txsz[8]; + volatile signed int head; + volatile signed int tail; + volatile signed int free_sz; /* in units of 64 bytes */ + volatile signed int free_cmdsz; + volatile signed int txsz[8]; uint ff_hwaddr; uint cmd_hwaddr; - sint ac_tag; + signed int ac_tag; }; struct agg_pkt_info { @@ -463,7 +463,7 @@ struct xmit_frame *rtw_alloc_xmitframe_ext(struct xmit_priv *pxmitpriv); struct xmit_frame *rtw_alloc_xmitframe_once(struct xmit_priv *pxmitpriv); extern s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitframe); extern void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, struct __queue *pframequeue); -struct tx_servq *rtw_get_sta_pending(struct adapter *padapter, struct sta_info *psta, sint up, u8 *ac); +struct tx_servq *rtw_get_sta_pending(struct adapter *padapter, struct sta_info *psta, signed int up, u8 *ac); extern s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe); extern s32 rtw_xmit_classifier(struct adapter *padapter, struct xmit_frame *pxmitframe); @@ -476,7 +476,7 @@ void _rtw_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv); s32 rtw_txframes_pending(struct adapter *padapter); -void rtw_init_hwxmits(struct hw_xmit *phwxmit, sint entry); +void rtw_init_hwxmits(struct hw_xmit *phwxmit, signed int entry); s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter); @@ -490,7 +490,7 @@ void rtw_free_hwxmits(struct adapter *padapter); s32 rtw_xmit(struct adapter *padapter, _pkt **pkt); bool xmitframe_hiq_filter(struct xmit_frame *xmitframe); -sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_frame *pxmitframe); +signed int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_frame *pxmitframe); void stop_sta_xmit(struct adapter *padapter, struct sta_info *psta); void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta); void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *psta); @@ -503,7 +503,7 @@ void enqueue_pending_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmit void enqueue_pending_xmitbuf_to_head(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf); struct xmit_buf *dequeue_pending_xmitbuf(struct xmit_priv *pxmitpriv); struct xmit_buf *dequeue_pending_xmitbuf_under_survey(struct xmit_priv *pxmitpriv); -sint check_pending_xmitbuf(struct xmit_priv *pxmitpriv); +signed int check_pending_xmitbuf(struct xmit_priv *pxmitpriv); int rtw_xmit_thread(void *context); u32 rtw_get_ff_hwaddr(struct xmit_frame *pxmitframe); diff --git a/drivers/staging/rtl8723bs/include/xmit_osdep.h b/drivers/staging/rtl8723bs/include/xmit_osdep.h index e9ff274f7474..78109c633c10 100644 --- a/drivers/staging/rtl8723bs/include/xmit_osdep.h +++ b/drivers/staging/rtl8723bs/include/xmit_osdep.h @@ -36,7 +36,7 @@ void rtw_os_xmit_resource_free(struct adapter *padapter, struct xmit_buf *pxmitb extern uint rtw_remainder_len(struct pkt_file *pfile); extern void _rtw_open_pktfile(_pkt *pkt, struct pkt_file *pfile); extern uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen); -extern sint rtw_endofpktfile(struct pkt_file *pfile); +extern signed int rtw_endofpktfile(struct pkt_file *pfile); extern void rtw_os_pkt_complete(struct adapter *padapter, _pkt *pkt); extern void rtw_os_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe); diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index e1d168d6ac86..6a28420cdb2f 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -1423,7 +1423,7 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, char *ev = extra; char *stop = ev + wrqu->data.length; u32 ret = 0; - sint wait_status; + signed int wait_status; RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_wx_get_scan\n")); RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, (" Start of Query SIOCGIWSCAN .\n")); @@ -4086,7 +4086,7 @@ static int rtw_set_hidden_ssid(struct net_device *dev, struct ieee_param *param, int ie_len; u8 *ssid_ie; char ssid[NDIS_802_11_LENGTH_SSID + 1]; - sint ssid_len; + signed int ssid_len; u8 ignore_broadcast_ssid; if (check_fwstate(mlmepriv, WIFI_AP_STATE) != true) diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c index f52802f24466..e77cd2cc29b1 100644 --- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c @@ -30,7 +30,7 @@ void rtw_os_recv_resource_alloc(struct adapter *padapter, union recv_frame *prec /* free os related resource in union recv_frame */ void rtw_os_recv_resource_free(struct recv_priv *precvpriv) { - sint i; + signed int i; union recv_frame *precvframe; precvframe = (union recv_frame *) precvpriv->precv_frame_buf; diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c index a89b88eaed39..79c477f559de 100644 --- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c @@ -39,7 +39,7 @@ uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen) return len; } -sint rtw_endofpktfile(struct pkt_file *pfile) +signed int rtw_endofpktfile(struct pkt_file *pfile) { if (pfile->pkt_len == 0) return true; -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:33 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:33 +0100 Subject: [PATCH 28/33] staging: rtl8723bs: remove typedefs in osdep_service_linux.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-29-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #43: FILE: include/osdep_service_linux.h:43: + typedef spinlock_t _lock; WARNING: do not add new typedefs #44: FILE: include/osdep_service_linux.h:44: + typedef struct mutex _mutex; WARNING: do not add new typedefs #45: FILE: include/osdep_service_linux.h:45: + typedef struct timer_list _timer; WARNING: do not add new typedefs #52: FILE: include/osdep_service_linux.h:52: + typedef struct sk_buff _pkt; WARNING: do not add new typedefs #53: FILE: include/osdep_service_linux.h:53: + typedef unsigned char _buffer; WARNING: do not add new typedefs #55: FILE: include/osdep_service_linux.h:55: + typedef int _OS_STATUS; WARNING: do not add new typedefs #57: FILE: include/osdep_service_linux.h:57: + typedef unsigned long _irqL; WARNING: do not add new typedefs #58: FILE: include/osdep_service_linux.h:58: + typedef struct net_device * _nic_hdl; WARNING: do not add new typedefs #62: FILE: include/osdep_service_linux.h:62: + typedef void timer_hdl_return; WARNING: do not add new typedefs #63: FILE: include/osdep_service_linux.h:63: + typedef void* timer_hdl_context; WARNING: do not add new typedefs #65: FILE: include/osdep_service_linux.h:65: + typedef struct work_struct _workitem; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/core/rtw_cmd.c | 8 ++--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 +- drivers/staging/rtl8723bs/core/rtw_recv.c | 2 +- drivers/staging/rtl8723bs/core/rtw_xmit.c | 18 +++++------ .../staging/rtl8723bs/hal/rtl8723bs_recv.c | 4 +-- drivers/staging/rtl8723bs/include/drv_types.h | 18 +++++------ drivers/staging/rtl8723bs/include/hal_data.h | 2 +- .../rtl8723bs/include/ioctl_cfg80211.h | 2 +- .../staging/rtl8723bs/include/osdep_intf.h | 4 +-- .../staging/rtl8723bs/include/osdep_service.h | 2 +- .../rtl8723bs/include/osdep_service_linux.h | 27 ++++------------- .../staging/rtl8723bs/include/recv_osdep.h | 6 ++-- drivers/staging/rtl8723bs/include/rtw_cmd.h | 4 +-- drivers/staging/rtl8723bs/include/rtw_io.h | 2 +- drivers/staging/rtl8723bs/include/rtw_mlme.h | 30 +++++++++---------- .../staging/rtl8723bs/include/rtw_mlme_ext.h | 8 ++--- drivers/staging/rtl8723bs/include/rtw_mp.h | 4 +-- .../staging/rtl8723bs/include/rtw_pwrctrl.h | 8 ++--- drivers/staging/rtl8723bs/include/rtw_recv.h | 16 +++++----- drivers/staging/rtl8723bs/include/rtw_xmit.h | 18 +++++------ drivers/staging/rtl8723bs/include/sta_info.h | 10 +++---- .../staging/rtl8723bs/include/xmit_osdep.h | 12 ++++---- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 2 +- .../staging/rtl8723bs/os_dep/osdep_service.c | 2 +- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 12 ++++---- drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 10 +++---- 26 files changed, 108 insertions(+), 125 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c index 3fe79169a811..bdb77bd46a20 100644 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@ -203,7 +203,7 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) return res; } -static void c2h_wk_callback(_workitem * work); +static void c2h_wk_callback(struct work_struct * work); int rtw_init_evt_priv(struct evt_priv *pevtpriv) { /* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */ @@ -260,7 +260,7 @@ ISR/Call-Back functions can't call this sub-function. int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj) { - _irqL irqL; + unsigned long irqL; if (obj == NULL) goto exit; @@ -279,7 +279,7 @@ int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj) struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue) { - _irqL irqL; + unsigned long irqL; struct cmd_obj *obj; /* spin_lock_bh(&(queue->lock)); */ @@ -1875,7 +1875,7 @@ u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt) return res; } -static void c2h_wk_callback(_workitem *work) +static void c2h_wk_callback(struct work_struct *work) { struct evt_priv *evtpriv = container_of(work, struct evt_priv, c2h_wk); struct adapter *adapter = container_of(evtpriv, struct adapter, evtpriv); diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index ca79e60838fe..23362b39082b 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -2340,7 +2340,7 @@ void dump_mgntframe(struct adapter *padapter, struct xmit_frame *pmgntframe) s32 dump_mgntframe_and_wait(struct adapter *padapter, struct xmit_frame *pmgntframe, int timeout_ms) { s32 ret = _FAIL; - _irqL irqL; + unsigned long irqL; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct xmit_buf *pxmitbuf = pmgntframe->pxmitbuf; struct submit_ctx sctx; diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c index c8353405d11f..697da6834810 100644 --- a/drivers/staging/rtl8723bs/core/rtw_recv.c +++ b/drivers/staging/rtl8723bs/core/rtw_recv.c @@ -1846,7 +1846,7 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe) u16 nSubframe_Length; u8 nr_subframes, i; u8 *pdata; - _pkt *sub_pkt, *subframes[MAX_SUBFRAME_COUNT]; + struct sk_buff *sub_pkt, *subframes[MAX_SUBFRAME_COUNT]; struct recv_priv *precvpriv = &padapter->recvpriv; struct __queue *pfree_recv_queue = &(precvpriv->free_recv_queue); diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c index 0644b85c6f4c..9d45484acdeb 100644 --- a/drivers/staging/rtl8723bs/core/rtw_xmit.c +++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c @@ -641,7 +641,7 @@ static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib) pattrib->subtype = WIFI_QOS_DATA_TYPE; } -static s32 update_attrib(struct adapter *padapter, _pkt *pkt, struct pkt_attrib *pattrib) +static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct pkt_attrib *pattrib) { struct pkt_file pktfile; struct sta_info *psta = NULL; @@ -1085,7 +1085,7 @@ This sub-routine will perform all the following: 6. apply sw-encrypt, if necessary. */ -s32 rtw_xmitframe_coalesce(struct adapter *padapter, _pkt *pkt, struct xmit_frame *pxmitframe) +s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct xmit_frame *pxmitframe) { struct pkt_file pktfile; @@ -1216,7 +1216,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, _pkt *pkt, struct xmit_fram } /* broadcast or multicast management pkt use BIP, unicast management pkt use CCMP encryption */ -s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, _pkt *pkt, struct xmit_frame *pxmitframe) +s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct xmit_frame *pxmitframe) { u8 *pframe, *mem_start = NULL, *tmp_buf = NULL; u8 subtype; @@ -1534,7 +1534,7 @@ struct xmit_frame *__rtw_alloc_cmdxmitframe(struct xmit_priv *pxmitpriv, struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv) { - _irqL irqL; + unsigned long irqL; struct xmit_buf *pxmitbuf = NULL; struct list_head *plist, *phead; struct __queue *pfree_queue = &pxmitpriv->free_xmit_extbuf_queue; @@ -1578,7 +1578,7 @@ struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv) s32 rtw_free_xmitbuf_ext(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) { - _irqL irqL; + unsigned long irqL; struct __queue *pfree_queue = &pxmitpriv->free_xmit_extbuf_queue; if (!pxmitbuf) @@ -1601,7 +1601,7 @@ s32 rtw_free_xmitbuf_ext(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv) { - _irqL irqL; + unsigned long irqL; struct xmit_buf *pxmitbuf = NULL; struct list_head *plist, *phead; struct __queue *pfree_xmitbuf_queue = &pxmitpriv->free_xmitbuf_queue; @@ -1650,7 +1650,7 @@ struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv) s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) { - _irqL irqL; + unsigned long irqL; struct __queue *pfree_xmitbuf_queue = &pxmitpriv->free_xmitbuf_queue; if (!pxmitbuf) @@ -1804,7 +1804,7 @@ s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitfram { struct __queue *queue = NULL; struct adapter *padapter = pxmitpriv->adapter; - _pkt *pndis_pkt = NULL; + struct sk_buff *pndis_pkt = NULL; if (!pxmitframe) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("======rtw_free_xmitframe():pxmitframe == NULL!!!!!!!!!!\n")); @@ -2077,7 +2077,7 @@ static void do_queue_select(struct adapter *padapter, struct pkt_attrib *pattrib *0 success, hardware will handle this xmit frame(packet) *<0 fail */ -s32 rtw_xmit(struct adapter *padapter, _pkt **ppkt) +s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt) { static unsigned long start; static u32 drop_cnt; diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c index 415e519e8aa0..9e1b33c71710 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c @@ -98,7 +98,7 @@ static void update_recvframe_phyinfo(union recv_frame *precvframe, .is_beacon = false, }; - /* _irqL irqL; */ + /* unsigned long irqL; */ struct sta_priv *pstapriv; struct sta_info *psta; @@ -242,7 +242,7 @@ static void rtl8723bs_recv_tasklet(struct tasklet_struct *t) struct __queue *recv_buf_queue; u8 *ptr; u32 pkt_offset, skb_len, alloc_sz; - _pkt *pkt_copy = NULL; + struct sk_buff *pkt_copy = NULL; u8 shift_sz = 0, rx_report_sz = 0; p_hal_data = GET_HAL_DATA(padapter); diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h index 59d7e22cddca..97e8e462d718 100644 --- a/drivers/staging/rtl8723bs/include/drv_types.h +++ b/drivers/staging/rtl8723bs/include/drv_types.h @@ -277,7 +277,7 @@ struct rtw_traffic_statistics { }; struct cam_ctl_t { - _lock lock; + spinlock_t lock; u64 bitmap; }; @@ -303,13 +303,13 @@ struct dvobj_priv { /* for local/global synchronization */ /* */ - _lock lock; + spinlock_t lock; int macid[NUM_STA]; - _mutex hw_init_mutex; - _mutex h2c_fwcmd_mutex; - _mutex setch_mutex; - _mutex setbw_mutex; + struct mutex hw_init_mutex; + struct mutex h2c_fwcmd_mutex; + struct mutex setch_mutex; + struct mutex setbw_mutex; unsigned char oper_channel; /* saved channel info when call set_channel_bw */ unsigned char oper_bwmode; @@ -393,7 +393,7 @@ struct adapter { struct recv_priv recvpriv; struct sta_priv stapriv; struct security_priv securitypriv; - _lock security_key_mutex; /* add for CONFIG_IEEE80211W, none 11w also can use */ + spinlock_t security_key_mutex; /* add for CONFIG_IEEE80211W, none 11w also can use */ struct registry_priv registrypriv; struct eeprom_priv eeprompriv; @@ -432,12 +432,12 @@ struct adapter { void (*intf_start)(struct adapter * adapter); void (*intf_stop)(struct adapter * adapter); - _nic_hdl pnetdev; + struct net_device * pnetdev; char old_ifname[IFNAMSIZ]; /* used by rtw_rereg_nd_name related function */ struct rereg_nd_name_data { - _nic_hdl old_pnetdev; + struct net_device * old_pnetdev; char old_ifname[IFNAMSIZ]; u8 old_ips_mode; u8 old_bRegUseLed; diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h index c933dc6cada2..9c21208765ef 100644 --- a/drivers/staging/rtl8723bs/include/hal_data.h +++ b/drivers/staging/rtl8723bs/include/hal_data.h @@ -419,7 +419,7 @@ struct hal_com_data { /* SDIO Tx FIFO related. */ /* HIQ, MID, LOW, PUB free pages; padapter->xmitpriv.free_txpg */ u8 SdioTxFIFOFreePage[SDIO_TX_FREE_PG_QUEUE]; - _lock SdioTxFIFOFreePageLock; + spinlock_t SdioTxFIFOFreePageLock; u8 SdioTxOQTMaxFreeSpace; u8 SdioTxOQTFreeSpace; diff --git a/drivers/staging/rtl8723bs/include/ioctl_cfg80211.h b/drivers/staging/rtl8723bs/include/ioctl_cfg80211.h index 44d0a0982659..2907a6fce7a9 100644 --- a/drivers/staging/rtl8723bs/include/ioctl_cfg80211.h +++ b/drivers/staging/rtl8723bs/include/ioctl_cfg80211.h @@ -67,7 +67,7 @@ struct rtw_wdev_priv { struct adapter *padapter; struct cfg80211_scan_request *scan_request; - _lock scan_req_lock; + spinlock_t scan_req_lock; struct net_device *pmon_ndev;/* for monitor interface */ char ifname_mon[IFNAMSIZ + 1]; /* interface name for monitor interface */ diff --git a/drivers/staging/rtl8723bs/include/osdep_intf.h b/drivers/staging/rtl8723bs/include/osdep_intf.h index c59c1384944b..e9fee6bf8d43 100644 --- a/drivers/staging/rtl8723bs/include/osdep_intf.h +++ b/drivers/staging/rtl8723bs/include/osdep_intf.h @@ -32,7 +32,7 @@ Under Async. IRP (SDIO/USB) The protection mechanism is through the pending queue. */ - _mutex ioctl_mutex; + struct mutex ioctl_mutex; }; @@ -70,7 +70,7 @@ int rtw_ips_pwr_up(struct adapter *padapter); void rtw_ips_pwr_down(struct adapter *padapter); int rtw_drv_register_netdev(struct adapter *padapter); -void rtw_ndev_destructor(_nic_hdl ndev); +void rtw_ndev_destructor(struct net_device * ndev); int rtw_suspend_common(struct adapter *padapter); int rtw_resume_common(struct adapter *padapter); diff --git a/drivers/staging/rtl8723bs/include/osdep_service.h b/drivers/staging/rtl8723bs/include/osdep_service.h index c241bb66a23e..63971fd691ed 100644 --- a/drivers/staging/rtl8723bs/include/osdep_service.h +++ b/drivers/staging/rtl8723bs/include/osdep_service.h @@ -94,7 +94,7 @@ void _kfree(u8 *pbuf, u32 sz); struct sk_buff *_rtw_skb_alloc(u32 sz); struct sk_buff *_rtw_skb_copy(const struct sk_buff *skb); -int _rtw_netif_rx(_nic_hdl ndev, struct sk_buff *skb); +int _rtw_netif_rx(struct net_device * ndev, struct sk_buff *skb); #define rtw_malloc(sz) _rtw_malloc((sz)) #define rtw_zmalloc(sz) _rtw_zmalloc((sz)) diff --git a/drivers/staging/rtl8723bs/include/osdep_service_linux.h b/drivers/staging/rtl8723bs/include/osdep_service_linux.h index 9194dea217fb..6454625d6bcf 100644 --- a/drivers/staging/rtl8723bs/include/osdep_service_linux.h +++ b/drivers/staging/rtl8723bs/include/osdep_service_linux.h @@ -40,30 +40,13 @@ #include #include - typedef spinlock_t _lock; - typedef struct mutex _mutex; - typedef struct timer_list _timer; - struct __queue { struct list_head queue; - _lock lock; + spinlock_t lock; }; - typedef struct sk_buff _pkt; - typedef unsigned char _buffer; - - typedef int _OS_STATUS; - /* typedef u32 _irqL; */ - typedef unsigned long _irqL; - typedef struct net_device * _nic_hdl; - #define thread_exit() complete_and_exit(NULL, 0) - typedef void timer_hdl_return; - typedef void* timer_hdl_context; - - typedef struct work_struct _workitem; - static inline struct list_head *get_next(struct list_head *list) { return list->next; @@ -74,22 +57,22 @@ static inline struct list_head *get_list_head(struct __queue *queue) return (&(queue->queue)); } -static inline void _set_timer(_timer *ptimer, u32 delay_time) +static inline void _set_timer(struct timer_list *ptimer, u32 delay_time) { mod_timer(ptimer, (jiffies + (delay_time * HZ / 1000))); } -static inline void _init_workitem(_workitem *pwork, void *pfunc, void *cntx) +static inline void _init_workitem(struct work_struct *pwork, void *pfunc, void *cntx) { INIT_WORK(pwork, pfunc); } -static inline void _set_workitem(_workitem *pwork) +static inline void _set_workitem(struct work_struct *pwork) { schedule_work(pwork); } -static inline void _cancel_workitem_sync(_workitem *pwork) +static inline void _cancel_workitem_sync(struct work_struct *pwork) { cancel_work_sync(pwork); } diff --git a/drivers/staging/rtl8723bs/include/recv_osdep.h b/drivers/staging/rtl8723bs/include/recv_osdep.h index 5f686cb339ba..82830ffc530a 100644 --- a/drivers/staging/rtl8723bs/include/recv_osdep.h +++ b/drivers/staging/rtl8723bs/include/recv_osdep.h @@ -14,7 +14,7 @@ extern void _rtw_free_recv_priv(struct recv_priv *precvpriv); extern s32 rtw_recv_entry(union recv_frame *precv_frame); extern int rtw_recv_indicatepkt(struct adapter *adapter, union recv_frame *precv_frame); -extern void rtw_recv_returnpacket(_nic_hdl cnxt, _pkt *preturnedpkt); +extern void rtw_recv_returnpacket(struct net_device * cnxt, struct sk_buff *preturnedpkt); extern void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup); @@ -31,8 +31,8 @@ void rtw_os_free_recvframe(union recv_frame *precvframe); void rtw_os_recvbuf_resource_free(struct adapter *padapter, struct recv_buf *precvbuf); -_pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 *pdata); -void rtw_os_recv_indicate_pkt(struct adapter *padapter, _pkt *pkt, struct rx_pkt_attrib *pattrib); +struct sk_buff *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 *pdata); +void rtw_os_recv_indicate_pkt(struct adapter *padapter, struct sk_buff *pkt, struct rx_pkt_attrib *pattrib); void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl); diff --git a/drivers/staging/rtl8723bs/include/rtw_cmd.h b/drivers/staging/rtl8723bs/include/rtw_cmd.h index f2459ad8c1e8..9e42731f8fa3 100644 --- a/drivers/staging/rtl8723bs/include/rtw_cmd.h +++ b/drivers/staging/rtl8723bs/include/rtw_cmd.h @@ -53,11 +53,11 @@ /* u8 cmdthd_running; */ u8 stop_req; struct adapter *padapter; - _mutex sctx_mutex; + struct mutex sctx_mutex; }; struct evt_priv { - _workitem c2h_wk; + struct work_struct c2h_wk; bool c2h_wk_alive; struct rtw_cbuf *c2h_queue; #define C2H_QUEUE_MAX_LEN 10 diff --git a/drivers/staging/rtl8723bs/include/rtw_io.h b/drivers/staging/rtl8723bs/include/rtw_io.h index b7076b590d84..c83d8c66bd86 100644 --- a/drivers/staging/rtl8723bs/include/rtw_io.h +++ b/drivers/staging/rtl8723bs/include/rtw_io.h @@ -250,7 +250,7 @@ Below is the data structure used by _io_handler */ struct io_queue { - _lock lock; + spinlock_t lock; struct list_head free_ioreqs; struct list_head pending; /* The io_req list that will be served in the single protocol read/write. */ struct list_head processing; diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h index 18f1653fc975..1ebc1e183381 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mlme.h +++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h @@ -131,7 +131,7 @@ struct sitesurvey_ctrl { u64 last_tx_pkts; uint last_rx_pkts; signed int traffic_busy; - _timer sitesurvey_ctrl_timer; + struct timer_list sitesurvey_ctrl_timer; }; struct RT_LINK_DETECT_T { @@ -203,7 +203,7 @@ struct scan_limit_info { }; struct cfg80211_wifidirect_info { - _timer remain_on_ch_timer; + struct timer_list remain_on_ch_timer; u8 restore_channel; struct ieee80211_channel remain_on_ch_channel; enum nl80211_channel_type remain_on_ch_type; @@ -214,13 +214,13 @@ struct cfg80211_wifidirect_info { struct wifidirect_info { struct adapter *padapter; - _timer find_phase_timer; - _timer restore_p2p_state_timer; + struct timer_list find_phase_timer; + struct timer_list restore_p2p_state_timer; /* Used to do the scanning. After confirming the peer is availalble, the driver transmits the P2P frame to peer. */ - _timer pre_tx_scan_timer; - _timer reset_ch_sitesurvey; - _timer reset_ch_sitesurvey2; /* Just for resetting the scan limit function by using p2p nego */ + struct timer_list pre_tx_scan_timer; + struct timer_list reset_ch_sitesurvey; + struct timer_list reset_ch_sitesurvey2; /* Just for resetting the scan limit function by using p2p nego */ struct tx_provdisc_req_info tx_prov_disc_info; struct rx_provdisc_req_info rx_prov_disc_info; struct tx_invite_req_info invitereq_info; @@ -302,8 +302,8 @@ struct tdls_info { u8 cur_channel; u8 candidate_ch; u8 collect_pkt_num[MAX_CHANNEL_NUM]; - _lock cmd_lock; - _lock hdl_lock; + spinlock_t cmd_lock; + spinlock_t hdl_lock; u8 watchdog_count; u8 dev_discovered; /* WFD_TDLS: for sigma test */ u8 tdls_enable; @@ -329,7 +329,7 @@ enum { struct mlme_priv { - _lock lock; + spinlock_t lock; signed int fw_state; /* shall we protect this variable? maybe not necessarily... */ u8 bScanInProcess; u8 to_join; /* flag */ @@ -361,15 +361,15 @@ struct mlme_priv { u32 auto_scan_int_ms; - _timer assoc_timer; + struct timer_list assoc_timer; uint assoc_by_bssid; uint assoc_by_rssi; - _timer scan_to_timer; /* driver itself handles scan_timeout status. */ + struct timer_list scan_to_timer; /* driver itself handles scan_timeout status. */ unsigned long scan_start_time; /* used to evaluate the time spent in scanning */ - _timer set_scan_deny_timer; + struct timer_list set_scan_deny_timer; atomic_t set_scan_deny; /* 0: allowed, 1: deny */ struct qos_priv qospriv; @@ -386,7 +386,7 @@ struct mlme_priv { struct ht_priv htpriv; struct RT_LINK_DETECT_T LinkDetectInfo; - _timer dynamic_chk_timer; /* dynamic/periodic check timer */ + struct timer_list dynamic_chk_timer; /* dynamic/periodic check timer */ u8 acm_mask; /* for wmm acm mask */ u8 ChannelPlan; @@ -448,7 +448,7 @@ struct mlme_priv { u32 p2p_go_probe_resp_ie_len; /* for GO */ u32 p2p_assoc_req_ie_len; - _lock bcn_update_lock; + spinlock_t bcn_update_lock; u8 update_bcn; u8 NumOfBcnInfoChkFail; diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h index 6aa3805b7abd..b7bf92d1328f 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h @@ -483,10 +483,10 @@ struct mlme_ext_priv { struct ss_res sitesurvey_res; struct mlme_ext_info mlmext_info;/* for sta/adhoc mode, including current scanning/connecting/connected related info. */ /* for ap mode, network includes ap's cap_info */ - _timer survey_timer; - _timer link_timer; - _timer sa_query_timer; - /* _timer ADDBA_timer; */ + struct timer_list survey_timer; + struct timer_list link_timer; + struct timer_list sa_query_timer; + /* struct timer_list ADDBA_timer; */ u16 chan_scan_time; unsigned long last_scan_time; u8 scan_abort; diff --git a/drivers/staging/rtl8723bs/include/rtw_mp.h b/drivers/staging/rtl8723bs/include/rtw_mp.h index 6cf598439e5c..a7fa82586967 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mp.h +++ b/drivers/staging/rtl8723bs/include/rtw_mp.h @@ -15,7 +15,7 @@ struct mp_xmit_frame { struct pkt_attrib attrib; - _pkt *pkt; + struct sk_buff *pkt; int frame_tag; @@ -56,7 +56,7 @@ struct MPT_CONTEXT { /* Indicate if the driver is unloading or unloaded. */ bool bMptDrvUnload; - _timer MPh2c_timeout_timer; + struct timer_list MPh2c_timeout_timer; /* Event used to sync H2c for BT control */ bool MptH2cRspEvent; diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h index 0987891e85ae..b1ef4e0ba9fe 100644 --- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h @@ -212,10 +212,10 @@ struct pwrctrl_priv { u8 dtim; u32 alives; - _workitem cpwm_event; + struct work_struct cpwm_event; u8 brpwmtimeout; - _workitem rpwmtimeoutwi; - _timer pwr_rpwm_timer; + struct work_struct rpwmtimeoutwi; + struct timer_list pwr_rpwm_timer; u8 bpower_saving; /* for LPS/IPS */ u8 b_hw_radio_off; @@ -282,7 +282,7 @@ struct pwrctrl_priv { u32 wowlan_pattern_context[8][5]; u64 wowlan_fw_iv; #endif /* CONFIG_WOWLAN */ - _timer pwr_state_check_timer; + struct timer_list pwr_state_check_timer; struct adapter *adapter; int pwr_state_check_interval; u8 pwr_state_check_cnts; diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h index 7737e3a0e105..2cc5e0beb90b 100644 --- a/drivers/staging/rtl8723bs/include/rtw_recv.h +++ b/drivers/staging/rtl8723bs/include/rtw_recv.h @@ -47,7 +47,7 @@ struct recv_reorder_ctrl { u16 wend_b; u8 wsize_b; struct __queue pending_recvframe_queue; - _timer reordering_ctrl_timer; + struct timer_list reordering_ctrl_timer; }; struct stainfo_rxcache { @@ -214,7 +214,7 @@ accesser of recv_priv: rtw_recv_entry(dispatch / passive level); recv_thread(pas using enter_critical section to protect */ struct recv_priv { - _lock lock; + spinlock_t lock; struct __queue free_recv_queue; struct __queue recv_pending_queue; struct __queue uc_swdec_pending_queue; @@ -264,7 +264,7 @@ struct recv_priv { /* int FalseAlmCnt_all; */ - _timer signal_stat_timer; + struct timer_list signal_stat_timer; u32 signal_stat_sampling_interval; /* u32 signal_stat_converging_constant; */ struct signal_stat signal_qual_data; @@ -275,7 +275,7 @@ struct recv_priv { struct sta_recv_priv { - _lock lock; + spinlock_t lock; signed int option; /* struct __queue blk_strms[MAX_RX_NUMBLKS]; */ @@ -293,7 +293,7 @@ struct sta_recv_priv { struct recv_buf { struct list_head list; - _lock recvbuf_lock; + spinlock_t recvbuf_lock; u32 ref_cnt; @@ -308,7 +308,7 @@ struct recv_buf { u8 *ptail; u8 *pend; - _pkt *pskb; + struct sk_buff *pskb; u8 reuse; }; @@ -334,8 +334,8 @@ struct recv_frame_hdr { struct sk_buff *pkt; struct sk_buff *pkt_newalloc; #else /* CONFIG_BSD_RX_USE_MBUF */ - _pkt *pkt; - _pkt *pkt_newalloc; + struct sk_buff *pkt; + struct sk_buff *pkt_newalloc; #endif /* CONFIG_BSD_RX_USE_MBUF */ struct adapter *adapter; diff --git a/drivers/staging/rtl8723bs/include/rtw_xmit.h b/drivers/staging/rtl8723bs/include/rtw_xmit.h index db5884a8a707..a6fb8be8c63a 100644 --- a/drivers/staging/rtl8723bs/include/rtw_xmit.h +++ b/drivers/staging/rtl8723bs/include/rtw_xmit.h @@ -128,7 +128,7 @@ union txdesc { }; struct hw_xmit { - /* _lock xmit_lock; */ + /* spinlock_t xmit_lock; */ /* struct list_head pending; */ struct __queue *sta_queue; /* struct hw_txqueue *phwtxqueue; */ @@ -284,7 +284,7 @@ struct xmit_frame { struct pkt_attrib attrib; - _pkt *pkt; + struct sk_buff *pkt; int frame_tag; @@ -312,7 +312,7 @@ struct tx_servq { struct sta_xmit_priv { - _lock lock; + spinlock_t lock; signed int option; signed int apsd_setting; /* When bit mask is on, the associated edca queue supports APSD. */ @@ -359,7 +359,7 @@ enum cmdbuf_type { struct xmit_priv { - _lock lock; + spinlock_t lock; struct completion xmit_comp; struct completion terminate_xmitthread_comp; @@ -436,10 +436,10 @@ struct xmit_priv { u16 nqos_ssn; int ack_tx; - _mutex ack_tx_mutex; + struct mutex ack_tx_mutex; struct submit_ctx ack_tx_ops; u8 seq_no; - _lock lock_sctx; + spinlock_t lock_sctx; }; extern struct xmit_frame *__rtw_alloc_cmdxmitframe(struct xmit_priv *pxmitpriv, @@ -469,8 +469,8 @@ extern s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *px extern s32 rtw_xmit_classifier(struct adapter *padapter, struct xmit_frame *pxmitframe); extern u32 rtw_calculate_wlan_pkt_size_by_attribue(struct pkt_attrib *pattrib); #define rtw_wlan_pkt_size(f) rtw_calculate_wlan_pkt_size_by_attribue(&f->attrib) -extern s32 rtw_xmitframe_coalesce(struct adapter *padapter, _pkt *pkt, struct xmit_frame *pxmitframe); -extern s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, _pkt *pkt, struct xmit_frame *pxmitframe); +extern s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct xmit_frame *pxmitframe); +extern s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct xmit_frame *pxmitframe); s32 _rtw_init_hw_txqueue(struct hw_txqueue *phw_txqueue, u8 ac_tag); void _rtw_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv); @@ -487,7 +487,7 @@ s32 rtw_alloc_hwxmits(struct adapter *padapter); void rtw_free_hwxmits(struct adapter *padapter); -s32 rtw_xmit(struct adapter *padapter, _pkt **pkt); +s32 rtw_xmit(struct adapter *padapter, struct sk_buff **pkt); bool xmitframe_hiq_filter(struct xmit_frame *xmitframe); signed int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_frame *pxmitframe); diff --git a/drivers/staging/rtl8723bs/include/sta_info.h b/drivers/staging/rtl8723bs/include/sta_info.h index 1dbbe6cbf174..28fb9f26466b 100644 --- a/drivers/staging/rtl8723bs/include/sta_info.h +++ b/drivers/staging/rtl8723bs/include/sta_info.h @@ -69,7 +69,7 @@ struct stainfo_stats { struct sta_info { - _lock lock; + spinlock_t lock; struct list_head list; /* free_sta_queue */ struct list_head hash_list; /* sta_hash */ struct adapter *padapter; @@ -121,7 +121,7 @@ struct sta_info { struct stainfo_stats sta_stats; /* for A-MPDU TX, ADDBA timeout check */ - _timer addba_retry_timer; + struct timer_list addba_retry_timer; /* for A-MPDU Rx reordering buffer control */ struct recv_reorder_ctrl recvreorder_ctrl[16]; @@ -314,7 +314,7 @@ struct sta_priv { u8 *pstainfo_buf; struct __queue free_sta_queue; - _lock sta_hash_lock; + spinlock_t sta_hash_lock; struct list_head sta_hash[NUM_STA]; int asoc_sta_count; struct __queue sleep_q; @@ -324,8 +324,8 @@ struct sta_priv { struct list_head asoc_list; struct list_head auth_list; - _lock asoc_list_lock; - _lock auth_list_lock; + spinlock_t asoc_list_lock; + spinlock_t auth_list_lock; u8 asoc_list_cnt; u8 auth_list_cnt; diff --git a/drivers/staging/rtl8723bs/include/xmit_osdep.h b/drivers/staging/rtl8723bs/include/xmit_osdep.h index 78109c633c10..0e0d8d150f78 100644 --- a/drivers/staging/rtl8723bs/include/xmit_osdep.h +++ b/drivers/staging/rtl8723bs/include/xmit_osdep.h @@ -9,9 +9,9 @@ struct pkt_file { - _pkt *pkt; + struct sk_buff *pkt; __kernel_size_t pkt_len; /* the remainder length of the open_file */ - _buffer *cur_buffer; + unsigned char *cur_buffer; u8 *buf_start; u8 *cur_addr; __kernel_size_t buf_len; @@ -25,8 +25,8 @@ struct sta_xmit_priv; struct xmit_frame; struct xmit_buf; -extern int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev); -extern int rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev); +extern int _rtw_xmit_entry(struct sk_buff *pkt, struct net_device * pnetdev); +extern int rtw_xmit_entry(struct sk_buff *pkt, struct net_device * pnetdev); void rtw_os_xmit_schedule(struct adapter *padapter); @@ -34,11 +34,11 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb void rtw_os_xmit_resource_free(struct adapter *padapter, struct xmit_buf *pxmitbuf, u32 free_sz, u8 flag); extern uint rtw_remainder_len(struct pkt_file *pfile); -extern void _rtw_open_pktfile(_pkt *pkt, struct pkt_file *pfile); +extern void _rtw_open_pktfile(struct sk_buff *pkt, struct pkt_file *pfile); extern uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen); extern signed int rtw_endofpktfile(struct pkt_file *pfile); -extern void rtw_os_pkt_complete(struct adapter *padapter, _pkt *pkt); +extern void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt); extern void rtw_os_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe); #endif /* __XMIT_OSDEP_H_ */ diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index b62fe9238e6d..4ece23737712 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -205,7 +205,7 @@ int _netdev_open(struct net_device *pnetdev); int netdev_open(struct net_device *pnetdev); static int netdev_close(struct net_device *pnetdev); -static void loadparam(struct adapter *padapter, _nic_hdl pnetdev) +static void loadparam(struct adapter *padapter, struct net_device * pnetdev) { struct registry_priv *registry_par = &padapter->registrypriv; diff --git a/drivers/staging/rtl8723bs/os_dep/osdep_service.c b/drivers/staging/rtl8723bs/os_dep/osdep_service.c index 3c71d2fafabf..e2b8923df129 100644 --- a/drivers/staging/rtl8723bs/os_dep/osdep_service.c +++ b/drivers/staging/rtl8723bs/os_dep/osdep_service.c @@ -47,7 +47,7 @@ inline struct sk_buff *_rtw_skb_copy(const struct sk_buff *skb) return skb_copy(skb, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); } -inline int _rtw_netif_rx(_nic_hdl ndev, struct sk_buff *skb) +inline int _rtw_netif_rx(struct net_device * ndev, struct sk_buff *skb) { skb->dev = ndev; return netif_rx(skb); diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c index e77cd2cc29b1..160653c0cc91 100644 --- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c @@ -53,10 +53,10 @@ void rtw_os_recvbuf_resource_free(struct adapter *padapter, struct recv_buf *pre } } -_pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 *pdata) +struct sk_buff *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 *pdata) { u16 eth_type; - _pkt *sub_skb; + struct sk_buff *sub_skb; struct rx_pkt_attrib *pattrib; pattrib = &prframe->u.hdr.attrib; @@ -95,7 +95,7 @@ _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 return sub_skb; } -void rtw_os_recv_indicate_pkt(struct adapter *padapter, _pkt *pkt, struct rx_pkt_attrib *pattrib) +void rtw_os_recv_indicate_pkt(struct adapter *padapter, struct sk_buff *pkt, struct rx_pkt_attrib *pattrib) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; int ret; @@ -103,7 +103,7 @@ void rtw_os_recv_indicate_pkt(struct adapter *padapter, _pkt *pkt, struct rx_pkt /* Indicate the packets to upper layer */ if (pkt) { if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { - _pkt *pskb2 = NULL; + struct sk_buff *pskb2 = NULL; struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; int bmcast = IS_MCAST(pattrib->dst); @@ -201,7 +201,7 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup) #ifdef CONFIG_AUTO_AP_MODE static void rtw_os_ksocket_send(struct adapter *padapter, union recv_frame *precv_frame) { - _pkt *skb = precv_frame->u.hdr.pkt; + struct sk_buff *skb = precv_frame->u.hdr.pkt; struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; struct sta_info *psta = precv_frame->u.hdr.psta; @@ -235,7 +235,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame { struct recv_priv *precvpriv; struct __queue *pfree_recv_queue; - _pkt *skb; + struct sk_buff *skb; struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; precvpriv = &(padapter->recvpriv); diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c index 79c477f559de..83d7cbbcdf93 100644 --- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c @@ -15,7 +15,7 @@ uint rtw_remainder_len(struct pkt_file *pfile) return (pfile->buf_len - ((SIZE_PTR)(pfile->cur_addr) - (SIZE_PTR)(pfile->buf_start))); } -void _rtw_open_pktfile(_pkt *pktptr, struct pkt_file *pfile) +void _rtw_open_pktfile(struct sk_buff *pktptr, struct pkt_file *pfile) { pfile->pkt = pktptr; pfile->cur_addr = pfile->buf_start = pktptr->data; @@ -67,7 +67,7 @@ void rtw_os_xmit_resource_free(struct adapter *padapter, struct xmit_buf *pxmitb #define WMM_XMIT_THRESHOLD (NR_XMITFRAME * 2 / 5) -void rtw_os_pkt_complete(struct adapter *padapter, _pkt *pkt) +void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt) { u16 queue; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; @@ -104,7 +104,7 @@ void rtw_os_xmit_schedule(struct adapter *padapter) complete(&pri_adapter->xmitpriv.xmit_comp); } -static void rtw_check_xmit_resource(struct adapter *padapter, _pkt *pkt) +static void rtw_check_xmit_resource(struct adapter *padapter, struct sk_buff *pkt) { struct xmit_priv *pxmitpriv = &padapter->xmitpriv; u16 queue; @@ -189,7 +189,7 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb) return true; } -int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev) +int _rtw_xmit_entry(struct sk_buff *pkt, struct net_device * pnetdev) { struct adapter *padapter = rtw_netdev_priv(pnetdev); struct xmit_priv *pxmitpriv = &padapter->xmitpriv; @@ -244,7 +244,7 @@ int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev) return 0; } -int rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev) +int rtw_xmit_entry(struct sk_buff *pkt, struct net_device * pnetdev) { int ret = 0; -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:36 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:36 +0100 Subject: [PATCH 31/33] staging: rtl8723bs: remove typedefs in odm_DIG.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-32-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #11: FILE: hal/odm_DIG.h:11: +typedef struct _Dynamic_Initial_Gain_Threshold_ { WARNING: do not add new typedefs #62: FILE: hal/odm_DIG.h:62: +typedef struct false_ALARM_STATISTICS { WARNING: do not add new typedefs #80: FILE: hal/odm_DIG.h:80: +typedef enum tag_Dynamic_Init_Gain_Operation_Type_Definition { WARNING: do not add new typedefs #91: FILE: hal/odm_DIG.h:91: +typedef enum tag_ODM_PauseDIG_Type { WARNING: do not add new typedefs #96: FILE: hal/odm_DIG.h:96: +typedef enum tag_ODM_PauseCCKPD_Type { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/hal_com.c | 2 +- drivers/staging/rtl8723bs/hal/odm.c | 2 +- drivers/staging/rtl8723bs/hal/odm.h | 6 ++--- drivers/staging/rtl8723bs/hal/odm_DIG.c | 26 +++++++++---------- drivers/staging/rtl8723bs/hal/odm_DIG.h | 22 ++++++++-------- drivers/staging/rtl8723bs/hal/rtl8723b_dm.c | 2 +- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 2 +- 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 9eaf35e8e442..4a1ca57c2e15 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -1172,7 +1172,7 @@ u8 SetHalDefVar( odm->SupportAbility &= (~DYNAMIC_BB_ANT_DIV); } else if (dm_func == 6) {/* turn on all dynamic func */ if (!(odm->SupportAbility & DYNAMIC_BB_DIG)) { - DIG_T *pDigTable = &odm->DM_DigTable; + struct DIG_T *pDigTable = &odm->DM_DigTable; pDigTable->CurIGValue = rtw_read8(adapter, 0xc50); } dm->DMFlag |= DYNAMIC_FUNC_BT; diff --git a/drivers/staging/rtl8723bs/hal/odm.c b/drivers/staging/rtl8723bs/hal/odm.c index 4c8f86fd22a3..4337f3b614f9 100644 --- a/drivers/staging/rtl8723bs/hal/odm.c +++ b/drivers/staging/rtl8723bs/hal/odm.c @@ -417,7 +417,7 @@ void ODM_DMWatchdog(struct DM_ODM_T * pDM_Odm) odm_DIG(pDM_Odm); { - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; odm_Adaptivity(pDM_Odm, pDM_DigTable->CurIGValue); } diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h index 52e66d1e466c..2bcb55878b12 100644 --- a/drivers/staging/rtl8723bs/hal/odm.h +++ b/drivers/staging/rtl8723bs/hal/odm.h @@ -1110,13 +1110,13 @@ struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ /* ODM Structure */ /* */ struct FAT_T DM_FatTable; - DIG_T DM_DigTable; + struct DIG_T DM_DigTable; PS_T DM_PSTable; struct dynamic_primary_CCA DM_PriCCA; struct RXHP_T DM_RXHP_Table; struct RA_T DM_RA_Table; - false_ALARM_STATISTICS FalseAlmCnt; - false_ALARM_STATISTICS FlaseAlmCntBuddyAdapter; + struct false_ALARM_STATISTICS FalseAlmCnt; + struct false_ALARM_STATISTICS FlaseAlmCntBuddyAdapter; struct SWAT_T DM_SWAT_Table; bool RSSI_test; struct CFO_TRACKING DM_CfoTrack; diff --git a/drivers/staging/rtl8723bs/hal/odm_DIG.c b/drivers/staging/rtl8723bs/hal/odm_DIG.c index 6b8b6da6dbcc..8179a963d2da 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DIG.c +++ b/drivers/staging/rtl8723bs/hal/odm_DIG.c @@ -71,7 +71,7 @@ void odm_NHMBB(void *pDM_VOID) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; /* u8 test_status; */ - /* Pfalse_ALARM_STATISTICS pFalseAlmCnt = &(pDM_Odm->FalseAlmCnt); */ + /* struct false_ALARM_STATISTICS *pFalseAlmCnt = &(pDM_Odm->FalseAlmCnt); */ pDM_Odm->NHMCurTxOkcnt = *(pDM_Odm->pNumTxBytesUnicast)-pDM_Odm->NHMLastTxOkcnt; @@ -323,7 +323,7 @@ void odm_Adaptivity(void *pDM_VOID, u8 IGI) void ODM_Write_DIG(void *pDM_VOID, u8 CurrentIGI) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; if (pDM_DigTable->bStopDIG) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("Stop Writing IGI\n")); @@ -358,12 +358,12 @@ void ODM_Write_DIG(void *pDM_VOID, u8 CurrentIGI) void odm_PauseDIG( void *pDM_VOID, - ODM_Pause_DIG_TYPE PauseType, + enum ODM_Pause_DIG_TYPE PauseType, u8 IGIValue ) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; static bool bPaused; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG() =========>\n")); @@ -467,7 +467,7 @@ bool odm_DigAbort(void *pDM_VOID) void odm_DIGInit(void *pDM_VOID) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; pDM_DigTable->bStopDIG = false; pDM_DigTable->bPSDInProgress = false; @@ -507,8 +507,8 @@ void odm_DIG(void *pDM_VOID) struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; /* Common parameters */ - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - Pfalse_ALARM_STATISTICS pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; + struct false_ALARM_STATISTICS *pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; bool FirstConnect, FirstDisConnect; u8 DIG_MaxOfMin, DIG_Dynamic_MIN; u8 dm_dig_max, dm_dig_min; @@ -824,7 +824,7 @@ void odm_DIG(void *pDM_VOID) void odm_DIGbyRSSI_LPS(void *pDM_VOID) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - Pfalse_ALARM_STATISTICS pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; + struct false_ALARM_STATISTICS *pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; u8 RSSI_Lower = DM_DIG_MIN_NIC; /* 0x1E or 0x1C */ u8 CurrentIGI = pDM_Odm->RSSI_Min; @@ -893,7 +893,7 @@ void odm_DIGbyRSSI_LPS(void *pDM_VOID) void odm_FalseAlarmCounterStatistics(void *pDM_VOID) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - Pfalse_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); + struct false_ALARM_STATISTICS * FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); u32 ret_value; if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) @@ -1079,8 +1079,8 @@ void odm_FAThresholdCheck( u8 odm_ForbiddenIGICheck(void *pDM_VOID, u8 DIG_Dynamic_MIN, u8 CurrentIGI) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - Pfalse_ALARM_STATISTICS pFalseAlmCnt = &(pDM_Odm->FalseAlmCnt); + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; + struct false_ALARM_STATISTICS * pFalseAlmCnt = &(pDM_Odm->FalseAlmCnt); u8 rx_gain_range_min = pDM_DigTable->rx_gain_range_min; if (pFalseAlmCnt->Cnt_all > 10000) { @@ -1135,7 +1135,7 @@ u8 odm_ForbiddenIGICheck(void *pDM_VOID, u8 DIG_Dynamic_MIN, u8 CurrentIGI) void odm_CCKPacketDetectionThresh(void *pDM_VOID) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - Pfalse_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); + struct false_ALARM_STATISTICS * FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); u8 CurCCK_CCAThres; @@ -1196,7 +1196,7 @@ void odm_CCKPacketDetectionThresh(void *pDM_VOID) void ODM_Write_CCK_CCA_Thres(void *pDM_VOID, u8 CurCCK_CCAThres) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; /* modify by Guo.Mingzhi 2012-01-03 */ if (pDM_DigTable->CurCCK_CCAThres != CurCCK_CCAThres) diff --git a/drivers/staging/rtl8723bs/hal/odm_DIG.h b/drivers/staging/rtl8723bs/hal/odm_DIG.h index f6777e97a24a..5a1900d1e8d1 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DIG.h +++ b/drivers/staging/rtl8723bs/hal/odm_DIG.h @@ -8,7 +8,7 @@ #ifndef __ODMDIG_H__ #define __ODMDIG_H__ -typedef struct _Dynamic_Initial_Gain_Threshold_ { +struct DIG_T { /* _Dynamic_Initial_Gain_Threshold_ */ bool bStopDIG; bool bPSDInProgress; @@ -57,9 +57,9 @@ typedef struct _Dynamic_Initial_Gain_Threshold_ { u32 RSSI_max; u8 *pbP2pLinkInProgress; -} DIG_T, *pDIG_T; +}; -typedef struct false_ALARM_STATISTICS { +struct false_ALARM_STATISTICS { u32 Cnt_Parity_Fail; u32 Cnt_Rate_Illegal; u32 Cnt_Crc8_fail; @@ -75,9 +75,9 @@ typedef struct false_ALARM_STATISTICS { u32 Cnt_CCA_all; u32 Cnt_BW_USC; /* Gary */ u32 Cnt_BW_LSC; /* Gary */ -} false_ALARM_STATISTICS, *Pfalse_ALARM_STATISTICS; +}; -typedef enum tag_Dynamic_Init_Gain_Operation_Type_Definition { +enum DM_DIG_OP_E { /* tag_Dynamic_Init_Gain_Operation_Type_Definition */ DIG_TYPE_THRESH_HIGH = 0, DIG_TYPE_THRESH_LOW = 1, DIG_TYPE_BACKOFF = 2, @@ -86,17 +86,17 @@ typedef enum tag_Dynamic_Init_Gain_Operation_Type_Definition { DIG_TYPE_ENABLE = 5, DIG_TYPE_DISABLE = 6, DIG_OP_TYPE_MAX -} DM_DIG_OP_E; +}; -typedef enum tag_ODM_PauseDIG_Type { +enum ODM_Pause_DIG_TYPE { ODM_PAUSE_DIG = BIT0, ODM_RESUME_DIG = BIT1 -} ODM_Pause_DIG_TYPE; +}; -typedef enum tag_ODM_PauseCCKPD_Type { +enum ODM_Pause_CCKPD_TYPE { ODM_PAUSE_CCKPD = BIT0, ODM_RESUME_CCKPD = BIT1 -} ODM_Pause_CCKPD_TYPE; +}; #define DM_DIG_THRESH_HIGH 40 #define DM_DIG_THRESH_LOW 35 @@ -157,7 +157,7 @@ void odm_Adaptivity(void *pDM_VOID, u8 IGI); void ODM_Write_DIG(void *pDM_VOID, u8 CurrentIGI); -void odm_PauseDIG(void *pDM_VOID, ODM_Pause_DIG_TYPE PauseType, u8 IGIValue); +void odm_PauseDIG(void *pDM_VOID, enum ODM_Pause_DIG_TYPE PauseType, u8 IGIValue); void odm_DIGInit(void *pDM_VOID); diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c index 9df5b1240de2..dce70fff0fae 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c @@ -230,7 +230,7 @@ void rtl8723b_HalDmWatchDog_in_LPS(struct adapter *Adapter) struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; struct sta_priv *pstapriv = &Adapter->stapriv; struct sta_info *psta = NULL; diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index a8f56eeb576f..0eac9cb11cef 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -4066,7 +4066,7 @@ void SetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val) case HW_VAR_INITIAL_GAIN: { - DIG_T *pDigTable = &pHalData->odmpriv.DM_DigTable; + struct DIG_T *pDigTable = &pHalData->odmpriv.DM_DigTable; u32 rx_gain = *(u32 *)val; if (rx_gain == 0xff) {/* restore rx gain */ -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:37 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:37 +0100 Subject: [PATCH 32/33] staging: rtl8723bs: remove typedefs in hal_btcoex.c In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-33-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #23: FILE: hal/hal_btcoex.c:23: +typedef struct _btcoexdbginfo { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c index c0dcde0c0f9d..267b93765fe8 100644 --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c @@ -20,22 +20,22 @@ static u8 GLBtcWiFiInIQKState; u32 GLBtcDbgType[BTC_MSG_MAX]; static u8 GLBtcDbgBuf[BT_TMP_BUF_SIZE]; -typedef struct _btcoexdbginfo { +struct BTCDBGINFO { /* _btcoexdbginfo */ u8 *info; u32 size; /* buffer total size */ u32 len; /* now used length */ -} BTCDBGINFO, *PBTCDBGINFO; +}; -static BTCDBGINFO GLBtcDbgInfo; +static struct BTCDBGINFO GLBtcDbgInfo; #define BT_Operation(Adapter) false -static void DBG_BT_INFO_INIT(PBTCDBGINFO pinfo, u8 *pbuf, u32 size) +static void DBG_BT_INFO_INIT(struct BTCDBGINFO *pinfo, u8 *pbuf, u32 size) { if (!pinfo) return; - memset(pinfo, 0, sizeof(BTCDBGINFO)); + memset(pinfo, 0, sizeof(struct BTCDBGINFO)); if (pbuf && size) { pinfo->info = pbuf; @@ -45,7 +45,7 @@ static void DBG_BT_INFO_INIT(PBTCDBGINFO pinfo, u8 *pbuf, u32 size) void DBG_BT_INFO(u8 *dbgmsg) { - PBTCDBGINFO pinfo; + struct BTCDBGINFO *pinfo; u32 msglen; u8 *pbuf; @@ -1489,7 +1489,7 @@ void hal_btcoex_RecordPwrMode(struct adapter *padapter, u8 *pCmdBuf, u8 cmdLen) void hal_btcoex_DisplayBtCoexInfo(struct adapter *padapter, u8 *pbuf, u32 bufsize) { - PBTCDBGINFO pinfo; + struct BTCDBGINFO *pinfo; pinfo = &GLBtcDbgInfo; -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:35 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:35 +0100 Subject: [PATCH 30/33] staging: rtl8723bs: remove typedefs in hal_btcoex.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-31-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #14: FILE: include/hal_btcoex.h:14: +typedef struct _BT_COEXIST { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/hal_btcoex.h | 4 ++-- drivers/staging/rtl8723bs/include/hal_data.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/hal_btcoex.h b/drivers/staging/rtl8723bs/include/hal_btcoex.h index 29318b49c3ff..fb8bc2cf083b 100644 --- a/drivers/staging/rtl8723bs/include/hal_btcoex.h +++ b/drivers/staging/rtl8723bs/include/hal_btcoex.h @@ -11,12 +11,12 @@ /* Some variables can't get from outsrc BT-Coex, */ /* so we need to save here */ -typedef struct _BT_COEXIST { +struct BT_COEXIST { u8 bBtExist; u8 btTotalAntNum; u8 btChipType; u8 bInitlized; -} BT_COEXIST, *PBT_COEXIST; +}; void DBG_BT_INFO(u8 *dbgmsg); diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h index 7fa384dd07ac..8f5de747ae4e 100644 --- a/drivers/staging/rtl8723bs/include/hal_data.h +++ b/drivers/staging/rtl8723bs/include/hal_data.h @@ -434,7 +434,7 @@ struct hal_com_data { struct DM_ODM_T odmpriv; /* For bluetooth co-existance */ - BT_COEXIST bt_coexist; + struct BT_COEXIST bt_coexist; /* Interrupt related register information. */ u32 SysIntrStatus; -- 2.30.2 From marcocesati at gmail.com Fri Mar 12 08:26:38 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Fri, 12 Mar 2021 09:26:38 +0100 Subject: [PATCH 33/33] staging: rtl8723bs: remove typedefs in odm_DynamicBBPowerSaving.h In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: <20210312082638.25512-34-marco.cesati@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: do not add new typedefs #11: FILE: hal/odm_DynamicBBPowerSaving.h:11: +typedef struct _Dynamic_Power_Saving_ { Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm.h | 2 +- drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c | 4 ++-- drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h index 2bcb55878b12..8b8fe2c406f5 100644 --- a/drivers/staging/rtl8723bs/hal/odm.h +++ b/drivers/staging/rtl8723bs/hal/odm.h @@ -1111,7 +1111,7 @@ struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ /* */ struct FAT_T DM_FatTable; struct DIG_T DM_DigTable; - PS_T DM_PSTable; + struct PS_T DM_PSTable; struct dynamic_primary_CCA DM_PriCCA; struct RXHP_T DM_RXHP_Table; struct RA_T DM_RA_Table; diff --git a/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c b/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c index cc0bf4c1c777..2cc9518c4ae8 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c +++ b/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c @@ -10,7 +10,7 @@ void odm_DynamicBBPowerSavingInit(void *pDM_VOID) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; + struct PS_T *pDM_PSTable = &pDM_Odm->DM_PSTable; pDM_PSTable->PreCCAState = CCA_MAX; pDM_PSTable->CurCCAState = CCA_MAX; @@ -23,7 +23,7 @@ void odm_DynamicBBPowerSavingInit(void *pDM_VOID) void ODM_RF_Saving(void *pDM_VOID, u8 bForceInNormal) { struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; + struct PS_T *pDM_PSTable = &pDM_Odm->DM_PSTable; u8 Rssi_Up_bound = 30; u8 Rssi_Low_bound = 25; diff --git a/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.h b/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.h index dba19271d526..90b9c7659084 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.h +++ b/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.h @@ -8,7 +8,7 @@ #ifndef __ODMDYNAMICBBPOWERSAVING_H__ #define __ODMDYNAMICBBPOWERSAVING_H__ -typedef struct _Dynamic_Power_Saving_ { +struct PS_T { /* _Dynamic_Power_Saving_ */ u8 PreCCAState; u8 CurCCAState; @@ -20,7 +20,7 @@ typedef struct _Dynamic_Power_Saving_ { u8 initialize; u32 Reg874, RegC70, Reg85C, RegA74; -} PS_T, *pPS_T; +}; #define dm_RF_Saving ODM_RF_Saving -- 2.30.2 From dan.carpenter at oracle.com Fri Mar 12 10:02:44 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Fri, 12 Mar 2021 13:02:44 +0300 Subject: [PATCH] staging: rtl8723bs: add initial value In-Reply-To: <20210311063838.19756-1-penghaob@uniontech.com> References: <20210311063838.19756-1-penghaob@uniontech.com> Message-ID: <20210312100244.GN2087@kadam> On Thu, Mar 11, 2021 at 02:38:38PM +0800, Hao Peng wrote: > Add initial value for some uninitialized variable and array. > None of these are ever used uninitialized. It's weird that you would even think that. > if (pmlmeext->active_keep_alive_check) { > - int stainfo_offset; > + int stainfo_offset = 0; > > stainfo_offset = rtw_stainfo_offset(pstapriv, psta); ^^^^^^^^^^^^^^^^ This one is initialized on the very next line so all the patch does is introduce static checker warnings for no reason. regards, dan carpenter From fabioaiuto83 at gmail.com Fri Mar 12 10:51:37 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Fri, 12 Mar 2021 11:51:37 +0100 Subject: [PATCH] staging: rtl8723bs: put quoted string in a single line Message-ID: <20210312105134.GA6079@agape.jhs> fix the following checkpatch issues: WARNING: quoted string split across lines + DBG_871X("HT: STA %pM HT Capabilities " + "Info: 0x%04x\n", MAC_ARG(psta->hwaddr), ht_capab); WARNING: quoted string split across lines + DBG_871X("%s STA %pM - no " + "greenfield, num of non-gf stations %d\n", WARNING: quoted string split across lines + DBG_871X("%s STA %pM - 20 MHz HT, " + "num of 20MHz HT STAs %d\n", Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_ap.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c index b6f944b37b08..b8706e1eb8ca 100644 --- a/drivers/staging/rtl8723bs/core/rtw_ap.c +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c @@ -2009,8 +2009,8 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) if (psta->flags & WLAN_STA_HT) { u16 ht_capab = le16_to_cpu(psta->htpriv.ht_cap.cap_info); - DBG_871X("HT: STA %pM HT Capabilities " - "Info: 0x%04x\n", MAC_ARG(psta->hwaddr), ht_capab); + DBG_871X("HT: STA %pM HT Capabilities Info: 0x%04x\n", + MAC_ARG(psta->hwaddr), ht_capab); if (psta->no_ht_set) { psta->no_ht_set = 0; @@ -2022,10 +2022,9 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) psta->no_ht_gf_set = 1; pmlmepriv->num_sta_ht_no_gf++; } - DBG_871X("%s STA %pM - no " - "greenfield, num of non-gf stations %d\n", - __func__, MAC_ARG(psta->hwaddr), - pmlmepriv->num_sta_ht_no_gf); + DBG_871X("%s STA %pM - no greenfield, num of non-gf stations %d\n", + __func__, MAC_ARG(psta->hwaddr), + pmlmepriv->num_sta_ht_no_gf); } if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH) == 0) { @@ -2033,10 +2032,9 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) psta->ht_20mhz_set = 1; pmlmepriv->num_sta_ht_20mhz++; } - DBG_871X("%s STA %pM - 20 MHz HT, " - "num of 20MHz HT STAs %d\n", - __func__, MAC_ARG(psta->hwaddr), - pmlmepriv->num_sta_ht_20mhz); + DBG_871X("%s STA %pM - 20 MHz HT, num of 20MHz HT STAs %d\n", + __func__, MAC_ARG(psta->hwaddr), + pmlmepriv->num_sta_ht_20mhz); } } else { -- 2.20.1 From unixbhaskar at gmail.com Fri Mar 12 11:42:07 2021 From: unixbhaskar at gmail.com (Bhaskar Chowdhury) Date: Fri, 12 Mar 2021 17:12:07 +0530 Subject: [PATCH] staging: wimax: i2400m: Mundane typos fix in the file tx.c Message-ID: <20210312114207.3624-1-unixbhaskar@gmail.com> s/exahusted/exhausted/ s/caleed/called/ Signed-off-by: Bhaskar Chowdhury --- drivers/staging/wimax/i2400m/tx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wimax/i2400m/tx.c b/drivers/staging/wimax/i2400m/tx.c index e9436212fe54..2d15de653951 100644 --- a/drivers/staging/wimax/i2400m/tx.c +++ b/drivers/staging/wimax/i2400m/tx.c @@ -85,7 +85,7 @@ * can keep adding payloads to it. * * Closed: we are not appending more payloads to this TX message - * (exahusted space in the queue, too many payloads or + * (exhausted space in the queue, too many payloads or * whichever). We have appended padding so the whole message * length is aligned to i2400m->bus_tx_block_size (as set by the * bus/transport layer). @@ -295,7 +295,7 @@ enum { /* * Calculate how much tail room is available * - * Note the trick here. This path is ONLY caleed for Case A (see + * Note the trick here. This path is ONLY called for Case A (see * i2400m_tx_fifo_push() below), where we have: * * Case A -- 2.26.2 From nsaenzjulienne at suse.de Fri Mar 12 12:24:44 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Fri, 12 Mar 2021 13:24:44 +0100 Subject: [PATCH v8 01/11] firmware: raspberrypi: Keep count of all consumers In-Reply-To: <20210312122454.24480-1-nsaenzjulienne@suse.de> References: <20210312122454.24480-1-nsaenzjulienne@suse.de> Message-ID: <20210312122454.24480-2-nsaenzjulienne@suse.de> When unbinding the firmware device we need to make sure it has no consumers left. Otherwise we'd leave them with a firmware handle pointing at freed memory. Keep a reference count of all consumers and introduce rpi_firmware_put() which will permit automatically decrease the reference count upon unbinding consumer drivers. Suggested-by: Uwe Kleine-K?nig Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Florian Fainelli Reviewed-by: Stephen Boyd Reviewed-by: Bartosz Golaszewski --- Changes since v5: - Add comment to avoid people blindly switching the memory allocation to the devm variant. - Fix function documentation as per Florian's comment. Changes since v3: - Use kref instead of waiting on refcount drivers/firmware/raspberrypi.c | 40 ++++++++++++++++++++-- include/soc/bcm2835/raspberrypi-firmware.h | 2 ++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c index 30259dc9b805..b65e4c495772 100644 --- a/drivers/firmware/raspberrypi.c +++ b/drivers/firmware/raspberrypi.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -27,6 +28,8 @@ struct rpi_firmware { struct mbox_chan *chan; /* The property channel. */ struct completion c; u32 enabled; + + struct kref consumers; }; static DEFINE_MUTEX(transaction_lock); @@ -225,12 +228,31 @@ static void rpi_register_clk_driver(struct device *dev) -1, NULL, 0); } +static void rpi_firmware_delete(struct kref *kref) +{ + struct rpi_firmware *fw = container_of(kref, struct rpi_firmware, + consumers); + + mbox_free_channel(fw->chan); + kfree(fw); +} + +void rpi_firmware_put(struct rpi_firmware *fw) +{ + kref_put(&fw->consumers, rpi_firmware_delete); +} +EXPORT_SYMBOL_GPL(rpi_firmware_put); + static int rpi_firmware_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct rpi_firmware *fw; - fw = devm_kzalloc(dev, sizeof(*fw), GFP_KERNEL); + /* + * Memory will be freed by rpi_firmware_delete() once all users have + * released their firmware handles. Don't use devm_kzalloc() here. + */ + fw = kzalloc(sizeof(*fw), GFP_KERNEL); if (!fw) return -ENOMEM; @@ -247,6 +269,7 @@ static int rpi_firmware_probe(struct platform_device *pdev) } init_completion(&fw->c); + kref_init(&fw->consumers); platform_set_drvdata(pdev, fw); @@ -275,7 +298,8 @@ static int rpi_firmware_remove(struct platform_device *pdev) rpi_hwmon = NULL; platform_device_unregister(rpi_clk); rpi_clk = NULL; - mbox_free_channel(fw->chan); + + rpi_firmware_put(fw); return 0; } @@ -284,16 +308,26 @@ static int rpi_firmware_remove(struct platform_device *pdev) * rpi_firmware_get - Get pointer to rpi_firmware structure. * @firmware_node: Pointer to the firmware Device Tree node. * + * The reference to rpi_firmware has to be released with rpi_firmware_put(). + * * Returns NULL is the firmware device is not ready. */ struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) { struct platform_device *pdev = of_find_device_by_node(firmware_node); + struct rpi_firmware *fw; if (!pdev) return NULL; - return platform_get_drvdata(pdev); + fw = platform_get_drvdata(pdev); + if (!fw) + return NULL; + + if (!kref_get_unless_zero(&fw->consumers)) + return NULL; + + return fw; } EXPORT_SYMBOL_GPL(rpi_firmware_get); diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h index cc9cdbc66403..fdfef7fe40df 100644 --- a/include/soc/bcm2835/raspberrypi-firmware.h +++ b/include/soc/bcm2835/raspberrypi-firmware.h @@ -140,6 +140,7 @@ int rpi_firmware_property(struct rpi_firmware *fw, u32 tag, void *data, size_t len); int rpi_firmware_property_list(struct rpi_firmware *fw, void *data, size_t tag_size); +void rpi_firmware_put(struct rpi_firmware *fw); struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node); #else static inline int rpi_firmware_property(struct rpi_firmware *fw, u32 tag, @@ -154,6 +155,7 @@ static inline int rpi_firmware_property_list(struct rpi_firmware *fw, return -ENOSYS; } +static inline void rpi_firmware_put(struct rpi_firmware *fw) { } static inline struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) { return NULL; -- 2.30.1 From nsaenzjulienne at suse.de Fri Mar 12 12:24:43 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Fri, 12 Mar 2021 13:24:43 +0100 Subject: [PATCH v8 00/11] Raspberry Pi PoE HAT fan support Message-ID: <20210312122454.24480-1-nsaenzjulienne@suse.de> The aim of this series is to add support to the fan found on RPi's PoE HAT. Some commentary on the design can be found below. But the important part to the people CC'd here not involved with PWM is that, in order to achieve this properly, we also have to fix the firmware interface the driver uses to communicate with the PWM bus (and many other low level functions). Specifically, we have to make sure the firmware interface isn't unbound while consumers are still up. So, patch #1 & #2 introduce reference counting in the firmware interface driver and patches #3 to #8 update all firmware users. Patches #9 to #11 introduce the new PWM driver. I sent everything as a single series as the final version of the PWM drivers depends on the firmware fixes, but I'll be happy to split this into two separate series if you think it's better. --- Original cover letter below --- This series aims at adding support to RPi's official PoE HAT fan[1]. The HW setup is the following: | Raspberry Pi | PoE HAT | arm core -> Mailbox -> RPi co-processor -> I2C -> Atmel MCU -> PWM -> FAN The arm cores have only access to the mailbox interface, as i2c0, even if physically accessible, is to be used solely by the co-processor (VideoCore 4/6). This series implements a PWM bus, and has pwm-fan sitting on top of it as per this discussion: https://lkml.org/lkml/2018/9/2/486. Although this design has a series of shortcomings: - It depends on a DT binding: it's not flexible if a new hat shows up with new functionality, we're not 100% sure we'll be able to expand it without breaking backwards compatibility. But without it we can't make use of DT thermal-zones, which IMO is overkill. - We're using pwm-fan, writing a hwmon driver would, again, give us more flexibility, but it's not really needed at the moment. I personally think that it's not worth the effort, it's unlikely we'll get things right in advance. And ultimately, if the RPi people come up with something new, we can always write a new driver/bindings from scratch (as in not reusing previous code). That said, I'm more than happy to change things if there is a consensus that another design will do the trick. [1] https://www.raspberrypi.org/blog/introducing-power-over-ethernet-poe-hat/ --- Changes since v7: - Remove unwarranted RPI_PWM_DEF_DUTY_REG usage Changes since v6: - Address PWM driver comments Changes since v5: - Small cleanups - Add extra code comments Changes since v4: - Cleanup devm calls - Rename compatible string so it's unique to the PoE HAT Changes since v3: - Split first patch, #1 introduces refcount, then #2 the devm function - Fix touchscreen function - Use kref Changes since v2: - Introduce devm_rpi_firmware_get() - Small cleanups in PWM driver Changes since v1: - Address PWM driver changes - Fix binding, now with 2 cells Nicolas Saenz Julienne (11): firmware: raspberrypi: Keep count of all consumers firmware: raspberrypi: Introduce devm_rpi_firmware_get() clk: bcm: rpi: Release firmware handle on unbind gpio: raspberrypi-exp: Release firmware handle on unbind reset: raspberrypi: Release firmware handle on unbind soc: bcm: raspberrypi-power: Release firmware handle on unbind staging: vchiq: Release firmware handle on unbind input: raspberrypi-ts: Release firmware handle when not needed dt-bindings: pwm: Add binding for RPi firmware PWM bus DO NOT MERGE: ARM: dts: Add RPi's official PoE hat support pwm: Add Raspberry Pi Firmware based PWM bus .../arm/bcm/raspberrypi,bcm2835-firmware.yaml | 20 ++ arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 54 +++++ drivers/clk/bcm/clk-raspberrypi.c | 2 +- drivers/firmware/raspberrypi.c | 69 +++++- drivers/gpio/gpio-raspberrypi-exp.c | 2 +- drivers/input/touchscreen/raspberrypi-ts.c | 2 +- drivers/pwm/Kconfig | 9 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-raspberrypi-poe.c | 206 ++++++++++++++++++ drivers/reset/reset-raspberrypi.c | 2 +- drivers/soc/bcm/raspberrypi-power.c | 2 +- .../interface/vchiq_arm/vchiq_arm.c | 2 +- .../pwm/raspberrypi,firmware-poe-pwm.h | 13 ++ include/soc/bcm2835/raspberrypi-firmware.h | 10 + 14 files changed, 385 insertions(+), 9 deletions(-) create mode 100644 drivers/pwm/pwm-raspberrypi-poe.c create mode 100644 include/dt-bindings/pwm/raspberrypi,firmware-poe-pwm.h -- 2.30.1 From nsaenzjulienne at suse.de Fri Mar 12 12:24:45 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Fri, 12 Mar 2021 13:24:45 +0100 Subject: [PATCH v8 02/11] firmware: raspberrypi: Introduce devm_rpi_firmware_get() In-Reply-To: <20210312122454.24480-1-nsaenzjulienne@suse.de> References: <20210312122454.24480-1-nsaenzjulienne@suse.de> Message-ID: <20210312122454.24480-3-nsaenzjulienne@suse.de> It'll simplify the firmware handling for most consumers. Suggested-by: Bartosz Golaszewski Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Florian Fainelli Reviewed-by: Bartosz Golaszewski --- Changes since v4: - Rearrange function calls for clarity, same functionality Changes since v2: - Create devm_rpi_firmware_get() drivers/firmware/raspberrypi.c | 29 ++++++++++++++++++++++ include/soc/bcm2835/raspberrypi-firmware.h | 8 ++++++ 2 files changed, 37 insertions(+) diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c index b65e4c495772..250e01680742 100644 --- a/drivers/firmware/raspberrypi.c +++ b/drivers/firmware/raspberrypi.c @@ -243,6 +243,13 @@ void rpi_firmware_put(struct rpi_firmware *fw) } EXPORT_SYMBOL_GPL(rpi_firmware_put); +static void devm_rpi_firmware_put(void *data) +{ + struct rpi_firmware *fw = data; + + rpi_firmware_put(fw); +} + static int rpi_firmware_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -331,6 +338,28 @@ struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) } EXPORT_SYMBOL_GPL(rpi_firmware_get); +/** + * devm_rpi_firmware_get - Get pointer to rpi_firmware structure. + * @firmware_node: Pointer to the firmware Device Tree node. + * + * Returns NULL is the firmware device is not ready. + */ +struct rpi_firmware *devm_rpi_firmware_get(struct device *dev, + struct device_node *firmware_node) +{ + struct rpi_firmware *fw; + + fw = rpi_firmware_get(firmware_node); + if (!fw) + return NULL; + + if (devm_add_action_or_reset(dev, devm_rpi_firmware_put, fw)) + return NULL; + + return fw; +} +EXPORT_SYMBOL_GPL(devm_rpi_firmware_get); + static const struct of_device_id rpi_firmware_of_match[] = { { .compatible = "raspberrypi,bcm2835-firmware", }, {}, diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h index fdfef7fe40df..73ad784fca96 100644 --- a/include/soc/bcm2835/raspberrypi-firmware.h +++ b/include/soc/bcm2835/raspberrypi-firmware.h @@ -142,6 +142,8 @@ int rpi_firmware_property_list(struct rpi_firmware *fw, void *data, size_t tag_size); void rpi_firmware_put(struct rpi_firmware *fw); struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node); +struct rpi_firmware *devm_rpi_firmware_get(struct device *dev, + struct device_node *firmware_node); #else static inline int rpi_firmware_property(struct rpi_firmware *fw, u32 tag, void *data, size_t len) @@ -160,6 +162,12 @@ static inline struct rpi_firmware *rpi_firmware_get(struct device_node *firmware { return NULL; } + +static inline struct rpi_firmware *devm_rpi_firmware_get(struct device *dev, + struct device_node *firmware_node) +{ + return NULL; +} #endif #endif /* __SOC_RASPBERRY_FIRMWARE_H__ */ -- 2.30.1 From nsaenzjulienne at suse.de Fri Mar 12 12:24:46 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Fri, 12 Mar 2021 13:24:46 +0100 Subject: [PATCH v8 03/11] clk: bcm: rpi: Release firmware handle on unbind In-Reply-To: <20210312122454.24480-1-nsaenzjulienne@suse.de> References: <20210312122454.24480-1-nsaenzjulienne@suse.de> Message-ID: <20210312122454.24480-4-nsaenzjulienne@suse.de> Use devm_rpi_firmware_get() so as to make sure we release RPi's firmware interface when unbinding the device. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Florian Fainelli Acked-by: Stephen Boyd drivers/clk/bcm/clk-raspberrypi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- drivers/clk/bcm/clk-raspberrypi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c index f89b9cfc4309..dd3b71eafabf 100644 --- a/drivers/clk/bcm/clk-raspberrypi.c +++ b/drivers/clk/bcm/clk-raspberrypi.c @@ -314,7 +314,7 @@ static int raspberrypi_clk_probe(struct platform_device *pdev) return -ENOENT; } - firmware = rpi_firmware_get(firmware_node); + firmware = devm_rpi_firmware_get(&pdev->dev, firmware_node); of_node_put(firmware_node); if (!firmware) return -EPROBE_DEFER; -- 2.30.1 From nsaenzjulienne at suse.de Fri Mar 12 12:24:47 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Fri, 12 Mar 2021 13:24:47 +0100 Subject: [PATCH v8 04/11] gpio: raspberrypi-exp: Release firmware handle on unbind In-Reply-To: <20210312122454.24480-1-nsaenzjulienne@suse.de> References: <20210312122454.24480-1-nsaenzjulienne@suse.de> Message-ID: <20210312122454.24480-5-nsaenzjulienne@suse.de> Use devm_rpi_firmware_get() so as to make sure we release RPi's firmware interface when unbinding the device. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Florian Fainelli Acked-by: Bartosz Golaszewski --- drivers/gpio/gpio-raspberrypi-exp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-raspberrypi-exp.c b/drivers/gpio/gpio-raspberrypi-exp.c index bb100e0124e6..64a552ecc2ad 100644 --- a/drivers/gpio/gpio-raspberrypi-exp.c +++ b/drivers/gpio/gpio-raspberrypi-exp.c @@ -208,7 +208,7 @@ static int rpi_exp_gpio_probe(struct platform_device *pdev) return -ENOENT; } - fw = rpi_firmware_get(fw_node); + fw = devm_rpi_firmware_get(&pdev->dev, fw_node); of_node_put(fw_node); if (!fw) return -EPROBE_DEFER; -- 2.30.1 From nsaenzjulienne at suse.de Fri Mar 12 12:24:48 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Fri, 12 Mar 2021 13:24:48 +0100 Subject: [PATCH v8 05/11] reset: raspberrypi: Release firmware handle on unbind In-Reply-To: <20210312122454.24480-1-nsaenzjulienne@suse.de> References: <20210312122454.24480-1-nsaenzjulienne@suse.de> Message-ID: <20210312122454.24480-6-nsaenzjulienne@suse.de> Use devm_rpi_firmware_get() so as to make sure we release RPi's firmware interface when unbinding the device. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Florian Fainelli --- drivers/reset/reset-raspberrypi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/reset/reset-raspberrypi.c b/drivers/reset/reset-raspberrypi.c index 02f59c06f69b..fa23db554bcf 100644 --- a/drivers/reset/reset-raspberrypi.c +++ b/drivers/reset/reset-raspberrypi.c @@ -82,7 +82,7 @@ static int rpi_reset_probe(struct platform_device *pdev) return -ENOENT; } - fw = rpi_firmware_get(np); + fw = devm_rpi_firmware_get(&pdev->dev, np); of_node_put(np); if (!fw) return -EPROBE_DEFER; -- 2.30.1 From nsaenzjulienne at suse.de Fri Mar 12 12:24:49 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Fri, 12 Mar 2021 13:24:49 +0100 Subject: [PATCH v8 06/11] soc: bcm: raspberrypi-power: Release firmware handle on unbind In-Reply-To: <20210312122454.24480-1-nsaenzjulienne@suse.de> References: <20210312122454.24480-1-nsaenzjulienne@suse.de> Message-ID: <20210312122454.24480-7-nsaenzjulienne@suse.de> Use devm_rpi_firmware_get() so as to make sure we release RPi's firmware interface when unbinding the device. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Florian Fainelli --- drivers/soc/bcm/raspberrypi-power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/bcm/raspberrypi-power.c b/drivers/soc/bcm/raspberrypi-power.c index 5d1aacdd84ef..068715d6e66d 100644 --- a/drivers/soc/bcm/raspberrypi-power.c +++ b/drivers/soc/bcm/raspberrypi-power.c @@ -177,7 +177,7 @@ static int rpi_power_probe(struct platform_device *pdev) return -ENODEV; } - rpi_domains->fw = rpi_firmware_get(fw_np); + rpi_domains->fw = devm_rpi_firmware_get(&pdev->dev, fw_np); of_node_put(fw_np); if (!rpi_domains->fw) return -EPROBE_DEFER; -- 2.30.1 From nsaenzjulienne at suse.de Fri Mar 12 12:24:50 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Fri, 12 Mar 2021 13:24:50 +0100 Subject: [PATCH v8 07/11] staging: vchiq: Release firmware handle on unbind In-Reply-To: <20210312122454.24480-1-nsaenzjulienne@suse.de> References: <20210312122454.24480-1-nsaenzjulienne@suse.de> Message-ID: <20210312122454.24480-8-nsaenzjulienne@suse.de> Use devm_rpi_firmware_get() so as to make sure we release RPi's firmware interface when unbinding the device. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Florian Fainelli Reviewed-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 8b2b4771f420..e39897c38e6a 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -2738,7 +2738,7 @@ static int vchiq_probe(struct platform_device *pdev) return -ENOENT; } - drvdata->fw = rpi_firmware_get(fw_node); + drvdata->fw = devm_rpi_firmware_get(&pdev->dev, fw_node); of_node_put(fw_node); if (!drvdata->fw) return -EPROBE_DEFER; -- 2.30.1 From nsaenzjulienne at suse.de Fri Mar 12 12:24:51 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Fri, 12 Mar 2021 13:24:51 +0100 Subject: [PATCH v8 08/11] input: raspberrypi-ts: Release firmware handle when not needed In-Reply-To: <20210312122454.24480-1-nsaenzjulienne@suse.de> References: <20210312122454.24480-1-nsaenzjulienne@suse.de> Message-ID: <20210312122454.24480-9-nsaenzjulienne@suse.de> There is no use for the firmware interface after getting the touch buffer address, so release it. Signed-off-by: Nicolas Saenz Julienne Acked-by: Dmitry Torokhov Reviewed-by: Florian Fainelli --- Changes since v5: - Correct commit message Changes since v3: - Release firmware handle in probe function Changes since v2: - Use devm_rpi_firmware_get(), instead of remove function drivers/input/touchscreen/raspberrypi-ts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/raspberrypi-ts.c b/drivers/input/touchscreen/raspberrypi-ts.c index ef6aaed217cf..5000f5fd9ec3 100644 --- a/drivers/input/touchscreen/raspberrypi-ts.c +++ b/drivers/input/touchscreen/raspberrypi-ts.c @@ -160,7 +160,7 @@ static int rpi_ts_probe(struct platform_device *pdev) touchbuf = (u32)ts->fw_regs_phys; error = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_SET_TOUCHBUF, &touchbuf, sizeof(touchbuf)); - + rpi_firmware_put(fw); if (error || touchbuf != 0) { dev_warn(dev, "Failed to set touchbuf, %d\n", error); return error; -- 2.30.1 From nsaenzjulienne at suse.de Fri Mar 12 12:24:53 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Fri, 12 Mar 2021 13:24:53 +0100 Subject: [PATCH v8 10/11] DO NOT MERGE: ARM: dts: Add RPi's official PoE hat support In-Reply-To: <20210312122454.24480-1-nsaenzjulienne@suse.de> References: <20210312122454.24480-1-nsaenzjulienne@suse.de> Message-ID: <20210312122454.24480-11-nsaenzjulienne@suse.de> This is an example on how to enable the fan on top of RPi's official PoE hat. Signed-off-by: Nicolas Saenz Julienne --- arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 54 +++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts index 3b4ab947492a..6897c7831d09 100644 --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts @@ -5,6 +5,7 @@ #include "bcm283x-rpi-usb-peripheral.dtsi" #include +#include / { compatible = "raspberrypi,4-model-b", "brcm,bcm2711"; @@ -69,6 +70,54 @@ sd_vcc_reg: sd_vcc_reg { enable-active-high; gpio = <&expgpio 6 GPIO_ACTIVE_HIGH>; }; + + fan: pwm-fan { + compatible = "pwm-fan"; + cooling-levels = <0 50 150 255>; + #cooling-cells = <2>; + pwms = <&fwpwm RASPBERRYPI_FIRMWARE_PWM_POE 80000>; + }; + + thermal-zones { + cpu_thermal: cpu-thermal { + trips { + threshold: trip-point at 0 { + temperature = <45000>; + hysteresis = <5000>; + type = "active"; + }; + + target: trip-point at 1 { + temperature = <50000>; + hysteresis = <2000>; + type = "active"; + }; + + cpu_hot: cpu_hot at 0 { + temperature = <55000>; + hysteresis = <2000>; + type = "active"; + }; + }; + + cooling-maps { + map0 { + trip = <&threshold>; + cooling-device = <&fan 0 1>; + }; + + map1 { + trip = <&target>; + cooling-device = <&fan 1 2>; + }; + + map2 { + trip = <&cpu_hot>; + cooling-device = <&fan 2 3>; + }; + }; + }; + }; }; &ddc0 { @@ -104,6 +153,11 @@ reset: reset { compatible = "raspberrypi,firmware-reset"; #reset-cells = <1>; }; + + fwpwm: pwm { + compatible = "raspberrypi,firmware-poe-pwm"; + #pwm-cells = <2>; + }; }; &gpio { -- 2.30.1 From nsaenzjulienne at suse.de Fri Mar 12 12:24:52 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Fri, 12 Mar 2021 13:24:52 +0100 Subject: [PATCH v8 09/11] dt-bindings: pwm: Add binding for RPi firmware PWM bus In-Reply-To: <20210312122454.24480-1-nsaenzjulienne@suse.de> References: <20210312122454.24480-1-nsaenzjulienne@suse.de> Message-ID: <20210312122454.24480-10-nsaenzjulienne@suse.de> The PWM bus controlling the fan in RPi's official PoE hat can only be controlled by the board's co-processor. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Rob Herring --- Changes since v4: - Rename compatible string to be more explicit with the bus' limitations Changes since v3: - Fix example Changes since v1: - Update bindings to use 2 #pwm-cells .../arm/bcm/raspberrypi,bcm2835-firmware.yaml | 20 +++++++++++++++++++ .../pwm/raspberrypi,firmware-poe-pwm.h | 13 ++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 include/dt-bindings/pwm/raspberrypi,firmware-poe-pwm.h diff --git a/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml b/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml index a2c63c8b1d10..e3664eab0f6a 100644 --- a/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml +++ b/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml @@ -64,6 +64,21 @@ properties: - compatible - "#reset-cells" + pwm: + type: object + + properties: + compatible: + const: raspberrypi,firmware-poe-pwm + + "#pwm-cells": + # See pwm.yaml in this directory for a description of the cells format. + const: 2 + + required: + - compatible + - "#pwm-cells" + additionalProperties: false required: @@ -87,5 +102,10 @@ examples: compatible = "raspberrypi,firmware-reset"; #reset-cells = <1>; }; + + pwm: pwm { + compatible = "raspberrypi,firmware-poe-pwm"; + #pwm-cells = <2>; + }; }; ... diff --git a/include/dt-bindings/pwm/raspberrypi,firmware-poe-pwm.h b/include/dt-bindings/pwm/raspberrypi,firmware-poe-pwm.h new file mode 100644 index 000000000000..27c5ce68847b --- /dev/null +++ b/include/dt-bindings/pwm/raspberrypi,firmware-poe-pwm.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2020 Nicolas Saenz Julienne + * Author: Nicolas Saenz Julienne + */ + +#ifndef _DT_BINDINGS_RASPBERRYPI_FIRMWARE_PWM_H +#define _DT_BINDINGS_RASPBERRYPI_FIRMWARE_PWM_H + +#define RASPBERRYPI_FIRMWARE_PWM_POE 0 +#define RASPBERRYPI_FIRMWARE_PWM_NUM 1 + +#endif -- 2.30.1 From nsaenzjulienne at suse.de Fri Mar 12 12:24:54 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Fri, 12 Mar 2021 13:24:54 +0100 Subject: [PATCH v8 11/11] pwm: Add Raspberry Pi Firmware based PWM bus In-Reply-To: <20210312122454.24480-1-nsaenzjulienne@suse.de> References: <20210312122454.24480-1-nsaenzjulienne@suse.de> Message-ID: <20210312122454.24480-12-nsaenzjulienne@suse.de> Adds support to control the PWM bus available in official Raspberry Pi PoE HAT. Only RPi's co-processor has access to it, so commands have to be sent through RPi's firmware mailbox interface. Signed-off-by: Nicolas Saenz Julienne --- Changes since v7: - Remove unwarranted RPI_PWM_DEF_DUTY_REG usage Changes since v6: - Use %pe - Round divisions properly - Use dev_err_probe() - Pass check_patch Changes since v3: - Rename compatible string to be more explicit WRT to bus's limitations Changes since v2: - Use devm_rpi_firmware_get() - Rename driver - Small cleanups Changes since v1: - Use default pwm bindings and get rid of xlate() function - Correct spelling errors - Correct apply() function - Round values - Fix divisions in arm32 mode - Small cleanups drivers/pwm/Kconfig | 9 ++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-raspberrypi-poe.c | 206 ++++++++++++++++++++++++++++++ 3 files changed, 216 insertions(+) create mode 100644 drivers/pwm/pwm-raspberrypi-poe.c diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index a7a7a9f26aef..d3371ac7b871 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -431,6 +431,15 @@ config PWM_PXA To compile this driver as a module, choose M here: the module will be called pwm-pxa. +config PWM_RASPBERRYPI_POE + tristate "Raspberry Pi Firwmware PoE Hat PWM support" + # Make sure not 'y' when RASPBERRYPI_FIRMWARE is 'm'. This can only + # happen when COMPILE_TEST=y, hence the added !RASPBERRYPI_FIRMWARE. + depends on RASPBERRYPI_FIRMWARE || (COMPILE_TEST && !RASPBERRYPI_FIRMWARE) + help + Enable Raspberry Pi firmware controller PWM bus used to control the + official RPI PoE hat + config PWM_RCAR tristate "Renesas R-Car PWM support" depends on ARCH_RENESAS || COMPILE_TEST diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile index 4e35a55fa7b6..d3879619bd76 100644 --- a/drivers/pwm/Makefile +++ b/drivers/pwm/Makefile @@ -39,6 +39,7 @@ obj-$(CONFIG_PWM_NTXEC) += pwm-ntxec.o obj-$(CONFIG_PWM_OMAP_DMTIMER) += pwm-omap-dmtimer.o obj-$(CONFIG_PWM_PCA9685) += pwm-pca9685.o obj-$(CONFIG_PWM_PXA) += pwm-pxa.o +obj-$(CONFIG_PWM_RASPBERRYPI_POE) += pwm-raspberrypi-poe.o obj-$(CONFIG_PWM_RCAR) += pwm-rcar.o obj-$(CONFIG_PWM_RENESAS_TPU) += pwm-renesas-tpu.o obj-$(CONFIG_PWM_ROCKCHIP) += pwm-rockchip.o diff --git a/drivers/pwm/pwm-raspberrypi-poe.c b/drivers/pwm/pwm-raspberrypi-poe.c new file mode 100644 index 000000000000..71ade5e55069 --- /dev/null +++ b/drivers/pwm/pwm-raspberrypi-poe.c @@ -0,0 +1,206 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2020 Nicolas Saenz Julienne + * For more information on Raspberry Pi's PoE hat see: + * https://www.raspberrypi.org/products/poe-hat/ + * + * Limitations: + * - No disable bit, so a disabled PWM is simulated by duty_cycle 0 + * - Only normal polarity + * - Fixed 12.5 kHz period + * + * The current period is completed when HW is reconfigured. + */ + +#include +#include +#include +#include + +#include +#include + +#define RPI_PWM_MAX_DUTY 255 +#define RPI_PWM_PERIOD_NS 80000 /* 12.5 kHz */ + +#define RPI_PWM_CUR_DUTY_REG 0x0 + +struct raspberrypi_pwm { + struct rpi_firmware *firmware; + struct pwm_chip chip; + unsigned int duty_cycle; +}; + +struct raspberrypi_pwm_prop { + __le32 reg; + __le32 val; + __le32 ret; +} __packed; + +static inline +struct raspberrypi_pwm *raspberrypi_pwm_from_chip(struct pwm_chip *chip) +{ + return container_of(chip, struct raspberrypi_pwm, chip); +} + +static int raspberrypi_pwm_set_property(struct rpi_firmware *firmware, + u32 reg, u32 val) +{ + struct raspberrypi_pwm_prop msg = { + .reg = cpu_to_le32(reg), + .val = cpu_to_le32(val), + }; + int ret; + + ret = rpi_firmware_property(firmware, RPI_FIRMWARE_SET_POE_HAT_VAL, + &msg, sizeof(msg)); + if (ret) + return ret; + if (msg.ret) + return -EIO; + + return 0; +} + +static int raspberrypi_pwm_get_property(struct rpi_firmware *firmware, + u32 reg, u32 *val) +{ + struct raspberrypi_pwm_prop msg = { + .reg = reg + }; + int ret; + + ret = rpi_firmware_property(firmware, RPI_FIRMWARE_GET_POE_HAT_VAL, + &msg, sizeof(msg)); + if (ret) + return ret; + if (msg.ret) + return -EIO; + + *val = le32_to_cpu(msg.val); + + return 0; +} + +static void raspberrypi_pwm_get_state(struct pwm_chip *chip, + struct pwm_device *pwm, + struct pwm_state *state) +{ + struct raspberrypi_pwm *rpipwm = raspberrypi_pwm_from_chip(chip); + + state->period = RPI_PWM_PERIOD_NS; + state->duty_cycle = DIV_ROUND_UP(rpipwm->duty_cycle * RPI_PWM_PERIOD_NS, + RPI_PWM_MAX_DUTY); + state->enabled = !!(rpipwm->duty_cycle); + state->polarity = PWM_POLARITY_NORMAL; +} + +static int raspberrypi_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, + const struct pwm_state *state) +{ + struct raspberrypi_pwm *rpipwm = raspberrypi_pwm_from_chip(chip); + unsigned int duty_cycle; + int ret; + + if (state->period < RPI_PWM_PERIOD_NS || + state->polarity != PWM_POLARITY_NORMAL) + return -EINVAL; + + if (!state->enabled) + duty_cycle = 0; + else if (state->duty_cycle < RPI_PWM_PERIOD_NS) + duty_cycle = DIV_ROUND_DOWN_ULL(state->duty_cycle * RPI_PWM_MAX_DUTY, + RPI_PWM_PERIOD_NS); + else + duty_cycle = RPI_PWM_MAX_DUTY; + + if (duty_cycle == rpipwm->duty_cycle) + return 0; + + ret = raspberrypi_pwm_set_property(rpipwm->firmware, RPI_PWM_CUR_DUTY_REG, + duty_cycle); + if (ret) { + dev_err(chip->dev, "Failed to set duty cycle: %pe\n", + ERR_PTR(ret)); + return ret; + } + + rpipwm->duty_cycle = duty_cycle; + + return 0; +} + +static const struct pwm_ops raspberrypi_pwm_ops = { + .get_state = raspberrypi_pwm_get_state, + .apply = raspberrypi_pwm_apply, + .owner = THIS_MODULE, +}; + +static int raspberrypi_pwm_probe(struct platform_device *pdev) +{ + struct device_node *firmware_node; + struct device *dev = &pdev->dev; + struct rpi_firmware *firmware; + struct raspberrypi_pwm *rpipwm; + int ret; + + firmware_node = of_get_parent(dev->of_node); + if (!firmware_node) { + dev_err(dev, "Missing firmware node\n"); + return -ENOENT; + } + + firmware = devm_rpi_firmware_get(&pdev->dev, firmware_node); + of_node_put(firmware_node); + if (!firmware) + return dev_err_probe(dev, -EPROBE_DEFER, + "Failed to get firmware handle\n"); + + rpipwm = devm_kzalloc(&pdev->dev, sizeof(*rpipwm), GFP_KERNEL); + if (!rpipwm) + return -ENOMEM; + + rpipwm->firmware = firmware; + rpipwm->chip.dev = dev; + rpipwm->chip.ops = &raspberrypi_pwm_ops; + rpipwm->chip.base = -1; + rpipwm->chip.npwm = RASPBERRYPI_FIRMWARE_PWM_NUM; + + platform_set_drvdata(pdev, rpipwm); + + ret = raspberrypi_pwm_get_property(rpipwm->firmware, RPI_PWM_CUR_DUTY_REG, + &rpipwm->duty_cycle); + if (ret) { + dev_err(dev, "Failed to get duty cycle: %pe\n", ERR_PTR(ret)); + return ret; + } + + return pwmchip_add(&rpipwm->chip); +} + +static int raspberrypi_pwm_remove(struct platform_device *pdev) +{ + struct raspberrypi_pwm *rpipwm = platform_get_drvdata(pdev); + + return pwmchip_remove(&rpipwm->chip); +} + +static const struct of_device_id raspberrypi_pwm_of_match[] = { + { .compatible = "raspberrypi,firmware-poe-pwm", }, + { } +}; +MODULE_DEVICE_TABLE(of, raspberrypi_pwm_of_match); + +static struct platform_driver raspberrypi_pwm_driver = { + .driver = { + .name = "raspberrypi-poe-pwm", + .of_match_table = raspberrypi_pwm_of_match, + }, + .probe = raspberrypi_pwm_probe, + .remove = raspberrypi_pwm_remove, +}; +module_platform_driver(raspberrypi_pwm_driver); + +MODULE_AUTHOR("Nicolas Saenz Julienne "); +MODULE_DESCRIPTION("Raspberry Pi Firmware Based PWM Bus Driver"); +MODULE_LICENSE("GPL v2"); -- 2.30.1 From fabioaiuto83 at gmail.com Fri Mar 12 15:49:40 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Fri, 12 Mar 2021 16:49:40 +0100 Subject: [PATCH 0/3] staging: rtl8723bs: remove unused code blocks Message-ID: This patch set removes unused code blocks as required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Fabio Aiuto (3): staging: rtl8723bs: remove unused code blocks staging: rtl8723bs: remove unused code blocks staging: rtl8723bs: remove unused code blocks drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 - drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 24 +- .../staging/rtl8723bs/core/rtw_wlan_util.c | 61 +- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 824 +----------------- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 43 +- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 248 +----- drivers/staging/rtl8723bs/hal/sdio_ops.c | 4 +- drivers/staging/rtl8723bs/include/autoconf.h | 3 - drivers/staging/rtl8723bs/include/drv_types.h | 5 - .../rtl8723bs/include/drv_types_sdio.h | 2 +- .../staging/rtl8723bs/include/hal_com_h2c.h | 88 +- drivers/staging/rtl8723bs/include/hal_intf.h | 5 - .../staging/rtl8723bs/include/rtl8723b_cmd.h | 4 +- .../staging/rtl8723bs/include/rtl8723b_hal.h | 17 - .../staging/rtl8723bs/include/rtl8723b_spec.h | 10 - drivers/staging/rtl8723bs/include/rtw_mp.h | 3 - .../staging/rtl8723bs/include/rtw_pwrctrl.h | 62 -- drivers/staging/rtl8723bs/include/rtw_recv.h | 5 - .../staging/rtl8723bs/include/rtw_security.h | 3 - drivers/staging/rtl8723bs/include/sdio_ops.h | 8 +- drivers/staging/rtl8723bs/include/sta_info.h | 5 - .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 56 -- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 3 - drivers/staging/rtl8723bs/os_dep/os_intfs.c | 238 +---- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 8 - drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 5 - 26 files changed, 28 insertions(+), 1709 deletions(-) -- 2.20.1 From fabioaiuto83 at gmail.com Fri Mar 12 15:50:48 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Fri, 12 Mar 2021 16:50:48 +0100 Subject: [PATCH 1/3] staging: rtl8723bs: remove unused code blocks In-Reply-To: References: Message-ID: Remove conditional code blocks checked by unused CONFIG_PNO_SUPPORT Cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 18 -- .../staging/rtl8723bs/core/rtw_wlan_util.c | 8 - drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 269 ------------------ drivers/staging/rtl8723bs/hal/sdio_halinit.c | 8 - .../staging/rtl8723bs/include/hal_com_h2c.h | 17 -- .../staging/rtl8723bs/include/rtl8723b_hal.h | 10 - .../staging/rtl8723bs/include/rtw_pwrctrl.h | 53 ---- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 56 ---- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 7 - 9 files changed, 446 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index c9f4a18b24b9..8059aeea9d47 100644 --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c @@ -1149,29 +1149,11 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter) pwrctrlpriv->wowlan_mode = false; pwrctrlpriv->wowlan_ap_mode = false; - -#ifdef CONFIG_PNO_SUPPORT - pwrctrlpriv->pno_inited = false; - pwrctrlpriv->pnlo_info = NULL; - pwrctrlpriv->pscan_info = NULL; - pwrctrlpriv->pno_ssid_list = NULL; - pwrctrlpriv->pno_in_resume = true; -#endif } void rtw_free_pwrctrl_priv(struct adapter *adapter) { -#ifdef CONFIG_PNO_SUPPORT - if (pwrctrlpriv->pnlo_info) - printk("****** pnlo_info memory leak********\n"); - - if (pwrctrlpriv->pscan_info) - printk("****** pscan_info memory leak********\n"); - - if (pwrctrlpriv->pno_ssid_list) - printk("****** pno_ssid_list memory leak********\n"); -#endif } inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms) diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index 96feced698ac..ae577178534f 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -2189,11 +2189,3 @@ void rtw_set_sec_pn(struct adapter *padapter) } #endif /* CONFIG_WOWLAN */ -#ifdef CONFIG_PNO_SUPPORT -#define CSCAN_TLV_TYPE_SSID_IE 'S' -#define CIPHER_IE "key_mgmt =" -#define CIPHER_NONE "NONE" -#define CIPHER_WPA_PSK "WPA-PSK" -#define CIPHER_WPA_EAP "WPA-EAP IEEE8021X" - -#endif /* CONFIG_PNO_SUPPORT */ diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index 479623d6eb79..b6958d3db855 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -462,125 +462,6 @@ static void ConstructARPResponse( } } -#ifdef CONFIG_PNO_SUPPORT -static void ConstructPnoInfo( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - - struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); - - u8 *pPnoInfoPkt = pframe; - pPnoInfoPkt = (u8 *)(pframe + *pLength); - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_num, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->fast_scan_period, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->fast_scan_iterations, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->slow_scan_period, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_length, - MAX_PNO_LIST_COUNT); - - *pLength += MAX_PNO_LIST_COUNT; - pPnoInfoPkt += MAX_PNO_LIST_COUNT; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_cipher_info, - MAX_PNO_LIST_COUNT); - - *pLength += MAX_PNO_LIST_COUNT; - pPnoInfoPkt += MAX_PNO_LIST_COUNT; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_channel_info, - MAX_PNO_LIST_COUNT); - - *pLength += MAX_PNO_LIST_COUNT; - pPnoInfoPkt += MAX_PNO_LIST_COUNT; -} - -static void ConstructSSIDList( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - int i = 0; - u8 *pSSIDListPkt = pframe; - struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); - - pSSIDListPkt = (u8 *)(pframe + *pLength); - - for (i = 0; i < pwrctl->pnlo_info->ssid_num ; i++) { - memcpy(pSSIDListPkt, &pwrctl->pno_ssid_list->node[i].SSID, - pwrctl->pnlo_info->ssid_length[i]); - - *pLength += WLAN_SSID_MAXLEN; - pSSIDListPkt += WLAN_SSID_MAXLEN; - } -} - -static void ConstructScanInfo( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - int i = 0; - u8 *pScanInfoPkt = pframe; - struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); - - pScanInfoPkt = (u8 *)(pframe + *pLength); - - memcpy(pScanInfoPkt, &pwrctl->pscan_info->channel_num, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_ch, 1); - - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_bw, 1); - - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_40_offset, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_80_offset, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->periodScan, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->period_scan_time, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->enableRFE, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->rfe_type, 8); - - *pLength += 8; - pScanInfoPkt += 8; - - for (i = 0; i < MAX_SCAN_LIST_COUNT; i++) { - memcpy(pScanInfoPkt, &pwrctl->pscan_info->ssid_channel_info[i], 4); - *pLength += 4; - pScanInfoPkt += 4; - } -} -#endif - #ifdef CONFIG_GTK_OL static void ConstructGTKResponse( struct adapter *padapter, u8 *pframe, u32 *pLength @@ -666,48 +547,6 @@ static void ConstructGTKResponse( } #endif /* CONFIG_GTK_OL */ -#ifdef CONFIG_PNO_SUPPORT -static void ConstructProbeReq(struct adapter *padapter, u8 *pframe, u32 *pLength) -{ - struct ieee80211_hdr *pwlanhdr; - u16 *fctrl; - u32 pktlen; - unsigned char *mac; - unsigned char bssrate[NumRates]; - int bssrate_len = 0; - u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - pwlanhdr = (struct ieee80211_hdr *)pframe; - mac = myid(&(padapter->eeprompriv)); - - fctrl = &(pwlanhdr->frame_control); - *(fctrl) = 0; - - /* broadcast probe request frame */ - memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN); - memcpy(pwlanhdr->addr3, bc_addr, ETH_ALEN); - - memcpy(pwlanhdr->addr2, mac, ETH_ALEN); - - SetSeqNum(pwlanhdr, 0); - SetFrameSubType(pframe, WIFI_PROBEREQ); - - pktlen = sizeof(struct ieee80211_hdr_3addr); - pframe += pktlen; - - pframe = rtw_set_ie(pframe, WLAN_EID_SSID, 0, NULL, &pktlen); - - get_rate_set(padapter, bssrate, &bssrate_len); - - if (bssrate_len > 8) { - pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, 8, bssrate, &pktlen); - pframe = rtw_set_ie(pframe, WLAN_EID_EXT_SUPP_RATES, (bssrate_len - 8), (bssrate + 8), &pktlen); - } else - pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, bssrate_len, bssrate, &pktlen); - - *pLength = pktlen; -} -#endif /* CONFIG_PNO_SUPPORT */ #endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN @@ -875,15 +714,6 @@ static void rtl8723b_set_FwAoacRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_ RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CAoacRsvdPageParm:", u1H2CAoacRsvdPageParm, H2C_AOAC_RSVDPAGE_LOC_LEN); FillH2CCmd8723B(padapter, H2C_8723B_AOAC_RSVD_PAGE, H2C_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm); } else { -#ifdef CONFIG_PNO_SUPPORT - if (!pwrpriv->pno_in_resume) { - DBG_871X("NLO_INFO =%d\n", rsvdpageloc->LocPNOInfo); - memset(&u1H2CAoacRsvdPageParm, 0, sizeof(u1H2CAoacRsvdPageParm)); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_NLO_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocPNOInfo); - FillH2CCmd8723B(padapter, H2C_AOAC_RSVDPAGE3, H2C_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm); - msleep(10); - } -#endif } #endif /* CONFIG_WOWLAN */ @@ -1183,11 +1013,6 @@ static void rtl8723b_set_FwWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) u8 gpio_high_active = 0; /* 0: low active, 1: high active */ u8 magic_pkt = 0; -#ifdef CONFIG_PNO_SUPPORT - if (!ppwrpriv->wowlan_pno_enable) - magic_pkt = 1; -#endif - if (psecpriv->dot11PrivacyAlgrthm == _WEP40_ || psecpriv->dot11PrivacyAlgrthm == _WEP104_) hw_unicast = 1; @@ -1240,28 +1065,9 @@ static void rtl8723b_set_FwRemoteWakeCtrl_Cmd(struct adapter *padapter, u8 benab else SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_ACTION(u1H2CRemoteWakeCtrlParm, 1); } -#ifdef CONFIG_PNO_SUPPORT - else { - SET_H2CCMD_REMOTE_WAKECTRL_ENABLE(u1H2CRemoteWakeCtrlParm, benable); - SET_H2CCMD_REMOTE_WAKE_CTRL_NLO_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, benable); - } -#endif RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CRemoteWakeCtrlParm:", u1H2CRemoteWakeCtrlParm, H2C_REMOTE_WAKE_CTRL_LEN); FillH2CCmd8723B(padapter, H2C_8723B_REMOTE_WAKE_CTRL, H2C_REMOTE_WAKE_CTRL_LEN, u1H2CRemoteWakeCtrlParm); -#ifdef CONFIG_PNO_SUPPORT - if (ppwrpriv->wowlan_pno_enable && !ppwrpriv->pno_in_resume) { - res = rtw_read8(padapter, REG_PNO_STATUS); - DBG_871X("cmd: 0x81 REG_PNO_STATUS: 0x%02x\n", res); - while (!(res&BIT(7)) && count < 25) { - DBG_871X("[%d] cmd: 0x81 REG_PNO_STATUS: 0x%02x\n", count, res); - res = rtw_read8(padapter, REG_PNO_STATUS); - count++; - msleep(2); - } - DBG_871X("cmd: 0x81 REG_PNO_STATUS: 0x%02x\n", res); - } -#endif /* CONFIG_PNO_SUPPORT */ } static void rtl8723b_set_FwAOACGlobalInfo_Cmd(struct adapter *padapter, u8 group_alg, u8 pairwise_alg) @@ -1278,26 +1084,6 @@ static void rtl8723b_set_FwAOACGlobalInfo_Cmd(struct adapter *padapter, u8 grou FillH2CCmd8723B(padapter, H2C_8723B_AOAC_GLOBAL_INFO, H2C_AOAC_GLOBAL_INFO_LEN, u1H2CAOACGlobalInfoParm); } -#ifdef CONFIG_PNO_SUPPORT -static void rtl8723b_set_FwScanOffloadInfo_cmd(struct adapter *padapter, PRSVDPAGE_LOC rsvdpageloc, u8 enable) -{ - u8 u1H2CScanOffloadInfoParm[H2C_SCAN_OFFLOAD_CTRL_LEN] = {0}; - - DBG_871X("%s: loc_probe_packet:%d, loc_scan_info: %d loc_ssid_info:%d\n", - __func__, rsvdpageloc->LocProbePacket, rsvdpageloc->LocScanInfo, rsvdpageloc->LocSSIDInfo); - - SET_H2CCMD_AOAC_NLO_FUN_EN(u1H2CScanOffloadInfoParm, enable); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_SCAN_INFO(u1H2CScanOffloadInfoParm, rsvdpageloc->LocScanInfo); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_PROBE_PACKET(u1H2CScanOffloadInfoParm, rsvdpageloc->LocProbePacket); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_SSID_INFO(u1H2CScanOffloadInfoParm, rsvdpageloc->LocSSIDInfo); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CScanOffloadInfoParm:", u1H2CScanOffloadInfoParm, H2C_SCAN_OFFLOAD_CTRL_LEN); - FillH2CCmd8723B(padapter, H2C_8723B_D0_SCAN_OFFLOAD_INFO, H2C_SCAN_OFFLOAD_CTRL_LEN, u1H2CScanOffloadInfoParm); - - msleep(20); -} -#endif /* CONFIG_PNO_SUPPORT */ - void rtl8723b_set_wowlan_cmd(struct adapter *padapter, u8 enable) { struct security_priv *psecpriv = &padapter->securitypriv; @@ -1656,55 +1442,8 @@ static void rtl8723b_set_FwRsvdPagePkt( } else #endif /* CONFIG_WOWLAN */ { -#ifdef CONFIG_PNO_SUPPORT - if (!pwrctl->pno_in_resume && pwrctl->pno_inited) { - /* Probe Request */ - RsvdPageLoc.LocProbePacket = TotalPageNum; - ConstructProbeReq( - padapter, - &ReservedPagePacket[BufIndex], - &ProbeReqLength); - - rtl8723b_fill_fake_txdesc(padapter, - &ReservedPagePacket[BufIndex-TxDescLen], - ProbeReqLength, false, false, false); - CurtPktPageNum = - (u8)PageNum_128(TxDescLen + ProbeReqLength); - - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* PNO INFO Page */ - RsvdPageLoc.LocPNOInfo = TotalPageNum; - ConstructPnoInfo(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &PNOLength); - - CurtPktPageNum = (u8)PageNum_128(PNOLength); - TotalPageNum += CurtPktPageNum; - BufIndex += (CurtPktPageNum*PageSize); - - /* SSID List Page */ - RsvdPageLoc.LocSSIDInfo = TotalPageNum; - ConstructSSIDList(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &SSIDLegnth); - CurtPktPageNum = (u8)PageNum_128(SSIDLegnth); - TotalPageNum += CurtPktPageNum; - BufIndex += (CurtPktPageNum*PageSize); - - /* Scan Info Page */ - RsvdPageLoc.LocScanInfo = TotalPageNum; - ConstructScanInfo(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &ScanInfoLength); - CurtPktPageNum = (u8)PageNum_128(ScanInfoLength); - TotalPageNum += CurtPktPageNum; - BufIndex += (CurtPktPageNum*PageSize); - - TotalPacketLen = BufIndex + ScanInfoLength; - } else { TotalPacketLen = BufIndex + BTQosNullLength; } -#else /* CONFIG_PNO_SUPPORT */ - TotalPacketLen = BufIndex + BTQosNullLength; -#endif - } if (TotalPacketLen > MaxRsvdPageBufSize) { DBG_871X("%s(): ERROR: The rsvd page size is not enough!!TotalPacketLen %d, MaxRsvdPageBufSize %d\n", __func__, @@ -1725,14 +1464,6 @@ static void rtl8723b_set_FwRsvdPagePkt( rtl8723b_set_FwAoacRsvdPage_cmd(padapter, &RsvdPageLoc); } else { rtl8723b_set_FwAoacRsvdPage_cmd(padapter, &RsvdPageLoc); -#ifdef CONFIG_PNO_SUPPORT - if (pwrctl->pno_in_resume) - rtl8723b_set_FwScanOffloadInfo_cmd(padapter, - &RsvdPageLoc, 0); - else - rtl8723b_set_FwScanOffloadInfo_cmd(padapter, - &RsvdPageLoc, 1); -#endif } return; diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index 3266839031f8..ced05bbfc906 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -1555,14 +1555,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) if (psta) rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); } -#ifdef CONFIG_PNO_SUPPORT - rtw_write8(padapter, 0x1b8, 0); - DBG_871X("reset 0x1b8: %d\n", rtw_read8(padapter, 0x1b8)); - rtw_write8(padapter, 0x1b9, 0); - DBG_871X("reset 0x1b9: %d\n", rtw_read8(padapter, 0x1b9)); - rtw_write8(padapter, REG_PNO_STATUS, 0); - DBG_871X("reset REG_PNO_STATUS: %d\n", rtw_read8(padapter, REG_PNO_STATUS)); -#endif break; default: diff --git a/drivers/staging/rtl8723bs/include/hal_com_h2c.h b/drivers/staging/rtl8723bs/include/hal_com_h2c.h index b951bc288b89..1f7ed90f9faa 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_h2c.h +++ b/drivers/staging/rtl8723bs/include/hal_com_h2c.h @@ -233,17 +233,6 @@ enum h2c_cmd { #ifdef CONFIG_GTK_OL #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+5, 0, 8, __Value) #endif /* CONFIG_GTK_OL */ -#ifdef CONFIG_PNO_SUPPORT -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_NLO_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd), 0, 8, __Value) -#endif - -#ifdef CONFIG_PNO_SUPPORT -/* D0_Scan_Offload_Info_0x86 */ -#define SET_H2CCMD_AOAC_NLO_FUN_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd), 3, 1, __Value) -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_PROBE_PACKET(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+1, 0, 8, __Value) -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_SCAN_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+2, 0, 8, __Value) -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_SSID_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+3, 0, 8, __Value) -#endif /* CONFIG_PNO_SUPPORT */ /* */ /* Structure -------------------------------------------------- */ @@ -265,12 +254,6 @@ typedef struct _RSVDPAGE_LOC { #ifdef CONFIG_GTK_OL u8 LocGTKEXTMEM; #endif /* CONFIG_GTK_OL */ -#ifdef CONFIG_PNO_SUPPORT - u8 LocPNOInfo; - u8 LocScanInfo; - u8 LocSSIDInfo; - u8 LocProbePacket; -#endif /* CONFIG_PNO_SUPPORT */ #endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN u8 LocApOffloadBCN; diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index 6f964f5c6578..2537bd7d6a13 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -92,11 +92,6 @@ struct rt_firmware_hdr { #define BCNQ_PAGE_NUM_8723B 0x08 #define BCNQ1_PAGE_NUM_8723B 0x00 -#ifdef CONFIG_PNO_SUPPORT -#undef BCNQ1_PAGE_NUM_8723B -#define BCNQ1_PAGE_NUM_8723B 0x00 /* 0x04 */ -#endif - #define MAX_RX_DMA_BUFFER_SIZE_8723B 0x2800 /* RX 10K */ /* For WoWLan, more reserved page */ @@ -107,11 +102,6 @@ struct rt_firmware_hdr { #define WOWLAN_PAGE_NUM_8723B 0x00 #endif -#ifdef CONFIG_PNO_SUPPORT -#undef WOWLAN_PAGE_NUM_8723B -#define WOWLAN_PAGE_NUM_8723B 0x0d -#endif - #ifdef CONFIG_AP_WOWLAN #define AP_WOWLAN_PAGE_NUM_8723B 0x02 #endif diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h index 0987891e85ae..f467e9032450 100644 --- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h @@ -46,11 +46,6 @@ enum Power_Mgnt { PS_MODE_NUM, }; -#ifdef CONFIG_PNO_SUPPORT -#define MAX_PNO_LIST_COUNT 16 -#define MAX_SCAN_LIST_COUNT 14 /* 2.4G only */ -#endif - /* BIT[2:0] = HW state BIT[3] = Protocol PS state, 0: register active state , 1: register sleep state @@ -158,47 +153,6 @@ enum PS_DENY_REASON { PS_DENY_OTHERS = 31 }; -#ifdef CONFIG_PNO_SUPPORT -struct pno_nlo_info { - u32 fast_scan_period; /* Fast scan period */ - u32 ssid_num; /* number of entry */ - u32 slow_scan_period; /* slow scan period */ - u32 fast_scan_iterations; /* Fast scan iterations */ - u8 ssid_length[MAX_PNO_LIST_COUNT]; /* SSID Length Array */ - u8 ssid_cipher_info[MAX_PNO_LIST_COUNT]; /* Cipher information for security */ - u8 ssid_channel_info[MAX_PNO_LIST_COUNT]; /* channel information */ -}; - -struct pno_ssid { - u32 SSID_len; - u8 SSID[32]; -}; - -struct pno_ssid_list { - struct pno_ssid node[MAX_PNO_LIST_COUNT]; -}; - -struct pno_scan_channel_info { - u8 channel; - u8 tx_power; - u8 timeout; - u8 active; /* set 1 means active scan, or pasivite scan. */ -}; - -struct pno_scan_info { - u8 enableRFE; /* Enable RFE */ - u8 period_scan_time; /* exclusive with fast_scan_period and slow_scan_period */ - u8 periodScan; /* exclusive with fast_scan_period and slow_scan_period */ - u8 orig_80_offset; /* original channel 80 offset */ - u8 orig_40_offset; /* original channel 40 offset */ - u8 orig_bw; /* original bandwidth */ - u8 orig_ch; /* original channel */ - u8 channel_num; /* number of channel */ - u64 rfe_type; /* rfe_type && 0x00000000000000ff */ - struct pno_scan_channel_info ssid_channel_info[MAX_SCAN_LIST_COUNT]; -}; -#endif /* CONFIG_PNO_SUPPORT */ - struct pwrctrl_priv { struct mutex lock; volatile u8 rpwm; /* requested power state for fw */ @@ -272,13 +226,6 @@ struct pwrctrl_priv { u8 wowlan_unicast; u8 wowlan_pattern_idx; u8 wowlan_pno_enable; -#ifdef CONFIG_PNO_SUPPORT - u8 pno_in_resume; - u8 pno_inited; - struct pno_nlo_info *pnlo_info; - struct pno_scan_info *pscan_info; - struct pno_ssid_list *pno_ssid_list; -#endif u32 wowlan_pattern_context[8][5]; u64 wowlan_fw_iv; #endif /* CONFIG_WOWLAN */ diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index ff164a8c8679..4d2981a4c01d 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -3095,54 +3095,6 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, return ret; } -#if defined(CONFIG_PNO_SUPPORT) -static int cfg80211_rtw_sched_scan_start(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_sched_scan_request *request) -{ - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - int ret; - - if (padapter->bup == false) { - DBG_871X("%s: net device is down.\n", __func__); - return -EIO; - } - - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true || - check_fwstate(pmlmepriv, _FW_LINKED) == true || - check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) { - DBG_871X("%s: device is busy.\n", __func__); - rtw_scan_abort(padapter); - } - - if (request == NULL) { - DBG_871X("%s: invalid cfg80211_requests parameters.\n", __func__); - return -EINVAL; - } - - ret = rtw_android_cfg80211_pno_setup(dev, request->ssids, - request->n_ssids, request->interval); - - if (ret < 0) { - DBG_871X("%s ret: %d\n", __func__, ret); - goto exit; - } - - ret = rtw_android_pno_enable(dev, true); - if (ret < 0) { - DBG_871X("%s ret: %d\n", __func__, ret); - goto exit; - } -exit: - return ret; -} - -static int cfg80211_rtw_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev) -{ - return rtw_android_pno_enable(dev, false); -} -#endif /* CONFIG_PNO_SUPPORT */ - static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum nl80211_band band, u8 rf_type) { @@ -3248,9 +3200,6 @@ static void rtw_cfg80211_preinit_wiphy(struct adapter *padapter, struct wiphy *w #if defined(CONFIG_PM) wiphy->max_sched_scan_reqs = 1; -#ifdef CONFIG_PNO_SUPPORT - wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT; -#endif #endif #if defined(CONFIG_PM) @@ -3297,11 +3246,6 @@ static struct cfg80211_ops rtw_cfg80211_ops = { .change_bss = cfg80211_rtw_change_bss, .mgmt_tx = cfg80211_rtw_mgmt_tx, - -#if defined(CONFIG_PNO_SUPPORT) - .sched_scan_start = cfg80211_rtw_sched_scan_start, - .sched_scan_stop = cfg80211_rtw_sched_scan_stop, -#endif /* CONFIG_PNO_SUPPORT */ }; int rtw_wdev_alloc(struct adapter *padapter, struct device *dev) diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index b62fe9238e6d..61488781d211 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -1505,10 +1505,6 @@ int rtw_resume_process_wow(struct adapter *padapter) goto exit; } -#ifdef CONFIG_PNO_SUPPORT - pwrpriv->pno_in_resume = true; -#endif - if (pwrpriv->wowlan_mode) { rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN"); @@ -1780,9 +1776,6 @@ int rtw_resume_common(struct adapter *padapter) if (pwrpriv) { pwrpriv->bInSuspend = false; - #ifdef CONFIG_PNO_SUPPORT - pwrpriv->pno_in_resume = false; - #endif } DBG_871X_LEVEL(_drv_always_, "%s:%d in %d ms\n", __func__, ret, jiffies_to_msecs(jiffies - start_time)); -- 2.20.1 From fabioaiuto83 at gmail.com Fri Mar 12 15:52:07 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Fri, 12 Mar 2021 16:52:07 +0100 Subject: [PATCH 2/3] staging: rtl8723bs: remove unused code blocks In-Reply-To: References: Message-ID: <76c47c1c24896d8854b4732645bd90ac27cf2b71.1615561447.git.fabioaiuto83@gmail.com> remove conditional code blocks checked by unused CONFIG_WOWLAN cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 - drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 6 +- .../staging/rtl8723bs/core/rtw_wlan_util.c | 53 +- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 555 +----------------- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 43 +- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 240 +------- drivers/staging/rtl8723bs/hal/sdio_ops.c | 4 +- drivers/staging/rtl8723bs/include/autoconf.h | 3 - drivers/staging/rtl8723bs/include/drv_types.h | 5 - .../rtl8723bs/include/drv_types_sdio.h | 2 +- .../staging/rtl8723bs/include/hal_com_h2c.h | 71 +-- drivers/staging/rtl8723bs/include/hal_intf.h | 5 - .../staging/rtl8723bs/include/rtl8723b_cmd.h | 4 +- .../staging/rtl8723bs/include/rtl8723b_hal.h | 7 - .../staging/rtl8723bs/include/rtl8723b_spec.h | 10 - drivers/staging/rtl8723bs/include/rtw_mp.h | 3 - .../staging/rtl8723bs/include/rtw_pwrctrl.h | 9 - .../staging/rtl8723bs/include/rtw_security.h | 3 - drivers/staging/rtl8723bs/include/sdio_ops.h | 8 +- drivers/staging/rtl8723bs/include/sta_info.h | 5 - .../staging/rtl8723bs/os_dep/ioctl_linux.c | 3 - drivers/staging/rtl8723bs/os_dep/os_intfs.c | 231 +------- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 5 - 23 files changed, 28 insertions(+), 1250 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index 2c9425e2a1e9..7412295f0a04 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -2098,9 +2098,6 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) if (!candidate) { DBG_871X("%s: return _FAIL(candidate == NULL)\n", __func__); -#ifdef CONFIG_WOWLAN - _clr_fwstate_(pmlmepriv, _FW_LINKED|_FW_UNDER_LINKING); -#endif ret = _FAIL; goto exit; } else { diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index 8059aeea9d47..2e6c522b74e3 100644 --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c @@ -350,7 +350,7 @@ static u8 PS_RDY_CHECK(struct adapter *padapter) struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN if (pwrpriv->bInSuspend && pwrpriv->wowlan_mode) return true; else if (pwrpriv->bInSuspend && pwrpriv->wowlan_ap_mode) @@ -391,7 +391,7 @@ static u8 PS_RDY_CHECK(struct adapter *padapter) void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode, const char *msg) { struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN struct debug_priv *pdbgpriv = &padapter->dvobj->drv_dbg; #endif @@ -422,7 +422,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a pwrpriv->pwr_mode = ps_mode; rtw_set_rpwm(padapter, PS_STATE_S4); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode) { unsigned long start_time; u32 delay_ms; diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index ae577178534f..355e43c4cf9a 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -10,7 +10,7 @@ #include #include -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN #include #endif @@ -2113,7 +2113,7 @@ int rtw_config_gpio(struct net_device *netdev, int gpio_num, bool isOutput) EXPORT_SYMBOL(rtw_config_gpio); #endif -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -2139,53 +2139,4 @@ void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip) } } #endif -#ifdef CONFIG_WOWLAN -void rtw_get_sec_iv(struct adapter *padapter, u8 *pcur_dot11txpn, u8 *StaAddr) -{ - struct sta_info *psta; - struct security_priv *psecpriv = &padapter->securitypriv; - - memset(pcur_dot11txpn, 0, 8); - if (!StaAddr) - return; - psta = rtw_get_stainfo(&padapter->stapriv, StaAddr); - DBG_871X("%s(): StaAddr: %02x %02x %02x %02x %02x %02x\n", - __func__, StaAddr[0], StaAddr[1], StaAddr[2], - StaAddr[3], StaAddr[4], StaAddr[5]); - - if (psta) { - if (psecpriv->dot11PrivacyAlgrthm != _NO_PRIVACY_ && psta->dot11txpn.val > 0) - psta->dot11txpn.val--; - AES_IV(pcur_dot11txpn, psta->dot11txpn, 0); - - DBG_871X("%s(): CurrentIV: %02x %02x %02x %02x %02x %02x %02x %02x\n" - , __func__, pcur_dot11txpn[0], pcur_dot11txpn[1], - pcur_dot11txpn[2], pcur_dot11txpn[3], pcur_dot11txpn[4], - pcur_dot11txpn[5], pcur_dot11txpn[6], pcur_dot11txpn[7]); - } -} - -void rtw_set_sec_pn(struct adapter *padapter) -{ - struct sta_info *psta; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct security_priv *psecpriv = &padapter->securitypriv; - - psta = rtw_get_stainfo(&padapter->stapriv, - get_my_bssid(&pmlmeinfo->network)); - - if (psta) { - if (pwrpriv->wowlan_fw_iv > psta->dot11txpn.val) { - if (psecpriv->dot11PrivacyAlgrthm != _NO_PRIVACY_) - psta->dot11txpn.val = pwrpriv->wowlan_fw_iv + 2; - } else { - DBG_871X("%s(): FW IV is smaller than driver\n", __func__); - psta->dot11txpn.val += 2; - } - DBG_871X("%s: dot11txpn: 0x%016llx\n", __func__, psta->dot11txpn.val); - } -} -#endif /* CONFIG_WOWLAN */ diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index b6958d3db855..c3e7103da7e7 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -31,10 +31,6 @@ static u8 _is_fw_read_cmd_down(struct adapter *padapter, u8 msgbox_num) if (0 == valid) { read_down = true; } -#ifdef CONFIG_WOWLAN - else - msleep(1); -#endif } while ((!read_down) && (retry_cnts--)); return read_down; @@ -316,239 +312,6 @@ static void ConstructNullFunctionData( *pLength = pktlen; } - -#ifdef CONFIG_WOWLAN -/* */ -/* Description: */ -/* Construct the ARP response packet to support ARP offload. */ -/* */ -static void ConstructARPResponse( - struct adapter *padapter, - u8 *pframe, - u32 *pLength, - u8 *pIPAddress -) -{ - struct ieee80211_hdr *pwlanhdr; - __le16 *fctrl; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct security_priv *psecuritypriv = &padapter->securitypriv; - static u8 ARPLLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06}; - u8 *pARPRspPkt = pframe; - /* for TKIP Cal MIC */ - u8 *payload = pframe; - u8 EncryptionHeadOverhead = 0; - /* DBG_871X("%s:%d\n", __func__, bForcePowerSave); */ - - pwlanhdr = (struct ieee80211_hdr *)pframe; - - fctrl = &pwlanhdr->frame_control; - *(fctrl) = 0; - - /* */ - /* MAC Header. */ - /* */ - SetFrameType(fctrl, WIFI_DATA); - /* SetFrameSubType(fctrl, 0); */ - SetToDs(fctrl); - memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - - SetSeqNum(pwlanhdr, 0); - SetDuration(pwlanhdr, 0); - /* SET_80211_HDR_FRAME_CONTROL(pARPRspPkt, 0); */ - /* SET_80211_HDR_TYPE_AND_SUBTYPE(pARPRspPkt, Type_Data); */ - /* SET_80211_HDR_TO_DS(pARPRspPkt, 1); */ - /* SET_80211_HDR_ADDRESS1(pARPRspPkt, pMgntInfo->Bssid); */ - /* SET_80211_HDR_ADDRESS2(pARPRspPkt, Adapter->CurrentAddress); */ - /* SET_80211_HDR_ADDRESS3(pARPRspPkt, pMgntInfo->Bssid); */ - - /* SET_80211_HDR_DURATION(pARPRspPkt, 0); */ - /* SET_80211_HDR_FRAGMENT_SEQUENCE(pARPRspPkt, 0); */ - *pLength = 24; - - /* */ - /* Security Header: leave space for it if necessary. */ - /* */ - - switch (psecuritypriv->dot11PrivacyAlgrthm) { - case _WEP40_: - case _WEP104_: - EncryptionHeadOverhead = 4; - break; - case _TKIP_: - EncryptionHeadOverhead = 8; - break; - case _AES_: - EncryptionHeadOverhead = 8; - break; - default: - EncryptionHeadOverhead = 0; - } - - if (EncryptionHeadOverhead > 0) { - memset(&(pframe[*pLength]), 0, EncryptionHeadOverhead); - *pLength += EncryptionHeadOverhead; - SetPrivacy(fctrl); - } - - /* */ - /* Frame Body. */ - /* */ - pARPRspPkt = (u8 *)(pframe + *pLength); - payload = pARPRspPkt; /* Get Payload pointer */ - /* LLC header */ - memcpy(pARPRspPkt, ARPLLCHeader, 8); - *pLength += 8; - - /* ARP element */ - pARPRspPkt += 8; - SET_ARP_PKT_HW(pARPRspPkt, 0x0100); - SET_ARP_PKT_PROTOCOL(pARPRspPkt, 0x0008); /* IP protocol */ - SET_ARP_PKT_HW_ADDR_LEN(pARPRspPkt, 6); - SET_ARP_PKT_PROTOCOL_ADDR_LEN(pARPRspPkt, 4); - SET_ARP_PKT_OPERATION(pARPRspPkt, 0x0200); /* ARP response */ - SET_ARP_PKT_SENDER_MAC_ADDR(pARPRspPkt, myid(&(padapter->eeprompriv))); - SET_ARP_PKT_SENDER_IP_ADDR(pARPRspPkt, pIPAddress); - { - SET_ARP_PKT_TARGET_MAC_ADDR(pARPRspPkt, get_my_bssid(&(pmlmeinfo->network))); - SET_ARP_PKT_TARGET_IP_ADDR(pARPRspPkt, pIPAddress); - DBG_871X("%s Target Mac Addr:%pM\n", __func__, MAC_ARG(get_my_bssid(&(pmlmeinfo->network)))); - DBG_871X("%s Target IP Addr:%pI4\n", __func__, IP_ARG(pIPAddress)); - } - - *pLength += 28; - - if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_) { - u8 mic[8]; - struct mic_data micdata; - struct sta_info *psta = NULL; - u8 priority[4] = { - 0x0, 0x0, 0x0, 0x0 - }; - u8 null_key[16] = { - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 - }; - - DBG_871X("%s(): Add MIC\n", __func__); - - psta = rtw_get_stainfo(&padapter->stapriv, get_my_bssid(&(pmlmeinfo->network))); - if (psta) { - if (!memcmp(&psta->dot11tkiptxmickey.skey[0], null_key, 16)) { - DBG_871X("%s(): STA dot11tkiptxmickey == 0\n", __func__); - } - /* start to calculate the mic code */ - rtw_secmicsetkey(&micdata, &psta->dot11tkiptxmickey.skey[0]); - } - - rtw_secmicappend(&micdata, pwlanhdr->addr3, 6); /* DA */ - - rtw_secmicappend(&micdata, pwlanhdr->addr2, 6); /* SA */ - - priority[0] = 0; - rtw_secmicappend(&micdata, &priority[0], 4); - - rtw_secmicappend(&micdata, payload, 36); /* payload length = 8 + 28 */ - - rtw_secgetmic(&micdata, &(mic[0])); - - pARPRspPkt += 28; - memcpy(pARPRspPkt, &(mic[0]), 8); - - *pLength += 8; - } -} - -#ifdef CONFIG_GTK_OL -static void ConstructGTKResponse( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - struct ieee80211_hdr *pwlanhdr; - u16 *fctrl; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct security_priv *psecuritypriv = &padapter->securitypriv; - static u8 LLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8E}; - static u8 GTKbody_a[11] = {0x01, 0x03, 0x00, 0x5F, 0x02, 0x03, 0x12, 0x00, 0x10, 0x42, 0x0B}; - u8 *pGTKRspPkt = pframe; - u8 EncryptionHeadOverhead = 0; - /* DBG_871X("%s:%d\n", __func__, bForcePowerSave); */ - - pwlanhdr = (struct ieee80211_hdr *)pframe; - - fctrl = &pwlanhdr->frame_control; - *(fctrl) = 0; - - /* */ - /* MAC Header. */ - /* */ - SetFrameType(fctrl, WIFI_DATA); - /* SetFrameSubType(fctrl, 0); */ - SetToDs(fctrl); - memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - - SetSeqNum(pwlanhdr, 0); - SetDuration(pwlanhdr, 0); - - *pLength = 24; - - /* */ - /* Security Header: leave space for it if necessary. */ - /* */ - - switch (psecuritypriv->dot11PrivacyAlgrthm) { - case _WEP40_: - case _WEP104_: - EncryptionHeadOverhead = 4; - break; - case _TKIP_: - EncryptionHeadOverhead = 8; - break; - case _AES_: - EncryptionHeadOverhead = 8; - break; - default: - EncryptionHeadOverhead = 0; - } - - if (EncryptionHeadOverhead > 0) { - memset(&(pframe[*pLength]), 0, EncryptionHeadOverhead); - *pLength += EncryptionHeadOverhead; - /* GTK's privacy bit is done by FW */ - /* SetPrivacy(fctrl); */ - } - - /* */ - /* Frame Body. */ - /* */ - pGTKRspPkt = (u8 *)(pframe + *pLength); - /* LLC header */ - memcpy(pGTKRspPkt, LLCHeader, 8); - *pLength += 8; - - /* GTK element */ - pGTKRspPkt += 8; - - /* GTK frame body after LLC, part 1 */ - memcpy(pGTKRspPkt, GTKbody_a, 11); - *pLength += 11; - pGTKRspPkt += 11; - /* GTK frame body after LLC, part 2 */ - memset(&(pframe[*pLength]), 0, 88); - *pLength += 88; - pGTKRspPkt += 88; - -} -#endif /* CONFIG_GTK_OL */ - -#endif /* CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN static void ConstructProbeRsp(struct adapter *padapter, u8 *pframe, u32 *pLength, u8 *StaAddr, bool bHideSSID) { @@ -692,31 +455,6 @@ static void rtl8723b_set_FwRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_LOC static void rtl8723b_set_FwAoacRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_LOC rsvdpageloc) { -#ifdef CONFIG_WOWLAN - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 u1H2CAoacRsvdPageParm[H2C_AOAC_RSVDPAGE_LOC_LEN] = {0}; - - DBG_871X("8723BAOACRsvdPageLoc: RWC =%d ArpRsp =%d NbrAdv =%d GtkRsp =%d GtkInfo =%d ProbeReq =%d NetworkList =%d\n", - rsvdpageloc->LocRemoteCtrlInfo, rsvdpageloc->LocArpRsp, - rsvdpageloc->LocNbrAdv, rsvdpageloc->LocGTKRsp, - rsvdpageloc->LocGTKInfo, rsvdpageloc->LocProbeReq, - rsvdpageloc->LocNetList); - - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - SET_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocRemoteCtrlInfo); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1H2CAoacRsvdPageParm, rsvdpageloc->LocArpRsp); - /* SET_H2CCMD_AOAC_RSVDPAGE_LOC_NEIGHBOR_ADV(u1H2CAoacRsvdPageParm, rsvdpageloc->LocNbrAdv); */ - SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_RSP(u1H2CAoacRsvdPageParm, rsvdpageloc->LocGTKRsp); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocGTKInfo); -#ifdef CONFIG_GTK_OL - SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(u1H2CAoacRsvdPageParm, rsvdpageloc->LocGTKEXTMEM); -#endif /* CONFIG_GTK_OL */ - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CAoacRsvdPageParm:", u1H2CAoacRsvdPageParm, H2C_AOAC_RSVDPAGE_LOC_LEN); - FillH2CCmd8723B(padapter, H2C_8723B_AOAC_RSVD_PAGE, H2C_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm); - } else { - } - -#endif /* CONFIG_WOWLAN */ } #ifdef CONFIG_AP_WOWLAN @@ -771,40 +509,6 @@ void rtl8723b_set_FwMediaStatusRpt_cmd(struct adapter *padapter, u8 mstatus, u8 FillH2CCmd8723B(padapter, H2C_8723B_MEDIA_STATUS_RPT, H2C_MEDIA_STATUS_RPT_LEN, u1H2CMediaStatusRptParm); } -#ifdef CONFIG_WOWLAN -static void rtl8723b_set_FwKeepAlive_cmd(struct adapter *padapter, u8 benable, u8 pkt_type) -{ - u8 u1H2CKeepAliveParm[H2C_KEEP_ALIVE_CTRL_LEN] = {0}; - u8 adopt = 1, check_period = 5; - - DBG_871X("%s(): benable = %d\n", __func__, benable); - SET_8723B_H2CCMD_KEEPALIVE_PARM_ENABLE(u1H2CKeepAliveParm, benable); - SET_8723B_H2CCMD_KEEPALIVE_PARM_ADOPT(u1H2CKeepAliveParm, adopt); - SET_8723B_H2CCMD_KEEPALIVE_PARM_PKT_TYPE(u1H2CKeepAliveParm, pkt_type); - SET_8723B_H2CCMD_KEEPALIVE_PARM_CHECK_PERIOD(u1H2CKeepAliveParm, check_period); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CKeepAliveParm:", u1H2CKeepAliveParm, H2C_KEEP_ALIVE_CTRL_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_KEEP_ALIVE, H2C_KEEP_ALIVE_CTRL_LEN, u1H2CKeepAliveParm); -} - -static void rtl8723b_set_FwDisconDecision_cmd(struct adapter *padapter, u8 benable) -{ - u8 u1H2CDisconDecisionParm[H2C_DISCON_DECISION_LEN] = {0}; - u8 adopt = 1, check_period = 10, trypkt_num = 0; - - DBG_871X("%s(): benable = %d\n", __func__, benable); - SET_8723B_H2CCMD_DISCONDECISION_PARM_ENABLE(u1H2CDisconDecisionParm, benable); - SET_8723B_H2CCMD_DISCONDECISION_PARM_ADOPT(u1H2CDisconDecisionParm, adopt); - SET_8723B_H2CCMD_DISCONDECISION_PARM_CHECK_PERIOD(u1H2CDisconDecisionParm, check_period); - SET_8723B_H2CCMD_DISCONDECISION_PARM_TRY_PKT_NUM(u1H2CDisconDecisionParm, trypkt_num); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CDisconDecisionParm:", u1H2CDisconDecisionParm, H2C_DISCON_DECISION_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_DISCON_DECISION, H2C_DISCON_DECISION_LEN, u1H2CDisconDecisionParm); -} -#endif /* CONFIG_WOWLAN */ - void rtl8723b_set_FwMacIdConfig_cmd(struct adapter *padapter, u8 mac_id, u8 raid, u8 bw, u8 sgi, u32 mask) { u8 u1H2CMacIdConfigParm[H2C_MACID_CFG_LEN] = {0}; @@ -855,21 +559,12 @@ void rtl8723b_set_FwPwrMode_cmd(struct adapter *padapter, u8 psmode) else DBG_871X("%s(): FW LPS mode = %d, SmartPS =%d\n", __func__, psmode, pwrpriv->smart_ps); -#ifdef CONFIG_WOWLAN - if (psmode == PS_MODE_DTIM) { /* For WOWLAN LPS, DTIM = (awake_intvl - 1) */ + if (pwrpriv->dtim > 0 && pwrpriv->dtim < 16) + awake_intvl = pwrpriv->dtim+1;/* DTIM = (awake_intvl - 1) */ + else awake_intvl = 3;/* DTIM =2 */ - rlbm = 2; - } else -#endif /* CONFIG_WOWLAN */ - { - if (pwrpriv->dtim > 0 && pwrpriv->dtim < 16) - awake_intvl = pwrpriv->dtim+1;/* DTIM = (awake_intvl - 1) */ - else - awake_intvl = 3;/* DTIM =2 */ - - rlbm = 2; - } + rlbm = 2; if (padapter->registrypriv.wifi_spec == 1) { awake_intvl = 2; @@ -1003,135 +698,6 @@ void rtl8723b_set_FwPwrModeInIPS_cmd(struct adapter *padapter, u8 cmd_param) FillH2CCmd8723B(padapter, H2C_8723B_FWLPS_IN_IPS_, 1, &cmd_param); } -#ifdef CONFIG_WOWLAN -static void rtl8723b_set_FwWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) -{ - struct security_priv *psecpriv = &padapter->securitypriv; - u8 u1H2CWoWlanCtrlParm[H2C_WOWLAN_LEN] = {0}; - u8 discont_wake = 1, gpionum = 0, gpio_dur = 0, hw_unicast = 0; - u8 sdio_wakeup_enable = 1; - u8 gpio_high_active = 0; /* 0: low active, 1: high active */ - u8 magic_pkt = 0; - - if (psecpriv->dot11PrivacyAlgrthm == _WEP40_ || psecpriv->dot11PrivacyAlgrthm == _WEP104_) - hw_unicast = 1; - - DBG_871X("%s(): bFuncEn =%d\n", __func__, bFuncEn); - - SET_H2CCMD_WOWLAN_FUNC_ENABLE(u1H2CWoWlanCtrlParm, bFuncEn); - SET_H2CCMD_WOWLAN_PATTERN_MATCH_ENABLE(u1H2CWoWlanCtrlParm, 0); - SET_H2CCMD_WOWLAN_MAGIC_PKT_ENABLE(u1H2CWoWlanCtrlParm, magic_pkt); - SET_H2CCMD_WOWLAN_UNICAST_PKT_ENABLE(u1H2CWoWlanCtrlParm, hw_unicast); - SET_H2CCMD_WOWLAN_ALL_PKT_DROP(u1H2CWoWlanCtrlParm, 0); - SET_H2CCMD_WOWLAN_GPIO_ACTIVE(u1H2CWoWlanCtrlParm, gpio_high_active); - SET_H2CCMD_WOWLAN_DISCONNECT_WAKE_UP(u1H2CWoWlanCtrlParm, discont_wake); - SET_H2CCMD_WOWLAN_GPIONUM(u1H2CWoWlanCtrlParm, gpionum); - SET_H2CCMD_WOWLAN_DATAPIN_WAKE_UP(u1H2CWoWlanCtrlParm, sdio_wakeup_enable); - SET_H2CCMD_WOWLAN_GPIO_DURATION(u1H2CWoWlanCtrlParm, gpio_dur); - /* SET_H2CCMD_WOWLAN_GPIO_PULSE_EN(u1H2CWoWlanCtrlParm, 1); */ - SET_H2CCMD_WOWLAN_GPIO_PULSE_COUNT(u1H2CWoWlanCtrlParm, 0x09); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CWoWlanCtrlParm:", u1H2CWoWlanCtrlParm, H2C_WOWLAN_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_WOWLAN, H2C_WOWLAN_LEN, u1H2CWoWlanCtrlParm); -} - -static void rtl8723b_set_FwRemoteWakeCtrl_Cmd(struct adapter *padapter, u8 benable) -{ - u8 u1H2CRemoteWakeCtrlParm[H2C_REMOTE_WAKE_CTRL_LEN] = {0}; - struct security_priv *psecuritypriv = &(padapter->securitypriv); - struct pwrctrl_priv *ppwrpriv = adapter_to_pwrctl(padapter); - - DBG_871X("%s(): Enable =%d\n", __func__, benable); - - if (!ppwrpriv->wowlan_pno_enable) { - SET_H2CCMD_REMOTE_WAKECTRL_ENABLE(u1H2CRemoteWakeCtrlParm, benable); - SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, 1); -#ifdef CONFIG_GTK_OL - if (psecuritypriv->binstallKCK_KEK && - psecuritypriv->dot11PrivacyAlgrthm == _AES_) { - SET_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, 1); - } else { - DBG_871X("no kck or security is not AES\n"); - SET_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, 0); - } -#endif /* CONFIG_GTK_OL */ - - SET_H2CCMD_REMOTE_WAKE_CTRL_FW_UNICAST_EN(u1H2CRemoteWakeCtrlParm, 1); - - if ((psecuritypriv->dot11PrivacyAlgrthm == _AES_) || - (psecuritypriv->dot11PrivacyAlgrthm == _NO_PRIVACY_)) - SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_ACTION(u1H2CRemoteWakeCtrlParm, 0); - else - SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_ACTION(u1H2CRemoteWakeCtrlParm, 1); - } - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CRemoteWakeCtrlParm:", u1H2CRemoteWakeCtrlParm, H2C_REMOTE_WAKE_CTRL_LEN); - FillH2CCmd8723B(padapter, H2C_8723B_REMOTE_WAKE_CTRL, - H2C_REMOTE_WAKE_CTRL_LEN, u1H2CRemoteWakeCtrlParm); -} - -static void rtl8723b_set_FwAOACGlobalInfo_Cmd(struct adapter *padapter, u8 group_alg, u8 pairwise_alg) -{ - u8 u1H2CAOACGlobalInfoParm[H2C_AOAC_GLOBAL_INFO_LEN] = {0}; - - DBG_871X("%s(): group_alg =%d pairwise_alg =%d\n", __func__, group_alg, pairwise_alg); - - SET_H2CCMD_AOAC_GLOBAL_INFO_PAIRWISE_ENC_ALG(u1H2CAOACGlobalInfoParm, pairwise_alg); - SET_H2CCMD_AOAC_GLOBAL_INFO_GROUP_ENC_ALG(u1H2CAOACGlobalInfoParm, group_alg); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CAOACGlobalInfoParm:", u1H2CAOACGlobalInfoParm, H2C_AOAC_GLOBAL_INFO_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_AOAC_GLOBAL_INFO, H2C_AOAC_GLOBAL_INFO_LEN, u1H2CAOACGlobalInfoParm); -} - -void rtl8723b_set_wowlan_cmd(struct adapter *padapter, u8 enable) -{ - struct security_priv *psecpriv = &padapter->securitypriv; - struct pwrctrl_priv *ppwrpriv = adapter_to_pwrctl(padapter); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_info *psta = NULL; - u8 pkt_type = 0; - - DBG_871X_LEVEL(_drv_always_, "+%s()+: enable =%d\n", __func__, enable); - if (enable) { - rtl8723b_set_FwAOACGlobalInfo_Cmd(padapter, psecpriv->dot118021XGrpPrivacy, psecpriv->dot11PrivacyAlgrthm); - - rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); /* RT_MEDIA_CONNECT will confuse in the future */ - - if (!(ppwrpriv->wowlan_pno_enable)) { - psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv)); - if (psta) - rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); - } else - DBG_871X("%s(): Disconnected, no FwMediaStatusRpt CONNECT\n", __func__); - - msleep(2); - - if (!(ppwrpriv->wowlan_pno_enable)) { - rtl8723b_set_FwDisconDecision_cmd(padapter, enable); - msleep(2); - - if ((psecpriv->dot11PrivacyAlgrthm != _WEP40_) || (psecpriv->dot11PrivacyAlgrthm != _WEP104_)) - pkt_type = 1; - - rtl8723b_set_FwKeepAlive_cmd(padapter, enable, pkt_type); - msleep(2); - } - - rtl8723b_set_FwWoWlanCtrl_Cmd(padapter, enable); - msleep(2); - - rtl8723b_set_FwRemoteWakeCtrl_Cmd(padapter, enable); - } else { - rtl8723b_set_FwRemoteWakeCtrl_Cmd(padapter, enable); - msleep(2); - rtl8723b_set_FwWoWlanCtrl_Cmd(padapter, enable); - } - - DBG_871X_LEVEL(_drv_always_, "-%s()-\n", __func__); -} -#endif /* CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN static void rtl8723b_set_FwAPWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) { @@ -1223,17 +789,6 @@ static void rtl8723b_set_FwRsvdPagePkt( u16 BufIndex, PageSize = 128; u32 TotalPacketLen, MaxRsvdPageBufSize = 0; RSVDPAGE_LOC RsvdPageLoc; -#ifdef CONFIG_WOWLAN - u32 ARPLegnth = 0, GTKLegnth = 0; - u8 currentip[4]; - u8 cur_dot11txpn[8]; -#ifdef CONFIG_GTK_OL - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *psta; - u8 kek[RTW_KEK_LEN]; - u8 kck[RTW_KCK_LEN]; -#endif -#endif /* DBG_871X("%s---->\n", __func__); */ @@ -1343,107 +898,7 @@ static void rtl8723b_set_FwRsvdPagePkt( BufIndex += (CurtPktPageNum*PageSize); -#ifdef CONFIG_WOWLAN - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - /* if (pwrctl->wowlan_mode == true) { */ - /* BufIndex += (CurtPktPageNum*PageSize); */ - - /* 3(7) ARP RSP */ - rtw_get_current_ip_address(padapter, currentip); - RsvdPageLoc.LocArpRsp = TotalPageNum; - { - ConstructARPResponse( - padapter, - &ReservedPagePacket[BufIndex], - &ARPLegnth, - currentip - ); - rtl8723b_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], ARPLegnth, false, false, true); - - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: ARP RSP %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], (ARPLegnth+TxDescLen)); */ - - CurtPktPageNum = (u8)PageNum_128(TxDescLen + ARPLegnth); - } - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* 3(8) SEC IV */ - rtw_get_sec_iv(padapter, cur_dot11txpn, get_my_bssid(&pmlmeinfo->network)); - RsvdPageLoc.LocRemoteCtrlInfo = TotalPageNum; - memcpy(ReservedPagePacket+BufIndex-TxDescLen, cur_dot11txpn, _AES_IV_LEN_); - - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: SEC IV %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], _AES_IV_LEN_); */ - - CurtPktPageNum = (u8)PageNum_128(_AES_IV_LEN_); - - TotalPageNum += CurtPktPageNum; - -#ifdef CONFIG_GTK_OL - BufIndex += (CurtPktPageNum*PageSize); - - /* if the ap station info. exists, get the kek, kck from station info. */ - psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); - if (!psta) { - memset(kek, 0, RTW_KEK_LEN); - memset(kck, 0, RTW_KCK_LEN); - DBG_8192C("%s, KEK, KCK download rsvd page all zero\n", __func__); - } else { - memcpy(kek, psta->kek, RTW_KEK_LEN); - memcpy(kck, psta->kck, RTW_KCK_LEN); - } - - /* 3(9) KEK, KCK */ - RsvdPageLoc.LocGTKInfo = TotalPageNum; - memcpy(ReservedPagePacket+BufIndex-TxDescLen, kck, RTW_KCK_LEN); - memcpy(ReservedPagePacket+BufIndex-TxDescLen+RTW_KCK_LEN, kek, RTW_KEK_LEN); - - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: KEK KCK %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], (TxDescLen + RTW_KCK_LEN + RTW_KEK_LEN)); */ - - CurtPktPageNum = (u8)PageNum_128(TxDescLen + RTW_KCK_LEN + RTW_KEK_LEN); - - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* 3(10) GTK Response */ - RsvdPageLoc.LocGTKRsp = TotalPageNum; - ConstructGTKResponse( - padapter, - &ReservedPagePacket[BufIndex], - >KLegnth - ); - - rtl8723b_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], GTKLegnth, false, false, true); - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: GTK RSP %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], (TxDescLen + GTKLegnth)); */ - - CurtPktPageNum = (u8)PageNum_128(TxDescLen + GTKLegnth); - - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* below page is empty for GTK extension memory */ - /* 3(11) GTK EXT MEM */ - RsvdPageLoc.LocGTKEXTMEM = TotalPageNum; - - CurtPktPageNum = 2; - - TotalPageNum += CurtPktPageNum; - - TotalPacketLen = BufIndex-TxDescLen + 256; /* extension memory for FW */ -#else - TotalPacketLen = BufIndex - TxDescLen + sizeof(union pn48); /* IV len */ -#endif /* CONFIG_GTK_OL */ - } else -#endif /* CONFIG_WOWLAN */ - { - TotalPacketLen = BufIndex + BTQosNullLength; - } + TotalPacketLen = BufIndex + BTQosNullLength; if (TotalPacketLen > MaxRsvdPageBufSize) { DBG_871X("%s(): ERROR: The rsvd page size is not enough!!TotalPacketLen %d, MaxRsvdPageBufSize %d\n", __func__, diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 84e963909283..9f5e81375289 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -369,9 +369,6 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool bUsedWoWLANFw) u8 tmp_ps; RT_TRACE(_module_hal_init_c_, _drv_info_, ("+%s\n", __func__)); -#ifdef CONFIG_WOWLAN - RT_TRACE(_module_hal_init_c_, _drv_notice_, ("+%s, bUsedWoWLANFw:%d\n", __func__, bUsedWoWLANFw)); -#endif pFirmware = kzalloc(sizeof(struct rt_firmware), GFP_KERNEL); if (!pFirmware) return _FAIL; @@ -393,12 +390,7 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool bUsedWoWLANFw) pdbgpriv->dbg_downloadfw_pwr_state_cnt++; } -#ifdef CONFIG_WOWLAN - if (bUsedWoWLANFw) - fwfilepath = "rtlwifi/rtl8723bs_wowlan.bin"; - else -#endif /* CONFIG_WOWLAN */ - fwfilepath = "rtlwifi/rtl8723bs_nic.bin"; + fwfilepath = "rtlwifi/rtl8723bs_nic.bin"; pr_info("rtl8723bs: acquire FW from file:%s\n", fwfilepath); @@ -535,7 +527,7 @@ void rtl8723b_InitializeFirmwareVars(struct adapter *padapter) /* pHalData->H2CStopInsertQueue = false; */ } -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN /* */ /* */ @@ -566,7 +558,7 @@ void SetFwRelatedForWoWLAN8723b( /* */ rtl8723b_InitializeFirmwareVars(padapter); } -#endif /* CONFIG_WOWLAN */ +#endif /* CONFIG_AP_WOWLAN */ static void rtl8723b_free_hal_data(struct adapter *padapter) { @@ -3752,14 +3744,6 @@ void C2HPacketHandler_8723B(struct adapter *padapter, u8 *pbuffer, u16 length) { C2H_EVT_HDR C2hEvent; u8 *tmpBuf = NULL; -#ifdef CONFIG_WOWLAN - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - - if (pwrpriv->wowlan_mode) { - DBG_871X("%s(): return because wowolan_mode ==true! CMDID =%d\n", __func__, pbuffer[0]); - return; - } -#endif C2hEvent.CmdID = pbuffer[0]; C2hEvent.CmdSeq = pbuffer[1]; C2hEvent.CmdLen = length-2; @@ -4314,19 +4298,6 @@ void GetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val) val16 = rtw_read16(padapter, REG_TXPKT_EMPTY); *val = (val16 & BIT(10)) ? true:false; break; -#ifdef CONFIG_WOWLAN - case HW_VAR_RPWM_TOG: - *val = rtw_read8(padapter, SDIO_LOCAL_BASE|SDIO_REG_HRPWM1) & BIT7; - break; - case HW_VAR_WAKEUP_REASON: - *val = rtw_read8(padapter, REG_WOWLAN_WAKE_REASON); - if (*val == 0xEA) - *val = 0; - break; - case HW_VAR_SYS_CLKR: - *val = rtw_read8(padapter, REG_SYS_CLKR); - break; -#endif default: GetHwReg(padapter, variable, val); break; @@ -4461,14 +4432,6 @@ u8 GetHalDefVar8723B(struct adapter *padapter, enum HAL_DEF_VARIABLE variable, v return bResult; } -#ifdef CONFIG_WOWLAN -void Hal_DetectWoWMode(struct adapter *padapter) -{ - adapter_to_pwrctl(padapter)->bSupportRemoteWakeup = true; - DBG_871X("%s\n", __func__); -} -#endif /* CONFIG_WOWLAN */ - void rtl8723b_start_thread(struct adapter *padapter) { #ifndef CONFIG_SDIO_TX_TASKLET diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index ced05bbfc906..47cd3ae63687 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -689,30 +689,6 @@ static u32 rtl8723bs_hal_init(struct adapter *padapter) return _SUCCESS; } -#ifdef CONFIG_WOWLAN - if (rtw_read8(padapter, REG_MCUFWDL) & BIT7) { - u8 reg_val = 0; - DBG_871X("+Reset Entry+\n"); - rtw_write8(padapter, REG_MCUFWDL, 0x00); - _8051Reset8723(padapter); - /* reset BB */ - reg_val = rtw_read8(padapter, REG_SYS_FUNC_EN); - reg_val &= ~(BIT(0) | BIT(1)); - rtw_write8(padapter, REG_SYS_FUNC_EN, reg_val); - /* reset RF */ - rtw_write8(padapter, REG_RF_CTRL, 0); - /* reset TRX path */ - rtw_write16(padapter, REG_CR, 0); - /* reset MAC, Digital Core */ - reg_val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); - reg_val &= ~(BIT(4) | BIT(7)); - rtw_write8(padapter, REG_SYS_FUNC_EN + 1, reg_val); - reg_val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); - reg_val |= BIT(4) | BIT(7); - rtw_write8(padapter, REG_SYS_FUNC_EN + 1, reg_val); - DBG_871X("-Reset Entry-\n"); - } -#endif /* CONFIG_WOWLAN */ /* Disable Interrupt first. */ /* rtw_hal_disable_interrupt(padapter); */ @@ -1228,10 +1204,6 @@ static void _ReadEfuseInfo8723BS(struct adapter *padapter) Hal_EfuseParseVoltage_8723B(padapter, hwinfo, pEEPROM->bautoload_fail_flag); -#ifdef CONFIG_WOWLAN - Hal_DetectWoWMode(padapter); -#endif - Hal_ReadRFGainOffset(padapter, hwinfo, pEEPROM->bautoload_fail_flag); RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("<==== _ReadEfuseInfo8723BS()\n")); @@ -1322,7 +1294,7 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) { u8 val8; -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN struct wowlan_ioctl_param *poidparam; struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); int res; @@ -1330,13 +1302,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) u16 len = 0; u8 trycnt = 100; u32 himr = 0; -#if defined(CONFIG_WOWLAN) - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_info *psta = NULL; - u64 iv_low = 0, iv_high = 0; - u8 mstatus = (*(u8 *)val); -#endif #endif switch (variable) { @@ -1363,206 +1328,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) val8 = *val; break; -#ifdef CONFIG_WOWLAN - case HW_VAR_WOWLAN: - { - poidparam = (struct wowlan_ioctl_param *)val; - switch (poidparam->subcode) { - case WOWLAN_ENABLE: - DBG_871X_LEVEL(_drv_always_, "WOWLAN_ENABLE\n"); - - /* backup data rate to register 0x8b for wowlan FW */ - rtw_write8(padapter, 0x8d, 1); - rtw_write8(padapter, 0x8c, 0); - rtw_write8(padapter, 0x8f, 0x40); - rtw_write8(padapter, 0x8b, - rtw_read8(padapter, 0x2f0)); - - /* 1. Download WOWLAN FW */ - DBG_871X_LEVEL(_drv_always_, "Re-download WoWlan FW!\n"); - SetFwRelatedForWoWLAN8723b(padapter, true); - - /* 2. RX DMA stop */ - DBG_871X_LEVEL(_drv_always_, "Pause DMA\n"); - rtw_write32(padapter, REG_RXPKT_NUM, (rtw_read32(padapter, REG_RXPKT_NUM) | RW_RELEASE_EN)); - do { - if ((rtw_read32(padapter, REG_RXPKT_NUM) & RXDMA_IDLE)) { - DBG_871X_LEVEL(_drv_always_, "RX_DMA_IDLE is true\n"); - break; - } else { - /* If RX_DMA is not idle, receive one pkt from DMA */ - res = sdio_local_read(padapter, SDIO_REG_RX0_REQ_LEN, 4, (u8 *)&tmp); - len = le16_to_cpu(tmp); - DBG_871X_LEVEL(_drv_always_, "RX len:%d\n", len); - if (len > 0) - res = RecvOnePkt(padapter, len); - else - DBG_871X_LEVEL(_drv_always_, "read length fail %d\n", len); - - DBG_871X_LEVEL(_drv_always_, "RecvOnePkt Result: %d\n", res); - } - } while (trycnt--); - if (trycnt == 0) - DBG_871X_LEVEL(_drv_always_, "Stop RX DMA failed......\n"); - - /* 3. Clear IMR and ISR */ - DBG_871X_LEVEL(_drv_always_, "Clear IMR and ISR\n"); - tmp = 0; - sdio_local_write(padapter, SDIO_REG_HIMR_ON, 4, (u8 *)&tmp); - sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - sdio_local_read(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); - sdio_local_write(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); - - /* 4. Enable CPWM2 only */ - DBG_871X_LEVEL(_drv_always_, "Enable only CPWM2\n"); - sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - DBG_871X("DisableInterruptButCpwm28723BSdio(): Read SDIO_REG_HIMR: 0x%08x\n", tmp); - - himr = cpu_to_le32(SDIO_HIMR_DISABLED) | SDIO_HIMR_CPWM2_MSK; - sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&himr); - - sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - DBG_871X("DisableInterruptButCpwm28723BSdio(): Read again SDIO_REG_HIMR: 0x%08x\n", tmp); - - /* 5. Set Enable WOWLAN H2C command. */ - DBG_871X_LEVEL(_drv_always_, "Set Enable WOWLan cmd\n"); - rtl8723b_set_wowlan_cmd(padapter, 1); - - /* 6. Check EnableWoWlan CMD is ready */ - if (!pwrctl->wowlan_pno_enable) { - DBG_871X_LEVEL(_drv_always_, "Check EnableWoWlan CMD is ready\n"); - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - trycnt = 10; - while (!(mstatus & BIT1) && trycnt > 1) { - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - DBG_871X("Loop index: %d :0x%02x\n", trycnt, mstatus); - trycnt--; - msleep(2); - } - } - break; - - case WOWLAN_DISABLE: - DBG_871X_LEVEL(_drv_always_, "WOWLAN_DISABLE\n"); - - psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv)); - if (psta) - rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_DISCONNECT, psta->mac_id); - else - DBG_871X("psta is null\n"); - - /* 1. Read wakeup reason */ - pwrctl->wowlan_wake_reason = rtw_read8(padapter, REG_WOWLAN_WAKE_REASON); - DBG_871X_LEVEL( - _drv_always_, - "wakeup_reason: 0x%02x, mac_630 = 0x%08x, mac_634 = 0x%08x, mac_1c0 = 0x%08x, mac_1c4 = 0x%08x" - ", mac_494 = 0x%08x, , mac_498 = 0x%08x, mac_49c = 0x%08x, mac_608 = 0x%08x, mac_4a0 = 0x%08x, mac_4a4 = 0x%08x\n" - ", mac_1cc = 0x%08x, mac_2f0 = 0x%08x, mac_2f4 = 0x%08x, mac_2f8 = 0x%08x, mac_2fc = 0x%08x, mac_8c = 0x%08x", - pwrctl->wowlan_wake_reason, - rtw_read32(padapter, REG_WOWLAN_GTK_DBG1), - rtw_read32(padapter, REG_WOWLAN_GTK_DBG2), - rtw_read32(padapter, 0x1c0), - rtw_read32(padapter, 0x1c4), - rtw_read32(padapter, 0x494), - rtw_read32(padapter, 0x498), - rtw_read32(padapter, 0x49c), - rtw_read32(padapter, 0x608), - rtw_read32(padapter, 0x4a0), - rtw_read32(padapter, 0x4a4), - rtw_read32(padapter, 0x1cc), - rtw_read32(padapter, 0x2f0), - rtw_read32(padapter, 0x2f4), - rtw_read32(padapter, 0x2f8), - rtw_read32(padapter, 0x2fc), - rtw_read32(padapter, 0x8c) - ); - - { - /* 2. Set Disable WOWLAN H2C command. */ - DBG_871X_LEVEL(_drv_always_, "Set Disable WOWLan cmd\n"); - rtl8723b_set_wowlan_cmd(padapter, 0); - - /* 3. Check Disable WoWlan CMD ready. */ - DBG_871X_LEVEL(_drv_always_, "Check DisableWoWlan CMD is ready\n"); - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - trycnt = 50; - while (mstatus & BIT1 && trycnt > 1) { - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - DBG_871X_LEVEL(_drv_always_, "Loop index: %d :0x%02x\n", trycnt, mstatus); - trycnt--; - msleep(10); - } - - if (mstatus & BIT1) { - DBG_871X_LEVEL(_drv_always_, "Disable WOW mode fail!!\n"); - DBG_871X("Set 0x690 = 0x00\n"); - rtw_write8(padapter, REG_WOW_CTRL, (rtw_read8(padapter, REG_WOW_CTRL) & 0xf0)); - DBG_871X_LEVEL(_drv_always_, "Release RXDMA\n"); - rtw_write32(padapter, REG_RXPKT_NUM, (rtw_read32(padapter, REG_RXPKT_NUM) & (~RW_RELEASE_EN))); - } - - /* 3.1 read fw iv */ - iv_low = rtw_read32(padapter, REG_TXPKTBUF_IV_LOW); - /* only low two bytes is PN, check AES_IV macro for detail */ - iv_low &= 0xffff; - iv_high = rtw_read32(padapter, REG_TXPKTBUF_IV_HIGH); - /* get the real packet number */ - pwrctl->wowlan_fw_iv = iv_high << 16 | iv_low; - DBG_871X_LEVEL(_drv_always_, "fw_iv: 0x%016llx\n", pwrctl->wowlan_fw_iv); - /* Update TX iv data. */ - rtw_set_sec_pn(padapter); - - /* 3.2 read GTK index and key */ - if ( - psecuritypriv->binstallKCK_KEK == true && - psecuritypriv->dot11PrivacyAlgrthm == _AES_ - ) { - u8 gtk_keyindex = 0; - u8 get_key[16]; - /* read gtk key index */ - gtk_keyindex = rtw_read8(padapter, 0x48c); - - if (gtk_keyindex < 4) { - psecuritypriv->dot118021XGrpKeyid = gtk_keyindex; - read_cam(padapter, gtk_keyindex, get_key); - memcpy(psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, get_key, 16); - DBG_871X_LEVEL( - _drv_always_, - "GTK (%d) = 0x%08x, 0x%08x, 0x%08x, 0x%08x\n", - gtk_keyindex, - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[0], - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[1], - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[2], - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[3] - ); - } else - DBG_871X_LEVEL(_drv_always_, "GTK index =%d\n", gtk_keyindex); - } - - /* 4. Re-download Normal FW. */ - DBG_871X_LEVEL(_drv_always_, "Re-download Normal FW!\n"); - SetFwRelatedForWoWLAN8723b(padapter, false); - } - - /* 5. Download reserved pages and report media status if needed. */ - if ( - (pwrctl->wowlan_wake_reason != FWDecisionDisconnect) && - (pwrctl->wowlan_wake_reason != Rx_Pairwisekey) && - (pwrctl->wowlan_wake_reason != Rx_DisAssoc) && - (pwrctl->wowlan_wake_reason != Rx_DeAuth) - ) { - rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); - if (psta) - rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); - } - break; - - default: - break; - } - } - break; -#endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN case HW_VAR_AP_WOWLAN: { @@ -1765,9 +1530,6 @@ void rtl8723bs_set_hal_ops(struct adapter *padapter) pHalFunc->enable_interrupt = &EnableInterrupt8723BSdio; pHalFunc->disable_interrupt = &DisableInterrupt8723BSdio; pHalFunc->check_ips_status = &CheckIPSStatus; -#ifdef CONFIG_WOWLAN - pHalFunc->clear_interrupt = &ClearInterrupt8723BSdio; -#endif pHalFunc->SetHwRegHandler = &SetHwReg8723BS; pHalFunc->GetHwRegHandler = &GetHwReg8723BS; pHalFunc->SetHwRegHandlerWithBuf = &SetHwRegWithBuf8723B; diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c index 369f55d11519..2400b06dff36 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_ops.c +++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c @@ -1114,7 +1114,7 @@ void HalQueryTxOQTBufferStatus8723BSdio(struct adapter *adapter) haldata->SdioTxOQTFreeSpace = SdioLocalCmd52Read1Byte(adapter, SDIO_REG_OQT_FREE_PG); } -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN u8 RecvOnePkt(struct adapter *adapter, u32 size) { struct recv_buf *recvbuf; @@ -1149,4 +1149,4 @@ u8 RecvOnePkt(struct adapter *adapter, u32 size) DBG_871X("-%s-\n", __func__); return res; } -#endif /* CONFIG_WOWLAN */ +#endif /* CONFIG_AP_WOWLAN */ diff --git a/drivers/staging/rtl8723bs/include/autoconf.h b/drivers/staging/rtl8723bs/include/autoconf.h index 86cf09ca5f06..996198750814 100644 --- a/drivers/staging/rtl8723bs/include/autoconf.h +++ b/drivers/staging/rtl8723bs/include/autoconf.h @@ -40,9 +40,6 @@ * Platform dependent */ #define WAKEUP_GPIO_IDX 12 /* WIFI Chip Side */ -#ifdef CONFIG_WOWLAN -#define CONFIG_GTK_OL -#endif /* CONFIG_WOWLAN */ /* * Debug Related Config diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h index cfde6e3ba400..998c8dc230eb 100644 --- a/drivers/staging/rtl8723bs/include/drv_types.h +++ b/drivers/staging/rtl8723bs/include/drv_types.h @@ -534,11 +534,6 @@ int rtw_set_gpio_output_value(struct net_device *netdev, int gpio_num, bool isHi int rtw_config_gpio(struct net_device *netdev, int gpio_num, bool isOutput); #endif -#ifdef CONFIG_WOWLAN -void rtw_suspend_wow(struct adapter *padapter); -int rtw_resume_process_wow(struct adapter *padapter); -#endif - static inline u8 *myid(struct eeprom_priv *peepriv) { return peepriv->mac_addr; diff --git a/drivers/staging/rtl8723bs/include/drv_types_sdio.h b/drivers/staging/rtl8723bs/include/drv_types_sdio.h index 5e079838f59c..83f5e912baa7 100644 --- a/drivers/staging/rtl8723bs/include/drv_types_sdio.h +++ b/drivers/staging/rtl8723bs/include/drv_types_sdio.h @@ -11,7 +11,7 @@ #include #include -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN #include #include #endif diff --git a/drivers/staging/rtl8723bs/include/hal_com_h2c.h b/drivers/staging/rtl8723bs/include/hal_com_h2c.h index 1f7ed90f9faa..6b8ec01ddc6a 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_h2c.h +++ b/drivers/staging/rtl8723bs/include/hal_com_h2c.h @@ -95,60 +95,6 @@ enum h2c_cmd { #define H2C_BCN_RSVDPAGE_LEN 5 #define H2C_PROBERSP_RSVDPAGE_LEN 5 -#ifdef CONFIG_WOWLAN -#define eqMacAddr(a, b) (((a)[0] == (b)[0] && (a)[1] == (b)[1] && (a)[2] == (b)[2] && (a)[3] == (b)[3] && (a)[4] == (b)[4] && (a)[5] == (b)[5]) ? 1 : 0) -#define cpMacAddr(des, src) ((des)[0] = (src)[0], (des)[1] = (src)[1], (des)[2] = (src)[2], (des)[3] = (src)[3], (des)[4] = (src)[4], (des)[5] = (src)[5]) -#define cpIpAddr(des, src) ((des)[0] = (src)[0], (des)[1] = (src)[1], (des)[2] = (src)[2], (des)[3] = (src)[3]) - -/* */ -/* ARP packet */ -/* */ -/* LLC Header */ -#define GET_ARP_PKT_LLC_TYPE(__pHeader) ReadEF2Byte(((u8 *)(__pHeader)) + 6) - -/* ARP element */ -#define GET_ARP_PKT_OPERATION(__pHeader) ReadEF2Byte(((u8 *)(__pHeader)) + 6) -#define GET_ARP_PKT_SENDER_MAC_ADDR(__pHeader, _val) cpMacAddr((u8 *)(_val), ((u8 *)(__pHeader))+8) -#define GET_ARP_PKT_SENDER_IP_ADDR(__pHeader, _val) cpIpAddr((u8 *)(_val), ((u8 *)(__pHeader))+14) -#define GET_ARP_PKT_TARGET_MAC_ADDR(__pHeader, _val) cpMacAddr((u8 *)(_val), ((u8 *)(__pHeader))+18) -#define GET_ARP_PKT_TARGET_IP_ADDR(__pHeader, _val) cpIpAddr((u8 *)(_val), ((u8 *)(__pHeader))+24) - -#define SET_ARP_PKT_HW(__pHeader, __Value) WRITEEF2BYTE(((u8 *)(__pHeader)) + 0, __Value) -#define SET_ARP_PKT_PROTOCOL(__pHeader, __Value) WRITEEF2BYTE(((u8 *)(__pHeader)) + 2, __Value) -#define SET_ARP_PKT_HW_ADDR_LEN(__pHeader, __Value) WRITEEF1BYTE(((u8 *)(__pHeader)) + 4, __Value) -#define SET_ARP_PKT_PROTOCOL_ADDR_LEN(__pHeader, __Value) WRITEEF1BYTE(((u8 *)(__pHeader)) + 5, __Value) -#define SET_ARP_PKT_OPERATION(__pHeader, __Value) WRITEEF2BYTE(((u8 *)(__pHeader)) + 6, __Value) -#define SET_ARP_PKT_SENDER_MAC_ADDR(__pHeader, _val) cpMacAddr(((u8 *)(__pHeader))+8, (u8 *)(_val)) -#define SET_ARP_PKT_SENDER_IP_ADDR(__pHeader, _val) cpIpAddr(((u8 *)(__pHeader))+14, (u8 *)(_val)) -#define SET_ARP_PKT_TARGET_MAC_ADDR(__pHeader, _val) cpMacAddr(((u8 *)(__pHeader))+18, (u8 *)(_val)) -#define SET_ARP_PKT_TARGET_IP_ADDR(__pHeader, _val) cpIpAddr(((u8 *)(__pHeader))+24, (u8 *)(_val)) - -#define FW_WOWLAN_FUN_EN BIT(0) -#define FW_WOWLAN_PATTERN_MATCH BIT(1) -#define FW_WOWLAN_MAGIC_PKT BIT(2) -#define FW_WOWLAN_UNICAST BIT(3) -#define FW_WOWLAN_ALL_PKT_DROP BIT(4) -#define FW_WOWLAN_GPIO_ACTIVE BIT(5) -#define FW_WOWLAN_REKEY_WAKEUP BIT(6) -#define FW_WOWLAN_DEAUTH_WAKEUP BIT(7) - -#define FW_WOWLAN_GPIO_WAKEUP_EN BIT(0) -#define FW_FW_PARSE_MAGIC_PKT BIT(1) - -#define FW_REMOTE_WAKE_CTRL_EN BIT(0) -#define FW_REALWOWLAN_EN BIT(5) - -#define FW_WOWLAN_KEEP_ALIVE_EN BIT(0) -#define FW_ADOPT_USER BIT(1) -#define FW_WOWLAN_KEEP_ALIVE_PKT_TYPE BIT(2) - -#define FW_REMOTE_WAKE_CTRL_EN BIT(0) -#define FW_ARP_EN BIT(1) -#define FW_REALWOWLAN_EN BIT(5) -#define FW_WOW_FW_UNICAST_EN BIT(7) - -#endif /* CONFIG_WOWLAN */ - /* _RSVDPAGE_LOC_CMD_0x00 */ #define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd, 0, 8, __Value) #define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+1, 0, 8, __Value) @@ -230,9 +176,6 @@ enum h2c_cmd { #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_NEIGHBOR_ADV(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+2, 0, 8, __Value) #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_RSP(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+3, 0, 8, __Value) #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+4, 0, 8, __Value) -#ifdef CONFIG_GTK_OL -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+5, 0, 8, __Value) -#endif /* CONFIG_GTK_OL */ /* */ /* Structure -------------------------------------------------- */ @@ -243,25 +186,13 @@ typedef struct _RSVDPAGE_LOC { u8 LocNullData; u8 LocQosNull; u8 LocBTQosNull; -#ifdef CONFIG_WOWLAN - u8 LocRemoteCtrlInfo; - u8 LocArpRsp; - u8 LocNbrAdv; - u8 LocGTKRsp; - u8 LocGTKInfo; - u8 LocProbeReq; - u8 LocNetList; -#ifdef CONFIG_GTK_OL - u8 LocGTKEXTMEM; -#endif /* CONFIG_GTK_OL */ -#endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN u8 LocApOffloadBCN; #endif /* CONFIG_AP_WOWLAN */ } RSVDPAGE_LOC, *PRSVDPAGE_LOC; #endif -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip); void rtw_get_sec_iv(struct adapter *padapter, u8*pcur_dot11txpn, u8 *StaAddr); void rtw_set_sec_pn(struct adapter *padapter); diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h index 426c8d58c444..093e00b9349b 100644 --- a/drivers/staging/rtl8723bs/include/hal_intf.h +++ b/drivers/staging/rtl8723bs/include/hal_intf.h @@ -85,11 +85,6 @@ enum HW_VARIABLES { HW_VAR_APFM_ON_MAC, /* Auto FSM to Turn On, include clock, isolation, power control for MAC only */ /* The valid upper nav range for the HW updating, if the true value is larger than the upper range, the HW won't update it. */ /* Unit in microsecond. 0 means disable this function. */ -#ifdef CONFIG_WOWLAN - HW_VAR_WOWLAN, - HW_VAR_WAKEUP_REASON, - HW_VAR_RPWM_TOG, -#endif #ifdef CONFIG_AP_WOWLAN HW_VAR_AP_WOWLAN, #endif diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h b/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h index 3bfb0e9be582..b85e67ccc7db 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h @@ -177,11 +177,11 @@ void rtl8723b_download_BTCoex_AP_mode_rsvd_page(struct adapter *padapter); void CheckFwRsvdPageContent(struct adapter *padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN void rtl8723b_set_wowlan_cmd(struct adapter *padapter, u8 enable); void rtl8723b_set_ap_wowlan_cmd(struct adapter *padapter, u8 enable); void SetFwRelatedForWoWLAN8723b(struct adapter *padapter, u8 bHostIsGoingtoSleep); -#endif/* CONFIG_WOWLAN */ +#endif void rtl8723b_set_FwPwrModeInIPS_cmd(struct adapter *padapter, u8 cmd_param); diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index 2537bd7d6a13..819594616e38 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -96,11 +96,7 @@ struct rt_firmware_hdr { /* For WoWLan, more reserved page */ /* ARP Rsp:1, RWC:1, GTK Info:1, GTK RSP:2, GTK EXT MEM:2, PNO: 6 */ -#ifdef CONFIG_WOWLAN -#define WOWLAN_PAGE_NUM_8723B 0x07 -#else #define WOWLAN_PAGE_NUM_8723B 0x00 -#endif #ifdef CONFIG_AP_WOWLAN #define AP_WOWLAN_PAGE_NUM_8723B 0x02 @@ -244,9 +240,6 @@ u8 GetHalDefVar8723B(struct adapter *padapter, enum HAL_DEF_VARIABLE variable, void rtl8723b_InitBeaconParameters(struct adapter *padapter); void _InitBurstPktLen_8723BS(struct adapter *adapter); void _8051Reset8723(struct adapter *padapter); -#ifdef CONFIG_WOWLAN -void Hal_DetectWoWMode(struct adapter *padapter); -#endif /* CONFIG_WOWLAN */ void rtl8723b_start_thread(struct adapter *padapter); void rtl8723b_stop_thread(struct adapter *padapter); diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h index 9149fe598545..999555476ebc 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h @@ -96,10 +96,6 @@ #define REG_TXPKTBUF_BCNQ_BDNY_8723B 0x0424 #define REG_TXPKTBUF_MGQ_BDNY_8723B 0x0425 #define REG_TXPKTBUF_WMAC_LBK_BF_HD_8723B 0x045D -#ifdef CONFIG_WOWLAN -#define REG_TXPKTBUF_IV_LOW 0x0484 -#define REG_TXPKTBUF_IV_HIGH 0x0488 -#endif #define REG_AMPDU_BURST_MODE_8723B 0x04BC /* */ @@ -164,12 +160,6 @@ #define BIT_USB_RXDMA_AGG_EN BIT(31) #define RXDMA_AGG_MODE_EN BIT(1) -#ifdef CONFIG_WOWLAN -#define RXPKT_RELEASE_POLL BIT(16) -#define RXDMA_IDLE BIT(17) -#define RW_RELEASE_EN BIT(18) -#endif - /* */ /* */ /* 0x0400h ~ 0x047Fh Protocol Configuration */ diff --git a/drivers/staging/rtl8723bs/include/rtw_mp.h b/drivers/staging/rtl8723bs/include/rtw_mp.h index 2ea7100c3a4c..2de0b50bbfc5 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mp.h +++ b/drivers/staging/rtl8723bs/include/rtw_mp.h @@ -189,9 +189,6 @@ enum { CTA_TEST, MP_DISABLE_BT_COEXIST, MP_PwrCtlDM, -#ifdef CONFIG_WOWLAN - MP_WOW_ENABLE, -#endif #ifdef CONFIG_AP_WOWLAN MP_AP_WOW_ENABLE, #endif diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h index f467e9032450..334642b8cff9 100644 --- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h @@ -220,15 +220,6 @@ struct pwrctrl_priv { u8 wowlan_wake_reason; u8 wowlan_ap_mode; u8 wowlan_mode; -#ifdef CONFIG_WOWLAN - u8 wowlan_pattern; - u8 wowlan_magic; - u8 wowlan_unicast; - u8 wowlan_pattern_idx; - u8 wowlan_pno_enable; - u32 wowlan_pattern_context[8][5]; - u64 wowlan_fw_iv; -#endif /* CONFIG_WOWLAN */ _timer pwr_state_check_timer; struct adapter *adapter; int pwr_state_check_interval; diff --git a/drivers/staging/rtl8723bs/include/rtw_security.h b/drivers/staging/rtl8723bs/include/rtw_security.h index 85ffd4ec4ce5..ec033767fc45 100644 --- a/drivers/staging/rtl8723bs/include/rtw_security.h +++ b/drivers/staging/rtl8723bs/include/rtw_security.h @@ -129,9 +129,6 @@ struct security_priv { u8 binstallGrpkey; -#ifdef CONFIG_GTK_OL - u8 binstallKCK_KEK; -#endif /* CONFIG_GTK_OL */ u8 binstallBIPkey; u8 busetkipkey; /* _timer tkip_timer; */ diff --git a/drivers/staging/rtl8723bs/include/sdio_ops.h b/drivers/staging/rtl8723bs/include/sdio_ops.h index 6b0446be6d19..1f1f368cded4 100644 --- a/drivers/staging/rtl8723bs/include/sdio_ops.h +++ b/drivers/staging/rtl8723bs/include/sdio_ops.h @@ -25,17 +25,17 @@ s32 _sdio_write32(struct adapter *padapter, u32 addr, u32 val); extern void sd_int_hdl(struct adapter *padapter); extern u8 CheckIPSStatus(struct adapter *padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN extern u8 RecvOnePkt(struct adapter *padapter, u32 size); -#endif /* CONFIG_WOWLAN */ +#endif extern void InitInterrupt8723BSdio(struct adapter *padapter); extern void InitSysInterrupt8723BSdio(struct adapter *padapter); extern void EnableInterrupt8723BSdio(struct adapter *padapter); extern void DisableInterrupt8723BSdio(struct adapter *padapter); extern u8 HalQueryTxBufferStatus8723BSdio(struct adapter *padapter); extern void HalQueryTxOQTBufferStatus8723BSdio(struct adapter *padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN extern void ClearInterrupt8723BSdio(struct adapter *padapter); -#endif /* CONFIG_WOWLAN */ +#endif #endif /* !__SDIO_OPS_H__ */ diff --git a/drivers/staging/rtl8723bs/include/sta_info.h b/drivers/staging/rtl8723bs/include/sta_info.h index 734f4e2ecd66..fff0bed1233b 100644 --- a/drivers/staging/rtl8723bs/include/sta_info.h +++ b/drivers/staging/rtl8723bs/include/sta_info.h @@ -92,11 +92,6 @@ struct sta_info { union Keytype dot11tkiprxmickey; union Keytype dot118021x_UncstKey; union pn48 dot11txpn; /* PN48 used for Unicast xmit */ -#ifdef CONFIG_GTK_OL - u8 kek[RTW_KEK_LEN]; - u8 kck[RTW_KCK_LEN]; - u8 replay_ctr[RTW_REPLAY_CTR_LEN]; -#endif /* CONFIG_GTK_OL */ union pn48 dot11wtxpn; /* PN48 used for Unicast mgmt xmit. */ union pn48 dot11rxpn; /* PN48 used for Unicast recv. */ diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index 78ba2423ed65..f4b99c6b82ad 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -4669,9 +4669,6 @@ static const struct iw_priv_args rtw_private_args[] = { IW_PRIV_TYPE_CHAR | 40, IW_PRIV_TYPE_CHAR | 0x7FF, "test" }, -#ifdef CONFIG_WOWLAN - { MP_WOW_ENABLE, IW_PRIV_TYPE_CHAR | 1024, 0, "wow_mode" }, /* set */ -#endif #ifdef CONFIG_AP_WOWLAN { MP_AP_WOW_ENABLE, IW_PRIV_TYPE_CHAR | 1024, 0, "ap_wow_mode" }, /* set */ #endif diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index 61488781d211..2c0df0db6419 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -596,9 +596,6 @@ static void rtw_init_default_value(struct adapter *padapter) /* security_priv */ /* rtw_get_encrypt_decrypt_from_registrypriv(padapter); */ psecuritypriv->binstallGrpkey = _FAIL; -#ifdef CONFIG_GTK_OL - psecuritypriv->binstallKCK_KEK = _FAIL; -#endif /* CONFIG_GTK_OL */ psecuritypriv->sw_encrypt = pregistrypriv->software_encrypt; psecuritypriv->sw_decrypt = pregistrypriv->software_decrypt; @@ -1174,16 +1171,10 @@ void rtw_dev_unload(struct adapter *padapter) if (!padapter->bSurpriseRemoved) { hal_btcoex_IpsNotify(padapter, pwrctl->ips_mode_req); -#ifdef CONFIG_WOWLAN - if (pwrctl->bSupportRemoteWakeup && pwrctl->wowlan_mode) { - DBG_871X_LEVEL(_drv_always_, "%s bSupportRemoteWakeup ==true do not run rtw_hal_deinit()\n", __func__); - } - else -#endif - { - /* amy modify 20120221 for power seq is different between driver open and ips */ - rtw_hal_deinit(padapter); - } + + /* amy modify 20120221 for power seq is different between driver open and ips */ + rtw_hal_deinit(padapter); + padapter->bSurpriseRemoved = true; } RT_TRACE(_module_hci_intfs_c_, _drv_notice_, @@ -1244,81 +1235,6 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) return _SUCCESS; } -#ifdef CONFIG_WOWLAN -void rtw_suspend_wow(struct adapter *padapter) -{ - u8 ch, bw, offset; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct net_device *pnetdev = padapter->pnetdev; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct wowlan_ioctl_param poidparam; - - DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); - - - DBG_871X("wowlan_mode: %d\n", pwrpriv->wowlan_mode); - DBG_871X("wowlan_pno_enable: %d\n", pwrpriv->wowlan_pno_enable); - - if (pwrpriv->wowlan_mode) { - if (pnetdev) - rtw_netif_stop_queue(pnetdev); - /* 1. stop thread */ - padapter->bDriverStopped = true; /* for stop thread */ - rtw_stop_drv_threads(padapter); - padapter->bDriverStopped = false; /* for 32k command */ - - /* 2. disable interrupt */ - if (padapter->intf_stop) - padapter->intf_stop(padapter); - - /* 2.1 clean interrupt */ - if (padapter->HalFunc.clear_interrupt) - padapter->HalFunc.clear_interrupt(padapter); - - /* 2.2 free irq */ - /* sdio_free_irq(adapter_to_dvobj(padapter)); */ - if (padapter->intf_free_irq) - padapter->intf_free_irq(adapter_to_dvobj(padapter)); - - poidparam.subcode = WOWLAN_ENABLE; - padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_WOWLAN, (u8 *)&poidparam); - if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) { - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)) { - DBG_871X("%s %s(%pM), length:%d assoc_ssid.length:%d\n", __func__, - pmlmepriv->cur_network.network.Ssid.Ssid, - MAC_ARG(pmlmepriv->cur_network.network.MacAddress), - pmlmepriv->cur_network.network.Ssid.SsidLength, - pmlmepriv->assoc_ssid.SsidLength); - - rtw_set_to_roam(padapter, 0); - } - } - - DBG_871X_LEVEL(_drv_always_, "%s: wowmode suspending\n", __func__); - - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) { - DBG_871X_LEVEL(_drv_always_, "%s: fw_under_survey\n", __func__); - rtw_indicate_scan_done(padapter, 1); - clr_fwstate(pmlmepriv, _FW_UNDER_SURVEY); - } - - if (rtw_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) { - DBG_871X(FUNC_ADPT_FMT " back to linked/linking union - ch:%u, bw:%u, offset:%u\n", - FUNC_ADPT_ARG(padapter), ch, bw, offset); - set_channel_bwmode(padapter, ch, offset, bw); - } - - if (pwrpriv->wowlan_pno_enable) - DBG_871X_LEVEL(_drv_always_, "%s: pno: %d\n", __func__, pwrpriv->wowlan_pno_enable); - else - rtw_set_ps_mode(padapter, PS_MODE_DTIM, 0, 0, "WOWLAN"); - } else { - DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode =%d\n", __func__, pwrpriv->wowlan_mode); - } - DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); -} -#endif /* ifdef CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN void rtw_suspend_ap_wow(struct adapter *padapter) { @@ -1440,20 +1356,7 @@ int rtw_suspend_common(struct adapter *padapter) rtw_ps_deny_cancel(padapter, PS_DENY_SUSPEND); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { - #ifdef CONFIG_WOWLAN - if (check_fwstate(pmlmepriv, _FW_LINKED)) - pwrpriv->wowlan_mode = true; - else if (pwrpriv->wowlan_pno_enable) - pwrpriv->wowlan_mode |= pwrpriv->wowlan_pno_enable; - - if (pwrpriv->wowlan_mode) - rtw_suspend_wow(padapter); - else - rtw_suspend_normal(padapter); - - #else /* CONFIG_WOWLAN */ rtw_suspend_normal(padapter); - #endif /* CONFIG_WOWLAN */ } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { #ifdef CONFIG_AP_WOWLAN rtw_suspend_ap_wow(padapter); @@ -1474,124 +1377,6 @@ int rtw_suspend_common(struct adapter *padapter) return ret; } -#ifdef CONFIG_WOWLAN -int rtw_resume_process_wow(struct adapter *padapter) -{ - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct net_device *pnetdev = padapter->pnetdev; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct dvobj_priv *psdpriv = padapter->dvobj; - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; - struct wowlan_ioctl_param poidparam; - struct sta_info *psta = NULL; - int ret = _SUCCESS; - - DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); - - if (padapter) { - pnetdev = padapter->pnetdev; - pwrpriv = adapter_to_pwrctl(padapter); - } else { - pdbgpriv->dbg_resume_error_cnt++; - ret = -1; - goto exit; - } - - if (padapter->bDriverStopped || padapter->bSurpriseRemoved) { - DBG_871X("%s pdapter %p bDriverStopped %d bSurpriseRemoved %d\n", - __func__, padapter, padapter->bDriverStopped, - padapter->bSurpriseRemoved); - goto exit; - } - - if (pwrpriv->wowlan_mode) { - rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN"); - - pwrpriv->bFwCurrentInPSMode = false; - - if (padapter->intf_stop) - padapter->intf_stop(padapter); - - if (padapter->HalFunc.clear_interrupt) - padapter->HalFunc.clear_interrupt(padapter); - - /* if (sdio_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS) { */ - if ((padapter->intf_alloc_irq) && (padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS)) { - ret = -1; - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("%s: sdio_alloc_irq Failed!!\n", __func__)); - goto exit; - } - - /* Disable WOW, set H2C command */ - poidparam.subcode = WOWLAN_DISABLE; - padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_WOWLAN, (u8 *)&poidparam); - - psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv)); - if (psta) - set_sta_rate(padapter, psta); - - padapter->bDriverStopped = false; - DBG_871X("%s: wowmode resuming, DriverStopped:%d\n", __func__, padapter->bDriverStopped); - rtw_start_drv_threads(padapter); - - if (padapter->intf_start) - padapter->intf_start(padapter); - - /* start netif queue */ - if (pnetdev) { - if (!rtw_netif_queue_stopped(pnetdev)) - rtw_netif_start_queue(pnetdev); - else - rtw_netif_wake_queue(pnetdev); - } - } else { - DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode =%d\n", __func__, pwrpriv->wowlan_mode); - } - - if (padapter->pid[1] != 0) { - DBG_871X("pid[1]:%d\n", padapter->pid[1]); - rtw_signal_process(padapter->pid[1], SIGUSR2); - } - - if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) { - if (pwrpriv->wowlan_wake_reason == FWDecisionDisconnect || - pwrpriv->wowlan_wake_reason == Rx_DisAssoc || - pwrpriv->wowlan_wake_reason == Rx_DeAuth) { - DBG_871X("%s: disconnect reason: %02x\n", __func__, - pwrpriv->wowlan_wake_reason); - rtw_indicate_disconnect(padapter); - - rtw_sta_media_status_rpt(padapter, - rtw_get_stainfo(&padapter->stapriv, - get_bssid(&padapter->mlmepriv)), 0); - - rtw_free_assoc_resources(padapter, 1); - pmlmeinfo->state = WIFI_FW_NULL_STATE; - - } else { - DBG_871X("%s: do roaming\n", __func__); - rtw_roaming(padapter, NULL); - } - } - - if (pwrpriv->wowlan_mode) { - pwrpriv->bips_processing = false; - _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); - } else { - DBG_871X_LEVEL(_drv_always_, "do not reset timer\n"); - } - - pwrpriv->wowlan_mode = false; - - /* clean driver side wake up reason. */ - pwrpriv->wowlan_wake_reason = 0; -exit: - DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); - return ret; -} -#endif /* ifdef CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN int rtw_resume_process_ap_wow(struct adapter *padapter) { @@ -1753,15 +1538,7 @@ int rtw_resume_common(struct adapter *padapter) DBG_871X("==> %s (%s:%d)\n", __func__, current->comm, current->pid); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { - #ifdef CONFIG_WOWLAN - if (pwrpriv->wowlan_mode) - rtw_resume_process_wow(padapter); - else - rtw_resume_process_normal(padapter); - #else rtw_resume_process_normal(padapter); - #endif - } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { #ifdef CONFIG_AP_WOWLAN rtw_resume_process_ap_wow(padapter); diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c index 079e75164f1e..8f8549eee23e 100644 --- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c +++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c @@ -377,11 +377,6 @@ static void rtw_sdio_if1_deinit(struct adapter *if1) rtw_cancel_all_timer(if1); -#ifdef CONFIG_WOWLAN - adapter_to_pwrctl(if1)->wowlan_mode = false; - DBG_871X_LEVEL(_drv_always_, "%s wowlan_mode:%d\n", __func__, adapter_to_pwrctl(if1)->wowlan_mode); -#endif /* CONFIG_WOWLAN */ - rtw_dev_unload(if1); DBG_871X("+r871xu_dev_remove, hw_init_completed =%d\n", if1->hw_init_completed); -- 2.20.1 From fabioaiuto83 at gmail.com Fri Mar 12 15:58:58 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Fri, 12 Mar 2021 16:58:58 +0100 Subject: [PATCH 3/3] staging: rtl8723bs: remove unused code blocks In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_TCP_CSUM_OFFLOAD_RX cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/include/rtw_recv.h | 5 ----- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 8 -------- 2 files changed, 13 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h index b4aeb44d5d6e..078854a55a31 100644 --- a/drivers/staging/rtl8723bs/include/rtw_recv.h +++ b/drivers/staging/rtl8723bs/include/rtw_recv.h @@ -159,11 +159,6 @@ struct rx_pkt_attrib { u8 ack_policy; -/* ifdef CONFIG_TCP_CSUM_OFFLOAD_RX */ - u8 tcpchk_valid; /* 0: invalid, 1: valid */ - u8 ip_chkrpt; /* 0: incorrect, 1: correct */ - u8 tcp_chkrpt; /* 0: incorrect, 1: correct */ -/* endif */ u8 key_index; u8 data_rate; diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c index f52802f24466..78d5b6913467 100644 --- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c @@ -138,15 +138,7 @@ void rtw_os_recv_indicate_pkt(struct adapter *padapter, _pkt *pkt, struct rx_pkt pkt->protocol = eth_type_trans(pkt, padapter->pnetdev); pkt->dev = padapter->pnetdev; -#ifdef CONFIG_TCP_CSUM_OFFLOAD_RX - if ((pattrib->tcpchk_valid == 1) && (pattrib->tcp_chkrpt == 1)) - pkt->ip_summed = CHECKSUM_UNNECESSARY; - else - pkt->ip_summed = CHECKSUM_NONE; - -#else /* !CONFIG_TCP_CSUM_OFFLOAD_RX */ pkt->ip_summed = CHECKSUM_NONE; -#endif /* CONFIG_TCP_CSUM_OFFLOAD_RX */ ret = rtw_netif_rx(padapter->pnetdev, pkt); } -- 2.20.1 From fabioaiuto83 at gmail.com Fri Mar 12 16:04:43 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Fri, 12 Mar 2021 17:04:43 +0100 Subject: [PATCH 0/3] staging: rtl8723bs: remove unused code blocks Message-ID: This patch set removes unused code blocks as required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Fabio Aiuto (3): staging: rtl8723bs: remove unused code blocks staging: rtl8723bs: remove unused code blocks staging: rtl8723bs: remove unused code blocks drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 - drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 24 +- .../staging/rtl8723bs/core/rtw_wlan_util.c | 61 +- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 824 +----------------- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 43 +- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 248 +----- drivers/staging/rtl8723bs/hal/sdio_ops.c | 4 +- drivers/staging/rtl8723bs/include/autoconf.h | 3 - drivers/staging/rtl8723bs/include/drv_types.h | 5 - .../rtl8723bs/include/drv_types_sdio.h | 2 +- .../staging/rtl8723bs/include/hal_com_h2c.h | 88 +- drivers/staging/rtl8723bs/include/hal_intf.h | 5 - .../staging/rtl8723bs/include/rtl8723b_cmd.h | 4 +- .../staging/rtl8723bs/include/rtl8723b_hal.h | 17 - .../staging/rtl8723bs/include/rtl8723b_spec.h | 10 - drivers/staging/rtl8723bs/include/rtw_mp.h | 3 - .../staging/rtl8723bs/include/rtw_pwrctrl.h | 62 -- drivers/staging/rtl8723bs/include/rtw_recv.h | 5 - .../staging/rtl8723bs/include/rtw_security.h | 3 - drivers/staging/rtl8723bs/include/sdio_ops.h | 8 +- drivers/staging/rtl8723bs/include/sta_info.h | 5 - .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 56 -- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 3 - drivers/staging/rtl8723bs/os_dep/os_intfs.c | 238 +---- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 8 - drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 5 - 26 files changed, 28 insertions(+), 1709 deletions(-) -- 2.20.1 From fabioaiuto83 at gmail.com Fri Mar 12 16:06:16 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Fri, 12 Mar 2021 17:06:16 +0100 Subject: [PATCH 1/3] staging: rtl8723bs: remove unused code blocks In-Reply-To: References: Message-ID: Remove conditional code blocks checked by unused CONFIG_PNO_SUPPORT Cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 18 -- .../staging/rtl8723bs/core/rtw_wlan_util.c | 8 - drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 269 ------------------ drivers/staging/rtl8723bs/hal/sdio_halinit.c | 8 - .../staging/rtl8723bs/include/hal_com_h2c.h | 17 -- .../staging/rtl8723bs/include/rtl8723b_hal.h | 10 - .../staging/rtl8723bs/include/rtw_pwrctrl.h | 53 ---- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 56 ---- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 7 - 9 files changed, 446 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index c9f4a18b24b9..8059aeea9d47 100644 --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c @@ -1149,29 +1149,11 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter) pwrctrlpriv->wowlan_mode = false; pwrctrlpriv->wowlan_ap_mode = false; - -#ifdef CONFIG_PNO_SUPPORT - pwrctrlpriv->pno_inited = false; - pwrctrlpriv->pnlo_info = NULL; - pwrctrlpriv->pscan_info = NULL; - pwrctrlpriv->pno_ssid_list = NULL; - pwrctrlpriv->pno_in_resume = true; -#endif } void rtw_free_pwrctrl_priv(struct adapter *adapter) { -#ifdef CONFIG_PNO_SUPPORT - if (pwrctrlpriv->pnlo_info) - printk("****** pnlo_info memory leak********\n"); - - if (pwrctrlpriv->pscan_info) - printk("****** pscan_info memory leak********\n"); - - if (pwrctrlpriv->pno_ssid_list) - printk("****** pno_ssid_list memory leak********\n"); -#endif } inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms) diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index 96feced698ac..ae577178534f 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -2189,11 +2189,3 @@ void rtw_set_sec_pn(struct adapter *padapter) } #endif /* CONFIG_WOWLAN */ -#ifdef CONFIG_PNO_SUPPORT -#define CSCAN_TLV_TYPE_SSID_IE 'S' -#define CIPHER_IE "key_mgmt =" -#define CIPHER_NONE "NONE" -#define CIPHER_WPA_PSK "WPA-PSK" -#define CIPHER_WPA_EAP "WPA-EAP IEEE8021X" - -#endif /* CONFIG_PNO_SUPPORT */ diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index 479623d6eb79..b6958d3db855 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -462,125 +462,6 @@ static void ConstructARPResponse( } } -#ifdef CONFIG_PNO_SUPPORT -static void ConstructPnoInfo( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - - struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); - - u8 *pPnoInfoPkt = pframe; - pPnoInfoPkt = (u8 *)(pframe + *pLength); - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_num, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->fast_scan_period, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->fast_scan_iterations, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->slow_scan_period, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_length, - MAX_PNO_LIST_COUNT); - - *pLength += MAX_PNO_LIST_COUNT; - pPnoInfoPkt += MAX_PNO_LIST_COUNT; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_cipher_info, - MAX_PNO_LIST_COUNT); - - *pLength += MAX_PNO_LIST_COUNT; - pPnoInfoPkt += MAX_PNO_LIST_COUNT; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_channel_info, - MAX_PNO_LIST_COUNT); - - *pLength += MAX_PNO_LIST_COUNT; - pPnoInfoPkt += MAX_PNO_LIST_COUNT; -} - -static void ConstructSSIDList( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - int i = 0; - u8 *pSSIDListPkt = pframe; - struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); - - pSSIDListPkt = (u8 *)(pframe + *pLength); - - for (i = 0; i < pwrctl->pnlo_info->ssid_num ; i++) { - memcpy(pSSIDListPkt, &pwrctl->pno_ssid_list->node[i].SSID, - pwrctl->pnlo_info->ssid_length[i]); - - *pLength += WLAN_SSID_MAXLEN; - pSSIDListPkt += WLAN_SSID_MAXLEN; - } -} - -static void ConstructScanInfo( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - int i = 0; - u8 *pScanInfoPkt = pframe; - struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); - - pScanInfoPkt = (u8 *)(pframe + *pLength); - - memcpy(pScanInfoPkt, &pwrctl->pscan_info->channel_num, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_ch, 1); - - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_bw, 1); - - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_40_offset, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_80_offset, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->periodScan, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->period_scan_time, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->enableRFE, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->rfe_type, 8); - - *pLength += 8; - pScanInfoPkt += 8; - - for (i = 0; i < MAX_SCAN_LIST_COUNT; i++) { - memcpy(pScanInfoPkt, &pwrctl->pscan_info->ssid_channel_info[i], 4); - *pLength += 4; - pScanInfoPkt += 4; - } -} -#endif - #ifdef CONFIG_GTK_OL static void ConstructGTKResponse( struct adapter *padapter, u8 *pframe, u32 *pLength @@ -666,48 +547,6 @@ static void ConstructGTKResponse( } #endif /* CONFIG_GTK_OL */ -#ifdef CONFIG_PNO_SUPPORT -static void ConstructProbeReq(struct adapter *padapter, u8 *pframe, u32 *pLength) -{ - struct ieee80211_hdr *pwlanhdr; - u16 *fctrl; - u32 pktlen; - unsigned char *mac; - unsigned char bssrate[NumRates]; - int bssrate_len = 0; - u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - pwlanhdr = (struct ieee80211_hdr *)pframe; - mac = myid(&(padapter->eeprompriv)); - - fctrl = &(pwlanhdr->frame_control); - *(fctrl) = 0; - - /* broadcast probe request frame */ - memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN); - memcpy(pwlanhdr->addr3, bc_addr, ETH_ALEN); - - memcpy(pwlanhdr->addr2, mac, ETH_ALEN); - - SetSeqNum(pwlanhdr, 0); - SetFrameSubType(pframe, WIFI_PROBEREQ); - - pktlen = sizeof(struct ieee80211_hdr_3addr); - pframe += pktlen; - - pframe = rtw_set_ie(pframe, WLAN_EID_SSID, 0, NULL, &pktlen); - - get_rate_set(padapter, bssrate, &bssrate_len); - - if (bssrate_len > 8) { - pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, 8, bssrate, &pktlen); - pframe = rtw_set_ie(pframe, WLAN_EID_EXT_SUPP_RATES, (bssrate_len - 8), (bssrate + 8), &pktlen); - } else - pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, bssrate_len, bssrate, &pktlen); - - *pLength = pktlen; -} -#endif /* CONFIG_PNO_SUPPORT */ #endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN @@ -875,15 +714,6 @@ static void rtl8723b_set_FwAoacRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_ RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CAoacRsvdPageParm:", u1H2CAoacRsvdPageParm, H2C_AOAC_RSVDPAGE_LOC_LEN); FillH2CCmd8723B(padapter, H2C_8723B_AOAC_RSVD_PAGE, H2C_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm); } else { -#ifdef CONFIG_PNO_SUPPORT - if (!pwrpriv->pno_in_resume) { - DBG_871X("NLO_INFO =%d\n", rsvdpageloc->LocPNOInfo); - memset(&u1H2CAoacRsvdPageParm, 0, sizeof(u1H2CAoacRsvdPageParm)); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_NLO_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocPNOInfo); - FillH2CCmd8723B(padapter, H2C_AOAC_RSVDPAGE3, H2C_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm); - msleep(10); - } -#endif } #endif /* CONFIG_WOWLAN */ @@ -1183,11 +1013,6 @@ static void rtl8723b_set_FwWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) u8 gpio_high_active = 0; /* 0: low active, 1: high active */ u8 magic_pkt = 0; -#ifdef CONFIG_PNO_SUPPORT - if (!ppwrpriv->wowlan_pno_enable) - magic_pkt = 1; -#endif - if (psecpriv->dot11PrivacyAlgrthm == _WEP40_ || psecpriv->dot11PrivacyAlgrthm == _WEP104_) hw_unicast = 1; @@ -1240,28 +1065,9 @@ static void rtl8723b_set_FwRemoteWakeCtrl_Cmd(struct adapter *padapter, u8 benab else SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_ACTION(u1H2CRemoteWakeCtrlParm, 1); } -#ifdef CONFIG_PNO_SUPPORT - else { - SET_H2CCMD_REMOTE_WAKECTRL_ENABLE(u1H2CRemoteWakeCtrlParm, benable); - SET_H2CCMD_REMOTE_WAKE_CTRL_NLO_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, benable); - } -#endif RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CRemoteWakeCtrlParm:", u1H2CRemoteWakeCtrlParm, H2C_REMOTE_WAKE_CTRL_LEN); FillH2CCmd8723B(padapter, H2C_8723B_REMOTE_WAKE_CTRL, H2C_REMOTE_WAKE_CTRL_LEN, u1H2CRemoteWakeCtrlParm); -#ifdef CONFIG_PNO_SUPPORT - if (ppwrpriv->wowlan_pno_enable && !ppwrpriv->pno_in_resume) { - res = rtw_read8(padapter, REG_PNO_STATUS); - DBG_871X("cmd: 0x81 REG_PNO_STATUS: 0x%02x\n", res); - while (!(res&BIT(7)) && count < 25) { - DBG_871X("[%d] cmd: 0x81 REG_PNO_STATUS: 0x%02x\n", count, res); - res = rtw_read8(padapter, REG_PNO_STATUS); - count++; - msleep(2); - } - DBG_871X("cmd: 0x81 REG_PNO_STATUS: 0x%02x\n", res); - } -#endif /* CONFIG_PNO_SUPPORT */ } static void rtl8723b_set_FwAOACGlobalInfo_Cmd(struct adapter *padapter, u8 group_alg, u8 pairwise_alg) @@ -1278,26 +1084,6 @@ static void rtl8723b_set_FwAOACGlobalInfo_Cmd(struct adapter *padapter, u8 grou FillH2CCmd8723B(padapter, H2C_8723B_AOAC_GLOBAL_INFO, H2C_AOAC_GLOBAL_INFO_LEN, u1H2CAOACGlobalInfoParm); } -#ifdef CONFIG_PNO_SUPPORT -static void rtl8723b_set_FwScanOffloadInfo_cmd(struct adapter *padapter, PRSVDPAGE_LOC rsvdpageloc, u8 enable) -{ - u8 u1H2CScanOffloadInfoParm[H2C_SCAN_OFFLOAD_CTRL_LEN] = {0}; - - DBG_871X("%s: loc_probe_packet:%d, loc_scan_info: %d loc_ssid_info:%d\n", - __func__, rsvdpageloc->LocProbePacket, rsvdpageloc->LocScanInfo, rsvdpageloc->LocSSIDInfo); - - SET_H2CCMD_AOAC_NLO_FUN_EN(u1H2CScanOffloadInfoParm, enable); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_SCAN_INFO(u1H2CScanOffloadInfoParm, rsvdpageloc->LocScanInfo); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_PROBE_PACKET(u1H2CScanOffloadInfoParm, rsvdpageloc->LocProbePacket); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_SSID_INFO(u1H2CScanOffloadInfoParm, rsvdpageloc->LocSSIDInfo); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CScanOffloadInfoParm:", u1H2CScanOffloadInfoParm, H2C_SCAN_OFFLOAD_CTRL_LEN); - FillH2CCmd8723B(padapter, H2C_8723B_D0_SCAN_OFFLOAD_INFO, H2C_SCAN_OFFLOAD_CTRL_LEN, u1H2CScanOffloadInfoParm); - - msleep(20); -} -#endif /* CONFIG_PNO_SUPPORT */ - void rtl8723b_set_wowlan_cmd(struct adapter *padapter, u8 enable) { struct security_priv *psecpriv = &padapter->securitypriv; @@ -1656,55 +1442,8 @@ static void rtl8723b_set_FwRsvdPagePkt( } else #endif /* CONFIG_WOWLAN */ { -#ifdef CONFIG_PNO_SUPPORT - if (!pwrctl->pno_in_resume && pwrctl->pno_inited) { - /* Probe Request */ - RsvdPageLoc.LocProbePacket = TotalPageNum; - ConstructProbeReq( - padapter, - &ReservedPagePacket[BufIndex], - &ProbeReqLength); - - rtl8723b_fill_fake_txdesc(padapter, - &ReservedPagePacket[BufIndex-TxDescLen], - ProbeReqLength, false, false, false); - CurtPktPageNum = - (u8)PageNum_128(TxDescLen + ProbeReqLength); - - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* PNO INFO Page */ - RsvdPageLoc.LocPNOInfo = TotalPageNum; - ConstructPnoInfo(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &PNOLength); - - CurtPktPageNum = (u8)PageNum_128(PNOLength); - TotalPageNum += CurtPktPageNum; - BufIndex += (CurtPktPageNum*PageSize); - - /* SSID List Page */ - RsvdPageLoc.LocSSIDInfo = TotalPageNum; - ConstructSSIDList(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &SSIDLegnth); - CurtPktPageNum = (u8)PageNum_128(SSIDLegnth); - TotalPageNum += CurtPktPageNum; - BufIndex += (CurtPktPageNum*PageSize); - - /* Scan Info Page */ - RsvdPageLoc.LocScanInfo = TotalPageNum; - ConstructScanInfo(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &ScanInfoLength); - CurtPktPageNum = (u8)PageNum_128(ScanInfoLength); - TotalPageNum += CurtPktPageNum; - BufIndex += (CurtPktPageNum*PageSize); - - TotalPacketLen = BufIndex + ScanInfoLength; - } else { TotalPacketLen = BufIndex + BTQosNullLength; } -#else /* CONFIG_PNO_SUPPORT */ - TotalPacketLen = BufIndex + BTQosNullLength; -#endif - } if (TotalPacketLen > MaxRsvdPageBufSize) { DBG_871X("%s(): ERROR: The rsvd page size is not enough!!TotalPacketLen %d, MaxRsvdPageBufSize %d\n", __func__, @@ -1725,14 +1464,6 @@ static void rtl8723b_set_FwRsvdPagePkt( rtl8723b_set_FwAoacRsvdPage_cmd(padapter, &RsvdPageLoc); } else { rtl8723b_set_FwAoacRsvdPage_cmd(padapter, &RsvdPageLoc); -#ifdef CONFIG_PNO_SUPPORT - if (pwrctl->pno_in_resume) - rtl8723b_set_FwScanOffloadInfo_cmd(padapter, - &RsvdPageLoc, 0); - else - rtl8723b_set_FwScanOffloadInfo_cmd(padapter, - &RsvdPageLoc, 1); -#endif } return; diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index 3266839031f8..ced05bbfc906 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -1555,14 +1555,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) if (psta) rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); } -#ifdef CONFIG_PNO_SUPPORT - rtw_write8(padapter, 0x1b8, 0); - DBG_871X("reset 0x1b8: %d\n", rtw_read8(padapter, 0x1b8)); - rtw_write8(padapter, 0x1b9, 0); - DBG_871X("reset 0x1b9: %d\n", rtw_read8(padapter, 0x1b9)); - rtw_write8(padapter, REG_PNO_STATUS, 0); - DBG_871X("reset REG_PNO_STATUS: %d\n", rtw_read8(padapter, REG_PNO_STATUS)); -#endif break; default: diff --git a/drivers/staging/rtl8723bs/include/hal_com_h2c.h b/drivers/staging/rtl8723bs/include/hal_com_h2c.h index b951bc288b89..1f7ed90f9faa 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_h2c.h +++ b/drivers/staging/rtl8723bs/include/hal_com_h2c.h @@ -233,17 +233,6 @@ enum h2c_cmd { #ifdef CONFIG_GTK_OL #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+5, 0, 8, __Value) #endif /* CONFIG_GTK_OL */ -#ifdef CONFIG_PNO_SUPPORT -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_NLO_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd), 0, 8, __Value) -#endif - -#ifdef CONFIG_PNO_SUPPORT -/* D0_Scan_Offload_Info_0x86 */ -#define SET_H2CCMD_AOAC_NLO_FUN_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd), 3, 1, __Value) -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_PROBE_PACKET(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+1, 0, 8, __Value) -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_SCAN_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+2, 0, 8, __Value) -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_SSID_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+3, 0, 8, __Value) -#endif /* CONFIG_PNO_SUPPORT */ /* */ /* Structure -------------------------------------------------- */ @@ -265,12 +254,6 @@ typedef struct _RSVDPAGE_LOC { #ifdef CONFIG_GTK_OL u8 LocGTKEXTMEM; #endif /* CONFIG_GTK_OL */ -#ifdef CONFIG_PNO_SUPPORT - u8 LocPNOInfo; - u8 LocScanInfo; - u8 LocSSIDInfo; - u8 LocProbePacket; -#endif /* CONFIG_PNO_SUPPORT */ #endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN u8 LocApOffloadBCN; diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index 6f964f5c6578..2537bd7d6a13 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -92,11 +92,6 @@ struct rt_firmware_hdr { #define BCNQ_PAGE_NUM_8723B 0x08 #define BCNQ1_PAGE_NUM_8723B 0x00 -#ifdef CONFIG_PNO_SUPPORT -#undef BCNQ1_PAGE_NUM_8723B -#define BCNQ1_PAGE_NUM_8723B 0x00 /* 0x04 */ -#endif - #define MAX_RX_DMA_BUFFER_SIZE_8723B 0x2800 /* RX 10K */ /* For WoWLan, more reserved page */ @@ -107,11 +102,6 @@ struct rt_firmware_hdr { #define WOWLAN_PAGE_NUM_8723B 0x00 #endif -#ifdef CONFIG_PNO_SUPPORT -#undef WOWLAN_PAGE_NUM_8723B -#define WOWLAN_PAGE_NUM_8723B 0x0d -#endif - #ifdef CONFIG_AP_WOWLAN #define AP_WOWLAN_PAGE_NUM_8723B 0x02 #endif diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h index 0987891e85ae..f467e9032450 100644 --- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h @@ -46,11 +46,6 @@ enum Power_Mgnt { PS_MODE_NUM, }; -#ifdef CONFIG_PNO_SUPPORT -#define MAX_PNO_LIST_COUNT 16 -#define MAX_SCAN_LIST_COUNT 14 /* 2.4G only */ -#endif - /* BIT[2:0] = HW state BIT[3] = Protocol PS state, 0: register active state , 1: register sleep state @@ -158,47 +153,6 @@ enum PS_DENY_REASON { PS_DENY_OTHERS = 31 }; -#ifdef CONFIG_PNO_SUPPORT -struct pno_nlo_info { - u32 fast_scan_period; /* Fast scan period */ - u32 ssid_num; /* number of entry */ - u32 slow_scan_period; /* slow scan period */ - u32 fast_scan_iterations; /* Fast scan iterations */ - u8 ssid_length[MAX_PNO_LIST_COUNT]; /* SSID Length Array */ - u8 ssid_cipher_info[MAX_PNO_LIST_COUNT]; /* Cipher information for security */ - u8 ssid_channel_info[MAX_PNO_LIST_COUNT]; /* channel information */ -}; - -struct pno_ssid { - u32 SSID_len; - u8 SSID[32]; -}; - -struct pno_ssid_list { - struct pno_ssid node[MAX_PNO_LIST_COUNT]; -}; - -struct pno_scan_channel_info { - u8 channel; - u8 tx_power; - u8 timeout; - u8 active; /* set 1 means active scan, or pasivite scan. */ -}; - -struct pno_scan_info { - u8 enableRFE; /* Enable RFE */ - u8 period_scan_time; /* exclusive with fast_scan_period and slow_scan_period */ - u8 periodScan; /* exclusive with fast_scan_period and slow_scan_period */ - u8 orig_80_offset; /* original channel 80 offset */ - u8 orig_40_offset; /* original channel 40 offset */ - u8 orig_bw; /* original bandwidth */ - u8 orig_ch; /* original channel */ - u8 channel_num; /* number of channel */ - u64 rfe_type; /* rfe_type && 0x00000000000000ff */ - struct pno_scan_channel_info ssid_channel_info[MAX_SCAN_LIST_COUNT]; -}; -#endif /* CONFIG_PNO_SUPPORT */ - struct pwrctrl_priv { struct mutex lock; volatile u8 rpwm; /* requested power state for fw */ @@ -272,13 +226,6 @@ struct pwrctrl_priv { u8 wowlan_unicast; u8 wowlan_pattern_idx; u8 wowlan_pno_enable; -#ifdef CONFIG_PNO_SUPPORT - u8 pno_in_resume; - u8 pno_inited; - struct pno_nlo_info *pnlo_info; - struct pno_scan_info *pscan_info; - struct pno_ssid_list *pno_ssid_list; -#endif u32 wowlan_pattern_context[8][5]; u64 wowlan_fw_iv; #endif /* CONFIG_WOWLAN */ diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index ff164a8c8679..4d2981a4c01d 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -3095,54 +3095,6 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, return ret; } -#if defined(CONFIG_PNO_SUPPORT) -static int cfg80211_rtw_sched_scan_start(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_sched_scan_request *request) -{ - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - int ret; - - if (padapter->bup == false) { - DBG_871X("%s: net device is down.\n", __func__); - return -EIO; - } - - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true || - check_fwstate(pmlmepriv, _FW_LINKED) == true || - check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) { - DBG_871X("%s: device is busy.\n", __func__); - rtw_scan_abort(padapter); - } - - if (request == NULL) { - DBG_871X("%s: invalid cfg80211_requests parameters.\n", __func__); - return -EINVAL; - } - - ret = rtw_android_cfg80211_pno_setup(dev, request->ssids, - request->n_ssids, request->interval); - - if (ret < 0) { - DBG_871X("%s ret: %d\n", __func__, ret); - goto exit; - } - - ret = rtw_android_pno_enable(dev, true); - if (ret < 0) { - DBG_871X("%s ret: %d\n", __func__, ret); - goto exit; - } -exit: - return ret; -} - -static int cfg80211_rtw_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev) -{ - return rtw_android_pno_enable(dev, false); -} -#endif /* CONFIG_PNO_SUPPORT */ - static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum nl80211_band band, u8 rf_type) { @@ -3248,9 +3200,6 @@ static void rtw_cfg80211_preinit_wiphy(struct adapter *padapter, struct wiphy *w #if defined(CONFIG_PM) wiphy->max_sched_scan_reqs = 1; -#ifdef CONFIG_PNO_SUPPORT - wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT; -#endif #endif #if defined(CONFIG_PM) @@ -3297,11 +3246,6 @@ static struct cfg80211_ops rtw_cfg80211_ops = { .change_bss = cfg80211_rtw_change_bss, .mgmt_tx = cfg80211_rtw_mgmt_tx, - -#if defined(CONFIG_PNO_SUPPORT) - .sched_scan_start = cfg80211_rtw_sched_scan_start, - .sched_scan_stop = cfg80211_rtw_sched_scan_stop, -#endif /* CONFIG_PNO_SUPPORT */ }; int rtw_wdev_alloc(struct adapter *padapter, struct device *dev) diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index b62fe9238e6d..61488781d211 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -1505,10 +1505,6 @@ int rtw_resume_process_wow(struct adapter *padapter) goto exit; } -#ifdef CONFIG_PNO_SUPPORT - pwrpriv->pno_in_resume = true; -#endif - if (pwrpriv->wowlan_mode) { rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN"); @@ -1780,9 +1776,6 @@ int rtw_resume_common(struct adapter *padapter) if (pwrpriv) { pwrpriv->bInSuspend = false; - #ifdef CONFIG_PNO_SUPPORT - pwrpriv->pno_in_resume = false; - #endif } DBG_871X_LEVEL(_drv_always_, "%s:%d in %d ms\n", __func__, ret, jiffies_to_msecs(jiffies - start_time)); -- 2.20.1 From fabioaiuto83 at gmail.com Fri Mar 12 16:07:25 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Fri, 12 Mar 2021 17:07:25 +0100 Subject: [PATCH 2/3] staging: rtl8723bs: remove unused code blocks In-Reply-To: References: Message-ID: <76c47c1c24896d8854b4732645bd90ac27cf2b71.1615561447.git.fabioaiuto83@gmail.com> remove conditional code blocks checked by unused CONFIG_WOWLAN cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 - drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 6 +- .../staging/rtl8723bs/core/rtw_wlan_util.c | 53 +- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 555 +----------------- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 43 +- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 240 +------- drivers/staging/rtl8723bs/hal/sdio_ops.c | 4 +- drivers/staging/rtl8723bs/include/autoconf.h | 3 - drivers/staging/rtl8723bs/include/drv_types.h | 5 - .../rtl8723bs/include/drv_types_sdio.h | 2 +- .../staging/rtl8723bs/include/hal_com_h2c.h | 71 +-- drivers/staging/rtl8723bs/include/hal_intf.h | 5 - .../staging/rtl8723bs/include/rtl8723b_cmd.h | 4 +- .../staging/rtl8723bs/include/rtl8723b_hal.h | 7 - .../staging/rtl8723bs/include/rtl8723b_spec.h | 10 - drivers/staging/rtl8723bs/include/rtw_mp.h | 3 - .../staging/rtl8723bs/include/rtw_pwrctrl.h | 9 - .../staging/rtl8723bs/include/rtw_security.h | 3 - drivers/staging/rtl8723bs/include/sdio_ops.h | 8 +- drivers/staging/rtl8723bs/include/sta_info.h | 5 - .../staging/rtl8723bs/os_dep/ioctl_linux.c | 3 - drivers/staging/rtl8723bs/os_dep/os_intfs.c | 231 +------- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 5 - 23 files changed, 28 insertions(+), 1250 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index 2c9425e2a1e9..7412295f0a04 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -2098,9 +2098,6 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) if (!candidate) { DBG_871X("%s: return _FAIL(candidate == NULL)\n", __func__); -#ifdef CONFIG_WOWLAN - _clr_fwstate_(pmlmepriv, _FW_LINKED|_FW_UNDER_LINKING); -#endif ret = _FAIL; goto exit; } else { diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index 8059aeea9d47..2e6c522b74e3 100644 --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c @@ -350,7 +350,7 @@ static u8 PS_RDY_CHECK(struct adapter *padapter) struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN if (pwrpriv->bInSuspend && pwrpriv->wowlan_mode) return true; else if (pwrpriv->bInSuspend && pwrpriv->wowlan_ap_mode) @@ -391,7 +391,7 @@ static u8 PS_RDY_CHECK(struct adapter *padapter) void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode, const char *msg) { struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN struct debug_priv *pdbgpriv = &padapter->dvobj->drv_dbg; #endif @@ -422,7 +422,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a pwrpriv->pwr_mode = ps_mode; rtw_set_rpwm(padapter, PS_STATE_S4); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode) { unsigned long start_time; u32 delay_ms; diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index ae577178534f..355e43c4cf9a 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -10,7 +10,7 @@ #include #include -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN #include #endif @@ -2113,7 +2113,7 @@ int rtw_config_gpio(struct net_device *netdev, int gpio_num, bool isOutput) EXPORT_SYMBOL(rtw_config_gpio); #endif -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -2139,53 +2139,4 @@ void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip) } } #endif -#ifdef CONFIG_WOWLAN -void rtw_get_sec_iv(struct adapter *padapter, u8 *pcur_dot11txpn, u8 *StaAddr) -{ - struct sta_info *psta; - struct security_priv *psecpriv = &padapter->securitypriv; - - memset(pcur_dot11txpn, 0, 8); - if (!StaAddr) - return; - psta = rtw_get_stainfo(&padapter->stapriv, StaAddr); - DBG_871X("%s(): StaAddr: %02x %02x %02x %02x %02x %02x\n", - __func__, StaAddr[0], StaAddr[1], StaAddr[2], - StaAddr[3], StaAddr[4], StaAddr[5]); - - if (psta) { - if (psecpriv->dot11PrivacyAlgrthm != _NO_PRIVACY_ && psta->dot11txpn.val > 0) - psta->dot11txpn.val--; - AES_IV(pcur_dot11txpn, psta->dot11txpn, 0); - - DBG_871X("%s(): CurrentIV: %02x %02x %02x %02x %02x %02x %02x %02x\n" - , __func__, pcur_dot11txpn[0], pcur_dot11txpn[1], - pcur_dot11txpn[2], pcur_dot11txpn[3], pcur_dot11txpn[4], - pcur_dot11txpn[5], pcur_dot11txpn[6], pcur_dot11txpn[7]); - } -} - -void rtw_set_sec_pn(struct adapter *padapter) -{ - struct sta_info *psta; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct security_priv *psecpriv = &padapter->securitypriv; - - psta = rtw_get_stainfo(&padapter->stapriv, - get_my_bssid(&pmlmeinfo->network)); - - if (psta) { - if (pwrpriv->wowlan_fw_iv > psta->dot11txpn.val) { - if (psecpriv->dot11PrivacyAlgrthm != _NO_PRIVACY_) - psta->dot11txpn.val = pwrpriv->wowlan_fw_iv + 2; - } else { - DBG_871X("%s(): FW IV is smaller than driver\n", __func__); - psta->dot11txpn.val += 2; - } - DBG_871X("%s: dot11txpn: 0x%016llx\n", __func__, psta->dot11txpn.val); - } -} -#endif /* CONFIG_WOWLAN */ diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index b6958d3db855..c3e7103da7e7 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -31,10 +31,6 @@ static u8 _is_fw_read_cmd_down(struct adapter *padapter, u8 msgbox_num) if (0 == valid) { read_down = true; } -#ifdef CONFIG_WOWLAN - else - msleep(1); -#endif } while ((!read_down) && (retry_cnts--)); return read_down; @@ -316,239 +312,6 @@ static void ConstructNullFunctionData( *pLength = pktlen; } - -#ifdef CONFIG_WOWLAN -/* */ -/* Description: */ -/* Construct the ARP response packet to support ARP offload. */ -/* */ -static void ConstructARPResponse( - struct adapter *padapter, - u8 *pframe, - u32 *pLength, - u8 *pIPAddress -) -{ - struct ieee80211_hdr *pwlanhdr; - __le16 *fctrl; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct security_priv *psecuritypriv = &padapter->securitypriv; - static u8 ARPLLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06}; - u8 *pARPRspPkt = pframe; - /* for TKIP Cal MIC */ - u8 *payload = pframe; - u8 EncryptionHeadOverhead = 0; - /* DBG_871X("%s:%d\n", __func__, bForcePowerSave); */ - - pwlanhdr = (struct ieee80211_hdr *)pframe; - - fctrl = &pwlanhdr->frame_control; - *(fctrl) = 0; - - /* */ - /* MAC Header. */ - /* */ - SetFrameType(fctrl, WIFI_DATA); - /* SetFrameSubType(fctrl, 0); */ - SetToDs(fctrl); - memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - - SetSeqNum(pwlanhdr, 0); - SetDuration(pwlanhdr, 0); - /* SET_80211_HDR_FRAME_CONTROL(pARPRspPkt, 0); */ - /* SET_80211_HDR_TYPE_AND_SUBTYPE(pARPRspPkt, Type_Data); */ - /* SET_80211_HDR_TO_DS(pARPRspPkt, 1); */ - /* SET_80211_HDR_ADDRESS1(pARPRspPkt, pMgntInfo->Bssid); */ - /* SET_80211_HDR_ADDRESS2(pARPRspPkt, Adapter->CurrentAddress); */ - /* SET_80211_HDR_ADDRESS3(pARPRspPkt, pMgntInfo->Bssid); */ - - /* SET_80211_HDR_DURATION(pARPRspPkt, 0); */ - /* SET_80211_HDR_FRAGMENT_SEQUENCE(pARPRspPkt, 0); */ - *pLength = 24; - - /* */ - /* Security Header: leave space for it if necessary. */ - /* */ - - switch (psecuritypriv->dot11PrivacyAlgrthm) { - case _WEP40_: - case _WEP104_: - EncryptionHeadOverhead = 4; - break; - case _TKIP_: - EncryptionHeadOverhead = 8; - break; - case _AES_: - EncryptionHeadOverhead = 8; - break; - default: - EncryptionHeadOverhead = 0; - } - - if (EncryptionHeadOverhead > 0) { - memset(&(pframe[*pLength]), 0, EncryptionHeadOverhead); - *pLength += EncryptionHeadOverhead; - SetPrivacy(fctrl); - } - - /* */ - /* Frame Body. */ - /* */ - pARPRspPkt = (u8 *)(pframe + *pLength); - payload = pARPRspPkt; /* Get Payload pointer */ - /* LLC header */ - memcpy(pARPRspPkt, ARPLLCHeader, 8); - *pLength += 8; - - /* ARP element */ - pARPRspPkt += 8; - SET_ARP_PKT_HW(pARPRspPkt, 0x0100); - SET_ARP_PKT_PROTOCOL(pARPRspPkt, 0x0008); /* IP protocol */ - SET_ARP_PKT_HW_ADDR_LEN(pARPRspPkt, 6); - SET_ARP_PKT_PROTOCOL_ADDR_LEN(pARPRspPkt, 4); - SET_ARP_PKT_OPERATION(pARPRspPkt, 0x0200); /* ARP response */ - SET_ARP_PKT_SENDER_MAC_ADDR(pARPRspPkt, myid(&(padapter->eeprompriv))); - SET_ARP_PKT_SENDER_IP_ADDR(pARPRspPkt, pIPAddress); - { - SET_ARP_PKT_TARGET_MAC_ADDR(pARPRspPkt, get_my_bssid(&(pmlmeinfo->network))); - SET_ARP_PKT_TARGET_IP_ADDR(pARPRspPkt, pIPAddress); - DBG_871X("%s Target Mac Addr:%pM\n", __func__, MAC_ARG(get_my_bssid(&(pmlmeinfo->network)))); - DBG_871X("%s Target IP Addr:%pI4\n", __func__, IP_ARG(pIPAddress)); - } - - *pLength += 28; - - if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_) { - u8 mic[8]; - struct mic_data micdata; - struct sta_info *psta = NULL; - u8 priority[4] = { - 0x0, 0x0, 0x0, 0x0 - }; - u8 null_key[16] = { - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 - }; - - DBG_871X("%s(): Add MIC\n", __func__); - - psta = rtw_get_stainfo(&padapter->stapriv, get_my_bssid(&(pmlmeinfo->network))); - if (psta) { - if (!memcmp(&psta->dot11tkiptxmickey.skey[0], null_key, 16)) { - DBG_871X("%s(): STA dot11tkiptxmickey == 0\n", __func__); - } - /* start to calculate the mic code */ - rtw_secmicsetkey(&micdata, &psta->dot11tkiptxmickey.skey[0]); - } - - rtw_secmicappend(&micdata, pwlanhdr->addr3, 6); /* DA */ - - rtw_secmicappend(&micdata, pwlanhdr->addr2, 6); /* SA */ - - priority[0] = 0; - rtw_secmicappend(&micdata, &priority[0], 4); - - rtw_secmicappend(&micdata, payload, 36); /* payload length = 8 + 28 */ - - rtw_secgetmic(&micdata, &(mic[0])); - - pARPRspPkt += 28; - memcpy(pARPRspPkt, &(mic[0]), 8); - - *pLength += 8; - } -} - -#ifdef CONFIG_GTK_OL -static void ConstructGTKResponse( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - struct ieee80211_hdr *pwlanhdr; - u16 *fctrl; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct security_priv *psecuritypriv = &padapter->securitypriv; - static u8 LLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8E}; - static u8 GTKbody_a[11] = {0x01, 0x03, 0x00, 0x5F, 0x02, 0x03, 0x12, 0x00, 0x10, 0x42, 0x0B}; - u8 *pGTKRspPkt = pframe; - u8 EncryptionHeadOverhead = 0; - /* DBG_871X("%s:%d\n", __func__, bForcePowerSave); */ - - pwlanhdr = (struct ieee80211_hdr *)pframe; - - fctrl = &pwlanhdr->frame_control; - *(fctrl) = 0; - - /* */ - /* MAC Header. */ - /* */ - SetFrameType(fctrl, WIFI_DATA); - /* SetFrameSubType(fctrl, 0); */ - SetToDs(fctrl); - memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - - SetSeqNum(pwlanhdr, 0); - SetDuration(pwlanhdr, 0); - - *pLength = 24; - - /* */ - /* Security Header: leave space for it if necessary. */ - /* */ - - switch (psecuritypriv->dot11PrivacyAlgrthm) { - case _WEP40_: - case _WEP104_: - EncryptionHeadOverhead = 4; - break; - case _TKIP_: - EncryptionHeadOverhead = 8; - break; - case _AES_: - EncryptionHeadOverhead = 8; - break; - default: - EncryptionHeadOverhead = 0; - } - - if (EncryptionHeadOverhead > 0) { - memset(&(pframe[*pLength]), 0, EncryptionHeadOverhead); - *pLength += EncryptionHeadOverhead; - /* GTK's privacy bit is done by FW */ - /* SetPrivacy(fctrl); */ - } - - /* */ - /* Frame Body. */ - /* */ - pGTKRspPkt = (u8 *)(pframe + *pLength); - /* LLC header */ - memcpy(pGTKRspPkt, LLCHeader, 8); - *pLength += 8; - - /* GTK element */ - pGTKRspPkt += 8; - - /* GTK frame body after LLC, part 1 */ - memcpy(pGTKRspPkt, GTKbody_a, 11); - *pLength += 11; - pGTKRspPkt += 11; - /* GTK frame body after LLC, part 2 */ - memset(&(pframe[*pLength]), 0, 88); - *pLength += 88; - pGTKRspPkt += 88; - -} -#endif /* CONFIG_GTK_OL */ - -#endif /* CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN static void ConstructProbeRsp(struct adapter *padapter, u8 *pframe, u32 *pLength, u8 *StaAddr, bool bHideSSID) { @@ -692,31 +455,6 @@ static void rtl8723b_set_FwRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_LOC static void rtl8723b_set_FwAoacRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_LOC rsvdpageloc) { -#ifdef CONFIG_WOWLAN - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 u1H2CAoacRsvdPageParm[H2C_AOAC_RSVDPAGE_LOC_LEN] = {0}; - - DBG_871X("8723BAOACRsvdPageLoc: RWC =%d ArpRsp =%d NbrAdv =%d GtkRsp =%d GtkInfo =%d ProbeReq =%d NetworkList =%d\n", - rsvdpageloc->LocRemoteCtrlInfo, rsvdpageloc->LocArpRsp, - rsvdpageloc->LocNbrAdv, rsvdpageloc->LocGTKRsp, - rsvdpageloc->LocGTKInfo, rsvdpageloc->LocProbeReq, - rsvdpageloc->LocNetList); - - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - SET_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocRemoteCtrlInfo); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1H2CAoacRsvdPageParm, rsvdpageloc->LocArpRsp); - /* SET_H2CCMD_AOAC_RSVDPAGE_LOC_NEIGHBOR_ADV(u1H2CAoacRsvdPageParm, rsvdpageloc->LocNbrAdv); */ - SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_RSP(u1H2CAoacRsvdPageParm, rsvdpageloc->LocGTKRsp); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocGTKInfo); -#ifdef CONFIG_GTK_OL - SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(u1H2CAoacRsvdPageParm, rsvdpageloc->LocGTKEXTMEM); -#endif /* CONFIG_GTK_OL */ - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CAoacRsvdPageParm:", u1H2CAoacRsvdPageParm, H2C_AOAC_RSVDPAGE_LOC_LEN); - FillH2CCmd8723B(padapter, H2C_8723B_AOAC_RSVD_PAGE, H2C_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm); - } else { - } - -#endif /* CONFIG_WOWLAN */ } #ifdef CONFIG_AP_WOWLAN @@ -771,40 +509,6 @@ void rtl8723b_set_FwMediaStatusRpt_cmd(struct adapter *padapter, u8 mstatus, u8 FillH2CCmd8723B(padapter, H2C_8723B_MEDIA_STATUS_RPT, H2C_MEDIA_STATUS_RPT_LEN, u1H2CMediaStatusRptParm); } -#ifdef CONFIG_WOWLAN -static void rtl8723b_set_FwKeepAlive_cmd(struct adapter *padapter, u8 benable, u8 pkt_type) -{ - u8 u1H2CKeepAliveParm[H2C_KEEP_ALIVE_CTRL_LEN] = {0}; - u8 adopt = 1, check_period = 5; - - DBG_871X("%s(): benable = %d\n", __func__, benable); - SET_8723B_H2CCMD_KEEPALIVE_PARM_ENABLE(u1H2CKeepAliveParm, benable); - SET_8723B_H2CCMD_KEEPALIVE_PARM_ADOPT(u1H2CKeepAliveParm, adopt); - SET_8723B_H2CCMD_KEEPALIVE_PARM_PKT_TYPE(u1H2CKeepAliveParm, pkt_type); - SET_8723B_H2CCMD_KEEPALIVE_PARM_CHECK_PERIOD(u1H2CKeepAliveParm, check_period); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CKeepAliveParm:", u1H2CKeepAliveParm, H2C_KEEP_ALIVE_CTRL_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_KEEP_ALIVE, H2C_KEEP_ALIVE_CTRL_LEN, u1H2CKeepAliveParm); -} - -static void rtl8723b_set_FwDisconDecision_cmd(struct adapter *padapter, u8 benable) -{ - u8 u1H2CDisconDecisionParm[H2C_DISCON_DECISION_LEN] = {0}; - u8 adopt = 1, check_period = 10, trypkt_num = 0; - - DBG_871X("%s(): benable = %d\n", __func__, benable); - SET_8723B_H2CCMD_DISCONDECISION_PARM_ENABLE(u1H2CDisconDecisionParm, benable); - SET_8723B_H2CCMD_DISCONDECISION_PARM_ADOPT(u1H2CDisconDecisionParm, adopt); - SET_8723B_H2CCMD_DISCONDECISION_PARM_CHECK_PERIOD(u1H2CDisconDecisionParm, check_period); - SET_8723B_H2CCMD_DISCONDECISION_PARM_TRY_PKT_NUM(u1H2CDisconDecisionParm, trypkt_num); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CDisconDecisionParm:", u1H2CDisconDecisionParm, H2C_DISCON_DECISION_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_DISCON_DECISION, H2C_DISCON_DECISION_LEN, u1H2CDisconDecisionParm); -} -#endif /* CONFIG_WOWLAN */ - void rtl8723b_set_FwMacIdConfig_cmd(struct adapter *padapter, u8 mac_id, u8 raid, u8 bw, u8 sgi, u32 mask) { u8 u1H2CMacIdConfigParm[H2C_MACID_CFG_LEN] = {0}; @@ -855,21 +559,12 @@ void rtl8723b_set_FwPwrMode_cmd(struct adapter *padapter, u8 psmode) else DBG_871X("%s(): FW LPS mode = %d, SmartPS =%d\n", __func__, psmode, pwrpriv->smart_ps); -#ifdef CONFIG_WOWLAN - if (psmode == PS_MODE_DTIM) { /* For WOWLAN LPS, DTIM = (awake_intvl - 1) */ + if (pwrpriv->dtim > 0 && pwrpriv->dtim < 16) + awake_intvl = pwrpriv->dtim+1;/* DTIM = (awake_intvl - 1) */ + else awake_intvl = 3;/* DTIM =2 */ - rlbm = 2; - } else -#endif /* CONFIG_WOWLAN */ - { - if (pwrpriv->dtim > 0 && pwrpriv->dtim < 16) - awake_intvl = pwrpriv->dtim+1;/* DTIM = (awake_intvl - 1) */ - else - awake_intvl = 3;/* DTIM =2 */ - - rlbm = 2; - } + rlbm = 2; if (padapter->registrypriv.wifi_spec == 1) { awake_intvl = 2; @@ -1003,135 +698,6 @@ void rtl8723b_set_FwPwrModeInIPS_cmd(struct adapter *padapter, u8 cmd_param) FillH2CCmd8723B(padapter, H2C_8723B_FWLPS_IN_IPS_, 1, &cmd_param); } -#ifdef CONFIG_WOWLAN -static void rtl8723b_set_FwWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) -{ - struct security_priv *psecpriv = &padapter->securitypriv; - u8 u1H2CWoWlanCtrlParm[H2C_WOWLAN_LEN] = {0}; - u8 discont_wake = 1, gpionum = 0, gpio_dur = 0, hw_unicast = 0; - u8 sdio_wakeup_enable = 1; - u8 gpio_high_active = 0; /* 0: low active, 1: high active */ - u8 magic_pkt = 0; - - if (psecpriv->dot11PrivacyAlgrthm == _WEP40_ || psecpriv->dot11PrivacyAlgrthm == _WEP104_) - hw_unicast = 1; - - DBG_871X("%s(): bFuncEn =%d\n", __func__, bFuncEn); - - SET_H2CCMD_WOWLAN_FUNC_ENABLE(u1H2CWoWlanCtrlParm, bFuncEn); - SET_H2CCMD_WOWLAN_PATTERN_MATCH_ENABLE(u1H2CWoWlanCtrlParm, 0); - SET_H2CCMD_WOWLAN_MAGIC_PKT_ENABLE(u1H2CWoWlanCtrlParm, magic_pkt); - SET_H2CCMD_WOWLAN_UNICAST_PKT_ENABLE(u1H2CWoWlanCtrlParm, hw_unicast); - SET_H2CCMD_WOWLAN_ALL_PKT_DROP(u1H2CWoWlanCtrlParm, 0); - SET_H2CCMD_WOWLAN_GPIO_ACTIVE(u1H2CWoWlanCtrlParm, gpio_high_active); - SET_H2CCMD_WOWLAN_DISCONNECT_WAKE_UP(u1H2CWoWlanCtrlParm, discont_wake); - SET_H2CCMD_WOWLAN_GPIONUM(u1H2CWoWlanCtrlParm, gpionum); - SET_H2CCMD_WOWLAN_DATAPIN_WAKE_UP(u1H2CWoWlanCtrlParm, sdio_wakeup_enable); - SET_H2CCMD_WOWLAN_GPIO_DURATION(u1H2CWoWlanCtrlParm, gpio_dur); - /* SET_H2CCMD_WOWLAN_GPIO_PULSE_EN(u1H2CWoWlanCtrlParm, 1); */ - SET_H2CCMD_WOWLAN_GPIO_PULSE_COUNT(u1H2CWoWlanCtrlParm, 0x09); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CWoWlanCtrlParm:", u1H2CWoWlanCtrlParm, H2C_WOWLAN_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_WOWLAN, H2C_WOWLAN_LEN, u1H2CWoWlanCtrlParm); -} - -static void rtl8723b_set_FwRemoteWakeCtrl_Cmd(struct adapter *padapter, u8 benable) -{ - u8 u1H2CRemoteWakeCtrlParm[H2C_REMOTE_WAKE_CTRL_LEN] = {0}; - struct security_priv *psecuritypriv = &(padapter->securitypriv); - struct pwrctrl_priv *ppwrpriv = adapter_to_pwrctl(padapter); - - DBG_871X("%s(): Enable =%d\n", __func__, benable); - - if (!ppwrpriv->wowlan_pno_enable) { - SET_H2CCMD_REMOTE_WAKECTRL_ENABLE(u1H2CRemoteWakeCtrlParm, benable); - SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, 1); -#ifdef CONFIG_GTK_OL - if (psecuritypriv->binstallKCK_KEK && - psecuritypriv->dot11PrivacyAlgrthm == _AES_) { - SET_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, 1); - } else { - DBG_871X("no kck or security is not AES\n"); - SET_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, 0); - } -#endif /* CONFIG_GTK_OL */ - - SET_H2CCMD_REMOTE_WAKE_CTRL_FW_UNICAST_EN(u1H2CRemoteWakeCtrlParm, 1); - - if ((psecuritypriv->dot11PrivacyAlgrthm == _AES_) || - (psecuritypriv->dot11PrivacyAlgrthm == _NO_PRIVACY_)) - SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_ACTION(u1H2CRemoteWakeCtrlParm, 0); - else - SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_ACTION(u1H2CRemoteWakeCtrlParm, 1); - } - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CRemoteWakeCtrlParm:", u1H2CRemoteWakeCtrlParm, H2C_REMOTE_WAKE_CTRL_LEN); - FillH2CCmd8723B(padapter, H2C_8723B_REMOTE_WAKE_CTRL, - H2C_REMOTE_WAKE_CTRL_LEN, u1H2CRemoteWakeCtrlParm); -} - -static void rtl8723b_set_FwAOACGlobalInfo_Cmd(struct adapter *padapter, u8 group_alg, u8 pairwise_alg) -{ - u8 u1H2CAOACGlobalInfoParm[H2C_AOAC_GLOBAL_INFO_LEN] = {0}; - - DBG_871X("%s(): group_alg =%d pairwise_alg =%d\n", __func__, group_alg, pairwise_alg); - - SET_H2CCMD_AOAC_GLOBAL_INFO_PAIRWISE_ENC_ALG(u1H2CAOACGlobalInfoParm, pairwise_alg); - SET_H2CCMD_AOAC_GLOBAL_INFO_GROUP_ENC_ALG(u1H2CAOACGlobalInfoParm, group_alg); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CAOACGlobalInfoParm:", u1H2CAOACGlobalInfoParm, H2C_AOAC_GLOBAL_INFO_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_AOAC_GLOBAL_INFO, H2C_AOAC_GLOBAL_INFO_LEN, u1H2CAOACGlobalInfoParm); -} - -void rtl8723b_set_wowlan_cmd(struct adapter *padapter, u8 enable) -{ - struct security_priv *psecpriv = &padapter->securitypriv; - struct pwrctrl_priv *ppwrpriv = adapter_to_pwrctl(padapter); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_info *psta = NULL; - u8 pkt_type = 0; - - DBG_871X_LEVEL(_drv_always_, "+%s()+: enable =%d\n", __func__, enable); - if (enable) { - rtl8723b_set_FwAOACGlobalInfo_Cmd(padapter, psecpriv->dot118021XGrpPrivacy, psecpriv->dot11PrivacyAlgrthm); - - rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); /* RT_MEDIA_CONNECT will confuse in the future */ - - if (!(ppwrpriv->wowlan_pno_enable)) { - psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv)); - if (psta) - rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); - } else - DBG_871X("%s(): Disconnected, no FwMediaStatusRpt CONNECT\n", __func__); - - msleep(2); - - if (!(ppwrpriv->wowlan_pno_enable)) { - rtl8723b_set_FwDisconDecision_cmd(padapter, enable); - msleep(2); - - if ((psecpriv->dot11PrivacyAlgrthm != _WEP40_) || (psecpriv->dot11PrivacyAlgrthm != _WEP104_)) - pkt_type = 1; - - rtl8723b_set_FwKeepAlive_cmd(padapter, enable, pkt_type); - msleep(2); - } - - rtl8723b_set_FwWoWlanCtrl_Cmd(padapter, enable); - msleep(2); - - rtl8723b_set_FwRemoteWakeCtrl_Cmd(padapter, enable); - } else { - rtl8723b_set_FwRemoteWakeCtrl_Cmd(padapter, enable); - msleep(2); - rtl8723b_set_FwWoWlanCtrl_Cmd(padapter, enable); - } - - DBG_871X_LEVEL(_drv_always_, "-%s()-\n", __func__); -} -#endif /* CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN static void rtl8723b_set_FwAPWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) { @@ -1223,17 +789,6 @@ static void rtl8723b_set_FwRsvdPagePkt( u16 BufIndex, PageSize = 128; u32 TotalPacketLen, MaxRsvdPageBufSize = 0; RSVDPAGE_LOC RsvdPageLoc; -#ifdef CONFIG_WOWLAN - u32 ARPLegnth = 0, GTKLegnth = 0; - u8 currentip[4]; - u8 cur_dot11txpn[8]; -#ifdef CONFIG_GTK_OL - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *psta; - u8 kek[RTW_KEK_LEN]; - u8 kck[RTW_KCK_LEN]; -#endif -#endif /* DBG_871X("%s---->\n", __func__); */ @@ -1343,107 +898,7 @@ static void rtl8723b_set_FwRsvdPagePkt( BufIndex += (CurtPktPageNum*PageSize); -#ifdef CONFIG_WOWLAN - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - /* if (pwrctl->wowlan_mode == true) { */ - /* BufIndex += (CurtPktPageNum*PageSize); */ - - /* 3(7) ARP RSP */ - rtw_get_current_ip_address(padapter, currentip); - RsvdPageLoc.LocArpRsp = TotalPageNum; - { - ConstructARPResponse( - padapter, - &ReservedPagePacket[BufIndex], - &ARPLegnth, - currentip - ); - rtl8723b_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], ARPLegnth, false, false, true); - - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: ARP RSP %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], (ARPLegnth+TxDescLen)); */ - - CurtPktPageNum = (u8)PageNum_128(TxDescLen + ARPLegnth); - } - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* 3(8) SEC IV */ - rtw_get_sec_iv(padapter, cur_dot11txpn, get_my_bssid(&pmlmeinfo->network)); - RsvdPageLoc.LocRemoteCtrlInfo = TotalPageNum; - memcpy(ReservedPagePacket+BufIndex-TxDescLen, cur_dot11txpn, _AES_IV_LEN_); - - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: SEC IV %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], _AES_IV_LEN_); */ - - CurtPktPageNum = (u8)PageNum_128(_AES_IV_LEN_); - - TotalPageNum += CurtPktPageNum; - -#ifdef CONFIG_GTK_OL - BufIndex += (CurtPktPageNum*PageSize); - - /* if the ap station info. exists, get the kek, kck from station info. */ - psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); - if (!psta) { - memset(kek, 0, RTW_KEK_LEN); - memset(kck, 0, RTW_KCK_LEN); - DBG_8192C("%s, KEK, KCK download rsvd page all zero\n", __func__); - } else { - memcpy(kek, psta->kek, RTW_KEK_LEN); - memcpy(kck, psta->kck, RTW_KCK_LEN); - } - - /* 3(9) KEK, KCK */ - RsvdPageLoc.LocGTKInfo = TotalPageNum; - memcpy(ReservedPagePacket+BufIndex-TxDescLen, kck, RTW_KCK_LEN); - memcpy(ReservedPagePacket+BufIndex-TxDescLen+RTW_KCK_LEN, kek, RTW_KEK_LEN); - - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: KEK KCK %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], (TxDescLen + RTW_KCK_LEN + RTW_KEK_LEN)); */ - - CurtPktPageNum = (u8)PageNum_128(TxDescLen + RTW_KCK_LEN + RTW_KEK_LEN); - - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* 3(10) GTK Response */ - RsvdPageLoc.LocGTKRsp = TotalPageNum; - ConstructGTKResponse( - padapter, - &ReservedPagePacket[BufIndex], - >KLegnth - ); - - rtl8723b_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], GTKLegnth, false, false, true); - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: GTK RSP %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], (TxDescLen + GTKLegnth)); */ - - CurtPktPageNum = (u8)PageNum_128(TxDescLen + GTKLegnth); - - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* below page is empty for GTK extension memory */ - /* 3(11) GTK EXT MEM */ - RsvdPageLoc.LocGTKEXTMEM = TotalPageNum; - - CurtPktPageNum = 2; - - TotalPageNum += CurtPktPageNum; - - TotalPacketLen = BufIndex-TxDescLen + 256; /* extension memory for FW */ -#else - TotalPacketLen = BufIndex - TxDescLen + sizeof(union pn48); /* IV len */ -#endif /* CONFIG_GTK_OL */ - } else -#endif /* CONFIG_WOWLAN */ - { - TotalPacketLen = BufIndex + BTQosNullLength; - } + TotalPacketLen = BufIndex + BTQosNullLength; if (TotalPacketLen > MaxRsvdPageBufSize) { DBG_871X("%s(): ERROR: The rsvd page size is not enough!!TotalPacketLen %d, MaxRsvdPageBufSize %d\n", __func__, diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 84e963909283..9f5e81375289 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -369,9 +369,6 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool bUsedWoWLANFw) u8 tmp_ps; RT_TRACE(_module_hal_init_c_, _drv_info_, ("+%s\n", __func__)); -#ifdef CONFIG_WOWLAN - RT_TRACE(_module_hal_init_c_, _drv_notice_, ("+%s, bUsedWoWLANFw:%d\n", __func__, bUsedWoWLANFw)); -#endif pFirmware = kzalloc(sizeof(struct rt_firmware), GFP_KERNEL); if (!pFirmware) return _FAIL; @@ -393,12 +390,7 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool bUsedWoWLANFw) pdbgpriv->dbg_downloadfw_pwr_state_cnt++; } -#ifdef CONFIG_WOWLAN - if (bUsedWoWLANFw) - fwfilepath = "rtlwifi/rtl8723bs_wowlan.bin"; - else -#endif /* CONFIG_WOWLAN */ - fwfilepath = "rtlwifi/rtl8723bs_nic.bin"; + fwfilepath = "rtlwifi/rtl8723bs_nic.bin"; pr_info("rtl8723bs: acquire FW from file:%s\n", fwfilepath); @@ -535,7 +527,7 @@ void rtl8723b_InitializeFirmwareVars(struct adapter *padapter) /* pHalData->H2CStopInsertQueue = false; */ } -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN /* */ /* */ @@ -566,7 +558,7 @@ void SetFwRelatedForWoWLAN8723b( /* */ rtl8723b_InitializeFirmwareVars(padapter); } -#endif /* CONFIG_WOWLAN */ +#endif /* CONFIG_AP_WOWLAN */ static void rtl8723b_free_hal_data(struct adapter *padapter) { @@ -3752,14 +3744,6 @@ void C2HPacketHandler_8723B(struct adapter *padapter, u8 *pbuffer, u16 length) { C2H_EVT_HDR C2hEvent; u8 *tmpBuf = NULL; -#ifdef CONFIG_WOWLAN - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - - if (pwrpriv->wowlan_mode) { - DBG_871X("%s(): return because wowolan_mode ==true! CMDID =%d\n", __func__, pbuffer[0]); - return; - } -#endif C2hEvent.CmdID = pbuffer[0]; C2hEvent.CmdSeq = pbuffer[1]; C2hEvent.CmdLen = length-2; @@ -4314,19 +4298,6 @@ void GetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val) val16 = rtw_read16(padapter, REG_TXPKT_EMPTY); *val = (val16 & BIT(10)) ? true:false; break; -#ifdef CONFIG_WOWLAN - case HW_VAR_RPWM_TOG: - *val = rtw_read8(padapter, SDIO_LOCAL_BASE|SDIO_REG_HRPWM1) & BIT7; - break; - case HW_VAR_WAKEUP_REASON: - *val = rtw_read8(padapter, REG_WOWLAN_WAKE_REASON); - if (*val == 0xEA) - *val = 0; - break; - case HW_VAR_SYS_CLKR: - *val = rtw_read8(padapter, REG_SYS_CLKR); - break; -#endif default: GetHwReg(padapter, variable, val); break; @@ -4461,14 +4432,6 @@ u8 GetHalDefVar8723B(struct adapter *padapter, enum HAL_DEF_VARIABLE variable, v return bResult; } -#ifdef CONFIG_WOWLAN -void Hal_DetectWoWMode(struct adapter *padapter) -{ - adapter_to_pwrctl(padapter)->bSupportRemoteWakeup = true; - DBG_871X("%s\n", __func__); -} -#endif /* CONFIG_WOWLAN */ - void rtl8723b_start_thread(struct adapter *padapter) { #ifndef CONFIG_SDIO_TX_TASKLET diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index ced05bbfc906..47cd3ae63687 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -689,30 +689,6 @@ static u32 rtl8723bs_hal_init(struct adapter *padapter) return _SUCCESS; } -#ifdef CONFIG_WOWLAN - if (rtw_read8(padapter, REG_MCUFWDL) & BIT7) { - u8 reg_val = 0; - DBG_871X("+Reset Entry+\n"); - rtw_write8(padapter, REG_MCUFWDL, 0x00); - _8051Reset8723(padapter); - /* reset BB */ - reg_val = rtw_read8(padapter, REG_SYS_FUNC_EN); - reg_val &= ~(BIT(0) | BIT(1)); - rtw_write8(padapter, REG_SYS_FUNC_EN, reg_val); - /* reset RF */ - rtw_write8(padapter, REG_RF_CTRL, 0); - /* reset TRX path */ - rtw_write16(padapter, REG_CR, 0); - /* reset MAC, Digital Core */ - reg_val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); - reg_val &= ~(BIT(4) | BIT(7)); - rtw_write8(padapter, REG_SYS_FUNC_EN + 1, reg_val); - reg_val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); - reg_val |= BIT(4) | BIT(7); - rtw_write8(padapter, REG_SYS_FUNC_EN + 1, reg_val); - DBG_871X("-Reset Entry-\n"); - } -#endif /* CONFIG_WOWLAN */ /* Disable Interrupt first. */ /* rtw_hal_disable_interrupt(padapter); */ @@ -1228,10 +1204,6 @@ static void _ReadEfuseInfo8723BS(struct adapter *padapter) Hal_EfuseParseVoltage_8723B(padapter, hwinfo, pEEPROM->bautoload_fail_flag); -#ifdef CONFIG_WOWLAN - Hal_DetectWoWMode(padapter); -#endif - Hal_ReadRFGainOffset(padapter, hwinfo, pEEPROM->bautoload_fail_flag); RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("<==== _ReadEfuseInfo8723BS()\n")); @@ -1322,7 +1294,7 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) { u8 val8; -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN struct wowlan_ioctl_param *poidparam; struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); int res; @@ -1330,13 +1302,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) u16 len = 0; u8 trycnt = 100; u32 himr = 0; -#if defined(CONFIG_WOWLAN) - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_info *psta = NULL; - u64 iv_low = 0, iv_high = 0; - u8 mstatus = (*(u8 *)val); -#endif #endif switch (variable) { @@ -1363,206 +1328,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) val8 = *val; break; -#ifdef CONFIG_WOWLAN - case HW_VAR_WOWLAN: - { - poidparam = (struct wowlan_ioctl_param *)val; - switch (poidparam->subcode) { - case WOWLAN_ENABLE: - DBG_871X_LEVEL(_drv_always_, "WOWLAN_ENABLE\n"); - - /* backup data rate to register 0x8b for wowlan FW */ - rtw_write8(padapter, 0x8d, 1); - rtw_write8(padapter, 0x8c, 0); - rtw_write8(padapter, 0x8f, 0x40); - rtw_write8(padapter, 0x8b, - rtw_read8(padapter, 0x2f0)); - - /* 1. Download WOWLAN FW */ - DBG_871X_LEVEL(_drv_always_, "Re-download WoWlan FW!\n"); - SetFwRelatedForWoWLAN8723b(padapter, true); - - /* 2. RX DMA stop */ - DBG_871X_LEVEL(_drv_always_, "Pause DMA\n"); - rtw_write32(padapter, REG_RXPKT_NUM, (rtw_read32(padapter, REG_RXPKT_NUM) | RW_RELEASE_EN)); - do { - if ((rtw_read32(padapter, REG_RXPKT_NUM) & RXDMA_IDLE)) { - DBG_871X_LEVEL(_drv_always_, "RX_DMA_IDLE is true\n"); - break; - } else { - /* If RX_DMA is not idle, receive one pkt from DMA */ - res = sdio_local_read(padapter, SDIO_REG_RX0_REQ_LEN, 4, (u8 *)&tmp); - len = le16_to_cpu(tmp); - DBG_871X_LEVEL(_drv_always_, "RX len:%d\n", len); - if (len > 0) - res = RecvOnePkt(padapter, len); - else - DBG_871X_LEVEL(_drv_always_, "read length fail %d\n", len); - - DBG_871X_LEVEL(_drv_always_, "RecvOnePkt Result: %d\n", res); - } - } while (trycnt--); - if (trycnt == 0) - DBG_871X_LEVEL(_drv_always_, "Stop RX DMA failed......\n"); - - /* 3. Clear IMR and ISR */ - DBG_871X_LEVEL(_drv_always_, "Clear IMR and ISR\n"); - tmp = 0; - sdio_local_write(padapter, SDIO_REG_HIMR_ON, 4, (u8 *)&tmp); - sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - sdio_local_read(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); - sdio_local_write(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); - - /* 4. Enable CPWM2 only */ - DBG_871X_LEVEL(_drv_always_, "Enable only CPWM2\n"); - sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - DBG_871X("DisableInterruptButCpwm28723BSdio(): Read SDIO_REG_HIMR: 0x%08x\n", tmp); - - himr = cpu_to_le32(SDIO_HIMR_DISABLED) | SDIO_HIMR_CPWM2_MSK; - sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&himr); - - sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - DBG_871X("DisableInterruptButCpwm28723BSdio(): Read again SDIO_REG_HIMR: 0x%08x\n", tmp); - - /* 5. Set Enable WOWLAN H2C command. */ - DBG_871X_LEVEL(_drv_always_, "Set Enable WOWLan cmd\n"); - rtl8723b_set_wowlan_cmd(padapter, 1); - - /* 6. Check EnableWoWlan CMD is ready */ - if (!pwrctl->wowlan_pno_enable) { - DBG_871X_LEVEL(_drv_always_, "Check EnableWoWlan CMD is ready\n"); - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - trycnt = 10; - while (!(mstatus & BIT1) && trycnt > 1) { - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - DBG_871X("Loop index: %d :0x%02x\n", trycnt, mstatus); - trycnt--; - msleep(2); - } - } - break; - - case WOWLAN_DISABLE: - DBG_871X_LEVEL(_drv_always_, "WOWLAN_DISABLE\n"); - - psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv)); - if (psta) - rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_DISCONNECT, psta->mac_id); - else - DBG_871X("psta is null\n"); - - /* 1. Read wakeup reason */ - pwrctl->wowlan_wake_reason = rtw_read8(padapter, REG_WOWLAN_WAKE_REASON); - DBG_871X_LEVEL( - _drv_always_, - "wakeup_reason: 0x%02x, mac_630 = 0x%08x, mac_634 = 0x%08x, mac_1c0 = 0x%08x, mac_1c4 = 0x%08x" - ", mac_494 = 0x%08x, , mac_498 = 0x%08x, mac_49c = 0x%08x, mac_608 = 0x%08x, mac_4a0 = 0x%08x, mac_4a4 = 0x%08x\n" - ", mac_1cc = 0x%08x, mac_2f0 = 0x%08x, mac_2f4 = 0x%08x, mac_2f8 = 0x%08x, mac_2fc = 0x%08x, mac_8c = 0x%08x", - pwrctl->wowlan_wake_reason, - rtw_read32(padapter, REG_WOWLAN_GTK_DBG1), - rtw_read32(padapter, REG_WOWLAN_GTK_DBG2), - rtw_read32(padapter, 0x1c0), - rtw_read32(padapter, 0x1c4), - rtw_read32(padapter, 0x494), - rtw_read32(padapter, 0x498), - rtw_read32(padapter, 0x49c), - rtw_read32(padapter, 0x608), - rtw_read32(padapter, 0x4a0), - rtw_read32(padapter, 0x4a4), - rtw_read32(padapter, 0x1cc), - rtw_read32(padapter, 0x2f0), - rtw_read32(padapter, 0x2f4), - rtw_read32(padapter, 0x2f8), - rtw_read32(padapter, 0x2fc), - rtw_read32(padapter, 0x8c) - ); - - { - /* 2. Set Disable WOWLAN H2C command. */ - DBG_871X_LEVEL(_drv_always_, "Set Disable WOWLan cmd\n"); - rtl8723b_set_wowlan_cmd(padapter, 0); - - /* 3. Check Disable WoWlan CMD ready. */ - DBG_871X_LEVEL(_drv_always_, "Check DisableWoWlan CMD is ready\n"); - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - trycnt = 50; - while (mstatus & BIT1 && trycnt > 1) { - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - DBG_871X_LEVEL(_drv_always_, "Loop index: %d :0x%02x\n", trycnt, mstatus); - trycnt--; - msleep(10); - } - - if (mstatus & BIT1) { - DBG_871X_LEVEL(_drv_always_, "Disable WOW mode fail!!\n"); - DBG_871X("Set 0x690 = 0x00\n"); - rtw_write8(padapter, REG_WOW_CTRL, (rtw_read8(padapter, REG_WOW_CTRL) & 0xf0)); - DBG_871X_LEVEL(_drv_always_, "Release RXDMA\n"); - rtw_write32(padapter, REG_RXPKT_NUM, (rtw_read32(padapter, REG_RXPKT_NUM) & (~RW_RELEASE_EN))); - } - - /* 3.1 read fw iv */ - iv_low = rtw_read32(padapter, REG_TXPKTBUF_IV_LOW); - /* only low two bytes is PN, check AES_IV macro for detail */ - iv_low &= 0xffff; - iv_high = rtw_read32(padapter, REG_TXPKTBUF_IV_HIGH); - /* get the real packet number */ - pwrctl->wowlan_fw_iv = iv_high << 16 | iv_low; - DBG_871X_LEVEL(_drv_always_, "fw_iv: 0x%016llx\n", pwrctl->wowlan_fw_iv); - /* Update TX iv data. */ - rtw_set_sec_pn(padapter); - - /* 3.2 read GTK index and key */ - if ( - psecuritypriv->binstallKCK_KEK == true && - psecuritypriv->dot11PrivacyAlgrthm == _AES_ - ) { - u8 gtk_keyindex = 0; - u8 get_key[16]; - /* read gtk key index */ - gtk_keyindex = rtw_read8(padapter, 0x48c); - - if (gtk_keyindex < 4) { - psecuritypriv->dot118021XGrpKeyid = gtk_keyindex; - read_cam(padapter, gtk_keyindex, get_key); - memcpy(psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, get_key, 16); - DBG_871X_LEVEL( - _drv_always_, - "GTK (%d) = 0x%08x, 0x%08x, 0x%08x, 0x%08x\n", - gtk_keyindex, - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[0], - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[1], - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[2], - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[3] - ); - } else - DBG_871X_LEVEL(_drv_always_, "GTK index =%d\n", gtk_keyindex); - } - - /* 4. Re-download Normal FW. */ - DBG_871X_LEVEL(_drv_always_, "Re-download Normal FW!\n"); - SetFwRelatedForWoWLAN8723b(padapter, false); - } - - /* 5. Download reserved pages and report media status if needed. */ - if ( - (pwrctl->wowlan_wake_reason != FWDecisionDisconnect) && - (pwrctl->wowlan_wake_reason != Rx_Pairwisekey) && - (pwrctl->wowlan_wake_reason != Rx_DisAssoc) && - (pwrctl->wowlan_wake_reason != Rx_DeAuth) - ) { - rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); - if (psta) - rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); - } - break; - - default: - break; - } - } - break; -#endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN case HW_VAR_AP_WOWLAN: { @@ -1765,9 +1530,6 @@ void rtl8723bs_set_hal_ops(struct adapter *padapter) pHalFunc->enable_interrupt = &EnableInterrupt8723BSdio; pHalFunc->disable_interrupt = &DisableInterrupt8723BSdio; pHalFunc->check_ips_status = &CheckIPSStatus; -#ifdef CONFIG_WOWLAN - pHalFunc->clear_interrupt = &ClearInterrupt8723BSdio; -#endif pHalFunc->SetHwRegHandler = &SetHwReg8723BS; pHalFunc->GetHwRegHandler = &GetHwReg8723BS; pHalFunc->SetHwRegHandlerWithBuf = &SetHwRegWithBuf8723B; diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c index 369f55d11519..2400b06dff36 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_ops.c +++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c @@ -1114,7 +1114,7 @@ void HalQueryTxOQTBufferStatus8723BSdio(struct adapter *adapter) haldata->SdioTxOQTFreeSpace = SdioLocalCmd52Read1Byte(adapter, SDIO_REG_OQT_FREE_PG); } -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN u8 RecvOnePkt(struct adapter *adapter, u32 size) { struct recv_buf *recvbuf; @@ -1149,4 +1149,4 @@ u8 RecvOnePkt(struct adapter *adapter, u32 size) DBG_871X("-%s-\n", __func__); return res; } -#endif /* CONFIG_WOWLAN */ +#endif /* CONFIG_AP_WOWLAN */ diff --git a/drivers/staging/rtl8723bs/include/autoconf.h b/drivers/staging/rtl8723bs/include/autoconf.h index 86cf09ca5f06..996198750814 100644 --- a/drivers/staging/rtl8723bs/include/autoconf.h +++ b/drivers/staging/rtl8723bs/include/autoconf.h @@ -40,9 +40,6 @@ * Platform dependent */ #define WAKEUP_GPIO_IDX 12 /* WIFI Chip Side */ -#ifdef CONFIG_WOWLAN -#define CONFIG_GTK_OL -#endif /* CONFIG_WOWLAN */ /* * Debug Related Config diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h index cfde6e3ba400..998c8dc230eb 100644 --- a/drivers/staging/rtl8723bs/include/drv_types.h +++ b/drivers/staging/rtl8723bs/include/drv_types.h @@ -534,11 +534,6 @@ int rtw_set_gpio_output_value(struct net_device *netdev, int gpio_num, bool isHi int rtw_config_gpio(struct net_device *netdev, int gpio_num, bool isOutput); #endif -#ifdef CONFIG_WOWLAN -void rtw_suspend_wow(struct adapter *padapter); -int rtw_resume_process_wow(struct adapter *padapter); -#endif - static inline u8 *myid(struct eeprom_priv *peepriv) { return peepriv->mac_addr; diff --git a/drivers/staging/rtl8723bs/include/drv_types_sdio.h b/drivers/staging/rtl8723bs/include/drv_types_sdio.h index 5e079838f59c..83f5e912baa7 100644 --- a/drivers/staging/rtl8723bs/include/drv_types_sdio.h +++ b/drivers/staging/rtl8723bs/include/drv_types_sdio.h @@ -11,7 +11,7 @@ #include #include -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN #include #include #endif diff --git a/drivers/staging/rtl8723bs/include/hal_com_h2c.h b/drivers/staging/rtl8723bs/include/hal_com_h2c.h index 1f7ed90f9faa..6b8ec01ddc6a 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_h2c.h +++ b/drivers/staging/rtl8723bs/include/hal_com_h2c.h @@ -95,60 +95,6 @@ enum h2c_cmd { #define H2C_BCN_RSVDPAGE_LEN 5 #define H2C_PROBERSP_RSVDPAGE_LEN 5 -#ifdef CONFIG_WOWLAN -#define eqMacAddr(a, b) (((a)[0] == (b)[0] && (a)[1] == (b)[1] && (a)[2] == (b)[2] && (a)[3] == (b)[3] && (a)[4] == (b)[4] && (a)[5] == (b)[5]) ? 1 : 0) -#define cpMacAddr(des, src) ((des)[0] = (src)[0], (des)[1] = (src)[1], (des)[2] = (src)[2], (des)[3] = (src)[3], (des)[4] = (src)[4], (des)[5] = (src)[5]) -#define cpIpAddr(des, src) ((des)[0] = (src)[0], (des)[1] = (src)[1], (des)[2] = (src)[2], (des)[3] = (src)[3]) - -/* */ -/* ARP packet */ -/* */ -/* LLC Header */ -#define GET_ARP_PKT_LLC_TYPE(__pHeader) ReadEF2Byte(((u8 *)(__pHeader)) + 6) - -/* ARP element */ -#define GET_ARP_PKT_OPERATION(__pHeader) ReadEF2Byte(((u8 *)(__pHeader)) + 6) -#define GET_ARP_PKT_SENDER_MAC_ADDR(__pHeader, _val) cpMacAddr((u8 *)(_val), ((u8 *)(__pHeader))+8) -#define GET_ARP_PKT_SENDER_IP_ADDR(__pHeader, _val) cpIpAddr((u8 *)(_val), ((u8 *)(__pHeader))+14) -#define GET_ARP_PKT_TARGET_MAC_ADDR(__pHeader, _val) cpMacAddr((u8 *)(_val), ((u8 *)(__pHeader))+18) -#define GET_ARP_PKT_TARGET_IP_ADDR(__pHeader, _val) cpIpAddr((u8 *)(_val), ((u8 *)(__pHeader))+24) - -#define SET_ARP_PKT_HW(__pHeader, __Value) WRITEEF2BYTE(((u8 *)(__pHeader)) + 0, __Value) -#define SET_ARP_PKT_PROTOCOL(__pHeader, __Value) WRITEEF2BYTE(((u8 *)(__pHeader)) + 2, __Value) -#define SET_ARP_PKT_HW_ADDR_LEN(__pHeader, __Value) WRITEEF1BYTE(((u8 *)(__pHeader)) + 4, __Value) -#define SET_ARP_PKT_PROTOCOL_ADDR_LEN(__pHeader, __Value) WRITEEF1BYTE(((u8 *)(__pHeader)) + 5, __Value) -#define SET_ARP_PKT_OPERATION(__pHeader, __Value) WRITEEF2BYTE(((u8 *)(__pHeader)) + 6, __Value) -#define SET_ARP_PKT_SENDER_MAC_ADDR(__pHeader, _val) cpMacAddr(((u8 *)(__pHeader))+8, (u8 *)(_val)) -#define SET_ARP_PKT_SENDER_IP_ADDR(__pHeader, _val) cpIpAddr(((u8 *)(__pHeader))+14, (u8 *)(_val)) -#define SET_ARP_PKT_TARGET_MAC_ADDR(__pHeader, _val) cpMacAddr(((u8 *)(__pHeader))+18, (u8 *)(_val)) -#define SET_ARP_PKT_TARGET_IP_ADDR(__pHeader, _val) cpIpAddr(((u8 *)(__pHeader))+24, (u8 *)(_val)) - -#define FW_WOWLAN_FUN_EN BIT(0) -#define FW_WOWLAN_PATTERN_MATCH BIT(1) -#define FW_WOWLAN_MAGIC_PKT BIT(2) -#define FW_WOWLAN_UNICAST BIT(3) -#define FW_WOWLAN_ALL_PKT_DROP BIT(4) -#define FW_WOWLAN_GPIO_ACTIVE BIT(5) -#define FW_WOWLAN_REKEY_WAKEUP BIT(6) -#define FW_WOWLAN_DEAUTH_WAKEUP BIT(7) - -#define FW_WOWLAN_GPIO_WAKEUP_EN BIT(0) -#define FW_FW_PARSE_MAGIC_PKT BIT(1) - -#define FW_REMOTE_WAKE_CTRL_EN BIT(0) -#define FW_REALWOWLAN_EN BIT(5) - -#define FW_WOWLAN_KEEP_ALIVE_EN BIT(0) -#define FW_ADOPT_USER BIT(1) -#define FW_WOWLAN_KEEP_ALIVE_PKT_TYPE BIT(2) - -#define FW_REMOTE_WAKE_CTRL_EN BIT(0) -#define FW_ARP_EN BIT(1) -#define FW_REALWOWLAN_EN BIT(5) -#define FW_WOW_FW_UNICAST_EN BIT(7) - -#endif /* CONFIG_WOWLAN */ - /* _RSVDPAGE_LOC_CMD_0x00 */ #define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd, 0, 8, __Value) #define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+1, 0, 8, __Value) @@ -230,9 +176,6 @@ enum h2c_cmd { #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_NEIGHBOR_ADV(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+2, 0, 8, __Value) #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_RSP(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+3, 0, 8, __Value) #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+4, 0, 8, __Value) -#ifdef CONFIG_GTK_OL -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+5, 0, 8, __Value) -#endif /* CONFIG_GTK_OL */ /* */ /* Structure -------------------------------------------------- */ @@ -243,25 +186,13 @@ typedef struct _RSVDPAGE_LOC { u8 LocNullData; u8 LocQosNull; u8 LocBTQosNull; -#ifdef CONFIG_WOWLAN - u8 LocRemoteCtrlInfo; - u8 LocArpRsp; - u8 LocNbrAdv; - u8 LocGTKRsp; - u8 LocGTKInfo; - u8 LocProbeReq; - u8 LocNetList; -#ifdef CONFIG_GTK_OL - u8 LocGTKEXTMEM; -#endif /* CONFIG_GTK_OL */ -#endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN u8 LocApOffloadBCN; #endif /* CONFIG_AP_WOWLAN */ } RSVDPAGE_LOC, *PRSVDPAGE_LOC; #endif -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip); void rtw_get_sec_iv(struct adapter *padapter, u8*pcur_dot11txpn, u8 *StaAddr); void rtw_set_sec_pn(struct adapter *padapter); diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h index 426c8d58c444..093e00b9349b 100644 --- a/drivers/staging/rtl8723bs/include/hal_intf.h +++ b/drivers/staging/rtl8723bs/include/hal_intf.h @@ -85,11 +85,6 @@ enum HW_VARIABLES { HW_VAR_APFM_ON_MAC, /* Auto FSM to Turn On, include clock, isolation, power control for MAC only */ /* The valid upper nav range for the HW updating, if the true value is larger than the upper range, the HW won't update it. */ /* Unit in microsecond. 0 means disable this function. */ -#ifdef CONFIG_WOWLAN - HW_VAR_WOWLAN, - HW_VAR_WAKEUP_REASON, - HW_VAR_RPWM_TOG, -#endif #ifdef CONFIG_AP_WOWLAN HW_VAR_AP_WOWLAN, #endif diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h b/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h index 3bfb0e9be582..b85e67ccc7db 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h @@ -177,11 +177,11 @@ void rtl8723b_download_BTCoex_AP_mode_rsvd_page(struct adapter *padapter); void CheckFwRsvdPageContent(struct adapter *padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN void rtl8723b_set_wowlan_cmd(struct adapter *padapter, u8 enable); void rtl8723b_set_ap_wowlan_cmd(struct adapter *padapter, u8 enable); void SetFwRelatedForWoWLAN8723b(struct adapter *padapter, u8 bHostIsGoingtoSleep); -#endif/* CONFIG_WOWLAN */ +#endif void rtl8723b_set_FwPwrModeInIPS_cmd(struct adapter *padapter, u8 cmd_param); diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index 2537bd7d6a13..819594616e38 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -96,11 +96,7 @@ struct rt_firmware_hdr { /* For WoWLan, more reserved page */ /* ARP Rsp:1, RWC:1, GTK Info:1, GTK RSP:2, GTK EXT MEM:2, PNO: 6 */ -#ifdef CONFIG_WOWLAN -#define WOWLAN_PAGE_NUM_8723B 0x07 -#else #define WOWLAN_PAGE_NUM_8723B 0x00 -#endif #ifdef CONFIG_AP_WOWLAN #define AP_WOWLAN_PAGE_NUM_8723B 0x02 @@ -244,9 +240,6 @@ u8 GetHalDefVar8723B(struct adapter *padapter, enum HAL_DEF_VARIABLE variable, void rtl8723b_InitBeaconParameters(struct adapter *padapter); void _InitBurstPktLen_8723BS(struct adapter *adapter); void _8051Reset8723(struct adapter *padapter); -#ifdef CONFIG_WOWLAN -void Hal_DetectWoWMode(struct adapter *padapter); -#endif /* CONFIG_WOWLAN */ void rtl8723b_start_thread(struct adapter *padapter); void rtl8723b_stop_thread(struct adapter *padapter); diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h index 9149fe598545..999555476ebc 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h @@ -96,10 +96,6 @@ #define REG_TXPKTBUF_BCNQ_BDNY_8723B 0x0424 #define REG_TXPKTBUF_MGQ_BDNY_8723B 0x0425 #define REG_TXPKTBUF_WMAC_LBK_BF_HD_8723B 0x045D -#ifdef CONFIG_WOWLAN -#define REG_TXPKTBUF_IV_LOW 0x0484 -#define REG_TXPKTBUF_IV_HIGH 0x0488 -#endif #define REG_AMPDU_BURST_MODE_8723B 0x04BC /* */ @@ -164,12 +160,6 @@ #define BIT_USB_RXDMA_AGG_EN BIT(31) #define RXDMA_AGG_MODE_EN BIT(1) -#ifdef CONFIG_WOWLAN -#define RXPKT_RELEASE_POLL BIT(16) -#define RXDMA_IDLE BIT(17) -#define RW_RELEASE_EN BIT(18) -#endif - /* */ /* */ /* 0x0400h ~ 0x047Fh Protocol Configuration */ diff --git a/drivers/staging/rtl8723bs/include/rtw_mp.h b/drivers/staging/rtl8723bs/include/rtw_mp.h index 2ea7100c3a4c..2de0b50bbfc5 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mp.h +++ b/drivers/staging/rtl8723bs/include/rtw_mp.h @@ -189,9 +189,6 @@ enum { CTA_TEST, MP_DISABLE_BT_COEXIST, MP_PwrCtlDM, -#ifdef CONFIG_WOWLAN - MP_WOW_ENABLE, -#endif #ifdef CONFIG_AP_WOWLAN MP_AP_WOW_ENABLE, #endif diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h index f467e9032450..334642b8cff9 100644 --- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h @@ -220,15 +220,6 @@ struct pwrctrl_priv { u8 wowlan_wake_reason; u8 wowlan_ap_mode; u8 wowlan_mode; -#ifdef CONFIG_WOWLAN - u8 wowlan_pattern; - u8 wowlan_magic; - u8 wowlan_unicast; - u8 wowlan_pattern_idx; - u8 wowlan_pno_enable; - u32 wowlan_pattern_context[8][5]; - u64 wowlan_fw_iv; -#endif /* CONFIG_WOWLAN */ _timer pwr_state_check_timer; struct adapter *adapter; int pwr_state_check_interval; diff --git a/drivers/staging/rtl8723bs/include/rtw_security.h b/drivers/staging/rtl8723bs/include/rtw_security.h index 85ffd4ec4ce5..ec033767fc45 100644 --- a/drivers/staging/rtl8723bs/include/rtw_security.h +++ b/drivers/staging/rtl8723bs/include/rtw_security.h @@ -129,9 +129,6 @@ struct security_priv { u8 binstallGrpkey; -#ifdef CONFIG_GTK_OL - u8 binstallKCK_KEK; -#endif /* CONFIG_GTK_OL */ u8 binstallBIPkey; u8 busetkipkey; /* _timer tkip_timer; */ diff --git a/drivers/staging/rtl8723bs/include/sdio_ops.h b/drivers/staging/rtl8723bs/include/sdio_ops.h index 6b0446be6d19..1f1f368cded4 100644 --- a/drivers/staging/rtl8723bs/include/sdio_ops.h +++ b/drivers/staging/rtl8723bs/include/sdio_ops.h @@ -25,17 +25,17 @@ s32 _sdio_write32(struct adapter *padapter, u32 addr, u32 val); extern void sd_int_hdl(struct adapter *padapter); extern u8 CheckIPSStatus(struct adapter *padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN extern u8 RecvOnePkt(struct adapter *padapter, u32 size); -#endif /* CONFIG_WOWLAN */ +#endif extern void InitInterrupt8723BSdio(struct adapter *padapter); extern void InitSysInterrupt8723BSdio(struct adapter *padapter); extern void EnableInterrupt8723BSdio(struct adapter *padapter); extern void DisableInterrupt8723BSdio(struct adapter *padapter); extern u8 HalQueryTxBufferStatus8723BSdio(struct adapter *padapter); extern void HalQueryTxOQTBufferStatus8723BSdio(struct adapter *padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN extern void ClearInterrupt8723BSdio(struct adapter *padapter); -#endif /* CONFIG_WOWLAN */ +#endif #endif /* !__SDIO_OPS_H__ */ diff --git a/drivers/staging/rtl8723bs/include/sta_info.h b/drivers/staging/rtl8723bs/include/sta_info.h index 734f4e2ecd66..fff0bed1233b 100644 --- a/drivers/staging/rtl8723bs/include/sta_info.h +++ b/drivers/staging/rtl8723bs/include/sta_info.h @@ -92,11 +92,6 @@ struct sta_info { union Keytype dot11tkiprxmickey; union Keytype dot118021x_UncstKey; union pn48 dot11txpn; /* PN48 used for Unicast xmit */ -#ifdef CONFIG_GTK_OL - u8 kek[RTW_KEK_LEN]; - u8 kck[RTW_KCK_LEN]; - u8 replay_ctr[RTW_REPLAY_CTR_LEN]; -#endif /* CONFIG_GTK_OL */ union pn48 dot11wtxpn; /* PN48 used for Unicast mgmt xmit. */ union pn48 dot11rxpn; /* PN48 used for Unicast recv. */ diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index 78ba2423ed65..f4b99c6b82ad 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -4669,9 +4669,6 @@ static const struct iw_priv_args rtw_private_args[] = { IW_PRIV_TYPE_CHAR | 40, IW_PRIV_TYPE_CHAR | 0x7FF, "test" }, -#ifdef CONFIG_WOWLAN - { MP_WOW_ENABLE, IW_PRIV_TYPE_CHAR | 1024, 0, "wow_mode" }, /* set */ -#endif #ifdef CONFIG_AP_WOWLAN { MP_AP_WOW_ENABLE, IW_PRIV_TYPE_CHAR | 1024, 0, "ap_wow_mode" }, /* set */ #endif diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index 61488781d211..2c0df0db6419 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -596,9 +596,6 @@ static void rtw_init_default_value(struct adapter *padapter) /* security_priv */ /* rtw_get_encrypt_decrypt_from_registrypriv(padapter); */ psecuritypriv->binstallGrpkey = _FAIL; -#ifdef CONFIG_GTK_OL - psecuritypriv->binstallKCK_KEK = _FAIL; -#endif /* CONFIG_GTK_OL */ psecuritypriv->sw_encrypt = pregistrypriv->software_encrypt; psecuritypriv->sw_decrypt = pregistrypriv->software_decrypt; @@ -1174,16 +1171,10 @@ void rtw_dev_unload(struct adapter *padapter) if (!padapter->bSurpriseRemoved) { hal_btcoex_IpsNotify(padapter, pwrctl->ips_mode_req); -#ifdef CONFIG_WOWLAN - if (pwrctl->bSupportRemoteWakeup && pwrctl->wowlan_mode) { - DBG_871X_LEVEL(_drv_always_, "%s bSupportRemoteWakeup ==true do not run rtw_hal_deinit()\n", __func__); - } - else -#endif - { - /* amy modify 20120221 for power seq is different between driver open and ips */ - rtw_hal_deinit(padapter); - } + + /* amy modify 20120221 for power seq is different between driver open and ips */ + rtw_hal_deinit(padapter); + padapter->bSurpriseRemoved = true; } RT_TRACE(_module_hci_intfs_c_, _drv_notice_, @@ -1244,81 +1235,6 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) return _SUCCESS; } -#ifdef CONFIG_WOWLAN -void rtw_suspend_wow(struct adapter *padapter) -{ - u8 ch, bw, offset; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct net_device *pnetdev = padapter->pnetdev; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct wowlan_ioctl_param poidparam; - - DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); - - - DBG_871X("wowlan_mode: %d\n", pwrpriv->wowlan_mode); - DBG_871X("wowlan_pno_enable: %d\n", pwrpriv->wowlan_pno_enable); - - if (pwrpriv->wowlan_mode) { - if (pnetdev) - rtw_netif_stop_queue(pnetdev); - /* 1. stop thread */ - padapter->bDriverStopped = true; /* for stop thread */ - rtw_stop_drv_threads(padapter); - padapter->bDriverStopped = false; /* for 32k command */ - - /* 2. disable interrupt */ - if (padapter->intf_stop) - padapter->intf_stop(padapter); - - /* 2.1 clean interrupt */ - if (padapter->HalFunc.clear_interrupt) - padapter->HalFunc.clear_interrupt(padapter); - - /* 2.2 free irq */ - /* sdio_free_irq(adapter_to_dvobj(padapter)); */ - if (padapter->intf_free_irq) - padapter->intf_free_irq(adapter_to_dvobj(padapter)); - - poidparam.subcode = WOWLAN_ENABLE; - padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_WOWLAN, (u8 *)&poidparam); - if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) { - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)) { - DBG_871X("%s %s(%pM), length:%d assoc_ssid.length:%d\n", __func__, - pmlmepriv->cur_network.network.Ssid.Ssid, - MAC_ARG(pmlmepriv->cur_network.network.MacAddress), - pmlmepriv->cur_network.network.Ssid.SsidLength, - pmlmepriv->assoc_ssid.SsidLength); - - rtw_set_to_roam(padapter, 0); - } - } - - DBG_871X_LEVEL(_drv_always_, "%s: wowmode suspending\n", __func__); - - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) { - DBG_871X_LEVEL(_drv_always_, "%s: fw_under_survey\n", __func__); - rtw_indicate_scan_done(padapter, 1); - clr_fwstate(pmlmepriv, _FW_UNDER_SURVEY); - } - - if (rtw_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) { - DBG_871X(FUNC_ADPT_FMT " back to linked/linking union - ch:%u, bw:%u, offset:%u\n", - FUNC_ADPT_ARG(padapter), ch, bw, offset); - set_channel_bwmode(padapter, ch, offset, bw); - } - - if (pwrpriv->wowlan_pno_enable) - DBG_871X_LEVEL(_drv_always_, "%s: pno: %d\n", __func__, pwrpriv->wowlan_pno_enable); - else - rtw_set_ps_mode(padapter, PS_MODE_DTIM, 0, 0, "WOWLAN"); - } else { - DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode =%d\n", __func__, pwrpriv->wowlan_mode); - } - DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); -} -#endif /* ifdef CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN void rtw_suspend_ap_wow(struct adapter *padapter) { @@ -1440,20 +1356,7 @@ int rtw_suspend_common(struct adapter *padapter) rtw_ps_deny_cancel(padapter, PS_DENY_SUSPEND); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { - #ifdef CONFIG_WOWLAN - if (check_fwstate(pmlmepriv, _FW_LINKED)) - pwrpriv->wowlan_mode = true; - else if (pwrpriv->wowlan_pno_enable) - pwrpriv->wowlan_mode |= pwrpriv->wowlan_pno_enable; - - if (pwrpriv->wowlan_mode) - rtw_suspend_wow(padapter); - else - rtw_suspend_normal(padapter); - - #else /* CONFIG_WOWLAN */ rtw_suspend_normal(padapter); - #endif /* CONFIG_WOWLAN */ } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { #ifdef CONFIG_AP_WOWLAN rtw_suspend_ap_wow(padapter); @@ -1474,124 +1377,6 @@ int rtw_suspend_common(struct adapter *padapter) return ret; } -#ifdef CONFIG_WOWLAN -int rtw_resume_process_wow(struct adapter *padapter) -{ - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct net_device *pnetdev = padapter->pnetdev; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct dvobj_priv *psdpriv = padapter->dvobj; - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; - struct wowlan_ioctl_param poidparam; - struct sta_info *psta = NULL; - int ret = _SUCCESS; - - DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); - - if (padapter) { - pnetdev = padapter->pnetdev; - pwrpriv = adapter_to_pwrctl(padapter); - } else { - pdbgpriv->dbg_resume_error_cnt++; - ret = -1; - goto exit; - } - - if (padapter->bDriverStopped || padapter->bSurpriseRemoved) { - DBG_871X("%s pdapter %p bDriverStopped %d bSurpriseRemoved %d\n", - __func__, padapter, padapter->bDriverStopped, - padapter->bSurpriseRemoved); - goto exit; - } - - if (pwrpriv->wowlan_mode) { - rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN"); - - pwrpriv->bFwCurrentInPSMode = false; - - if (padapter->intf_stop) - padapter->intf_stop(padapter); - - if (padapter->HalFunc.clear_interrupt) - padapter->HalFunc.clear_interrupt(padapter); - - /* if (sdio_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS) { */ - if ((padapter->intf_alloc_irq) && (padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS)) { - ret = -1; - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("%s: sdio_alloc_irq Failed!!\n", __func__)); - goto exit; - } - - /* Disable WOW, set H2C command */ - poidparam.subcode = WOWLAN_DISABLE; - padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_WOWLAN, (u8 *)&poidparam); - - psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv)); - if (psta) - set_sta_rate(padapter, psta); - - padapter->bDriverStopped = false; - DBG_871X("%s: wowmode resuming, DriverStopped:%d\n", __func__, padapter->bDriverStopped); - rtw_start_drv_threads(padapter); - - if (padapter->intf_start) - padapter->intf_start(padapter); - - /* start netif queue */ - if (pnetdev) { - if (!rtw_netif_queue_stopped(pnetdev)) - rtw_netif_start_queue(pnetdev); - else - rtw_netif_wake_queue(pnetdev); - } - } else { - DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode =%d\n", __func__, pwrpriv->wowlan_mode); - } - - if (padapter->pid[1] != 0) { - DBG_871X("pid[1]:%d\n", padapter->pid[1]); - rtw_signal_process(padapter->pid[1], SIGUSR2); - } - - if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) { - if (pwrpriv->wowlan_wake_reason == FWDecisionDisconnect || - pwrpriv->wowlan_wake_reason == Rx_DisAssoc || - pwrpriv->wowlan_wake_reason == Rx_DeAuth) { - DBG_871X("%s: disconnect reason: %02x\n", __func__, - pwrpriv->wowlan_wake_reason); - rtw_indicate_disconnect(padapter); - - rtw_sta_media_status_rpt(padapter, - rtw_get_stainfo(&padapter->stapriv, - get_bssid(&padapter->mlmepriv)), 0); - - rtw_free_assoc_resources(padapter, 1); - pmlmeinfo->state = WIFI_FW_NULL_STATE; - - } else { - DBG_871X("%s: do roaming\n", __func__); - rtw_roaming(padapter, NULL); - } - } - - if (pwrpriv->wowlan_mode) { - pwrpriv->bips_processing = false; - _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); - } else { - DBG_871X_LEVEL(_drv_always_, "do not reset timer\n"); - } - - pwrpriv->wowlan_mode = false; - - /* clean driver side wake up reason. */ - pwrpriv->wowlan_wake_reason = 0; -exit: - DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); - return ret; -} -#endif /* ifdef CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN int rtw_resume_process_ap_wow(struct adapter *padapter) { @@ -1753,15 +1538,7 @@ int rtw_resume_common(struct adapter *padapter) DBG_871X("==> %s (%s:%d)\n", __func__, current->comm, current->pid); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { - #ifdef CONFIG_WOWLAN - if (pwrpriv->wowlan_mode) - rtw_resume_process_wow(padapter); - else - rtw_resume_process_normal(padapter); - #else rtw_resume_process_normal(padapter); - #endif - } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { #ifdef CONFIG_AP_WOWLAN rtw_resume_process_ap_wow(padapter); diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c index 079e75164f1e..8f8549eee23e 100644 --- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c +++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c @@ -377,11 +377,6 @@ static void rtw_sdio_if1_deinit(struct adapter *if1) rtw_cancel_all_timer(if1); -#ifdef CONFIG_WOWLAN - adapter_to_pwrctl(if1)->wowlan_mode = false; - DBG_871X_LEVEL(_drv_always_, "%s wowlan_mode:%d\n", __func__, adapter_to_pwrctl(if1)->wowlan_mode); -#endif /* CONFIG_WOWLAN */ - rtw_dev_unload(if1); DBG_871X("+r871xu_dev_remove, hw_init_completed =%d\n", if1->hw_init_completed); -- 2.20.1 From florian at floriancentrum.com.pl Thu Mar 11 19:21:00 2021 From: florian at floriancentrum.com.pl (Robert SONNE) Date: 11 Mar 2021 20:21:00 +0100 Subject: Bonjour, Message-ID: <20210311202100.059D66FAAB2F01D6@floriancentrum.com.pl> Re : Bonjour, Je me pr?sente Monsieur Robert SONNE, je vous contacte suite ? un don que je veux vous offrir, il s?agit d?une somme d'argent de (1.425.000 euros) que je vous donne du fond de mon c?ur ; car mes jours sont compt?s sur cette terre et je n'ai pas de famille ni d'enfant pour h?riter ces fonds. Pour plus de renseignements, je vous prie de bien vouloir me contacter ? mon adresse ?mail personnel : robertsonne at orange.fr Cordialement, Robert SONNE From fabioaiuto83 at gmail.com Fri Mar 12 16:10:01 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Fri, 12 Mar 2021 17:10:01 +0100 Subject: [PATCH 3/3] staging: rtl8723bs: remove unused code blocks In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_TCP_CSUM_OFFLOAD_RX cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/include/rtw_recv.h | 5 ----- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 8 -------- 2 files changed, 13 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h index b4aeb44d5d6e..078854a55a31 100644 --- a/drivers/staging/rtl8723bs/include/rtw_recv.h +++ b/drivers/staging/rtl8723bs/include/rtw_recv.h @@ -159,11 +159,6 @@ struct rx_pkt_attrib { u8 ack_policy; -/* ifdef CONFIG_TCP_CSUM_OFFLOAD_RX */ - u8 tcpchk_valid; /* 0: invalid, 1: valid */ - u8 ip_chkrpt; /* 0: incorrect, 1: correct */ - u8 tcp_chkrpt; /* 0: incorrect, 1: correct */ -/* endif */ u8 key_index; u8 data_rate; diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c index f52802f24466..78d5b6913467 100644 --- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c @@ -138,15 +138,7 @@ void rtw_os_recv_indicate_pkt(struct adapter *padapter, _pkt *pkt, struct rx_pkt pkt->protocol = eth_type_trans(pkt, padapter->pnetdev); pkt->dev = padapter->pnetdev; -#ifdef CONFIG_TCP_CSUM_OFFLOAD_RX - if ((pattrib->tcpchk_valid == 1) && (pattrib->tcp_chkrpt == 1)) - pkt->ip_summed = CHECKSUM_UNNECESSARY; - else - pkt->ip_summed = CHECKSUM_NONE; - -#else /* !CONFIG_TCP_CSUM_OFFLOAD_RX */ pkt->ip_summed = CHECKSUM_NONE; -#endif /* CONFIG_TCP_CSUM_OFFLOAD_RX */ ret = rtw_netif_rx(padapter->pnetdev, pkt); } -- 2.20.1 From gregkh at linuxfoundation.org Fri Mar 12 16:17:49 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Fri, 12 Mar 2021 17:17:49 +0100 Subject: [PATCH 0/3] staging: rtl8723bs: remove unused code blocks In-Reply-To: References: Message-ID: On Fri, Mar 12, 2021 at 04:49:40PM +0100, Fabio Aiuto wrote: > This patch set removes unused code blocks as required in > TODO file: > > find and remove code blocks guarded by never set CONFIG_FOO defines > > Fabio Aiuto (3): > staging: rtl8723bs: remove unused code blocks > staging: rtl8723bs: remove unused code blocks > staging: rtl8723bs: remove unused code blocks You sent 3 patches that did different things, yet had identical subject lines :( Please fix up and make them unique. thanks, greg k-h From gregkh at linuxfoundation.org Fri Mar 12 16:25:32 2021 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Fri, 12 Mar 2021 17:25:32 +0100 Subject: [PATCHSET] remove 153 useless typedefs in staging/rtl8723bs In-Reply-To: <20210312082638.25512-1-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> Message-ID: On Fri, Mar 12, 2021 at 09:26:05AM +0100, Marco Cesati wrote: > This set of patches remove 153 useless typedef instructions in the > staging/rtl8723bs source code, as identified by the checkpatch.pl > script. Every patch is purely syntactical: it does not change the > generated machine code. Furthermore, every single patch leaves the > source code fully compilable, so that 'git bisect' will not be affected. I'll take these, but can you now clean up the ALL_CAPS structure names that this patch series creates? thanks, greg k-h From gregkh at linuxfoundation.org Fri Mar 12 16:26:51 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Fri, 12 Mar 2021 17:26:51 +0100 Subject: [PATCH] Staging: rtl8723bs/core: fix coding style issue In-Reply-To: <20210310113503.1352-1-guolongji@uniontech.com> References: <20210310113503.1352-1-guolongji@uniontech.com> Message-ID: On Wed, Mar 10, 2021 at 07:35:03PM +0800, Longji Guo wrote: > Move operators and spaces before tabs to fix coding style issues. This change doesn't have anything to do with tabs. confused, greg k-h From rdunlap at infradead.org Fri Mar 12 16:42:55 2021 From: rdunlap at infradead.org (Randy Dunlap) Date: Fri, 12 Mar 2021 08:42:55 -0800 Subject: [PATCH] staging: wimax: i2400m: Mundane typos fix in the file tx.c In-Reply-To: <20210312114207.3624-1-unixbhaskar@gmail.com> References: <20210312114207.3624-1-unixbhaskar@gmail.com> Message-ID: On 3/12/21 3:42 AM, Bhaskar Chowdhury wrote: > > s/exahusted/exhausted/ > s/caleed/called/ > > Signed-off-by: Bhaskar Chowdhury Acked-by: Randy Dunlap > --- > drivers/staging/wimax/i2400m/tx.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/wimax/i2400m/tx.c b/drivers/staging/wimax/i2400m/tx.c > index e9436212fe54..2d15de653951 100644 > --- a/drivers/staging/wimax/i2400m/tx.c > +++ b/drivers/staging/wimax/i2400m/tx.c > @@ -85,7 +85,7 @@ > * can keep adding payloads to it. > * > * Closed: we are not appending more payloads to this TX message > - * (exahusted space in the queue, too many payloads or > + * (exhausted space in the queue, too many payloads or > * whichever). We have appended padding so the whole message > * length is aligned to i2400m->bus_tx_block_size (as set by the > * bus/transport layer). > @@ -295,7 +295,7 @@ enum { > /* > * Calculate how much tail room is available > * > - * Note the trick here. This path is ONLY caleed for Case A (see > + * Note the trick here. This path is ONLY called for Case A (see > * i2400m_tx_fifo_push() below), where we have: > * > * Case A > -- -- ~Randy From fabioaiuto83 at gmail.com Fri Mar 12 18:33:13 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Fri, 12 Mar 2021 19:33:13 +0100 Subject: [PATCH v2 0/4] staging: rtl8723bs: remove unused code blocks Message-ID: This patch set removes unused code blocks as required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Changes in v2: - modified sunject lines to make them unique - added a patch previously excluded (removal of CONFIG_PNO_SET_DEBUG code) Fabio Aiuto (4): staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_PNO_SET_DEBUG staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_PNO_SUPPORT staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_WOWLAN staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_TCP_CSUM_OFFLOAD_RX drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 - drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 24 +- .../staging/rtl8723bs/core/rtw_wlan_util.c | 61 +- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 872 +----------------- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 43 +- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 253 +---- drivers/staging/rtl8723bs/hal/sdio_ops.c | 4 +- drivers/staging/rtl8723bs/include/autoconf.h | 3 - drivers/staging/rtl8723bs/include/drv_types.h | 5 - .../rtl8723bs/include/drv_types_sdio.h | 2 +- .../staging/rtl8723bs/include/hal_com_h2c.h | 88 +- drivers/staging/rtl8723bs/include/hal_intf.h | 5 - .../staging/rtl8723bs/include/rtl8723b_cmd.h | 4 +- .../staging/rtl8723bs/include/rtl8723b_hal.h | 17 - .../staging/rtl8723bs/include/rtl8723b_spec.h | 10 - drivers/staging/rtl8723bs/include/rtw_mp.h | 3 - .../staging/rtl8723bs/include/rtw_pwrctrl.h | 62 -- drivers/staging/rtl8723bs/include/rtw_recv.h | 5 - .../staging/rtl8723bs/include/rtw_security.h | 3 - drivers/staging/rtl8723bs/include/sdio_ops.h | 8 +- drivers/staging/rtl8723bs/include/sta_info.h | 5 - .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 56 -- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 3 - drivers/staging/rtl8723bs/os_dep/os_intfs.c | 238 +---- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 8 - drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 5 - 26 files changed, 28 insertions(+), 1762 deletions(-) -- 2.20.1 From fabioaiuto83 at gmail.com Fri Mar 12 18:33:26 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Fri, 12 Mar 2021 19:33:26 +0100 Subject: [PATCH v2 1/4] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_PNO_SET_DEBUG In-Reply-To: References: Message-ID: <1a2eaead1b848c26892497fe34841b29e5eaeec2.1615572985.git.fabioaiuto83@gmail.com> Remove conditional code block checked by unused CONFIG_PNO_SET_DEBUG Cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 48 -------------------- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 5 -- 2 files changed, 53 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index 0480e32701f0..479623d6eb79 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -1668,18 +1668,6 @@ static void rtl8723b_set_FwRsvdPagePkt( rtl8723b_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], ProbeReqLength, false, false, false); -#ifdef CONFIG_PNO_SET_DEBUG - { - int gj; - printk("probe req pkt =>\n"); - for (gj = 0; gj < ProbeReqLength+TxDescLen; gj++) { - printk(" %02x ", ReservedPagePacket[BufIndex-TxDescLen+gj]); - if ((gj+1)%8 == 0) - printk("\n"); - } - printk(" <=end\n"); - } -#endif CurtPktPageNum = (u8)PageNum_128(TxDescLen + ProbeReqLength); @@ -1690,18 +1678,6 @@ static void rtl8723b_set_FwRsvdPagePkt( /* PNO INFO Page */ RsvdPageLoc.LocPNOInfo = TotalPageNum; ConstructPnoInfo(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &PNOLength); -#ifdef CONFIG_PNO_SET_DEBUG - { - int gj; - printk("PNO pkt =>\n"); - for (gj = 0; gj < PNOLength; gj++) { - printk(" %02x ", ReservedPagePacket[BufIndex-TxDescLen+gj]); - if ((gj + 1)%8 == 0) - printk("\n"); - } - printk(" <=end\n"); - } -#endif CurtPktPageNum = (u8)PageNum_128(PNOLength); TotalPageNum += CurtPktPageNum; @@ -1710,18 +1686,6 @@ static void rtl8723b_set_FwRsvdPagePkt( /* SSID List Page */ RsvdPageLoc.LocSSIDInfo = TotalPageNum; ConstructSSIDList(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &SSIDLegnth); -#ifdef CONFIG_PNO_SET_DEBUG - { - int gj; - printk("SSID list pkt =>\n"); - for (gj = 0; gj < SSIDLegnth; gj++) { - printk(" %02x ", ReservedPagePacket[BufIndex-TxDescLen+gj]); - if ((gj + 1)%8 == 0) - printk("\n"); - } - printk(" <=end\n"); - } -#endif CurtPktPageNum = (u8)PageNum_128(SSIDLegnth); TotalPageNum += CurtPktPageNum; BufIndex += (CurtPktPageNum*PageSize); @@ -1729,18 +1693,6 @@ static void rtl8723b_set_FwRsvdPagePkt( /* Scan Info Page */ RsvdPageLoc.LocScanInfo = TotalPageNum; ConstructScanInfo(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &ScanInfoLength); -#ifdef CONFIG_PNO_SET_DEBUG - { - int gj; - printk("Scan info pkt =>\n"); - for (gj = 0; gj < ScanInfoLength; gj++) { - printk(" %02x ", ReservedPagePacket[BufIndex-TxDescLen+gj]); - if ((gj + 1)%8 == 0) - printk("\n"); - } - printk(" <=end\n"); - } -#endif CurtPktPageNum = (u8)PageNum_128(ScanInfoLength); TotalPageNum += CurtPktPageNum; BufIndex += (CurtPktPageNum*PageSize); diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index 9dd3f3249e01..3266839031f8 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -1476,11 +1476,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) rtw_read32(padapter, 0x2fc), rtw_read32(padapter, 0x8c) ); -#ifdef CONFIG_PNO_SET_DEBUG - DBG_871X("0x1b9: 0x%02x, 0x632: 0x%02x\n", rtw_read8(padapter, 0x1b9), rtw_read8(padapter, 0x632)); - DBG_871X("0x4fc: 0x%02x, 0x4fd: 0x%02x\n", rtw_read8(padapter, 0x4fc), rtw_read8(padapter, 0x4fd)); - DBG_871X("TXDMA STATUS: 0x%08x\n", rtw_read32(padapter, REG_TXDMA_STATUS)); -#endif { /* 2. Set Disable WOWLAN H2C command. */ -- 2.20.1 From fabioaiuto83 at gmail.com Fri Mar 12 18:33:36 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Fri, 12 Mar 2021 19:33:36 +0100 Subject: [PATCH v2 2/4] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_PNO_SUPPORT In-Reply-To: References: Message-ID: <9eb16865cc1318d123768334fb02ccabf542c433.1615572985.git.fabioaiuto83@gmail.com> Remove conditional code blocks checked by unused CONFIG_PNO_SUPPORT Cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 18 -- .../staging/rtl8723bs/core/rtw_wlan_util.c | 8 - drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 269 ------------------ drivers/staging/rtl8723bs/hal/sdio_halinit.c | 8 - .../staging/rtl8723bs/include/hal_com_h2c.h | 17 -- .../staging/rtl8723bs/include/rtl8723b_hal.h | 10 - .../staging/rtl8723bs/include/rtw_pwrctrl.h | 53 ---- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 56 ---- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 7 - 9 files changed, 446 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index c9f4a18b24b9..8059aeea9d47 100644 --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c @@ -1149,29 +1149,11 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter) pwrctrlpriv->wowlan_mode = false; pwrctrlpriv->wowlan_ap_mode = false; - -#ifdef CONFIG_PNO_SUPPORT - pwrctrlpriv->pno_inited = false; - pwrctrlpriv->pnlo_info = NULL; - pwrctrlpriv->pscan_info = NULL; - pwrctrlpriv->pno_ssid_list = NULL; - pwrctrlpriv->pno_in_resume = true; -#endif } void rtw_free_pwrctrl_priv(struct adapter *adapter) { -#ifdef CONFIG_PNO_SUPPORT - if (pwrctrlpriv->pnlo_info) - printk("****** pnlo_info memory leak********\n"); - - if (pwrctrlpriv->pscan_info) - printk("****** pscan_info memory leak********\n"); - - if (pwrctrlpriv->pno_ssid_list) - printk("****** pno_ssid_list memory leak********\n"); -#endif } inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms) diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index 96feced698ac..ae577178534f 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -2189,11 +2189,3 @@ void rtw_set_sec_pn(struct adapter *padapter) } #endif /* CONFIG_WOWLAN */ -#ifdef CONFIG_PNO_SUPPORT -#define CSCAN_TLV_TYPE_SSID_IE 'S' -#define CIPHER_IE "key_mgmt =" -#define CIPHER_NONE "NONE" -#define CIPHER_WPA_PSK "WPA-PSK" -#define CIPHER_WPA_EAP "WPA-EAP IEEE8021X" - -#endif /* CONFIG_PNO_SUPPORT */ diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index 479623d6eb79..b6958d3db855 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -462,125 +462,6 @@ static void ConstructARPResponse( } } -#ifdef CONFIG_PNO_SUPPORT -static void ConstructPnoInfo( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - - struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); - - u8 *pPnoInfoPkt = pframe; - pPnoInfoPkt = (u8 *)(pframe + *pLength); - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_num, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->fast_scan_period, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->fast_scan_iterations, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->slow_scan_period, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_length, - MAX_PNO_LIST_COUNT); - - *pLength += MAX_PNO_LIST_COUNT; - pPnoInfoPkt += MAX_PNO_LIST_COUNT; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_cipher_info, - MAX_PNO_LIST_COUNT); - - *pLength += MAX_PNO_LIST_COUNT; - pPnoInfoPkt += MAX_PNO_LIST_COUNT; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_channel_info, - MAX_PNO_LIST_COUNT); - - *pLength += MAX_PNO_LIST_COUNT; - pPnoInfoPkt += MAX_PNO_LIST_COUNT; -} - -static void ConstructSSIDList( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - int i = 0; - u8 *pSSIDListPkt = pframe; - struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); - - pSSIDListPkt = (u8 *)(pframe + *pLength); - - for (i = 0; i < pwrctl->pnlo_info->ssid_num ; i++) { - memcpy(pSSIDListPkt, &pwrctl->pno_ssid_list->node[i].SSID, - pwrctl->pnlo_info->ssid_length[i]); - - *pLength += WLAN_SSID_MAXLEN; - pSSIDListPkt += WLAN_SSID_MAXLEN; - } -} - -static void ConstructScanInfo( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - int i = 0; - u8 *pScanInfoPkt = pframe; - struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); - - pScanInfoPkt = (u8 *)(pframe + *pLength); - - memcpy(pScanInfoPkt, &pwrctl->pscan_info->channel_num, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_ch, 1); - - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_bw, 1); - - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_40_offset, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_80_offset, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->periodScan, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->period_scan_time, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->enableRFE, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->rfe_type, 8); - - *pLength += 8; - pScanInfoPkt += 8; - - for (i = 0; i < MAX_SCAN_LIST_COUNT; i++) { - memcpy(pScanInfoPkt, &pwrctl->pscan_info->ssid_channel_info[i], 4); - *pLength += 4; - pScanInfoPkt += 4; - } -} -#endif - #ifdef CONFIG_GTK_OL static void ConstructGTKResponse( struct adapter *padapter, u8 *pframe, u32 *pLength @@ -666,48 +547,6 @@ static void ConstructGTKResponse( } #endif /* CONFIG_GTK_OL */ -#ifdef CONFIG_PNO_SUPPORT -static void ConstructProbeReq(struct adapter *padapter, u8 *pframe, u32 *pLength) -{ - struct ieee80211_hdr *pwlanhdr; - u16 *fctrl; - u32 pktlen; - unsigned char *mac; - unsigned char bssrate[NumRates]; - int bssrate_len = 0; - u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - pwlanhdr = (struct ieee80211_hdr *)pframe; - mac = myid(&(padapter->eeprompriv)); - - fctrl = &(pwlanhdr->frame_control); - *(fctrl) = 0; - - /* broadcast probe request frame */ - memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN); - memcpy(pwlanhdr->addr3, bc_addr, ETH_ALEN); - - memcpy(pwlanhdr->addr2, mac, ETH_ALEN); - - SetSeqNum(pwlanhdr, 0); - SetFrameSubType(pframe, WIFI_PROBEREQ); - - pktlen = sizeof(struct ieee80211_hdr_3addr); - pframe += pktlen; - - pframe = rtw_set_ie(pframe, WLAN_EID_SSID, 0, NULL, &pktlen); - - get_rate_set(padapter, bssrate, &bssrate_len); - - if (bssrate_len > 8) { - pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, 8, bssrate, &pktlen); - pframe = rtw_set_ie(pframe, WLAN_EID_EXT_SUPP_RATES, (bssrate_len - 8), (bssrate + 8), &pktlen); - } else - pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, bssrate_len, bssrate, &pktlen); - - *pLength = pktlen; -} -#endif /* CONFIG_PNO_SUPPORT */ #endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN @@ -875,15 +714,6 @@ static void rtl8723b_set_FwAoacRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_ RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CAoacRsvdPageParm:", u1H2CAoacRsvdPageParm, H2C_AOAC_RSVDPAGE_LOC_LEN); FillH2CCmd8723B(padapter, H2C_8723B_AOAC_RSVD_PAGE, H2C_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm); } else { -#ifdef CONFIG_PNO_SUPPORT - if (!pwrpriv->pno_in_resume) { - DBG_871X("NLO_INFO =%d\n", rsvdpageloc->LocPNOInfo); - memset(&u1H2CAoacRsvdPageParm, 0, sizeof(u1H2CAoacRsvdPageParm)); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_NLO_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocPNOInfo); - FillH2CCmd8723B(padapter, H2C_AOAC_RSVDPAGE3, H2C_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm); - msleep(10); - } -#endif } #endif /* CONFIG_WOWLAN */ @@ -1183,11 +1013,6 @@ static void rtl8723b_set_FwWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) u8 gpio_high_active = 0; /* 0: low active, 1: high active */ u8 magic_pkt = 0; -#ifdef CONFIG_PNO_SUPPORT - if (!ppwrpriv->wowlan_pno_enable) - magic_pkt = 1; -#endif - if (psecpriv->dot11PrivacyAlgrthm == _WEP40_ || psecpriv->dot11PrivacyAlgrthm == _WEP104_) hw_unicast = 1; @@ -1240,28 +1065,9 @@ static void rtl8723b_set_FwRemoteWakeCtrl_Cmd(struct adapter *padapter, u8 benab else SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_ACTION(u1H2CRemoteWakeCtrlParm, 1); } -#ifdef CONFIG_PNO_SUPPORT - else { - SET_H2CCMD_REMOTE_WAKECTRL_ENABLE(u1H2CRemoteWakeCtrlParm, benable); - SET_H2CCMD_REMOTE_WAKE_CTRL_NLO_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, benable); - } -#endif RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CRemoteWakeCtrlParm:", u1H2CRemoteWakeCtrlParm, H2C_REMOTE_WAKE_CTRL_LEN); FillH2CCmd8723B(padapter, H2C_8723B_REMOTE_WAKE_CTRL, H2C_REMOTE_WAKE_CTRL_LEN, u1H2CRemoteWakeCtrlParm); -#ifdef CONFIG_PNO_SUPPORT - if (ppwrpriv->wowlan_pno_enable && !ppwrpriv->pno_in_resume) { - res = rtw_read8(padapter, REG_PNO_STATUS); - DBG_871X("cmd: 0x81 REG_PNO_STATUS: 0x%02x\n", res); - while (!(res&BIT(7)) && count < 25) { - DBG_871X("[%d] cmd: 0x81 REG_PNO_STATUS: 0x%02x\n", count, res); - res = rtw_read8(padapter, REG_PNO_STATUS); - count++; - msleep(2); - } - DBG_871X("cmd: 0x81 REG_PNO_STATUS: 0x%02x\n", res); - } -#endif /* CONFIG_PNO_SUPPORT */ } static void rtl8723b_set_FwAOACGlobalInfo_Cmd(struct adapter *padapter, u8 group_alg, u8 pairwise_alg) @@ -1278,26 +1084,6 @@ static void rtl8723b_set_FwAOACGlobalInfo_Cmd(struct adapter *padapter, u8 grou FillH2CCmd8723B(padapter, H2C_8723B_AOAC_GLOBAL_INFO, H2C_AOAC_GLOBAL_INFO_LEN, u1H2CAOACGlobalInfoParm); } -#ifdef CONFIG_PNO_SUPPORT -static void rtl8723b_set_FwScanOffloadInfo_cmd(struct adapter *padapter, PRSVDPAGE_LOC rsvdpageloc, u8 enable) -{ - u8 u1H2CScanOffloadInfoParm[H2C_SCAN_OFFLOAD_CTRL_LEN] = {0}; - - DBG_871X("%s: loc_probe_packet:%d, loc_scan_info: %d loc_ssid_info:%d\n", - __func__, rsvdpageloc->LocProbePacket, rsvdpageloc->LocScanInfo, rsvdpageloc->LocSSIDInfo); - - SET_H2CCMD_AOAC_NLO_FUN_EN(u1H2CScanOffloadInfoParm, enable); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_SCAN_INFO(u1H2CScanOffloadInfoParm, rsvdpageloc->LocScanInfo); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_PROBE_PACKET(u1H2CScanOffloadInfoParm, rsvdpageloc->LocProbePacket); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_SSID_INFO(u1H2CScanOffloadInfoParm, rsvdpageloc->LocSSIDInfo); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CScanOffloadInfoParm:", u1H2CScanOffloadInfoParm, H2C_SCAN_OFFLOAD_CTRL_LEN); - FillH2CCmd8723B(padapter, H2C_8723B_D0_SCAN_OFFLOAD_INFO, H2C_SCAN_OFFLOAD_CTRL_LEN, u1H2CScanOffloadInfoParm); - - msleep(20); -} -#endif /* CONFIG_PNO_SUPPORT */ - void rtl8723b_set_wowlan_cmd(struct adapter *padapter, u8 enable) { struct security_priv *psecpriv = &padapter->securitypriv; @@ -1656,55 +1442,8 @@ static void rtl8723b_set_FwRsvdPagePkt( } else #endif /* CONFIG_WOWLAN */ { -#ifdef CONFIG_PNO_SUPPORT - if (!pwrctl->pno_in_resume && pwrctl->pno_inited) { - /* Probe Request */ - RsvdPageLoc.LocProbePacket = TotalPageNum; - ConstructProbeReq( - padapter, - &ReservedPagePacket[BufIndex], - &ProbeReqLength); - - rtl8723b_fill_fake_txdesc(padapter, - &ReservedPagePacket[BufIndex-TxDescLen], - ProbeReqLength, false, false, false); - CurtPktPageNum = - (u8)PageNum_128(TxDescLen + ProbeReqLength); - - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* PNO INFO Page */ - RsvdPageLoc.LocPNOInfo = TotalPageNum; - ConstructPnoInfo(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &PNOLength); - - CurtPktPageNum = (u8)PageNum_128(PNOLength); - TotalPageNum += CurtPktPageNum; - BufIndex += (CurtPktPageNum*PageSize); - - /* SSID List Page */ - RsvdPageLoc.LocSSIDInfo = TotalPageNum; - ConstructSSIDList(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &SSIDLegnth); - CurtPktPageNum = (u8)PageNum_128(SSIDLegnth); - TotalPageNum += CurtPktPageNum; - BufIndex += (CurtPktPageNum*PageSize); - - /* Scan Info Page */ - RsvdPageLoc.LocScanInfo = TotalPageNum; - ConstructScanInfo(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &ScanInfoLength); - CurtPktPageNum = (u8)PageNum_128(ScanInfoLength); - TotalPageNum += CurtPktPageNum; - BufIndex += (CurtPktPageNum*PageSize); - - TotalPacketLen = BufIndex + ScanInfoLength; - } else { TotalPacketLen = BufIndex + BTQosNullLength; } -#else /* CONFIG_PNO_SUPPORT */ - TotalPacketLen = BufIndex + BTQosNullLength; -#endif - } if (TotalPacketLen > MaxRsvdPageBufSize) { DBG_871X("%s(): ERROR: The rsvd page size is not enough!!TotalPacketLen %d, MaxRsvdPageBufSize %d\n", __func__, @@ -1725,14 +1464,6 @@ static void rtl8723b_set_FwRsvdPagePkt( rtl8723b_set_FwAoacRsvdPage_cmd(padapter, &RsvdPageLoc); } else { rtl8723b_set_FwAoacRsvdPage_cmd(padapter, &RsvdPageLoc); -#ifdef CONFIG_PNO_SUPPORT - if (pwrctl->pno_in_resume) - rtl8723b_set_FwScanOffloadInfo_cmd(padapter, - &RsvdPageLoc, 0); - else - rtl8723b_set_FwScanOffloadInfo_cmd(padapter, - &RsvdPageLoc, 1); -#endif } return; diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index 3266839031f8..ced05bbfc906 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -1555,14 +1555,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) if (psta) rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); } -#ifdef CONFIG_PNO_SUPPORT - rtw_write8(padapter, 0x1b8, 0); - DBG_871X("reset 0x1b8: %d\n", rtw_read8(padapter, 0x1b8)); - rtw_write8(padapter, 0x1b9, 0); - DBG_871X("reset 0x1b9: %d\n", rtw_read8(padapter, 0x1b9)); - rtw_write8(padapter, REG_PNO_STATUS, 0); - DBG_871X("reset REG_PNO_STATUS: %d\n", rtw_read8(padapter, REG_PNO_STATUS)); -#endif break; default: diff --git a/drivers/staging/rtl8723bs/include/hal_com_h2c.h b/drivers/staging/rtl8723bs/include/hal_com_h2c.h index b951bc288b89..1f7ed90f9faa 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_h2c.h +++ b/drivers/staging/rtl8723bs/include/hal_com_h2c.h @@ -233,17 +233,6 @@ enum h2c_cmd { #ifdef CONFIG_GTK_OL #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+5, 0, 8, __Value) #endif /* CONFIG_GTK_OL */ -#ifdef CONFIG_PNO_SUPPORT -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_NLO_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd), 0, 8, __Value) -#endif - -#ifdef CONFIG_PNO_SUPPORT -/* D0_Scan_Offload_Info_0x86 */ -#define SET_H2CCMD_AOAC_NLO_FUN_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd), 3, 1, __Value) -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_PROBE_PACKET(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+1, 0, 8, __Value) -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_SCAN_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+2, 0, 8, __Value) -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_SSID_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+3, 0, 8, __Value) -#endif /* CONFIG_PNO_SUPPORT */ /* */ /* Structure -------------------------------------------------- */ @@ -265,12 +254,6 @@ typedef struct _RSVDPAGE_LOC { #ifdef CONFIG_GTK_OL u8 LocGTKEXTMEM; #endif /* CONFIG_GTK_OL */ -#ifdef CONFIG_PNO_SUPPORT - u8 LocPNOInfo; - u8 LocScanInfo; - u8 LocSSIDInfo; - u8 LocProbePacket; -#endif /* CONFIG_PNO_SUPPORT */ #endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN u8 LocApOffloadBCN; diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index 6f964f5c6578..2537bd7d6a13 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -92,11 +92,6 @@ struct rt_firmware_hdr { #define BCNQ_PAGE_NUM_8723B 0x08 #define BCNQ1_PAGE_NUM_8723B 0x00 -#ifdef CONFIG_PNO_SUPPORT -#undef BCNQ1_PAGE_NUM_8723B -#define BCNQ1_PAGE_NUM_8723B 0x00 /* 0x04 */ -#endif - #define MAX_RX_DMA_BUFFER_SIZE_8723B 0x2800 /* RX 10K */ /* For WoWLan, more reserved page */ @@ -107,11 +102,6 @@ struct rt_firmware_hdr { #define WOWLAN_PAGE_NUM_8723B 0x00 #endif -#ifdef CONFIG_PNO_SUPPORT -#undef WOWLAN_PAGE_NUM_8723B -#define WOWLAN_PAGE_NUM_8723B 0x0d -#endif - #ifdef CONFIG_AP_WOWLAN #define AP_WOWLAN_PAGE_NUM_8723B 0x02 #endif diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h index 0987891e85ae..f467e9032450 100644 --- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h @@ -46,11 +46,6 @@ enum Power_Mgnt { PS_MODE_NUM, }; -#ifdef CONFIG_PNO_SUPPORT -#define MAX_PNO_LIST_COUNT 16 -#define MAX_SCAN_LIST_COUNT 14 /* 2.4G only */ -#endif - /* BIT[2:0] = HW state BIT[3] = Protocol PS state, 0: register active state , 1: register sleep state @@ -158,47 +153,6 @@ enum PS_DENY_REASON { PS_DENY_OTHERS = 31 }; -#ifdef CONFIG_PNO_SUPPORT -struct pno_nlo_info { - u32 fast_scan_period; /* Fast scan period */ - u32 ssid_num; /* number of entry */ - u32 slow_scan_period; /* slow scan period */ - u32 fast_scan_iterations; /* Fast scan iterations */ - u8 ssid_length[MAX_PNO_LIST_COUNT]; /* SSID Length Array */ - u8 ssid_cipher_info[MAX_PNO_LIST_COUNT]; /* Cipher information for security */ - u8 ssid_channel_info[MAX_PNO_LIST_COUNT]; /* channel information */ -}; - -struct pno_ssid { - u32 SSID_len; - u8 SSID[32]; -}; - -struct pno_ssid_list { - struct pno_ssid node[MAX_PNO_LIST_COUNT]; -}; - -struct pno_scan_channel_info { - u8 channel; - u8 tx_power; - u8 timeout; - u8 active; /* set 1 means active scan, or pasivite scan. */ -}; - -struct pno_scan_info { - u8 enableRFE; /* Enable RFE */ - u8 period_scan_time; /* exclusive with fast_scan_period and slow_scan_period */ - u8 periodScan; /* exclusive with fast_scan_period and slow_scan_period */ - u8 orig_80_offset; /* original channel 80 offset */ - u8 orig_40_offset; /* original channel 40 offset */ - u8 orig_bw; /* original bandwidth */ - u8 orig_ch; /* original channel */ - u8 channel_num; /* number of channel */ - u64 rfe_type; /* rfe_type && 0x00000000000000ff */ - struct pno_scan_channel_info ssid_channel_info[MAX_SCAN_LIST_COUNT]; -}; -#endif /* CONFIG_PNO_SUPPORT */ - struct pwrctrl_priv { struct mutex lock; volatile u8 rpwm; /* requested power state for fw */ @@ -272,13 +226,6 @@ struct pwrctrl_priv { u8 wowlan_unicast; u8 wowlan_pattern_idx; u8 wowlan_pno_enable; -#ifdef CONFIG_PNO_SUPPORT - u8 pno_in_resume; - u8 pno_inited; - struct pno_nlo_info *pnlo_info; - struct pno_scan_info *pscan_info; - struct pno_ssid_list *pno_ssid_list; -#endif u32 wowlan_pattern_context[8][5]; u64 wowlan_fw_iv; #endif /* CONFIG_WOWLAN */ diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index ff164a8c8679..4d2981a4c01d 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -3095,54 +3095,6 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, return ret; } -#if defined(CONFIG_PNO_SUPPORT) -static int cfg80211_rtw_sched_scan_start(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_sched_scan_request *request) -{ - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - int ret; - - if (padapter->bup == false) { - DBG_871X("%s: net device is down.\n", __func__); - return -EIO; - } - - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true || - check_fwstate(pmlmepriv, _FW_LINKED) == true || - check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) { - DBG_871X("%s: device is busy.\n", __func__); - rtw_scan_abort(padapter); - } - - if (request == NULL) { - DBG_871X("%s: invalid cfg80211_requests parameters.\n", __func__); - return -EINVAL; - } - - ret = rtw_android_cfg80211_pno_setup(dev, request->ssids, - request->n_ssids, request->interval); - - if (ret < 0) { - DBG_871X("%s ret: %d\n", __func__, ret); - goto exit; - } - - ret = rtw_android_pno_enable(dev, true); - if (ret < 0) { - DBG_871X("%s ret: %d\n", __func__, ret); - goto exit; - } -exit: - return ret; -} - -static int cfg80211_rtw_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev) -{ - return rtw_android_pno_enable(dev, false); -} -#endif /* CONFIG_PNO_SUPPORT */ - static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum nl80211_band band, u8 rf_type) { @@ -3248,9 +3200,6 @@ static void rtw_cfg80211_preinit_wiphy(struct adapter *padapter, struct wiphy *w #if defined(CONFIG_PM) wiphy->max_sched_scan_reqs = 1; -#ifdef CONFIG_PNO_SUPPORT - wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT; -#endif #endif #if defined(CONFIG_PM) @@ -3297,11 +3246,6 @@ static struct cfg80211_ops rtw_cfg80211_ops = { .change_bss = cfg80211_rtw_change_bss, .mgmt_tx = cfg80211_rtw_mgmt_tx, - -#if defined(CONFIG_PNO_SUPPORT) - .sched_scan_start = cfg80211_rtw_sched_scan_start, - .sched_scan_stop = cfg80211_rtw_sched_scan_stop, -#endif /* CONFIG_PNO_SUPPORT */ }; int rtw_wdev_alloc(struct adapter *padapter, struct device *dev) diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index b62fe9238e6d..61488781d211 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -1505,10 +1505,6 @@ int rtw_resume_process_wow(struct adapter *padapter) goto exit; } -#ifdef CONFIG_PNO_SUPPORT - pwrpriv->pno_in_resume = true; -#endif - if (pwrpriv->wowlan_mode) { rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN"); @@ -1780,9 +1776,6 @@ int rtw_resume_common(struct adapter *padapter) if (pwrpriv) { pwrpriv->bInSuspend = false; - #ifdef CONFIG_PNO_SUPPORT - pwrpriv->pno_in_resume = false; - #endif } DBG_871X_LEVEL(_drv_always_, "%s:%d in %d ms\n", __func__, ret, jiffies_to_msecs(jiffies - start_time)); -- 2.20.1 From fabioaiuto83 at gmail.com Fri Mar 12 18:33:51 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Fri, 12 Mar 2021 19:33:51 +0100 Subject: [PATCH v2 3/4] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_WOWLAN In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_WOWLAN cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 - drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 6 +- .../staging/rtl8723bs/core/rtw_wlan_util.c | 53 +- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 555 +----------------- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 43 +- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 240 +------- drivers/staging/rtl8723bs/hal/sdio_ops.c | 4 +- drivers/staging/rtl8723bs/include/autoconf.h | 3 - drivers/staging/rtl8723bs/include/drv_types.h | 5 - .../rtl8723bs/include/drv_types_sdio.h | 2 +- .../staging/rtl8723bs/include/hal_com_h2c.h | 71 +-- drivers/staging/rtl8723bs/include/hal_intf.h | 5 - .../staging/rtl8723bs/include/rtl8723b_cmd.h | 4 +- .../staging/rtl8723bs/include/rtl8723b_hal.h | 7 - .../staging/rtl8723bs/include/rtl8723b_spec.h | 10 - drivers/staging/rtl8723bs/include/rtw_mp.h | 3 - .../staging/rtl8723bs/include/rtw_pwrctrl.h | 9 - .../staging/rtl8723bs/include/rtw_security.h | 3 - drivers/staging/rtl8723bs/include/sdio_ops.h | 8 +- drivers/staging/rtl8723bs/include/sta_info.h | 5 - .../staging/rtl8723bs/os_dep/ioctl_linux.c | 3 - drivers/staging/rtl8723bs/os_dep/os_intfs.c | 231 +------- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 5 - 23 files changed, 28 insertions(+), 1250 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index 2c9425e2a1e9..7412295f0a04 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -2098,9 +2098,6 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) if (!candidate) { DBG_871X("%s: return _FAIL(candidate == NULL)\n", __func__); -#ifdef CONFIG_WOWLAN - _clr_fwstate_(pmlmepriv, _FW_LINKED|_FW_UNDER_LINKING); -#endif ret = _FAIL; goto exit; } else { diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index 8059aeea9d47..2e6c522b74e3 100644 --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c @@ -350,7 +350,7 @@ static u8 PS_RDY_CHECK(struct adapter *padapter) struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN if (pwrpriv->bInSuspend && pwrpriv->wowlan_mode) return true; else if (pwrpriv->bInSuspend && pwrpriv->wowlan_ap_mode) @@ -391,7 +391,7 @@ static u8 PS_RDY_CHECK(struct adapter *padapter) void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode, const char *msg) { struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN struct debug_priv *pdbgpriv = &padapter->dvobj->drv_dbg; #endif @@ -422,7 +422,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a pwrpriv->pwr_mode = ps_mode; rtw_set_rpwm(padapter, PS_STATE_S4); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode) { unsigned long start_time; u32 delay_ms; diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index ae577178534f..355e43c4cf9a 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -10,7 +10,7 @@ #include #include -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN #include #endif @@ -2113,7 +2113,7 @@ int rtw_config_gpio(struct net_device *netdev, int gpio_num, bool isOutput) EXPORT_SYMBOL(rtw_config_gpio); #endif -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -2139,53 +2139,4 @@ void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip) } } #endif -#ifdef CONFIG_WOWLAN -void rtw_get_sec_iv(struct adapter *padapter, u8 *pcur_dot11txpn, u8 *StaAddr) -{ - struct sta_info *psta; - struct security_priv *psecpriv = &padapter->securitypriv; - - memset(pcur_dot11txpn, 0, 8); - if (!StaAddr) - return; - psta = rtw_get_stainfo(&padapter->stapriv, StaAddr); - DBG_871X("%s(): StaAddr: %02x %02x %02x %02x %02x %02x\n", - __func__, StaAddr[0], StaAddr[1], StaAddr[2], - StaAddr[3], StaAddr[4], StaAddr[5]); - - if (psta) { - if (psecpriv->dot11PrivacyAlgrthm != _NO_PRIVACY_ && psta->dot11txpn.val > 0) - psta->dot11txpn.val--; - AES_IV(pcur_dot11txpn, psta->dot11txpn, 0); - - DBG_871X("%s(): CurrentIV: %02x %02x %02x %02x %02x %02x %02x %02x\n" - , __func__, pcur_dot11txpn[0], pcur_dot11txpn[1], - pcur_dot11txpn[2], pcur_dot11txpn[3], pcur_dot11txpn[4], - pcur_dot11txpn[5], pcur_dot11txpn[6], pcur_dot11txpn[7]); - } -} - -void rtw_set_sec_pn(struct adapter *padapter) -{ - struct sta_info *psta; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct security_priv *psecpriv = &padapter->securitypriv; - - psta = rtw_get_stainfo(&padapter->stapriv, - get_my_bssid(&pmlmeinfo->network)); - - if (psta) { - if (pwrpriv->wowlan_fw_iv > psta->dot11txpn.val) { - if (psecpriv->dot11PrivacyAlgrthm != _NO_PRIVACY_) - psta->dot11txpn.val = pwrpriv->wowlan_fw_iv + 2; - } else { - DBG_871X("%s(): FW IV is smaller than driver\n", __func__); - psta->dot11txpn.val += 2; - } - DBG_871X("%s: dot11txpn: 0x%016llx\n", __func__, psta->dot11txpn.val); - } -} -#endif /* CONFIG_WOWLAN */ diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index b6958d3db855..c3e7103da7e7 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -31,10 +31,6 @@ static u8 _is_fw_read_cmd_down(struct adapter *padapter, u8 msgbox_num) if (0 == valid) { read_down = true; } -#ifdef CONFIG_WOWLAN - else - msleep(1); -#endif } while ((!read_down) && (retry_cnts--)); return read_down; @@ -316,239 +312,6 @@ static void ConstructNullFunctionData( *pLength = pktlen; } - -#ifdef CONFIG_WOWLAN -/* */ -/* Description: */ -/* Construct the ARP response packet to support ARP offload. */ -/* */ -static void ConstructARPResponse( - struct adapter *padapter, - u8 *pframe, - u32 *pLength, - u8 *pIPAddress -) -{ - struct ieee80211_hdr *pwlanhdr; - __le16 *fctrl; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct security_priv *psecuritypriv = &padapter->securitypriv; - static u8 ARPLLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06}; - u8 *pARPRspPkt = pframe; - /* for TKIP Cal MIC */ - u8 *payload = pframe; - u8 EncryptionHeadOverhead = 0; - /* DBG_871X("%s:%d\n", __func__, bForcePowerSave); */ - - pwlanhdr = (struct ieee80211_hdr *)pframe; - - fctrl = &pwlanhdr->frame_control; - *(fctrl) = 0; - - /* */ - /* MAC Header. */ - /* */ - SetFrameType(fctrl, WIFI_DATA); - /* SetFrameSubType(fctrl, 0); */ - SetToDs(fctrl); - memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - - SetSeqNum(pwlanhdr, 0); - SetDuration(pwlanhdr, 0); - /* SET_80211_HDR_FRAME_CONTROL(pARPRspPkt, 0); */ - /* SET_80211_HDR_TYPE_AND_SUBTYPE(pARPRspPkt, Type_Data); */ - /* SET_80211_HDR_TO_DS(pARPRspPkt, 1); */ - /* SET_80211_HDR_ADDRESS1(pARPRspPkt, pMgntInfo->Bssid); */ - /* SET_80211_HDR_ADDRESS2(pARPRspPkt, Adapter->CurrentAddress); */ - /* SET_80211_HDR_ADDRESS3(pARPRspPkt, pMgntInfo->Bssid); */ - - /* SET_80211_HDR_DURATION(pARPRspPkt, 0); */ - /* SET_80211_HDR_FRAGMENT_SEQUENCE(pARPRspPkt, 0); */ - *pLength = 24; - - /* */ - /* Security Header: leave space for it if necessary. */ - /* */ - - switch (psecuritypriv->dot11PrivacyAlgrthm) { - case _WEP40_: - case _WEP104_: - EncryptionHeadOverhead = 4; - break; - case _TKIP_: - EncryptionHeadOverhead = 8; - break; - case _AES_: - EncryptionHeadOverhead = 8; - break; - default: - EncryptionHeadOverhead = 0; - } - - if (EncryptionHeadOverhead > 0) { - memset(&(pframe[*pLength]), 0, EncryptionHeadOverhead); - *pLength += EncryptionHeadOverhead; - SetPrivacy(fctrl); - } - - /* */ - /* Frame Body. */ - /* */ - pARPRspPkt = (u8 *)(pframe + *pLength); - payload = pARPRspPkt; /* Get Payload pointer */ - /* LLC header */ - memcpy(pARPRspPkt, ARPLLCHeader, 8); - *pLength += 8; - - /* ARP element */ - pARPRspPkt += 8; - SET_ARP_PKT_HW(pARPRspPkt, 0x0100); - SET_ARP_PKT_PROTOCOL(pARPRspPkt, 0x0008); /* IP protocol */ - SET_ARP_PKT_HW_ADDR_LEN(pARPRspPkt, 6); - SET_ARP_PKT_PROTOCOL_ADDR_LEN(pARPRspPkt, 4); - SET_ARP_PKT_OPERATION(pARPRspPkt, 0x0200); /* ARP response */ - SET_ARP_PKT_SENDER_MAC_ADDR(pARPRspPkt, myid(&(padapter->eeprompriv))); - SET_ARP_PKT_SENDER_IP_ADDR(pARPRspPkt, pIPAddress); - { - SET_ARP_PKT_TARGET_MAC_ADDR(pARPRspPkt, get_my_bssid(&(pmlmeinfo->network))); - SET_ARP_PKT_TARGET_IP_ADDR(pARPRspPkt, pIPAddress); - DBG_871X("%s Target Mac Addr:%pM\n", __func__, MAC_ARG(get_my_bssid(&(pmlmeinfo->network)))); - DBG_871X("%s Target IP Addr:%pI4\n", __func__, IP_ARG(pIPAddress)); - } - - *pLength += 28; - - if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_) { - u8 mic[8]; - struct mic_data micdata; - struct sta_info *psta = NULL; - u8 priority[4] = { - 0x0, 0x0, 0x0, 0x0 - }; - u8 null_key[16] = { - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 - }; - - DBG_871X("%s(): Add MIC\n", __func__); - - psta = rtw_get_stainfo(&padapter->stapriv, get_my_bssid(&(pmlmeinfo->network))); - if (psta) { - if (!memcmp(&psta->dot11tkiptxmickey.skey[0], null_key, 16)) { - DBG_871X("%s(): STA dot11tkiptxmickey == 0\n", __func__); - } - /* start to calculate the mic code */ - rtw_secmicsetkey(&micdata, &psta->dot11tkiptxmickey.skey[0]); - } - - rtw_secmicappend(&micdata, pwlanhdr->addr3, 6); /* DA */ - - rtw_secmicappend(&micdata, pwlanhdr->addr2, 6); /* SA */ - - priority[0] = 0; - rtw_secmicappend(&micdata, &priority[0], 4); - - rtw_secmicappend(&micdata, payload, 36); /* payload length = 8 + 28 */ - - rtw_secgetmic(&micdata, &(mic[0])); - - pARPRspPkt += 28; - memcpy(pARPRspPkt, &(mic[0]), 8); - - *pLength += 8; - } -} - -#ifdef CONFIG_GTK_OL -static void ConstructGTKResponse( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - struct ieee80211_hdr *pwlanhdr; - u16 *fctrl; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct security_priv *psecuritypriv = &padapter->securitypriv; - static u8 LLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8E}; - static u8 GTKbody_a[11] = {0x01, 0x03, 0x00, 0x5F, 0x02, 0x03, 0x12, 0x00, 0x10, 0x42, 0x0B}; - u8 *pGTKRspPkt = pframe; - u8 EncryptionHeadOverhead = 0; - /* DBG_871X("%s:%d\n", __func__, bForcePowerSave); */ - - pwlanhdr = (struct ieee80211_hdr *)pframe; - - fctrl = &pwlanhdr->frame_control; - *(fctrl) = 0; - - /* */ - /* MAC Header. */ - /* */ - SetFrameType(fctrl, WIFI_DATA); - /* SetFrameSubType(fctrl, 0); */ - SetToDs(fctrl); - memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - - SetSeqNum(pwlanhdr, 0); - SetDuration(pwlanhdr, 0); - - *pLength = 24; - - /* */ - /* Security Header: leave space for it if necessary. */ - /* */ - - switch (psecuritypriv->dot11PrivacyAlgrthm) { - case _WEP40_: - case _WEP104_: - EncryptionHeadOverhead = 4; - break; - case _TKIP_: - EncryptionHeadOverhead = 8; - break; - case _AES_: - EncryptionHeadOverhead = 8; - break; - default: - EncryptionHeadOverhead = 0; - } - - if (EncryptionHeadOverhead > 0) { - memset(&(pframe[*pLength]), 0, EncryptionHeadOverhead); - *pLength += EncryptionHeadOverhead; - /* GTK's privacy bit is done by FW */ - /* SetPrivacy(fctrl); */ - } - - /* */ - /* Frame Body. */ - /* */ - pGTKRspPkt = (u8 *)(pframe + *pLength); - /* LLC header */ - memcpy(pGTKRspPkt, LLCHeader, 8); - *pLength += 8; - - /* GTK element */ - pGTKRspPkt += 8; - - /* GTK frame body after LLC, part 1 */ - memcpy(pGTKRspPkt, GTKbody_a, 11); - *pLength += 11; - pGTKRspPkt += 11; - /* GTK frame body after LLC, part 2 */ - memset(&(pframe[*pLength]), 0, 88); - *pLength += 88; - pGTKRspPkt += 88; - -} -#endif /* CONFIG_GTK_OL */ - -#endif /* CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN static void ConstructProbeRsp(struct adapter *padapter, u8 *pframe, u32 *pLength, u8 *StaAddr, bool bHideSSID) { @@ -692,31 +455,6 @@ static void rtl8723b_set_FwRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_LOC static void rtl8723b_set_FwAoacRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_LOC rsvdpageloc) { -#ifdef CONFIG_WOWLAN - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 u1H2CAoacRsvdPageParm[H2C_AOAC_RSVDPAGE_LOC_LEN] = {0}; - - DBG_871X("8723BAOACRsvdPageLoc: RWC =%d ArpRsp =%d NbrAdv =%d GtkRsp =%d GtkInfo =%d ProbeReq =%d NetworkList =%d\n", - rsvdpageloc->LocRemoteCtrlInfo, rsvdpageloc->LocArpRsp, - rsvdpageloc->LocNbrAdv, rsvdpageloc->LocGTKRsp, - rsvdpageloc->LocGTKInfo, rsvdpageloc->LocProbeReq, - rsvdpageloc->LocNetList); - - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - SET_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocRemoteCtrlInfo); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1H2CAoacRsvdPageParm, rsvdpageloc->LocArpRsp); - /* SET_H2CCMD_AOAC_RSVDPAGE_LOC_NEIGHBOR_ADV(u1H2CAoacRsvdPageParm, rsvdpageloc->LocNbrAdv); */ - SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_RSP(u1H2CAoacRsvdPageParm, rsvdpageloc->LocGTKRsp); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocGTKInfo); -#ifdef CONFIG_GTK_OL - SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(u1H2CAoacRsvdPageParm, rsvdpageloc->LocGTKEXTMEM); -#endif /* CONFIG_GTK_OL */ - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CAoacRsvdPageParm:", u1H2CAoacRsvdPageParm, H2C_AOAC_RSVDPAGE_LOC_LEN); - FillH2CCmd8723B(padapter, H2C_8723B_AOAC_RSVD_PAGE, H2C_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm); - } else { - } - -#endif /* CONFIG_WOWLAN */ } #ifdef CONFIG_AP_WOWLAN @@ -771,40 +509,6 @@ void rtl8723b_set_FwMediaStatusRpt_cmd(struct adapter *padapter, u8 mstatus, u8 FillH2CCmd8723B(padapter, H2C_8723B_MEDIA_STATUS_RPT, H2C_MEDIA_STATUS_RPT_LEN, u1H2CMediaStatusRptParm); } -#ifdef CONFIG_WOWLAN -static void rtl8723b_set_FwKeepAlive_cmd(struct adapter *padapter, u8 benable, u8 pkt_type) -{ - u8 u1H2CKeepAliveParm[H2C_KEEP_ALIVE_CTRL_LEN] = {0}; - u8 adopt = 1, check_period = 5; - - DBG_871X("%s(): benable = %d\n", __func__, benable); - SET_8723B_H2CCMD_KEEPALIVE_PARM_ENABLE(u1H2CKeepAliveParm, benable); - SET_8723B_H2CCMD_KEEPALIVE_PARM_ADOPT(u1H2CKeepAliveParm, adopt); - SET_8723B_H2CCMD_KEEPALIVE_PARM_PKT_TYPE(u1H2CKeepAliveParm, pkt_type); - SET_8723B_H2CCMD_KEEPALIVE_PARM_CHECK_PERIOD(u1H2CKeepAliveParm, check_period); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CKeepAliveParm:", u1H2CKeepAliveParm, H2C_KEEP_ALIVE_CTRL_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_KEEP_ALIVE, H2C_KEEP_ALIVE_CTRL_LEN, u1H2CKeepAliveParm); -} - -static void rtl8723b_set_FwDisconDecision_cmd(struct adapter *padapter, u8 benable) -{ - u8 u1H2CDisconDecisionParm[H2C_DISCON_DECISION_LEN] = {0}; - u8 adopt = 1, check_period = 10, trypkt_num = 0; - - DBG_871X("%s(): benable = %d\n", __func__, benable); - SET_8723B_H2CCMD_DISCONDECISION_PARM_ENABLE(u1H2CDisconDecisionParm, benable); - SET_8723B_H2CCMD_DISCONDECISION_PARM_ADOPT(u1H2CDisconDecisionParm, adopt); - SET_8723B_H2CCMD_DISCONDECISION_PARM_CHECK_PERIOD(u1H2CDisconDecisionParm, check_period); - SET_8723B_H2CCMD_DISCONDECISION_PARM_TRY_PKT_NUM(u1H2CDisconDecisionParm, trypkt_num); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CDisconDecisionParm:", u1H2CDisconDecisionParm, H2C_DISCON_DECISION_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_DISCON_DECISION, H2C_DISCON_DECISION_LEN, u1H2CDisconDecisionParm); -} -#endif /* CONFIG_WOWLAN */ - void rtl8723b_set_FwMacIdConfig_cmd(struct adapter *padapter, u8 mac_id, u8 raid, u8 bw, u8 sgi, u32 mask) { u8 u1H2CMacIdConfigParm[H2C_MACID_CFG_LEN] = {0}; @@ -855,21 +559,12 @@ void rtl8723b_set_FwPwrMode_cmd(struct adapter *padapter, u8 psmode) else DBG_871X("%s(): FW LPS mode = %d, SmartPS =%d\n", __func__, psmode, pwrpriv->smart_ps); -#ifdef CONFIG_WOWLAN - if (psmode == PS_MODE_DTIM) { /* For WOWLAN LPS, DTIM = (awake_intvl - 1) */ + if (pwrpriv->dtim > 0 && pwrpriv->dtim < 16) + awake_intvl = pwrpriv->dtim+1;/* DTIM = (awake_intvl - 1) */ + else awake_intvl = 3;/* DTIM =2 */ - rlbm = 2; - } else -#endif /* CONFIG_WOWLAN */ - { - if (pwrpriv->dtim > 0 && pwrpriv->dtim < 16) - awake_intvl = pwrpriv->dtim+1;/* DTIM = (awake_intvl - 1) */ - else - awake_intvl = 3;/* DTIM =2 */ - - rlbm = 2; - } + rlbm = 2; if (padapter->registrypriv.wifi_spec == 1) { awake_intvl = 2; @@ -1003,135 +698,6 @@ void rtl8723b_set_FwPwrModeInIPS_cmd(struct adapter *padapter, u8 cmd_param) FillH2CCmd8723B(padapter, H2C_8723B_FWLPS_IN_IPS_, 1, &cmd_param); } -#ifdef CONFIG_WOWLAN -static void rtl8723b_set_FwWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) -{ - struct security_priv *psecpriv = &padapter->securitypriv; - u8 u1H2CWoWlanCtrlParm[H2C_WOWLAN_LEN] = {0}; - u8 discont_wake = 1, gpionum = 0, gpio_dur = 0, hw_unicast = 0; - u8 sdio_wakeup_enable = 1; - u8 gpio_high_active = 0; /* 0: low active, 1: high active */ - u8 magic_pkt = 0; - - if (psecpriv->dot11PrivacyAlgrthm == _WEP40_ || psecpriv->dot11PrivacyAlgrthm == _WEP104_) - hw_unicast = 1; - - DBG_871X("%s(): bFuncEn =%d\n", __func__, bFuncEn); - - SET_H2CCMD_WOWLAN_FUNC_ENABLE(u1H2CWoWlanCtrlParm, bFuncEn); - SET_H2CCMD_WOWLAN_PATTERN_MATCH_ENABLE(u1H2CWoWlanCtrlParm, 0); - SET_H2CCMD_WOWLAN_MAGIC_PKT_ENABLE(u1H2CWoWlanCtrlParm, magic_pkt); - SET_H2CCMD_WOWLAN_UNICAST_PKT_ENABLE(u1H2CWoWlanCtrlParm, hw_unicast); - SET_H2CCMD_WOWLAN_ALL_PKT_DROP(u1H2CWoWlanCtrlParm, 0); - SET_H2CCMD_WOWLAN_GPIO_ACTIVE(u1H2CWoWlanCtrlParm, gpio_high_active); - SET_H2CCMD_WOWLAN_DISCONNECT_WAKE_UP(u1H2CWoWlanCtrlParm, discont_wake); - SET_H2CCMD_WOWLAN_GPIONUM(u1H2CWoWlanCtrlParm, gpionum); - SET_H2CCMD_WOWLAN_DATAPIN_WAKE_UP(u1H2CWoWlanCtrlParm, sdio_wakeup_enable); - SET_H2CCMD_WOWLAN_GPIO_DURATION(u1H2CWoWlanCtrlParm, gpio_dur); - /* SET_H2CCMD_WOWLAN_GPIO_PULSE_EN(u1H2CWoWlanCtrlParm, 1); */ - SET_H2CCMD_WOWLAN_GPIO_PULSE_COUNT(u1H2CWoWlanCtrlParm, 0x09); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CWoWlanCtrlParm:", u1H2CWoWlanCtrlParm, H2C_WOWLAN_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_WOWLAN, H2C_WOWLAN_LEN, u1H2CWoWlanCtrlParm); -} - -static void rtl8723b_set_FwRemoteWakeCtrl_Cmd(struct adapter *padapter, u8 benable) -{ - u8 u1H2CRemoteWakeCtrlParm[H2C_REMOTE_WAKE_CTRL_LEN] = {0}; - struct security_priv *psecuritypriv = &(padapter->securitypriv); - struct pwrctrl_priv *ppwrpriv = adapter_to_pwrctl(padapter); - - DBG_871X("%s(): Enable =%d\n", __func__, benable); - - if (!ppwrpriv->wowlan_pno_enable) { - SET_H2CCMD_REMOTE_WAKECTRL_ENABLE(u1H2CRemoteWakeCtrlParm, benable); - SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, 1); -#ifdef CONFIG_GTK_OL - if (psecuritypriv->binstallKCK_KEK && - psecuritypriv->dot11PrivacyAlgrthm == _AES_) { - SET_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, 1); - } else { - DBG_871X("no kck or security is not AES\n"); - SET_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, 0); - } -#endif /* CONFIG_GTK_OL */ - - SET_H2CCMD_REMOTE_WAKE_CTRL_FW_UNICAST_EN(u1H2CRemoteWakeCtrlParm, 1); - - if ((psecuritypriv->dot11PrivacyAlgrthm == _AES_) || - (psecuritypriv->dot11PrivacyAlgrthm == _NO_PRIVACY_)) - SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_ACTION(u1H2CRemoteWakeCtrlParm, 0); - else - SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_ACTION(u1H2CRemoteWakeCtrlParm, 1); - } - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CRemoteWakeCtrlParm:", u1H2CRemoteWakeCtrlParm, H2C_REMOTE_WAKE_CTRL_LEN); - FillH2CCmd8723B(padapter, H2C_8723B_REMOTE_WAKE_CTRL, - H2C_REMOTE_WAKE_CTRL_LEN, u1H2CRemoteWakeCtrlParm); -} - -static void rtl8723b_set_FwAOACGlobalInfo_Cmd(struct adapter *padapter, u8 group_alg, u8 pairwise_alg) -{ - u8 u1H2CAOACGlobalInfoParm[H2C_AOAC_GLOBAL_INFO_LEN] = {0}; - - DBG_871X("%s(): group_alg =%d pairwise_alg =%d\n", __func__, group_alg, pairwise_alg); - - SET_H2CCMD_AOAC_GLOBAL_INFO_PAIRWISE_ENC_ALG(u1H2CAOACGlobalInfoParm, pairwise_alg); - SET_H2CCMD_AOAC_GLOBAL_INFO_GROUP_ENC_ALG(u1H2CAOACGlobalInfoParm, group_alg); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CAOACGlobalInfoParm:", u1H2CAOACGlobalInfoParm, H2C_AOAC_GLOBAL_INFO_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_AOAC_GLOBAL_INFO, H2C_AOAC_GLOBAL_INFO_LEN, u1H2CAOACGlobalInfoParm); -} - -void rtl8723b_set_wowlan_cmd(struct adapter *padapter, u8 enable) -{ - struct security_priv *psecpriv = &padapter->securitypriv; - struct pwrctrl_priv *ppwrpriv = adapter_to_pwrctl(padapter); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_info *psta = NULL; - u8 pkt_type = 0; - - DBG_871X_LEVEL(_drv_always_, "+%s()+: enable =%d\n", __func__, enable); - if (enable) { - rtl8723b_set_FwAOACGlobalInfo_Cmd(padapter, psecpriv->dot118021XGrpPrivacy, psecpriv->dot11PrivacyAlgrthm); - - rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); /* RT_MEDIA_CONNECT will confuse in the future */ - - if (!(ppwrpriv->wowlan_pno_enable)) { - psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv)); - if (psta) - rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); - } else - DBG_871X("%s(): Disconnected, no FwMediaStatusRpt CONNECT\n", __func__); - - msleep(2); - - if (!(ppwrpriv->wowlan_pno_enable)) { - rtl8723b_set_FwDisconDecision_cmd(padapter, enable); - msleep(2); - - if ((psecpriv->dot11PrivacyAlgrthm != _WEP40_) || (psecpriv->dot11PrivacyAlgrthm != _WEP104_)) - pkt_type = 1; - - rtl8723b_set_FwKeepAlive_cmd(padapter, enable, pkt_type); - msleep(2); - } - - rtl8723b_set_FwWoWlanCtrl_Cmd(padapter, enable); - msleep(2); - - rtl8723b_set_FwRemoteWakeCtrl_Cmd(padapter, enable); - } else { - rtl8723b_set_FwRemoteWakeCtrl_Cmd(padapter, enable); - msleep(2); - rtl8723b_set_FwWoWlanCtrl_Cmd(padapter, enable); - } - - DBG_871X_LEVEL(_drv_always_, "-%s()-\n", __func__); -} -#endif /* CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN static void rtl8723b_set_FwAPWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) { @@ -1223,17 +789,6 @@ static void rtl8723b_set_FwRsvdPagePkt( u16 BufIndex, PageSize = 128; u32 TotalPacketLen, MaxRsvdPageBufSize = 0; RSVDPAGE_LOC RsvdPageLoc; -#ifdef CONFIG_WOWLAN - u32 ARPLegnth = 0, GTKLegnth = 0; - u8 currentip[4]; - u8 cur_dot11txpn[8]; -#ifdef CONFIG_GTK_OL - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *psta; - u8 kek[RTW_KEK_LEN]; - u8 kck[RTW_KCK_LEN]; -#endif -#endif /* DBG_871X("%s---->\n", __func__); */ @@ -1343,107 +898,7 @@ static void rtl8723b_set_FwRsvdPagePkt( BufIndex += (CurtPktPageNum*PageSize); -#ifdef CONFIG_WOWLAN - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - /* if (pwrctl->wowlan_mode == true) { */ - /* BufIndex += (CurtPktPageNum*PageSize); */ - - /* 3(7) ARP RSP */ - rtw_get_current_ip_address(padapter, currentip); - RsvdPageLoc.LocArpRsp = TotalPageNum; - { - ConstructARPResponse( - padapter, - &ReservedPagePacket[BufIndex], - &ARPLegnth, - currentip - ); - rtl8723b_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], ARPLegnth, false, false, true); - - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: ARP RSP %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], (ARPLegnth+TxDescLen)); */ - - CurtPktPageNum = (u8)PageNum_128(TxDescLen + ARPLegnth); - } - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* 3(8) SEC IV */ - rtw_get_sec_iv(padapter, cur_dot11txpn, get_my_bssid(&pmlmeinfo->network)); - RsvdPageLoc.LocRemoteCtrlInfo = TotalPageNum; - memcpy(ReservedPagePacket+BufIndex-TxDescLen, cur_dot11txpn, _AES_IV_LEN_); - - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: SEC IV %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], _AES_IV_LEN_); */ - - CurtPktPageNum = (u8)PageNum_128(_AES_IV_LEN_); - - TotalPageNum += CurtPktPageNum; - -#ifdef CONFIG_GTK_OL - BufIndex += (CurtPktPageNum*PageSize); - - /* if the ap station info. exists, get the kek, kck from station info. */ - psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); - if (!psta) { - memset(kek, 0, RTW_KEK_LEN); - memset(kck, 0, RTW_KCK_LEN); - DBG_8192C("%s, KEK, KCK download rsvd page all zero\n", __func__); - } else { - memcpy(kek, psta->kek, RTW_KEK_LEN); - memcpy(kck, psta->kck, RTW_KCK_LEN); - } - - /* 3(9) KEK, KCK */ - RsvdPageLoc.LocGTKInfo = TotalPageNum; - memcpy(ReservedPagePacket+BufIndex-TxDescLen, kck, RTW_KCK_LEN); - memcpy(ReservedPagePacket+BufIndex-TxDescLen+RTW_KCK_LEN, kek, RTW_KEK_LEN); - - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: KEK KCK %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], (TxDescLen + RTW_KCK_LEN + RTW_KEK_LEN)); */ - - CurtPktPageNum = (u8)PageNum_128(TxDescLen + RTW_KCK_LEN + RTW_KEK_LEN); - - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* 3(10) GTK Response */ - RsvdPageLoc.LocGTKRsp = TotalPageNum; - ConstructGTKResponse( - padapter, - &ReservedPagePacket[BufIndex], - >KLegnth - ); - - rtl8723b_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], GTKLegnth, false, false, true); - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: GTK RSP %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], (TxDescLen + GTKLegnth)); */ - - CurtPktPageNum = (u8)PageNum_128(TxDescLen + GTKLegnth); - - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* below page is empty for GTK extension memory */ - /* 3(11) GTK EXT MEM */ - RsvdPageLoc.LocGTKEXTMEM = TotalPageNum; - - CurtPktPageNum = 2; - - TotalPageNum += CurtPktPageNum; - - TotalPacketLen = BufIndex-TxDescLen + 256; /* extension memory for FW */ -#else - TotalPacketLen = BufIndex - TxDescLen + sizeof(union pn48); /* IV len */ -#endif /* CONFIG_GTK_OL */ - } else -#endif /* CONFIG_WOWLAN */ - { - TotalPacketLen = BufIndex + BTQosNullLength; - } + TotalPacketLen = BufIndex + BTQosNullLength; if (TotalPacketLen > MaxRsvdPageBufSize) { DBG_871X("%s(): ERROR: The rsvd page size is not enough!!TotalPacketLen %d, MaxRsvdPageBufSize %d\n", __func__, diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 84e963909283..9f5e81375289 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -369,9 +369,6 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool bUsedWoWLANFw) u8 tmp_ps; RT_TRACE(_module_hal_init_c_, _drv_info_, ("+%s\n", __func__)); -#ifdef CONFIG_WOWLAN - RT_TRACE(_module_hal_init_c_, _drv_notice_, ("+%s, bUsedWoWLANFw:%d\n", __func__, bUsedWoWLANFw)); -#endif pFirmware = kzalloc(sizeof(struct rt_firmware), GFP_KERNEL); if (!pFirmware) return _FAIL; @@ -393,12 +390,7 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool bUsedWoWLANFw) pdbgpriv->dbg_downloadfw_pwr_state_cnt++; } -#ifdef CONFIG_WOWLAN - if (bUsedWoWLANFw) - fwfilepath = "rtlwifi/rtl8723bs_wowlan.bin"; - else -#endif /* CONFIG_WOWLAN */ - fwfilepath = "rtlwifi/rtl8723bs_nic.bin"; + fwfilepath = "rtlwifi/rtl8723bs_nic.bin"; pr_info("rtl8723bs: acquire FW from file:%s\n", fwfilepath); @@ -535,7 +527,7 @@ void rtl8723b_InitializeFirmwareVars(struct adapter *padapter) /* pHalData->H2CStopInsertQueue = false; */ } -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN /* */ /* */ @@ -566,7 +558,7 @@ void SetFwRelatedForWoWLAN8723b( /* */ rtl8723b_InitializeFirmwareVars(padapter); } -#endif /* CONFIG_WOWLAN */ +#endif /* CONFIG_AP_WOWLAN */ static void rtl8723b_free_hal_data(struct adapter *padapter) { @@ -3752,14 +3744,6 @@ void C2HPacketHandler_8723B(struct adapter *padapter, u8 *pbuffer, u16 length) { C2H_EVT_HDR C2hEvent; u8 *tmpBuf = NULL; -#ifdef CONFIG_WOWLAN - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - - if (pwrpriv->wowlan_mode) { - DBG_871X("%s(): return because wowolan_mode ==true! CMDID =%d\n", __func__, pbuffer[0]); - return; - } -#endif C2hEvent.CmdID = pbuffer[0]; C2hEvent.CmdSeq = pbuffer[1]; C2hEvent.CmdLen = length-2; @@ -4314,19 +4298,6 @@ void GetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val) val16 = rtw_read16(padapter, REG_TXPKT_EMPTY); *val = (val16 & BIT(10)) ? true:false; break; -#ifdef CONFIG_WOWLAN - case HW_VAR_RPWM_TOG: - *val = rtw_read8(padapter, SDIO_LOCAL_BASE|SDIO_REG_HRPWM1) & BIT7; - break; - case HW_VAR_WAKEUP_REASON: - *val = rtw_read8(padapter, REG_WOWLAN_WAKE_REASON); - if (*val == 0xEA) - *val = 0; - break; - case HW_VAR_SYS_CLKR: - *val = rtw_read8(padapter, REG_SYS_CLKR); - break; -#endif default: GetHwReg(padapter, variable, val); break; @@ -4461,14 +4432,6 @@ u8 GetHalDefVar8723B(struct adapter *padapter, enum HAL_DEF_VARIABLE variable, v return bResult; } -#ifdef CONFIG_WOWLAN -void Hal_DetectWoWMode(struct adapter *padapter) -{ - adapter_to_pwrctl(padapter)->bSupportRemoteWakeup = true; - DBG_871X("%s\n", __func__); -} -#endif /* CONFIG_WOWLAN */ - void rtl8723b_start_thread(struct adapter *padapter) { #ifndef CONFIG_SDIO_TX_TASKLET diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index ced05bbfc906..47cd3ae63687 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -689,30 +689,6 @@ static u32 rtl8723bs_hal_init(struct adapter *padapter) return _SUCCESS; } -#ifdef CONFIG_WOWLAN - if (rtw_read8(padapter, REG_MCUFWDL) & BIT7) { - u8 reg_val = 0; - DBG_871X("+Reset Entry+\n"); - rtw_write8(padapter, REG_MCUFWDL, 0x00); - _8051Reset8723(padapter); - /* reset BB */ - reg_val = rtw_read8(padapter, REG_SYS_FUNC_EN); - reg_val &= ~(BIT(0) | BIT(1)); - rtw_write8(padapter, REG_SYS_FUNC_EN, reg_val); - /* reset RF */ - rtw_write8(padapter, REG_RF_CTRL, 0); - /* reset TRX path */ - rtw_write16(padapter, REG_CR, 0); - /* reset MAC, Digital Core */ - reg_val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); - reg_val &= ~(BIT(4) | BIT(7)); - rtw_write8(padapter, REG_SYS_FUNC_EN + 1, reg_val); - reg_val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); - reg_val |= BIT(4) | BIT(7); - rtw_write8(padapter, REG_SYS_FUNC_EN + 1, reg_val); - DBG_871X("-Reset Entry-\n"); - } -#endif /* CONFIG_WOWLAN */ /* Disable Interrupt first. */ /* rtw_hal_disable_interrupt(padapter); */ @@ -1228,10 +1204,6 @@ static void _ReadEfuseInfo8723BS(struct adapter *padapter) Hal_EfuseParseVoltage_8723B(padapter, hwinfo, pEEPROM->bautoload_fail_flag); -#ifdef CONFIG_WOWLAN - Hal_DetectWoWMode(padapter); -#endif - Hal_ReadRFGainOffset(padapter, hwinfo, pEEPROM->bautoload_fail_flag); RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("<==== _ReadEfuseInfo8723BS()\n")); @@ -1322,7 +1294,7 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) { u8 val8; -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN struct wowlan_ioctl_param *poidparam; struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); int res; @@ -1330,13 +1302,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) u16 len = 0; u8 trycnt = 100; u32 himr = 0; -#if defined(CONFIG_WOWLAN) - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_info *psta = NULL; - u64 iv_low = 0, iv_high = 0; - u8 mstatus = (*(u8 *)val); -#endif #endif switch (variable) { @@ -1363,206 +1328,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) val8 = *val; break; -#ifdef CONFIG_WOWLAN - case HW_VAR_WOWLAN: - { - poidparam = (struct wowlan_ioctl_param *)val; - switch (poidparam->subcode) { - case WOWLAN_ENABLE: - DBG_871X_LEVEL(_drv_always_, "WOWLAN_ENABLE\n"); - - /* backup data rate to register 0x8b for wowlan FW */ - rtw_write8(padapter, 0x8d, 1); - rtw_write8(padapter, 0x8c, 0); - rtw_write8(padapter, 0x8f, 0x40); - rtw_write8(padapter, 0x8b, - rtw_read8(padapter, 0x2f0)); - - /* 1. Download WOWLAN FW */ - DBG_871X_LEVEL(_drv_always_, "Re-download WoWlan FW!\n"); - SetFwRelatedForWoWLAN8723b(padapter, true); - - /* 2. RX DMA stop */ - DBG_871X_LEVEL(_drv_always_, "Pause DMA\n"); - rtw_write32(padapter, REG_RXPKT_NUM, (rtw_read32(padapter, REG_RXPKT_NUM) | RW_RELEASE_EN)); - do { - if ((rtw_read32(padapter, REG_RXPKT_NUM) & RXDMA_IDLE)) { - DBG_871X_LEVEL(_drv_always_, "RX_DMA_IDLE is true\n"); - break; - } else { - /* If RX_DMA is not idle, receive one pkt from DMA */ - res = sdio_local_read(padapter, SDIO_REG_RX0_REQ_LEN, 4, (u8 *)&tmp); - len = le16_to_cpu(tmp); - DBG_871X_LEVEL(_drv_always_, "RX len:%d\n", len); - if (len > 0) - res = RecvOnePkt(padapter, len); - else - DBG_871X_LEVEL(_drv_always_, "read length fail %d\n", len); - - DBG_871X_LEVEL(_drv_always_, "RecvOnePkt Result: %d\n", res); - } - } while (trycnt--); - if (trycnt == 0) - DBG_871X_LEVEL(_drv_always_, "Stop RX DMA failed......\n"); - - /* 3. Clear IMR and ISR */ - DBG_871X_LEVEL(_drv_always_, "Clear IMR and ISR\n"); - tmp = 0; - sdio_local_write(padapter, SDIO_REG_HIMR_ON, 4, (u8 *)&tmp); - sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - sdio_local_read(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); - sdio_local_write(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); - - /* 4. Enable CPWM2 only */ - DBG_871X_LEVEL(_drv_always_, "Enable only CPWM2\n"); - sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - DBG_871X("DisableInterruptButCpwm28723BSdio(): Read SDIO_REG_HIMR: 0x%08x\n", tmp); - - himr = cpu_to_le32(SDIO_HIMR_DISABLED) | SDIO_HIMR_CPWM2_MSK; - sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&himr); - - sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - DBG_871X("DisableInterruptButCpwm28723BSdio(): Read again SDIO_REG_HIMR: 0x%08x\n", tmp); - - /* 5. Set Enable WOWLAN H2C command. */ - DBG_871X_LEVEL(_drv_always_, "Set Enable WOWLan cmd\n"); - rtl8723b_set_wowlan_cmd(padapter, 1); - - /* 6. Check EnableWoWlan CMD is ready */ - if (!pwrctl->wowlan_pno_enable) { - DBG_871X_LEVEL(_drv_always_, "Check EnableWoWlan CMD is ready\n"); - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - trycnt = 10; - while (!(mstatus & BIT1) && trycnt > 1) { - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - DBG_871X("Loop index: %d :0x%02x\n", trycnt, mstatus); - trycnt--; - msleep(2); - } - } - break; - - case WOWLAN_DISABLE: - DBG_871X_LEVEL(_drv_always_, "WOWLAN_DISABLE\n"); - - psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv)); - if (psta) - rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_DISCONNECT, psta->mac_id); - else - DBG_871X("psta is null\n"); - - /* 1. Read wakeup reason */ - pwrctl->wowlan_wake_reason = rtw_read8(padapter, REG_WOWLAN_WAKE_REASON); - DBG_871X_LEVEL( - _drv_always_, - "wakeup_reason: 0x%02x, mac_630 = 0x%08x, mac_634 = 0x%08x, mac_1c0 = 0x%08x, mac_1c4 = 0x%08x" - ", mac_494 = 0x%08x, , mac_498 = 0x%08x, mac_49c = 0x%08x, mac_608 = 0x%08x, mac_4a0 = 0x%08x, mac_4a4 = 0x%08x\n" - ", mac_1cc = 0x%08x, mac_2f0 = 0x%08x, mac_2f4 = 0x%08x, mac_2f8 = 0x%08x, mac_2fc = 0x%08x, mac_8c = 0x%08x", - pwrctl->wowlan_wake_reason, - rtw_read32(padapter, REG_WOWLAN_GTK_DBG1), - rtw_read32(padapter, REG_WOWLAN_GTK_DBG2), - rtw_read32(padapter, 0x1c0), - rtw_read32(padapter, 0x1c4), - rtw_read32(padapter, 0x494), - rtw_read32(padapter, 0x498), - rtw_read32(padapter, 0x49c), - rtw_read32(padapter, 0x608), - rtw_read32(padapter, 0x4a0), - rtw_read32(padapter, 0x4a4), - rtw_read32(padapter, 0x1cc), - rtw_read32(padapter, 0x2f0), - rtw_read32(padapter, 0x2f4), - rtw_read32(padapter, 0x2f8), - rtw_read32(padapter, 0x2fc), - rtw_read32(padapter, 0x8c) - ); - - { - /* 2. Set Disable WOWLAN H2C command. */ - DBG_871X_LEVEL(_drv_always_, "Set Disable WOWLan cmd\n"); - rtl8723b_set_wowlan_cmd(padapter, 0); - - /* 3. Check Disable WoWlan CMD ready. */ - DBG_871X_LEVEL(_drv_always_, "Check DisableWoWlan CMD is ready\n"); - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - trycnt = 50; - while (mstatus & BIT1 && trycnt > 1) { - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - DBG_871X_LEVEL(_drv_always_, "Loop index: %d :0x%02x\n", trycnt, mstatus); - trycnt--; - msleep(10); - } - - if (mstatus & BIT1) { - DBG_871X_LEVEL(_drv_always_, "Disable WOW mode fail!!\n"); - DBG_871X("Set 0x690 = 0x00\n"); - rtw_write8(padapter, REG_WOW_CTRL, (rtw_read8(padapter, REG_WOW_CTRL) & 0xf0)); - DBG_871X_LEVEL(_drv_always_, "Release RXDMA\n"); - rtw_write32(padapter, REG_RXPKT_NUM, (rtw_read32(padapter, REG_RXPKT_NUM) & (~RW_RELEASE_EN))); - } - - /* 3.1 read fw iv */ - iv_low = rtw_read32(padapter, REG_TXPKTBUF_IV_LOW); - /* only low two bytes is PN, check AES_IV macro for detail */ - iv_low &= 0xffff; - iv_high = rtw_read32(padapter, REG_TXPKTBUF_IV_HIGH); - /* get the real packet number */ - pwrctl->wowlan_fw_iv = iv_high << 16 | iv_low; - DBG_871X_LEVEL(_drv_always_, "fw_iv: 0x%016llx\n", pwrctl->wowlan_fw_iv); - /* Update TX iv data. */ - rtw_set_sec_pn(padapter); - - /* 3.2 read GTK index and key */ - if ( - psecuritypriv->binstallKCK_KEK == true && - psecuritypriv->dot11PrivacyAlgrthm == _AES_ - ) { - u8 gtk_keyindex = 0; - u8 get_key[16]; - /* read gtk key index */ - gtk_keyindex = rtw_read8(padapter, 0x48c); - - if (gtk_keyindex < 4) { - psecuritypriv->dot118021XGrpKeyid = gtk_keyindex; - read_cam(padapter, gtk_keyindex, get_key); - memcpy(psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, get_key, 16); - DBG_871X_LEVEL( - _drv_always_, - "GTK (%d) = 0x%08x, 0x%08x, 0x%08x, 0x%08x\n", - gtk_keyindex, - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[0], - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[1], - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[2], - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[3] - ); - } else - DBG_871X_LEVEL(_drv_always_, "GTK index =%d\n", gtk_keyindex); - } - - /* 4. Re-download Normal FW. */ - DBG_871X_LEVEL(_drv_always_, "Re-download Normal FW!\n"); - SetFwRelatedForWoWLAN8723b(padapter, false); - } - - /* 5. Download reserved pages and report media status if needed. */ - if ( - (pwrctl->wowlan_wake_reason != FWDecisionDisconnect) && - (pwrctl->wowlan_wake_reason != Rx_Pairwisekey) && - (pwrctl->wowlan_wake_reason != Rx_DisAssoc) && - (pwrctl->wowlan_wake_reason != Rx_DeAuth) - ) { - rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); - if (psta) - rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); - } - break; - - default: - break; - } - } - break; -#endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN case HW_VAR_AP_WOWLAN: { @@ -1765,9 +1530,6 @@ void rtl8723bs_set_hal_ops(struct adapter *padapter) pHalFunc->enable_interrupt = &EnableInterrupt8723BSdio; pHalFunc->disable_interrupt = &DisableInterrupt8723BSdio; pHalFunc->check_ips_status = &CheckIPSStatus; -#ifdef CONFIG_WOWLAN - pHalFunc->clear_interrupt = &ClearInterrupt8723BSdio; -#endif pHalFunc->SetHwRegHandler = &SetHwReg8723BS; pHalFunc->GetHwRegHandler = &GetHwReg8723BS; pHalFunc->SetHwRegHandlerWithBuf = &SetHwRegWithBuf8723B; diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c index 369f55d11519..2400b06dff36 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_ops.c +++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c @@ -1114,7 +1114,7 @@ void HalQueryTxOQTBufferStatus8723BSdio(struct adapter *adapter) haldata->SdioTxOQTFreeSpace = SdioLocalCmd52Read1Byte(adapter, SDIO_REG_OQT_FREE_PG); } -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN u8 RecvOnePkt(struct adapter *adapter, u32 size) { struct recv_buf *recvbuf; @@ -1149,4 +1149,4 @@ u8 RecvOnePkt(struct adapter *adapter, u32 size) DBG_871X("-%s-\n", __func__); return res; } -#endif /* CONFIG_WOWLAN */ +#endif /* CONFIG_AP_WOWLAN */ diff --git a/drivers/staging/rtl8723bs/include/autoconf.h b/drivers/staging/rtl8723bs/include/autoconf.h index 86cf09ca5f06..996198750814 100644 --- a/drivers/staging/rtl8723bs/include/autoconf.h +++ b/drivers/staging/rtl8723bs/include/autoconf.h @@ -40,9 +40,6 @@ * Platform dependent */ #define WAKEUP_GPIO_IDX 12 /* WIFI Chip Side */ -#ifdef CONFIG_WOWLAN -#define CONFIG_GTK_OL -#endif /* CONFIG_WOWLAN */ /* * Debug Related Config diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h index cfde6e3ba400..998c8dc230eb 100644 --- a/drivers/staging/rtl8723bs/include/drv_types.h +++ b/drivers/staging/rtl8723bs/include/drv_types.h @@ -534,11 +534,6 @@ int rtw_set_gpio_output_value(struct net_device *netdev, int gpio_num, bool isHi int rtw_config_gpio(struct net_device *netdev, int gpio_num, bool isOutput); #endif -#ifdef CONFIG_WOWLAN -void rtw_suspend_wow(struct adapter *padapter); -int rtw_resume_process_wow(struct adapter *padapter); -#endif - static inline u8 *myid(struct eeprom_priv *peepriv) { return peepriv->mac_addr; diff --git a/drivers/staging/rtl8723bs/include/drv_types_sdio.h b/drivers/staging/rtl8723bs/include/drv_types_sdio.h index 5e079838f59c..83f5e912baa7 100644 --- a/drivers/staging/rtl8723bs/include/drv_types_sdio.h +++ b/drivers/staging/rtl8723bs/include/drv_types_sdio.h @@ -11,7 +11,7 @@ #include #include -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN #include #include #endif diff --git a/drivers/staging/rtl8723bs/include/hal_com_h2c.h b/drivers/staging/rtl8723bs/include/hal_com_h2c.h index 1f7ed90f9faa..6b8ec01ddc6a 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_h2c.h +++ b/drivers/staging/rtl8723bs/include/hal_com_h2c.h @@ -95,60 +95,6 @@ enum h2c_cmd { #define H2C_BCN_RSVDPAGE_LEN 5 #define H2C_PROBERSP_RSVDPAGE_LEN 5 -#ifdef CONFIG_WOWLAN -#define eqMacAddr(a, b) (((a)[0] == (b)[0] && (a)[1] == (b)[1] && (a)[2] == (b)[2] && (a)[3] == (b)[3] && (a)[4] == (b)[4] && (a)[5] == (b)[5]) ? 1 : 0) -#define cpMacAddr(des, src) ((des)[0] = (src)[0], (des)[1] = (src)[1], (des)[2] = (src)[2], (des)[3] = (src)[3], (des)[4] = (src)[4], (des)[5] = (src)[5]) -#define cpIpAddr(des, src) ((des)[0] = (src)[0], (des)[1] = (src)[1], (des)[2] = (src)[2], (des)[3] = (src)[3]) - -/* */ -/* ARP packet */ -/* */ -/* LLC Header */ -#define GET_ARP_PKT_LLC_TYPE(__pHeader) ReadEF2Byte(((u8 *)(__pHeader)) + 6) - -/* ARP element */ -#define GET_ARP_PKT_OPERATION(__pHeader) ReadEF2Byte(((u8 *)(__pHeader)) + 6) -#define GET_ARP_PKT_SENDER_MAC_ADDR(__pHeader, _val) cpMacAddr((u8 *)(_val), ((u8 *)(__pHeader))+8) -#define GET_ARP_PKT_SENDER_IP_ADDR(__pHeader, _val) cpIpAddr((u8 *)(_val), ((u8 *)(__pHeader))+14) -#define GET_ARP_PKT_TARGET_MAC_ADDR(__pHeader, _val) cpMacAddr((u8 *)(_val), ((u8 *)(__pHeader))+18) -#define GET_ARP_PKT_TARGET_IP_ADDR(__pHeader, _val) cpIpAddr((u8 *)(_val), ((u8 *)(__pHeader))+24) - -#define SET_ARP_PKT_HW(__pHeader, __Value) WRITEEF2BYTE(((u8 *)(__pHeader)) + 0, __Value) -#define SET_ARP_PKT_PROTOCOL(__pHeader, __Value) WRITEEF2BYTE(((u8 *)(__pHeader)) + 2, __Value) -#define SET_ARP_PKT_HW_ADDR_LEN(__pHeader, __Value) WRITEEF1BYTE(((u8 *)(__pHeader)) + 4, __Value) -#define SET_ARP_PKT_PROTOCOL_ADDR_LEN(__pHeader, __Value) WRITEEF1BYTE(((u8 *)(__pHeader)) + 5, __Value) -#define SET_ARP_PKT_OPERATION(__pHeader, __Value) WRITEEF2BYTE(((u8 *)(__pHeader)) + 6, __Value) -#define SET_ARP_PKT_SENDER_MAC_ADDR(__pHeader, _val) cpMacAddr(((u8 *)(__pHeader))+8, (u8 *)(_val)) -#define SET_ARP_PKT_SENDER_IP_ADDR(__pHeader, _val) cpIpAddr(((u8 *)(__pHeader))+14, (u8 *)(_val)) -#define SET_ARP_PKT_TARGET_MAC_ADDR(__pHeader, _val) cpMacAddr(((u8 *)(__pHeader))+18, (u8 *)(_val)) -#define SET_ARP_PKT_TARGET_IP_ADDR(__pHeader, _val) cpIpAddr(((u8 *)(__pHeader))+24, (u8 *)(_val)) - -#define FW_WOWLAN_FUN_EN BIT(0) -#define FW_WOWLAN_PATTERN_MATCH BIT(1) -#define FW_WOWLAN_MAGIC_PKT BIT(2) -#define FW_WOWLAN_UNICAST BIT(3) -#define FW_WOWLAN_ALL_PKT_DROP BIT(4) -#define FW_WOWLAN_GPIO_ACTIVE BIT(5) -#define FW_WOWLAN_REKEY_WAKEUP BIT(6) -#define FW_WOWLAN_DEAUTH_WAKEUP BIT(7) - -#define FW_WOWLAN_GPIO_WAKEUP_EN BIT(0) -#define FW_FW_PARSE_MAGIC_PKT BIT(1) - -#define FW_REMOTE_WAKE_CTRL_EN BIT(0) -#define FW_REALWOWLAN_EN BIT(5) - -#define FW_WOWLAN_KEEP_ALIVE_EN BIT(0) -#define FW_ADOPT_USER BIT(1) -#define FW_WOWLAN_KEEP_ALIVE_PKT_TYPE BIT(2) - -#define FW_REMOTE_WAKE_CTRL_EN BIT(0) -#define FW_ARP_EN BIT(1) -#define FW_REALWOWLAN_EN BIT(5) -#define FW_WOW_FW_UNICAST_EN BIT(7) - -#endif /* CONFIG_WOWLAN */ - /* _RSVDPAGE_LOC_CMD_0x00 */ #define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd, 0, 8, __Value) #define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+1, 0, 8, __Value) @@ -230,9 +176,6 @@ enum h2c_cmd { #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_NEIGHBOR_ADV(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+2, 0, 8, __Value) #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_RSP(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+3, 0, 8, __Value) #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+4, 0, 8, __Value) -#ifdef CONFIG_GTK_OL -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+5, 0, 8, __Value) -#endif /* CONFIG_GTK_OL */ /* */ /* Structure -------------------------------------------------- */ @@ -243,25 +186,13 @@ typedef struct _RSVDPAGE_LOC { u8 LocNullData; u8 LocQosNull; u8 LocBTQosNull; -#ifdef CONFIG_WOWLAN - u8 LocRemoteCtrlInfo; - u8 LocArpRsp; - u8 LocNbrAdv; - u8 LocGTKRsp; - u8 LocGTKInfo; - u8 LocProbeReq; - u8 LocNetList; -#ifdef CONFIG_GTK_OL - u8 LocGTKEXTMEM; -#endif /* CONFIG_GTK_OL */ -#endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN u8 LocApOffloadBCN; #endif /* CONFIG_AP_WOWLAN */ } RSVDPAGE_LOC, *PRSVDPAGE_LOC; #endif -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip); void rtw_get_sec_iv(struct adapter *padapter, u8*pcur_dot11txpn, u8 *StaAddr); void rtw_set_sec_pn(struct adapter *padapter); diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h index 426c8d58c444..093e00b9349b 100644 --- a/drivers/staging/rtl8723bs/include/hal_intf.h +++ b/drivers/staging/rtl8723bs/include/hal_intf.h @@ -85,11 +85,6 @@ enum HW_VARIABLES { HW_VAR_APFM_ON_MAC, /* Auto FSM to Turn On, include clock, isolation, power control for MAC only */ /* The valid upper nav range for the HW updating, if the true value is larger than the upper range, the HW won't update it. */ /* Unit in microsecond. 0 means disable this function. */ -#ifdef CONFIG_WOWLAN - HW_VAR_WOWLAN, - HW_VAR_WAKEUP_REASON, - HW_VAR_RPWM_TOG, -#endif #ifdef CONFIG_AP_WOWLAN HW_VAR_AP_WOWLAN, #endif diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h b/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h index 3bfb0e9be582..b85e67ccc7db 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h @@ -177,11 +177,11 @@ void rtl8723b_download_BTCoex_AP_mode_rsvd_page(struct adapter *padapter); void CheckFwRsvdPageContent(struct adapter *padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN void rtl8723b_set_wowlan_cmd(struct adapter *padapter, u8 enable); void rtl8723b_set_ap_wowlan_cmd(struct adapter *padapter, u8 enable); void SetFwRelatedForWoWLAN8723b(struct adapter *padapter, u8 bHostIsGoingtoSleep); -#endif/* CONFIG_WOWLAN */ +#endif void rtl8723b_set_FwPwrModeInIPS_cmd(struct adapter *padapter, u8 cmd_param); diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index 2537bd7d6a13..819594616e38 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -96,11 +96,7 @@ struct rt_firmware_hdr { /* For WoWLan, more reserved page */ /* ARP Rsp:1, RWC:1, GTK Info:1, GTK RSP:2, GTK EXT MEM:2, PNO: 6 */ -#ifdef CONFIG_WOWLAN -#define WOWLAN_PAGE_NUM_8723B 0x07 -#else #define WOWLAN_PAGE_NUM_8723B 0x00 -#endif #ifdef CONFIG_AP_WOWLAN #define AP_WOWLAN_PAGE_NUM_8723B 0x02 @@ -244,9 +240,6 @@ u8 GetHalDefVar8723B(struct adapter *padapter, enum HAL_DEF_VARIABLE variable, void rtl8723b_InitBeaconParameters(struct adapter *padapter); void _InitBurstPktLen_8723BS(struct adapter *adapter); void _8051Reset8723(struct adapter *padapter); -#ifdef CONFIG_WOWLAN -void Hal_DetectWoWMode(struct adapter *padapter); -#endif /* CONFIG_WOWLAN */ void rtl8723b_start_thread(struct adapter *padapter); void rtl8723b_stop_thread(struct adapter *padapter); diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h index 9149fe598545..999555476ebc 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h @@ -96,10 +96,6 @@ #define REG_TXPKTBUF_BCNQ_BDNY_8723B 0x0424 #define REG_TXPKTBUF_MGQ_BDNY_8723B 0x0425 #define REG_TXPKTBUF_WMAC_LBK_BF_HD_8723B 0x045D -#ifdef CONFIG_WOWLAN -#define REG_TXPKTBUF_IV_LOW 0x0484 -#define REG_TXPKTBUF_IV_HIGH 0x0488 -#endif #define REG_AMPDU_BURST_MODE_8723B 0x04BC /* */ @@ -164,12 +160,6 @@ #define BIT_USB_RXDMA_AGG_EN BIT(31) #define RXDMA_AGG_MODE_EN BIT(1) -#ifdef CONFIG_WOWLAN -#define RXPKT_RELEASE_POLL BIT(16) -#define RXDMA_IDLE BIT(17) -#define RW_RELEASE_EN BIT(18) -#endif - /* */ /* */ /* 0x0400h ~ 0x047Fh Protocol Configuration */ diff --git a/drivers/staging/rtl8723bs/include/rtw_mp.h b/drivers/staging/rtl8723bs/include/rtw_mp.h index 2ea7100c3a4c..2de0b50bbfc5 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mp.h +++ b/drivers/staging/rtl8723bs/include/rtw_mp.h @@ -189,9 +189,6 @@ enum { CTA_TEST, MP_DISABLE_BT_COEXIST, MP_PwrCtlDM, -#ifdef CONFIG_WOWLAN - MP_WOW_ENABLE, -#endif #ifdef CONFIG_AP_WOWLAN MP_AP_WOW_ENABLE, #endif diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h index f467e9032450..334642b8cff9 100644 --- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h @@ -220,15 +220,6 @@ struct pwrctrl_priv { u8 wowlan_wake_reason; u8 wowlan_ap_mode; u8 wowlan_mode; -#ifdef CONFIG_WOWLAN - u8 wowlan_pattern; - u8 wowlan_magic; - u8 wowlan_unicast; - u8 wowlan_pattern_idx; - u8 wowlan_pno_enable; - u32 wowlan_pattern_context[8][5]; - u64 wowlan_fw_iv; -#endif /* CONFIG_WOWLAN */ _timer pwr_state_check_timer; struct adapter *adapter; int pwr_state_check_interval; diff --git a/drivers/staging/rtl8723bs/include/rtw_security.h b/drivers/staging/rtl8723bs/include/rtw_security.h index 85ffd4ec4ce5..ec033767fc45 100644 --- a/drivers/staging/rtl8723bs/include/rtw_security.h +++ b/drivers/staging/rtl8723bs/include/rtw_security.h @@ -129,9 +129,6 @@ struct security_priv { u8 binstallGrpkey; -#ifdef CONFIG_GTK_OL - u8 binstallKCK_KEK; -#endif /* CONFIG_GTK_OL */ u8 binstallBIPkey; u8 busetkipkey; /* _timer tkip_timer; */ diff --git a/drivers/staging/rtl8723bs/include/sdio_ops.h b/drivers/staging/rtl8723bs/include/sdio_ops.h index 6b0446be6d19..1f1f368cded4 100644 --- a/drivers/staging/rtl8723bs/include/sdio_ops.h +++ b/drivers/staging/rtl8723bs/include/sdio_ops.h @@ -25,17 +25,17 @@ s32 _sdio_write32(struct adapter *padapter, u32 addr, u32 val); extern void sd_int_hdl(struct adapter *padapter); extern u8 CheckIPSStatus(struct adapter *padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN extern u8 RecvOnePkt(struct adapter *padapter, u32 size); -#endif /* CONFIG_WOWLAN */ +#endif extern void InitInterrupt8723BSdio(struct adapter *padapter); extern void InitSysInterrupt8723BSdio(struct adapter *padapter); extern void EnableInterrupt8723BSdio(struct adapter *padapter); extern void DisableInterrupt8723BSdio(struct adapter *padapter); extern u8 HalQueryTxBufferStatus8723BSdio(struct adapter *padapter); extern void HalQueryTxOQTBufferStatus8723BSdio(struct adapter *padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN extern void ClearInterrupt8723BSdio(struct adapter *padapter); -#endif /* CONFIG_WOWLAN */ +#endif #endif /* !__SDIO_OPS_H__ */ diff --git a/drivers/staging/rtl8723bs/include/sta_info.h b/drivers/staging/rtl8723bs/include/sta_info.h index 734f4e2ecd66..fff0bed1233b 100644 --- a/drivers/staging/rtl8723bs/include/sta_info.h +++ b/drivers/staging/rtl8723bs/include/sta_info.h @@ -92,11 +92,6 @@ struct sta_info { union Keytype dot11tkiprxmickey; union Keytype dot118021x_UncstKey; union pn48 dot11txpn; /* PN48 used for Unicast xmit */ -#ifdef CONFIG_GTK_OL - u8 kek[RTW_KEK_LEN]; - u8 kck[RTW_KCK_LEN]; - u8 replay_ctr[RTW_REPLAY_CTR_LEN]; -#endif /* CONFIG_GTK_OL */ union pn48 dot11wtxpn; /* PN48 used for Unicast mgmt xmit. */ union pn48 dot11rxpn; /* PN48 used for Unicast recv. */ diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index 78ba2423ed65..f4b99c6b82ad 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -4669,9 +4669,6 @@ static const struct iw_priv_args rtw_private_args[] = { IW_PRIV_TYPE_CHAR | 40, IW_PRIV_TYPE_CHAR | 0x7FF, "test" }, -#ifdef CONFIG_WOWLAN - { MP_WOW_ENABLE, IW_PRIV_TYPE_CHAR | 1024, 0, "wow_mode" }, /* set */ -#endif #ifdef CONFIG_AP_WOWLAN { MP_AP_WOW_ENABLE, IW_PRIV_TYPE_CHAR | 1024, 0, "ap_wow_mode" }, /* set */ #endif diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index 61488781d211..2c0df0db6419 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -596,9 +596,6 @@ static void rtw_init_default_value(struct adapter *padapter) /* security_priv */ /* rtw_get_encrypt_decrypt_from_registrypriv(padapter); */ psecuritypriv->binstallGrpkey = _FAIL; -#ifdef CONFIG_GTK_OL - psecuritypriv->binstallKCK_KEK = _FAIL; -#endif /* CONFIG_GTK_OL */ psecuritypriv->sw_encrypt = pregistrypriv->software_encrypt; psecuritypriv->sw_decrypt = pregistrypriv->software_decrypt; @@ -1174,16 +1171,10 @@ void rtw_dev_unload(struct adapter *padapter) if (!padapter->bSurpriseRemoved) { hal_btcoex_IpsNotify(padapter, pwrctl->ips_mode_req); -#ifdef CONFIG_WOWLAN - if (pwrctl->bSupportRemoteWakeup && pwrctl->wowlan_mode) { - DBG_871X_LEVEL(_drv_always_, "%s bSupportRemoteWakeup ==true do not run rtw_hal_deinit()\n", __func__); - } - else -#endif - { - /* amy modify 20120221 for power seq is different between driver open and ips */ - rtw_hal_deinit(padapter); - } + + /* amy modify 20120221 for power seq is different between driver open and ips */ + rtw_hal_deinit(padapter); + padapter->bSurpriseRemoved = true; } RT_TRACE(_module_hci_intfs_c_, _drv_notice_, @@ -1244,81 +1235,6 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) return _SUCCESS; } -#ifdef CONFIG_WOWLAN -void rtw_suspend_wow(struct adapter *padapter) -{ - u8 ch, bw, offset; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct net_device *pnetdev = padapter->pnetdev; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct wowlan_ioctl_param poidparam; - - DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); - - - DBG_871X("wowlan_mode: %d\n", pwrpriv->wowlan_mode); - DBG_871X("wowlan_pno_enable: %d\n", pwrpriv->wowlan_pno_enable); - - if (pwrpriv->wowlan_mode) { - if (pnetdev) - rtw_netif_stop_queue(pnetdev); - /* 1. stop thread */ - padapter->bDriverStopped = true; /* for stop thread */ - rtw_stop_drv_threads(padapter); - padapter->bDriverStopped = false; /* for 32k command */ - - /* 2. disable interrupt */ - if (padapter->intf_stop) - padapter->intf_stop(padapter); - - /* 2.1 clean interrupt */ - if (padapter->HalFunc.clear_interrupt) - padapter->HalFunc.clear_interrupt(padapter); - - /* 2.2 free irq */ - /* sdio_free_irq(adapter_to_dvobj(padapter)); */ - if (padapter->intf_free_irq) - padapter->intf_free_irq(adapter_to_dvobj(padapter)); - - poidparam.subcode = WOWLAN_ENABLE; - padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_WOWLAN, (u8 *)&poidparam); - if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) { - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)) { - DBG_871X("%s %s(%pM), length:%d assoc_ssid.length:%d\n", __func__, - pmlmepriv->cur_network.network.Ssid.Ssid, - MAC_ARG(pmlmepriv->cur_network.network.MacAddress), - pmlmepriv->cur_network.network.Ssid.SsidLength, - pmlmepriv->assoc_ssid.SsidLength); - - rtw_set_to_roam(padapter, 0); - } - } - - DBG_871X_LEVEL(_drv_always_, "%s: wowmode suspending\n", __func__); - - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) { - DBG_871X_LEVEL(_drv_always_, "%s: fw_under_survey\n", __func__); - rtw_indicate_scan_done(padapter, 1); - clr_fwstate(pmlmepriv, _FW_UNDER_SURVEY); - } - - if (rtw_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) { - DBG_871X(FUNC_ADPT_FMT " back to linked/linking union - ch:%u, bw:%u, offset:%u\n", - FUNC_ADPT_ARG(padapter), ch, bw, offset); - set_channel_bwmode(padapter, ch, offset, bw); - } - - if (pwrpriv->wowlan_pno_enable) - DBG_871X_LEVEL(_drv_always_, "%s: pno: %d\n", __func__, pwrpriv->wowlan_pno_enable); - else - rtw_set_ps_mode(padapter, PS_MODE_DTIM, 0, 0, "WOWLAN"); - } else { - DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode =%d\n", __func__, pwrpriv->wowlan_mode); - } - DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); -} -#endif /* ifdef CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN void rtw_suspend_ap_wow(struct adapter *padapter) { @@ -1440,20 +1356,7 @@ int rtw_suspend_common(struct adapter *padapter) rtw_ps_deny_cancel(padapter, PS_DENY_SUSPEND); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { - #ifdef CONFIG_WOWLAN - if (check_fwstate(pmlmepriv, _FW_LINKED)) - pwrpriv->wowlan_mode = true; - else if (pwrpriv->wowlan_pno_enable) - pwrpriv->wowlan_mode |= pwrpriv->wowlan_pno_enable; - - if (pwrpriv->wowlan_mode) - rtw_suspend_wow(padapter); - else - rtw_suspend_normal(padapter); - - #else /* CONFIG_WOWLAN */ rtw_suspend_normal(padapter); - #endif /* CONFIG_WOWLAN */ } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { #ifdef CONFIG_AP_WOWLAN rtw_suspend_ap_wow(padapter); @@ -1474,124 +1377,6 @@ int rtw_suspend_common(struct adapter *padapter) return ret; } -#ifdef CONFIG_WOWLAN -int rtw_resume_process_wow(struct adapter *padapter) -{ - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct net_device *pnetdev = padapter->pnetdev; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct dvobj_priv *psdpriv = padapter->dvobj; - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; - struct wowlan_ioctl_param poidparam; - struct sta_info *psta = NULL; - int ret = _SUCCESS; - - DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); - - if (padapter) { - pnetdev = padapter->pnetdev; - pwrpriv = adapter_to_pwrctl(padapter); - } else { - pdbgpriv->dbg_resume_error_cnt++; - ret = -1; - goto exit; - } - - if (padapter->bDriverStopped || padapter->bSurpriseRemoved) { - DBG_871X("%s pdapter %p bDriverStopped %d bSurpriseRemoved %d\n", - __func__, padapter, padapter->bDriverStopped, - padapter->bSurpriseRemoved); - goto exit; - } - - if (pwrpriv->wowlan_mode) { - rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN"); - - pwrpriv->bFwCurrentInPSMode = false; - - if (padapter->intf_stop) - padapter->intf_stop(padapter); - - if (padapter->HalFunc.clear_interrupt) - padapter->HalFunc.clear_interrupt(padapter); - - /* if (sdio_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS) { */ - if ((padapter->intf_alloc_irq) && (padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS)) { - ret = -1; - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("%s: sdio_alloc_irq Failed!!\n", __func__)); - goto exit; - } - - /* Disable WOW, set H2C command */ - poidparam.subcode = WOWLAN_DISABLE; - padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_WOWLAN, (u8 *)&poidparam); - - psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv)); - if (psta) - set_sta_rate(padapter, psta); - - padapter->bDriverStopped = false; - DBG_871X("%s: wowmode resuming, DriverStopped:%d\n", __func__, padapter->bDriverStopped); - rtw_start_drv_threads(padapter); - - if (padapter->intf_start) - padapter->intf_start(padapter); - - /* start netif queue */ - if (pnetdev) { - if (!rtw_netif_queue_stopped(pnetdev)) - rtw_netif_start_queue(pnetdev); - else - rtw_netif_wake_queue(pnetdev); - } - } else { - DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode =%d\n", __func__, pwrpriv->wowlan_mode); - } - - if (padapter->pid[1] != 0) { - DBG_871X("pid[1]:%d\n", padapter->pid[1]); - rtw_signal_process(padapter->pid[1], SIGUSR2); - } - - if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) { - if (pwrpriv->wowlan_wake_reason == FWDecisionDisconnect || - pwrpriv->wowlan_wake_reason == Rx_DisAssoc || - pwrpriv->wowlan_wake_reason == Rx_DeAuth) { - DBG_871X("%s: disconnect reason: %02x\n", __func__, - pwrpriv->wowlan_wake_reason); - rtw_indicate_disconnect(padapter); - - rtw_sta_media_status_rpt(padapter, - rtw_get_stainfo(&padapter->stapriv, - get_bssid(&padapter->mlmepriv)), 0); - - rtw_free_assoc_resources(padapter, 1); - pmlmeinfo->state = WIFI_FW_NULL_STATE; - - } else { - DBG_871X("%s: do roaming\n", __func__); - rtw_roaming(padapter, NULL); - } - } - - if (pwrpriv->wowlan_mode) { - pwrpriv->bips_processing = false; - _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); - } else { - DBG_871X_LEVEL(_drv_always_, "do not reset timer\n"); - } - - pwrpriv->wowlan_mode = false; - - /* clean driver side wake up reason. */ - pwrpriv->wowlan_wake_reason = 0; -exit: - DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); - return ret; -} -#endif /* ifdef CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN int rtw_resume_process_ap_wow(struct adapter *padapter) { @@ -1753,15 +1538,7 @@ int rtw_resume_common(struct adapter *padapter) DBG_871X("==> %s (%s:%d)\n", __func__, current->comm, current->pid); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { - #ifdef CONFIG_WOWLAN - if (pwrpriv->wowlan_mode) - rtw_resume_process_wow(padapter); - else - rtw_resume_process_normal(padapter); - #else rtw_resume_process_normal(padapter); - #endif - } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { #ifdef CONFIG_AP_WOWLAN rtw_resume_process_ap_wow(padapter); diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c index 079e75164f1e..8f8549eee23e 100644 --- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c +++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c @@ -377,11 +377,6 @@ static void rtw_sdio_if1_deinit(struct adapter *if1) rtw_cancel_all_timer(if1); -#ifdef CONFIG_WOWLAN - adapter_to_pwrctl(if1)->wowlan_mode = false; - DBG_871X_LEVEL(_drv_always_, "%s wowlan_mode:%d\n", __func__, adapter_to_pwrctl(if1)->wowlan_mode); -#endif /* CONFIG_WOWLAN */ - rtw_dev_unload(if1); DBG_871X("+r871xu_dev_remove, hw_init_completed =%d\n", if1->hw_init_completed); -- 2.20.1 From fabioaiuto83 at gmail.com Fri Mar 12 18:34:06 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Fri, 12 Mar 2021 19:34:06 +0100 Subject: [PATCH v2 4/4] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_TCP_CSUM_OFFLOAD_RX In-Reply-To: References: Message-ID: <0975dcb60dfb6abdc6a3233283908bd57472c225.1615572985.git.fabioaiuto83@gmail.com> remove conditional code blocks checked by unused CONFIG_TCP_CSUM_OFFLOAD_RX cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/include/rtw_recv.h | 5 ----- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 8 -------- 2 files changed, 13 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h index b4aeb44d5d6e..078854a55a31 100644 --- a/drivers/staging/rtl8723bs/include/rtw_recv.h +++ b/drivers/staging/rtl8723bs/include/rtw_recv.h @@ -159,11 +159,6 @@ struct rx_pkt_attrib { u8 ack_policy; -/* ifdef CONFIG_TCP_CSUM_OFFLOAD_RX */ - u8 tcpchk_valid; /* 0: invalid, 1: valid */ - u8 ip_chkrpt; /* 0: incorrect, 1: correct */ - u8 tcp_chkrpt; /* 0: incorrect, 1: correct */ -/* endif */ u8 key_index; u8 data_rate; diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c index f52802f24466..78d5b6913467 100644 --- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c @@ -138,15 +138,7 @@ void rtw_os_recv_indicate_pkt(struct adapter *padapter, _pkt *pkt, struct rx_pkt pkt->protocol = eth_type_trans(pkt, padapter->pnetdev); pkt->dev = padapter->pnetdev; -#ifdef CONFIG_TCP_CSUM_OFFLOAD_RX - if ((pattrib->tcpchk_valid == 1) && (pattrib->tcp_chkrpt == 1)) - pkt->ip_summed = CHECKSUM_UNNECESSARY; - else - pkt->ip_summed = CHECKSUM_NONE; - -#else /* !CONFIG_TCP_CSUM_OFFLOAD_RX */ pkt->ip_summed = CHECKSUM_NONE; -#endif /* CONFIG_TCP_CSUM_OFFLOAD_RX */ ret = rtw_netif_rx(padapter->pnetdev, pkt); } -- 2.20.1 From u.kleine-koenig at pengutronix.de Fri Mar 12 20:12:17 2021 From: u.kleine-koenig at pengutronix.de (Uwe =?utf-8?Q?Kleine-K=C3=B6nig?=) Date: Fri, 12 Mar 2021 21:12:17 +0100 Subject: [PATCH v8 11/11] pwm: Add Raspberry Pi Firmware based PWM bus In-Reply-To: <20210312122454.24480-12-nsaenzjulienne@suse.de> References: <20210312122454.24480-1-nsaenzjulienne@suse.de> <20210312122454.24480-12-nsaenzjulienne@suse.de> Message-ID: <20210312201217.n2sav23swy7ii4uo@pengutronix.de> Hello Nicolas, On Fri, Mar 12, 2021 at 01:24:54PM +0100, Nicolas Saenz Julienne wrote: > Adds support to control the PWM bus available in official Raspberry Pi > PoE HAT. Only RPi's co-processor has access to it, so commands have to > be sent through RPi's firmware mailbox interface. > > Signed-off-by: Nicolas Saenz Julienne > > --- > > Changes since v7: > - Remove unwarranted RPI_PWM_DEF_DUTY_REG usage > > Changes since v6: > - Use %pe > - Round divisions properly > - Use dev_err_probe() > - Pass check_patch > > Changes since v3: > - Rename compatible string to be more explicit WRT to bus's limitations > > Changes since v2: > - Use devm_rpi_firmware_get() > - Rename driver > - Small cleanups > > Changes since v1: > - Use default pwm bindings and get rid of xlate() function > - Correct spelling errors > - Correct apply() function > - Round values > - Fix divisions in arm32 mode > - Small cleanups > > drivers/pwm/Kconfig | 9 ++ > drivers/pwm/Makefile | 1 + > drivers/pwm/pwm-raspberrypi-poe.c | 206 ++++++++++++++++++++++++++++++ > 3 files changed, 216 insertions(+) > create mode 100644 drivers/pwm/pwm-raspberrypi-poe.c > > diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig > index a7a7a9f26aef..d3371ac7b871 100644 > --- a/drivers/pwm/Kconfig > +++ b/drivers/pwm/Kconfig > @@ -431,6 +431,15 @@ config PWM_PXA > To compile this driver as a module, choose M here: the module > will be called pwm-pxa. > > +config PWM_RASPBERRYPI_POE > + tristate "Raspberry Pi Firwmware PoE Hat PWM support" > + # Make sure not 'y' when RASPBERRYPI_FIRMWARE is 'm'. This can only > + # happen when COMPILE_TEST=y, hence the added !RASPBERRYPI_FIRMWARE. > + depends on RASPBERRYPI_FIRMWARE || (COMPILE_TEST && !RASPBERRYPI_FIRMWARE) > + help > + Enable Raspberry Pi firmware controller PWM bus used to control the > + official RPI PoE hat > + > config PWM_RCAR > tristate "Renesas R-Car PWM support" > depends on ARCH_RENESAS || COMPILE_TEST > diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile > index 4e35a55fa7b6..d3879619bd76 100644 > --- a/drivers/pwm/Makefile > +++ b/drivers/pwm/Makefile > @@ -39,6 +39,7 @@ obj-$(CONFIG_PWM_NTXEC) += pwm-ntxec.o > obj-$(CONFIG_PWM_OMAP_DMTIMER) += pwm-omap-dmtimer.o > obj-$(CONFIG_PWM_PCA9685) += pwm-pca9685.o > obj-$(CONFIG_PWM_PXA) += pwm-pxa.o > +obj-$(CONFIG_PWM_RASPBERRYPI_POE) += pwm-raspberrypi-poe.o > obj-$(CONFIG_PWM_RCAR) += pwm-rcar.o > obj-$(CONFIG_PWM_RENESAS_TPU) += pwm-renesas-tpu.o > obj-$(CONFIG_PWM_ROCKCHIP) += pwm-rockchip.o > diff --git a/drivers/pwm/pwm-raspberrypi-poe.c b/drivers/pwm/pwm-raspberrypi-poe.c > new file mode 100644 > index 000000000000..71ade5e55069 > --- /dev/null > +++ b/drivers/pwm/pwm-raspberrypi-poe.c > @@ -0,0 +1,206 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright 2020 Nicolas Saenz Julienne 2021? > + * For more information on Raspberry Pi's PoE hat see: > + * https://www.raspberrypi.org/products/poe-hat/ Out of personal interest: Is this hat also able to power a RPi CM4? > + * Limitations: > + * - No disable bit, so a disabled PWM is simulated by duty_cycle 0 > + * - Only normal polarity > + * - Fixed 12.5 kHz period > + * > + * The current period is completed when HW is reconfigured. > + */ Other than that as mentioned in the previous round: This looks good, Reviewed-by: Uwe Kleine-K?nig What is your thought about how to get this series merged? At least input, staging, armsoc, clk, reset anf firmware are touched. Do you prepare a branch for merging in the relevant trees (once you have all the necessary Acks)? Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | https://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: not available URL: From broonie at kernel.org Fri Mar 12 20:25:23 2021 From: broonie at kernel.org (Mark Brown) Date: Fri, 12 Mar 2021 20:25:23 +0000 Subject: [PATCH 00/10] spi: finalize 'delay_usecs' removal/transition In-Reply-To: <20210308145502.1075689-1-aardelean@deviqon.com> References: <20210308145502.1075689-1-aardelean@deviqon.com> Message-ID: <161558072332.11700.3899329199367246111.b4-ty@kernel.org> On Mon, 8 Mar 2021 16:54:52 +0200, Alexandru Ardelean wrote: > A while back I started the introduction of the 'spi_delay' data type: > https://lore.kernel.org/linux-spi/20190926105147.7839-1-alexandru.ardelean at analog.com/ > > Users of the 'delay_usecs' were removed from drivers. > > Now it's time to remove the 'delay_usecs' from the SPI subsystem and use > only the 'delay' field. > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next Thanks! [01/10] spi: spi-axi-spi-engine: remove usage of delay_usecs commit: 93c941448994a728e691f7dce9ea6475e352b09c [02/10] spi: bcm63xx-spi: don't check 'delay_usecs' field commit: e7f2d4c6aacd0a2cded363bb14ef9b6e752798fd [03/10] spi: spi-bcm-qspi: replace 'delay_usecs' with 'delay.value' check commit: 66a3aadec42aa001c62ae9a637398d853880a02b [04/10] spi: spi-sh: replace 'delay_usecs' with 'delay.value' in pr_debug commit: 506d1a1b441e058e318d8d81141295ff76927367 [05/10] spi: spi-tegra20-flash: don't check 'delay_usecs' field for spi transfer commit: 7ca660f8212b2fbeb0f3133c3a6fa8805777a877 [06/10] staging: greybus: spilib: use 'spi_delay_to_ns' for getting xfer delay commit: 33a23423ca0a08b488791fc9d4ca53f4bea4e45b [07/10] spi: spi-falcon: remove check for 'delay_usecs' commit: a886010c69718988756fd7873522caa0f26af398 [08/10] spi: fsl-espi: remove usage of 'delay_usecs' field commit: 55a47532fa4c5dc3291d796dd21cc80034b5d067 [09/10] spi: core: remove 'delay_usecs' field from spi_transfer commit: 3ab1cce553378fc0df1b1d26d7e23d03bd4dd3b6 [10/10] spi: docs: update info about 'delay_usecs' commit: 05d8a019eb057d14cdf9483318a7ee8b35a69cda All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From tkjos at google.com Sat Mar 13 00:00:01 2021 From: tkjos at google.com (Todd Kjos) Date: Fri, 12 Mar 2021 16:00:01 -0800 Subject: [PATCH v2 1/3] binder: BINDER_FREEZE ioctl In-Reply-To: <20210311184629.589725-2-dualli@chromium.org> References: <20210311184629.589725-1-dualli@chromium.org> <20210311184629.589725-2-dualli@chromium.org> Message-ID: On Thu, Mar 11, 2021 at 10:46 AM Li Li wrote: > > From: Marco Ballesio > > Frozen tasks can't process binder transactions, so a way is required to > inform transmitting ends of communication failures due to the frozen > state of their receiving counterparts. Additionally, races are possible > between transitions to frozen state and binder transactions enqueued to > a specific process. > > Implement BINDER_FREEZE ioctl for user space to inform the binder driver > about the intention to freeze or unfreeze a process. When the ioctl is > called, block the caller until any pending binder transactions toward > the target process are flushed. Return an error to transactions to > processes marked as frozen. > > Signed-off-by: Marco Ballesio > Co-developed-by: Todd Kjos > Signed-off-by: Todd Kjos > Signed-off-by: Li Li > --- > drivers/android/binder.c | 141 ++++++++++++++++++++++++++-- > drivers/android/binder_internal.h | 12 +++ > include/uapi/linux/android/binder.h | 13 +++ > 3 files changed, 156 insertions(+), 10 deletions(-) > > diff --git a/drivers/android/binder.c b/drivers/android/binder.c > index c119736ca56a..76ea558df03e 100644 > --- a/drivers/android/binder.c > +++ b/drivers/android/binder.c > @@ -1506,6 +1506,12 @@ static void binder_free_transaction(struct binder_transaction *t) > > if (target_proc) { > binder_inner_proc_lock(target_proc); > + target_proc->outstanding_txns--; > + if (target_proc->outstanding_txns < 0) > + pr_warn("%s: Unexpected outstanding_txns %d\n", > + __func__, target_proc->outstanding_txns); Shouldn't this be something like "outstanding_txns is negative"? If we ever see one of these, is this enough information to be useful? Should we at least print the target proc's pid so someone can figure out what process had the messed up count? > + if (!target_proc->outstanding_txns && target_proc->is_frozen) > + wake_up_interruptible_all(&target_proc->freeze_wait); > if (t->buffer) > t->buffer->transaction = NULL; > binder_inner_proc_unlock(target_proc); > @@ -2331,10 +2337,11 @@ static int binder_fixup_parent(struct binder_transaction *t, > * If the @thread parameter is not NULL, the transaction is always queued > * to the waitlist of that specific thread. > * > - * Return: true if the transactions was successfully queued > - * false if the target process or thread is dead > + * Return: 0 if the transaction was successfully queued > + * BR_DEAD_REPLY if the target process or thread is dead > + * BR_FROZEN_REPLY if the target process or thread is frozen > */ > -static bool binder_proc_transaction(struct binder_transaction *t, > +static int binder_proc_transaction(struct binder_transaction *t, > struct binder_proc *proc, > struct binder_thread *thread) > { > @@ -2354,10 +2361,13 @@ static bool binder_proc_transaction(struct binder_transaction *t, > > binder_inner_proc_lock(proc); > > - if (proc->is_dead || (thread && thread->is_dead)) { > + if ((proc->is_frozen && !oneway) || proc->is_dead || > + (thread && thread->is_dead)) { > + bool proc_is_dead = proc->is_dead > + || (thread && thread->is_dead); > binder_inner_proc_unlock(proc); > binder_node_unlock(node); > - return false; > + return proc_is_dead ? BR_DEAD_REPLY : BR_FROZEN_REPLY; Do we need the proc_is_dead local? This could be: return proc->is_frozen ? BR_FROZEN_REPLY : BR_DEAD_REPLY > } > > if (!thread && !pending_async) > @@ -2373,10 +2383,11 @@ static bool binder_proc_transaction(struct binder_transaction *t, > if (!pending_async) > binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); > > + proc->outstanding_txns++; > binder_inner_proc_unlock(proc); > binder_node_unlock(node); > > - return true; > + return 0; > } > > /** > @@ -3013,13 +3024,16 @@ static void binder_transaction(struct binder_proc *proc, > if (reply) { > binder_enqueue_thread_work(thread, tcomplete); > binder_inner_proc_lock(target_proc); > - if (target_thread->is_dead) { > + if (target_thread->is_dead || target_proc->is_frozen) { > + return_error = target_thread->is_dead ? > + BR_DEAD_REPLY : BR_FROZEN_REPLY; > binder_inner_proc_unlock(target_proc); > goto err_dead_proc_or_thread; > } > BUG_ON(t->buffer->async_transaction != 0); > binder_pop_transaction_ilocked(target_thread, in_reply_to); > binder_enqueue_thread_work_ilocked(target_thread, &t->work); > + target_proc->outstanding_txns++; > binder_inner_proc_unlock(target_proc); > wake_up_interruptible_sync(&target_thread->wait); > binder_free_transaction(in_reply_to); > @@ -3038,7 +3052,9 @@ static void binder_transaction(struct binder_proc *proc, > t->from_parent = thread->transaction_stack; > thread->transaction_stack = t; > binder_inner_proc_unlock(proc); > - if (!binder_proc_transaction(t, target_proc, target_thread)) { > + return_error = binder_proc_transaction(t, > + target_proc, target_thread); > + if (return_error) { > binder_inner_proc_lock(proc); > binder_pop_transaction_ilocked(thread, t); > binder_inner_proc_unlock(proc); > @@ -3048,7 +3064,8 @@ static void binder_transaction(struct binder_proc *proc, > BUG_ON(target_node == NULL); > BUG_ON(t->buffer->async_transaction != 1); > binder_enqueue_thread_work(thread, tcomplete); > - if (!binder_proc_transaction(t, target_proc, NULL)) > + return_error = binder_proc_transaction(t, target_proc, NULL); > + if (return_error) > goto err_dead_proc_or_thread; > } > if (target_thread) > @@ -3065,7 +3082,6 @@ static void binder_transaction(struct binder_proc *proc, > return; > > err_dead_proc_or_thread: > - return_error = BR_DEAD_REPLY; > return_error_line = __LINE__; > binder_dequeue_work(proc, tcomplete); > err_translate_failed: > @@ -4298,6 +4314,9 @@ static void binder_free_proc(struct binder_proc *proc) > > BUG_ON(!list_empty(&proc->todo)); > BUG_ON(!list_empty(&proc->delivered_death)); > + if (proc->outstanding_txns) > + pr_warn("%s: Unexpected outstanding_txns %d\n", > + __func__, proc->outstanding_txns); > device = container_of(proc->context, struct binder_device, context); > if (refcount_dec_and_test(&device->ref)) { > kfree(proc->context->name); > @@ -4359,6 +4378,7 @@ static int binder_thread_release(struct binder_proc *proc, > (t->to_thread == thread) ? "in" : "out"); > > if (t->to_thread == thread) { > + thread->proc->outstanding_txns--; > t->to_proc = NULL; > t->to_thread = NULL; > if (t->buffer) { > @@ -4609,6 +4629,45 @@ static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, > return 0; > } > > +static int binder_ioctl_freeze(struct binder_freeze_info *info, > + struct binder_proc *target_proc) > +{ > + int ret = 0; > + > + if (!info->enable) { > + binder_inner_proc_lock(target_proc); > + target_proc->is_frozen = false; > + binder_inner_proc_unlock(target_proc); > + return 0; > + } > + > + /* > + * Freezing the target. Prevent new transactions by > + * setting frozen state. If timeout specified, wait > + * for transactions to drain. > + */ > + binder_inner_proc_lock(target_proc); > + target_proc->is_frozen = true; > + binder_inner_proc_unlock(target_proc); > + > + if (info->timeout_ms > 0) > + ret = wait_event_interruptible_timeout( > + target_proc->freeze_wait, > + (!target_proc->outstanding_txns), > + msecs_to_jiffies(info->timeout_ms)); > + > + if (!ret && target_proc->outstanding_txns) > + ret = -EAGAIN; > + > + if (ret < 0) { > + binder_inner_proc_lock(target_proc); > + target_proc->is_frozen = false; > + binder_inner_proc_unlock(target_proc); > + } > + > + return ret; > +} > + > static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > { > int ret; > @@ -4727,6 +4786,66 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > } > break; > } > + case BINDER_FREEZE: { > + struct binder_freeze_info info; > + struct binder_proc **target_procs = NULL, *target_proc; > + int target_procs_count = 0, i = 0; > + > + ret = 0; > + > + if (copy_from_user(&info, ubuf, sizeof(info))) { > + ret = -EFAULT; > + goto err; > + } > + > + mutex_lock(&binder_procs_lock); > + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { > + if (target_proc->pid == info.pid) > + target_procs_count++; > + } > + > + if (target_procs_count == 0) { > + mutex_unlock(&binder_procs_lock); > + ret = -EINVAL; > + goto err; > + } > + > + target_procs = kcalloc(target_procs_count, > + sizeof(struct binder_proc *), > + GFP_KERNEL); > + > + if (!target_procs) { > + mutex_unlock(&binder_procs_lock); > + ret = -ENOMEM; > + goto err; > + } > + > + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { > + if (target_proc->pid != info.pid) > + continue; > + > + binder_inner_proc_lock(target_proc); > + target_proc->tmp_ref++; > + binder_inner_proc_unlock(target_proc); > + > + target_procs[i++] = target_proc; > + } > + mutex_unlock(&binder_procs_lock); > + > + for (i = 0; i < target_procs_count; i++) { > + if (ret >= 0) > + ret = binder_ioctl_freeze(&info, > + target_procs[i]); > + > + binder_proc_dec_tmpref(target_procs[i]); > + } > + > + kfree(target_procs); > + > + if (ret < 0) > + goto err; > + break; > + } > default: > ret = -EINVAL; > goto err; > @@ -4823,6 +4942,7 @@ static int binder_open(struct inode *nodp, struct file *filp) > get_task_struct(current->group_leader); > proc->tsk = current->group_leader; > INIT_LIST_HEAD(&proc->todo); > + init_waitqueue_head(&proc->freeze_wait); > proc->default_priority = task_nice(current); > /* binderfs stashes devices in i_private */ > if (is_binderfs_device(nodp)) { > @@ -5035,6 +5155,7 @@ static void binder_deferred_release(struct binder_proc *proc) > proc->tmp_ref++; > > proc->is_dead = true; > + proc->is_frozen = false; > threads = 0; > active_transactions = 0; > while ((n = rb_first(&proc->threads))) { > diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h > index 6cd79011e35d..e6a53e98c6da 100644 > --- a/drivers/android/binder_internal.h > +++ b/drivers/android/binder_internal.h > @@ -367,9 +367,18 @@ struct binder_ref { > * (protected by binder_deferred_lock) > * @deferred_work: bitmap of deferred work to perform > * (protected by binder_deferred_lock) > + * @outstanding_txns: number of transactions to be transmitted before > + * processes in freeze_wait are woken up > + * (protected by @inner_lock) > * @is_dead: process is dead and awaiting free > * when outstanding transactions are cleaned up > * (protected by @inner_lock) > + * @is_frozen: process is frozen and unable to service > + * binder transactions > + * (protected by @inner_lock) > + * @freeze_wait: waitqueue of processes waiting for all outstanding > + * transactions to be processed > + * (protected by @inner_lock) > * @todo: list of work for this process > * (protected by @inner_lock) > * @stats: per-process binder statistics > @@ -410,7 +419,10 @@ struct binder_proc { > struct task_struct *tsk; > struct hlist_node deferred_work_node; > int deferred_work; > + int outstanding_txns; > bool is_dead; > + bool is_frozen; > + wait_queue_head_t freeze_wait; > > struct list_head todo; > struct binder_stats stats; > diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h > index ec84ad106568..7eb5b818b3c1 100644 > --- a/include/uapi/linux/android/binder.h > +++ b/include/uapi/linux/android/binder.h > @@ -217,6 +217,12 @@ struct binder_node_info_for_ref { > __u32 reserved3; > }; > > +struct binder_freeze_info { > + __u32 pid; > + __u32 enable; > + __u32 timeout_ms; > +}; > + > #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) > #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) > #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) > @@ -227,6 +233,7 @@ struct binder_node_info_for_ref { > #define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info) > #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref) > #define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object) > +#define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info) > > /* > * NOTE: Two special error codes you should check for when calling > @@ -408,6 +415,12 @@ enum binder_driver_return_protocol { > * The last transaction (either a bcTRANSACTION or > * a bcATTEMPT_ACQUIRE) failed (e.g. out of memory). No parameters. > */ > + > + BR_FROZEN_REPLY = _IO('r', 18), > + /* > + * The target of the last transaction (either a bcTRANSACTION or > + * a bcATTEMPT_ACQUIRE) is frozen. No parameters. > + */ > }; > > enum binder_driver_command_protocol { > -- > 2.31.0.rc2.261.g7f71774620-goog > From tkjos at google.com Sat Mar 13 00:01:11 2021 From: tkjos at google.com (Todd Kjos) Date: Fri, 12 Mar 2021 16:01:11 -0800 Subject: [PATCH v2 2/3] binder: use EINTR for interrupted wait for work In-Reply-To: <20210311184629.589725-3-dualli@chromium.org> References: <20210311184629.589725-1-dualli@chromium.org> <20210311184629.589725-3-dualli@chromium.org> Message-ID: On Thu, Mar 11, 2021 at 10:46 AM Li Li wrote: > > From: Marco Ballesio > > when interrupted by a signal, binder_wait_for_work currently returns > -ERESTARTSYS. This error code isn't propagated to user space, but a way > to handle interruption due to signals must be provided to code using > this API. > > Replace this instance of -ERESTARTSYS with -EINTR, which is propagated > to user space. > > Test: built, booted, interrupted a worker thread within > binder_wait_for_work > Signed-off-by: Marco Ballesio > Signed-off-by: Li Li Acked-by: Todd Kjos > --- > drivers/android/binder.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/android/binder.c b/drivers/android/binder.c > index 76ea558df03e..38bbf9a4ce99 100644 > --- a/drivers/android/binder.c > +++ b/drivers/android/binder.c > @@ -3712,7 +3712,7 @@ static int binder_wait_for_work(struct binder_thread *thread, > binder_inner_proc_lock(proc); > list_del_init(&thread->waiting_thread_node); > if (signal_pending(current)) { > - ret = -ERESTARTSYS; > + ret = -EINTR; > break; > } > } > @@ -4855,7 +4855,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > if (thread) > thread->looper_need_return = false; > wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2); > - if (ret && ret != -ERESTARTSYS) > + if (ret && ret != -EINTR) > pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); > err_unlocked: > trace_binder_ioctl_done(ret); > -- > 2.31.0.rc2.261.g7f71774620-goog > From tkjos at google.com Sat Mar 13 00:07:19 2021 From: tkjos at google.com (Todd Kjos) Date: Fri, 12 Mar 2021 16:07:19 -0800 Subject: [PATCH v2 3/3] binder: BINDER_GET_FROZEN_INFO ioctl In-Reply-To: <20210311184629.589725-4-dualli@chromium.org> References: <20210311184629.589725-1-dualli@chromium.org> <20210311184629.589725-4-dualli@chromium.org> Message-ID: On Thu, Mar 11, 2021 at 10:46 AM Li Li wrote: > > From: Marco Ballesio > > User space needs to know if binder transactions occurred to frozen > processes. Introduce a new BINDER_GET_FROZEN ioctl and keep track of > transactions occurring to frozen proceses. > > Signed-off-by: Marco Ballesio > Signed-off-by: Li Li Acked-by: Todd Kjos > --- > drivers/android/binder.c | 55 +++++++++++++++++++++++++++++ > drivers/android/binder_internal.h | 6 ++++ > include/uapi/linux/android/binder.h | 7 ++++ > 3 files changed, 68 insertions(+) > > diff --git a/drivers/android/binder.c b/drivers/android/binder.c > index 38bbf9a4ce99..b4999ed04b2e 100644 > --- a/drivers/android/binder.c > +++ b/drivers/android/binder.c > @@ -2360,6 +2360,10 @@ static int binder_proc_transaction(struct binder_transaction *t, > } > > binder_inner_proc_lock(proc); > + if (proc->is_frozen) { > + proc->sync_recv |= !oneway; > + proc->async_recv |= oneway; > + } > > if ((proc->is_frozen && !oneway) || proc->is_dead || > (thread && thread->is_dead)) { > @@ -4636,6 +4640,8 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, > > if (!info->enable) { > binder_inner_proc_lock(target_proc); > + target_proc->sync_recv = false; > + target_proc->async_recv = false; > target_proc->is_frozen = false; > binder_inner_proc_unlock(target_proc); > return 0; > @@ -4647,6 +4653,8 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, > * for transactions to drain. > */ > binder_inner_proc_lock(target_proc); > + target_proc->sync_recv = false; > + target_proc->async_recv = false; > target_proc->is_frozen = true; > binder_inner_proc_unlock(target_proc); > > @@ -4668,6 +4676,33 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, > return ret; > } > > +static int binder_ioctl_get_freezer_info( > + struct binder_frozen_status_info *info) > +{ > + struct binder_proc *target_proc; > + bool found = false; > + > + info->sync_recv = 0; > + info->async_recv = 0; > + > + mutex_lock(&binder_procs_lock); > + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { > + if (target_proc->pid == info->pid) { > + found = true; > + binder_inner_proc_lock(target_proc); > + info->sync_recv |= target_proc->sync_recv; > + info->async_recv |= target_proc->async_recv; > + binder_inner_proc_unlock(target_proc); > + } > + } > + mutex_unlock(&binder_procs_lock); > + > + if (!found) > + return -EINVAL; > + > + return 0; > +} > + > static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > { > int ret; > @@ -4846,6 +4881,24 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > goto err; > break; > } > + case BINDER_GET_FROZEN_INFO: { > + struct binder_frozen_status_info info; > + > + if (copy_from_user(&info, ubuf, sizeof(info))) { > + ret = -EFAULT; > + goto err; > + } > + > + ret = binder_ioctl_get_freezer_info(&info); > + if (ret < 0) > + goto err; > + > + if (copy_to_user(ubuf, &info, sizeof(info))) { > + ret = -EFAULT; > + goto err; > + } > + break; > + } > default: > ret = -EINVAL; > goto err; > @@ -5156,6 +5209,8 @@ static void binder_deferred_release(struct binder_proc *proc) > > proc->is_dead = true; > proc->is_frozen = false; > + proc->sync_recv = false; > + proc->async_recv = false; > threads = 0; > active_transactions = 0; > while ((n = rb_first(&proc->threads))) { > diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h > index e6a53e98c6da..2872a7de68e1 100644 > --- a/drivers/android/binder_internal.h > +++ b/drivers/android/binder_internal.h > @@ -376,6 +376,10 @@ struct binder_ref { > * @is_frozen: process is frozen and unable to service > * binder transactions > * (protected by @inner_lock) > + * @sync_recv: process received sync transactions since last frozen > + * (protected by @inner_lock) > + * @async_recv: process received async transactions since last frozen > + * (protected by @inner_lock) > * @freeze_wait: waitqueue of processes waiting for all outstanding > * transactions to be processed > * (protected by @inner_lock) > @@ -422,6 +426,8 @@ struct binder_proc { > int outstanding_txns; > bool is_dead; > bool is_frozen; > + bool sync_recv; > + bool async_recv; > wait_queue_head_t freeze_wait; > > struct list_head todo; > diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h > index 7eb5b818b3c1..156070d18c4f 100644 > --- a/include/uapi/linux/android/binder.h > +++ b/include/uapi/linux/android/binder.h > @@ -223,6 +223,12 @@ struct binder_freeze_info { > __u32 timeout_ms; > }; > > +struct binder_frozen_status_info { > + __u32 pid; > + __u32 sync_recv; > + __u32 async_recv; > +}; > + > #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) > #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) > #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) > @@ -234,6 +240,7 @@ struct binder_freeze_info { > #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref) > #define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object) > #define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info) > +#define BINDER_GET_FROZEN_INFO _IOWR('b', 15, struct binder_frozen_status_info) > > /* > * NOTE: Two special error codes you should check for when calling > -- > 2.31.0.rc2.261.g7f71774620-goog > From lkp at intel.com Sat Mar 13 05:01:01 2021 From: lkp at intel.com (kernel test robot) Date: Sat, 13 Mar 2021 13:01:01 +0800 Subject: [staging:staging-testing] BUILD SUCCESS 55c9731662b8bf0bc48aabdbf9f54d779bc072a1 Message-ID: <604c470d.g0nHKevD/eyYTm7q%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-testing branch HEAD: 55c9731662b8bf0bc48aabdbf9f54d779bc072a1 staging: wimax: i2400m: Mundane typos fix in the file tx.c elapsed time: 722m configs tested: 140 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig h8300 h8s-sim_defconfig arm imx_v4_v5_defconfig powerpc tqm8541_defconfig m68k m5475evb_defconfig arm mxs_defconfig powerpc64 alldefconfig arm s3c2410_defconfig powerpc mpc512x_defconfig openrisc simple_smp_defconfig mips nlm_xlp_defconfig mips sb1250_swarm_defconfig arm pxa_defconfig arc nsimosci_hs_smp_defconfig powerpc pseries_defconfig arm mini2440_defconfig arm keystone_defconfig sh se7780_defconfig h8300 edosk2674_defconfig sh kfr2r09-romimage_defconfig sh r7785rp_defconfig arm iop32x_defconfig arm badge4_defconfig sh ap325rxa_defconfig powerpc pcm030_defconfig arm ep93xx_defconfig mips gpr_defconfig arm pxa168_defconfig mips ip22_defconfig powerpc ps3_defconfig powerpc mpc832x_rdb_defconfig mips ar7_defconfig arc hsdk_defconfig arm multi_v4t_defconfig sh sh7757lcr_defconfig mips maltaup_xpa_defconfig arm assabet_defconfig arm ixp4xx_defconfig arm s3c6400_defconfig arm footbridge_defconfig h8300 h8300h-sim_defconfig mips gcw0_defconfig m68k alldefconfig sh espt_defconfig powerpc eiger_defconfig arm simpad_defconfig xtensa cadence_csp_defconfig sh se7705_defconfig arm cns3420vb_defconfig powerpc mpc836x_mds_defconfig arm imx_v6_v7_defconfig mips malta_defconfig mips jmr3927_defconfig mips capcella_defconfig m68k bvme6000_defconfig nios2 10m50_defconfig sparc sparc64_defconfig arc tb10x_defconfig mips tb0226_defconfig arm omap2plus_defconfig powerpc bamboo_defconfig parisc generic-32bit_defconfig powerpc ppc6xx_defconfig arm nhk8815_defconfig mips cu1830-neo_defconfig sh edosk7705_defconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig parisc allyesconfig s390 defconfig s390 allmodconfig i386 allyesconfig sparc allyesconfig sparc defconfig i386 tinyconfig i386 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a001-20210312 i386 randconfig-a005-20210312 i386 randconfig-a002-20210312 i386 randconfig-a003-20210312 i386 randconfig-a004-20210312 i386 randconfig-a006-20210312 x86_64 randconfig-a011-20210312 x86_64 randconfig-a016-20210312 x86_64 randconfig-a013-20210312 x86_64 randconfig-a014-20210312 x86_64 randconfig-a015-20210312 x86_64 randconfig-a012-20210312 i386 randconfig-a013-20210312 i386 randconfig-a016-20210312 i386 randconfig-a011-20210312 i386 randconfig-a015-20210312 i386 randconfig-a014-20210312 i386 randconfig-a012-20210312 riscv nommu_k210_defconfig riscv allyesconfig riscv nommu_virt_defconfig riscv allnoconfig riscv defconfig riscv rv32_defconfig riscv allmodconfig x86_64 allyesconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a006-20210312 x86_64 randconfig-a001-20210312 x86_64 randconfig-a005-20210312 x86_64 randconfig-a003-20210312 x86_64 randconfig-a002-20210312 x86_64 randconfig-a004-20210312 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From gregkh at linuxfoundation.org Sat Mar 13 13:58:02 2021 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Sat, 13 Mar 2021 14:58:02 +0100 Subject: [PATCH] MAINTAINERS: move some real subsystems off of the staging mailing list Message-ID: The VME and Android drivers still have their MAINTAINERS entries pointing to the "driverdevel" mailing list, due to them having their codebase move out of the drivers/staging/ directory, but no one remembered to change the mailing list entries. Move them both to linux-kernel for lack of a more specific place at the moment. These are both low-volume areas of the kernel, so this shouldn't be an issue. Cc: Martyn Welch Cc: Manohar Vanga Cc: Arve Hj?nnev?g Cc: Todd Kjos Cc: Martijn Coenen Cc: Joel Fernandes Cc: Christian Brauner Cc: Hridya Valsaraju Cc: Suren Baghdasaryan Reported-by: Konstantin Ryabitsev Signed-off-by: Greg Kroah-Hartman diff --git a/MAINTAINERS b/MAINTAINERS index 72e5b9db5050..b02eec28ae2c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1181,7 +1181,7 @@ M: Joel Fernandes M: Christian Brauner M: Hridya Valsaraju M: Suren Baghdasaryan -L: devel at driverdev.osuosl.org +L: linux-kernel at vger.kernel.org S: Supported T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git F: drivers/android/ @@ -19135,7 +19135,7 @@ VME SUBSYSTEM M: Martyn Welch M: Manohar Vanga M: Greg Kroah-Hartman -L: devel at driverdev.osuosl.org +L: linux-kernel at vger.kernel.org S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git F: Documentation/driver-api/vme.rst From gregkh at linuxfoundation.org Sat Mar 13 15:03:34 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Sat, 13 Mar 2021 16:03:34 +0100 Subject: [GIT PULL] Staging driver fixes for 5.12-rc3 Message-ID: The following changes since commit a38fd8748464831584a19438cbb3082b5a2dab15: Linux 5.12-rc2 (2021-03-05 17:33:41 -0800) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git tags/staging-5.12-rc3 for you to fetch changes up to 16d7586dccf83785819f5b66f4d20fac9bfcd644: Revert "staging: wfx: remove unused included header files" (2021-03-10 09:23:30 +0100) ---------------------------------------------------------------- Staging driver fixes for 5.12-rc3 Here are some small staging driver fixes for reported problems for 5.12-rc3. They include: - wfx header file cleanup patch reverted as it could cause problems - comedi driver endian fixes - buffer overflow problems for staging wifi drivers - build dependency issue for rtl8192e driver All have been in linux-next for a while with no reported problems. Signed-off-by: Greg Kroah-Hartman ---------------------------------------------------------------- Dan Carpenter (5): staging: rtl8712: unterminated string leads to read overflow staging: ks7010: prevent buffer overflow in ks_wlan_set_scan() staging: rtl8192u: fix ->ssid overflow in r8192_wx_set_scan() staging: rtl8188eu: fix potential memory corruption in rtw_check_beacon_data() staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan() Greg Kroah-Hartman (1): Revert "staging: wfx: remove unused included header files" Ian Abbott (14): staging: comedi: addi_apci_1032: Fix endian problem for COS sample staging: comedi: addi_apci_1500: Fix endian problem for command sample staging: comedi: adv_pci1710: Fix endian problem for AI command data staging: comedi: das6402: Fix endian problem for AI command data staging: comedi: das800: Fix endian problem for AI command data staging: comedi: dmm32at: Fix endian problem for AI command data staging: comedi: me4000: Fix endian problem for AI command data staging: comedi: pcl711: Fix endian problem for AI command data staging: comedi: pcl818: Fix endian problem for AI command data staging: comedi: amplc_pc236_common: Use 16-bit 0 for interrupt data staging: comedi: comedi_parport: Use 16-bit 0 for interrupt data staging: comedi: ni_6527: Use 16-bit 0 for interrupt data staging: comedi: ni_65xx: Use 16-bit 0 for interrupt data staging: comedi: pcl726: Use 16-bit 0 for interrupt data Julian Braha (1): staging: rtl8192e: fix kconfig dependency on CRYPTO Lee Gibson (2): staging: rtl8192e: Fix possible buffer overflow in _rtl92e_wx_set_scan staging: rtl8712: Fix possible buffer overflow in r8712_sitesurvey_cmd drivers/staging/comedi/drivers/addi_apci_1032.c | 4 +++- drivers/staging/comedi/drivers/addi_apci_1500.c | 18 +++++++++--------- drivers/staging/comedi/drivers/adv_pci1710.c | 10 +++++----- drivers/staging/comedi/drivers/amplc_pc236_common.c | 4 +++- drivers/staging/comedi/drivers/comedi_parport.c | 3 ++- drivers/staging/comedi/drivers/das6402.c | 2 +- drivers/staging/comedi/drivers/das800.c | 2 +- drivers/staging/comedi/drivers/dmm32at.c | 2 +- drivers/staging/comedi/drivers/me4000.c | 2 +- drivers/staging/comedi/drivers/ni_6527.c | 4 +++- drivers/staging/comedi/drivers/ni_65xx.c | 3 ++- drivers/staging/comedi/drivers/pcl711.c | 2 +- drivers/staging/comedi/drivers/pcl726.c | 4 +++- drivers/staging/comedi/drivers/pcl818.c | 2 +- drivers/staging/ks7010/ks_wlan_net.c | 6 ++++-- drivers/staging/rtl8188eu/core/rtw_ap.c | 5 +++++ drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 6 ++++-- drivers/staging/rtl8192e/Kconfig | 1 + drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 7 ++++--- drivers/staging/rtl8192u/r8192U_wx.c | 6 ++++-- drivers/staging/rtl8712/rtl871x_cmd.c | 6 ++++-- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 2 +- drivers/staging/wfx/bh.c | 1 + drivers/staging/wfx/bh.h | 4 ++++ drivers/staging/wfx/bus.h | 3 +++ drivers/staging/wfx/bus_sdio.c | 6 ++++++ drivers/staging/wfx/bus_spi.c | 7 +++++++ drivers/staging/wfx/data_rx.c | 5 +++++ drivers/staging/wfx/data_tx.c | 5 +++++ drivers/staging/wfx/data_tx.h | 3 +++ drivers/staging/wfx/debug.c | 6 ++++++ drivers/staging/wfx/fwio.c | 2 ++ drivers/staging/wfx/hif_api_cmd.h | 4 ++++ drivers/staging/wfx/hif_api_general.h | 9 +++++++++ drivers/staging/wfx/hif_tx.c | 4 ++++ drivers/staging/wfx/hif_tx_mib.c | 5 +++++ drivers/staging/wfx/hwio.c | 3 +++ drivers/staging/wfx/hwio.h | 2 ++ drivers/staging/wfx/key.c | 2 ++ drivers/staging/wfx/key.h | 2 ++ drivers/staging/wfx/main.c | 7 +++++++ drivers/staging/wfx/main.h | 3 +++ drivers/staging/wfx/queue.c | 4 ++++ drivers/staging/wfx/queue.h | 3 +++ drivers/staging/wfx/scan.h | 2 ++ drivers/staging/wfx/sta.c | 6 ++++++ drivers/staging/wfx/sta.h | 2 ++ drivers/staging/wfx/traces.h | 3 +++ drivers/staging/wfx/wfx.h | 3 +++ 49 files changed, 169 insertions(+), 38 deletions(-) From chawora at econet.co.zw Sat Mar 13 23:29:01 2021 From: chawora at econet.co.zw (Reem E. A) Date: Sat, 13 Mar 2021 15:29:01 -0800 Subject: No subject Message-ID: <8bd610e62caf400783acd4309e54dad1@WVALE-CAS-SVR-9.econetzw.local> Hello, My name is Ms. Reem Ebrahim Al-Hashimi, I am the "Minister of state and Petroleum" also "Minister of State for International Cooperation" in UAE. I write to you on behalf of my other "three (2) colleagues" who has approved me to solicit for your "partnership in claiming of {us$47=Million}" from a Financial Home on their behalf and for our "Mutual Benefits". The Fund {us$47=Million} is our share from the (over-invoiced) Oil/Gas deal with Turkish Government within 2013/2014, however, we don't want our government to know about the fund. If this proposal interests you, let me know, by sending me an email and I will send to you detailed information on how this business would be successfully transacted. Be informed that nobody knows about the secret of this fund except us, and we know how to carry out the entire transaction. So I am compelled to ask, that you will stand on our behalf and receive this fund into any account that is solely controlled by you. We will compensate you with 15% of the total amount involved as gratification for being our partner in this transaction. Reply to: reem.alhashimi at yandex.com Regards, Ms. Reem. This mail was sent through Econet Wireless, a Global telecoms leader. DISCLAIMER The information in this message is confidential and is legally privileged. It is intended solely for the addressee. Access to this message by anyone else is unauthorized. If received in error please accept our apologies and notify the sender immediately. You must also delete the original message from your machine. If you are not the intended recipient, any use, disclosure, copying, distribution or action taken in reliance of it, is prohibited and may be unlawful. The information, attachments, opinions or advice contained in this email are not the views or opinions of Econet Wireless, its subsidiaries or affiliates. Econet Wireless therefore accepts no liability for claims, losses, or damages arising from the inaccuracy, incorrectness, or lack of integrity of such information. [https://mail.econet.co.zw/OWA/auth/current/themes/resources/Agile/AgileBanner.png] WORK ISN'T A PLACE IT'S WHAT WE DO ________________________________ [https://mail.econet.co.zw/OWA/auth/current/themes/resources/Agile/telephone.png] [https://mail.econet.co.zw/OWA/auth/current/themes/resources/Agile/email.png] [https://mail.econet.co.zw/OWA/auth/current/themes/resources/Agile/location.png] [https://mail.econet.co.zw/OWA/auth/current/themes/resources/Agile/website.png] www.econet.co.zw [https://mail.econet.co.zw/OWA/auth/current/themes/resources/Agile/inspired.jpg] From 42.hyeyoo at gmail.com Sat Mar 13 15:29:34 2021 From: 42.hyeyoo at gmail.com (hygoni) Date: Sun, 14 Mar 2021 00:29:34 +0900 Subject: [PATCH] staging: rtl8723bs: fix checkpatch warnings Message-ID: <20210313152934.87638-1-42.hyeyoo@gmail.com> Fix checkpatch warnings of core/rtw_cmd.c in detail, unnecessary braces, space before tab and wrongly formatted comments. Issues found by checkpatch --- drivers/staging/rtl8723bs/core/rtw_cmd.c | 105 +++++++++++------------ 1 file changed, 50 insertions(+), 55 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c index 3fe79169a811..9ed1e83769b8 100644 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@ -158,11 +158,9 @@ static struct cmd_hdl wlancmds[] = { GEN_MLME_EXT_HANDLER(sizeof(struct RunInThread_param), run_in_thread_hdl) /*63*/ }; -/* -Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. -No irqsave is necessary. -*/ - +/* Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. + * No irqsave is necessary. + */ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) { int res = 0; @@ -229,6 +227,7 @@ void _rtw_free_evt_priv(struct evt_priv *pevtpriv) while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) { void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue); + if (c2h && c2h != (void *)pevtpriv) kfree(c2h); } @@ -248,15 +247,14 @@ void _rtw_free_cmd_priv(struct cmd_priv *pcmdpriv) } } -/* -Calling Context: - -rtw_enqueue_cmd can only be called between kernel thread, -since only spin_lock is used. - -ISR/Call-Back functions can't call this sub-function. - -*/ +/* Calling Context: + * + * rtw_enqueue_cmd can only be called between kernel thread, + * since only spin_lock is used. + * + * ISR/Call-Back functions can't call this sub-function. + * + */ int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj) { @@ -321,9 +319,9 @@ int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) || atomic_read(&(pcmdpriv->cmdthd_running)) == false /* com_thread not running */ ) { /* DBG_871X("%s:%s: drop cmdcode:%u, hw_init_completed:%u, cmdthd_running:%u\n", caller_func, __func__, */ - /* cmd_obj->cmdcode, */ - /* pcmdpriv->padapter->hw_init_completed, */ - /* pcmdpriv->cmdthd_running */ + /* cmd_obj->cmdcode, */ + /* pcmdpriv->padapter->hw_init_completed, */ + /* pcmdpriv->cmdthd_running */ /* */ return _FAIL; @@ -554,18 +552,17 @@ int rtw_cmd_thread(void *context) thread_exit(); } -/* -rtw_sitesurvey_cmd(~) - ### NOTE:#### (!!!!) - MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock -*/ +/* rtw_sitesurvey_cmd(~) + * ### NOTE:#### (!!!!) + * MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock + */ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, int ssid_num, struct rtw_ieee80211_channel *ch, int ch_num) { u8 res = _FAIL; struct cmd_obj *ph2c; struct sitesurvey_parm *psurveyPara; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; if (check_fwstate(pmlmepriv, _FW_LINKED) == true) @@ -593,6 +590,7 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, /* prepare ssid list */ if (ssid) { int i; + for (i = 0; i < ssid_num && i < RTW_SSID_SCAN_AMOUNT; i++) { if (ssid[i].SsidLength) { memcpy(&psurveyPara->ssid[i], &ssid[i], sizeof(struct ndis_802_11_ssid)); @@ -607,6 +605,7 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, /* prepare channel list */ if (ch) { int i; + for (i = 0; i < ch_num && i < RTW_CHANNEL_SCAN_AMOUNT; i++) { if (ch[i].hw_value && !(ch[i].flags & RTW_IEEE80211_CHAN_DISABLED)) { memcpy(&psurveyPara->ch[i], &ch[i], sizeof(struct rtw_ieee80211_channel)); @@ -671,16 +670,15 @@ void rtw_getbbrfreg_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *p u8 rtw_createbss_cmd(struct adapter *padapter) { struct cmd_obj *pcmd; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_bssid_ex *pdev_network = &padapter->registrypriv.dev_network; u8 res = _SUCCESS; - if (pmlmepriv->assoc_ssid.SsidLength == 0) { + if (pmlmepriv->assoc_ssid.SsidLength == 0) RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for Any SSid:%s\n", pmlmepriv->assoc_ssid.Ssid)); - } else { + else RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for SSid:%s\n", pmlmepriv->assoc_ssid.Ssid)); - } pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); if (pcmd == NULL) { @@ -755,23 +753,22 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) uint t_len = 0; struct wlan_bssid_ex *psecnetwork; struct cmd_obj *pcmd; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct qos_priv *pqospriv = &pmlmepriv->qospriv; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct qos_priv *pqospriv = &pmlmepriv->qospriv; struct security_priv *psecuritypriv = &padapter->securitypriv; struct registry_priv *pregistrypriv = &padapter->registrypriv; - struct ht_priv *phtpriv = &pmlmepriv->htpriv; + struct ht_priv *phtpriv = &pmlmepriv->htpriv; enum NDIS_802_11_NETWORK_INFRASTRUCTURE ndis_network_mode = pnetwork->network.InfrastructureMode; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u32 tmp_len; u8 *ptmp = NULL; - if (pmlmepriv->assoc_ssid.SsidLength == 0) { + if (pmlmepriv->assoc_ssid.SsidLength == 0) RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("+Join cmd: Any SSid\n")); - } else { + else RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid =[%s]\n", pmlmepriv->assoc_ssid.Ssid)); - } pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); if (pcmd == NULL) { @@ -810,11 +807,10 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) psecuritypriv->authenticator_ie[0] = (unsigned char)psecnetwork->IELength; - if ((psecnetwork->IELength-12) < (256-1)) { + if ((psecnetwork->IELength-12) < (256-1)) memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], psecnetwork->IELength-12); - } else { + else memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], (256-1)); - } psecnetwork->IELength = 0; /* Added by Albert 2009/02/18 */ @@ -844,9 +840,9 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) phtpriv->ht_option = false; ptmp = rtw_get_ie(&pnetwork->network.IEs[12], WLAN_EID_HT_CAPABILITY, &tmp_len, pnetwork->network.IELength-12); if (pregistrypriv->ht_enable && ptmp && tmp_len > 0) { - /* Added by Albert 2010/06/23 */ - /* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ - /* Especially for Realtek 8192u SoftAP. */ + /* Added by Albert 2010/06/23 */ + /* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ + /* Especially for Realtek 8192u SoftAP. */ if ((padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_)) { @@ -955,11 +951,11 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_ { struct cmd_obj *ph2c; struct set_stakey_parm *psetstakey_para; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct set_stakey_rsp *psetstakey_rsp = NULL; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct security_priv *psecuritypriv = &padapter->securitypriv; u8 res = _SUCCESS; psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm)); @@ -970,17 +966,15 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_ memcpy(psetstakey_para->addr, sta->hwaddr, ETH_ALEN); - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) psetstakey_para->algorithm = (unsigned char) psecuritypriv->dot11PrivacyAlgrthm; - } else { + else GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, false); - } - if (unicast_key == true) { + if (unicast_key == true) memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16); - } else { + else memcpy(&psetstakey_para->key, &psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, 16); - } /* jeff: set this because at least sw key is ready */ padapter->securitypriv.busetkipkey = true; @@ -1017,7 +1011,7 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 enqueu { struct cmd_obj *ph2c; struct set_stakey_parm *psetstakey_para; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct set_stakey_rsp *psetstakey_rsp = NULL; s16 cam_id = 0; u8 res = _SUCCESS; @@ -1068,7 +1062,7 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 enqueu u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr) { - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct cmd_obj *ph2c; struct addBaReq_parm *paddbareq_parm; @@ -1296,7 +1290,7 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer) u8 bBusyTraffic = false, bTxBusyTraffic = false, bRxBusyTraffic = false; u8 bHigherBusyTraffic = false, bHigherBusyRxTraffic = false, bHigherBusyTxTraffic = false; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); collect_traffic_statistics(padapter); @@ -1397,6 +1391,7 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer) static void dynamic_chk_wk_hdl(struct adapter *padapter) { struct mlme_priv *pmlmepriv; + pmlmepriv = &(padapter->mlmepriv); if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) @@ -1495,7 +1490,7 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue) u8 res = _SUCCESS; /* if (!pwrctrlpriv->bLeisurePs) */ - /* return res; */ + /* return res; */ if (enqueue) { ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); @@ -2035,7 +2030,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) if (pcmd->parmbuf == NULL) goto exit; - if ((pcmd->res != H2C_SUCCESS)) { + if (pcmd->res != H2C_SUCCESS) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n ********Error: rtw_createbss_cmd_callback Fail ************\n\n.")); _set_timer(&pmlmepriv->assoc_timer, 1); } -- 2.24.3 (Apple Git-128) From gregkh at linuxfoundation.org Sat Mar 13 15:32:43 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Sat, 13 Mar 2021 16:32:43 +0100 Subject: [PATCH] staging: rtl8723bs: fix checkpatch warnings In-Reply-To: <20210313152934.87638-1-42.hyeyoo@gmail.com> References: <20210313152934.87638-1-42.hyeyoo@gmail.com> Message-ID: On Sun, Mar 14, 2021 at 12:29:34AM +0900, hygoni wrote: > Fix checkpatch warnings of core/rtw_cmd.c > in detail, unnecessary braces, space before tab and wrongly formatted comments. > Issues found by checkpatch > --- > drivers/staging/rtl8723bs/core/rtw_cmd.c | 105 +++++++++++------------ > 1 file changed, 50 insertions(+), 55 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c > index 3fe79169a811..9ed1e83769b8 100644 > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c > @@ -158,11 +158,9 @@ static struct cmd_hdl wlancmds[] = { > GEN_MLME_EXT_HANDLER(sizeof(struct RunInThread_param), run_in_thread_hdl) /*63*/ > }; > > -/* > -Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. > -No irqsave is necessary. > -*/ > - > +/* Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. > + * No irqsave is necessary. > + */ > int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) > { > int res = 0; > @@ -229,6 +227,7 @@ void _rtw_free_evt_priv(struct evt_priv *pevtpriv) > > while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) { > void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue); > + > if (c2h && c2h != (void *)pevtpriv) > kfree(c2h); > } > @@ -248,15 +247,14 @@ void _rtw_free_cmd_priv(struct cmd_priv *pcmdpriv) > } > } > > -/* > -Calling Context: > - > -rtw_enqueue_cmd can only be called between kernel thread, > -since only spin_lock is used. > - > -ISR/Call-Back functions can't call this sub-function. > - > -*/ > +/* Calling Context: > + * > + * rtw_enqueue_cmd can only be called between kernel thread, > + * since only spin_lock is used. > + * > + * ISR/Call-Back functions can't call this sub-function. > + * > + */ > > int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj) > { > @@ -321,9 +319,9 @@ int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) > || atomic_read(&(pcmdpriv->cmdthd_running)) == false /* com_thread not running */ > ) { > /* DBG_871X("%s:%s: drop cmdcode:%u, hw_init_completed:%u, cmdthd_running:%u\n", caller_func, __func__, */ > - /* cmd_obj->cmdcode, */ > - /* pcmdpriv->padapter->hw_init_completed, */ > - /* pcmdpriv->cmdthd_running */ > + /* cmd_obj->cmdcode, */ > + /* pcmdpriv->padapter->hw_init_completed, */ > + /* pcmdpriv->cmdthd_running */ > /* */ > > return _FAIL; > @@ -554,18 +552,17 @@ int rtw_cmd_thread(void *context) > thread_exit(); > } > > -/* > -rtw_sitesurvey_cmd(~) > - ### NOTE:#### (!!!!) > - MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock > -*/ > +/* rtw_sitesurvey_cmd(~) > + * ### NOTE:#### (!!!!) > + * MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock > + */ > u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, int ssid_num, > struct rtw_ieee80211_channel *ch, int ch_num) > { > u8 res = _FAIL; > struct cmd_obj *ph2c; > struct sitesurvey_parm *psurveyPara; > - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; > + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; > struct mlme_priv *pmlmepriv = &padapter->mlmepriv; > > if (check_fwstate(pmlmepriv, _FW_LINKED) == true) > @@ -593,6 +590,7 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, > /* prepare ssid list */ > if (ssid) { > int i; > + > for (i = 0; i < ssid_num && i < RTW_SSID_SCAN_AMOUNT; i++) { > if (ssid[i].SsidLength) { > memcpy(&psurveyPara->ssid[i], &ssid[i], sizeof(struct ndis_802_11_ssid)); > @@ -607,6 +605,7 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, > /* prepare channel list */ > if (ch) { > int i; > + > for (i = 0; i < ch_num && i < RTW_CHANNEL_SCAN_AMOUNT; i++) { > if (ch[i].hw_value && !(ch[i].flags & RTW_IEEE80211_CHAN_DISABLED)) { > memcpy(&psurveyPara->ch[i], &ch[i], sizeof(struct rtw_ieee80211_channel)); > @@ -671,16 +670,15 @@ void rtw_getbbrfreg_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *p > u8 rtw_createbss_cmd(struct adapter *padapter) > { > struct cmd_obj *pcmd; > - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; > - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; > + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; > + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; > struct wlan_bssid_ex *pdev_network = &padapter->registrypriv.dev_network; > u8 res = _SUCCESS; > > - if (pmlmepriv->assoc_ssid.SsidLength == 0) { > + if (pmlmepriv->assoc_ssid.SsidLength == 0) > RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for Any SSid:%s\n", pmlmepriv->assoc_ssid.Ssid)); > - } else { > + else > RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for SSid:%s\n", pmlmepriv->assoc_ssid.Ssid)); > - } > > pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); > if (pcmd == NULL) { > @@ -755,23 +753,22 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) > uint t_len = 0; > struct wlan_bssid_ex *psecnetwork; > struct cmd_obj *pcmd; > - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; > - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; > - struct qos_priv *pqospriv = &pmlmepriv->qospriv; > + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; > + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; > + struct qos_priv *pqospriv = &pmlmepriv->qospriv; > struct security_priv *psecuritypriv = &padapter->securitypriv; > struct registry_priv *pregistrypriv = &padapter->registrypriv; > - struct ht_priv *phtpriv = &pmlmepriv->htpriv; > + struct ht_priv *phtpriv = &pmlmepriv->htpriv; > enum NDIS_802_11_NETWORK_INFRASTRUCTURE ndis_network_mode = pnetwork->network.InfrastructureMode; > struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; > struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); > u32 tmp_len; > u8 *ptmp = NULL; > > - if (pmlmepriv->assoc_ssid.SsidLength == 0) { > + if (pmlmepriv->assoc_ssid.SsidLength == 0) > RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("+Join cmd: Any SSid\n")); > - } else { > + else > RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid =[%s]\n", pmlmepriv->assoc_ssid.Ssid)); > - } > > pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); > if (pcmd == NULL) { > @@ -810,11 +807,10 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) > > psecuritypriv->authenticator_ie[0] = (unsigned char)psecnetwork->IELength; > > - if ((psecnetwork->IELength-12) < (256-1)) { > + if ((psecnetwork->IELength-12) < (256-1)) > memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], psecnetwork->IELength-12); > - } else { > + else > memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], (256-1)); > - } > > psecnetwork->IELength = 0; > /* Added by Albert 2009/02/18 */ > @@ -844,9 +840,9 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) > phtpriv->ht_option = false; > ptmp = rtw_get_ie(&pnetwork->network.IEs[12], WLAN_EID_HT_CAPABILITY, &tmp_len, pnetwork->network.IELength-12); > if (pregistrypriv->ht_enable && ptmp && tmp_len > 0) { > - /* Added by Albert 2010/06/23 */ > - /* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ > - /* Especially for Realtek 8192u SoftAP. */ > + /* Added by Albert 2010/06/23 */ > + /* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ > + /* Especially for Realtek 8192u SoftAP. */ > if ((padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_) && > (padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_) && > (padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_)) { > @@ -955,11 +951,11 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_ > { > struct cmd_obj *ph2c; > struct set_stakey_parm *psetstakey_para; > - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; > + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; > struct set_stakey_rsp *psetstakey_rsp = NULL; > > - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; > - struct security_priv *psecuritypriv = &padapter->securitypriv; > + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; > + struct security_priv *psecuritypriv = &padapter->securitypriv; > u8 res = _SUCCESS; > > psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm)); > @@ -970,17 +966,15 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_ > > memcpy(psetstakey_para->addr, sta->hwaddr, ETH_ALEN); > > - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { > + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) > psetstakey_para->algorithm = (unsigned char) psecuritypriv->dot11PrivacyAlgrthm; > - } else { > + else > GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, false); > - } > > - if (unicast_key == true) { > + if (unicast_key == true) > memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16); > - } else { > + else > memcpy(&psetstakey_para->key, &psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, 16); > - } > > /* jeff: set this because at least sw key is ready */ > padapter->securitypriv.busetkipkey = true; > @@ -1017,7 +1011,7 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 enqueu > { > struct cmd_obj *ph2c; > struct set_stakey_parm *psetstakey_para; > - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; > + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; > struct set_stakey_rsp *psetstakey_rsp = NULL; > s16 cam_id = 0; > u8 res = _SUCCESS; > @@ -1068,7 +1062,7 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 enqueu > > u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr) > { > - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; > + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; > struct cmd_obj *ph2c; > struct addBaReq_parm *paddbareq_parm; > > @@ -1296,7 +1290,7 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer) > u8 bBusyTraffic = false, bTxBusyTraffic = false, bRxBusyTraffic = false; > u8 bHigherBusyTraffic = false, bHigherBusyRxTraffic = false, bHigherBusyTxTraffic = false; > > - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); > + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); > > collect_traffic_statistics(padapter); > > @@ -1397,6 +1391,7 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer) > static void dynamic_chk_wk_hdl(struct adapter *padapter) > { > struct mlme_priv *pmlmepriv; > + > pmlmepriv = &(padapter->mlmepriv); > > if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) > @@ -1495,7 +1490,7 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue) > u8 res = _SUCCESS; > > /* if (!pwrctrlpriv->bLeisurePs) */ > - /* return res; */ > + /* return res; */ > > if (enqueue) { > ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); > @@ -2035,7 +2030,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) > if (pcmd->parmbuf == NULL) > goto exit; > > - if ((pcmd->res != H2C_SUCCESS)) { > + if (pcmd->res != H2C_SUCCESS) { > RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n ********Error: rtw_createbss_cmd_callback Fail ************\n\n.")); > _set_timer(&pmlmepriv->assoc_timer, 1); > } > -- > 2.24.3 (Apple Git-128) > Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - Your patch does not have a Signed-off-by: line. Please read the kernel file, Documentation/SubmittingPatches and resend it after adding that line. Note, the line needs to be in the body of the email, before the patch, not at the bottom of the patch or in the email signature. - Your patch did many different things all at once, making it difficult to review. All Linux kernel patches need to only do one thing at a time. If you need to do multiple things (such as clean up all coding style issues in a file/driver), do it in a sequence of patches, each one doing only one thing. This will make it easier to review the patches to ensure that they are correct, and to help alleviate any merge issues that larger patches can cause. - It looks like you did not use your "real" name for the patch on either the Signed-off-by: line, or the From: line (both of which have to match). Please read the kernel file, Documentation/SubmittingPatches for how to do this correctly. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot From astro.abhishek02 at gmail.com Sat Mar 13 16:16:55 2021 From: astro.abhishek02 at gmail.com (Abhishek C) Date: Sat, 13 Mar 2021 21:46:55 +0530 Subject: [PATCH] drivers: android: binder.c: Fix indentation of multi-line comment Message-ID: <20210313161655.mu64qezxog4ghibq@astroabhi> Fixed alignment of multi-line comment. Added a * for each line of the comment. Signed-off-by: Abhishek C --- drivers/android/binder.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index c119736ca56a..700719c58147 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -4617,8 +4617,9 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) unsigned int size = _IOC_SIZE(cmd); void __user *ubuf = (void __user *)arg; - /*pr_info("binder_ioctl: %d:%d %x %lx\n", - proc->pid, current->pid, cmd, arg);*/ + /* pr_info("binder_ioctl: %d:%d %x %lx\n", + * proc->pid, current->pid, cmd, arg); + */ binder_selftest_alloc(&proc->alloc); @@ -5750,8 +5751,8 @@ static int __init binder_init(void) if (!IS_ENABLED(CONFIG_ANDROID_BINDERFS) && strcmp(binder_devices_param, "") != 0) { /* - * Copy the module_parameter string, because we don't want to - * tokenize it in-place. + * Copy the module_parameter string, because we don't want to + * tokenize it in-place. */ device_names = kstrdup(binder_devices_param, GFP_KERNEL); if (!device_names) { -- 2.25.1 From shreya.ajithchb at gmail.com Sat Mar 13 17:14:53 2021 From: shreya.ajithchb at gmail.com (Shreya) Date: Sat, 13 Mar 2021 22:44:53 +0530 Subject: [PATCH] staging:rtl8723bs:core:rtw_wlan_util:fixed indentation coding style issue Message-ID: <20210313171453.GA2640@shreya-VirtualBox> Fixed the indentation of the else part of the conditional statement. Signed-off-by: Shreya Ajith --- drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index 975f2830e29e..4b5afaeac916 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -1760,7 +1760,7 @@ void update_wireless_mode(struct adapter *padapter) if (pmlmeext->cur_wireless_mode & WIRELESS_11B) update_mgnt_tx_rate(padapter, IEEE80211_CCK_RATE_1MB); - else + else update_mgnt_tx_rate(padapter, IEEE80211_OFDM_RATE_6MB); } -- 2.25.1 From namrata.janawade at gmail.com Sat Mar 13 17:26:35 2021 From: namrata.janawade at gmail.com (namratajanawade) Date: Sat, 13 Mar 2021 09:26:35 -0800 Subject: [PATCH] staging: andriod: ashmem: Declared file operation with const keyword Message-ID: <20210313172636.18234-1-namrata.janawade@gmail.com> Warning found by checkpatch.pl script. Signed-off-by: namratajanawade --- drivers/staging/android/ashmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index d66a64e42273..7854fd410efa 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -376,7 +376,7 @@ ashmem_vmfile_get_unmapped_area(struct file *file, unsigned long addr, static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) { - static struct file_operations vmfile_fops; + static const struct file_operations vmfile_fops; struct ashmem_area *asma = file->private_data; int ret = 0; -- 2.25.1 From bkkarthik at pesu.pes.edu Sat Mar 13 17:29:43 2021 From: bkkarthik at pesu.pes.edu (B K Karthik) Date: Sat, 13 Mar 2021 22:59:43 +0530 Subject: [PATCH] staging: andriod: ashmem: Declared file operation with const keyword In-Reply-To: <20210313172636.18234-1-namrata.janawade@gmail.com> References: <20210313172636.18234-1-namrata.janawade@gmail.com> Message-ID: On Sat, Mar 13, 2021 at 10:57 PM namratajanawade wrote: > > Warning found by checkpatch.pl script. That doesn't tell what you did or why you did it. Please write an appropriate commit description and resend the patch. karthik From selvakumar16197 at gmail.com Sat Mar 13 17:32:47 2021 From: selvakumar16197 at gmail.com (Selvakumar Elangovan) Date: Sat, 13 Mar 2021 23:02:47 +0530 Subject: [PATCH] staging: octeon-usb: fixed precedence issue Message-ID: <20210313173247.8676-1-selvakumar16197@gmail.com> Added parenthesis around reg macro to avoid precedence issue identified by checkpatch.pl Signed-off-by: Selvakumar Elangovan --- drivers/staging/octeon-usb/octeon-hcd.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/octeon-usb/octeon-hcd.h b/drivers/staging/octeon-usb/octeon-hcd.h index 9ed619c93a4e..5aefd3fb3854 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.h +++ b/drivers/staging/octeon-usb/octeon-hcd.h @@ -51,11 +51,11 @@ #include #define CVMX_USBCXBASE 0x00016F0010000000ull -#define CVMX_USBCXREG1(reg, bid) \ - (CVMX_ADD_IO_SEG(CVMX_USBCXBASE | reg) + \ +#define CVMX_USBCXREG1((reg), bid) \ + (CVMX_ADD_IO_SEG(CVMX_USBCXBASE | (reg)) + \ ((bid) & 1) * 0x100000000000ull) -#define CVMX_USBCXREG2(reg, bid, off) \ - (CVMX_ADD_IO_SEG(CVMX_USBCXBASE | reg) + \ +#define CVMX_USBCXREG2((reg), bid, off) \ + (CVMX_ADD_IO_SEG(CVMX_USBCXBASE | (reg)) + \ (((off) & 7) + ((bid) & 1) * 0x8000000000ull) * 32) #define CVMX_USBCX_GAHBCFG(bid) CVMX_USBCXREG1(0x008, bid) @@ -86,10 +86,10 @@ #define CVMX_USBNXBID1(bid) (((bid) & 1) * 0x10000000ull) #define CVMX_USBNXBID2(bid) (((bid) & 1) * 0x100000000000ull) -#define CVMX_USBNXREG1(reg, bid) \ - (CVMX_ADD_IO_SEG(0x0001180068000000ull | reg) + CVMX_USBNXBID1(bid)) -#define CVMX_USBNXREG2(reg, bid) \ - (CVMX_ADD_IO_SEG(0x00016F0000000000ull | reg) + CVMX_USBNXBID2(bid)) +#define CVMX_USBNXREG1((reg), bid) \ + (CVMX_ADD_IO_SEG(0x0001180068000000ull | (reg)) + CVMX_USBNXBID1(bid)) +#define CVMX_USBNXREG2((reg), bid) \ + (CVMX_ADD_IO_SEG(0x00016F0000000000ull | (reg)) + CVMX_USBNXBID2(bid)) #define CVMX_USBNX_CLK_CTL(bid) CVMX_USBNXREG1(0x10, bid) #define CVMX_USBNX_DMA0_INB_CHN0(bid) CVMX_USBNXREG2(0x818, bid) -- 2.17.1 From gabriele.modena at gmail.com Sat Mar 13 17:35:29 2021 From: gabriele.modena at gmail.com (Gabriele Modena) Date: Sat, 13 Mar 2021 18:35:29 +0100 Subject: [PATCH v2 0/3] staging: wimax: fix style check warnings In-Reply-To: <20210305195508.3543-1-gabriele.modena@gmail.com> References: <20210305195508.3543-1-gabriele.modena@gmail.com> Message-ID: Fix style warnings reported by checkpatch.pl on op-rfkill.c by moving */ on a separate line in a block comment, adding a missing blank line after declarations, and reformatting a quoted string split across lines. Resubmitting so that each style warning is addressed in a separate commit. This patch is both an attempt to address the warnings, as well as a way for me to familiarise with the linux kernel contribution process, by following tasks proposed by a popular online challenge. Gabriele Modena (3): staging: wimax: fix block comment style check in op-rfkill.c staging: wimax: add a blank line after declaration in op-rfkill.c staging: wimax: fix quoted string split across lines in op-rfkill.c drivers/staging/wimax/op-rfkill.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.11.0 From gabriele.modena at gmail.com Sat Mar 13 17:35:30 2021 From: gabriele.modena at gmail.com (Gabriele Modena) Date: Sat, 13 Mar 2021 18:35:30 +0100 Subject: [PATCH v2 1/3] staging: wimax: fix block comment style check in op-rfkill.c In-Reply-To: References: Message-ID: <752f22ec19c8e5bc249589ca4c5edef770396aff.1615652628.git.gabriele.modena@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: Block comments use a trailing */ on a separate line + * considering the radios are all off. */ Signed-off-by: Gabriele Modena --- drivers/staging/wimax/op-rfkill.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wimax/op-rfkill.c b/drivers/staging/wimax/op-rfkill.c index 78b294481a59..ad9d1c682ca2 100644 --- a/drivers/staging/wimax/op-rfkill.c +++ b/drivers/staging/wimax/op-rfkill.c @@ -294,7 +294,8 @@ int wimax_rfkill(struct wimax_dev *wimax_dev, enum wimax_rf_state state) /* While initializing, < 1.4.3 wimax-tools versions use * this call to check if the device is a valid WiMAX * device; so we allow it to proceed always, - * considering the radios are all off. */ + * considering the radios are all off. + */ if (result == -ENOMEDIUM && state == WIMAX_RF_QUERY) result = WIMAX_RF_OFF << 1 | WIMAX_RF_OFF; goto error_not_ready; -- 2.11.0 From gabriele.modena at gmail.com Sat Mar 13 17:35:31 2021 From: gabriele.modena at gmail.com (Gabriele Modena) Date: Sat, 13 Mar 2021 18:35:31 +0100 Subject: [PATCH v2 2/3] staging: wimax: add a blank line after declaration in op-rfkill.c In-Reply-To: References: Message-ID: <1ee3795245816a81609749c82c3d369ea0cbf466.1615652628.git.gabriele.modena@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: Missing a blank line after declarations + struct device *dev = wimax_dev_to_dev(wimax_dev); + d_fnstart(3, dev, "(wimax_dev %p)\n", wimax_dev); Signed-off-by: Gabriele Modena --- drivers/staging/wimax/op-rfkill.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/wimax/op-rfkill.c b/drivers/staging/wimax/op-rfkill.c index ad9d1c682ca2..50146f7b089e 100644 --- a/drivers/staging/wimax/op-rfkill.c +++ b/drivers/staging/wimax/op-rfkill.c @@ -379,6 +379,7 @@ int wimax_rfkill_add(struct wimax_dev *wimax_dev) void wimax_rfkill_rm(struct wimax_dev *wimax_dev) { struct device *dev = wimax_dev_to_dev(wimax_dev); + d_fnstart(3, dev, "(wimax_dev %p)\n", wimax_dev); rfkill_unregister(wimax_dev->rfkill); rfkill_destroy(wimax_dev->rfkill); -- 2.11.0 From gabriele.modena at gmail.com Sat Mar 13 17:35:32 2021 From: gabriele.modena at gmail.com (Gabriele Modena) Date: Sat, 13 Mar 2021 18:35:32 +0100 Subject: [PATCH v2 3/3] staging: wimax: fix quoted string split across lines in op-rfkill.c In-Reply-To: References: Message-ID: <590fcf33a97025019e5c3b3a915fec9bbe24aa4c.1615652628.git.gabriele.modena@gmail.com> This commit fixes the following checkpatch.pl warning: WARNING: quoted string split across lines + dev_err(dev, "WIMAX_GNL_RFKILL: can't find RFKILL_STATE " + "attribute\n"); Signed-off-by: Gabriele Modena --- drivers/staging/wimax/op-rfkill.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wimax/op-rfkill.c b/drivers/staging/wimax/op-rfkill.c index 50146f7b089e..52612ed09183 100644 --- a/drivers/staging/wimax/op-rfkill.c +++ b/drivers/staging/wimax/op-rfkill.c @@ -417,8 +417,7 @@ int wimax_gnl_doit_rfkill(struct sk_buff *skb, struct genl_info *info) dev = wimax_dev_to_dev(wimax_dev); result = -EINVAL; if (info->attrs[WIMAX_GNL_RFKILL_STATE] == NULL) { - dev_err(dev, "WIMAX_GNL_RFKILL: can't find RFKILL_STATE " - "attribute\n"); + dev_err(dev, "WIMAX_GNL_RFKILL: can't find RFKILL_STATE attribute\n"); goto error_no_pid; } new_state = nla_get_u32(info->attrs[WIMAX_GNL_RFKILL_STATE]); -- 2.11.0 From madhumithabiw at gmail.com Sat Mar 13 18:30:19 2021 From: madhumithabiw at gmail.com (Madhumitha Prabakaran) Date: Sat, 13 Mar 2021 12:30:19 -0600 Subject: [PATCH] staging: vt6655: Fix camelcase Message-ID: <20210313183019.368317-1-madhumithabiw@gmail.com> Fix checkpatch.pl - Avoid CamelCase: Signed-off-by: Madhumitha Prabakaran --- drivers/staging/vt6655/baseband.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index 1aa675241599..d89163299172 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c @@ -52,7 +52,7 @@ /*--------------------- Static Variables --------------------------*/ #define CB_VT3253_INIT_FOR_RFMD 446 -static const unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = { +static const unsigned char by_vt3253_init_tab_rfmd[CB_VT3253_INIT_FOR_RFMD][2] = { {0x00, 0x30}, {0x01, 0x00}, {0x02, 0x00}, @@ -2002,8 +2002,8 @@ bool bb_vt3253_init(struct vnt_private *priv) if (by_local_id <= REV_ID_VT3253_A1) { for (ii = 0; ii < CB_VT3253_INIT_FOR_RFMD; ii++) result &= bb_write_embedded(priv, - byVT3253InitTab_RFMD[ii][0], - byVT3253InitTab_RFMD[ii][1]); + by_vt3253_init_tab_rfmd[ii][0], + by_vt3253_init_tab_rfmd[ii][1]); } else { for (ii = 0; ii < CB_VT3253B0_INIT_FOR_RFMD; ii++) -- 2.25.1 From jic23 at kernel.org Sat Mar 13 18:54:53 2021 From: jic23 at kernel.org (Jonathan Cameron) Date: Sat, 13 Mar 2021 18:54:53 +0000 Subject: [PATCH] staging: iio: ad9834: convert to device-managed functions in probe In-Reply-To: <20210310095131.47476-1-aardelean@deviqon.com> References: <20210310095131.47476-1-aardelean@deviqon.com> Message-ID: <20210313185453.76f2518c@archlinux> On Wed, 10 Mar 2021 11:51:31 +0200 Alexandru Ardelean wrote: > 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 I tweaked this a little to drop st->reg as it's no longer used. Applied to the togreg branch of iio.git and pushed out as testing for allow the autobuilders to poke randomly at it. Thanks, Jonathan > --- > drivers/staging/iio/frequency/ad9834.c | 64 +++++++++++++------------- > 1 file changed, 31 insertions(+), 33 deletions(-) > > diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c > index 262c3590e64e..b063cfd0e0e1 100644 > --- a/drivers/staging/iio/frequency/ad9834.c > +++ b/drivers/staging/iio/frequency/ad9834.c > @@ -390,6 +390,20 @@ static const struct iio_info ad9833_info = { > .attrs = &ad9833_attribute_group, > }; > > +static void ad9834_disable_reg(void *data) > +{ > + struct regulator *reg = data; > + > + regulator_disable(reg); > +} > + > +static void ad9834_disable_clk(void *data) > +{ > + struct clk *clk = data; > + > + clk_disable_unprepare(clk); > +} > + > static int ad9834_probe(struct spi_device *spi) > { > struct ad9834_state *st; > @@ -407,26 +421,33 @@ static int ad9834_probe(struct spi_device *spi) > return ret; > } > > + ret = devm_add_action_or_reset(&spi->dev, ad9834_disable_reg, reg); > + if (ret) > + return ret; > + > indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); > if (!indio_dev) { > ret = -ENOMEM; > - goto error_disable_reg; > + return ret; > } > - spi_set_drvdata(spi, indio_dev); > st = iio_priv(indio_dev); > mutex_init(&st->lock); > st->mclk = devm_clk_get(&spi->dev, NULL); > if (IS_ERR(st->mclk)) { > ret = PTR_ERR(st->mclk); > - goto error_disable_reg; > + return ret; > } > > ret = clk_prepare_enable(st->mclk); > if (ret) { > dev_err(&spi->dev, "Failed to enable master clock\n"); > - goto error_disable_reg; > + return ret; > } > > + ret = devm_add_action_or_reset(&spi->dev, ad9834_disable_clk, st->mclk); > + if (ret) > + return ret; > + > st->spi = spi; > st->devid = spi_get_device_id(spi)->driver_data; > st->reg = reg; > @@ -470,48 +491,26 @@ static int ad9834_probe(struct spi_device *spi) > ret = spi_sync(st->spi, &st->msg); > if (ret) { > dev_err(&spi->dev, "device init failed\n"); > - goto error_clock_unprepare; > + return ret; > } > > ret = ad9834_write_frequency(st, AD9834_REG_FREQ0, 1000000); > if (ret) > - goto error_clock_unprepare; > + return ret; > > ret = ad9834_write_frequency(st, AD9834_REG_FREQ1, 5000000); > if (ret) > - goto error_clock_unprepare; > + return ret; > > ret = ad9834_write_phase(st, AD9834_REG_PHASE0, 512); > if (ret) > - goto error_clock_unprepare; > + return ret; > > ret = ad9834_write_phase(st, AD9834_REG_PHASE1, 1024); > if (ret) > - goto error_clock_unprepare; > - > - ret = iio_device_register(indio_dev); > - if (ret) > - goto error_clock_unprepare; > - > - return 0; > -error_clock_unprepare: > - clk_disable_unprepare(st->mclk); > -error_disable_reg: > - regulator_disable(reg); > - > - return ret; > -} > - > -static int ad9834_remove(struct spi_device *spi) > -{ > - struct iio_dev *indio_dev = spi_get_drvdata(spi); > - struct ad9834_state *st = iio_priv(indio_dev); > - > - iio_device_unregister(indio_dev); > - clk_disable_unprepare(st->mclk); > - regulator_disable(st->reg); > + return ret; > > - return 0; > + return devm_iio_device_register(&spi->dev, indio_dev); > } > > static const struct spi_device_id ad9834_id[] = { > @@ -539,7 +538,6 @@ static struct spi_driver ad9834_driver = { > .of_match_table = ad9834_of_match > }, > .probe = ad9834_probe, > - .remove = ad9834_remove, > .id_table = ad9834_id, > }; > module_spi_driver(ad9834_driver); From pr-tracker-bot at kernel.org Sat Mar 13 20:45:36 2021 From: pr-tracker-bot at kernel.org (pr-tracker-bot at kernel.org) Date: Sat, 13 Mar 2021 20:45:36 +0000 Subject: [GIT PULL] Staging driver fixes for 5.12-rc3 In-Reply-To: References: Message-ID: <161566833690.19597.7937919137536167389.pr-tracker-bot@kernel.org> The pull request you sent on Sat, 13 Mar 2021 16:03:34 +0100: > git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git tags/staging-5.12-rc3 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/be61af330e09cfdde29fa5516b2ee015ebdc8bea Thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html From nathan at kernel.org Sat Mar 13 22:42:05 2021 From: nathan at kernel.org (Nathan Chancellor) Date: Sat, 13 Mar 2021 15:42:05 -0700 Subject: [PATCH] staging: andriod: ashmem: Declared file operation with const keyword In-Reply-To: References: <20210313172636.18234-1-namrata.janawade@gmail.com> Message-ID: <20210313224205.ubnwecxyyas5qtvk@archlinux-ax161> On Sat, Mar 13, 2021 at 10:59:43PM +0530, B K Karthik wrote: > On Sat, Mar 13, 2021 at 10:57 PM namratajanawade > wrote: > > > > Warning found by checkpatch.pl script. > > That doesn't tell what you did or why you did it. Please write an > appropriate commit description and resend the patch. > > karthik This patch will not even build, it has been sent several times before... https://lore.kernel.org/r/20201016051111.1947-1-kirank.suren at gmail.com/ https://lore.kernel.org/r/20200328151523.17516-1-sandeshkenjanaashok at gmail.com/ https://lore.kernel.org/r/20201128121627.GA27317 at worker-node1/ https://lore.kernel.org/r/20201227112645.256943-1-senguptaangshuman17 at gmail.com/ https://lore.kernel.org/r/20201228051301.14983-1-jovin555 at gmail.com/ https://lore.kernel.org/r/20210214023136.8916-1-thaiscamachoo at gmail.com/ https://lore.kernel.org/r/20210219101338.2670-1-amritkhera98 at gmail.com/ https://lore.kernel.org/r/20210306063817.674041-1-nabil.ibn.mahmud at gmail.com/ I once considered adding a comment above it saying that it should not be marked const but it is a good benchmark for seeing if people compile their patches before sending them out. Cheers, Nathan From ztong0001 at gmail.com Sun Mar 14 03:57:57 2021 From: ztong0001 at gmail.com (Tong Zhang) Date: Sat, 13 Mar 2021 22:57:57 -0500 Subject: [PATCH] staging: comedi: replace slash in name Message-ID: <20210314035757.2740146-1-ztong0001@gmail.com> request_irq() wont accept a name which contains slash so we need to repalce it with something else -- otherwise it will trigger a warning and the entry in /proc/irq/ will not be created [ 1.565966] name 'pci-das6402/16' [ 1.566149] WARNING: CPU: 0 PID: 184 at fs/proc/generic.c:180 __xlate_proc_name+0x93/0xb0 [ 1.568923] RIP: 0010:__xlate_proc_name+0x93/0xb0 [ 1.574200] Call Trace: [ 1.574722] proc_mkdir+0x18/0x20 [ 1.576629] request_threaded_irq+0xfe/0x160 [ 1.576859] auto_attach+0x60a/0xc40 [cb_pcidas64] Signed-off-by: Tong Zhang --- drivers/staging/comedi/drivers/cb_pcidas64.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index fa987bb0e7cd..662d6ffb8f60 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -677,7 +677,7 @@ static const int bytes_in_sample = 2; static const struct pcidas64_board pcidas64_boards[] = { [BOARD_PCIDAS6402_16] = { - .name = "pci-das6402/16", + .name = "pci-das6402-16", .ai_se_chans = 64, .ai_bits = 16, .ai_speed = 5000, @@ -693,7 +693,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .has_8255 = 1, }, [BOARD_PCIDAS6402_12] = { - .name = "pci-das6402/12", /* XXX check */ + .name = "pci-das6402-12", /* XXX check */ .ai_se_chans = 64, .ai_bits = 12, .ai_speed = 5000, @@ -709,7 +709,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .has_8255 = 1, }, [BOARD_PCIDAS64_M1_16] = { - .name = "pci-das64/m1/16", + .name = "pci-das64-m1-16", .ai_se_chans = 64, .ai_bits = 16, .ai_speed = 1000, @@ -725,7 +725,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .has_8255 = 1, }, [BOARD_PCIDAS64_M2_16] = { - .name = "pci-das64/m2/16", + .name = "pci-das64-m2-16", .ai_se_chans = 64, .ai_bits = 16, .ai_speed = 500, @@ -741,7 +741,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .has_8255 = 1, }, [BOARD_PCIDAS64_M3_16] = { - .name = "pci-das64/m3/16", + .name = "pci-das64-m3-16", .ai_se_chans = 64, .ai_bits = 16, .ai_speed = 333, @@ -984,7 +984,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .has_8255 = 0, }, [BOARD_PCIDAS4020_12] = { - .name = "pci-das4020/12", + .name = "pci-das4020-12", .ai_se_chans = 4, .ai_bits = 12, .ai_speed = 50, -- 2.25.1 From ztong0001 at gmail.com Sun Mar 14 04:02:20 2021 From: ztong0001 at gmail.com (Tong Zhang) Date: Sat, 13 Mar 2021 23:02:20 -0500 Subject: [PATCH] staging: comedi: cb_pcidas: replace slash in name Message-ID: <20210314040221.2740750-1-ztong0001@gmail.com> request_irq() wont accept a name which contains slash so we need to repalce it with something else -- otherwise it will trigger a warning and the entry in /proc/irq/ will not be created [ 1.630764] name 'pci-das1602/16' [ 1.630950] WARNING: CPU: 0 PID: 181 at fs/proc/generic.c:180 __xlate_proc_name+0x93/0xb0 [ 1.634009] RIP: 0010:__xlate_proc_name+0x93/0xb0 [ 1.639441] Call Trace: [ 1.639976] proc_mkdir+0x18/0x20 [ 1.641946] request_threaded_irq+0xfe/0x160 [ 1.642186] cb_pcidas_auto_attach+0xf4/0x610 [cb_pcidas] Signed-off-by: Tong Zhang --- drivers/staging/comedi/drivers/cb_pcidas.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index d740c4782775..df0960d41cff 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -230,7 +230,7 @@ struct cb_pcidas_board { static const struct cb_pcidas_board cb_pcidas_boards[] = { [BOARD_PCIDAS1602_16] = { - .name = "pci-das1602/16", + .name = "pci-das1602-16", .ai_speed = 5000, .ao_scan_speed = 10000, .fifo_size = 512, @@ -248,7 +248,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .has_ao = 1, }, [BOARD_PCIDAS1602_12] = { - .name = "pci-das1602/12", + .name = "pci-das1602-12", .ai_speed = 3200, .ao_scan_speed = 4000, .fifo_size = 1024, @@ -257,12 +257,12 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { .is_1602 = 1, }, [BOARD_PCIDAS1200_JR] = { - .name = "pci-das1200/jr", + .name = "pci-das1200-jr", .ai_speed = 3200, .fifo_size = 1024, }, [BOARD_PCIDAS1602_16_JR] = { - .name = "pci-das1602/16/jr", + .name = "pci-das1602-16-jr", .ai_speed = 5000, .fifo_size = 512, .is_16bit = 1, -- 2.25.1 From gregkh at linuxfoundation.org Sun Mar 14 07:33:39 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Sun, 14 Mar 2021 08:33:39 +0100 Subject: [PATCH] staging: octeon-usb: fixed precedence issue In-Reply-To: <20210313173247.8676-1-selvakumar16197@gmail.com> References: <20210313173247.8676-1-selvakumar16197@gmail.com> Message-ID: On Sat, Mar 13, 2021 at 11:02:47PM +0530, Selvakumar Elangovan wrote: > Added parenthesis around reg macro to avoid precedence issue identified by > checkpatch.pl > > Signed-off-by: Selvakumar Elangovan > --- > drivers/staging/octeon-usb/octeon-hcd.h | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/staging/octeon-usb/octeon-hcd.h b/drivers/staging/octeon-usb/octeon-hcd.h > index 9ed619c93a4e..5aefd3fb3854 100644 > --- a/drivers/staging/octeon-usb/octeon-hcd.h > +++ b/drivers/staging/octeon-usb/octeon-hcd.h > @@ -51,11 +51,11 @@ > #include > > #define CVMX_USBCXBASE 0x00016F0010000000ull > -#define CVMX_USBCXREG1(reg, bid) \ > - (CVMX_ADD_IO_SEG(CVMX_USBCXBASE | reg) + \ > +#define CVMX_USBCXREG1((reg), bid) \ Why did you change this line? From gregkh at linuxfoundation.org Sun Mar 14 08:35:26 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Sun, 14 Mar 2021 09:35:26 +0100 Subject: [PATCH] staging: octeon-usb: fixed precedence issue In-Reply-To: References: <20210313173247.8676-1-selvakumar16197@gmail.com> Message-ID: A: http://en.wikipedia.org/wiki/Top_post Q: Were do I find info about this thing called top-posting? A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? A: No. Q: Should I include quotations after my reply? http://daringfireball.net/2007/07/on_top On Sun, Mar 14, 2021 at 01:34:23PM +0530, Selvakumar E wrote: > Hi Greg > I changed the line because of the checkpatch.pl warned for > precedence issue. But I fail to see how this: > > > +#define CVMX_USBCXREG1((reg), bid) \ Does anything here at all. What am I missing? thanks, greg k-h From insafonov at gmail.com Sun Mar 14 09:02:45 2021 From: insafonov at gmail.com (Ivan Safonov) Date: Sun, 14 Mar 2021 12:02:45 +0300 Subject: [PATCH 2/4] staging:r8188eu: remove unused definitions from wifi.h In-Reply-To: <20210314090247.21181-1-insafonov@gmail.com> References: <20210314090247.21181-1-insafonov@gmail.com> Message-ID: <20210314090247.21181-3-insafonov@gmail.com> These definitions are not used and will not be useful in the future. Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/include/wifi.h | 92 ------------------------ 1 file changed, 92 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h index 5ee4d02e293c..f03359602db7 100644 --- a/drivers/staging/rtl8188eu/include/wifi.h +++ b/drivers/staging/rtl8188eu/include/wifi.h @@ -7,21 +7,8 @@ #ifndef _WIFI_H_ #define _WIFI_H_ -#define WLAN_IEEE_OUI_LEN 3 -#define WLAN_CRC_LEN 4 -#define WLAN_BSSID_LEN 6 -#define WLAN_BSS_TS_LEN 8 #define WLAN_HDR_A3_LEN 24 -#define WLAN_HDR_A4_LEN 30 #define WLAN_HDR_A3_QOS_LEN 26 -#define WLAN_HDR_A4_QOS_LEN 32 -#define WLAN_DATA_MAXLEN 2312 - -#define WLAN_A3_PN_OFFSET 24 -#define WLAN_A4_PN_OFFSET 30 - -#define WLAN_MIN_ETHFRM_LEN 60 -#define WLAN_MAX_ETHFRM_LEN 1514 #define P80211CAPTURE_VERSION 0x80211001 @@ -74,20 +61,6 @@ enum WIFI_FRAME_SUBTYPE { WIFI_QOS_DATA_NULL = (BIT(6) | WIFI_QOS_DATA_TYPE), }; -enum WIFI_REG_DOMAIN { - DOMAIN_FCC = 1, - DOMAIN_IC = 2, - DOMAIN_ETSI = 3, - DOMAIN_SPA = 4, - DOMAIN_FRANCE = 5, - DOMAIN_MKK = 6, - DOMAIN_ISRAEL = 7, - DOMAIN_MKK1 = 8, - DOMAIN_MKK2 = 9, - DOMAIN_MKK3 = 10, - DOMAIN_MAX -}; - #define SetToDs(pbuf) \ *(__le16 *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_TODS) @@ -199,8 +172,6 @@ enum WIFI_REG_DOMAIN { #define GetAddr3Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 16)) -#define GetAddr4Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 24)) - static inline unsigned char *get_hdr_bssid(unsigned char *pframe) { unsigned char *sa; @@ -237,19 +208,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe) /*----------------------------------------------------------------------------- Below is for the security related definition ------------------------------------------------------------------------------*/ -#define _RESERVED_FRAME_TYPE_ 0 -#define _SKB_FRAME_TYPE_ 2 -#define _PRE_ALLOCMEM_ 1 -#define _PRE_ALLOCHDR_ 3 -#define _PRE_ALLOCLLCHDR_ 4 -#define _PRE_ALLOCICVHDR_ 5 -#define _PRE_ALLOCMICHDR_ 6 - -#define _SIFSTIME_ \ - ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11A) ? 16 : 10) -#define _ACKCTSLNG_ 14 /* 14 bytes long, including crclng */ -#define _CRCLNG_ 4 - #define _ASOCREQ_IE_OFFSET_ 4 /* excluding wlan_hdr */ #define _ASOCRSP_IE_OFFSET_ 6 #define _REASOCREQ_IE_OFFSET_ 10 @@ -280,10 +238,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe) #define AUTH_ODD_TO 0 #define AUTH_EVEN_TO 1 -#define WLAN_ETHCONV_ENCAP 1 -#define WLAN_ETHCONV_RFC1042 2 -#define WLAN_ETHCONV_8021h 3 - #define cap_ESS BIT(0) #define cap_IBSS BIT(1) #define cap_CFPollable BIT(2) @@ -316,7 +270,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe) Below is the definition for WMM ------------------------------------------------------------------------------*/ #define _WMM_IE_Length_ 7 /* for WMM STA */ -#define _WMM_Para_Element_Length_ 24 /*----------------------------------------------------------------------------- Below is the definition for 802.11n @@ -388,13 +341,6 @@ enum ht_cap_ampdu_factor { #define HT_INFO_OPERATION_MODE_TRANSMIT_BURST_LIMIT ((u8)BIT(3)) #define HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT ((u8)BIT(4)) -#define HT_INFO_STBC_PARAM_DUAL_BEACON ((u16)BIT(6)) -#define HT_INFO_STBC_PARAM_DUAL_STBC_PROTECT ((u16)BIT(7)) -#define HT_INFO_STBC_PARAM_SECONDARY_BC ((u16)BIT(8)) -#define HT_INFO_STBC_PARAM_LSIG_TXOP_PROTECT_ALLOWED ((u16)BIT(9)) -#define HT_INFO_STBC_PARAM_PCO_ACTIVE ((u16)BIT(10)) -#define HT_INFO_STBC_PARAM_PCO_PHASE ((u16)BIT(11)) - /* ===============WPS Section=============== */ /* For WPSv1.0 */ #define WPSOUI 0x0050f204 @@ -453,48 +399,10 @@ enum ht_cap_ampdu_factor { #define WPS_CONFIG_METHOD_VDISPLAY 0x2008 #define WPS_CONFIG_METHOD_PDISPLAY 0x4008 -/* Value of Category ID of WPS Primary Device Type Attribute */ -#define WPS_PDT_CID_DISPLAYS 0x0007 -#define WPS_PDT_CID_MULIT_MEDIA 0x0008 -#define WPS_PDT_CID_RTK_WIDI WPS_PDT_CID_MULIT_MEDIA - -/* Value of Sub Category ID of WPS Primary Device Type Attribute */ -#define WPS_PDT_SCID_MEDIA_SERVER 0x0005 -#define WPS_PDT_SCID_RTK_DMP WPS_PDT_SCID_MEDIA_SERVER - -/* Value of Device Password ID */ -#define WPS_DPID_P 0x0000 -#define WPS_DPID_USER_SPEC 0x0001 -#define WPS_DPID_MACHINE_SPEC 0x0002 -#define WPS_DPID_REKEY 0x0003 -#define WPS_DPID_PBC 0x0004 -#define WPS_DPID_REGISTRAR_SPEC 0x0005 - /* Value of WPS RF Bands Attribute */ #define WPS_RF_BANDS_2_4_GHZ 0x01 #define WPS_RF_BANDS_5_GHZ 0x02 -/* Value of WPS Association State Attribute */ -#define WPS_ASSOC_STATE_NOT_ASSOCIATED 0x00 -#define WPS_ASSOC_STATE_CONNECTION_SUCCESS 0x01 -#define WPS_ASSOC_STATE_CONFIGURATION_FAILURE 0x02 -#define WPS_ASSOC_STATE_ASSOCIATION_FAILURE 0x03 -#define WPS_ASSOC_STATE_IP_FAILURE 0x04 - -/* WPS Configuration Method */ -#define WPS_CM_NONE 0x0000 -#define WPS_CM_LABEL 0x0004 -#define WPS_CM_DISPLYA 0x0008 -#define WPS_CM_EXTERNAL_NFC_TOKEN 0x0010 -#define WPS_CM_INTEGRATED_NFC_TOKEN 0x0020 -#define WPS_CM_NFC_INTERFACE 0x0040 -#define WPS_CM_PUSH_BUTTON 0x0080 -#define WPS_CM_KEYPAD 0x0100 -#define WPS_CM_SW_PUHS_BUTTON 0x0280 -#define WPS_CM_HW_PUHS_BUTTON 0x0480 -#define WPS_CM_SW_DISPLAY_P 0x2008 -#define WPS_CM_LCD_DISPLAY_P 0x4008 - #define IP_MCAST_MAC(mac) \ ((mac[0] == 0x01) && (mac[1] == 0x00) && (mac[2] == 0x5e)) #define ICMPV6_MCAST_MAC(mac) \ -- 2.26.2 From insafonov at gmail.com Sun Mar 14 09:02:43 2021 From: insafonov at gmail.com (Ivan Safonov) Date: Sun, 14 Mar 2021 12:02:43 +0300 Subject: [PATCH 0/4] staging:r8188eu: remove unnecessary definitions from wifi.h Message-ID: <20210314090247.21181-1-insafonov@gmail.com> wifi.h contains unnecessary definitions. Some of them are not used at all, some can be replaced with native definitions. Ivan Safonov (4): staging:r8188eu: replace get_(d|s)a with ieee80211_get_(D|S)A staging:r8188eu: remove unused definitions from wifi.h staging:r8188eu: replace cap_* definitions with native kernel WLAN_CAPABILITY_* staging:r8188eu: use ieee80211_is_ctl instead IsFrameTypeCtrl .../staging/rtl8188eu/core/rtw_ieee80211.c | 6 +- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 12 +- drivers/staging/rtl8188eu/core/rtw_recv.c | 4 +- .../staging/rtl8188eu/hal/rtl8188e_rxdesc.c | 8 +- drivers/staging/rtl8188eu/include/wifi.h | 156 ------------------ 5 files changed, 16 insertions(+), 170 deletions(-) -- 2.26.2 From insafonov at gmail.com Sun Mar 14 09:02:47 2021 From: insafonov at gmail.com (Ivan Safonov) Date: Sun, 14 Mar 2021 12:02:47 +0300 Subject: [PATCH 4/4] staging:r8188eu: use ieee80211_is_ctl instead IsFrameTypeCtrl In-Reply-To: <20210314090247.21181-1-insafonov@gmail.com> References: <20210314090247.21181-1-insafonov@gmail.com> Message-ID: <20210314090247.21181-5-insafonov@gmail.com> IsFrameTypeCtrl() duplicate ieee80211_is_ctl(). Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c | 8 +++++--- drivers/staging/rtl8188eu/include/wifi.h | 8 -------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c index 4fae75fc3dd5..8669bf097479 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c @@ -133,6 +133,8 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, struct rx_pkt_attrib *pattrib = &precvframe->attrib; struct odm_phy_status_info *pPHYInfo = (struct odm_phy_status_info *)(&pattrib->phy_info); u8 *wlanhdr; + struct ieee80211_hdr *hdr = + (struct ieee80211_hdr *)precvframe->pkt->data; struct odm_per_pkt_info pkt_info; u8 *sa = NULL; struct sta_priv *pstapriv; @@ -144,13 +146,13 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, wlanhdr = precvframe->pkt->data; - pkt_info.bPacketMatchBSSID = ((!IsFrameTypeCtrl(wlanhdr)) && + pkt_info.bPacketMatchBSSID = (!ieee80211_is_ctl(hdr->frame_control) && !pattrib->icv_err && !pattrib->crc_err && !memcmp(get_hdr_bssid(wlanhdr), get_bssid(&padapter->mlmepriv), ETH_ALEN)); pkt_info.bPacketToSelf = pkt_info.bPacketMatchBSSID && - (!memcmp(ieee80211_get_DA((struct ieee80211_hdr *)wlanhdr), + (!memcmp(ieee80211_get_DA(hdr), myid(&padapter->eeprompriv), ETH_ALEN)); pkt_info.bPacketBeacon = pkt_info.bPacketMatchBSSID && @@ -161,7 +163,7 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, sa = padapter->mlmepriv.cur_network.network.MacAddress; /* to do Ad-hoc */ } else { - sa = ieee80211_get_SA((struct ieee80211_hdr *)wlanhdr); + sa = ieee80211_get_SA(hdr); } pstapriv = &padapter->stapriv; diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h index d65a0a88a69a..84e17330628e 100644 --- a/drivers/staging/rtl8188eu/include/wifi.h +++ b/drivers/staging/rtl8188eu/include/wifi.h @@ -197,14 +197,6 @@ static inline unsigned char *get_hdr_bssid(unsigned char *pframe) return sa; } -static inline int IsFrameTypeCtrl(unsigned char *pframe) -{ - if (GetFrameType(pframe) == WIFI_CTRL_TYPE) - return true; - else - return false; -} - /*----------------------------------------------------------------------------- Below is for the security related definition ------------------------------------------------------------------------------*/ -- 2.26.2 From insafonov at gmail.com Sun Mar 14 09:02:46 2021 From: insafonov at gmail.com (Ivan Safonov) Date: Sun, 14 Mar 2021 12:02:46 +0300 Subject: [PATCH 3/4] staging:r8188eu: replace cap_* definitions with native kernel WLAN_CAPABILITY_* In-Reply-To: <20210314090247.21181-1-insafonov@gmail.com> References: <20210314090247.21181-1-insafonov@gmail.com> Message-ID: <20210314090247.21181-4-insafonov@gmail.com> cap_* definitions duplicate WLAN_CAPABILITY_*. Remove cap_* definitions, improve code consistency. Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 6 +++--- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 6 +++--- drivers/staging/rtl8188eu/include/wifi.h | 12 ------------ 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c index ec5b8be14c2b..7a706fe11750 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c @@ -223,13 +223,13 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv) /* capability info */ *(u16 *)ie = 0; - *(__le16 *)ie |= cpu_to_le16(cap_IBSS); + *(__le16 *)ie |= cpu_to_le16(WLAN_CAPABILITY_IBSS); if (pregistrypriv->preamble == PREAMBLE_SHORT) - *(__le16 *)ie |= cpu_to_le16(cap_ShortPremble); + *(__le16 *)ie |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE); if (pdev_network->Privacy) - *(__le16 *)ie |= cpu_to_le16(cap_Privacy); + *(__le16 *)ie |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); sz += 2; ie += 2; diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index bee19d5b22c0..50d3c3631be0 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -2188,7 +2188,7 @@ static void start_create_ibss(struct adapter *padapter) /* update capability */ caps = rtw_get_capability(pnetwork); update_capinfo(padapter, caps); - if (caps & cap_IBSS) {/* adhoc master */ + if (caps & WLAN_CAPABILITY_IBSS) {/* adhoc master */ val8 = 0xcf; rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8)); @@ -2240,7 +2240,7 @@ static void start_clnt_join(struct adapter *padapter) /* update capability */ caps = rtw_get_capability(pnetwork); update_capinfo(padapter, caps); - if (caps & cap_ESS) { + if (caps & WLAN_CAPABILITY_ESS) { Set_MSR(padapter, WIFI_FW_STATION_STATE); val8 = (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X) ? 0xcc : 0xcf; @@ -2258,7 +2258,7 @@ static void start_clnt_join(struct adapter *padapter) msecs_to_jiffies((REAUTH_TO * REAUTH_LIMIT) + (REASSOC_TO * REASSOC_LIMIT) + beacon_timeout)); pmlmeinfo->state = WIFI_FW_AUTH_NULL | WIFI_FW_STATION_STATE; - } else if (caps & cap_IBSS) { /* adhoc client */ + } else if (caps & WLAN_CAPABILITY_IBSS) { /* adhoc client */ Set_MSR(padapter, WIFI_FW_ADHOC_STATE); val8 = 0xcf; diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h index f03359602db7..d65a0a88a69a 100644 --- a/drivers/staging/rtl8188eu/include/wifi.h +++ b/drivers/staging/rtl8188eu/include/wifi.h @@ -238,18 +238,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe) #define AUTH_ODD_TO 0 #define AUTH_EVEN_TO 1 -#define cap_ESS BIT(0) -#define cap_IBSS BIT(1) -#define cap_CFPollable BIT(2) -#define cap_CFRequest BIT(3) -#define cap_Privacy BIT(4) -#define cap_ShortPremble BIT(5) -#define cap_PBCC BIT(6) -#define cap_ChAgility BIT(7) -#define cap_SpecMgmt BIT(8) -#define cap_QoSi BIT(9) -#define cap_ShortSlot BIT(10) - /*----------------------------------------------------------------------------- Below is the definition for 802.11i / 802.1x ------------------------------------------------------------------------------*/ -- 2.26.2 From insafonov at gmail.com Sun Mar 14 09:02:44 2021 From: insafonov at gmail.com (Ivan Safonov) Date: Sun, 14 Mar 2021 12:02:44 +0300 Subject: [PATCH 1/4] staging:r8188eu: replace get_(d|s)a with ieee80211_get_(D|S)A In-Reply-To: <20210314090247.21181-1-insafonov@gmail.com> References: <20210314090247.21181-1-insafonov@gmail.com> Message-ID: <20210314090247.21181-2-insafonov@gmail.com> get_da()/get_sa() duplicate native ieee80211_get_(D|S)A functions. Remove get_(d|s)a, use ieee80211_get_(D|S)A instead. Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 6 +-- drivers/staging/rtl8188eu/core/rtw_recv.c | 4 +- .../staging/rtl8188eu/hal/rtl8188e_rxdesc.c | 4 +- drivers/staging/rtl8188eu/include/wifi.h | 44 ------------------- 4 files changed, 7 insertions(+), 51 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index ebd9b96a8211..bee19d5b22c0 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -2526,7 +2526,7 @@ static unsigned int OnProbeReq(struct adapter *padapter, if (check_fwstate(pmlmepriv, _FW_LINKED) && pmlmepriv->cur_network.join_res) - issue_probersp(padapter, get_sa(pframe)); + issue_probersp(padapter, ieee80211_get_SA((struct ieee80211_hdr *)pframe)); } return _SUCCESS; } @@ -2819,7 +2819,7 @@ static unsigned int OnAuthClient(struct adapter *padapter, DBG_88E("%s\n", __func__); /* check A1 matches or not */ - if (memcmp(myid(&padapter->eeprompriv), get_da(pframe), ETH_ALEN)) + if (memcmp(myid(&padapter->eeprompriv), ieee80211_get_DA((struct ieee80211_hdr *)pframe), ETH_ALEN)) return _SUCCESS; if (!(pmlmeinfo->state & WIFI_FW_AUTH_STATE)) @@ -3332,7 +3332,7 @@ static unsigned int OnAssocRsp(struct adapter *padapter, DBG_88E("%s\n", __func__); /* check A1 matches or not */ - if (memcmp(myid(&padapter->eeprompriv), get_da(pframe), ETH_ALEN)) + if (memcmp(myid(&padapter->eeprompriv), ieee80211_get_DA((struct ieee80211_hdr *)pframe), ETH_ALEN)) return _SUCCESS; if (!(pmlmeinfo->state & (WIFI_FW_AUTH_SUCCESS | WIFI_FW_ASSOC_STATE))) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 36bcbe635cf4..b9b4bc435037 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -1029,8 +1029,8 @@ static int validate_recv_data_frame(struct adapter *adapter, int ret = _SUCCESS; bretry = GetRetry(ptr); - pda = get_da(ptr); - psa = get_sa(ptr); + pda = ieee80211_get_DA((struct ieee80211_hdr *)ptr); + psa = ieee80211_get_SA((struct ieee80211_hdr *)ptr); pbssid = get_hdr_bssid(ptr); if (!pbssid) { diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c index 0d06cb54b1ad..4fae75fc3dd5 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c @@ -150,7 +150,7 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, get_bssid(&padapter->mlmepriv), ETH_ALEN)); pkt_info.bPacketToSelf = pkt_info.bPacketMatchBSSID && - (!memcmp(get_da(wlanhdr), + (!memcmp(ieee80211_get_DA((struct ieee80211_hdr *)wlanhdr), myid(&padapter->eeprompriv), ETH_ALEN)); pkt_info.bPacketBeacon = pkt_info.bPacketMatchBSSID && @@ -161,7 +161,7 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, sa = padapter->mlmepriv.cur_network.network.MacAddress; /* to do Ad-hoc */ } else { - sa = get_sa(wlanhdr); + sa = ieee80211_get_SA((struct ieee80211_hdr *)wlanhdr); } pstapriv = &padapter->stapriv; diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h index 1b9006879a11..5ee4d02e293c 100644 --- a/drivers/staging/rtl8188eu/include/wifi.h +++ b/drivers/staging/rtl8188eu/include/wifi.h @@ -201,50 +201,6 @@ enum WIFI_REG_DOMAIN { #define GetAddr4Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 24)) -static inline unsigned char *get_da(unsigned char *pframe) -{ - unsigned char *da; - unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe); - - switch (to_fr_ds) { - case 0x00: /* ToDs=0, FromDs=0 */ - da = GetAddr1Ptr(pframe); - break; - case 0x01: /* ToDs=0, FromDs=1 */ - da = GetAddr1Ptr(pframe); - break; - case 0x02: /* ToDs=1, FromDs=0 */ - da = GetAddr3Ptr(pframe); - break; - default: /* ToDs=1, FromDs=1 */ - da = GetAddr3Ptr(pframe); - break; - } - return da; -} - -static inline unsigned char *get_sa(unsigned char *pframe) -{ - unsigned char *sa; - unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe); - - switch (to_fr_ds) { - case 0x00: /* ToDs=0, FromDs=0 */ - sa = GetAddr2Ptr(pframe); - break; - case 0x01: /* ToDs=0, FromDs=1 */ - sa = GetAddr3Ptr(pframe); - break; - case 0x02: /* ToDs=1, FromDs=0 */ - sa = GetAddr2Ptr(pframe); - break; - default: /* ToDs=1, FromDs=1 */ - sa = GetAddr4Ptr(pframe); - break; - } - return sa; -} - static inline unsigned char *get_hdr_bssid(unsigned char *pframe) { unsigned char *sa; -- 2.26.2 From 42.hyeyoo at gmail.com Sun Mar 14 12:08:58 2021 From: 42.hyeyoo at gmail.com (HyeonggonYoo) Date: Sun, 14 Mar 2021 12:08:58 +0000 Subject: [PATCH] Staging: rtl8723bs: fixed a brace coding style Message-ID: <20210314120858.37951-1-42.hyeyoo@gmail.com> Fixed a coding style issue - unnecessary braces for single statement Signed-off-by: Hyeonggon Yoo <42.hyeyoo at gmail.com> --- drivers/staging/rtl8723bs/core/rtw_cmd.c | 25 ++++++++++-------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c index 3fe79169a811..974657b18678 100644 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@ -676,11 +676,10 @@ u8 rtw_createbss_cmd(struct adapter *padapter) struct wlan_bssid_ex *pdev_network = &padapter->registrypriv.dev_network; u8 res = _SUCCESS; - if (pmlmepriv->assoc_ssid.SsidLength == 0) { + if (pmlmepriv->assoc_ssid.SsidLength == 0) RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for Any SSid:%s\n", pmlmepriv->assoc_ssid.Ssid)); - } else { + else RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for SSid:%s\n", pmlmepriv->assoc_ssid.Ssid)); - } pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); if (pcmd == NULL) { @@ -767,11 +766,10 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) u32 tmp_len; u8 *ptmp = NULL; - if (pmlmepriv->assoc_ssid.SsidLength == 0) { + if (pmlmepriv->assoc_ssid.SsidLength == 0) RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("+Join cmd: Any SSid\n")); - } else { + else RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid =[%s]\n", pmlmepriv->assoc_ssid.Ssid)); - } pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); if (pcmd == NULL) { @@ -810,11 +808,10 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) psecuritypriv->authenticator_ie[0] = (unsigned char)psecnetwork->IELength; - if ((psecnetwork->IELength-12) < (256-1)) { + if ((psecnetwork->IELength-12) < (256-1)) memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], psecnetwork->IELength-12); - } else { + else memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], (256-1)); - } psecnetwork->IELength = 0; /* Added by Albert 2009/02/18 */ @@ -970,17 +967,15 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_ memcpy(psetstakey_para->addr, sta->hwaddr, ETH_ALEN); - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) psetstakey_para->algorithm = (unsigned char) psecuritypriv->dot11PrivacyAlgrthm; - } else { + else GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, false); - } - if (unicast_key == true) { + if (unicast_key == true) memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16); - } else { + else memcpy(&psetstakey_para->key, &psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, 16); - } /* jeff: set this because at least sw key is ready */ padapter->securitypriv.busetkipkey = true; -- 2.25.1 From gregkh at linuxfoundation.org Sun Mar 14 15:57:38 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Sun, 14 Mar 2021 16:57:38 +0100 Subject: [PATCH v2 0/4] staging: rtl8723bs: remove unused code blocks In-Reply-To: References: Message-ID: On Fri, Mar 12, 2021 at 07:33:13PM +0100, Fabio Aiuto wrote: > This patch set removes unused code blocks as required in TODO file: > > find and remove code blocks guarded by never set CONFIG_FOO defines > > Changes in v2: > - modified sunject lines to make them unique > - added a patch previously excluded (removal of > CONFIG_PNO_SET_DEBUG code) > > Fabio Aiuto (4): > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_PNO_SET_DEBUG > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_PNO_SUPPORT > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_WOWLAN > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_TCP_CSUM_OFFLOAD_RX The first 2 patches here worked, the others did not apply to my tree due to other changes from other developers. Can you please rebase them and resend? thanks, greg k-h From gregkh at linuxfoundation.org Sun Mar 14 15:57:59 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Sun, 14 Mar 2021 16:57:59 +0100 Subject: [PATCH] staging:rtl8723bs:core:rtw_wlan_util:fixed indentation coding style issue In-Reply-To: <20210313171453.GA2640@shreya-VirtualBox> References: <20210313171453.GA2640@shreya-VirtualBox> Message-ID: On Sat, Mar 13, 2021 at 10:44:53PM +0530, Shreya wrote: > Fixed the indentation of the else part of the conditional statement. > > Signed-off-by: Shreya Ajith This name does not match your "From:" email name :( Please fix up and resend. thanks, greg k-h From gregkh at linuxfoundation.org Sun Mar 14 15:58:54 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Sun, 14 Mar 2021 16:58:54 +0100 Subject: [PATCH] staging: vt6655: Fix camelcase In-Reply-To: <20210313183019.368317-1-madhumithabiw@gmail.com> References: <20210313183019.368317-1-madhumithabiw@gmail.com> Message-ID: On Sat, Mar 13, 2021 at 12:30:19PM -0600, Madhumitha Prabakaran wrote: > Fix checkpatch.pl - Avoid CamelCase: > > Signed-off-by: Madhumitha Prabakaran > --- > drivers/staging/vt6655/baseband.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c > index 1aa675241599..d89163299172 100644 > --- a/drivers/staging/vt6655/baseband.c > +++ b/drivers/staging/vt6655/baseband.c > @@ -52,7 +52,7 @@ > /*--------------------- Static Variables --------------------------*/ > > #define CB_VT3253_INIT_FOR_RFMD 446 > -static const unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = { > +static const unsigned char by_vt3253_init_tab_rfmd[CB_VT3253_INIT_FOR_RFMD][2] = { > {0x00, 0x30}, > {0x01, 0x00}, > {0x02, 0x00}, > @@ -2002,8 +2002,8 @@ bool bb_vt3253_init(struct vnt_private *priv) > if (by_local_id <= REV_ID_VT3253_A1) { > for (ii = 0; ii < CB_VT3253_INIT_FOR_RFMD; ii++) > result &= bb_write_embedded(priv, > - byVT3253InitTab_RFMD[ii][0], > - byVT3253InitTab_RFMD[ii][1]); > + by_vt3253_init_tab_rfmd[ii][0], > + by_vt3253_init_tab_rfmd[ii][1]); > > } else { > for (ii = 0; ii < CB_VT3253B0_INIT_FOR_RFMD; ii++) > -- > 2.25.1 Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - You did not specify a description of why the patch is needed, or possibly, any description at all, in the email body. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what is needed in order to properly describe the change. - You did not write a descriptive Subject: for the patch, allowing Greg, and everyone else, to know what this patch is all about. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what a proper Subject: line should look like. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot From shreya.ajithchb at gmail.com Sun Mar 14 16:28:55 2021 From: shreya.ajithchb at gmail.com (Shreya) Date: Sun, 14 Mar 2021 21:58:55 +0530 Subject: [PATCH v2] staging:rtl8723bs:core:rtw_wlan_util:fixed indentation coding style issue Message-ID: <20210314162855.GA2002@shreya-VirtualBox> Fixed the indentation of the else part of the conditional statement. Signed-off-by: Shreya --- v1 -> v2: Changed name in signed-off-by to match name in From drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index 975f2830e29e..4b5afaeac916 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -1760,7 +1760,7 @@ void update_wireless_mode(struct adapter *padapter) if (pmlmeext->cur_wireless_mode & WIRELESS_11B) update_mgnt_tx_rate(padapter, IEEE80211_CCK_RATE_1MB); - else + else update_mgnt_tx_rate(padapter, IEEE80211_OFDM_RATE_6MB); } -- 2.25.1 From fabioaiuto83 at gmail.com Sun Mar 14 18:12:06 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Sun, 14 Mar 2021 19:12:06 +0100 Subject: [PATCH v3 0/2] staging: rtl8723bs: remove unused code blocks Message-ID: This patch set removes unused code clocks as required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Changes in v3: - rebase of remaining conflicting patches Changes in v2: - modified subject lines to make them unique - added a patch previously excluded (removal of CONFIG_PNO_SET_DEBUG code) Fabio Aiuto (2): staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_PNO_SUPPORT staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_WOWLAN drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 - drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 24 +- .../staging/rtl8723bs/core/rtw_wlan_util.c | 61 +- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 825 +----------------- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 43 +- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 248 +----- drivers/staging/rtl8723bs/hal/sdio_ops.c | 4 +- drivers/staging/rtl8723bs/include/autoconf.h | 3 - drivers/staging/rtl8723bs/include/drv_types.h | 5 - .../rtl8723bs/include/drv_types_sdio.h | 2 +- .../staging/rtl8723bs/include/hal_com_h2c.h | 88 +- drivers/staging/rtl8723bs/include/hal_intf.h | 5 - .../staging/rtl8723bs/include/rtl8723b_cmd.h | 4 +- .../staging/rtl8723bs/include/rtl8723b_hal.h | 17 - .../staging/rtl8723bs/include/rtl8723b_spec.h | 10 - drivers/staging/rtl8723bs/include/rtw_mp.h | 3 - .../staging/rtl8723bs/include/rtw_pwrctrl.h | 62 -- .../staging/rtl8723bs/include/rtw_security.h | 3 - drivers/staging/rtl8723bs/include/sdio_ops.h | 8 +- drivers/staging/rtl8723bs/include/sta_info.h | 5 - .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 56 -- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 3 - drivers/staging/rtl8723bs/os_dep/os_intfs.c | 238 +---- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 5 - 24 files changed, 29 insertions(+), 1696 deletions(-) -- 2.20.1 From fabioaiuto83 at gmail.com Sun Mar 14 18:12:23 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Sun, 14 Mar 2021 19:12:23 +0100 Subject: [PATCH v3 1/2] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_PNO_SUPPORT In-Reply-To: References: Message-ID: Remove conditional code blocks checked by unused CONFIG_PNO_SUPPORT Cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 18 -- .../staging/rtl8723bs/core/rtw_wlan_util.c | 8 - drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 269 ------------------ drivers/staging/rtl8723bs/hal/sdio_halinit.c | 8 - .../staging/rtl8723bs/include/hal_com_h2c.h | 17 -- .../staging/rtl8723bs/include/rtl8723b_hal.h | 10 - .../staging/rtl8723bs/include/rtw_pwrctrl.h | 53 ---- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 56 ---- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 7 - 9 files changed, 446 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index c9f4a18b24b9..8059aeea9d47 100644 --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c @@ -1149,29 +1149,11 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter) pwrctrlpriv->wowlan_mode = false; pwrctrlpriv->wowlan_ap_mode = false; - -#ifdef CONFIG_PNO_SUPPORT - pwrctrlpriv->pno_inited = false; - pwrctrlpriv->pnlo_info = NULL; - pwrctrlpriv->pscan_info = NULL; - pwrctrlpriv->pno_ssid_list = NULL; - pwrctrlpriv->pno_in_resume = true; -#endif } void rtw_free_pwrctrl_priv(struct adapter *adapter) { -#ifdef CONFIG_PNO_SUPPORT - if (pwrctrlpriv->pnlo_info) - printk("****** pnlo_info memory leak********\n"); - - if (pwrctrlpriv->pscan_info) - printk("****** pscan_info memory leak********\n"); - - if (pwrctrlpriv->pno_ssid_list) - printk("****** pno_ssid_list memory leak********\n"); -#endif } inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms) diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index 96feced698ac..ae577178534f 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -2189,11 +2189,3 @@ void rtw_set_sec_pn(struct adapter *padapter) } #endif /* CONFIG_WOWLAN */ -#ifdef CONFIG_PNO_SUPPORT -#define CSCAN_TLV_TYPE_SSID_IE 'S' -#define CIPHER_IE "key_mgmt =" -#define CIPHER_NONE "NONE" -#define CIPHER_WPA_PSK "WPA-PSK" -#define CIPHER_WPA_EAP "WPA-EAP IEEE8021X" - -#endif /* CONFIG_PNO_SUPPORT */ diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index d246ba2117b5..59d42bd4f032 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -462,125 +462,6 @@ static void ConstructARPResponse( } } -#ifdef CONFIG_PNO_SUPPORT -static void ConstructPnoInfo( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - - struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); - - u8 *pPnoInfoPkt = pframe; - pPnoInfoPkt = (u8 *)(pframe + *pLength); - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_num, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->fast_scan_period, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->fast_scan_iterations, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->slow_scan_period, 4); - - *pLength += 4; - pPnoInfoPkt += 4; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_length, - MAX_PNO_LIST_COUNT); - - *pLength += MAX_PNO_LIST_COUNT; - pPnoInfoPkt += MAX_PNO_LIST_COUNT; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_cipher_info, - MAX_PNO_LIST_COUNT); - - *pLength += MAX_PNO_LIST_COUNT; - pPnoInfoPkt += MAX_PNO_LIST_COUNT; - memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_channel_info, - MAX_PNO_LIST_COUNT); - - *pLength += MAX_PNO_LIST_COUNT; - pPnoInfoPkt += MAX_PNO_LIST_COUNT; -} - -static void ConstructSSIDList( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - int i = 0; - u8 *pSSIDListPkt = pframe; - struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); - - pSSIDListPkt = (u8 *)(pframe + *pLength); - - for (i = 0; i < pwrctl->pnlo_info->ssid_num ; i++) { - memcpy(pSSIDListPkt, &pwrctl->pno_ssid_list->node[i].SSID, - pwrctl->pnlo_info->ssid_length[i]); - - *pLength += WLAN_SSID_MAXLEN; - pSSIDListPkt += WLAN_SSID_MAXLEN; - } -} - -static void ConstructScanInfo( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - int i = 0; - u8 *pScanInfoPkt = pframe; - struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); - - pScanInfoPkt = (u8 *)(pframe + *pLength); - - memcpy(pScanInfoPkt, &pwrctl->pscan_info->channel_num, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_ch, 1); - - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_bw, 1); - - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_40_offset, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_80_offset, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->periodScan, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->period_scan_time, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->enableRFE, 1); - - *pLength += 1; - pScanInfoPkt += 1; - memcpy(pScanInfoPkt, &pwrctl->pscan_info->rfe_type, 8); - - *pLength += 8; - pScanInfoPkt += 8; - - for (i = 0; i < MAX_SCAN_LIST_COUNT; i++) { - memcpy(pScanInfoPkt, &pwrctl->pscan_info->ssid_channel_info[i], 4); - *pLength += 4; - pScanInfoPkt += 4; - } -} -#endif - #ifdef CONFIG_GTK_OL static void ConstructGTKResponse( struct adapter *padapter, u8 *pframe, u32 *pLength @@ -666,48 +547,6 @@ static void ConstructGTKResponse( } #endif /* CONFIG_GTK_OL */ -#ifdef CONFIG_PNO_SUPPORT -static void ConstructProbeReq(struct adapter *padapter, u8 *pframe, u32 *pLength) -{ - struct ieee80211_hdr *pwlanhdr; - u16 *fctrl; - u32 pktlen; - unsigned char *mac; - unsigned char bssrate[NumRates]; - int bssrate_len = 0; - u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - pwlanhdr = (struct ieee80211_hdr *)pframe; - mac = myid(&(padapter->eeprompriv)); - - fctrl = &(pwlanhdr->frame_control); - *(fctrl) = 0; - - /* broadcast probe request frame */ - memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN); - memcpy(pwlanhdr->addr3, bc_addr, ETH_ALEN); - - memcpy(pwlanhdr->addr2, mac, ETH_ALEN); - - SetSeqNum(pwlanhdr, 0); - SetFrameSubType(pframe, WIFI_PROBEREQ); - - pktlen = sizeof(struct ieee80211_hdr_3addr); - pframe += pktlen; - - pframe = rtw_set_ie(pframe, WLAN_EID_SSID, 0, NULL, &pktlen); - - get_rate_set(padapter, bssrate, &bssrate_len); - - if (bssrate_len > 8) { - pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, 8, bssrate, &pktlen); - pframe = rtw_set_ie(pframe, WLAN_EID_EXT_SUPP_RATES, (bssrate_len - 8), (bssrate + 8), &pktlen); - } else - pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, bssrate_len, bssrate, &pktlen); - - *pLength = pktlen; -} -#endif /* CONFIG_PNO_SUPPORT */ #endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN @@ -875,15 +714,6 @@ static void rtl8723b_set_FwAoacRsvdPage_cmd(struct adapter *padapter, struct RSV RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CAoacRsvdPageParm:", u1H2CAoacRsvdPageParm, H2C_AOAC_RSVDPAGE_LOC_LEN); FillH2CCmd8723B(padapter, H2C_8723B_AOAC_RSVD_PAGE, H2C_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm); } else { -#ifdef CONFIG_PNO_SUPPORT - if (!pwrpriv->pno_in_resume) { - DBG_871X("NLO_INFO =%d\n", rsvdpageloc->LocPNOInfo); - memset(&u1H2CAoacRsvdPageParm, 0, sizeof(u1H2CAoacRsvdPageParm)); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_NLO_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocPNOInfo); - FillH2CCmd8723B(padapter, H2C_AOAC_RSVDPAGE3, H2C_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm); - msleep(10); - } -#endif } #endif /* CONFIG_WOWLAN */ @@ -1183,11 +1013,6 @@ static void rtl8723b_set_FwWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) u8 gpio_high_active = 0; /* 0: low active, 1: high active */ u8 magic_pkt = 0; -#ifdef CONFIG_PNO_SUPPORT - if (!ppwrpriv->wowlan_pno_enable) - magic_pkt = 1; -#endif - if (psecpriv->dot11PrivacyAlgrthm == _WEP40_ || psecpriv->dot11PrivacyAlgrthm == _WEP104_) hw_unicast = 1; @@ -1240,28 +1065,9 @@ static void rtl8723b_set_FwRemoteWakeCtrl_Cmd(struct adapter *padapter, u8 benab else SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_ACTION(u1H2CRemoteWakeCtrlParm, 1); } -#ifdef CONFIG_PNO_SUPPORT - else { - SET_H2CCMD_REMOTE_WAKECTRL_ENABLE(u1H2CRemoteWakeCtrlParm, benable); - SET_H2CCMD_REMOTE_WAKE_CTRL_NLO_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, benable); - } -#endif RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CRemoteWakeCtrlParm:", u1H2CRemoteWakeCtrlParm, H2C_REMOTE_WAKE_CTRL_LEN); FillH2CCmd8723B(padapter, H2C_8723B_REMOTE_WAKE_CTRL, H2C_REMOTE_WAKE_CTRL_LEN, u1H2CRemoteWakeCtrlParm); -#ifdef CONFIG_PNO_SUPPORT - if (ppwrpriv->wowlan_pno_enable && !ppwrpriv->pno_in_resume) { - res = rtw_read8(padapter, REG_PNO_STATUS); - DBG_871X("cmd: 0x81 REG_PNO_STATUS: 0x%02x\n", res); - while (!(res&BIT(7)) && count < 25) { - DBG_871X("[%d] cmd: 0x81 REG_PNO_STATUS: 0x%02x\n", count, res); - res = rtw_read8(padapter, REG_PNO_STATUS); - count++; - msleep(2); - } - DBG_871X("cmd: 0x81 REG_PNO_STATUS: 0x%02x\n", res); - } -#endif /* CONFIG_PNO_SUPPORT */ } static void rtl8723b_set_FwAOACGlobalInfo_Cmd(struct adapter *padapter, u8 group_alg, u8 pairwise_alg) @@ -1278,26 +1084,6 @@ static void rtl8723b_set_FwAOACGlobalInfo_Cmd(struct adapter *padapter, u8 grou FillH2CCmd8723B(padapter, H2C_8723B_AOAC_GLOBAL_INFO, H2C_AOAC_GLOBAL_INFO_LEN, u1H2CAOACGlobalInfoParm); } -#ifdef CONFIG_PNO_SUPPORT -static void rtl8723b_set_FwScanOffloadInfo_cmd(struct adapter *padapter, struct RSVDPAGE_LOC *rsvdpageloc, u8 enable) -{ - u8 u1H2CScanOffloadInfoParm[H2C_SCAN_OFFLOAD_CTRL_LEN] = {0}; - - DBG_871X("%s: loc_probe_packet:%d, loc_scan_info: %d loc_ssid_info:%d\n", - __func__, rsvdpageloc->LocProbePacket, rsvdpageloc->LocScanInfo, rsvdpageloc->LocSSIDInfo); - - SET_H2CCMD_AOAC_NLO_FUN_EN(u1H2CScanOffloadInfoParm, enable); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_SCAN_INFO(u1H2CScanOffloadInfoParm, rsvdpageloc->LocScanInfo); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_PROBE_PACKET(u1H2CScanOffloadInfoParm, rsvdpageloc->LocProbePacket); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_SSID_INFO(u1H2CScanOffloadInfoParm, rsvdpageloc->LocSSIDInfo); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CScanOffloadInfoParm:", u1H2CScanOffloadInfoParm, H2C_SCAN_OFFLOAD_CTRL_LEN); - FillH2CCmd8723B(padapter, H2C_8723B_D0_SCAN_OFFLOAD_INFO, H2C_SCAN_OFFLOAD_CTRL_LEN, u1H2CScanOffloadInfoParm); - - msleep(20); -} -#endif /* CONFIG_PNO_SUPPORT */ - void rtl8723b_set_wowlan_cmd(struct adapter *padapter, u8 enable) { struct security_priv *psecpriv = &padapter->securitypriv; @@ -1656,55 +1442,8 @@ static void rtl8723b_set_FwRsvdPagePkt( } else #endif /* CONFIG_WOWLAN */ { -#ifdef CONFIG_PNO_SUPPORT - if (!pwrctl->pno_in_resume && pwrctl->pno_inited) { - /* Probe Request */ - RsvdPageLoc.LocProbePacket = TotalPageNum; - ConstructProbeReq( - padapter, - &ReservedPagePacket[BufIndex], - &ProbeReqLength); - - rtl8723b_fill_fake_txdesc(padapter, - &ReservedPagePacket[BufIndex-TxDescLen], - ProbeReqLength, false, false, false); - CurtPktPageNum = - (u8)PageNum_128(TxDescLen + ProbeReqLength); - - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* PNO INFO Page */ - RsvdPageLoc.LocPNOInfo = TotalPageNum; - ConstructPnoInfo(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &PNOLength); - - CurtPktPageNum = (u8)PageNum_128(PNOLength); - TotalPageNum += CurtPktPageNum; - BufIndex += (CurtPktPageNum*PageSize); - - /* SSID List Page */ - RsvdPageLoc.LocSSIDInfo = TotalPageNum; - ConstructSSIDList(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &SSIDLegnth); - CurtPktPageNum = (u8)PageNum_128(SSIDLegnth); - TotalPageNum += CurtPktPageNum; - BufIndex += (CurtPktPageNum*PageSize); - - /* Scan Info Page */ - RsvdPageLoc.LocScanInfo = TotalPageNum; - ConstructScanInfo(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &ScanInfoLength); - CurtPktPageNum = (u8)PageNum_128(ScanInfoLength); - TotalPageNum += CurtPktPageNum; - BufIndex += (CurtPktPageNum*PageSize); - - TotalPacketLen = BufIndex + ScanInfoLength; - } else { TotalPacketLen = BufIndex + BTQosNullLength; } -#else /* CONFIG_PNO_SUPPORT */ - TotalPacketLen = BufIndex + BTQosNullLength; -#endif - } if (TotalPacketLen > MaxRsvdPageBufSize) { DBG_871X("%s(): ERROR: The rsvd page size is not enough!!TotalPacketLen %d, MaxRsvdPageBufSize %d\n", __func__, @@ -1725,14 +1464,6 @@ static void rtl8723b_set_FwRsvdPagePkt( rtl8723b_set_FwAoacRsvdPage_cmd(padapter, &RsvdPageLoc); } else { rtl8723b_set_FwAoacRsvdPage_cmd(padapter, &RsvdPageLoc); -#ifdef CONFIG_PNO_SUPPORT - if (pwrctl->pno_in_resume) - rtl8723b_set_FwScanOffloadInfo_cmd(padapter, - &RsvdPageLoc, 0); - else - rtl8723b_set_FwScanOffloadInfo_cmd(padapter, - &RsvdPageLoc, 1); -#endif } return; diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index 3266839031f8..ced05bbfc906 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -1555,14 +1555,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) if (psta) rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); } -#ifdef CONFIG_PNO_SUPPORT - rtw_write8(padapter, 0x1b8, 0); - DBG_871X("reset 0x1b8: %d\n", rtw_read8(padapter, 0x1b8)); - rtw_write8(padapter, 0x1b9, 0); - DBG_871X("reset 0x1b9: %d\n", rtw_read8(padapter, 0x1b9)); - rtw_write8(padapter, REG_PNO_STATUS, 0); - DBG_871X("reset REG_PNO_STATUS: %d\n", rtw_read8(padapter, REG_PNO_STATUS)); -#endif break; default: diff --git a/drivers/staging/rtl8723bs/include/hal_com_h2c.h b/drivers/staging/rtl8723bs/include/hal_com_h2c.h index 8970c59388bb..a6e49c5494e6 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_h2c.h +++ b/drivers/staging/rtl8723bs/include/hal_com_h2c.h @@ -233,17 +233,6 @@ enum h2c_cmd { #ifdef CONFIG_GTK_OL #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+5, 0, 8, __Value) #endif /* CONFIG_GTK_OL */ -#ifdef CONFIG_PNO_SUPPORT -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_NLO_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd), 0, 8, __Value) -#endif - -#ifdef CONFIG_PNO_SUPPORT -/* D0_Scan_Offload_Info_0x86 */ -#define SET_H2CCMD_AOAC_NLO_FUN_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd), 3, 1, __Value) -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_PROBE_PACKET(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+1, 0, 8, __Value) -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_SCAN_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+2, 0, 8, __Value) -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_SSID_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+3, 0, 8, __Value) -#endif /* CONFIG_PNO_SUPPORT */ /* */ /* Structure -------------------------------------------------- */ @@ -265,12 +254,6 @@ struct RSVDPAGE_LOC { #ifdef CONFIG_GTK_OL u8 LocGTKEXTMEM; #endif /* CONFIG_GTK_OL */ -#ifdef CONFIG_PNO_SUPPORT - u8 LocPNOInfo; - u8 LocScanInfo; - u8 LocSSIDInfo; - u8 LocProbePacket; -#endif /* CONFIG_PNO_SUPPORT */ #endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN u8 LocApOffloadBCN; diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index 8b214a6e3077..5f2784c7cc16 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -92,11 +92,6 @@ struct rt_firmware_hdr { #define BCNQ_PAGE_NUM_8723B 0x08 #define BCNQ1_PAGE_NUM_8723B 0x00 -#ifdef CONFIG_PNO_SUPPORT -#undef BCNQ1_PAGE_NUM_8723B -#define BCNQ1_PAGE_NUM_8723B 0x00 /* 0x04 */ -#endif - #define MAX_RX_DMA_BUFFER_SIZE_8723B 0x2800 /* RX 10K */ /* For WoWLan, more reserved page */ @@ -107,11 +102,6 @@ struct rt_firmware_hdr { #define WOWLAN_PAGE_NUM_8723B 0x00 #endif -#ifdef CONFIG_PNO_SUPPORT -#undef WOWLAN_PAGE_NUM_8723B -#define WOWLAN_PAGE_NUM_8723B 0x0d -#endif - #ifdef CONFIG_AP_WOWLAN #define AP_WOWLAN_PAGE_NUM_8723B 0x02 #endif diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h index b1ef4e0ba9fe..20eafa1eeafa 100644 --- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h @@ -46,11 +46,6 @@ enum Power_Mgnt { PS_MODE_NUM, }; -#ifdef CONFIG_PNO_SUPPORT -#define MAX_PNO_LIST_COUNT 16 -#define MAX_SCAN_LIST_COUNT 14 /* 2.4G only */ -#endif - /* BIT[2:0] = HW state BIT[3] = Protocol PS state, 0: register active state , 1: register sleep state @@ -158,47 +153,6 @@ enum PS_DENY_REASON { PS_DENY_OTHERS = 31 }; -#ifdef CONFIG_PNO_SUPPORT -struct pno_nlo_info { - u32 fast_scan_period; /* Fast scan period */ - u32 ssid_num; /* number of entry */ - u32 slow_scan_period; /* slow scan period */ - u32 fast_scan_iterations; /* Fast scan iterations */ - u8 ssid_length[MAX_PNO_LIST_COUNT]; /* SSID Length Array */ - u8 ssid_cipher_info[MAX_PNO_LIST_COUNT]; /* Cipher information for security */ - u8 ssid_channel_info[MAX_PNO_LIST_COUNT]; /* channel information */ -}; - -struct pno_ssid { - u32 SSID_len; - u8 SSID[32]; -}; - -struct pno_ssid_list { - struct pno_ssid node[MAX_PNO_LIST_COUNT]; -}; - -struct pno_scan_channel_info { - u8 channel; - u8 tx_power; - u8 timeout; - u8 active; /* set 1 means active scan, or pasivite scan. */ -}; - -struct pno_scan_info { - u8 enableRFE; /* Enable RFE */ - u8 period_scan_time; /* exclusive with fast_scan_period and slow_scan_period */ - u8 periodScan; /* exclusive with fast_scan_period and slow_scan_period */ - u8 orig_80_offset; /* original channel 80 offset */ - u8 orig_40_offset; /* original channel 40 offset */ - u8 orig_bw; /* original bandwidth */ - u8 orig_ch; /* original channel */ - u8 channel_num; /* number of channel */ - u64 rfe_type; /* rfe_type && 0x00000000000000ff */ - struct pno_scan_channel_info ssid_channel_info[MAX_SCAN_LIST_COUNT]; -}; -#endif /* CONFIG_PNO_SUPPORT */ - struct pwrctrl_priv { struct mutex lock; volatile u8 rpwm; /* requested power state for fw */ @@ -272,13 +226,6 @@ struct pwrctrl_priv { u8 wowlan_unicast; u8 wowlan_pattern_idx; u8 wowlan_pno_enable; -#ifdef CONFIG_PNO_SUPPORT - u8 pno_in_resume; - u8 pno_inited; - struct pno_nlo_info *pnlo_info; - struct pno_scan_info *pscan_info; - struct pno_ssid_list *pno_ssid_list; -#endif u32 wowlan_pattern_context[8][5]; u64 wowlan_fw_iv; #endif /* CONFIG_WOWLAN */ diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index f0e38303022d..2ff71d001c07 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -3095,54 +3095,6 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, return ret; } -#if defined(CONFIG_PNO_SUPPORT) -static int cfg80211_rtw_sched_scan_start(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_sched_scan_request *request) -{ - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - int ret; - - if (padapter->bup == false) { - DBG_871X("%s: net device is down.\n", __func__); - return -EIO; - } - - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true || - check_fwstate(pmlmepriv, _FW_LINKED) == true || - check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) { - DBG_871X("%s: device is busy.\n", __func__); - rtw_scan_abort(padapter); - } - - if (request == NULL) { - DBG_871X("%s: invalid cfg80211_requests parameters.\n", __func__); - return -EINVAL; - } - - ret = rtw_android_cfg80211_pno_setup(dev, request->ssids, - request->n_ssids, request->interval); - - if (ret < 0) { - DBG_871X("%s ret: %d\n", __func__, ret); - goto exit; - } - - ret = rtw_android_pno_enable(dev, true); - if (ret < 0) { - DBG_871X("%s ret: %d\n", __func__, ret); - goto exit; - } -exit: - return ret; -} - -static int cfg80211_rtw_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev) -{ - return rtw_android_pno_enable(dev, false); -} -#endif /* CONFIG_PNO_SUPPORT */ - static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum nl80211_band band, u8 rf_type) { @@ -3248,9 +3200,6 @@ static void rtw_cfg80211_preinit_wiphy(struct adapter *padapter, struct wiphy *w #if defined(CONFIG_PM) wiphy->max_sched_scan_reqs = 1; -#ifdef CONFIG_PNO_SUPPORT - wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT; -#endif #endif #if defined(CONFIG_PM) @@ -3297,11 +3246,6 @@ static struct cfg80211_ops rtw_cfg80211_ops = { .change_bss = cfg80211_rtw_change_bss, .mgmt_tx = cfg80211_rtw_mgmt_tx, - -#if defined(CONFIG_PNO_SUPPORT) - .sched_scan_start = cfg80211_rtw_sched_scan_start, - .sched_scan_stop = cfg80211_rtw_sched_scan_stop, -#endif /* CONFIG_PNO_SUPPORT */ }; int rtw_wdev_alloc(struct adapter *padapter, struct device *dev) diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index 4ece23737712..b6977f6ece85 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -1505,10 +1505,6 @@ int rtw_resume_process_wow(struct adapter *padapter) goto exit; } -#ifdef CONFIG_PNO_SUPPORT - pwrpriv->pno_in_resume = true; -#endif - if (pwrpriv->wowlan_mode) { rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN"); @@ -1780,9 +1776,6 @@ int rtw_resume_common(struct adapter *padapter) if (pwrpriv) { pwrpriv->bInSuspend = false; - #ifdef CONFIG_PNO_SUPPORT - pwrpriv->pno_in_resume = false; - #endif } DBG_871X_LEVEL(_drv_always_, "%s:%d in %d ms\n", __func__, ret, jiffies_to_msecs(jiffies - start_time)); -- 2.20.1 From fabioaiuto83 at gmail.com Sun Mar 14 18:12:40 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Sun, 14 Mar 2021 19:12:40 +0100 Subject: [PATCH v3 2/2] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_WOWLAN In-Reply-To: References: Message-ID: <1d4e09852ff08e7121e9dd6d2d55d819d53ed702.1615744948.git.fabioaiuto83@gmail.com> remove conditional code blocks checked by unused CONFIG_WOWLAN cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 - drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 6 +- .../staging/rtl8723bs/core/rtw_wlan_util.c | 53 +- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 556 +----------------- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 43 +- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 240 +------- drivers/staging/rtl8723bs/hal/sdio_ops.c | 4 +- drivers/staging/rtl8723bs/include/autoconf.h | 3 - drivers/staging/rtl8723bs/include/drv_types.h | 5 - .../rtl8723bs/include/drv_types_sdio.h | 2 +- .../staging/rtl8723bs/include/hal_com_h2c.h | 71 +-- drivers/staging/rtl8723bs/include/hal_intf.h | 5 - .../staging/rtl8723bs/include/rtl8723b_cmd.h | 4 +- .../staging/rtl8723bs/include/rtl8723b_hal.h | 7 - .../staging/rtl8723bs/include/rtl8723b_spec.h | 10 - drivers/staging/rtl8723bs/include/rtw_mp.h | 3 - .../staging/rtl8723bs/include/rtw_pwrctrl.h | 9 - .../staging/rtl8723bs/include/rtw_security.h | 3 - drivers/staging/rtl8723bs/include/sdio_ops.h | 8 +- drivers/staging/rtl8723bs/include/sta_info.h | 5 - .../staging/rtl8723bs/os_dep/ioctl_linux.c | 3 - drivers/staging/rtl8723bs/os_dep/os_intfs.c | 231 +------- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 5 - 23 files changed, 29 insertions(+), 1250 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index 57370091dc9f..723187a78484 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -2098,9 +2098,6 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) if (!candidate) { DBG_871X("%s: return _FAIL(candidate == NULL)\n", __func__); -#ifdef CONFIG_WOWLAN - _clr_fwstate_(pmlmepriv, _FW_LINKED|_FW_UNDER_LINKING); -#endif ret = _FAIL; goto exit; } else { diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index 8059aeea9d47..2e6c522b74e3 100644 --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c @@ -350,7 +350,7 @@ static u8 PS_RDY_CHECK(struct adapter *padapter) struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN if (pwrpriv->bInSuspend && pwrpriv->wowlan_mode) return true; else if (pwrpriv->bInSuspend && pwrpriv->wowlan_ap_mode) @@ -391,7 +391,7 @@ static u8 PS_RDY_CHECK(struct adapter *padapter) void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode, const char *msg) { struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN struct debug_priv *pdbgpriv = &padapter->dvobj->drv_dbg; #endif @@ -422,7 +422,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a pwrpriv->pwr_mode = ps_mode; rtw_set_rpwm(padapter, PS_STATE_S4); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode) { unsigned long start_time; u32 delay_ms; diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index ae577178534f..355e43c4cf9a 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -10,7 +10,7 @@ #include #include -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN #include #endif @@ -2113,7 +2113,7 @@ int rtw_config_gpio(struct net_device *netdev, int gpio_num, bool isOutput) EXPORT_SYMBOL(rtw_config_gpio); #endif -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -2139,53 +2139,4 @@ void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip) } } #endif -#ifdef CONFIG_WOWLAN -void rtw_get_sec_iv(struct adapter *padapter, u8 *pcur_dot11txpn, u8 *StaAddr) -{ - struct sta_info *psta; - struct security_priv *psecpriv = &padapter->securitypriv; - - memset(pcur_dot11txpn, 0, 8); - if (!StaAddr) - return; - psta = rtw_get_stainfo(&padapter->stapriv, StaAddr); - DBG_871X("%s(): StaAddr: %02x %02x %02x %02x %02x %02x\n", - __func__, StaAddr[0], StaAddr[1], StaAddr[2], - StaAddr[3], StaAddr[4], StaAddr[5]); - - if (psta) { - if (psecpriv->dot11PrivacyAlgrthm != _NO_PRIVACY_ && psta->dot11txpn.val > 0) - psta->dot11txpn.val--; - AES_IV(pcur_dot11txpn, psta->dot11txpn, 0); - - DBG_871X("%s(): CurrentIV: %02x %02x %02x %02x %02x %02x %02x %02x\n" - , __func__, pcur_dot11txpn[0], pcur_dot11txpn[1], - pcur_dot11txpn[2], pcur_dot11txpn[3], pcur_dot11txpn[4], - pcur_dot11txpn[5], pcur_dot11txpn[6], pcur_dot11txpn[7]); - } -} - -void rtw_set_sec_pn(struct adapter *padapter) -{ - struct sta_info *psta; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct security_priv *psecpriv = &padapter->securitypriv; - - psta = rtw_get_stainfo(&padapter->stapriv, - get_my_bssid(&pmlmeinfo->network)); - - if (psta) { - if (pwrpriv->wowlan_fw_iv > psta->dot11txpn.val) { - if (psecpriv->dot11PrivacyAlgrthm != _NO_PRIVACY_) - psta->dot11txpn.val = pwrpriv->wowlan_fw_iv + 2; - } else { - DBG_871X("%s(): FW IV is smaller than driver\n", __func__); - psta->dot11txpn.val += 2; - } - DBG_871X("%s: dot11txpn: 0x%016llx\n", __func__, psta->dot11txpn.val); - } -} -#endif /* CONFIG_WOWLAN */ diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index 59d42bd4f032..61fd643c244f 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -31,10 +31,6 @@ static u8 _is_fw_read_cmd_down(struct adapter *padapter, u8 msgbox_num) if (0 == valid) { read_down = true; } -#ifdef CONFIG_WOWLAN - else - msleep(1); -#endif } while ((!read_down) && (retry_cnts--)); return read_down; @@ -316,239 +312,6 @@ static void ConstructNullFunctionData( *pLength = pktlen; } - -#ifdef CONFIG_WOWLAN -/* */ -/* Description: */ -/* Construct the ARP response packet to support ARP offload. */ -/* */ -static void ConstructARPResponse( - struct adapter *padapter, - u8 *pframe, - u32 *pLength, - u8 *pIPAddress -) -{ - struct ieee80211_hdr *pwlanhdr; - __le16 *fctrl; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct security_priv *psecuritypriv = &padapter->securitypriv; - static u8 ARPLLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06}; - u8 *pARPRspPkt = pframe; - /* for TKIP Cal MIC */ - u8 *payload = pframe; - u8 EncryptionHeadOverhead = 0; - /* DBG_871X("%s:%d\n", __func__, bForcePowerSave); */ - - pwlanhdr = (struct ieee80211_hdr *)pframe; - - fctrl = &pwlanhdr->frame_control; - *(fctrl) = 0; - - /* */ - /* MAC Header. */ - /* */ - SetFrameType(fctrl, WIFI_DATA); - /* SetFrameSubType(fctrl, 0); */ - SetToDs(fctrl); - memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - - SetSeqNum(pwlanhdr, 0); - SetDuration(pwlanhdr, 0); - /* SET_80211_HDR_FRAME_CONTROL(pARPRspPkt, 0); */ - /* SET_80211_HDR_TYPE_AND_SUBTYPE(pARPRspPkt, Type_Data); */ - /* SET_80211_HDR_TO_DS(pARPRspPkt, 1); */ - /* SET_80211_HDR_ADDRESS1(pARPRspPkt, pMgntInfo->Bssid); */ - /* SET_80211_HDR_ADDRESS2(pARPRspPkt, Adapter->CurrentAddress); */ - /* SET_80211_HDR_ADDRESS3(pARPRspPkt, pMgntInfo->Bssid); */ - - /* SET_80211_HDR_DURATION(pARPRspPkt, 0); */ - /* SET_80211_HDR_FRAGMENT_SEQUENCE(pARPRspPkt, 0); */ - *pLength = 24; - - /* */ - /* Security Header: leave space for it if necessary. */ - /* */ - - switch (psecuritypriv->dot11PrivacyAlgrthm) { - case _WEP40_: - case _WEP104_: - EncryptionHeadOverhead = 4; - break; - case _TKIP_: - EncryptionHeadOverhead = 8; - break; - case _AES_: - EncryptionHeadOverhead = 8; - break; - default: - EncryptionHeadOverhead = 0; - } - - if (EncryptionHeadOverhead > 0) { - memset(&(pframe[*pLength]), 0, EncryptionHeadOverhead); - *pLength += EncryptionHeadOverhead; - SetPrivacy(fctrl); - } - - /* */ - /* Frame Body. */ - /* */ - pARPRspPkt = (u8 *)(pframe + *pLength); - payload = pARPRspPkt; /* Get Payload pointer */ - /* LLC header */ - memcpy(pARPRspPkt, ARPLLCHeader, 8); - *pLength += 8; - - /* ARP element */ - pARPRspPkt += 8; - SET_ARP_PKT_HW(pARPRspPkt, 0x0100); - SET_ARP_PKT_PROTOCOL(pARPRspPkt, 0x0008); /* IP protocol */ - SET_ARP_PKT_HW_ADDR_LEN(pARPRspPkt, 6); - SET_ARP_PKT_PROTOCOL_ADDR_LEN(pARPRspPkt, 4); - SET_ARP_PKT_OPERATION(pARPRspPkt, 0x0200); /* ARP response */ - SET_ARP_PKT_SENDER_MAC_ADDR(pARPRspPkt, myid(&(padapter->eeprompriv))); - SET_ARP_PKT_SENDER_IP_ADDR(pARPRspPkt, pIPAddress); - { - SET_ARP_PKT_TARGET_MAC_ADDR(pARPRspPkt, get_my_bssid(&(pmlmeinfo->network))); - SET_ARP_PKT_TARGET_IP_ADDR(pARPRspPkt, pIPAddress); - DBG_871X("%s Target Mac Addr:%pM\n", __func__, MAC_ARG(get_my_bssid(&(pmlmeinfo->network)))); - DBG_871X("%s Target IP Addr:%pI4\n", __func__, IP_ARG(pIPAddress)); - } - - *pLength += 28; - - if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_) { - u8 mic[8]; - struct mic_data micdata; - struct sta_info *psta = NULL; - u8 priority[4] = { - 0x0, 0x0, 0x0, 0x0 - }; - u8 null_key[16] = { - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 - }; - - DBG_871X("%s(): Add MIC\n", __func__); - - psta = rtw_get_stainfo(&padapter->stapriv, get_my_bssid(&(pmlmeinfo->network))); - if (psta) { - if (!memcmp(&psta->dot11tkiptxmickey.skey[0], null_key, 16)) { - DBG_871X("%s(): STA dot11tkiptxmickey == 0\n", __func__); - } - /* start to calculate the mic code */ - rtw_secmicsetkey(&micdata, &psta->dot11tkiptxmickey.skey[0]); - } - - rtw_secmicappend(&micdata, pwlanhdr->addr3, 6); /* DA */ - - rtw_secmicappend(&micdata, pwlanhdr->addr2, 6); /* SA */ - - priority[0] = 0; - rtw_secmicappend(&micdata, &priority[0], 4); - - rtw_secmicappend(&micdata, payload, 36); /* payload length = 8 + 28 */ - - rtw_secgetmic(&micdata, &(mic[0])); - - pARPRspPkt += 28; - memcpy(pARPRspPkt, &(mic[0]), 8); - - *pLength += 8; - } -} - -#ifdef CONFIG_GTK_OL -static void ConstructGTKResponse( - struct adapter *padapter, u8 *pframe, u32 *pLength -) -{ - struct ieee80211_hdr *pwlanhdr; - u16 *fctrl; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct security_priv *psecuritypriv = &padapter->securitypriv; - static u8 LLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8E}; - static u8 GTKbody_a[11] = {0x01, 0x03, 0x00, 0x5F, 0x02, 0x03, 0x12, 0x00, 0x10, 0x42, 0x0B}; - u8 *pGTKRspPkt = pframe; - u8 EncryptionHeadOverhead = 0; - /* DBG_871X("%s:%d\n", __func__, bForcePowerSave); */ - - pwlanhdr = (struct ieee80211_hdr *)pframe; - - fctrl = &pwlanhdr->frame_control; - *(fctrl) = 0; - - /* */ - /* MAC Header. */ - /* */ - SetFrameType(fctrl, WIFI_DATA); - /* SetFrameSubType(fctrl, 0); */ - SetToDs(fctrl); - memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - - SetSeqNum(pwlanhdr, 0); - SetDuration(pwlanhdr, 0); - - *pLength = 24; - - /* */ - /* Security Header: leave space for it if necessary. */ - /* */ - - switch (psecuritypriv->dot11PrivacyAlgrthm) { - case _WEP40_: - case _WEP104_: - EncryptionHeadOverhead = 4; - break; - case _TKIP_: - EncryptionHeadOverhead = 8; - break; - case _AES_: - EncryptionHeadOverhead = 8; - break; - default: - EncryptionHeadOverhead = 0; - } - - if (EncryptionHeadOverhead > 0) { - memset(&(pframe[*pLength]), 0, EncryptionHeadOverhead); - *pLength += EncryptionHeadOverhead; - /* GTK's privacy bit is done by FW */ - /* SetPrivacy(fctrl); */ - } - - /* */ - /* Frame Body. */ - /* */ - pGTKRspPkt = (u8 *)(pframe + *pLength); - /* LLC header */ - memcpy(pGTKRspPkt, LLCHeader, 8); - *pLength += 8; - - /* GTK element */ - pGTKRspPkt += 8; - - /* GTK frame body after LLC, part 1 */ - memcpy(pGTKRspPkt, GTKbody_a, 11); - *pLength += 11; - pGTKRspPkt += 11; - /* GTK frame body after LLC, part 2 */ - memset(&(pframe[*pLength]), 0, 88); - *pLength += 88; - pGTKRspPkt += 88; - -} -#endif /* CONFIG_GTK_OL */ - -#endif /* CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN static void ConstructProbeRsp(struct adapter *padapter, u8 *pframe, u32 *pLength, u8 *StaAddr, bool bHideSSID) { @@ -692,31 +455,6 @@ static void rtl8723b_set_FwRsvdPage_cmd(struct adapter *padapter, struct RSVDPAG static void rtl8723b_set_FwAoacRsvdPage_cmd(struct adapter *padapter, struct RSVDPAGE_LOC *rsvdpageloc) { -#ifdef CONFIG_WOWLAN - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 u1H2CAoacRsvdPageParm[H2C_AOAC_RSVDPAGE_LOC_LEN] = {0}; - - DBG_871X("8723BAOACRsvdPageLoc: RWC =%d ArpRsp =%d NbrAdv =%d GtkRsp =%d GtkInfo =%d ProbeReq =%d NetworkList =%d\n", - rsvdpageloc->LocRemoteCtrlInfo, rsvdpageloc->LocArpRsp, - rsvdpageloc->LocNbrAdv, rsvdpageloc->LocGTKRsp, - rsvdpageloc->LocGTKInfo, rsvdpageloc->LocProbeReq, - rsvdpageloc->LocNetList); - - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - SET_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocRemoteCtrlInfo); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1H2CAoacRsvdPageParm, rsvdpageloc->LocArpRsp); - /* SET_H2CCMD_AOAC_RSVDPAGE_LOC_NEIGHBOR_ADV(u1H2CAoacRsvdPageParm, rsvdpageloc->LocNbrAdv); */ - SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_RSP(u1H2CAoacRsvdPageParm, rsvdpageloc->LocGTKRsp); - SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocGTKInfo); -#ifdef CONFIG_GTK_OL - SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(u1H2CAoacRsvdPageParm, rsvdpageloc->LocGTKEXTMEM); -#endif /* CONFIG_GTK_OL */ - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CAoacRsvdPageParm:", u1H2CAoacRsvdPageParm, H2C_AOAC_RSVDPAGE_LOC_LEN); - FillH2CCmd8723B(padapter, H2C_8723B_AOAC_RSVD_PAGE, H2C_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm); - } else { - } - -#endif /* CONFIG_WOWLAN */ } #ifdef CONFIG_AP_WOWLAN @@ -771,40 +509,6 @@ void rtl8723b_set_FwMediaStatusRpt_cmd(struct adapter *padapter, u8 mstatus, u8 FillH2CCmd8723B(padapter, H2C_8723B_MEDIA_STATUS_RPT, H2C_MEDIA_STATUS_RPT_LEN, u1H2CMediaStatusRptParm); } -#ifdef CONFIG_WOWLAN -static void rtl8723b_set_FwKeepAlive_cmd(struct adapter *padapter, u8 benable, u8 pkt_type) -{ - u8 u1H2CKeepAliveParm[H2C_KEEP_ALIVE_CTRL_LEN] = {0}; - u8 adopt = 1, check_period = 5; - - DBG_871X("%s(): benable = %d\n", __func__, benable); - SET_8723B_H2CCMD_KEEPALIVE_PARM_ENABLE(u1H2CKeepAliveParm, benable); - SET_8723B_H2CCMD_KEEPALIVE_PARM_ADOPT(u1H2CKeepAliveParm, adopt); - SET_8723B_H2CCMD_KEEPALIVE_PARM_PKT_TYPE(u1H2CKeepAliveParm, pkt_type); - SET_8723B_H2CCMD_KEEPALIVE_PARM_CHECK_PERIOD(u1H2CKeepAliveParm, check_period); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CKeepAliveParm:", u1H2CKeepAliveParm, H2C_KEEP_ALIVE_CTRL_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_KEEP_ALIVE, H2C_KEEP_ALIVE_CTRL_LEN, u1H2CKeepAliveParm); -} - -static void rtl8723b_set_FwDisconDecision_cmd(struct adapter *padapter, u8 benable) -{ - u8 u1H2CDisconDecisionParm[H2C_DISCON_DECISION_LEN] = {0}; - u8 adopt = 1, check_period = 10, trypkt_num = 0; - - DBG_871X("%s(): benable = %d\n", __func__, benable); - SET_8723B_H2CCMD_DISCONDECISION_PARM_ENABLE(u1H2CDisconDecisionParm, benable); - SET_8723B_H2CCMD_DISCONDECISION_PARM_ADOPT(u1H2CDisconDecisionParm, adopt); - SET_8723B_H2CCMD_DISCONDECISION_PARM_CHECK_PERIOD(u1H2CDisconDecisionParm, check_period); - SET_8723B_H2CCMD_DISCONDECISION_PARM_TRY_PKT_NUM(u1H2CDisconDecisionParm, trypkt_num); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CDisconDecisionParm:", u1H2CDisconDecisionParm, H2C_DISCON_DECISION_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_DISCON_DECISION, H2C_DISCON_DECISION_LEN, u1H2CDisconDecisionParm); -} -#endif /* CONFIG_WOWLAN */ - void rtl8723b_set_FwMacIdConfig_cmd(struct adapter *padapter, u8 mac_id, u8 raid, u8 bw, u8 sgi, u32 mask) { u8 u1H2CMacIdConfigParm[H2C_MACID_CFG_LEN] = {0}; @@ -855,21 +559,12 @@ void rtl8723b_set_FwPwrMode_cmd(struct adapter *padapter, u8 psmode) else DBG_871X("%s(): FW LPS mode = %d, SmartPS =%d\n", __func__, psmode, pwrpriv->smart_ps); -#ifdef CONFIG_WOWLAN - if (psmode == PS_MODE_DTIM) { /* For WOWLAN LPS, DTIM = (awake_intvl - 1) */ + if (pwrpriv->dtim > 0 && pwrpriv->dtim < 16) + awake_intvl = pwrpriv->dtim+1;/* DTIM = (awake_intvl - 1) */ + else awake_intvl = 3;/* DTIM =2 */ - rlbm = 2; - } else -#endif /* CONFIG_WOWLAN */ - { - if (pwrpriv->dtim > 0 && pwrpriv->dtim < 16) - awake_intvl = pwrpriv->dtim+1;/* DTIM = (awake_intvl - 1) */ - else - awake_intvl = 3;/* DTIM =2 */ - - rlbm = 2; - } + rlbm = 2; if (padapter->registrypriv.wifi_spec == 1) { awake_intvl = 2; @@ -1003,135 +698,6 @@ void rtl8723b_set_FwPwrModeInIPS_cmd(struct adapter *padapter, u8 cmd_param) FillH2CCmd8723B(padapter, H2C_8723B_FWLPS_IN_IPS_, 1, &cmd_param); } -#ifdef CONFIG_WOWLAN -static void rtl8723b_set_FwWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) -{ - struct security_priv *psecpriv = &padapter->securitypriv; - u8 u1H2CWoWlanCtrlParm[H2C_WOWLAN_LEN] = {0}; - u8 discont_wake = 1, gpionum = 0, gpio_dur = 0, hw_unicast = 0; - u8 sdio_wakeup_enable = 1; - u8 gpio_high_active = 0; /* 0: low active, 1: high active */ - u8 magic_pkt = 0; - - if (psecpriv->dot11PrivacyAlgrthm == _WEP40_ || psecpriv->dot11PrivacyAlgrthm == _WEP104_) - hw_unicast = 1; - - DBG_871X("%s(): bFuncEn =%d\n", __func__, bFuncEn); - - SET_H2CCMD_WOWLAN_FUNC_ENABLE(u1H2CWoWlanCtrlParm, bFuncEn); - SET_H2CCMD_WOWLAN_PATTERN_MATCH_ENABLE(u1H2CWoWlanCtrlParm, 0); - SET_H2CCMD_WOWLAN_MAGIC_PKT_ENABLE(u1H2CWoWlanCtrlParm, magic_pkt); - SET_H2CCMD_WOWLAN_UNICAST_PKT_ENABLE(u1H2CWoWlanCtrlParm, hw_unicast); - SET_H2CCMD_WOWLAN_ALL_PKT_DROP(u1H2CWoWlanCtrlParm, 0); - SET_H2CCMD_WOWLAN_GPIO_ACTIVE(u1H2CWoWlanCtrlParm, gpio_high_active); - SET_H2CCMD_WOWLAN_DISCONNECT_WAKE_UP(u1H2CWoWlanCtrlParm, discont_wake); - SET_H2CCMD_WOWLAN_GPIONUM(u1H2CWoWlanCtrlParm, gpionum); - SET_H2CCMD_WOWLAN_DATAPIN_WAKE_UP(u1H2CWoWlanCtrlParm, sdio_wakeup_enable); - SET_H2CCMD_WOWLAN_GPIO_DURATION(u1H2CWoWlanCtrlParm, gpio_dur); - /* SET_H2CCMD_WOWLAN_GPIO_PULSE_EN(u1H2CWoWlanCtrlParm, 1); */ - SET_H2CCMD_WOWLAN_GPIO_PULSE_COUNT(u1H2CWoWlanCtrlParm, 0x09); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CWoWlanCtrlParm:", u1H2CWoWlanCtrlParm, H2C_WOWLAN_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_WOWLAN, H2C_WOWLAN_LEN, u1H2CWoWlanCtrlParm); -} - -static void rtl8723b_set_FwRemoteWakeCtrl_Cmd(struct adapter *padapter, u8 benable) -{ - u8 u1H2CRemoteWakeCtrlParm[H2C_REMOTE_WAKE_CTRL_LEN] = {0}; - struct security_priv *psecuritypriv = &(padapter->securitypriv); - struct pwrctrl_priv *ppwrpriv = adapter_to_pwrctl(padapter); - - DBG_871X("%s(): Enable =%d\n", __func__, benable); - - if (!ppwrpriv->wowlan_pno_enable) { - SET_H2CCMD_REMOTE_WAKECTRL_ENABLE(u1H2CRemoteWakeCtrlParm, benable); - SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, 1); -#ifdef CONFIG_GTK_OL - if (psecuritypriv->binstallKCK_KEK && - psecuritypriv->dot11PrivacyAlgrthm == _AES_) { - SET_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, 1); - } else { - DBG_871X("no kck or security is not AES\n"); - SET_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(u1H2CRemoteWakeCtrlParm, 0); - } -#endif /* CONFIG_GTK_OL */ - - SET_H2CCMD_REMOTE_WAKE_CTRL_FW_UNICAST_EN(u1H2CRemoteWakeCtrlParm, 1); - - if ((psecuritypriv->dot11PrivacyAlgrthm == _AES_) || - (psecuritypriv->dot11PrivacyAlgrthm == _NO_PRIVACY_)) - SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_ACTION(u1H2CRemoteWakeCtrlParm, 0); - else - SET_H2CCMD_REMOTE_WAKE_CTRL_ARP_ACTION(u1H2CRemoteWakeCtrlParm, 1); - } - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CRemoteWakeCtrlParm:", u1H2CRemoteWakeCtrlParm, H2C_REMOTE_WAKE_CTRL_LEN); - FillH2CCmd8723B(padapter, H2C_8723B_REMOTE_WAKE_CTRL, - H2C_REMOTE_WAKE_CTRL_LEN, u1H2CRemoteWakeCtrlParm); -} - -static void rtl8723b_set_FwAOACGlobalInfo_Cmd(struct adapter *padapter, u8 group_alg, u8 pairwise_alg) -{ - u8 u1H2CAOACGlobalInfoParm[H2C_AOAC_GLOBAL_INFO_LEN] = {0}; - - DBG_871X("%s(): group_alg =%d pairwise_alg =%d\n", __func__, group_alg, pairwise_alg); - - SET_H2CCMD_AOAC_GLOBAL_INFO_PAIRWISE_ENC_ALG(u1H2CAOACGlobalInfoParm, pairwise_alg); - SET_H2CCMD_AOAC_GLOBAL_INFO_GROUP_ENC_ALG(u1H2CAOACGlobalInfoParm, group_alg); - - RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CAOACGlobalInfoParm:", u1H2CAOACGlobalInfoParm, H2C_AOAC_GLOBAL_INFO_LEN); - - FillH2CCmd8723B(padapter, H2C_8723B_AOAC_GLOBAL_INFO, H2C_AOAC_GLOBAL_INFO_LEN, u1H2CAOACGlobalInfoParm); -} - -void rtl8723b_set_wowlan_cmd(struct adapter *padapter, u8 enable) -{ - struct security_priv *psecpriv = &padapter->securitypriv; - struct pwrctrl_priv *ppwrpriv = adapter_to_pwrctl(padapter); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_info *psta = NULL; - u8 pkt_type = 0; - - DBG_871X_LEVEL(_drv_always_, "+%s()+: enable =%d\n", __func__, enable); - if (enable) { - rtl8723b_set_FwAOACGlobalInfo_Cmd(padapter, psecpriv->dot118021XGrpPrivacy, psecpriv->dot11PrivacyAlgrthm); - - rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); /* RT_MEDIA_CONNECT will confuse in the future */ - - if (!(ppwrpriv->wowlan_pno_enable)) { - psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv)); - if (psta) - rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); - } else - DBG_871X("%s(): Disconnected, no FwMediaStatusRpt CONNECT\n", __func__); - - msleep(2); - - if (!(ppwrpriv->wowlan_pno_enable)) { - rtl8723b_set_FwDisconDecision_cmd(padapter, enable); - msleep(2); - - if ((psecpriv->dot11PrivacyAlgrthm != _WEP40_) || (psecpriv->dot11PrivacyAlgrthm != _WEP104_)) - pkt_type = 1; - - rtl8723b_set_FwKeepAlive_cmd(padapter, enable, pkt_type); - msleep(2); - } - - rtl8723b_set_FwWoWlanCtrl_Cmd(padapter, enable); - msleep(2); - - rtl8723b_set_FwRemoteWakeCtrl_Cmd(padapter, enable); - } else { - rtl8723b_set_FwRemoteWakeCtrl_Cmd(padapter, enable); - msleep(2); - rtl8723b_set_FwWoWlanCtrl_Cmd(padapter, enable); - } - - DBG_871X_LEVEL(_drv_always_, "-%s()-\n", __func__); -} -#endif /* CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN static void rtl8723b_set_FwAPWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) { @@ -1222,18 +788,8 @@ static void rtl8723b_set_FwRsvdPagePkt( u8 TotalPageNum = 0, CurtPktPageNum = 0, RsvdPageNum = 0; u16 BufIndex, PageSize = 128; u32 TotalPacketLen, MaxRsvdPageBufSize = 0; + struct RSVDPAGE_LOC RsvdPageLoc; -#ifdef CONFIG_WOWLAN - u32 ARPLegnth = 0, GTKLegnth = 0; - u8 currentip[4]; - u8 cur_dot11txpn[8]; -#ifdef CONFIG_GTK_OL - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *psta; - u8 kek[RTW_KEK_LEN]; - u8 kck[RTW_KCK_LEN]; -#endif -#endif /* DBG_871X("%s---->\n", __func__); */ @@ -1343,107 +899,7 @@ static void rtl8723b_set_FwRsvdPagePkt( BufIndex += (CurtPktPageNum*PageSize); -#ifdef CONFIG_WOWLAN - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - /* if (pwrctl->wowlan_mode == true) { */ - /* BufIndex += (CurtPktPageNum*PageSize); */ - - /* 3(7) ARP RSP */ - rtw_get_current_ip_address(padapter, currentip); - RsvdPageLoc.LocArpRsp = TotalPageNum; - { - ConstructARPResponse( - padapter, - &ReservedPagePacket[BufIndex], - &ARPLegnth, - currentip - ); - rtl8723b_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], ARPLegnth, false, false, true); - - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: ARP RSP %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], (ARPLegnth+TxDescLen)); */ - - CurtPktPageNum = (u8)PageNum_128(TxDescLen + ARPLegnth); - } - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* 3(8) SEC IV */ - rtw_get_sec_iv(padapter, cur_dot11txpn, get_my_bssid(&pmlmeinfo->network)); - RsvdPageLoc.LocRemoteCtrlInfo = TotalPageNum; - memcpy(ReservedPagePacket+BufIndex-TxDescLen, cur_dot11txpn, _AES_IV_LEN_); - - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: SEC IV %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], _AES_IV_LEN_); */ - - CurtPktPageNum = (u8)PageNum_128(_AES_IV_LEN_); - - TotalPageNum += CurtPktPageNum; - -#ifdef CONFIG_GTK_OL - BufIndex += (CurtPktPageNum*PageSize); - - /* if the ap station info. exists, get the kek, kck from station info. */ - psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); - if (!psta) { - memset(kek, 0, RTW_KEK_LEN); - memset(kck, 0, RTW_KCK_LEN); - DBG_8192C("%s, KEK, KCK download rsvd page all zero\n", __func__); - } else { - memcpy(kek, psta->kek, RTW_KEK_LEN); - memcpy(kck, psta->kck, RTW_KCK_LEN); - } - - /* 3(9) KEK, KCK */ - RsvdPageLoc.LocGTKInfo = TotalPageNum; - memcpy(ReservedPagePacket+BufIndex-TxDescLen, kck, RTW_KCK_LEN); - memcpy(ReservedPagePacket+BufIndex-TxDescLen+RTW_KCK_LEN, kek, RTW_KEK_LEN); - - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: KEK KCK %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], (TxDescLen + RTW_KCK_LEN + RTW_KEK_LEN)); */ - - CurtPktPageNum = (u8)PageNum_128(TxDescLen + RTW_KCK_LEN + RTW_KEK_LEN); - - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* 3(10) GTK Response */ - RsvdPageLoc.LocGTKRsp = TotalPageNum; - ConstructGTKResponse( - padapter, - &ReservedPagePacket[BufIndex], - >KLegnth - ); - - rtl8723b_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], GTKLegnth, false, false, true); - /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: GTK RSP %p %d\n", */ - /* __func__, &ReservedPagePacket[BufIndex-TxDescLen], (TxDescLen + GTKLegnth)); */ - - CurtPktPageNum = (u8)PageNum_128(TxDescLen + GTKLegnth); - - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* below page is empty for GTK extension memory */ - /* 3(11) GTK EXT MEM */ - RsvdPageLoc.LocGTKEXTMEM = TotalPageNum; - - CurtPktPageNum = 2; - - TotalPageNum += CurtPktPageNum; - - TotalPacketLen = BufIndex-TxDescLen + 256; /* extension memory for FW */ -#else - TotalPacketLen = BufIndex - TxDescLen + sizeof(union pn48); /* IV len */ -#endif /* CONFIG_GTK_OL */ - } else -#endif /* CONFIG_WOWLAN */ - { - TotalPacketLen = BufIndex + BTQosNullLength; - } + TotalPacketLen = BufIndex + BTQosNullLength; if (TotalPacketLen > MaxRsvdPageBufSize) { DBG_871X("%s(): ERROR: The rsvd page size is not enough!!TotalPacketLen %d, MaxRsvdPageBufSize %d\n", __func__, diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 0eac9cb11cef..618b40ede2e4 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -369,9 +369,6 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool bUsedWoWLANFw) u8 tmp_ps; RT_TRACE(_module_hal_init_c_, _drv_info_, ("+%s\n", __func__)); -#ifdef CONFIG_WOWLAN - RT_TRACE(_module_hal_init_c_, _drv_notice_, ("+%s, bUsedWoWLANFw:%d\n", __func__, bUsedWoWLANFw)); -#endif pFirmware = kzalloc(sizeof(struct rt_firmware), GFP_KERNEL); if (!pFirmware) return _FAIL; @@ -393,12 +390,7 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool bUsedWoWLANFw) pdbgpriv->dbg_downloadfw_pwr_state_cnt++; } -#ifdef CONFIG_WOWLAN - if (bUsedWoWLANFw) - fwfilepath = "rtlwifi/rtl8723bs_wowlan.bin"; - else -#endif /* CONFIG_WOWLAN */ - fwfilepath = "rtlwifi/rtl8723bs_nic.bin"; + fwfilepath = "rtlwifi/rtl8723bs_nic.bin"; pr_info("rtl8723bs: acquire FW from file:%s\n", fwfilepath); @@ -535,7 +527,7 @@ void rtl8723b_InitializeFirmwareVars(struct adapter *padapter) /* pHalData->H2CStopInsertQueue = false; */ } -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN /* */ /* */ @@ -566,7 +558,7 @@ void SetFwRelatedForWoWLAN8723b( /* */ rtl8723b_InitializeFirmwareVars(padapter); } -#endif /* CONFIG_WOWLAN */ +#endif /* CONFIG_AP_WOWLAN */ static void rtl8723b_free_hal_data(struct adapter *padapter) { @@ -3752,14 +3744,6 @@ void C2HPacketHandler_8723B(struct adapter *padapter, u8 *pbuffer, u16 length) { struct C2H_EVT_HDR C2hEvent; u8 *tmpBuf = NULL; -#ifdef CONFIG_WOWLAN - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - - if (pwrpriv->wowlan_mode) { - DBG_871X("%s(): return because wowolan_mode ==true! CMDID =%d\n", __func__, pbuffer[0]); - return; - } -#endif C2hEvent.CmdID = pbuffer[0]; C2hEvent.CmdSeq = pbuffer[1]; C2hEvent.CmdLen = length-2; @@ -4314,19 +4298,6 @@ void GetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val) val16 = rtw_read16(padapter, REG_TXPKT_EMPTY); *val = (val16 & BIT(10)) ? true:false; break; -#ifdef CONFIG_WOWLAN - case HW_VAR_RPWM_TOG: - *val = rtw_read8(padapter, SDIO_LOCAL_BASE|SDIO_REG_HRPWM1) & BIT7; - break; - case HW_VAR_WAKEUP_REASON: - *val = rtw_read8(padapter, REG_WOWLAN_WAKE_REASON); - if (*val == 0xEA) - *val = 0; - break; - case HW_VAR_SYS_CLKR: - *val = rtw_read8(padapter, REG_SYS_CLKR); - break; -#endif default: GetHwReg(padapter, variable, val); break; @@ -4461,14 +4432,6 @@ u8 GetHalDefVar8723B(struct adapter *padapter, enum HAL_DEF_VARIABLE variable, v return bResult; } -#ifdef CONFIG_WOWLAN -void Hal_DetectWoWMode(struct adapter *padapter) -{ - adapter_to_pwrctl(padapter)->bSupportRemoteWakeup = true; - DBG_871X("%s\n", __func__); -} -#endif /* CONFIG_WOWLAN */ - void rtl8723b_start_thread(struct adapter *padapter) { #ifndef CONFIG_SDIO_TX_TASKLET diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index ced05bbfc906..47cd3ae63687 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -689,30 +689,6 @@ static u32 rtl8723bs_hal_init(struct adapter *padapter) return _SUCCESS; } -#ifdef CONFIG_WOWLAN - if (rtw_read8(padapter, REG_MCUFWDL) & BIT7) { - u8 reg_val = 0; - DBG_871X("+Reset Entry+\n"); - rtw_write8(padapter, REG_MCUFWDL, 0x00); - _8051Reset8723(padapter); - /* reset BB */ - reg_val = rtw_read8(padapter, REG_SYS_FUNC_EN); - reg_val &= ~(BIT(0) | BIT(1)); - rtw_write8(padapter, REG_SYS_FUNC_EN, reg_val); - /* reset RF */ - rtw_write8(padapter, REG_RF_CTRL, 0); - /* reset TRX path */ - rtw_write16(padapter, REG_CR, 0); - /* reset MAC, Digital Core */ - reg_val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); - reg_val &= ~(BIT(4) | BIT(7)); - rtw_write8(padapter, REG_SYS_FUNC_EN + 1, reg_val); - reg_val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); - reg_val |= BIT(4) | BIT(7); - rtw_write8(padapter, REG_SYS_FUNC_EN + 1, reg_val); - DBG_871X("-Reset Entry-\n"); - } -#endif /* CONFIG_WOWLAN */ /* Disable Interrupt first. */ /* rtw_hal_disable_interrupt(padapter); */ @@ -1228,10 +1204,6 @@ static void _ReadEfuseInfo8723BS(struct adapter *padapter) Hal_EfuseParseVoltage_8723B(padapter, hwinfo, pEEPROM->bautoload_fail_flag); -#ifdef CONFIG_WOWLAN - Hal_DetectWoWMode(padapter); -#endif - Hal_ReadRFGainOffset(padapter, hwinfo, pEEPROM->bautoload_fail_flag); RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("<==== _ReadEfuseInfo8723BS()\n")); @@ -1322,7 +1294,7 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) { u8 val8; -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN struct wowlan_ioctl_param *poidparam; struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); int res; @@ -1330,13 +1302,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) u16 len = 0; u8 trycnt = 100; u32 himr = 0; -#if defined(CONFIG_WOWLAN) - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_info *psta = NULL; - u64 iv_low = 0, iv_high = 0; - u8 mstatus = (*(u8 *)val); -#endif #endif switch (variable) { @@ -1363,206 +1328,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) val8 = *val; break; -#ifdef CONFIG_WOWLAN - case HW_VAR_WOWLAN: - { - poidparam = (struct wowlan_ioctl_param *)val; - switch (poidparam->subcode) { - case WOWLAN_ENABLE: - DBG_871X_LEVEL(_drv_always_, "WOWLAN_ENABLE\n"); - - /* backup data rate to register 0x8b for wowlan FW */ - rtw_write8(padapter, 0x8d, 1); - rtw_write8(padapter, 0x8c, 0); - rtw_write8(padapter, 0x8f, 0x40); - rtw_write8(padapter, 0x8b, - rtw_read8(padapter, 0x2f0)); - - /* 1. Download WOWLAN FW */ - DBG_871X_LEVEL(_drv_always_, "Re-download WoWlan FW!\n"); - SetFwRelatedForWoWLAN8723b(padapter, true); - - /* 2. RX DMA stop */ - DBG_871X_LEVEL(_drv_always_, "Pause DMA\n"); - rtw_write32(padapter, REG_RXPKT_NUM, (rtw_read32(padapter, REG_RXPKT_NUM) | RW_RELEASE_EN)); - do { - if ((rtw_read32(padapter, REG_RXPKT_NUM) & RXDMA_IDLE)) { - DBG_871X_LEVEL(_drv_always_, "RX_DMA_IDLE is true\n"); - break; - } else { - /* If RX_DMA is not idle, receive one pkt from DMA */ - res = sdio_local_read(padapter, SDIO_REG_RX0_REQ_LEN, 4, (u8 *)&tmp); - len = le16_to_cpu(tmp); - DBG_871X_LEVEL(_drv_always_, "RX len:%d\n", len); - if (len > 0) - res = RecvOnePkt(padapter, len); - else - DBG_871X_LEVEL(_drv_always_, "read length fail %d\n", len); - - DBG_871X_LEVEL(_drv_always_, "RecvOnePkt Result: %d\n", res); - } - } while (trycnt--); - if (trycnt == 0) - DBG_871X_LEVEL(_drv_always_, "Stop RX DMA failed......\n"); - - /* 3. Clear IMR and ISR */ - DBG_871X_LEVEL(_drv_always_, "Clear IMR and ISR\n"); - tmp = 0; - sdio_local_write(padapter, SDIO_REG_HIMR_ON, 4, (u8 *)&tmp); - sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - sdio_local_read(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); - sdio_local_write(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); - - /* 4. Enable CPWM2 only */ - DBG_871X_LEVEL(_drv_always_, "Enable only CPWM2\n"); - sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - DBG_871X("DisableInterruptButCpwm28723BSdio(): Read SDIO_REG_HIMR: 0x%08x\n", tmp); - - himr = cpu_to_le32(SDIO_HIMR_DISABLED) | SDIO_HIMR_CPWM2_MSK; - sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&himr); - - sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - DBG_871X("DisableInterruptButCpwm28723BSdio(): Read again SDIO_REG_HIMR: 0x%08x\n", tmp); - - /* 5. Set Enable WOWLAN H2C command. */ - DBG_871X_LEVEL(_drv_always_, "Set Enable WOWLan cmd\n"); - rtl8723b_set_wowlan_cmd(padapter, 1); - - /* 6. Check EnableWoWlan CMD is ready */ - if (!pwrctl->wowlan_pno_enable) { - DBG_871X_LEVEL(_drv_always_, "Check EnableWoWlan CMD is ready\n"); - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - trycnt = 10; - while (!(mstatus & BIT1) && trycnt > 1) { - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - DBG_871X("Loop index: %d :0x%02x\n", trycnt, mstatus); - trycnt--; - msleep(2); - } - } - break; - - case WOWLAN_DISABLE: - DBG_871X_LEVEL(_drv_always_, "WOWLAN_DISABLE\n"); - - psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv)); - if (psta) - rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_DISCONNECT, psta->mac_id); - else - DBG_871X("psta is null\n"); - - /* 1. Read wakeup reason */ - pwrctl->wowlan_wake_reason = rtw_read8(padapter, REG_WOWLAN_WAKE_REASON); - DBG_871X_LEVEL( - _drv_always_, - "wakeup_reason: 0x%02x, mac_630 = 0x%08x, mac_634 = 0x%08x, mac_1c0 = 0x%08x, mac_1c4 = 0x%08x" - ", mac_494 = 0x%08x, , mac_498 = 0x%08x, mac_49c = 0x%08x, mac_608 = 0x%08x, mac_4a0 = 0x%08x, mac_4a4 = 0x%08x\n" - ", mac_1cc = 0x%08x, mac_2f0 = 0x%08x, mac_2f4 = 0x%08x, mac_2f8 = 0x%08x, mac_2fc = 0x%08x, mac_8c = 0x%08x", - pwrctl->wowlan_wake_reason, - rtw_read32(padapter, REG_WOWLAN_GTK_DBG1), - rtw_read32(padapter, REG_WOWLAN_GTK_DBG2), - rtw_read32(padapter, 0x1c0), - rtw_read32(padapter, 0x1c4), - rtw_read32(padapter, 0x494), - rtw_read32(padapter, 0x498), - rtw_read32(padapter, 0x49c), - rtw_read32(padapter, 0x608), - rtw_read32(padapter, 0x4a0), - rtw_read32(padapter, 0x4a4), - rtw_read32(padapter, 0x1cc), - rtw_read32(padapter, 0x2f0), - rtw_read32(padapter, 0x2f4), - rtw_read32(padapter, 0x2f8), - rtw_read32(padapter, 0x2fc), - rtw_read32(padapter, 0x8c) - ); - - { - /* 2. Set Disable WOWLAN H2C command. */ - DBG_871X_LEVEL(_drv_always_, "Set Disable WOWLan cmd\n"); - rtl8723b_set_wowlan_cmd(padapter, 0); - - /* 3. Check Disable WoWlan CMD ready. */ - DBG_871X_LEVEL(_drv_always_, "Check DisableWoWlan CMD is ready\n"); - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - trycnt = 50; - while (mstatus & BIT1 && trycnt > 1) { - mstatus = rtw_read8(padapter, REG_WOW_CTRL); - DBG_871X_LEVEL(_drv_always_, "Loop index: %d :0x%02x\n", trycnt, mstatus); - trycnt--; - msleep(10); - } - - if (mstatus & BIT1) { - DBG_871X_LEVEL(_drv_always_, "Disable WOW mode fail!!\n"); - DBG_871X("Set 0x690 = 0x00\n"); - rtw_write8(padapter, REG_WOW_CTRL, (rtw_read8(padapter, REG_WOW_CTRL) & 0xf0)); - DBG_871X_LEVEL(_drv_always_, "Release RXDMA\n"); - rtw_write32(padapter, REG_RXPKT_NUM, (rtw_read32(padapter, REG_RXPKT_NUM) & (~RW_RELEASE_EN))); - } - - /* 3.1 read fw iv */ - iv_low = rtw_read32(padapter, REG_TXPKTBUF_IV_LOW); - /* only low two bytes is PN, check AES_IV macro for detail */ - iv_low &= 0xffff; - iv_high = rtw_read32(padapter, REG_TXPKTBUF_IV_HIGH); - /* get the real packet number */ - pwrctl->wowlan_fw_iv = iv_high << 16 | iv_low; - DBG_871X_LEVEL(_drv_always_, "fw_iv: 0x%016llx\n", pwrctl->wowlan_fw_iv); - /* Update TX iv data. */ - rtw_set_sec_pn(padapter); - - /* 3.2 read GTK index and key */ - if ( - psecuritypriv->binstallKCK_KEK == true && - psecuritypriv->dot11PrivacyAlgrthm == _AES_ - ) { - u8 gtk_keyindex = 0; - u8 get_key[16]; - /* read gtk key index */ - gtk_keyindex = rtw_read8(padapter, 0x48c); - - if (gtk_keyindex < 4) { - psecuritypriv->dot118021XGrpKeyid = gtk_keyindex; - read_cam(padapter, gtk_keyindex, get_key); - memcpy(psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, get_key, 16); - DBG_871X_LEVEL( - _drv_always_, - "GTK (%d) = 0x%08x, 0x%08x, 0x%08x, 0x%08x\n", - gtk_keyindex, - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[0], - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[1], - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[2], - psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[3] - ); - } else - DBG_871X_LEVEL(_drv_always_, "GTK index =%d\n", gtk_keyindex); - } - - /* 4. Re-download Normal FW. */ - DBG_871X_LEVEL(_drv_always_, "Re-download Normal FW!\n"); - SetFwRelatedForWoWLAN8723b(padapter, false); - } - - /* 5. Download reserved pages and report media status if needed. */ - if ( - (pwrctl->wowlan_wake_reason != FWDecisionDisconnect) && - (pwrctl->wowlan_wake_reason != Rx_Pairwisekey) && - (pwrctl->wowlan_wake_reason != Rx_DisAssoc) && - (pwrctl->wowlan_wake_reason != Rx_DeAuth) - ) { - rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); - if (psta) - rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); - } - break; - - default: - break; - } - } - break; -#endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN case HW_VAR_AP_WOWLAN: { @@ -1765,9 +1530,6 @@ void rtl8723bs_set_hal_ops(struct adapter *padapter) pHalFunc->enable_interrupt = &EnableInterrupt8723BSdio; pHalFunc->disable_interrupt = &DisableInterrupt8723BSdio; pHalFunc->check_ips_status = &CheckIPSStatus; -#ifdef CONFIG_WOWLAN - pHalFunc->clear_interrupt = &ClearInterrupt8723BSdio; -#endif pHalFunc->SetHwRegHandler = &SetHwReg8723BS; pHalFunc->GetHwRegHandler = &GetHwReg8723BS; pHalFunc->SetHwRegHandlerWithBuf = &SetHwRegWithBuf8723B; diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c index 369f55d11519..2400b06dff36 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_ops.c +++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c @@ -1114,7 +1114,7 @@ void HalQueryTxOQTBufferStatus8723BSdio(struct adapter *adapter) haldata->SdioTxOQTFreeSpace = SdioLocalCmd52Read1Byte(adapter, SDIO_REG_OQT_FREE_PG); } -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN u8 RecvOnePkt(struct adapter *adapter, u32 size) { struct recv_buf *recvbuf; @@ -1149,4 +1149,4 @@ u8 RecvOnePkt(struct adapter *adapter, u32 size) DBG_871X("-%s-\n", __func__); return res; } -#endif /* CONFIG_WOWLAN */ +#endif /* CONFIG_AP_WOWLAN */ diff --git a/drivers/staging/rtl8723bs/include/autoconf.h b/drivers/staging/rtl8723bs/include/autoconf.h index 86cf09ca5f06..996198750814 100644 --- a/drivers/staging/rtl8723bs/include/autoconf.h +++ b/drivers/staging/rtl8723bs/include/autoconf.h @@ -40,9 +40,6 @@ * Platform dependent */ #define WAKEUP_GPIO_IDX 12 /* WIFI Chip Side */ -#ifdef CONFIG_WOWLAN -#define CONFIG_GTK_OL -#endif /* CONFIG_WOWLAN */ /* * Debug Related Config diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h index 97e8e462d718..56ebf18a4c05 100644 --- a/drivers/staging/rtl8723bs/include/drv_types.h +++ b/drivers/staging/rtl8723bs/include/drv_types.h @@ -534,11 +534,6 @@ int rtw_set_gpio_output_value(struct net_device *netdev, int gpio_num, bool isHi int rtw_config_gpio(struct net_device *netdev, int gpio_num, bool isOutput); #endif -#ifdef CONFIG_WOWLAN -void rtw_suspend_wow(struct adapter *padapter); -int rtw_resume_process_wow(struct adapter *padapter); -#endif - static inline u8 *myid(struct eeprom_priv *peepriv) { return peepriv->mac_addr; diff --git a/drivers/staging/rtl8723bs/include/drv_types_sdio.h b/drivers/staging/rtl8723bs/include/drv_types_sdio.h index 5e079838f59c..83f5e912baa7 100644 --- a/drivers/staging/rtl8723bs/include/drv_types_sdio.h +++ b/drivers/staging/rtl8723bs/include/drv_types_sdio.h @@ -11,7 +11,7 @@ #include #include -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN #include #include #endif diff --git a/drivers/staging/rtl8723bs/include/hal_com_h2c.h b/drivers/staging/rtl8723bs/include/hal_com_h2c.h index a6e49c5494e6..eca394a8e565 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_h2c.h +++ b/drivers/staging/rtl8723bs/include/hal_com_h2c.h @@ -95,60 +95,6 @@ enum h2c_cmd { #define H2C_BCN_RSVDPAGE_LEN 5 #define H2C_PROBERSP_RSVDPAGE_LEN 5 -#ifdef CONFIG_WOWLAN -#define eqMacAddr(a, b) (((a)[0] == (b)[0] && (a)[1] == (b)[1] && (a)[2] == (b)[2] && (a)[3] == (b)[3] && (a)[4] == (b)[4] && (a)[5] == (b)[5]) ? 1 : 0) -#define cpMacAddr(des, src) ((des)[0] = (src)[0], (des)[1] = (src)[1], (des)[2] = (src)[2], (des)[3] = (src)[3], (des)[4] = (src)[4], (des)[5] = (src)[5]) -#define cpIpAddr(des, src) ((des)[0] = (src)[0], (des)[1] = (src)[1], (des)[2] = (src)[2], (des)[3] = (src)[3]) - -/* */ -/* ARP packet */ -/* */ -/* LLC Header */ -#define GET_ARP_PKT_LLC_TYPE(__pHeader) ReadEF2Byte(((u8 *)(__pHeader)) + 6) - -/* ARP element */ -#define GET_ARP_PKT_OPERATION(__pHeader) ReadEF2Byte(((u8 *)(__pHeader)) + 6) -#define GET_ARP_PKT_SENDER_MAC_ADDR(__pHeader, _val) cpMacAddr((u8 *)(_val), ((u8 *)(__pHeader))+8) -#define GET_ARP_PKT_SENDER_IP_ADDR(__pHeader, _val) cpIpAddr((u8 *)(_val), ((u8 *)(__pHeader))+14) -#define GET_ARP_PKT_TARGET_MAC_ADDR(__pHeader, _val) cpMacAddr((u8 *)(_val), ((u8 *)(__pHeader))+18) -#define GET_ARP_PKT_TARGET_IP_ADDR(__pHeader, _val) cpIpAddr((u8 *)(_val), ((u8 *)(__pHeader))+24) - -#define SET_ARP_PKT_HW(__pHeader, __Value) WRITEEF2BYTE(((u8 *)(__pHeader)) + 0, __Value) -#define SET_ARP_PKT_PROTOCOL(__pHeader, __Value) WRITEEF2BYTE(((u8 *)(__pHeader)) + 2, __Value) -#define SET_ARP_PKT_HW_ADDR_LEN(__pHeader, __Value) WRITEEF1BYTE(((u8 *)(__pHeader)) + 4, __Value) -#define SET_ARP_PKT_PROTOCOL_ADDR_LEN(__pHeader, __Value) WRITEEF1BYTE(((u8 *)(__pHeader)) + 5, __Value) -#define SET_ARP_PKT_OPERATION(__pHeader, __Value) WRITEEF2BYTE(((u8 *)(__pHeader)) + 6, __Value) -#define SET_ARP_PKT_SENDER_MAC_ADDR(__pHeader, _val) cpMacAddr(((u8 *)(__pHeader))+8, (u8 *)(_val)) -#define SET_ARP_PKT_SENDER_IP_ADDR(__pHeader, _val) cpIpAddr(((u8 *)(__pHeader))+14, (u8 *)(_val)) -#define SET_ARP_PKT_TARGET_MAC_ADDR(__pHeader, _val) cpMacAddr(((u8 *)(__pHeader))+18, (u8 *)(_val)) -#define SET_ARP_PKT_TARGET_IP_ADDR(__pHeader, _val) cpIpAddr(((u8 *)(__pHeader))+24, (u8 *)(_val)) - -#define FW_WOWLAN_FUN_EN BIT(0) -#define FW_WOWLAN_PATTERN_MATCH BIT(1) -#define FW_WOWLAN_MAGIC_PKT BIT(2) -#define FW_WOWLAN_UNICAST BIT(3) -#define FW_WOWLAN_ALL_PKT_DROP BIT(4) -#define FW_WOWLAN_GPIO_ACTIVE BIT(5) -#define FW_WOWLAN_REKEY_WAKEUP BIT(6) -#define FW_WOWLAN_DEAUTH_WAKEUP BIT(7) - -#define FW_WOWLAN_GPIO_WAKEUP_EN BIT(0) -#define FW_FW_PARSE_MAGIC_PKT BIT(1) - -#define FW_REMOTE_WAKE_CTRL_EN BIT(0) -#define FW_REALWOWLAN_EN BIT(5) - -#define FW_WOWLAN_KEEP_ALIVE_EN BIT(0) -#define FW_ADOPT_USER BIT(1) -#define FW_WOWLAN_KEEP_ALIVE_PKT_TYPE BIT(2) - -#define FW_REMOTE_WAKE_CTRL_EN BIT(0) -#define FW_ARP_EN BIT(1) -#define FW_REALWOWLAN_EN BIT(5) -#define FW_WOW_FW_UNICAST_EN BIT(7) - -#endif /* CONFIG_WOWLAN */ - /* _RSVDPAGE_LOC_CMD_0x00 */ #define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd, 0, 8, __Value) #define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+1, 0, 8, __Value) @@ -230,9 +176,6 @@ enum h2c_cmd { #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_NEIGHBOR_ADV(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+2, 0, 8, __Value) #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_RSP(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+3, 0, 8, __Value) #define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+4, 0, 8, __Value) -#ifdef CONFIG_GTK_OL -#define SET_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+5, 0, 8, __Value) -#endif /* CONFIG_GTK_OL */ /* */ /* Structure -------------------------------------------------- */ @@ -243,25 +186,13 @@ struct RSVDPAGE_LOC { u8 LocNullData; u8 LocQosNull; u8 LocBTQosNull; -#ifdef CONFIG_WOWLAN - u8 LocRemoteCtrlInfo; - u8 LocArpRsp; - u8 LocNbrAdv; - u8 LocGTKRsp; - u8 LocGTKInfo; - u8 LocProbeReq; - u8 LocNetList; -#ifdef CONFIG_GTK_OL - u8 LocGTKEXTMEM; -#endif /* CONFIG_GTK_OL */ -#endif /* CONFIG_WOWLAN */ #ifdef CONFIG_AP_WOWLAN u8 LocApOffloadBCN; #endif /* CONFIG_AP_WOWLAN */ }; #endif -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip); void rtw_get_sec_iv(struct adapter *padapter, u8*pcur_dot11txpn, u8 *StaAddr); void rtw_set_sec_pn(struct adapter *padapter); diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h index 426c8d58c444..093e00b9349b 100644 --- a/drivers/staging/rtl8723bs/include/hal_intf.h +++ b/drivers/staging/rtl8723bs/include/hal_intf.h @@ -85,11 +85,6 @@ enum HW_VARIABLES { HW_VAR_APFM_ON_MAC, /* Auto FSM to Turn On, include clock, isolation, power control for MAC only */ /* The valid upper nav range for the HW updating, if the true value is larger than the upper range, the HW won't update it. */ /* Unit in microsecond. 0 means disable this function. */ -#ifdef CONFIG_WOWLAN - HW_VAR_WOWLAN, - HW_VAR_WAKEUP_REASON, - HW_VAR_RPWM_TOG, -#endif #ifdef CONFIG_AP_WOWLAN HW_VAR_AP_WOWLAN, #endif diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h b/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h index 3bfb0e9be582..b85e67ccc7db 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h @@ -177,11 +177,11 @@ void rtl8723b_download_BTCoex_AP_mode_rsvd_page(struct adapter *padapter); void CheckFwRsvdPageContent(struct adapter *padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN void rtl8723b_set_wowlan_cmd(struct adapter *padapter, u8 enable); void rtl8723b_set_ap_wowlan_cmd(struct adapter *padapter, u8 enable); void SetFwRelatedForWoWLAN8723b(struct adapter *padapter, u8 bHostIsGoingtoSleep); -#endif/* CONFIG_WOWLAN */ +#endif void rtl8723b_set_FwPwrModeInIPS_cmd(struct adapter *padapter, u8 cmd_param); diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index 5f2784c7cc16..da3679d2c8f9 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -96,11 +96,7 @@ struct rt_firmware_hdr { /* For WoWLan, more reserved page */ /* ARP Rsp:1, RWC:1, GTK Info:1, GTK RSP:2, GTK EXT MEM:2, PNO: 6 */ -#ifdef CONFIG_WOWLAN -#define WOWLAN_PAGE_NUM_8723B 0x07 -#else #define WOWLAN_PAGE_NUM_8723B 0x00 -#endif #ifdef CONFIG_AP_WOWLAN #define AP_WOWLAN_PAGE_NUM_8723B 0x02 @@ -244,9 +240,6 @@ u8 GetHalDefVar8723B(struct adapter *padapter, enum HAL_DEF_VARIABLE variable, void rtl8723b_InitBeaconParameters(struct adapter *padapter); void _InitBurstPktLen_8723BS(struct adapter *adapter); void _8051Reset8723(struct adapter *padapter); -#ifdef CONFIG_WOWLAN -void Hal_DetectWoWMode(struct adapter *padapter); -#endif /* CONFIG_WOWLAN */ void rtl8723b_start_thread(struct adapter *padapter); void rtl8723b_stop_thread(struct adapter *padapter); diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h index 9149fe598545..999555476ebc 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h @@ -96,10 +96,6 @@ #define REG_TXPKTBUF_BCNQ_BDNY_8723B 0x0424 #define REG_TXPKTBUF_MGQ_BDNY_8723B 0x0425 #define REG_TXPKTBUF_WMAC_LBK_BF_HD_8723B 0x045D -#ifdef CONFIG_WOWLAN -#define REG_TXPKTBUF_IV_LOW 0x0484 -#define REG_TXPKTBUF_IV_HIGH 0x0488 -#endif #define REG_AMPDU_BURST_MODE_8723B 0x04BC /* */ @@ -164,12 +160,6 @@ #define BIT_USB_RXDMA_AGG_EN BIT(31) #define RXDMA_AGG_MODE_EN BIT(1) -#ifdef CONFIG_WOWLAN -#define RXPKT_RELEASE_POLL BIT(16) -#define RXDMA_IDLE BIT(17) -#define RW_RELEASE_EN BIT(18) -#endif - /* */ /* */ /* 0x0400h ~ 0x047Fh Protocol Configuration */ diff --git a/drivers/staging/rtl8723bs/include/rtw_mp.h b/drivers/staging/rtl8723bs/include/rtw_mp.h index a7fa82586967..8b6e4e9578f9 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mp.h +++ b/drivers/staging/rtl8723bs/include/rtw_mp.h @@ -189,9 +189,6 @@ enum { CTA_TEST, MP_DISABLE_BT_COEXIST, MP_PwrCtlDM, -#ifdef CONFIG_WOWLAN - MP_WOW_ENABLE, -#endif #ifdef CONFIG_AP_WOWLAN MP_AP_WOW_ENABLE, #endif diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h index 20eafa1eeafa..33e33591006d 100644 --- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h @@ -220,15 +220,6 @@ struct pwrctrl_priv { u8 wowlan_wake_reason; u8 wowlan_ap_mode; u8 wowlan_mode; -#ifdef CONFIG_WOWLAN - u8 wowlan_pattern; - u8 wowlan_magic; - u8 wowlan_unicast; - u8 wowlan_pattern_idx; - u8 wowlan_pno_enable; - u32 wowlan_pattern_context[8][5]; - u64 wowlan_fw_iv; -#endif /* CONFIG_WOWLAN */ struct timer_list pwr_state_check_timer; struct adapter *adapter; int pwr_state_check_interval; diff --git a/drivers/staging/rtl8723bs/include/rtw_security.h b/drivers/staging/rtl8723bs/include/rtw_security.h index 6c1483989ea3..3f3fd19d61c3 100644 --- a/drivers/staging/rtl8723bs/include/rtw_security.h +++ b/drivers/staging/rtl8723bs/include/rtw_security.h @@ -129,9 +129,6 @@ struct security_priv { u8 binstallGrpkey; -#ifdef CONFIG_GTK_OL - u8 binstallKCK_KEK; -#endif /* CONFIG_GTK_OL */ u8 binstallBIPkey; u8 busetkipkey; /* _timer tkip_timer; */ diff --git a/drivers/staging/rtl8723bs/include/sdio_ops.h b/drivers/staging/rtl8723bs/include/sdio_ops.h index 6b0446be6d19..1f1f368cded4 100644 --- a/drivers/staging/rtl8723bs/include/sdio_ops.h +++ b/drivers/staging/rtl8723bs/include/sdio_ops.h @@ -25,17 +25,17 @@ s32 _sdio_write32(struct adapter *padapter, u32 addr, u32 val); extern void sd_int_hdl(struct adapter *padapter); extern u8 CheckIPSStatus(struct adapter *padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN extern u8 RecvOnePkt(struct adapter *padapter, u32 size); -#endif /* CONFIG_WOWLAN */ +#endif extern void InitInterrupt8723BSdio(struct adapter *padapter); extern void InitSysInterrupt8723BSdio(struct adapter *padapter); extern void EnableInterrupt8723BSdio(struct adapter *padapter); extern void DisableInterrupt8723BSdio(struct adapter *padapter); extern u8 HalQueryTxBufferStatus8723BSdio(struct adapter *padapter); extern void HalQueryTxOQTBufferStatus8723BSdio(struct adapter *padapter); -#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +#ifdef CONFIG_AP_WOWLAN extern void ClearInterrupt8723BSdio(struct adapter *padapter); -#endif /* CONFIG_WOWLAN */ +#endif #endif /* !__SDIO_OPS_H__ */ diff --git a/drivers/staging/rtl8723bs/include/sta_info.h b/drivers/staging/rtl8723bs/include/sta_info.h index 28fb9f26466b..78a9091661a5 100644 --- a/drivers/staging/rtl8723bs/include/sta_info.h +++ b/drivers/staging/rtl8723bs/include/sta_info.h @@ -92,11 +92,6 @@ struct sta_info { union Keytype dot11tkiprxmickey; union Keytype dot118021x_UncstKey; union pn48 dot11txpn; /* PN48 used for Unicast xmit */ -#ifdef CONFIG_GTK_OL - u8 kek[RTW_KEK_LEN]; - u8 kck[RTW_KCK_LEN]; - u8 replay_ctr[RTW_REPLAY_CTR_LEN]; -#endif /* CONFIG_GTK_OL */ union pn48 dot11wtxpn; /* PN48 used for Unicast mgmt xmit. */ union pn48 dot11rxpn; /* PN48 used for Unicast recv. */ diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index 6a28420cdb2f..9ee95fe4266e 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -4669,9 +4669,6 @@ static const struct iw_priv_args rtw_private_args[] = { IW_PRIV_TYPE_CHAR | 40, IW_PRIV_TYPE_CHAR | 0x7FF, "test" }, -#ifdef CONFIG_WOWLAN - { MP_WOW_ENABLE, IW_PRIV_TYPE_CHAR | 1024, 0, "wow_mode" }, /* set */ -#endif #ifdef CONFIG_AP_WOWLAN { MP_AP_WOW_ENABLE, IW_PRIV_TYPE_CHAR | 1024, 0, "ap_wow_mode" }, /* set */ #endif diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index b6977f6ece85..d8cdce0539af 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -596,9 +596,6 @@ static void rtw_init_default_value(struct adapter *padapter) /* security_priv */ /* rtw_get_encrypt_decrypt_from_registrypriv(padapter); */ psecuritypriv->binstallGrpkey = _FAIL; -#ifdef CONFIG_GTK_OL - psecuritypriv->binstallKCK_KEK = _FAIL; -#endif /* CONFIG_GTK_OL */ psecuritypriv->sw_encrypt = pregistrypriv->software_encrypt; psecuritypriv->sw_decrypt = pregistrypriv->software_decrypt; @@ -1174,16 +1171,10 @@ void rtw_dev_unload(struct adapter *padapter) if (!padapter->bSurpriseRemoved) { hal_btcoex_IpsNotify(padapter, pwrctl->ips_mode_req); -#ifdef CONFIG_WOWLAN - if (pwrctl->bSupportRemoteWakeup && pwrctl->wowlan_mode) { - DBG_871X_LEVEL(_drv_always_, "%s bSupportRemoteWakeup ==true do not run rtw_hal_deinit()\n", __func__); - } - else -#endif - { - /* amy modify 20120221 for power seq is different between driver open and ips */ - rtw_hal_deinit(padapter); - } + + /* amy modify 20120221 for power seq is different between driver open and ips */ + rtw_hal_deinit(padapter); + padapter->bSurpriseRemoved = true; } RT_TRACE(_module_hci_intfs_c_, _drv_notice_, @@ -1244,81 +1235,6 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) return _SUCCESS; } -#ifdef CONFIG_WOWLAN -void rtw_suspend_wow(struct adapter *padapter) -{ - u8 ch, bw, offset; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct net_device *pnetdev = padapter->pnetdev; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct wowlan_ioctl_param poidparam; - - DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); - - - DBG_871X("wowlan_mode: %d\n", pwrpriv->wowlan_mode); - DBG_871X("wowlan_pno_enable: %d\n", pwrpriv->wowlan_pno_enable); - - if (pwrpriv->wowlan_mode) { - if (pnetdev) - rtw_netif_stop_queue(pnetdev); - /* 1. stop thread */ - padapter->bDriverStopped = true; /* for stop thread */ - rtw_stop_drv_threads(padapter); - padapter->bDriverStopped = false; /* for 32k command */ - - /* 2. disable interrupt */ - if (padapter->intf_stop) - padapter->intf_stop(padapter); - - /* 2.1 clean interrupt */ - if (padapter->HalFunc.clear_interrupt) - padapter->HalFunc.clear_interrupt(padapter); - - /* 2.2 free irq */ - /* sdio_free_irq(adapter_to_dvobj(padapter)); */ - if (padapter->intf_free_irq) - padapter->intf_free_irq(adapter_to_dvobj(padapter)); - - poidparam.subcode = WOWLAN_ENABLE; - padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_WOWLAN, (u8 *)&poidparam); - if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) { - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)) { - DBG_871X("%s %s(%pM), length:%d assoc_ssid.length:%d\n", __func__, - pmlmepriv->cur_network.network.Ssid.Ssid, - MAC_ARG(pmlmepriv->cur_network.network.MacAddress), - pmlmepriv->cur_network.network.Ssid.SsidLength, - pmlmepriv->assoc_ssid.SsidLength); - - rtw_set_to_roam(padapter, 0); - } - } - - DBG_871X_LEVEL(_drv_always_, "%s: wowmode suspending\n", __func__); - - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) { - DBG_871X_LEVEL(_drv_always_, "%s: fw_under_survey\n", __func__); - rtw_indicate_scan_done(padapter, 1); - clr_fwstate(pmlmepriv, _FW_UNDER_SURVEY); - } - - if (rtw_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) { - DBG_871X(FUNC_ADPT_FMT " back to linked/linking union - ch:%u, bw:%u, offset:%u\n", - FUNC_ADPT_ARG(padapter), ch, bw, offset); - set_channel_bwmode(padapter, ch, offset, bw); - } - - if (pwrpriv->wowlan_pno_enable) - DBG_871X_LEVEL(_drv_always_, "%s: pno: %d\n", __func__, pwrpriv->wowlan_pno_enable); - else - rtw_set_ps_mode(padapter, PS_MODE_DTIM, 0, 0, "WOWLAN"); - } else { - DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode =%d\n", __func__, pwrpriv->wowlan_mode); - } - DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); -} -#endif /* ifdef CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN void rtw_suspend_ap_wow(struct adapter *padapter) { @@ -1440,20 +1356,7 @@ int rtw_suspend_common(struct adapter *padapter) rtw_ps_deny_cancel(padapter, PS_DENY_SUSPEND); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { - #ifdef CONFIG_WOWLAN - if (check_fwstate(pmlmepriv, _FW_LINKED)) - pwrpriv->wowlan_mode = true; - else if (pwrpriv->wowlan_pno_enable) - pwrpriv->wowlan_mode |= pwrpriv->wowlan_pno_enable; - - if (pwrpriv->wowlan_mode) - rtw_suspend_wow(padapter); - else - rtw_suspend_normal(padapter); - - #else /* CONFIG_WOWLAN */ rtw_suspend_normal(padapter); - #endif /* CONFIG_WOWLAN */ } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { #ifdef CONFIG_AP_WOWLAN rtw_suspend_ap_wow(padapter); @@ -1474,124 +1377,6 @@ int rtw_suspend_common(struct adapter *padapter) return ret; } -#ifdef CONFIG_WOWLAN -int rtw_resume_process_wow(struct adapter *padapter) -{ - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct net_device *pnetdev = padapter->pnetdev; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct dvobj_priv *psdpriv = padapter->dvobj; - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; - struct wowlan_ioctl_param poidparam; - struct sta_info *psta = NULL; - int ret = _SUCCESS; - - DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); - - if (padapter) { - pnetdev = padapter->pnetdev; - pwrpriv = adapter_to_pwrctl(padapter); - } else { - pdbgpriv->dbg_resume_error_cnt++; - ret = -1; - goto exit; - } - - if (padapter->bDriverStopped || padapter->bSurpriseRemoved) { - DBG_871X("%s pdapter %p bDriverStopped %d bSurpriseRemoved %d\n", - __func__, padapter, padapter->bDriverStopped, - padapter->bSurpriseRemoved); - goto exit; - } - - if (pwrpriv->wowlan_mode) { - rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN"); - - pwrpriv->bFwCurrentInPSMode = false; - - if (padapter->intf_stop) - padapter->intf_stop(padapter); - - if (padapter->HalFunc.clear_interrupt) - padapter->HalFunc.clear_interrupt(padapter); - - /* if (sdio_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS) { */ - if ((padapter->intf_alloc_irq) && (padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS)) { - ret = -1; - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("%s: sdio_alloc_irq Failed!!\n", __func__)); - goto exit; - } - - /* Disable WOW, set H2C command */ - poidparam.subcode = WOWLAN_DISABLE; - padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_WOWLAN, (u8 *)&poidparam); - - psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv)); - if (psta) - set_sta_rate(padapter, psta); - - padapter->bDriverStopped = false; - DBG_871X("%s: wowmode resuming, DriverStopped:%d\n", __func__, padapter->bDriverStopped); - rtw_start_drv_threads(padapter); - - if (padapter->intf_start) - padapter->intf_start(padapter); - - /* start netif queue */ - if (pnetdev) { - if (!rtw_netif_queue_stopped(pnetdev)) - rtw_netif_start_queue(pnetdev); - else - rtw_netif_wake_queue(pnetdev); - } - } else { - DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode =%d\n", __func__, pwrpriv->wowlan_mode); - } - - if (padapter->pid[1] != 0) { - DBG_871X("pid[1]:%d\n", padapter->pid[1]); - rtw_signal_process(padapter->pid[1], SIGUSR2); - } - - if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) { - if (pwrpriv->wowlan_wake_reason == FWDecisionDisconnect || - pwrpriv->wowlan_wake_reason == Rx_DisAssoc || - pwrpriv->wowlan_wake_reason == Rx_DeAuth) { - DBG_871X("%s: disconnect reason: %02x\n", __func__, - pwrpriv->wowlan_wake_reason); - rtw_indicate_disconnect(padapter); - - rtw_sta_media_status_rpt(padapter, - rtw_get_stainfo(&padapter->stapriv, - get_bssid(&padapter->mlmepriv)), 0); - - rtw_free_assoc_resources(padapter, 1); - pmlmeinfo->state = WIFI_FW_NULL_STATE; - - } else { - DBG_871X("%s: do roaming\n", __func__); - rtw_roaming(padapter, NULL); - } - } - - if (pwrpriv->wowlan_mode) { - pwrpriv->bips_processing = false; - _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); - } else { - DBG_871X_LEVEL(_drv_always_, "do not reset timer\n"); - } - - pwrpriv->wowlan_mode = false; - - /* clean driver side wake up reason. */ - pwrpriv->wowlan_wake_reason = 0; -exit: - DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); - return ret; -} -#endif /* ifdef CONFIG_WOWLAN */ - #ifdef CONFIG_AP_WOWLAN int rtw_resume_process_ap_wow(struct adapter *padapter) { @@ -1753,15 +1538,7 @@ int rtw_resume_common(struct adapter *padapter) DBG_871X("==> %s (%s:%d)\n", __func__, current->comm, current->pid); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { - #ifdef CONFIG_WOWLAN - if (pwrpriv->wowlan_mode) - rtw_resume_process_wow(padapter); - else - rtw_resume_process_normal(padapter); - #else rtw_resume_process_normal(padapter); - #endif - } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { #ifdef CONFIG_AP_WOWLAN rtw_resume_process_ap_wow(padapter); diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c index 079e75164f1e..8f8549eee23e 100644 --- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c +++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c @@ -377,11 +377,6 @@ static void rtw_sdio_if1_deinit(struct adapter *if1) rtw_cancel_all_timer(if1); -#ifdef CONFIG_WOWLAN - adapter_to_pwrctl(if1)->wowlan_mode = false; - DBG_871X_LEVEL(_drv_always_, "%s wowlan_mode:%d\n", __func__, adapter_to_pwrctl(if1)->wowlan_mode); -#endif /* CONFIG_WOWLAN */ - rtw_dev_unload(if1); DBG_871X("+r871xu_dev_remove, hw_init_completed =%d\n", if1->hw_init_completed); -- 2.20.1 From fabioaiuto83 at gmail.com Sun Mar 14 18:18:21 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Sun, 14 Mar 2021 19:18:21 +0100 Subject: [PATCH v2 0/4] staging: rtl8723bs: remove unused code blocks In-Reply-To: References: Message-ID: <20210314181820.GA1443@agape.jhs> On Sun, Mar 14, 2021 at 04:57:38PM +0100, Greg KH wrote: > On Fri, Mar 12, 2021 at 07:33:13PM +0100, Fabio Aiuto wrote: > > This patch set removes unused code blocks as required in TODO file: > > > > find and remove code blocks guarded by never set CONFIG_FOO defines > > > > Changes in v2: > > - modified sunject lines to make them unique > > - added a patch previously excluded (removal of > > CONFIG_PNO_SET_DEBUG code) > > > > Fabio Aiuto (4): > > staging: rtl8723bs: remove unused code blocks conditioned by never set > > CONFIG_PNO_SET_DEBUG > > staging: rtl8723bs: remove unused code blocks conditioned by never set > > CONFIG_PNO_SUPPORT > > staging: rtl8723bs: remove unused code blocks conditioned by never set > > CONFIG_WOWLAN > > staging: rtl8723bs: remove unused code blocks conditioned by never set > > CONFIG_TCP_CSUM_OFFLOAD_RX > > The first 2 patches here worked, the others did not apply to my tree due > to other changes from other developers. Can you please rebase them and > resend? > > thanks, > > greg k-h just sent, thank you, fabio From king at pemilra.fti.uajy.ac.id Fri Mar 12 02:08:48 2021 From: king at pemilra.fti.uajy.ac.id (IMF) Date: Fri, 12 Mar 2021 09:08:48 +0700 Subject: VERIFICATION AND APPROVAL OF YOUR PAYMENT FILE Message-ID: <91fd63b83d57e8437c914323289e4bd2@pemilra.fti.uajy.ac.id> INTERNATIONAL FUNDS TRANSFER / AUDIT UNIT UNITED NATION (WORLD BANK ASSISTED PROGRAMME) DIRECTORATE OF INTERNATIONAL PAYMENT AND TRANSFERS. Ref: WB/NF/UN/XX027. ATTN: BENEFICIARY: This is to inform you that the regional verification office has received your message concerning the approved list of the United Nation Records of Outstanding Funds which your NAME/PARTICULARS WAS DISCOVERED AS NEXT ON THE APPROVED LIST., I have been assigned to direct you on the transfer of US$12,500,000.00 (TWELVE MILLION FIVE HUNDRED THOUSAND DOLLARS)into your Bank account. Note: YOU ARE THEREFORE STRONGLY ADVISE TO STOP FURTHER COMMUNICATION WITH ANY OTHER BANK OR INSTITUTION REGARDING THIS MATTER, FOR THE OVERALL SAFETY OF YOU AND YOUR FUND, you are hereby required to fill up the below application form for payment to enable the paying bank make the transfer into your bank account immediately. PERSONAL INFORMATION'S First Name: Last Name: Gender: Age: Marital Status: Contact Address: Nationality: Occupation: Mobile phone No: Have a nice day, Looking forward to your E-mail. United nation Approval No;UN5685P, White HouseApproved No:WH44CV, Reference No.-35460021, Allocation No: 674632 Password No: 339331 , Pin Code No: 55674 Certificate of Merit Payment No : 103 , Released Code No: 0763; NOTE: PLEASE BASE ON THE PRESURE WE ARE HAVING IN MAKING SURE ALL BENEFICIARY RECEIVED THERE PAYMENT, WE WILL ADVICE YOU URGENTLY COMPLY WITH THE ABOVE INSTRUCTION TO AVOID THE CANCELLATION OF YOUR FUND. AS [1]A MATTER OF URGENCY I WILL ADVICE YOU HAVE ALL THE ABOVE INSTRUCTION FOLLOWED AND AS URGENT AS POSIBLE TO AVOID CANCELLATION AND USING YOUR FUND TO PAY OTHER WHO HAS COMPLIED BEST REGARD. ANDREW TWEEDIE DIRECTOR INTERNATIONAL MONETARY FUND. From am26111971 at gmail.com Sun Mar 14 23:58:31 2021 From: am26111971 at gmail.com (GB) Date: Sun, 14 Mar 2021 16:58:31 -0700 Subject: Business inquiries Message-ID: Hi, We are interested in petronazing?you.?Kindly revert to us for price negotiation and other modalitie Yours sincerely GB/PM From madhumithabiw at gmail.com Mon Mar 15 00:46:41 2021 From: madhumithabiw at gmail.com (Madhumitha Prabakaran) Date: Sun, 14 Mar 2021 19:46:41 -0500 Subject: [PATCH v2] staging: vt6655: Rename two dimensional array declaration Message-ID: <20210315004641.378933-1-madhumithabiw@gmail.com> Rename two dimensional array declaration to fix checkpatch warning: Avoid Camelcase and make the declaration more readable and understandable Signed-off-by: Madhumitha Prabakaran --- Changes in v2: Improve commit message --- drivers/staging/vt6655/baseband.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index 1aa675241599..d89163299172 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c @@ -52,7 +52,7 @@ /*--------------------- Static Variables --------------------------*/ #define CB_VT3253_INIT_FOR_RFMD 446 -static const unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = { +static const unsigned char by_vt3253_init_tab_rfmd[CB_VT3253_INIT_FOR_RFMD][2] = { {0x00, 0x30}, {0x01, 0x00}, {0x02, 0x00}, @@ -2002,8 +2002,8 @@ bool bb_vt3253_init(struct vnt_private *priv) if (by_local_id <= REV_ID_VT3253_A1) { for (ii = 0; ii < CB_VT3253_INIT_FOR_RFMD; ii++) result &= bb_write_embedded(priv, - byVT3253InitTab_RFMD[ii][0], - byVT3253InitTab_RFMD[ii][1]); + by_vt3253_init_tab_rfmd[ii][0], + by_vt3253_init_tab_rfmd[ii][1]); } else { for (ii = 0; ii < CB_VT3253B0_INIT_FOR_RFMD; ii++) -- 2.25.1 From maqianga at uniontech.com Mon Mar 15 01:56:59 2021 From: maqianga at uniontech.com (Qiang Ma) Date: Mon, 15 Mar 2021 09:56:59 +0800 Subject: [PATCH] Staging: rtl8723bs/core: fix space coding style issue Message-ID: <20210315015659.2402-1-maqianga@uniontech.com> Add one space around (on each side of) '*' binary operators. Signed-off-by: Qiang Ma --- drivers/staging/rtl8723bs/core/rtw_security.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c index a311595deafb..6d53c08b29d1 100644 --- a/drivers/staging/rtl8723bs/core/rtw_security.c +++ b/drivers/staging/rtl8723bs/core/rtw_security.c @@ -319,7 +319,7 @@ static u32 secmicgetuint32(u8 *p) u32 res = 0; for (i = 0; i < 4; i++) - res |= ((u32)(*p++)) << (8*i); + res |= ((u32)(*p++)) << (8 * i); return res; } -- 2.20.1 From maqianga at uniontech.com Mon Mar 15 03:08:13 2021 From: maqianga at uniontech.com (Qiang Ma) Date: Mon, 15 Mar 2021 11:08:13 +0800 Subject: [PATCH] staging: rtl8723bs: add spaces between operators Message-ID: <20210315030813.19445-1-maqianga@uniontech.com> Add spaces between operators for a better readability in function 'rtw_secgetmic'. Signed-off-by: Qiang Ma --- drivers/staging/rtl8723bs/core/rtw_security.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c index 6d53c08b29d1..3e576cbe4712 100644 --- a/drivers/staging/rtl8723bs/core/rtw_security.c +++ b/drivers/staging/rtl8723bs/core/rtw_security.c @@ -397,7 +397,7 @@ void rtw_secgetmic(struct mic_data *pmicdata, u8 *dst) rtw_secmicappendbyte(pmicdata, 0); /* The appendByte function has already computed the result. */ secmicputuint32(dst, pmicdata->L); - secmicputuint32(dst+4, pmicdata->R); + secmicputuint32(dst + 4, pmicdata->R); /* Reset to the empty message. */ secmicclear(pmicdata); } -- 2.20.1 From lkp at intel.com Mon Mar 15 03:54:14 2021 From: lkp at intel.com (kernel test robot) Date: Mon, 15 Mar 2021 11:54:14 +0800 Subject: [driver-core:debugfs_remove_return_value] BUILD SUCCESS 7a49a9e3b030ca76ddcbc3fa7012770fb25fa08c Message-ID: <604eda66.F0ZRpQXmv/Ih8BeH%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git debugfs_remove_return_value branch HEAD: 7a49a9e3b030ca76ddcbc3fa7012770fb25fa08c x86/tools/relocs: add __printf attribute to die() elapsed time: 720m configs tested: 126 configs skipped: 3 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 defconfig arm allyesconfig arm allmodconfig arm64 allyesconfig nios2 3c120_defconfig mips decstation_defconfig mips db1xxx_defconfig mips maltaup_defconfig powerpc makalu_defconfig arm alldefconfig mips tb0287_defconfig powerpc mpc8272_ads_defconfig arm realview_defconfig arm tegra_defconfig sh migor_defconfig powerpc pmac32_defconfig sh rts7751r2d1_defconfig arm moxart_defconfig arm iop32x_defconfig arm versatile_defconfig arm vt8500_v6_v7_defconfig arm aspeed_g4_defconfig arm bcm2835_defconfig powerpc ppc40x_defconfig powerpc mpc512x_defconfig arm integrator_defconfig sh titan_defconfig m68k sun3x_defconfig mips jmr3927_defconfig sh ecovec24_defconfig arc axs103_smp_defconfig mips rs90_defconfig h8300 h8300h-sim_defconfig arm qcom_defconfig ia64 defconfig mips gpr_defconfig mips decstation_64_defconfig openrisc alldefconfig powerpc ep88xc_defconfig mips fuloong2e_defconfig powerpc taishan_defconfig powerpc gamecube_defconfig sh magicpanelr2_defconfig parisc defconfig openrisc defconfig powerpc storcenter_defconfig csky defconfig microblaze mmu_defconfig mips ip22_defconfig mips malta_kvm_guest_defconfig sh se7712_defconfig arc nsimosci_hs_defconfig ia64 allmodconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig nds32 defconfig nios2 allyesconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig s390 allyesconfig parisc allyesconfig s390 defconfig s390 allmodconfig i386 allyesconfig sparc allyesconfig sparc defconfig i386 tinyconfig i386 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a001-20210314 i386 randconfig-a005-20210314 i386 randconfig-a003-20210314 i386 randconfig-a002-20210314 i386 randconfig-a004-20210314 i386 randconfig-a006-20210314 x86_64 randconfig-a011-20210314 x86_64 randconfig-a016-20210314 x86_64 randconfig-a013-20210314 x86_64 randconfig-a015-20210314 x86_64 randconfig-a014-20210314 x86_64 randconfig-a012-20210314 i386 randconfig-a013-20210314 i386 randconfig-a016-20210314 i386 randconfig-a011-20210314 i386 randconfig-a012-20210314 i386 randconfig-a014-20210314 i386 randconfig-a015-20210314 i386 randconfig-a013-20210315 i386 randconfig-a016-20210315 i386 randconfig-a011-20210315 i386 randconfig-a012-20210315 i386 randconfig-a014-20210315 i386 randconfig-a015-20210315 riscv nommu_k210_defconfig riscv allyesconfig riscv nommu_virt_defconfig riscv allnoconfig riscv defconfig riscv rv32_defconfig riscv allmodconfig x86_64 allyesconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a006-20210314 x86_64 randconfig-a001-20210314 x86_64 randconfig-a005-20210314 x86_64 randconfig-a004-20210314 x86_64 randconfig-a002-20210314 x86_64 randconfig-a003-20210314 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From lkp at intel.com Mon Mar 15 04:27:00 2021 From: lkp at intel.com (kernel test robot) Date: Mon, 15 Mar 2021 12:27:00 +0800 Subject: [staging:staging-testing] BUILD SUCCESS 0ba8b68b5b30ad3cba7ed8b6323ff6a127017ff4 Message-ID: <604ee214.s7pUm3KCOD9v2xmC%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-testing branch HEAD: 0ba8b68b5b30ad3cba7ed8b6323ff6a127017ff4 Staging: rtl8723bs: fixed a brace coding style elapsed time: 722m configs tested: 103 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 defconfig arm allyesconfig arm allmodconfig arm64 allyesconfig nios2 3c120_defconfig mips decstation_defconfig mips db1xxx_defconfig mips maltaup_defconfig powerpc makalu_defconfig arm alldefconfig mips tb0287_defconfig powerpc mpc8272_ads_defconfig arm realview_defconfig arm tegra_defconfig sh migor_defconfig powerpc pmac32_defconfig powerpc motionpro_defconfig nds32 allnoconfig powerpc sbc8548_defconfig powerpc eiger_defconfig riscv allmodconfig arc axs103_smp_defconfig mips rs90_defconfig h8300 h8300h-sim_defconfig arm zeus_defconfig x86_64 alldefconfig arm vexpress_defconfig sh shmin_defconfig powerpc mpc7448_hpc2_defconfig powerpc mpc85xx_cds_defconfig mips malta_kvm_guest_defconfig sh rts7751r2d1_defconfig sh se7712_defconfig arc nsimosci_hs_defconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig i386 allyesconfig sparc allyesconfig sparc defconfig i386 tinyconfig i386 defconfig nios2 defconfig arc allyesconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a001-20210314 i386 randconfig-a005-20210314 i386 randconfig-a003-20210314 i386 randconfig-a002-20210314 i386 randconfig-a004-20210314 i386 randconfig-a006-20210314 x86_64 randconfig-a011-20210314 x86_64 randconfig-a016-20210314 x86_64 randconfig-a013-20210314 x86_64 randconfig-a015-20210314 x86_64 randconfig-a014-20210314 x86_64 randconfig-a012-20210314 i386 randconfig-a013-20210314 i386 randconfig-a016-20210314 i386 randconfig-a011-20210314 i386 randconfig-a012-20210314 i386 randconfig-a014-20210314 i386 randconfig-a015-20210314 riscv nommu_k210_defconfig riscv allyesconfig riscv nommu_virt_defconfig riscv allnoconfig riscv defconfig riscv rv32_defconfig x86_64 allyesconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a006-20210314 x86_64 randconfig-a001-20210314 x86_64 randconfig-a005-20210314 x86_64 randconfig-a004-20210314 x86_64 randconfig-a002-20210314 x86_64 randconfig-a003-20210314 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From zhaoxiao at uniontech.com Mon Mar 15 06:12:02 2021 From: zhaoxiao at uniontech.com (zhaoxiao) Date: Mon, 15 Mar 2021 14:12:02 +0800 Subject: [PATCH] staging: rtl8192u: fixed no space coding style issue. Message-ID: <20210315061202.10219-1-zhaoxiao@uniontech.com> Added space around the binary operator for readability in r8192U_wx.c file Signed-off-by: zhaoxiao --- drivers/staging/rtl8192u/r8192U_wx.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index 5211b2005763..6ead461e3279 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -276,7 +276,7 @@ static int rtl8180_wx_get_range(struct net_device *dev, range->min_pmp = 0; range->max_pmp = 5000000; range->min_pmt = 0; - range->max_pmt = 65535*1000; + range->max_pmt = 65535 * 1000; range->pmp_flags = IW_POWER_PERIOD; range->pmt_flags = IW_POWER_TIMEOUT; range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R; @@ -519,14 +519,14 @@ static int r8192_wx_set_enc(struct net_device *dev, /* sometimes, the length is zero while we do not type key value */ if (wrqu->encoding.length != 0) { for (i = 0; i < 4; i++) { - hwkey[i] |= key[4*i+0]&mask; - if (i == 1 && (4*i+1) == wrqu->encoding.length) + hwkey[i] |= key[4 * i + 0] & mask; + if (i == 1 && (4 * i + 1) == wrqu->encoding.length) mask = 0x00; - if (i == 3 && (4*i+1) == wrqu->encoding.length) + if (i == 3 && (4 * i + 1) == wrqu->encoding.length) mask = 0x00; - hwkey[i] |= (key[4*i+1]&mask)<<8; - hwkey[i] |= (key[4*i+2]&mask)<<16; - hwkey[i] |= (key[4*i+3]&mask)<<24; + hwkey[i] |= (key[4 * i + 1] & mask) << 8; + hwkey[i] |= (key[4 * i + 2] & mask) << 16; + hwkey[i] |= (key[4 * i + 3] & mask) << 24; } #define CONF_WEP40 0x4 -- 2.20.1 From am26111971 at gmail.com Mon Mar 15 06:25:09 2021 From: am26111971 at gmail.com (GB) Date: Sun, 14 Mar 2021 23:25:09 -0700 Subject: Business inquiries Message-ID: Hi, We are interested in petronazing?you.?Kindly revert to us for price negotiation and other modalitie Yours sincerely GB/PM From am26111971 at gmail.com Mon Mar 15 06:25:09 2021 From: am26111971 at gmail.com (GB) Date: Sun, 14 Mar 2021 23:25:09 -0700 Subject: Business inquiries Message-ID: Hi, We are interested in petronazing?you.?Kindly revert to us for price negotiation and other modalitie Yours sincerely GB/PM From zhengxunli.mxic at gmail.com Mon Mar 15 07:07:20 2021 From: zhengxunli.mxic at gmail.com (Zhengxun Li) Date: Mon, 15 Mar 2021 15:07:20 +0800 Subject: [PATCH v10 5/9] staging: clocking-wizard: Add support for dynamic reconfiguration Message-ID: Hi Shubhrajyoti, My name is Zhengxun and I am the engineer from Macronix. We are using the platform PicoZed 7015/7030 SOM (System On Module), which is based on Xilinx Zynq?-7000 All Programmable (AP) SoC to verify our Flash driver. Of course, we are also using your clock wizard, our version seems to be v5.2, but something went wrong. +static int clk_wzrd_dynamic_reconfig(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) +{ + int err; + u32 value; + unsigned long flags = 0; + struct clk_wzrd_divider *divider = to_clk_wzrd_divider(hw); + void __iomem *div_addr = divider->base + divider->offset; + + if (divider->lock) + spin_lock_irqsave(divider->lock, flags); + else + __acquire(divider->lock); + + value = DIV_ROUND_CLOSEST(parent_rate, rate); + + /* Cap the value to max */ + min_t(u32, value, WZRD_DR_MAX_INT_DIV_VALUE); + + /* Set divisor and clear phase offset */ + writel(value, div_addr); + writel(0x00, div_addr + WZRD_DR_DIV_TO_PHASE_OFFSET); Why phase always set to zero? We want to support DTR operation in Flash driver. Can you add a set_phase function to adjust the phase? + /* Check status register */ + err = readl_poll_timeout(divider->base + WZRD_DR_STATUS_REG_OFFSET, + value, value & WZRD_DR_LOCK_BIT_MASK, + WZRD_USEC_POLL, WZRD_TIMEOUT_POLL); + if (err) + goto err_reconfig; + + /* Initiate reconfiguration */ + writel(WZRD_DR_BEGIN_DYNA_RECONF, + divider->base + WZRD_DR_INIT_REG_OFFSET); + + /* Check status register */ + err = readl_poll_timeout(divider->base + WZRD_DR_STATUS_REG_OFFSET, + value, value & WZRD_DR_LOCK_BIT_MASK, + WZRD_USEC_POLL, WZRD_TIMEOUT_POLL); According to pg015-clk-wiz.pdf, Clocking Wizard v5.2 and later, need to write 0x00000007 followed by 0x00000002 into Clock Configuration Register 23, to consolidate the redundant bits that the IP has upgraded, right? Can you compatible to v5.2? Thanks, Zhengxun From zhengxunli.mxic at gmail.com Mon Mar 15 07:25:26 2021 From: zhengxunli.mxic at gmail.com (Zhengxun Li) Date: Mon, 15 Mar 2021 15:25:26 +0800 Subject: [PATCH v10 6/9] staging: clocking-wizard: Add support for fractional support Message-ID: Hi Shubhrajyoti, +static int clk_wzrd_dynamic_reconfig_f(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) +{ + int err; + u32 value, pre; + unsigned long rate_div, f, clockout0_div; + struct clk_wzrd_divider *divider = to_clk_wzrd_divider(hw); + void __iomem *div_addr = divider->base + divider->offset; + + rate_div = ((parent_rate * 1000) / rate); In some cases, the variable seems to overflow. Thanks, Zhengxun From zhaoxiao at uniontech.com Mon Mar 15 07:27:59 2021 From: zhaoxiao at uniontech.com (zhaoxiao) Date: Mon, 15 Mar 2021 15:27:59 +0800 Subject: [PATCH] staging: rtl8192u: remove extra lines Message-ID: <20210315072759.23107-1-zhaoxiao@uniontech.com> Remove extra lines in many functions in r8192U_wx.c. Signed-off-by: zhaoxiao --- drivers/staging/rtl8192u/r8192U_wx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index 6ead461e3279..e68d37914456 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -879,7 +879,6 @@ static iw_handler r8192_wx_handlers[] = { static const struct iw_priv_args r8192_private_args[] = { - { SIOCIWFIRSTPRIV + 0x0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc" @@ -890,14 +889,15 @@ static const struct iw_priv_args r8192_private_args[] = { IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan" }, + { SIOCIWFIRSTPRIV + 0x2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx" }, + { SIOCIWFIRSTPRIV + 0x3, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset" - } }; -- 2.20.1 From gregkh at linuxfoundation.org Mon Mar 15 07:56:10 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Mon, 15 Mar 2021 08:56:10 +0100 Subject: [PATCH] staging: rtl8192u: remove extra lines In-Reply-To: <20210315072759.23107-1-zhaoxiao@uniontech.com> References: <20210315072759.23107-1-zhaoxiao@uniontech.com> Message-ID: On Mon, Mar 15, 2021 at 03:27:59PM +0800, zhaoxiao wrote: > Remove extra lines in many functions in r8192U_wx.c. > Signed-off-by: zhaoxiao You did mor than just remove extra lines :( Also we need an extra line right before your signed-off-by line, as checkpatch should have warned you about. Please fix up and resend. thanks, greg k-h From shubhrajyoti.datta at gmail.com Mon Mar 15 08:32:08 2021 From: shubhrajyoti.datta at gmail.com (Shubhrajyoti Datta) Date: Mon, 15 Mar 2021 14:02:08 +0530 Subject: [PATCH v10 5/9] staging: clocking-wizard: Add support for dynamic reconfiguration In-Reply-To: References: Message-ID: Hi Zhengxun, Thanks for the review. On Mon, Mar 15, 2021 at 12:37 PM Zhengxun Li wrote: > > Hi Shubhrajyoti, > > My name is Zhengxun and I am the engineer from Macronix. We are > using the platform PicoZed 7015/7030 SOM (System On Module), > which is based on Xilinx Zynq?-7000 All Programmable (AP) SoC to > verify our Flash driver. Of course, we are also using your clock > wizard, our version seems to be v5.2, but something went wrong. > > +static int clk_wzrd_dynamic_reconfig(struct clk_hw *hw, unsigned long rate, > + unsigned long parent_rate) > +{ > + int err; > + u32 value; > + unsigned long flags = 0; > + struct clk_wzrd_divider *divider = to_clk_wzrd_divider(hw); > + void __iomem *div_addr = divider->base + divider->offset; > + > + if (divider->lock) > + spin_lock_irqsave(divider->lock, flags); > + else > + __acquire(divider->lock); > + > + value = DIV_ROUND_CLOSEST(parent_rate, rate); > + > + /* Cap the value to max */ > + min_t(u32, value, WZRD_DR_MAX_INT_DIV_VALUE); > + > + /* Set divisor and clear phase offset */ > + writel(value, div_addr); > + writel(0x00, div_addr + WZRD_DR_DIV_TO_PHASE_OFFSET); > > Why phase always set to zero? We want to support DTR operation in > Flash driver. Can you add a set_phase function to adjust the phase? > > + /* Check status register */ > + err = readl_poll_timeout(divider->base + WZRD_DR_STATUS_REG_OFFSET, > + value, value & WZRD_DR_LOCK_BIT_MASK, > + WZRD_USEC_POLL, WZRD_TIMEOUT_POLL); > + if (err) > + goto err_reconfig; > + > + /* Initiate reconfiguration */ > + writel(WZRD_DR_BEGIN_DYNA_RECONF, > + divider->base + WZRD_DR_INIT_REG_OFFSET); > + > + /* Check status register */ > + err = readl_poll_timeout(divider->base + WZRD_DR_STATUS_REG_OFFSET, > + value, value & WZRD_DR_LOCK_BIT_MASK, > + WZRD_USEC_POLL, WZRD_TIMEOUT_POLL); > > According to pg015-clk-wiz.pdf, Clocking Wizard v5.2 and later, need to write > 0x00000007 followed by 0x00000002 into Clock Configuration Register 23, to > consolidate the redundant bits that the IP has upgraded, right? > > Can you compatible to v5.2? Will fix in the next version. > > Thanks, > Zhengxun From shubhrajyoti.datta at gmail.com Mon Mar 15 08:33:56 2021 From: shubhrajyoti.datta at gmail.com (Shubhrajyoti Datta) Date: Mon, 15 Mar 2021 14:03:56 +0530 Subject: [PATCH v10 6/9] staging: clocking-wizard: Add support for fractional support In-Reply-To: References: Message-ID: Hi Zhengxun, On Mon, Mar 15, 2021 at 12:55 PM Zhengxun Li wrote: > > Hi Shubhrajyoti, > > +static int clk_wzrd_dynamic_reconfig_f(struct clk_hw *hw, unsigned long rate, > + unsigned long parent_rate) > +{ > + int err; > + u32 value, pre; > + unsigned long rate_div, f, clockout0_div; > + struct clk_wzrd_divider *divider = to_clk_wzrd_divider(hw); > + void __iomem *div_addr = divider->base + divider->offset; > + > + rate_div = ((parent_rate * 1000) / rate); > > In some cases, the variable seems to overflow. Will fix in the next version. > > Thanks, > Zhengxun From chawora at econet.co.zw Sat Mar 13 23:29:01 2021 From: chawora at econet.co.zw (Reem E. A) Date: Sat, 13 Mar 2021 15:29:01 -0800 Subject: No subject Message-ID: <8bd610e62caf400783acd4309e54dad1@WVALE-CAS-SVR-9.econetzw.local> Hello, My name is Ms. Reem Ebrahim Al-Hashimi, I am the "Minister of state and Petroleum" also "Minister of State for International Cooperation" in UAE. I write to you on behalf of my other "three (2) colleagues" who has approved me to solicit for your "partnership in claiming of {us$47=Million}" from a Financial Home on their behalf and for our "Mutual Benefits". The Fund {us$47=Million} is our share from the (over-invoiced) Oil/Gas deal with Turkish Government within 2013/2014, however, we don't want our government to know about the fund. If this proposal interests you, let me know, by sending me an email and I will send to you detailed information on how this business would be successfully transacted. Be informed that nobody knows about the secret of this fund except us, and we know how to carry out the entire transaction. So I am compelled to ask, that you will stand on our behalf and receive this fund into any account that is solely controlled by you. We will compensate you with 15% of the total amount involved as gratification for being our partner in this transaction. Reply to: reem.alhashimi at yandex.com Regards, Ms. Reem. This mail was sent through Econet Wireless, a Global telecoms leader. DISCLAIMER The information in this message is confidential and is legally privileged. It is intended solely for the addressee. Access to this message by anyone else is unauthorized. If received in error please accept our apologies and notify the sender immediately. You must also delete the original message from your machine. If you are not the intended recipient, any use, disclosure, copying, distribution or action taken in reliance of it, is prohibited and may be unlawful. The information, attachments, opinions or advice contained in this email are not the views or opinions of Econet Wireless, its subsidiaries or affiliates. Econet Wireless therefore accepts no liability for claims, losses, or damages arising from the inaccuracy, incorrectness, or lack of integrity of such information. [https://mail.econet.co.zw/OWA/auth/current/themes/resources/Agile/AgileBanner.png] WORK ISN'T A PLACE IT'S WHAT WE DO ________________________________ [https://mail.econet.co.zw/OWA/auth/current/themes/resources/Agile/telephone.png] [https://mail.econet.co.zw/OWA/auth/current/themes/resources/Agile/email.png] [https://mail.econet.co.zw/OWA/auth/current/themes/resources/Agile/location.png] [https://mail.econet.co.zw/OWA/auth/current/themes/resources/Agile/website.png] www.econet.co.zw [https://mail.econet.co.zw/OWA/auth/current/themes/resources/Agile/inspired.jpg] From fabioaiuto83 at gmail.com Mon Mar 15 10:13:49 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:13:49 +0100 Subject: [PATCH 00/15] staging: rtl8723bs: remove unused code blocks Message-ID: Remove unused code blocks as required in TODO file Fabio Aiuto (15): staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_AUTO_AP_MODE staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_HW_PWRP_DETECTION staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_QOS_OPTIMIZATION staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_AP_WOWLAN staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_PM staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_SIGNAL_DISPLAY_DBM staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_BACKGROUND_NOISE_MONITOR staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_SKIP_SIGNAL_SCALE_MAPPING staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_GPIO_API staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_EXT_CLK staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_CHECK_BT_HANG staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_SDIO_TX_TASKLET staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_SW_CHANNEL_PLAN staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_C2H_PACKET_EN staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_ODM_ADAPTIVITY drivers/staging/rtl8723bs/core/rtw_ap.c | 4 - drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 - drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 250 ------------- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 35 -- drivers/staging/rtl8723bs/core/rtw_recv.c | 32 -- .../staging/rtl8723bs/core/rtw_wlan_util.c | 126 ------- drivers/staging/rtl8723bs/core/rtw_xmit.c | 5 - drivers/staging/rtl8723bs/hal/hal_com.c | 37 -- drivers/staging/rtl8723bs/hal/odm_HWConfig.c | 9 - drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 339 ------------------ drivers/staging/rtl8723bs/hal/rtl8723b_dm.c | 3 - .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 71 ---- .../staging/rtl8723bs/hal/rtl8723bs_xmit.c | 8 - drivers/staging/rtl8723bs/hal/sdio_halinit.c | 126 ------- drivers/staging/rtl8723bs/hal/sdio_ops.c | 37 -- drivers/staging/rtl8723bs/include/drv_types.h | 6 - .../rtl8723bs/include/drv_types_sdio.h | 5 - drivers/staging/rtl8723bs/include/hal_com.h | 10 - .../staging/rtl8723bs/include/hal_com_h2c.h | 30 -- drivers/staging/rtl8723bs/include/hal_data.h | 5 - drivers/staging/rtl8723bs/include/hal_intf.h | 3 - .../staging/rtl8723bs/include/osdep_service.h | 7 - .../staging/rtl8723bs/include/rtl8723b_cmd.h | 6 - .../staging/rtl8723bs/include/rtl8723b_hal.h | 11 - drivers/staging/rtl8723bs/include/rtw_mp.h | 3 - drivers/staging/rtl8723bs/include/rtw_recv.h | 5 - drivers/staging/rtl8723bs/include/rtw_xmit.h | 4 - drivers/staging/rtl8723bs/include/sdio_ops.h | 7 - drivers/staging/rtl8723bs/include/sta_info.h | 5 - .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 8 - .../staging/rtl8723bs/os_dep/ioctl_linux.c | 130 +------ drivers/staging/rtl8723bs/os_dep/os_intfs.c | 142 -------- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 41 --- 33 files changed, 1 insertion(+), 1512 deletions(-) -- 2.20.1 From fabioaiuto83 at gmail.com Mon Mar 15 10:14:13 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:14:13 +0100 Subject: [PATCH 01/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_AUTO_AP_MODE In-Reply-To: References: Message-ID: <342607e2b4ba2a19b367705a0b47cac95d601d44.1615801721.git.fabioaiuto83@gmail.com> remove conditional code blocks checked by unused CONFIG_AUTO_AP_MODE cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_ap.c | 4 - drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 - drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 238 ------------------ drivers/staging/rtl8723bs/core/rtw_recv.c | 32 --- drivers/staging/rtl8723bs/core/rtw_xmit.c | 5 - .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 3 - drivers/staging/rtl8723bs/include/sta_info.h | 5 - drivers/staging/rtl8723bs/os_dep/recv_linux.c | 41 --- 8 files changed, 331 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c index abb2a2299511..63b339484289 100644 --- a/drivers/staging/rtl8723bs/core/rtw_ap.c +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c @@ -270,10 +270,6 @@ void expire_timeout_chk(struct adapter *padapter) while (phead != plist) { psta = container_of(plist, struct sta_info, asoc_list); plist = get_next(plist); -#ifdef CONFIG_AUTO_AP_MODE - if (psta->isrc) - continue; -#endif if (chk_sta_is_alive(psta) || !psta->expire_to) { psta->expire_to = pstapriv->expire_to; psta->keep_alive_trycnt = 0; diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index 723187a78484..725f699abda9 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -1478,8 +1478,6 @@ void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf) rtw_sta_media_status_rpt(adapter, psta, 1); -#ifndef CONFIG_AUTO_AP_MODE - ap_sta_info_defer_update(adapter, psta); /* report to upper layer */ @@ -1503,7 +1501,6 @@ void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf) kfree(passoc_req); } -#endif /* CONFIG_AUTO_AP_MODE */ } return; } diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index 23362b39082b..0ca3ddfc8b08 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -619,115 +619,6 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame) /* DBG_871X("+OnProbeReq\n"); */ -#ifdef CONFIG_AUTO_AP_MODE - if (check_fwstate(pmlmepriv, _FW_LINKED) && - pmlmepriv->cur_network.join_res) { - struct sta_info *psta; - u8 *mac_addr, *peer_addr; - struct sta_priv *pstapriv = &padapter->stapriv; - u8 RC_OUI[4] = {0x00, 0xE0, 0x4C, 0x0A}; - /* EID[1] + EID_LEN[1] + RC_OUI[4] + MAC[6] + PairingID[2] + ChannelNum[2] */ - - p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + _PROBEREQ_IE_OFFSET_, WLAN_EID_VENDOR_SPECIFIC, (int *)&ielen, - len - WLAN_HDR_A3_LEN - _PROBEREQ_IE_OFFSET_); - - if (!p || ielen != 14) - goto _non_rc_device; - - if (memcmp(p+2, RC_OUI, sizeof(RC_OUI))) - goto _non_rc_device; - - if (memcmp(p+6, get_sa(pframe), ETH_ALEN)) { - DBG_871X("%s, do rc pairing (%pM), but mac addr mismatch!(%pM)\n", __func__, - MAC_ARG(get_sa(pframe)), MAC_ARG(p+6)); - - goto _non_rc_device; - } - - DBG_871X("%s, got the pairing device(%pM)\n", __func__, MAC_ARG(get_sa(pframe))); - - /* new a station */ - psta = rtw_get_stainfo(pstapriv, get_sa(pframe)); - if (psta == NULL) { - /* allocate a new one */ - DBG_871X("going to alloc stainfo for rc =%pM\n", MAC_ARG(get_sa(pframe))); - psta = rtw_alloc_stainfo(pstapriv, get_sa(pframe)); - if (!psta) { - /* TODO: */ - DBG_871X(" Exceed the upper limit of supported clients...\n"); - return _SUCCESS; - } - - spin_lock_bh(&pstapriv->asoc_list_lock); - if (list_empty(&psta->asoc_list)) { - psta->expire_to = pstapriv->expire_to; - list_add_tail(&psta->asoc_list, &pstapriv->asoc_list); - pstapriv->asoc_list_cnt++; - } - spin_unlock_bh(&pstapriv->asoc_list_lock); - - /* generate pairing ID */ - mac_addr = myid(&(padapter->eeprompriv)); - peer_addr = psta->hwaddr; - psta->pid = (u16)(((mac_addr[4]<<8) + mac_addr[5]) + ((peer_addr[4]<<8) + peer_addr[5])); - - /* update peer stainfo */ - psta->isrc = true; - /* psta->aid = 0; */ - /* psta->mac_id = 2; */ - - /* get a unique AID */ - if (psta->aid > 0) { - DBG_871X("old AID %d\n", psta->aid); - } else { - for (psta->aid = 1; psta->aid <= NUM_STA; psta->aid++) - if (pstapriv->sta_aid[psta->aid - 1] == NULL) - break; - - if (psta->aid > pstapriv->max_num_sta) { - psta->aid = 0; - DBG_871X("no room for more AIDs\n"); - return _SUCCESS; - } - pstapriv->sta_aid[psta->aid - 1] = psta; - DBG_871X("allocate new AID = (%d)\n", psta->aid); - } - - psta->qos_option = 1; - psta->bw_mode = CHANNEL_WIDTH_20; - psta->ieee8021x_blocked = false; - psta->htpriv.ht_option = true; - psta->htpriv.ampdu_enable = false; - psta->htpriv.sgi_20m = false; - psta->htpriv.sgi_40m = false; - psta->htpriv.ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - psta->htpriv.agg_enable_bitmap = 0x0;/* reset */ - psta->htpriv.candidate_tid_bitmap = 0x0;/* reset */ - - rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, true); - - memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats)); - - spin_lock_bh(&psta->lock); - psta->state |= _FW_LINKED; - spin_unlock_bh(&psta->lock); - - report_add_sta_event(padapter, psta->hwaddr, psta->aid); - - } - - issue_probersp(padapter, get_sa(pframe), false); - - return _SUCCESS; - - } - -_non_rc_device: - - return _SUCCESS; - -#endif /* CONFIG_AUTO_AP_MODE */ - p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + _PROBEREQ_IE_OFFSET_, WLAN_EID_SSID, (int *)&ielen, len - WLAN_HDR_A3_LEN - _PROBEREQ_IE_OFFSET_); @@ -2771,36 +2662,6 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p } -#ifdef CONFIG_AUTO_AP_MODE -{ - struct sta_info *psta; - struct sta_priv *pstapriv = &padapter->stapriv; - - DBG_871X("(%s)\n", __func__); - - /* check rc station */ - psta = rtw_get_stainfo(pstapriv, da); - if (psta && psta->isrc && psta->pid > 0) { - u8 RC_OUI[4] = {0x00, 0xE0, 0x4C, 0x0A}; - u8 RC_INFO[14] = {0}; - /* EID[1] + EID_LEN[1] + RC_OUI[4] + MAC[6] + PairingID[2] + ChannelNum[2] */ - u16 cu_ch = (u16)cur_network->Configuration.DSConfig; - - DBG_871X("%s, reply rc(pid = 0x%x) device %pM in ch =%d\n", __func__, - psta->pid, MAC_ARG(psta->hwaddr), cu_ch); - - /* append vendor specific ie */ - memcpy(RC_INFO, RC_OUI, sizeof(RC_OUI)); - memcpy(&RC_INFO[4], mac, ETH_ALEN); - memcpy(&RC_INFO[10], (u8 *)&psta->pid, 2); - memcpy(&RC_INFO[12], (u8 *)&cu_ch, 2); - - pframe = rtw_set_ie(pframe, WLAN_EID_VENDOR_SPECIFIC, sizeof(RC_INFO), RC_INFO, &pattrib->pktlen); - } -} -#endif /* CONFIG_AUTO_AP_MODE */ - - pattrib->last_txcmdsz = pattrib->pktlen; @@ -5912,99 +5773,6 @@ u8 NULL_hdl(struct adapter *padapter, u8 *pbuf) return H2C_SUCCESS; } -#ifdef CONFIG_AUTO_AP_MODE -static int rtw_auto_ap_start_beacon(struct adapter *adapter) -{ - int ret = 0; - u8 *pbuf = NULL; - uint len; - u8 supportRate[16]; - int sz = 0, rateLen; - u8 *ie; - u8 wireless_mode, oper_channel; - u8 ssid[3] = {0}; /* hidden ssid */ - u32 ssid_len = sizeof(ssid); - struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); - - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return -EINVAL; - - - len = 128; - pbuf = rtw_zmalloc(len); - if (!pbuf) - return -ENOMEM; - - - /* generate beacon */ - ie = pbuf; - - /* timestamp will be inserted by hardware */ - sz += 8; - ie += sz; - - /* beacon interval : 2bytes */ - *(u16 *)ie = cpu_to_le16((u16)100);/* BCN_INTERVAL = 100; */ - sz += 2; - ie += 2; - - /* capability info */ - *(u16 *)ie = 0; - *(u16 *)ie |= cpu_to_le16(WLAN_CAPABILITY_ESS); - *(u16 *)ie |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE); - /* u16*)ie |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); */ - sz += 2; - ie += 2; - - /* SSID */ - ie = rtw_set_ie(ie, WLAN_EID_SSID, ssid_len, ssid, &sz); - - /* supported rates */ - wireless_mode = WIRELESS_11BG_24N; - rtw_set_supported_rate(supportRate, wireless_mode); - rateLen = rtw_get_rateset_len(supportRate); - if (rateLen > 8) { - ie = rtw_set_ie(ie, WLAN_EID_SUPP_RATES, 8, supportRate, &sz); - } else { - ie = rtw_set_ie(ie, WLAN_EID_SUPP_RATES, rateLen, supportRate, &sz); - } - - - /* DS parameter set */ - if (check_buddy_fwstate(adapter, _FW_LINKED) && - check_buddy_fwstate(adapter, WIFI_STATION_STATE)) { - struct adapter *pbuddystruct adapter = adapter->pbuddystruct adapter; - struct mlme_ext_priv *pbuddy_mlmeext = &pbuddystruct adapter->mlmeextpriv; - - oper_channel = pbuddy_mlmeext->cur_channel; - } else { - oper_channel = adapter_to_dvobj(adapter)->oper_channel; - } - ie = rtw_set_ie(ie, WLAN_EID_DS_PARAMS, 1, &oper_channel, &sz); - - /* ext supported rates */ - if (rateLen > 8) { - ie = rtw_set_ie(ie, WLAN_EID_EXT_SUPP_RATES, (rateLen - 8), (supportRate + 8), &sz); - } - - DBG_871X("%s, start auto ap beacon sz =%d\n", __func__, sz); - - /* lunch ap mode & start to issue beacon */ - if (rtw_check_beacon_data(adapter, pbuf, sz) == _SUCCESS) { - - } else { - ret = -EINVAL; - } - - - kfree(pbuf); - - return ret; - -} -#endif/* CONFIG_AUTO_AP_MODE */ - u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf) { u8 type; @@ -6029,12 +5797,6 @@ u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf) rtw_hal_set_hwreg(padapter, HW_VAR_SET_OPMODE, (u8 *)(&type)); /* Set_MSR(padapter, type); */ - -#ifdef CONFIG_AUTO_AP_MODE - if (psetop->mode == Ndis802_11APMode) - rtw_auto_ap_start_beacon(padapter); -#endif - if (psetop->mode == Ndis802_11APMode) { /* Do this after port switch to */ /* prevent from downloading rsvd page to wrong port */ diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c index 697da6834810..1fa381663b4c 100644 --- a/drivers/staging/rtl8723bs/core/rtw_recv.c +++ b/drivers/staging/rtl8723bs/core/rtw_recv.c @@ -1600,38 +1600,6 @@ signed int wlanhdr_to_ethhdr(union recv_frame *precvframe) eth_type = ntohs(be_tmp); /* pattrib->ether_type */ pattrib->eth_type = eth_type; -#ifdef CONFIG_AUTO_AP_MODE - if (0x8899 == pattrib->eth_type) { - struct sta_info *psta = precvframe->u.hdr.psta; - - DBG_871X("wlan rx: got eth_type = 0x%x\n", pattrib->eth_type); - - if (psta && psta->isrc && psta->pid > 0) { - u16 rx_pid; - - rx_pid = *(u16 *)(ptr+rmv_len+2); - - DBG_871X("wlan rx(pid = 0x%x): sta(%pM) pid = 0x%x\n", - rx_pid, MAC_ARG(psta->hwaddr), psta->pid); - - if (rx_pid == psta->pid) { - int i; - u16 len = *(u16 *)(ptr+rmv_len+4); - /* u16 ctrl_type = *(u16*)(ptr+rmv_len+6); */ - - /* DBG_871X("RC: len = 0x%x, ctrl_type = 0x%x\n", len, ctrl_type); */ - DBG_871X("RC: len = 0x%x\n", len); - - for (i = 0; i < len ; i++) - DBG_871X("0x%x\n", *(ptr+rmv_len+6+i)); - /* DBG_871X("0x%x\n", *(ptr+rmv_len+8+i)); */ - - DBG_871X("RC-end\n"); - } - } - } -#endif /* CONFIG_AUTO_AP_MODE */ - if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true)) { ptr += rmv_len; *ptr = 0x87; diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c index 9d45484acdeb..2daf5c461a4d 100644 --- a/drivers/staging/rtl8723bs/core/rtw_xmit.c +++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c @@ -467,11 +467,6 @@ static void update_attrib_phy_info(struct adapter *padapter, struct pkt_attrib * pattrib->ampdu_spacing = psta->htpriv.rx_ampdu_min_spacing; pattrib->retry_ctrl = false; - -#ifdef CONFIG_AUTO_AP_MODE - if (psta->isrc && psta->pid > 0) - pattrib->pctrl = true; -#endif } static s32 update_attrib_sec_info(struct adapter *padapter, struct pkt_attrib *pattrib, struct sta_info *psta) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 618b40ede2e4..49085525de05 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -3079,9 +3079,6 @@ static void rtl8723b_fill_default_txdesc( (pattrib->ether_type != 0x88B4) && (pattrib->dhcp_pkt != 1) && (drv_userate != 1) -#ifdef CONFIG_AUTO_AP_MODE - && (!pattrib->pctrl) -#endif ) { /* Non EAP & ARP & DHCP type data packet */ diff --git a/drivers/staging/rtl8723bs/include/sta_info.h b/drivers/staging/rtl8723bs/include/sta_info.h index 78a9091661a5..33e6e00c126d 100644 --- a/drivers/staging/rtl8723bs/include/sta_info.h +++ b/drivers/staging/rtl8723bs/include/sta_info.h @@ -182,11 +182,6 @@ struct sta_info { u8 keep_alive_trycnt; -#ifdef CONFIG_AUTO_AP_MODE - u8 isrc; /* this device is rc */ - u16 pid; /* pairing id */ -#endif - u8 *passoc_req; u32 assoc_req_len; diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c index a4a1b34281c3..fbdbcd04d44a 100644 --- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c @@ -190,39 +190,6 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup) wrqu.data.length = sizeof(ev); } -#ifdef CONFIG_AUTO_AP_MODE -static void rtw_os_ksocket_send(struct adapter *padapter, union recv_frame *precv_frame) -{ - struct sk_buff *skb = precv_frame->u.hdr.pkt; - struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; - struct sta_info *psta = precv_frame->u.hdr.psta; - - DBG_871X("eth rx: got eth_type = 0x%x\n", pattrib->eth_type); - - if (psta && psta->isrc && psta->pid > 0) { - u16 rx_pid; - - rx_pid = *(u16 *)(skb->data+ETH_HLEN); - - DBG_871X("eth rx(pid = 0x%x): sta(%pM) pid = 0x%x\n", - rx_pid, MAC_ARG(psta->hwaddr), psta->pid); - - if (rx_pid == psta->pid) { - int i; - u16 len = *(u16 *)(skb->data+ETH_HLEN+2); - DBG_871X("eth, RC: len = 0x%x\n", len); - - for (i = 0; i < len; i++) - DBG_871X("0x%x\n", *(skb->data+ETH_HLEN+4+i)); - - DBG_871X("eth, RC-end\n"); - } - - } - -} -#endif /* CONFIG_AUTO_AP_MODE */ - int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame) { struct recv_priv *precvpriv; @@ -251,14 +218,6 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame RT_TRACE(_module_recv_osdep_c_, _drv_info_, ("\n skb->head =%p skb->data =%p skb->tail =%p skb->end =%p skb->len =%d\n", skb->head, skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), skb->len)); -#ifdef CONFIG_AUTO_AP_MODE - if (0x8899 == pattrib->eth_type) { - rtw_os_ksocket_send(padapter, precv_frame); - - /* goto _recv_indicatepkt_drop; */ - } -#endif /* CONFIG_AUTO_AP_MODE */ - rtw_os_recv_indicate_pkt(padapter, skb, pattrib); /* pointers to NULL before rtw_free_recvframe() */ -- 2.20.1 From fabioaiuto83 at gmail.com Mon Mar 15 10:14:25 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:14:25 +0100 Subject: [PATCH 02/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_HW_PWRP_DETECTION In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_HW_PWRP_DETECTION cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index d8cdce0539af..d643e9a59e6b 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -113,11 +113,7 @@ static int rtw_enusbss;/* 0:disable, 1:enable */ static int rtw_hwpdn_mode = 2;/* 0:disable, 1:enable, 2: by EFUSE config */ -#ifdef CONFIG_HW_PWRP_DETECTION -static int rtw_hwpwrp_detect = 1; -#else static int rtw_hwpwrp_detect; /* HW power ping detect 0:disable , 1:enable */ -#endif static int rtw_hw_wps_pbc; -- 2.20.1 From fabioaiuto83 at gmail.com Mon Mar 15 10:14:38 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:14:38 +0100 Subject: [PATCH 03/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_QOS_OPTIMIZATION In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_QOS_OPTIMIZATION cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index d643e9a59e6b..270f93e90e07 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -121,11 +121,7 @@ int rtw_mc2u_disable = 0; static int rtw_80211d; -#ifdef CONFIG_QOS_OPTIMIZATION -static int rtw_qos_opt_enable = 1;/* 0: disable, 1:enable */ -#else static int rtw_qos_opt_enable;/* 0: disable, 1:enable */ -#endif module_param(rtw_qos_opt_enable, int, 0644); static char *ifname = "wlan%d"; -- 2.20.1 From fabioaiuto83 at gmail.com Mon Mar 15 10:14:49 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:14:49 +0100 Subject: [PATCH 04/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_AP_WOWLAN In-Reply-To: References: Message-ID: <19753137ed1d82a8b42429c8609684bdacb6ff8a.1615801721.git.fabioaiuto83@gmail.com> remove conditional code blocks checked by unused CONFIG_AP_WOWLAN cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 35 -- .../staging/rtl8723bs/core/rtw_wlan_util.c | 31 -- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 339 ------------------ .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 33 -- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 105 ------ drivers/staging/rtl8723bs/hal/sdio_ops.c | 35 -- .../rtl8723bs/include/drv_types_sdio.h | 5 - .../staging/rtl8723bs/include/hal_com_h2c.h | 30 -- drivers/staging/rtl8723bs/include/hal_intf.h | 3 - .../staging/rtl8723bs/include/osdep_service.h | 7 - .../staging/rtl8723bs/include/rtl8723b_cmd.h | 6 - .../staging/rtl8723bs/include/rtl8723b_hal.h | 4 - drivers/staging/rtl8723bs/include/rtw_mp.h | 3 - drivers/staging/rtl8723bs/include/sdio_ops.h | 7 - .../staging/rtl8723bs/os_dep/ioctl_linux.c | 4 - drivers/staging/rtl8723bs/os_dep/os_intfs.c | 134 ------- 16 files changed, 781 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index 2e6c522b74e3..b942cf49cd27 100644 --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c @@ -350,17 +350,8 @@ static u8 PS_RDY_CHECK(struct adapter *padapter) struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); -#ifdef CONFIG_AP_WOWLAN - if (pwrpriv->bInSuspend && pwrpriv->wowlan_mode) - return true; - else if (pwrpriv->bInSuspend && pwrpriv->wowlan_ap_mode) - return true; - else if (pwrpriv->bInSuspend) - return false; -#else if (pwrpriv->bInSuspend) return false; -#endif curr_time = jiffies; @@ -391,9 +382,6 @@ static u8 PS_RDY_CHECK(struct adapter *padapter) void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode, const char *msg) { struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); -#ifdef CONFIG_AP_WOWLAN - struct debug_priv *pdbgpriv = &padapter->dvobj->drv_dbg; -#endif RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_notice_, ("%s: PowerMode =%d Smart_PS =%d\n", @@ -422,29 +410,6 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a pwrpriv->pwr_mode = ps_mode; rtw_set_rpwm(padapter, PS_STATE_S4); -#ifdef CONFIG_AP_WOWLAN - if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode) { - unsigned long start_time; - u32 delay_ms; - u8 val8; - delay_ms = 20; - start_time = jiffies; - do { - rtw_hal_get_hwreg(padapter, HW_VAR_SYS_CLKR, &val8); - if (!(val8 & BIT(4))) { /* 0x08 bit4 = 1 --> in 32k, bit4 = 0 --> leave 32k */ - pwrpriv->cpwm = PS_STATE_S4; - break; - } - if (jiffies_to_msecs(jiffies - start_time) > delay_ms) { - DBG_871X("%s: Wait for FW 32K leave more than %u ms!!!\n", - __func__, delay_ms); - pdbgpriv->dbg_wow_leave_ps_fail_cnt++; - break; - } - msleep(1); - } while (1); - } -#endif rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&ps_mode)); pwrpriv->bFwCurrentInPSMode = false; diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index 355e43c4cf9a..d04514d36b49 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -10,10 +10,6 @@ #include #include -#ifdef CONFIG_AP_WOWLAN -#include -#endif - static unsigned char ARTHEROS_OUI1[] = {0x00, 0x03, 0x7f}; static unsigned char ARTHEROS_OUI2[] = {0x00, 0x13, 0x74}; @@ -2113,30 +2109,3 @@ int rtw_config_gpio(struct net_device *netdev, int gpio_num, bool isOutput) EXPORT_SYMBOL(rtw_config_gpio); #endif -#ifdef CONFIG_AP_WOWLAN -void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip) -{ - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct in_device *my_ip_ptr = padapter->pnetdev->ip_ptr; - u8 ipaddress[4]; - - if ((pmlmeinfo->state & WIFI_FW_LINKING_STATE) || - pmlmeinfo->state & WIFI_FW_AP_STATE) { - if (my_ip_ptr) { - struct in_ifaddr *my_ifa_list = my_ip_ptr->ifa_list; - - if (my_ifa_list) { - ipaddress[0] = my_ifa_list->ifa_address & 0xFF; - ipaddress[1] = (my_ifa_list->ifa_address >> 8) & 0xFF; - ipaddress[2] = (my_ifa_list->ifa_address >> 16) & 0xFF; - ipaddress[3] = my_ifa_list->ifa_address >> 24; - DBG_871X("%s: %d.%d.%d.%d ==========\n", __func__, - ipaddress[0], ipaddress[1], ipaddress[2], ipaddress[3]); - memcpy(pcurrentip, ipaddress, 4); - } - } - } -} -#endif - diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index 61fd643c244f..11e7a7121f30 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -312,119 +312,6 @@ static void ConstructNullFunctionData( *pLength = pktlen; } -#ifdef CONFIG_AP_WOWLAN -static void ConstructProbeRsp(struct adapter *padapter, u8 *pframe, u32 *pLength, u8 *StaAddr, bool bHideSSID) -{ - struct ieee80211_hdr *pwlanhdr; - u16 *fctrl; - u8 *mac, *bssid; - u32 pktlen; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); - u8 *pwps_ie; - uint wps_ielen; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - - /* DBG_871X("%s\n", __func__); */ - - pwlanhdr = (struct ieee80211_hdr *)pframe; - - mac = myid(&(padapter->eeprompriv)); - bssid = cur_network->MacAddress; - - fctrl = &(pwlanhdr->frame_control); - *(fctrl) = 0; - memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); - memcpy(pwlanhdr->addr2, mac, ETH_ALEN); - memcpy(pwlanhdr->addr3, bssid, ETH_ALEN); - - DBG_871X("%s FW Mac Addr:%pM\n", __func__, MAC_ARG(mac)); - DBG_871X("%s FW IP Addr:%pI4\n", __func__, IP_ARG(StaAddr)); - - SetSeqNum(pwlanhdr, 0); - SetFrameSubType(fctrl, WIFI_PROBERSP); - - pktlen = sizeof(struct ieee80211_hdr_3addr); - pframe += pktlen; - - if (cur_network->IELength > MAX_IE_SZ) - return; - - pwps_ie = rtw_get_wps_ie(cur_network->IEs+_FIXED_IE_LENGTH_, - cur_network->IELength-_FIXED_IE_LENGTH_, NULL, &wps_ielen); - - /* inerset & update wps_probe_resp_ie */ - if (pmlmepriv->wps_probe_resp_ie && pwps_ie && (wps_ielen > 0)) { - uint wps_offset, remainder_ielen; - u8 *premainder_ie; - - wps_offset = (uint)(pwps_ie - cur_network->IEs); - - premainder_ie = pwps_ie + wps_ielen; - - remainder_ielen = cur_network->IELength - wps_offset - wps_ielen; - - memcpy(pframe, cur_network->IEs, wps_offset); - pframe += wps_offset; - pktlen += wps_offset; - - wps_ielen = (uint)pmlmepriv->wps_probe_resp_ie[1];/* to get ie data len */ - if ((wps_offset+wps_ielen+2) <= MAX_IE_SZ) { - memcpy(pframe, pmlmepriv->wps_probe_resp_ie, wps_ielen+2); - pframe += wps_ielen+2; - pktlen += wps_ielen+2; - } - - if ((wps_offset+wps_ielen+2+remainder_ielen) <= MAX_IE_SZ) { - memcpy(pframe, premainder_ie, remainder_ielen); - pframe += remainder_ielen; - pktlen += remainder_ielen; - } - } else { - memcpy(pframe, cur_network->IEs, cur_network->IELength); - pframe += cur_network->IELength; - pktlen += cur_network->IELength; - } - - /* retrieve SSID IE from cur_network->Ssid */ - { - u8 *ssid_ie; - signed int ssid_ielen; - signed int ssid_ielen_diff; - u8 buf[MAX_IE_SZ]; - u8 *ies = pframe + sizeof(struct ieee80211_hdr_3addr); - - ssid_ie = rtw_get_ie(ies+_FIXED_IE_LENGTH_, WLAN_EID_SSID, &ssid_ielen, - (pframe-ies)-_FIXED_IE_LENGTH_); - - ssid_ielen_diff = cur_network->Ssid.SsidLength - ssid_ielen; - - if (ssid_ie && cur_network->Ssid.SsidLength) { - uint remainder_ielen; - u8 *remainder_ie; - remainder_ie = ssid_ie+2; - remainder_ielen = (pframe-remainder_ie); - - if (remainder_ielen > MAX_IE_SZ) { - DBG_871X_LEVEL(_drv_warning_, FUNC_ADPT_FMT" remainder_ielen > MAX_IE_SZ\n", FUNC_ADPT_ARG(padapter)); - remainder_ielen = MAX_IE_SZ; - } - - memcpy(buf, remainder_ie, remainder_ielen); - memcpy(remainder_ie+ssid_ielen_diff, buf, remainder_ielen); - *(ssid_ie+1) = cur_network->Ssid.SsidLength; - memcpy(ssid_ie+2, cur_network->Ssid.Ssid, cur_network->Ssid.SsidLength); - pframe += ssid_ielen_diff; - pktlen += ssid_ielen_diff; - } - } - - *pLength = pktlen; - -} -#endif /* CONFIG_AP_WOWLAN */ - /* * To check if reserved page content is destroyed by beacon because beacon * is too large. @@ -457,42 +344,6 @@ static void rtl8723b_set_FwAoacRsvdPage_cmd(struct adapter *padapter, struct RSV { } -#ifdef CONFIG_AP_WOWLAN -static void rtl8723b_set_ap_wow_rsvdpage_cmd( - struct adapter *padapter, struct RSVDPAGE_LOC *rsvdpageloc -) -{ - u8 header; - u8 rsvdparm[H2C_AOAC_RSVDPAGE_LOC_LEN] = {0}; - - header = rtw_read8(padapter, REG_BCNQ_BDNY); - - DBG_871X("%s: beacon: %d, probeRsp: %d, header:0x%02x\n", __func__, - rsvdpageloc->LocApOffloadBCN, - rsvdpageloc->LocProbeRsp, - header); - - SET_H2CCMD_AP_WOWLAN_RSVDPAGE_LOC_BCN(rsvdparm, - rsvdpageloc->LocApOffloadBCN + header); - - FillH2CCmd8723B(padapter, H2C_8723B_BCN_RSVDPAGE, - H2C_BCN_RSVDPAGE_LEN, rsvdparm); - - msleep(10); - - memset(&rsvdparm, 0, sizeof(rsvdparm)); - - SET_H2CCMD_AP_WOWLAN_RSVDPAGE_LOC_ProbeRsp( - rsvdparm, - rsvdpageloc->LocProbeRsp + header); - - FillH2CCmd8723B(padapter, H2C_8723B_PROBERSP_RSVDPAGE, - H2C_PROBERSP_RSVDPAGE_LEN, rsvdparm); - - msleep(10); -} -#endif /* CONFIG_AP_WOWLAN */ - void rtl8723b_set_FwMediaStatusRpt_cmd(struct adapter *padapter, u8 mstatus, u8 macid) { u8 u1H2CMediaStatusRptParm[H2C_MEDIA_STATUS_RPT_LEN] = {0}; @@ -698,64 +549,6 @@ void rtl8723b_set_FwPwrModeInIPS_cmd(struct adapter *padapter, u8 cmd_param) FillH2CCmd8723B(padapter, H2C_8723B_FWLPS_IN_IPS_, 1, &cmd_param); } -#ifdef CONFIG_AP_WOWLAN -static void rtl8723b_set_FwAPWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) -{ - u8 u1H2CAPWoWlanCtrlParm[H2C_WOWLAN_LEN] = {0}; - u8 gpionum = 0, gpio_dur = 0; - u8 gpio_high_active = 1; /* 0: low active, 1: high active */ - u8 gpio_pulse = bFuncEn; - - DBG_871X("%s(): bFuncEn =%d\n", __func__, bFuncEn); - - if (bFuncEn) - gpio_dur = 16; - else - gpio_dur = 0; - - SET_H2CCMD_AP_WOW_GPIO_CTRL_INDEX(u1H2CAPWoWlanCtrlParm, - gpionum); - SET_H2CCMD_AP_WOW_GPIO_CTRL_PLUS(u1H2CAPWoWlanCtrlParm, - gpio_pulse); - SET_H2CCMD_AP_WOW_GPIO_CTRL_HIGH_ACTIVE(u1H2CAPWoWlanCtrlParm, - gpio_high_active); - SET_H2CCMD_AP_WOW_GPIO_CTRL_EN(u1H2CAPWoWlanCtrlParm, - bFuncEn); - SET_H2CCMD_AP_WOW_GPIO_CTRL_DURATION(u1H2CAPWoWlanCtrlParm, - gpio_dur); - - FillH2CCmd8723B(padapter, H2C_8723B_AP_WOW_GPIO_CTRL, - H2C_AP_WOW_GPIO_CTRL_LEN, u1H2CAPWoWlanCtrlParm); -} - -static void rtl8723b_set_Fw_AP_Offload_Cmd(struct adapter *padapter, u8 bFuncEn) -{ - u8 u1H2CAPOffloadCtrlParm[H2C_WOWLAN_LEN] = {0}; - - DBG_871X("%s(): bFuncEn =%d\n", __func__, bFuncEn); - - SET_H2CCMD_AP_WOWLAN_EN(u1H2CAPOffloadCtrlParm, bFuncEn); - - FillH2CCmd8723B(padapter, H2C_8723B_AP_OFFLOAD, - H2C_AP_OFFLOAD_LEN, u1H2CAPOffloadCtrlParm); -} - -void rtl8723b_set_ap_wowlan_cmd(struct adapter *padapter, u8 enable) -{ - DBG_871X_LEVEL(_drv_always_, "+%s()+: enable =%d\n", __func__, enable); - if (enable) { - rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); - issue_beacon(padapter, 0); - } - - rtl8723b_set_FwAPWoWlanCtrl_Cmd(padapter, enable); - msleep(10); - rtl8723b_set_Fw_AP_Offload_Cmd(padapter, enable); - msleep(10); - DBG_871X_LEVEL(_drv_always_, "-%s()-\n", __func__); -} -#endif /* CONFIG_AP_WOWLAN */ - /* * Description: Fill the reserved packets that FW will use to RSVD page. * Now we just send 4 types packet to rsvd page. @@ -928,134 +721,9 @@ static void rtl8723b_set_FwRsvdPagePkt( rtw_free_xmitframe(pxmitpriv, pcmdframe); } -#ifdef CONFIG_AP_WOWLAN -/* - * Description: Fill the reserved packets that FW will use to RSVD page. - * Now we just send 2 types packet to rsvd page. (1)Beacon, (2)ProbeRsp. - * - * Input: bDLFinished - * - * false: At the first time we will send all the packets as a large packet to - * Hw, so we need to set the packet length to total length. - * - * true: At the second time, we should send the first packet (default:beacon) - * to Hw again and set the length in descriptor to the real beacon length. - */ -/* 2009.10.15 by tynli. */ -static void rtl8723b_set_AP_FwRsvdPagePkt( - struct adapter *padapter, bool bDLFinished -) -{ - struct hal_com_data *pHalData; - struct xmit_frame *pcmdframe; - struct pkt_attrib *pattrib; - struct xmit_priv *pxmitpriv; - struct mlme_ext_priv *pmlmeext; - struct mlme_ext_info *pmlmeinfo; - struct pwrctrl_priv *pwrctl; - u32 BeaconLength = 0, ProbeRspLength = 0; - u8 *ReservedPagePacket; - u8 TxDescLen = TXDESC_SIZE, TxDescOffset = TXDESC_OFFSET; - u8 TotalPageNum = 0, CurtPktPageNum = 0, RsvdPageNum = 0; - u8 currentip[4]; - u16 BufIndex, PageSize = 128; - u32 TotalPacketLen = 0, MaxRsvdPageBufSize = 0; - struct RSVDPAGE_LOC RsvdPageLoc; - - /* DBG_871X("%s---->\n", __func__); */ - DBG_8192C("+" FUNC_ADPT_FMT ": iface_type =%d\n", - FUNC_ADPT_ARG(padapter), get_iface_type(padapter)); - - pHalData = GET_HAL_DATA(padapter); - pxmitpriv = &padapter->xmitpriv; - pmlmeext = &padapter->mlmeextpriv; - pmlmeinfo = &pmlmeext->mlmext_info; - pwrctl = adapter_to_pwrctl(padapter); - - RsvdPageNum = BCNQ_PAGE_NUM_8723B + AP_WOWLAN_PAGE_NUM_8723B; - MaxRsvdPageBufSize = RsvdPageNum*PageSize; - - pcmdframe = rtw_alloc_cmdxmitframe(pxmitpriv); - if (!pcmdframe) { - DBG_871X("%s: alloc ReservedPagePacket fail!\n", __func__); - return; - } - - ReservedPagePacket = pcmdframe->buf_addr; - memset(&RsvdPageLoc, 0, sizeof(struct RSVDPAGE_LOC)); - - /* 3 (1) beacon */ - BufIndex = TxDescOffset; - ConstructBeacon(padapter, &ReservedPagePacket[BufIndex], &BeaconLength); - - /* When we count the first page size, we need to reserve description size for the RSVD */ - /* packet, it will be filled in front of the packet in TXPKTBUF. */ - CurtPktPageNum = (u8)PageNum_128(TxDescLen + BeaconLength); - /* If we don't add 1 more page, the WOWLAN function has a problem. Baron thinks it's a bug of firmware */ - if (CurtPktPageNum == 1) - CurtPktPageNum += 1; - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* 2 (4) probe response */ - RsvdPageLoc.LocProbeRsp = TotalPageNum; - - rtw_get_current_ip_address(padapter, currentip); - - ConstructProbeRsp( - padapter, - &ReservedPagePacket[BufIndex], - &ProbeRspLength, - currentip, - false); - rtl8723b_fill_fake_txdesc(padapter, - &ReservedPagePacket[BufIndex-TxDescLen], - ProbeRspLength, - false, false, false); - - DBG_871X("%s(): HW_VAR_SET_TX_CMD: PROBE RSP %p %d\n", - __func__, &ReservedPagePacket[BufIndex-TxDescLen], - (ProbeRspLength+TxDescLen)); - - CurtPktPageNum = (u8)PageNum_128(TxDescLen + ProbeRspLength); - - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - TotalPacketLen = BufIndex + ProbeRspLength; - - if (TotalPacketLen > MaxRsvdPageBufSize) { - DBG_871X("%s(): ERROR: The rsvd page size is not enough \ - !!TotalPacketLen %d, MaxRsvdPageBufSize %d\n", - __func__, TotalPacketLen, MaxRsvdPageBufSize); - goto error; - } else { - /* update attribute */ - pattrib = &pcmdframe->attrib; - update_mgntframe_attrib(padapter, pattrib); - pattrib->qsel = 0x10; - pattrib->pktlen = TotalPacketLen - TxDescOffset; - pattrib->last_txcmdsz = TotalPacketLen - TxDescOffset; - dump_mgntframe_and_wait(padapter, pcmdframe, 100); - } - - DBG_871X("%s: Set RSVD page location to Fw , TotalPacketLen(%d), TotalPageNum(%d)\n", __func__, TotalPacketLen, TotalPageNum); - rtl8723b_set_ap_wow_rsvdpage_cmd(padapter, &RsvdPageLoc); - - return; -error: - rtw_free_xmitframe(pxmitpriv, pcmdframe); -} -#endif /* CONFIG_AP_WOWLAN */ - void rtl8723b_download_rsvd_page(struct adapter *padapter, u8 mstatus) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -#ifdef CONFIG_AP_WOWLAN - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); -#endif struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); bool bcn_valid = false; @@ -1102,15 +770,8 @@ void rtl8723b_download_rsvd_page(struct adapter *padapter, u8 mstatus) DLBcnCount = 0; poll = 0; do { -#ifdef CONFIG_AP_WOWLAN - if (pwrpriv->wowlan_ap_mode) - rtl8723b_set_AP_FwRsvdPagePkt(padapter, 0); - else - rtl8723b_set_FwRsvdPagePkt(padapter, 0); -#else /* download rsvd page. */ rtl8723b_set_FwRsvdPagePkt(padapter, 0); -#endif DLBcnCount++; do { yield(); diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 49085525de05..9f059fb78c7d 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -527,39 +527,6 @@ void rtl8723b_InitializeFirmwareVars(struct adapter *padapter) /* pHalData->H2CStopInsertQueue = false; */ } -#ifdef CONFIG_AP_WOWLAN -/* */ - -/* */ -/* Description: Prepare some information to Fw for WoWLAN. */ -/* (1) Download wowlan Fw. */ -/* (2) Download RSVD page packets. */ -/* (3) Enable AP offload if needed. */ -/* */ -/* 2011.04.12 by tynli. */ -/* */ -void SetFwRelatedForWoWLAN8723b( - struct adapter *padapter, u8 bHostIsGoingtoSleep -) -{ - int status = _FAIL; - /* */ - /* 1. Before WoWLAN we need to re-download WoWLAN Fw. */ - /* */ - status = rtl8723b_FirmwareDownload(padapter, bHostIsGoingtoSleep); - if (status != _SUCCESS) { - DBG_871X("SetFwRelatedForWoWLAN8723b(): Re-Download Firmware failed!!\n"); - return; - } else { - DBG_871X("SetFwRelatedForWoWLAN8723b(): Re-Download Firmware Success !!\n"); - } - /* */ - /* 2. Re-Init the variables about Fw related setting. */ - /* */ - rtl8723b_InitializeFirmwareVars(padapter); -} -#endif /* CONFIG_AP_WOWLAN */ - static void rtl8723b_free_hal_data(struct adapter *padapter) { } diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index 47cd3ae63687..a64274fa9907 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -1294,16 +1294,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) { u8 val8; -#ifdef CONFIG_AP_WOWLAN - struct wowlan_ioctl_param *poidparam; - struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); - int res; - u32 tmp; - u16 len = 0; - u8 trycnt = 100; - u32 himr = 0; -#endif - switch (variable) { case HW_VAR_SET_RPWM: /* rpwm value only use BIT0(clock bit) , BIT6(Ack bit), and BIT7(Toggle bit) */ @@ -1328,101 +1318,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) val8 = *val; break; -#ifdef CONFIG_AP_WOWLAN - case HW_VAR_AP_WOWLAN: - { - poidparam = (struct wowlan_ioctl_param *)val; - switch (poidparam->subcode) { - case WOWLAN_AP_ENABLE: - DBG_871X("%s, WOWLAN_AP_ENABLE\n", __func__); - /* 1. Download WOWLAN FW */ - DBG_871X_LEVEL(_drv_always_, "Re-download WoWlan FW!\n"); - SetFwRelatedForWoWLAN8723b(padapter, true); - - /* 2. RX DMA stop */ - DBG_871X_LEVEL(_drv_always_, "Pause DMA\n"); - rtw_write32(padapter, REG_RXPKT_NUM, - (rtw_read32(padapter, REG_RXPKT_NUM) | RW_RELEASE_EN)); - do { - if ((rtw_read32(padapter, REG_RXPKT_NUM) & RXDMA_IDLE)) { - DBG_871X_LEVEL(_drv_always_, "RX_DMA_IDLE is true\n"); - break; - } else { - /* If RX_DMA is not idle, receive one pkt from DMA */ - res = sdio_local_read(padapter, SDIO_REG_RX0_REQ_LEN, 4, (u8 *)&tmp); - len = le16_to_cpu(tmp); - - DBG_871X_LEVEL(_drv_always_, "RX len:%d\n", len); - if (len > 0) - res = RecvOnePkt(padapter, len); - else - DBG_871X_LEVEL(_drv_always_, "read length fail %d\n", len); - - DBG_871X_LEVEL(_drv_always_, "RecvOnePkt Result: %d\n", res); - } - } while (trycnt--); - - if (trycnt == 0) - DBG_871X_LEVEL(_drv_always_, "Stop RX DMA failed......\n"); - - /* 3. Clear IMR and ISR */ - DBG_871X_LEVEL(_drv_always_, "Clear IMR and ISR\n"); - tmp = 0; - sdio_local_write(padapter, SDIO_REG_HIMR_ON, 4, (u8 *)&tmp); - sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - sdio_local_read(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); - sdio_local_write(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); - - /* 4. Enable CPWM2 only */ - DBG_871X_LEVEL(_drv_always_, "Enable only CPWM2\n"); - sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - DBG_871X("DisableInterruptButCpwm28723BSdio(): Read SDIO_REG_HIMR: 0x%08x\n", tmp); - - himr = cpu_to_le32(SDIO_HIMR_DISABLED) | SDIO_HIMR_CPWM2_MSK; - sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&himr); - - sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - DBG_871X("DisableInterruptButCpwm28723BSdio(): Read again SDIO_REG_HIMR: 0x%08x\n", tmp); - - /* 5. Set Enable WOWLAN H2C command. */ - DBG_871X_LEVEL(_drv_always_, "Set Enable AP WOWLan cmd\n"); - rtl8723b_set_ap_wowlan_cmd(padapter, 1); - /* 6. add some delay for H2C cmd ready */ - msleep(10); - - rtw_write8(padapter, REG_WOWLAN_WAKE_REASON, 0); - break; - case WOWLAN_AP_DISABLE: - DBG_871X("%s, WOWLAN_AP_DISABLE\n", __func__); - /* 1. Read wakeup reason */ - pwrctl->wowlan_wake_reason = - rtw_read8(padapter, REG_WOWLAN_WAKE_REASON); - - DBG_871X_LEVEL(_drv_always_, "wakeup_reason: 0x%02x\n", - pwrctl->wowlan_wake_reason); - - /* 2. Set Disable WOWLAN H2C command. */ - DBG_871X_LEVEL(_drv_always_, "Set Disable WOWLan cmd\n"); - rtl8723b_set_ap_wowlan_cmd(padapter, 0); - /* 6. add some delay for H2C cmd ready */ - msleep(2); - - DBG_871X_LEVEL(_drv_always_, "Release RXDMA\n"); - - rtw_write32(padapter, REG_RXPKT_NUM, - (rtw_read32(padapter, REG_RXPKT_NUM) & (~RW_RELEASE_EN))); - - SetFwRelatedForWoWLAN8723b(padapter, false); - - rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); - issue_beacon(padapter, 0); - break; - default: - break; - } -} - break; -#endif /* CONFIG_AP_WOWLAN */ case HW_VAR_DM_IN_LPS: rtl8723b_hal_dm_in_lps(padapter); break; diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c index 2400b06dff36..0ea97e85e6a2 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_ops.c +++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c @@ -1114,39 +1114,4 @@ void HalQueryTxOQTBufferStatus8723BSdio(struct adapter *adapter) haldata->SdioTxOQTFreeSpace = SdioLocalCmd52Read1Byte(adapter, SDIO_REG_OQT_FREE_PG); } -#ifdef CONFIG_AP_WOWLAN -u8 RecvOnePkt(struct adapter *adapter, u32 size) -{ - struct recv_buf *recvbuf; - struct dvobj_priv *sddev; - struct sdio_func *func; - - u8 res = false; - - DBG_871X("+%s: size: %d+\n", __func__, size); - - if (!adapter) { - DBG_871X(KERN_ERR "%s: adapter is NULL!\n", __func__); - return false; - } - sddev = adapter_to_dvobj(adapter); - psdio_data = &sddev->intf_data; - func = psdio_data->func; - - if (size) { - sdio_claim_host(func); - recvbuf = sd_recv_rxfifo(adapter, size); - - if (recvbuf) { - sd_rxhandler(adapter, recvbuf); - res = true; - } else { - res = false; - } - sdio_release_host(func); - } - DBG_871X("-%s-\n", __func__); - return res; -} -#endif /* CONFIG_AP_WOWLAN */ diff --git a/drivers/staging/rtl8723bs/include/drv_types_sdio.h b/drivers/staging/rtl8723bs/include/drv_types_sdio.h index 83f5e912baa7..25b3c3a39ee4 100644 --- a/drivers/staging/rtl8723bs/include/drv_types_sdio.h +++ b/drivers/staging/rtl8723bs/include/drv_types_sdio.h @@ -11,11 +11,6 @@ #include #include -#ifdef CONFIG_AP_WOWLAN - #include - #include -#endif - struct sdio_data { u8 func_number; diff --git a/drivers/staging/rtl8723bs/include/hal_com_h2c.h b/drivers/staging/rtl8723bs/include/hal_com_h2c.h index eca394a8e565..dedbd0a1efb4 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_h2c.h +++ b/drivers/staging/rtl8723bs/include/hal_com_h2c.h @@ -120,28 +120,6 @@ enum h2c_cmd { #define SET_H2CCMD_DISCONDECISION_PARM_CHECK_PERIOD(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd+1, 0, 8, __Value) #define SET_H2CCMD_DISCONDECISION_PARM_TRY_PKT_NUM(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd+2, 0, 8, __Value) -#ifdef CONFIG_AP_WOWLAN -/* _AP_Offload 0x08 */ -#define SET_H2CCMD_AP_WOWLAN_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd, 0, 8, __Value) -/* _BCN_RsvdPage 0x09 */ -#define SET_H2CCMD_AP_WOWLAN_RSVDPAGE_LOC_BCN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd, 0, 8, __Value) -/* _Probersp_RsvdPage 0x0a */ -#define SET_H2CCMD_AP_WOWLAN_RSVDPAGE_LOC_ProbeRsp(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd, 0, 8, __Value) -/* _Probersp_RsvdPage 0x13 */ -#define SET_H2CCMD_AP_WOW_GPIO_CTRL_INDEX(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 4, __Value) -#define SET_H2CCMD_AP_WOW_GPIO_CTRL_C2H_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 4, 1, __Value) -#define SET_H2CCMD_AP_WOW_GPIO_CTRL_PLUS(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 5, 1, __Value) -#define SET_H2CCMD_AP_WOW_GPIO_CTRL_HIGH_ACTIVE(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 6, 1, __Value) -#define SET_H2CCMD_AP_WOW_GPIO_CTRL_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 7, 1, __Value) -#define SET_H2CCMD_AP_WOW_GPIO_CTRL_DURATION(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+1, 0, 8, __Value) -#define SET_H2CCMD_AP_WOW_GPIO_CTRL_C2H_DURATION(__pH2CCmd, __Value)SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+2, 0, 8, __Value) -/* _AP_PS 0x26 */ -#define SET_H2CCMD_AP_WOW_PS_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 1, __Value) -#define SET_H2CCMD_AP_WOW_PS_32K_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 1, 1, __Value) -#define SET_H2CCMD_AP_WOW_PS_RF(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 2, 1, __Value) -#define SET_H2CCMD_AP_WOW_PS_DURATION(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+1, 0, 8, __Value) -#endif - /* _WoWLAN PARAM_CMD_0x80 */ #define SET_H2CCMD_WOWLAN_FUNC_ENABLE(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 1, __Value) #define SET_H2CCMD_WOWLAN_PATTERN_MATCH_ENABLE(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 1, 1, __Value) @@ -186,14 +164,6 @@ struct RSVDPAGE_LOC { u8 LocNullData; u8 LocQosNull; u8 LocBTQosNull; -#ifdef CONFIG_AP_WOWLAN - u8 LocApOffloadBCN; -#endif /* CONFIG_AP_WOWLAN */ }; #endif -#ifdef CONFIG_AP_WOWLAN -void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip); -void rtw_get_sec_iv(struct adapter *padapter, u8*pcur_dot11txpn, u8 *StaAddr); -void rtw_set_sec_pn(struct adapter *padapter); -#endif diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h index 093e00b9349b..02cad39be5c9 100644 --- a/drivers/staging/rtl8723bs/include/hal_intf.h +++ b/drivers/staging/rtl8723bs/include/hal_intf.h @@ -85,9 +85,6 @@ enum HW_VARIABLES { HW_VAR_APFM_ON_MAC, /* Auto FSM to Turn On, include clock, isolation, power control for MAC only */ /* The valid upper nav range for the HW updating, if the true value is larger than the upper range, the HW won't update it. */ /* Unit in microsecond. 0 means disable this function. */ -#ifdef CONFIG_AP_WOWLAN - HW_VAR_AP_WOWLAN, -#endif HW_VAR_SYS_CLKR, HW_VAR_NAV_UPPER, HW_VAR_C2H_HANDLE, diff --git a/drivers/staging/rtl8723bs/include/osdep_service.h b/drivers/staging/rtl8723bs/include/osdep_service.h index 63971fd691ed..57e668988a1c 100644 --- a/drivers/staging/rtl8723bs/include/osdep_service.h +++ b/drivers/staging/rtl8723bs/include/osdep_service.h @@ -136,15 +136,8 @@ static inline int rtw_bug_check(void *parg1, void *parg2, void *parg3, void *par #define MAC_ARG(x) (x) #endif - -#ifdef CONFIG_AP_WOWLAN -extern void rtw_softap_lock_suspend(void); -extern void rtw_softap_unlock_suspend(void); -#endif - extern void rtw_free_netdev(struct net_device * netdev); - /* Macros for handling unaligned memory accesses */ void rtw_buf_free(u8 **buf, u32 *buf_len); diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h b/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h index b85e67ccc7db..9629a8844c2d 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h @@ -177,12 +177,6 @@ void rtl8723b_download_BTCoex_AP_mode_rsvd_page(struct adapter *padapter); void CheckFwRsvdPageContent(struct adapter *padapter); -#ifdef CONFIG_AP_WOWLAN -void rtl8723b_set_wowlan_cmd(struct adapter *padapter, u8 enable); -void rtl8723b_set_ap_wowlan_cmd(struct adapter *padapter, u8 enable); -void SetFwRelatedForWoWLAN8723b(struct adapter *padapter, u8 bHostIsGoingtoSleep); -#endif - void rtl8723b_set_FwPwrModeInIPS_cmd(struct adapter *padapter, u8 cmd_param); s32 FillH2CCmd8723B(struct adapter *padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer); diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index da3679d2c8f9..0f787ec44b5b 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -98,10 +98,6 @@ struct rt_firmware_hdr { /* ARP Rsp:1, RWC:1, GTK Info:1, GTK RSP:2, GTK EXT MEM:2, PNO: 6 */ #define WOWLAN_PAGE_NUM_8723B 0x00 -#ifdef CONFIG_AP_WOWLAN -#define AP_WOWLAN_PAGE_NUM_8723B 0x02 -#endif - #define TX_TOTAL_PAGE_NUMBER_8723B \ (0xFF - BCNQ_PAGE_NUM_8723B - \ BCNQ1_PAGE_NUM_8723B - \ diff --git a/drivers/staging/rtl8723bs/include/rtw_mp.h b/drivers/staging/rtl8723bs/include/rtw_mp.h index 8b6e4e9578f9..fb254d88f503 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mp.h +++ b/drivers/staging/rtl8723bs/include/rtw_mp.h @@ -189,9 +189,6 @@ enum { CTA_TEST, MP_DISABLE_BT_COEXIST, MP_PwrCtlDM, -#ifdef CONFIG_AP_WOWLAN - MP_AP_WOW_ENABLE, -#endif MP_NULL, MP_GET_TXPOWER_INX, }; diff --git a/drivers/staging/rtl8723bs/include/sdio_ops.h b/drivers/staging/rtl8723bs/include/sdio_ops.h index 1f1f368cded4..c7559a884608 100644 --- a/drivers/staging/rtl8723bs/include/sdio_ops.h +++ b/drivers/staging/rtl8723bs/include/sdio_ops.h @@ -25,17 +25,10 @@ s32 _sdio_write32(struct adapter *padapter, u32 addr, u32 val); extern void sd_int_hdl(struct adapter *padapter); extern u8 CheckIPSStatus(struct adapter *padapter); -#ifdef CONFIG_AP_WOWLAN -extern u8 RecvOnePkt(struct adapter *padapter, u32 size); -#endif extern void InitInterrupt8723BSdio(struct adapter *padapter); extern void InitSysInterrupt8723BSdio(struct adapter *padapter); extern void EnableInterrupt8723BSdio(struct adapter *padapter); extern void DisableInterrupt8723BSdio(struct adapter *padapter); extern u8 HalQueryTxBufferStatus8723BSdio(struct adapter *padapter); extern void HalQueryTxOQTBufferStatus8723BSdio(struct adapter *padapter); -#ifdef CONFIG_AP_WOWLAN -extern void ClearInterrupt8723BSdio(struct adapter *padapter); -#endif - #endif /* !__SDIO_OPS_H__ */ diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index 9ee95fe4266e..822e6b650c6b 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -4668,10 +4668,6 @@ static const struct iw_priv_args rtw_private_args[] = { SIOCIWFIRSTPRIV + 0x1D, IW_PRIV_TYPE_CHAR | 40, IW_PRIV_TYPE_CHAR | 0x7FF, "test" }, - -#ifdef CONFIG_AP_WOWLAN - { MP_AP_WOW_ENABLE, IW_PRIV_TYPE_CHAR | 1024, 0, "ap_wow_mode" }, /* set */ -#endif }; static iw_handler rtw_private_handler[] = { diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index 270f93e90e07..fe19be2186c3 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -1227,58 +1227,6 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) return _SUCCESS; } -#ifdef CONFIG_AP_WOWLAN -void rtw_suspend_ap_wow(struct adapter *padapter) -{ - u8 ch, bw, offset; - struct net_device *pnetdev = padapter->pnetdev; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct wowlan_ioctl_param poidparam; - - DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); - - pwrpriv->wowlan_ap_mode = true; - - DBG_871X("wowlan_ap_mode: %d\n", pwrpriv->wowlan_ap_mode); - - if (pnetdev) - rtw_netif_stop_queue(pnetdev); - /* 1. stop thread */ - padapter->bDriverStopped = true; /* for stop thread */ - rtw_stop_drv_threads(padapter); - padapter->bDriverStopped = false; /* for 32k command */ - - /* 2. disable interrupt */ - rtw_hal_disable_interrupt(padapter); /* It need wait for leaving 32K. */ - - /* 2.1 clean interrupt */ - if (padapter->HalFunc.clear_interrupt) - padapter->HalFunc.clear_interrupt(padapter); - - /* 2.2 free irq */ - /* sdio_free_irq(adapter_to_dvobj(padapter)); */ - if (padapter->intf_free_irq) - padapter->intf_free_irq(adapter_to_dvobj(padapter)); - - poidparam.subcode = WOWLAN_AP_ENABLE; - padapter->HalFunc.SetHwRegHandler(padapter, - HW_VAR_AP_WOWLAN, (u8 *)&poidparam); - - DBG_871X_LEVEL(_drv_always_, "%s: wowmode suspending\n", __func__); - - if (rtw_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) { - DBG_871X(FUNC_ADPT_FMT " back to linked/linking union - ch:%u, bw:%u, offset:%u\n", - FUNC_ADPT_ARG(padapter), ch, bw, offset); - set_channel_bwmode(padapter, ch, offset, bw); - } - - rtw_set_ps_mode(padapter, PS_MODE_MIN, 0, 0, "AP-WOWLAN"); - - DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); -} -#endif /* ifdef CONFIG_AP_WOWLAN */ - - static void rtw_suspend_normal(struct adapter *padapter) { struct net_device *pnetdev = padapter->pnetdev; @@ -1350,11 +1298,7 @@ int rtw_suspend_common(struct adapter *padapter) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { rtw_suspend_normal(padapter); } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - #ifdef CONFIG_AP_WOWLAN - rtw_suspend_ap_wow(padapter); - #else rtw_suspend_normal(padapter); - #endif /* CONFIG_AP_WOWLAN */ } else { rtw_suspend_normal(padapter); } @@ -1369,80 +1313,6 @@ int rtw_suspend_common(struct adapter *padapter) return ret; } -#ifdef CONFIG_AP_WOWLAN -int rtw_resume_process_ap_wow(struct adapter *padapter) -{ - struct net_device *pnetdev = padapter->pnetdev; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct dvobj_priv *psdpriv = padapter->dvobj; - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; - struct wowlan_ioctl_param poidparam; - int ret = _SUCCESS; - - DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); - - if (padapter) { - pnetdev = padapter->pnetdev; - pwrpriv = adapter_to_pwrctl(padapter); - } else { - pdbgpriv->dbg_resume_error_cnt++; - ret = -1; - goto exit; - } - - rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "AP-WOWLAN"); - - pwrpriv->bFwCurrentInPSMode = false; - - rtw_hal_disable_interrupt(padapter); - - if (padapter->HalFunc.clear_interrupt) - padapter->HalFunc.clear_interrupt(padapter); - - /* if (sdio_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS) { */ - if ((padapter->intf_alloc_irq) && (padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS)) { - ret = -1; - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("%s: sdio_alloc_irq Failed!!\n", __func__)); - goto exit; - } - - /* Disable WOW, set H2C command */ - poidparam.subcode = WOWLAN_AP_DISABLE; - padapter->HalFunc.SetHwRegHandler(padapter, - HW_VAR_AP_WOWLAN, (u8 *)&poidparam); - pwrpriv->wowlan_ap_mode = false; - - padapter->bDriverStopped = false; - DBG_871X("%s: wowmode resuming, DriverStopped:%d\n", __func__, padapter->bDriverStopped); - rtw_start_drv_threads(padapter); - - if (padapter->intf_start) - padapter->intf_start(padapter); - - /* start netif queue */ - if (pnetdev) { - if (!rtw_netif_queue_stopped(pnetdev)) - rtw_netif_start_queue(pnetdev); - else - rtw_netif_wake_queue(pnetdev); - } - - if (padapter->pid[1] != 0) { - DBG_871X("pid[1]:%d\n", padapter->pid[1]); - rtw_signal_process(padapter->pid[1], SIGUSR2); - } - - pwrpriv->bips_processing = false; - _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); - - /* clean driver side wake up reason. */ - pwrpriv->wowlan_wake_reason = 0; -exit: - DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); - return ret; -} -#endif /* ifdef CONFIG_APWOWLAN */ - static int rtw_resume_process_normal(struct adapter *padapter) { struct net_device *pnetdev; @@ -1532,11 +1402,7 @@ int rtw_resume_common(struct adapter *padapter) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { rtw_resume_process_normal(padapter); } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - #ifdef CONFIG_AP_WOWLAN - rtw_resume_process_ap_wow(padapter); - #else rtw_resume_process_normal(padapter); - #endif /* CONFIG_AP_WOWLAN */ } else { rtw_resume_process_normal(padapter); } -- 2.20.1 From fabioaiuto83 at gmail.com Mon Mar 15 10:15:02 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:15:02 +0100 Subject: [PATCH 05/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_PM In-Reply-To: References: Message-ID: <77ea39e63246fa4756afcf2bdea573f43fefc74c.1615801721.git.fabioaiuto83@gmail.com> remove conditional code blocks checked by unused CONFIG_PM cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index 2ff71d001c07..5748e1c1a25c 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -3198,14 +3198,6 @@ static void rtw_cfg80211_preinit_wiphy(struct adapter *padapter, struct wiphy *w wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; wiphy->flags |= WIPHY_FLAG_OFFCHAN_TX | WIPHY_FLAG_HAVE_AP_SME; -#if defined(CONFIG_PM) - wiphy->max_sched_scan_reqs = 1; -#endif - -#if defined(CONFIG_PM) - wiphy->wowlan = &wowlan_stub; -#endif - if (padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE) wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; else -- 2.20.1 From fabioaiuto83 at gmail.com Mon Mar 15 10:15:26 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:15:26 +0100 Subject: [PATCH 06/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_SIGNAL_DISPLAY_DBM In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_SIGNAL_DISPLAY_DBM cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 +- drivers/staging/rtl8723bs/hal/hal_com.c | 4 ++-- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 21 +++---------------- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index 0ca3ddfc8b08..5d0611c5119b 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -4211,7 +4211,7 @@ void site_survey(struct adapter *padapter) channel_scan_time_ms = pmlmeext->chan_scan_time; set_survey_timer(pmlmeext, channel_scan_time_ms); -#if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) +#ifdef CONFIG_BACKGROUND_NOISE_MONITOR { struct noise_info info; diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 4a1ca57c2e15..7c65ec60a982 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -1262,7 +1262,7 @@ void GetHalODMVar( ) { switch (eVariable) { -#if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) +#ifdef CONFIG_BACKGROUND_NOISE_MONITOR case HAL_ODM_NOISE_MONITOR: { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); @@ -1313,7 +1313,7 @@ void SetHalODMVar( case HAL_ODM_WIFI_DISPLAY_STATE: ODM_CmnInfoUpdate(podmpriv, ODM_CMNINFO_WIFI_DISPLAY, bSet); break; - #if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) + #ifdef CONFIG_BACKGROUND_NOISE_MONITOR case HAL_ODM_NOISE_MONITOR: { struct noise_info *pinfo = pValue1; diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index 822e6b650c6b..a52d04582aa1 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -313,14 +313,11 @@ static char *translate_scan(struct adapter *padapter, /* Add quality statistics */ iwe.cmd = IWEVQUAL; iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED - #if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) + #ifdef CONFIG_BACKGROUND_NOISE_MONITOR | IW_QUAL_NOISE_UPDATED #else | IW_QUAL_NOISE_INVALID #endif - #ifdef CONFIG_SIGNAL_DISPLAY_DBM - | IW_QUAL_DBM - #endif ; if (check_fwstate(pmlmepriv, _FW_LINKED) == true && @@ -333,9 +330,6 @@ static char *translate_scan(struct adapter *padapter, } - #ifdef CONFIG_SIGNAL_DISPLAY_DBM - iwe.u.qual.level = (u8)translate_percentage_to_dbm(ss);/* dbm */ - #else #ifdef CONFIG_SKIP_SIGNAL_SCALE_MAPPING { /* Do signal scale mapping when using percentage as the unit of signal strength, since the scale mapping is skipped in odm */ @@ -347,11 +341,10 @@ static char *translate_scan(struct adapter *padapter, #else iwe.u.qual.level = (u8)ss;/* */ #endif - #endif iwe.u.qual.qual = (u8)sq; /* signal quality */ - #if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) + #ifdef CONFIG_BACKGROUND_NOISE_MONITOR { s16 tmp_noise = 0; rtw_hal_get_odm_var(padapter, HAL_ODM_NOISE_MONITOR, &(pnetwork->network.Configuration.DSConfig), &(tmp_noise)); @@ -4728,9 +4721,6 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev) piwstats->qual.noise = 0; /* DBG_871X("No link level:%d, qual:%d, noise:%d\n", tmp_level, tmp_qual, tmp_noise); */ } else { - #ifdef CONFIG_SIGNAL_DISPLAY_DBM - tmp_level = translate_percentage_to_dbm(padapter->recvpriv.signal_strength); - #else #ifdef CONFIG_SKIP_SIGNAL_SCALE_MAPPING { /* Do signal scale mapping when using percentage as the unit of signal strength, since the scale mapping is skipped in odm */ @@ -4742,10 +4732,9 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev) #else tmp_level = padapter->recvpriv.signal_strength; #endif - #endif tmp_qual = padapter->recvpriv.signal_qual; -#if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) +#ifdef CONFIG_BACKGROUND_NOISE_MONITOR if (rtw_linked_check(padapter)) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct noise_info info; @@ -4772,10 +4761,6 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev) } piwstats->qual.updated = IW_QUAL_ALL_UPDATED ;/* IW_QUAL_DBM; */ - #ifdef CONFIG_SIGNAL_DISPLAY_DBM - piwstats->qual.updated = piwstats->qual.updated | IW_QUAL_DBM; - #endif - return &padapter->iwstats; } -- 2.20.1 From fabioaiuto83 at gmail.com Mon Mar 15 10:15:39 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:15:39 +0100 Subject: [PATCH 07/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_BACKGROUND_NOISE_MONITOR In-Reply-To: References: Message-ID: <2872c6f848b8b7aa0dc2d0399123d798f4b18820.1615801722.git.fabioaiuto83@gmail.com> remove conditional code blocks checked by unused CONFIG_BACKGROUND_NOISE_MONITOR cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 12 ----- drivers/staging/rtl8723bs/hal/hal_com.c | 35 ------------- drivers/staging/rtl8723bs/include/hal_com.h | 10 ---- drivers/staging/rtl8723bs/include/hal_data.h | 5 -- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 50 +------------------ 5 files changed, 1 insertion(+), 111 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index 5d0611c5119b..e60a2ed32de5 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -4211,18 +4211,6 @@ void site_survey(struct adapter *padapter) channel_scan_time_ms = pmlmeext->chan_scan_time; set_survey_timer(pmlmeext, channel_scan_time_ms); -#ifdef CONFIG_BACKGROUND_NOISE_MONITOR - { - struct noise_info info; - - info.bPauseDIG = false; - info.IGIValue = 0; - info.max_time = channel_scan_time_ms/2;/* ms */ - info.chan = survey_channel; - rtw_hal_set_odm_var(padapter, HAL_ODM_NOISE_MONITOR, &info, false); - } -#endif - } else { /* channel number is 0 or this channel is not valid. */ diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 7c65ec60a982..bf07251a07d7 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -1262,20 +1262,6 @@ void GetHalODMVar( ) { switch (eVariable) { -#ifdef CONFIG_BACKGROUND_NOISE_MONITOR - case HAL_ODM_NOISE_MONITOR: - { - struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - u8 chan = *(u8 *)pValue1; - *(s16 *)pValue2 = pHalData->noise[chan]; - #ifdef DBG_NOISE_MONITOR - DBG_8192C("### Noise monitor chan(%d)-noise:%d (dBm) ###\n", - chan, pHalData->noise[chan]); - #endif - - } - break; -#endif/* ifdef CONFIG_BACKGROUND_NOISE_MONITOR */ default: break; } @@ -1313,27 +1299,6 @@ void SetHalODMVar( case HAL_ODM_WIFI_DISPLAY_STATE: ODM_CmnInfoUpdate(podmpriv, ODM_CMNINFO_WIFI_DISPLAY, bSet); break; - #ifdef CONFIG_BACKGROUND_NOISE_MONITOR - case HAL_ODM_NOISE_MONITOR: - { - struct noise_info *pinfo = pValue1; - - #ifdef DBG_NOISE_MONITOR - DBG_8192C("### Noise monitor chan(%d)-bPauseDIG:%d, IGIValue:0x%02x, max_time:%d (ms) ###\n", - pinfo->chan, pinfo->bPauseDIG, pinfo->IGIValue, pinfo->max_time); - #endif - - pHalData->noise[pinfo->chan] = ODM_InbandNoise_Monitor(podmpriv, pinfo->bPauseDIG, pinfo->IGIValue, pinfo->max_time); - DBG_871X("chan_%d, noise = %d (dBm)\n", pinfo->chan, pHalData->noise[pinfo->chan]); - #ifdef DBG_NOISE_MONITOR - DBG_871X("noise_a = %d, noise_b = %d noise_all:%d\n", - podmpriv->noise_level.noise[ODM_RF_PATH_A], - podmpriv->noise_level.noise[ODM_RF_PATH_B], - podmpriv->noise_level.noise_all); - #endif - } - break; - #endif/* ifdef CONFIG_BACKGROUND_NOISE_MONITOR */ default: break; diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h index c4b83eb16326..8669155dcddc 100644 --- a/drivers/staging/rtl8723bs/include/hal_com.h +++ b/drivers/staging/rtl8723bs/include/hal_com.h @@ -286,14 +286,4 @@ void SetHalODMVar( enum HAL_ODM_VARIABLE eVariable, void * pValue1, bool bSet); - -#ifdef CONFIG_BACKGROUND_NOISE_MONITOR -struct noise_info { - u8 bPauseDIG; - u8 IGIValue; - u32 max_time;/* ms */ - u8 chan; -}; -#endif - #endif /* __HAL_COMMON_H__ */ diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h index 8f5de747ae4e..8e75a334c60b 100644 --- a/drivers/staging/rtl8723bs/include/hal_data.h +++ b/drivers/staging/rtl8723bs/include/hal_data.h @@ -439,11 +439,6 @@ struct hal_com_data { /* Interrupt related register information. */ u32 SysIntrStatus; u32 SysIntrMask; - -#ifdef CONFIG_BACKGROUND_NOISE_MONITOR - s16 noise[ODM_MAX_CHANNEL_NUM]; -#endif - }; #define GET_HAL_DATA(__padapter) ((struct hal_com_data *)((__padapter)->HalData)) diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index a52d04582aa1..b6ae7dfc51fe 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -313,12 +313,7 @@ static char *translate_scan(struct adapter *padapter, /* Add quality statistics */ iwe.cmd = IWEVQUAL; iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED - #ifdef CONFIG_BACKGROUND_NOISE_MONITOR - | IW_QUAL_NOISE_UPDATED - #else - | IW_QUAL_NOISE_INVALID - #endif - ; + | IW_QUAL_NOISE_INVALID; if (check_fwstate(pmlmepriv, _FW_LINKED) == true && is_same_network(&pmlmepriv->cur_network.network, &pnetwork->network, 0)) { @@ -344,15 +339,7 @@ static char *translate_scan(struct adapter *padapter, iwe.u.qual.qual = (u8)sq; /* signal quality */ - #ifdef CONFIG_BACKGROUND_NOISE_MONITOR - { - s16 tmp_noise = 0; - rtw_hal_get_odm_var(padapter, HAL_ODM_NOISE_MONITOR, &(pnetwork->network.Configuration.DSConfig), &(tmp_noise)); - iwe.u.qual.noise = tmp_noise; - } - #else iwe.u.qual.noise = 0; /* noise level */ - #endif /* DBG_871X("iqual =%d, ilevel =%d, inoise =%d, iupdated =%d\n", iwe.u.qual.qual, iwe.u.qual.level , iwe.u.qual.noise, iwe.u.qual.updated); */ @@ -3076,23 +3063,6 @@ static int rtw_dbg_port(struct net_device *dev, } } break; -#ifdef CONFIG_BACKGROUND_NOISE_MONITOR - case 0x1e: - { - struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - u8 chan = rtw_get_oper_ch(padapter); - DBG_871X("===========================================\n"); - ODM_InbandNoise_Monitor(pDM_Odm, true, 0x1e, 100); - DBG_871X("channel(%d), noise_a = %d, noise_b = %d , noise_all:%d\n", - chan, pDM_Odm->noise_level.noise[ODM_RF_PATH_A], - pDM_Odm->noise_level.noise[ODM_RF_PATH_B], - pDM_Odm->noise_level.noise_all); - DBG_871X("===========================================\n"); - - } - break; -#endif case 0x23: { DBG_871X("turn %s the bNotifyChannelChange Variable\n", (extra_arg == 1)?"on":"off"); @@ -4734,24 +4704,6 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev) #endif tmp_qual = padapter->recvpriv.signal_qual; -#ifdef CONFIG_BACKGROUND_NOISE_MONITOR - if (rtw_linked_check(padapter)) { - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct noise_info info; - info.bPauseDIG = true; - info.IGIValue = 0x1e; - info.max_time = 100;/* ms */ - info.chan = pmlmeext->cur_channel ;/* rtw_get_oper_ch(padapter); */ - rtw_ps_deny(padapter, PS_DENY_IOCTL); - LeaveAllPowerSaveModeDirect(padapter); - - rtw_hal_set_odm_var(padapter, HAL_ODM_NOISE_MONITOR, &info, false); - /* ODM_InbandNoise_Monitor(podmpriv, true, 0x20, 100); */ - rtw_ps_deny_cancel(padapter, PS_DENY_IOCTL); - rtw_hal_get_odm_var(padapter, HAL_ODM_NOISE_MONITOR, &(info.chan), &(padapter->recvpriv.noise)); - DBG_871X("chan:%d, noise_level:%d\n", info.chan, padapter->recvpriv.noise); - } -#endif tmp_noise = padapter->recvpriv.noise; DBG_871X("level:%d, qual:%d, noise:%d, rssi (%d)\n", tmp_level, tmp_qual, tmp_noise, padapter->recvpriv.rssi); -- 2.20.1 From fabioaiuto83 at gmail.com Mon Mar 15 10:15:50 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:15:50 +0100 Subject: [PATCH 08/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_SKIP_SIGNAL_SCALE_MAPPING In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_SKIP_SIGNAL_SCALE_MAPPING cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/hal/odm_HWConfig.c | 9 -------- drivers/staging/rtl8723bs/include/rtw_recv.h | 5 ----- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 21 ------------------- 3 files changed, 35 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c index de63e4a2932e..5f2f17b49173 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c @@ -226,19 +226,10 @@ static void odm_RxPhyStatus92CSeries_Parsing( /* UI BSS List signal strength(in percentage), make it good looking, from 0~100. */ /* It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp(). */ if (isCCKrate) { -#ifdef CONFIG_SKIP_SIGNAL_SCALE_MAPPING - pPhyInfo->SignalStrength = (u8)PWDB_ALL; -#else pPhyInfo->signal_strength = (u8)(odm_SignalScaleMapping(pDM_Odm, PWDB_ALL));/* PWDB_ALL; */ -#endif } else { if (rf_rx_num != 0) { -#ifdef CONFIG_SKIP_SIGNAL_SCALE_MAPPING - total_rssi /= rf_rx_num; - pPhyInfo->signal_strength = (u8)total_rssi; -#else pPhyInfo->signal_strength = (u8)(odm_SignalScaleMapping(pDM_Odm, total_rssi /= rf_rx_num)); -#endif } } diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h index 484e9d62ef92..0a56c3a66ee8 100644 --- a/drivers/staging/rtl8723bs/include/rtw_recv.h +++ b/drivers/staging/rtl8723bs/include/rtw_recv.h @@ -512,14 +512,9 @@ static inline s32 translate_percentage_to_dbm(u32 SignalStrengthIndex) { s32 SignalPower; /* in dBm. */ -#ifdef CONFIG_SKIP_SIGNAL_SCALE_MAPPING - /* Translate to dBm (x =y-100) */ - SignalPower = SignalStrengthIndex - 100; -#else /* Translate to dBm (x = 0.5y-95). */ SignalPower = (s32)((SignalStrengthIndex + 1) >> 1); SignalPower -= 95; -#endif return SignalPower; } diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index b6ae7dfc51fe..d0e77465ad9a 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -325,17 +325,7 @@ static char *translate_scan(struct adapter *padapter, } - #ifdef CONFIG_SKIP_SIGNAL_SCALE_MAPPING - { - /* Do signal scale mapping when using percentage as the unit of signal strength, since the scale mapping is skipped in odm */ - - struct hal_com_data *pHal = GET_HAL_DATA(padapter); - - iwe.u.qual.level = (u8)odm_SignalScaleMapping(&pHal->odmpriv, ss); - } - #else iwe.u.qual.level = (u8)ss;/* */ - #endif iwe.u.qual.qual = (u8)sq; /* signal quality */ @@ -4691,18 +4681,7 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev) piwstats->qual.noise = 0; /* DBG_871X("No link level:%d, qual:%d, noise:%d\n", tmp_level, tmp_qual, tmp_noise); */ } else { - #ifdef CONFIG_SKIP_SIGNAL_SCALE_MAPPING - { - /* Do signal scale mapping when using percentage as the unit of signal strength, since the scale mapping is skipped in odm */ - - struct hal_com_data *pHal = GET_HAL_DATA(padapter); - - tmp_level = (u8)odm_SignalScaleMapping(&pHal->odmpriv, padapter->recvpriv.signal_strength); - } - #else tmp_level = padapter->recvpriv.signal_strength; - #endif - tmp_qual = padapter->recvpriv.signal_qual; tmp_noise = padapter->recvpriv.noise; DBG_871X("level:%d, qual:%d, noise:%d, rssi (%d)\n", tmp_level, tmp_qual, tmp_noise, padapter->recvpriv.rssi); -- 2.20.1 From fabioaiuto83 at gmail.com Mon Mar 15 10:16:13 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:16:13 +0100 Subject: [PATCH 09/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_GPIO_API In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_GPIO_API cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- .../staging/rtl8723bs/core/rtw_wlan_util.c | 95 ------------------- drivers/staging/rtl8723bs/include/drv_types.h | 6 -- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 40 -------- 3 files changed, 141 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index d04514d36b49..3e211780cde4 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -2014,98 +2014,3 @@ struct adapter *dvobj_get_port0_adapter(struct dvobj_priv *dvobj) return dvobj->padapters; } - -#ifdef CONFIG_GPIO_API -int rtw_get_gpio(struct net_device *netdev, int gpio_num) -{ - u8 value; - u8 direction; - struct adapter *adapter = rtw_netdev_priv(netdev); - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(adapter); - - rtw_ps_deny(adapter, PS_DENY_IOCTL); - - DBG_871X("rf_pwrstate = 0x%02x\n", pwrpriv->rf_pwrstate); - LeaveAllPowerSaveModeDirect(adapter); - - /* Read GPIO Direction */ - direction = (rtw_read8(adapter, REG_GPIO_PIN_CTRL + 2) & BIT(gpio_num)) >> gpio_num; - - /* According the direction to read register value */ - if (direction) - value = (rtw_read8(adapter, REG_GPIO_PIN_CTRL + 1) & BIT(gpio_num)) >> gpio_num; - else - value = (rtw_read8(adapter, REG_GPIO_PIN_CTRL) & BIT(gpio_num)) >> gpio_num; - - rtw_ps_deny_cancel(adapter, PS_DENY_IOCTL); - DBG_871X("%s direction =%d value =%d\n", __func__, direction, value); - - return value; -} -EXPORT_SYMBOL(rtw_get_gpio); - -int rtw_set_gpio_output_value(struct net_device *netdev, int gpio_num, bool isHigh) -{ - u8 direction = 0; - u8 res = -1; - struct adapter *adapter = rtw_netdev_priv(netdev); - - /* Check GPIO is 4~7 */ - if (gpio_num > 7 || gpio_num < 4) { - DBG_871X("%s The gpio number does not included 4~7.\n", __func__); - return -1; - } - - rtw_ps_deny(adapter, PS_DENY_IOCTL); - - LeaveAllPowerSaveModeDirect(adapter); - - /* Read GPIO direction */ - direction = (rtw_read8(adapter, REG_GPIO_PIN_CTRL + 2) & BIT(gpio_num)) >> gpio_num; - - /* If GPIO is output direction, setting value. */ - if (direction) { - if (isHigh) - rtw_write8(adapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(adapter, REG_GPIO_PIN_CTRL + 1) | BIT(gpio_num)); - else - rtw_write8(adapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(adapter, REG_GPIO_PIN_CTRL + 1) & ~BIT(gpio_num)); - - DBG_871X("%s Set gpio %x[%d]=%d\n", __func__, REG_GPIO_PIN_CTRL+1, gpio_num, isHigh); - res = 0; - } else { - DBG_871X("%s The gpio is input, not be set!\n", __func__); - res = -1; - } - - rtw_ps_deny_cancel(adapter, PS_DENY_IOCTL); - return res; -} -EXPORT_SYMBOL(rtw_set_gpio_output_value); - -int rtw_config_gpio(struct net_device *netdev, int gpio_num, bool isOutput) -{ - struct adapter *adapter = rtw_netdev_priv(netdev); - - if (gpio_num > 7 || gpio_num < 4) { - DBG_871X("%s The gpio number does not included 4~7.\n", __func__); - return -1; - } - - DBG_871X("%s gpio_num =%d direction =%d\n", __func__, gpio_num, isOutput); - - rtw_ps_deny(adapter, PS_DENY_IOCTL); - - LeaveAllPowerSaveModeDirect(adapter); - - if (isOutput) - rtw_write8(adapter, REG_GPIO_PIN_CTRL + 2, rtw_read8(adapter, REG_GPIO_PIN_CTRL + 2) | BIT(gpio_num)); - else - rtw_write8(adapter, REG_GPIO_PIN_CTRL + 2, rtw_read8(adapter, REG_GPIO_PIN_CTRL + 2) & ~BIT(gpio_num)); - - rtw_ps_deny_cancel(adapter, PS_DENY_IOCTL); - - return 0; -} -EXPORT_SYMBOL(rtw_config_gpio); -#endif - diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h index 56ebf18a4c05..a7d30bab744c 100644 --- a/drivers/staging/rtl8723bs/include/drv_types.h +++ b/drivers/staging/rtl8723bs/include/drv_types.h @@ -528,12 +528,6 @@ static inline void RTW_ENABLE_FUNC(struct adapter *padapter, int func_bit) (padapter)->bSurpriseRemoved || \ RTW_IS_FUNC_DISABLED((padapter), DF_TX_BIT)) -#ifdef CONFIG_GPIO_API -int rtw_get_gpio(struct net_device *netdev, int gpio_num); -int rtw_set_gpio_output_value(struct net_device *netdev, int gpio_num, bool isHigh); -int rtw_config_gpio(struct net_device *netdev, int gpio_num, bool isOutput); -#endif - static inline u8 *myid(struct eeprom_priv *peepriv) { return peepriv->mac_addr; diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index d0e77465ad9a..f5cd3639f571 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -3063,46 +3063,6 @@ static int rtw_dbg_port(struct net_device *dev, { break; } -#ifdef CONFIG_GPIO_API - case 0x25: /* Get GPIO register */ - { - /* - * dbg 0x7f250000 [gpio_num], Get gpio value, gpio_num:0~7 - */ - - int value; - DBG_871X("Read GPIO Value extra_arg = %d\n", extra_arg); - value = rtw_get_gpio(dev, extra_arg); - DBG_871X("Read GPIO Value = %d\n", value); - break; - } - case 0x26: /* Set GPIO direction */ - { - - /* dbg 0x7f26000x [y], Set gpio direction, - * x: gpio_num, 4~7 y: indicate direction, 0~1 - */ - - int value; - DBG_871X("Set GPIO Direction! arg = %d , extra_arg =%d\n", arg, extra_arg); - value = rtw_config_gpio(dev, arg, extra_arg); - DBG_871X("Set GPIO Direction %s\n", (value == -1) ? "Fail!!!" : "Success"); - break; - } - case 0x27: /* Set GPIO output direction value */ - { - /* - * dbg 0x7f27000x [y], Set gpio output direction value, - * x: gpio_num, 4~7 y: indicate direction, 0~1 - */ - - int value; - DBG_871X("Set GPIO Value! arg = %d , extra_arg =%d\n", arg, extra_arg); - value = rtw_set_gpio_output_value(dev, arg, extra_arg); - DBG_871X("Set GPIO Value %s\n", (value == -1) ? "Fail!!!" : "Success"); - break; - } -#endif case 0xaa: { if ((extra_arg & 0x7F) > 0x3F) -- 2.20.1 From fabioaiuto83 at gmail.com Mon Mar 15 10:16:27 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:16:27 +0100 Subject: [PATCH 10/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_EXT_CLK In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_EXT_CLK cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index a64274fa9907..d0e5b482f382 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -53,20 +53,6 @@ u8 _InitPowerOn_8723BS(struct adapter *padapter) /* all of these MUST be configured before power on */ -#ifdef CONFIG_EXT_CLK - /* Use external crystal(XTAL) */ - value8 = rtw_read8(padapter, REG_PAD_CTRL1_8723B + 2); - value8 |= BIT(7); - rtw_write8(padapter, REG_PAD_CTRL1_8723B + 2, value8); - - /* CLK_REQ High active or Low Active */ - /* Request GPIO polarity: */ - /* 0: low active */ - /* 1: high active */ - value8 = rtw_read8(padapter, REG_MULTI_FUNC_CTRL + 1); - value8 |= BIT(5); - rtw_write8(padapter, REG_MULTI_FUNC_CTRL + 1, value8); -#endif /* CONFIG_EXT_CLK */ /* only cmd52 can be used before power on(card enable) */ ret = CardEnable(padapter); -- 2.20.1 From fabioaiuto83 at gmail.com Mon Mar 15 10:16:47 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:16:47 +0100 Subject: [PATCH 11/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_CHECK_BT_HANG In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_CHECK_BT_HANG cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 31 ------------------- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 7 ----- .../staging/rtl8723bs/include/rtl8723b_hal.h | 7 ----- 3 files changed, 45 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 9f059fb78c7d..5854590e5811 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -4421,34 +4421,3 @@ void rtl8723b_stop_thread(struct adapter *padapter) } #endif } - -#if defined(CONFIG_CHECK_BT_HANG) -extern void check_bt_status_work(void *data); -void rtl8723bs_init_checkbthang_workqueue(struct adapter *adapter) -{ - adapter->priv_checkbt_wq = alloc_workqueue("sdio_wq", 0, 0); - INIT_DELAYED_WORK(&adapter->checkbt_work, (void *)check_bt_status_work); -} - -void rtl8723bs_free_checkbthang_workqueue(struct adapter *adapter) -{ - if (adapter->priv_checkbt_wq) { - cancel_delayed_work_sync(&adapter->checkbt_work); - flush_workqueue(adapter->priv_checkbt_wq); - destroy_workqueue(adapter->priv_checkbt_wq); - adapter->priv_checkbt_wq = NULL; - } -} - -void rtl8723bs_cancle_checkbthang_workqueue(struct adapter *adapter) -{ - if (adapter->priv_checkbt_wq) - cancel_delayed_work_sync(&adapter->checkbt_work); -} - -void rtl8723bs_hal_check_bt_hang(struct adapter *adapter) -{ - if (adapter->priv_checkbt_wq) - queue_delayed_work(adapter->priv_checkbt_wq, &(adapter->checkbt_work), 0); -} -#endif diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index d0e5b482f382..82b54131c9ec 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -1420,11 +1420,4 @@ void rtl8723bs_set_hal_ops(struct adapter *padapter) pHalFunc->hal_xmit = &rtl8723bs_hal_xmit; pHalFunc->mgnt_xmit = &rtl8723bs_mgnt_xmit; pHalFunc->hal_xmitframe_enqueue = &rtl8723bs_hal_xmitframe_enqueue; - -#if defined(CONFIG_CHECK_BT_HANG) - pHalFunc->hal_init_checkbthang_workqueue = &rtl8723bs_init_checkbthang_workqueue; - pHalFunc->hal_free_checkbthang_workqueue = &rtl8723bs_free_checkbthang_workqueue; - pHalFunc->hal_cancle_checkbthang_workqueue = &rtl8723bs_cancle_checkbthang_workqueue; - pHalFunc->hal_checke_bt_hang = &rtl8723bs_hal_check_bt_hang; -#endif } diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index 0f787ec44b5b..6449238fb2a5 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -240,13 +240,6 @@ void _8051Reset8723(struct adapter *padapter); void rtl8723b_start_thread(struct adapter *padapter); void rtl8723b_stop_thread(struct adapter *padapter); -#if defined(CONFIG_CHECK_BT_HANG) -void rtl8723bs_init_checkbthang_workqueue(struct adapter *adapter); -void rtl8723bs_free_checkbthang_workqueue(struct adapter *adapter); -void rtl8723bs_cancle_checkbthang_workqueue(struct adapter *adapter); -void rtl8723bs_hal_check_bt_hang(struct adapter *adapter); -#endif - int FirmwareDownloadBT(struct adapter *adapter, struct rt_firmware *firmware); void CCX_FwC2HTxRpt_8723b(struct adapter *padapter, u8 *pdata, u8 len); -- 2.20.1 From fabioaiuto83 at gmail.com Mon Mar 15 10:16:58 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:16:58 +0100 Subject: [PATCH 12/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_SDIO_TX_TASKLET In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_SDIO_TX_TASKLET cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 4 ---- drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 8 -------- drivers/staging/rtl8723bs/include/rtw_xmit.h | 4 ---- 3 files changed, 16 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 5854590e5811..eddf01c71e24 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -4398,19 +4398,16 @@ u8 GetHalDefVar8723B(struct adapter *padapter, enum HAL_DEF_VARIABLE variable, v void rtl8723b_start_thread(struct adapter *padapter) { -#ifndef CONFIG_SDIO_TX_TASKLET struct xmit_priv *xmitpriv = &padapter->xmitpriv; xmitpriv->SdioXmitThread = kthread_run(rtl8723bs_xmit_thread, padapter, "RTWHALXT"); if (IS_ERR(xmitpriv->SdioXmitThread)) { RT_TRACE(_module_hal_xmit_c_, _drv_err_, ("%s: start rtl8723bs_xmit_thread FAIL!!\n", __func__)); } -#endif } void rtl8723b_stop_thread(struct adapter *padapter) { -#ifndef CONFIG_SDIO_TX_TASKLET struct xmit_priv *xmitpriv = &padapter->xmitpriv; /* stop xmit_buf_thread */ @@ -4419,5 +4416,4 @@ void rtl8723b_stop_thread(struct adapter *padapter) wait_for_completion(&xmitpriv->SdioXmitTerminate); xmitpriv->SdioXmitThread = NULL; } -#endif } diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c index a3bd9c2002c9..597cf3a88c51 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c @@ -124,10 +124,6 @@ static s32 rtl8723_dequeue_writeport(struct adapter *padapter) /* pxmitbuf->priv_data = NULL; */ rtw_free_xmitbuf(pxmitpriv, pxmitbuf); -#ifdef CONFIG_SDIO_TX_TASKLET - tasklet_hi_schedule(&pxmitpriv->xmit_tasklet); -#endif - return _FAIL; } @@ -601,11 +597,7 @@ s32 rtl8723bs_hal_xmitframe_enqueue( pxmitpriv->tx_drop++; } else { -#ifdef CONFIG_SDIO_TX_TASKLET - tasklet_hi_schedule(&pxmitpriv->xmit_tasklet); -#else complete(&pxmitpriv->SdioXmitStart); -#endif } return err; diff --git a/drivers/staging/rtl8723bs/include/rtw_xmit.h b/drivers/staging/rtl8723bs/include/rtw_xmit.h index a6fb8be8c63a..b482821c9af8 100644 --- a/drivers/staging/rtl8723bs/include/rtw_xmit.h +++ b/drivers/staging/rtl8723bs/include/rtw_xmit.h @@ -412,13 +412,9 @@ struct xmit_priv { u8 wmm_para_seq[4];/* sequence for wmm ac parameter strength from large to small. it's value is 0->vo, 1->vi, 2->be, 3->bk. */ -#ifdef CONFIG_SDIO_TX_TASKLET - struct tasklet_struct xmit_tasklet; -#else void *SdioXmitThread; struct completion SdioXmitStart; struct completion SdioXmitTerminate; -#endif /* CONFIG_SDIO_TX_TASKLET */ struct __queue free_xmitbuf_queue; struct __queue pending_xmitbuf_queue; -- 2.20.1 From fabioaiuto83 at gmail.com Mon Mar 15 10:17:09 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:17:09 +0100 Subject: [PATCH 13/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_SW_CHANNEL_PLAN In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_SW_CHANNEL_PLAN cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/hal/hal_com.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index bf07251a07d7..368807e05830 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -132,10 +132,8 @@ u8 hal_com_config_channel_plan( hw_chnlPlan = hw_channel_plan & (~EEPROM_CHANNEL_PLAN_BY_HW_MASK); if (rtw_is_channel_plan_valid(hw_chnlPlan)) { -#ifndef CONFIG_SW_CHANNEL_PLAN if (hw_channel_plan & EEPROM_CHANNEL_PLAN_BY_HW_MASK) pHalData->bDisableSWChannelPlan = true; -#endif /* !CONFIG_SW_CHANNEL_PLAN */ chnlPlan = hw_chnlPlan; } -- 2.20.1 From fabioaiuto83 at gmail.com Mon Mar 15 10:17:22 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:17:22 +0100 Subject: [PATCH 14/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_C2H_PACKET_EN In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_C2H_PACKET_EN cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/hal/sdio_ops.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c index 0ea97e85e6a2..170a28f4b191 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_ops.c +++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c @@ -974,7 +974,6 @@ void sd_int_dpc(struct adapter *adapter) if (hal->sdio_hisr & SDIO_HISR_TXBCNERR) DBG_8192C("%s: SDIO_HISR_TXBCNERR\n", __func__); -#ifndef CONFIG_C2H_PACKET_EN if (hal->sdio_hisr & SDIO_HISR_C2HCMD) { struct c2h_evt_hdr_88xx *c2h_evt; @@ -997,7 +996,6 @@ void sd_int_dpc(struct adapter *adapter) _set_workitem(&adapter->evtpriv.c2h_wk); } } -#endif if (hal->sdio_hisr & SDIO_HISR_RXFOVW) DBG_8192C("%s: Rx Overflow\n", __func__); -- 2.20.1 From fabioaiuto83 at gmail.com Mon Mar 15 10:17:37 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Mon, 15 Mar 2021 11:17:37 +0100 Subject: [PATCH 15/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_ODM_ADAPTIVITY In-Reply-To: References: Message-ID: <0b2d79045feb7da232a8ffe73b068c9bd59d0284.1615801722.git.fabioaiuto83@gmail.com> remove conditional code blocks checked by unused CONFIG_ODM_ADAPTIVITY cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/hal/rtl8723b_dm.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c index dce70fff0fae..4eb487cf70f0 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c @@ -91,9 +91,6 @@ static void Update_ODM_ComInfo_8723b(struct adapter *Adapter) | ODM_MAC_EDCA_TURBO | ODM_RF_TX_PWR_TRACK | ODM_RF_CALIBRATION -#ifdef CONFIG_ODM_ADAPTIVITY - | ODM_BB_ADAPTIVITY -#endif ; /* */ -- 2.20.1 From penghaob at uniontech.com Mon Mar 15 10:33:20 2021 From: penghaob at uniontech.com (Hao Peng) Date: Mon, 15 Mar 2021 18:33:20 +0800 Subject: [PATCH] staging: rtl8192e: remove extra space in rtl819x_BAProc.c Message-ID: <20210315103320.18536-1-penghaob@uniontech.com> Remove extra spaces in rtl819x_BAProc.c. Signed-off-by: Hao Peng --- drivers/staging/rtl8192e/rtl819x_BAProc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c index 2d5e4a0330c6..f692ad7f9bbc 100644 --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c @@ -45,7 +45,7 @@ static u8 TxTsDeleteBA(struct rtllib_device *ieee, struct tx_ts_record *pTxTs) static u8 RxTsDeleteBA(struct rtllib_device *ieee, struct rx_ts_record *pRxTs) { struct ba_record *pBa = &pRxTs->RxAdmittedBARecord; - u8 bSendDELBA = false; + u8 bSendDELBA = false; if (pBa->bValid) { DeActivateBAEntry(ieee, pBa); @@ -314,7 +314,7 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) u8 *dst = NULL, *pDialogToken = NULL, *tag = NULL; u16 *pStatusCode = NULL, *pBaTimeoutVal = NULL; union ba_param_set *pBaParamSet = NULL; - u16 ReasonCode; + u16 ReasonCode; if (skb->len < sizeof(struct rtllib_hdr_3addr) + 9) { netdev_warn(ieee->dev, "Invalid skb len in BARSP(%d / %d)\n", -- 2.20.1 From abbotti at mev.co.uk Mon Mar 15 10:44:32 2021 From: abbotti at mev.co.uk (Ian Abbott) Date: Mon, 15 Mar 2021 10:44:32 +0000 Subject: [PATCH] staging: comedi: replace slash in name In-Reply-To: <20210314035757.2740146-1-ztong0001@gmail.com> References: <20210314035757.2740146-1-ztong0001@gmail.com> Message-ID: <5d7a5e1c-35ab-58cb-ebcd-da5b280c802e@mev.co.uk> On 14/03/2021 03:57, Tong Zhang wrote: > request_irq() wont accept a name which contains slash so we need to > repalce it with something else -- otherwise it will trigger a warning > and the entry in /proc/irq/ will not be created > > [ 1.565966] name 'pci-das6402/16' > [ 1.566149] WARNING: CPU: 0 PID: 184 at fs/proc/generic.c:180 __xlate_proc_name+0x93/0xb0 > [ 1.568923] RIP: 0010:__xlate_proc_name+0x93/0xb0 > [ 1.574200] Call Trace: > [ 1.574722] proc_mkdir+0x18/0x20 > [ 1.576629] request_threaded_irq+0xfe/0x160 > [ 1.576859] auto_attach+0x60a/0xc40 [cb_pcidas64] > > Signed-off-by: Tong Zhang > --- > drivers/staging/comedi/drivers/cb_pcidas64.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c > index fa987bb0e7cd..662d6ffb8f60 100644 > --- a/drivers/staging/comedi/drivers/cb_pcidas64.c > +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c > @@ -677,7 +677,7 @@ static const int bytes_in_sample = 2; > > static const struct pcidas64_board pcidas64_boards[] = { > [BOARD_PCIDAS6402_16] = { > - .name = "pci-das6402/16", > + .name = "pci-das6402-16", > .ai_se_chans = 64, > .ai_bits = 16, > .ai_speed = 5000, > @@ -693,7 +693,7 @@ static const struct pcidas64_board pcidas64_boards[] = { > .has_8255 = 1, > }, > [BOARD_PCIDAS6402_12] = { > - .name = "pci-das6402/12", /* XXX check */ > + .name = "pci-das6402-12", /* XXX check */ > .ai_se_chans = 64, > .ai_bits = 12, > .ai_speed = 5000, > @@ -709,7 +709,7 @@ static const struct pcidas64_board pcidas64_boards[] = { > .has_8255 = 1, > }, > [BOARD_PCIDAS64_M1_16] = { > - .name = "pci-das64/m1/16", > + .name = "pci-das64-m1-16", > .ai_se_chans = 64, > .ai_bits = 16, > .ai_speed = 1000, > @@ -725,7 +725,7 @@ static const struct pcidas64_board pcidas64_boards[] = { > .has_8255 = 1, > }, > [BOARD_PCIDAS64_M2_16] = { > - .name = "pci-das64/m2/16", > + .name = "pci-das64-m2-16", > .ai_se_chans = 64, > .ai_bits = 16, > .ai_speed = 500, > @@ -741,7 +741,7 @@ static const struct pcidas64_board pcidas64_boards[] = { > .has_8255 = 1, > }, > [BOARD_PCIDAS64_M3_16] = { > - .name = "pci-das64/m3/16", > + .name = "pci-das64-m3-16", > .ai_se_chans = 64, > .ai_bits = 16, > .ai_speed = 333, > @@ -984,7 +984,7 @@ static const struct pcidas64_board pcidas64_boards[] = { > .has_8255 = 0, > }, > [BOARD_PCIDAS4020_12] = { > - .name = "pci-das4020/12", > + .name = "pci-das4020-12", > .ai_se_chans = 4, > .ai_bits = 12, > .ai_speed = 50, > Userspace applications can use these strings to determine the board type, so changing the strings would break those applications. I suggest passing the comedi driver name "cb_pcidas" to request_irq() for now. -- -=( Ian Abbott || MEV Ltd. is a company )=- -=( registered in England & Wales. Regd. number: 02862268. )=- -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=- -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=- From abbotti at mev.co.uk Mon Mar 15 10:48:38 2021 From: abbotti at mev.co.uk (Ian Abbott) Date: Mon, 15 Mar 2021 10:48:38 +0000 Subject: [PATCH] staging: comedi: replace slash in name In-Reply-To: <5d7a5e1c-35ab-58cb-ebcd-da5b280c802e@mev.co.uk> References: <20210314035757.2740146-1-ztong0001@gmail.com> <5d7a5e1c-35ab-58cb-ebcd-da5b280c802e@mev.co.uk> Message-ID: <858341a6-c105-1440-aa4d-ea0217f2ec89@mev.co.uk> On 15/03/2021 10:44, Ian Abbott wrote: > On 14/03/2021 03:57, Tong Zhang wrote: >> request_irq() wont accept a name which contains slash so we need to >> repalce it with something else -- otherwise it will trigger a warning >> and the entry in /proc/irq/ will not be created >> >> [ 1.565966] name 'pci-das6402/16' >> [ 1.566149] WARNING: CPU: 0 PID: 184 at fs/proc/generic.c:180 __xlate_proc_name+0x93/0xb0 >> [ 1.568923] RIP: 0010:__xlate_proc_name+0x93/0xb0 >> [ 1.574200] Call Trace: >> [ 1.574722] proc_mkdir+0x18/0x20 >> [ 1.576629] request_threaded_irq+0xfe/0x160 >> [ 1.576859] auto_attach+0x60a/0xc40 [cb_pcidas64] >> >> Signed-off-by: Tong Zhang [snip] > Userspace applications can use these strings to determine the board > type, so changing the strings would break those applications. > > I suggest passing the comedi driver name "cb_pcidas" to request_irq() > for now. Oops, I meant "cb_pcidas64". But you could reach that via dev->driver->driver_name if you want (where dev is the struct comedi_device * parameter). -- -=( Ian Abbott || MEV Ltd. is a company )=- -=( registered in England & Wales. Regd. number: 02862268. )=- -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=- -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=- From abbotti at mev.co.uk Mon Mar 15 10:50:53 2021 From: abbotti at mev.co.uk (Ian Abbott) Date: Mon, 15 Mar 2021 10:50:53 +0000 Subject: [PATCH] staging: comedi: cb_pcidas: replace slash in name In-Reply-To: <20210314040221.2740750-1-ztong0001@gmail.com> References: <20210314040221.2740750-1-ztong0001@gmail.com> Message-ID: <393f3925-9dbf-72e5-4d9b-2e213a6a71cb@mev.co.uk> On 14/03/2021 04:02, Tong Zhang wrote: > request_irq() wont accept a name which contains slash so we need to > repalce it with something else -- otherwise it will trigger a warning > and the entry in /proc/irq/ will not be created > > [ 1.630764] name 'pci-das1602/16' > [ 1.630950] WARNING: CPU: 0 PID: 181 at fs/proc/generic.c:180 __xlate_proc_name+0x93/0xb0 > [ 1.634009] RIP: 0010:__xlate_proc_name+0x93/0xb0 > [ 1.639441] Call Trace: > [ 1.639976] proc_mkdir+0x18/0x20 > [ 1.641946] request_threaded_irq+0xfe/0x160 > [ 1.642186] cb_pcidas_auto_attach+0xf4/0x610 [cb_pcidas] > > Signed-off-by: Tong Zhang > --- > drivers/staging/comedi/drivers/cb_pcidas.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c > index d740c4782775..df0960d41cff 100644 > --- a/drivers/staging/comedi/drivers/cb_pcidas.c > +++ b/drivers/staging/comedi/drivers/cb_pcidas.c > @@ -230,7 +230,7 @@ struct cb_pcidas_board { > > static const struct cb_pcidas_board cb_pcidas_boards[] = { > [BOARD_PCIDAS1602_16] = { > - .name = "pci-das1602/16", > + .name = "pci-das1602-16", > .ai_speed = 5000, > .ao_scan_speed = 10000, > .fifo_size = 512, > @@ -248,7 +248,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { > .has_ao = 1, > }, > [BOARD_PCIDAS1602_12] = { > - .name = "pci-das1602/12", > + .name = "pci-das1602-12", > .ai_speed = 3200, > .ao_scan_speed = 4000, > .fifo_size = 1024, > @@ -257,12 +257,12 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { > .is_1602 = 1, > }, > [BOARD_PCIDAS1200_JR] = { > - .name = "pci-das1200/jr", > + .name = "pci-das1200-jr", > .ai_speed = 3200, > .fifo_size = 1024, > }, > [BOARD_PCIDAS1602_16_JR] = { > - .name = "pci-das1602/16/jr", > + .name = "pci-das1602-16-jr", > .ai_speed = 5000, > .fifo_size = 512, > .is_16bit = 1, > As for cb_pcidas64, the board name may be used by user-space applications, so this may break those applications. I suggest passing the comedi driver name "cb_pcidas" to request_irq() for now. (It can also be reached via dev->driver->driver_name .) -- -=( Ian Abbott || MEV Ltd. is a company )=- -=( registered in England & Wales. Regd. number: 02862268. )=- -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=- -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=- From penghaob at uniontech.com Mon Mar 15 11:04:18 2021 From: penghaob at uniontech.com (Hao Peng) Date: Mon, 15 Mar 2021 19:04:18 +0800 Subject: [PATCH] staging: rtl8192e: remove extra lines in rtl819x_BAProc.c Message-ID: <20210315110418.25117-1-penghaob@uniontech.com> Remove extra lines in rtl819x_BAProc.c. Signed-off-by: Hao Peng --- drivers/staging/rtl8192e/rtl819x_BAProc.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c index f692ad7f9bbc..adc2304ae155 100644 --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c @@ -162,7 +162,6 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst, *tag++ = ACT_CAT_BA; *tag++ = ACT_DELBA; - put_unaligned_le16(DelbaParamSet.shortData, tag); tag += 2; @@ -182,7 +181,6 @@ static void rtllib_send_ADDBAReq(struct rtllib_device *ieee, u8 *dst, struct sk_buff *skb; skb = rtllib_ADDBA(ieee, dst, pBA, 0, ACT_ADDBAREQ); - if (skb) { RT_TRACE(COMP_DBG, "====>to send ADDBAREQ!!!!!\n"); softmac_mgmt_xmit(skb, ieee); @@ -344,7 +342,6 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) goto OnADDBARsp_Reject; } - if (!GetTs(ieee, (struct ts_common_info **)(&pTS), dst, (u8)(pBaParamSet->field.TID), TX_DIR, false)) { netdev_warn(ieee->dev, "%s(): can't get TS\n", __func__); @@ -356,7 +353,6 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) pPendingBA = &pTS->TxPendingBARecord; pAdmittedBA = &pTS->TxAdmittedBARecord; - if (pAdmittedBA->bValid) { netdev_dbg(ieee->dev, "%s(): ADDBA response already admitted\n", __func__); @@ -375,7 +371,6 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) DeActivateBAEntry(ieee, pPendingBA); } - if (*pStatusCode == ADDBA_STATUS_SUCCESS) { if (pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) { pTS->bAddBaReqDelayed = true; @@ -384,7 +379,6 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) goto OnADDBARsp_Reject; } - pAdmittedBA->DialogToken = *pDialogToken; pAdmittedBA->BaTimeoutValue = *pBaTimeoutVal; pAdmittedBA->BaStartSeqCtrl = pPendingBA->BaStartSeqCtrl; -- 2.20.1 From penghaob at uniontech.com Mon Mar 15 11:12:20 2021 From: penghaob at uniontech.com (Hao Peng) Date: Mon, 15 Mar 2021 19:12:20 +0800 Subject: [PATCH] staging: rts5208: add empty line in general.c Message-ID: <20210315111220.27090-1-penghaob@uniontech.com> Add one empty line upon return for easy reading. Signed-off-by: Hao Peng --- drivers/staging/rts5208/general.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/rts5208/general.c b/drivers/staging/rts5208/general.c index 0f912b011064..1ddfbc5aecb7 100644 --- a/drivers/staging/rts5208/general.c +++ b/drivers/staging/rts5208/general.c @@ -20,6 +20,7 @@ int bit1cnt_long(u32 data) cnt++; data >>= 1; } + return cnt; } -- 2.20.1 From wealfaro at minem.gob.pe Mon Mar 15 11:32:55 2021 From: wealfaro at minem.gob.pe (Fred Grenville) Date: Mon, 15 Mar 2021 04:32:55 -0700 Subject: Reply Asap. Message-ID: <20210315120946.E066D47169@smtp4.osuosl.org> Good day How are you today, did you receive the email I sent you three days ago? For important discussion on ( Investment ) If not please reply me back so that I will resend it again. Please confirm if you did ( u.abdulghani at yahoo.com.co ). Best Regards, Mr. Fred Grenville From wealfaro at minem.gob.pe Mon Mar 15 11:32:55 2021 From: wealfaro at minem.gob.pe (Fred Grenville) Date: Mon, 15 Mar 2021 04:32:55 -0700 Subject: Reply Asap. Message-ID: <20210315120947.9AFE16F4B4@smtp3.osuosl.org> Good day How are you today, did you receive the email I sent you three days ago? For important discussion on ( Investment ) If not please reply me back so that I will resend it again. Please confirm if you did ( u.abdulghani at yahoo.com.co ). Best Regards, Mr. Fred Grenville From ribalda at chromium.org Mon Mar 15 12:34:05 2021 From: ribalda at chromium.org (Ricardo Ribalda) Date: Mon, 15 Mar 2021 13:34:05 +0100 Subject: [PATCH v2 1/2] media: staging/intel-ipu3: Fix memory leak in imu_fmt Message-ID: <20210315123406.1523607-1-ribalda@chromium.org> We are losing the reference to an allocated memory if try. Change the order of the check to avoid that. Cc: stable at vger.kernel.org Fixes: 6d5f26f2e045 ("media: staging/intel-ipu3-v4l: reduce kernel stack usage") Signed-off-by: Ricardo Ribalda --- drivers/staging/media/ipu3/ipu3-v4l2.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c index 60aa02eb7d2a..35a74d99322f 100644 --- a/drivers/staging/media/ipu3/ipu3-v4l2.c +++ b/drivers/staging/media/ipu3/ipu3-v4l2.c @@ -693,6 +693,13 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, if (inode == IMGU_NODE_STAT_3A || inode == IMGU_NODE_PARAMS) continue; + /* CSS expects some format on OUT queue */ + if (i != IPU3_CSS_QUEUE_OUT && + !imgu_pipe->nodes[inode].enabled) { + fmts[i] = NULL; + continue; + } + if (try) { fmts[i] = kmemdup(&imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp, sizeof(struct v4l2_pix_format_mplane), @@ -705,10 +712,6 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, fmts[i] = &imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp; } - /* CSS expects some format on OUT queue */ - if (i != IPU3_CSS_QUEUE_OUT && - !imgu_pipe->nodes[inode].enabled) - fmts[i] = NULL; } if (!try) { -- 2.31.0.rc2.261.g7f71774620-goog From ribalda at chromium.org Mon Mar 15 12:34:06 2021 From: ribalda at chromium.org (Ricardo Ribalda) Date: Mon, 15 Mar 2021 13:34:06 +0100 Subject: [PATCH v2 2/2] media: staging/intel-ipu3: Fix set_fmt error handling In-Reply-To: <20210315123406.1523607-1-ribalda@chromium.org> References: <20210315123406.1523607-1-ribalda@chromium.org> Message-ID: <20210315123406.1523607-2-ribalda@chromium.org> If there in an error during a set_fmt, do not overwrite the previous sizes with the invalid config. [ 38.662975] ipu3-imgu 0000:00:05.0: swiotlb buffer is full (sz: 4096 bytes) [ 38.662980] DMA: Out of SW-IOMMU space for 4096 bytes at device 0000:00:05.0 [ 38.663010] general protection fault: 0000 [#1] PREEMPT SMP Cc: stable at vger.kernel.org Fixes: 6d5f26f2e045 ("media: staging/intel-ipu3-v4l: reduce kernel stack usage") Signed-off-by: Ricardo Ribalda --- drivers/staging/media/ipu3/ipu3-v4l2.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c index 35a74d99322f..6d9c49b39531 100644 --- a/drivers/staging/media/ipu3/ipu3-v4l2.c +++ b/drivers/staging/media/ipu3/ipu3-v4l2.c @@ -686,6 +686,7 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, dev_dbg(dev, "IPU3 pipe %u pipe_id = %u", pipe, css_pipe->pipe_id); + css_q = imgu_node_to_queue(node); for (i = 0; i < IPU3_CSS_QUEUES; i++) { unsigned int inode = imgu_map_node(imgu, i); @@ -700,6 +701,11 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, continue; } + if (i == css_q) { + fmts[i] = &f->fmt.pix_mp; + continue; + } + if (try) { fmts[i] = kmemdup(&imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp, sizeof(struct v4l2_pix_format_mplane), @@ -728,16 +734,10 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, rects[IPU3_CSS_RECT_GDC]->height = pad_fmt.height; } - /* - * imgu doesn't set the node to the value given by user - * before we return success from this function, so set it here. - */ - css_q = imgu_node_to_queue(node); if (!fmts[css_q]) { ret = -EINVAL; goto out; } - *fmts[css_q] = f->fmt.pix_mp; if (try) ret = imgu_css_fmt_try(&imgu->css, fmts, rects, pipe); @@ -748,15 +748,18 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, if (ret < 0) goto out; - if (try) - f->fmt.pix_mp = *fmts[css_q]; - else - f->fmt = imgu_pipe->nodes[node].vdev_fmt.fmt; + /* + * imgu doesn't set the node to the value given by user + * before we return success from this function, so set it here. + */ + if (!try) + imgu_pipe->nodes[node].vdev_fmt.fmt.pix_mp = f->fmt.pix_mp; out: if (try) { for (i = 0; i < IPU3_CSS_QUEUES; i++) - kfree(fmts[i]); + if (i != css_q) + kfree(fmts[i]); } return ret; -- 2.31.0.rc2.261.g7f71774620-goog From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:38 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:38 +0100 Subject: [PATCH v5 01/24] mmc: sdio: add SDIO IDs for Silabs WF200 chip In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-2-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Add Silabs SDIO ID to sdio_ids.h. Note that the values used by Silabs are uncommon. A driver cannot fully rely on the SDIO PnP. It should also check if the device is declared in the DT. Signed-off-by: J?r?me Pouiller --- include/linux/mmc/sdio_ids.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h index 12036619346c..734918fbf164 100644 --- a/include/linux/mmc/sdio_ids.h +++ b/include/linux/mmc/sdio_ids.h @@ -25,6 +25,13 @@ * Vendors and devices. Sort key: vendor first, device next. */ +/* + * Silabs does not use a reliable vendor ID. To avoid conflicts, the driver + * won't probe the device if it is not also declared in the DT. + */ +#define SDIO_VENDOR_ID_SILABS 0x0000 +#define SDIO_DEVICE_ID_SILABS_WF200 0x1000 + #define SDIO_VENDOR_ID_STE 0x0020 #define SDIO_DEVICE_ID_STE_CW1200 0x2280 -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:37 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:37 +0100 Subject: [PATCH v5 00/24] wfx: get out from the staging area Message-ID: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller I think the wfx driver is now mature enough to be accepted in the drivers/net/wireless directory. The firmware is now a part of the linux-firmware repository since relase 20210315[1]. It had taken a bit of time because I have worked with the legal department to simplify the redistribution terms of the firmware. [1]: https://lore.kernel.org/linux-firmware/2833354.gXvVfaC4I7 at pc-42/ As requested by Kalle[2], I send one file per patch. At the end, all the patches (or at least the patches 3 to 24) will be squashed (therefore, I didn't bother to write real commit messages). [2]: https://lore.kernel.org/lkml/87ft6p2n0h.fsf at codeaurora.org/ Here is a diagram of the global architecture that may help to understand the code: ,------------------------------------. | mac80211 | `------------------------------------' ,------------+-----------+-----------. | sta | | | | scan | | | | main | | | +------------+ data_tx | | | key | | data_rx | | hif_tx_mib | queue | | | hif_tx | | | | hif_rx | | | | hif_api_* | | | +------------+-----------+-----------+--------. | bh | fwio | +------------------------------------+--------+ | hwio | +---------------------------------------------+ | bus_sdio | | bus_spi | `---------------------------------------------' ,---------------------------------------------. | spi / sdio | `---------------------------------------------' Roughly, I have sent the files from the bottom to the top. Below the differences with the files from drivers/staging/wfx/: v5: - Add reference to the PR to linux-firmware in the cover letter - Rebase on last staging tree (that mainly include commit 6efed0a69794 "staging: wfx: fix possible panic with re-queued frames" and a few cosmetics changes) - Remove useless trailing spaces in DT binding (Rob) - Add a commit message in the patch 2 since I am not sure it will be squashed with the other (Rob) v4: - Rebase on last staging tree - Add 'additionalProperties: false' to the DT specification (I made that change blindly because I am able to reproduce Rob's error) (Rob) - Replace C++ comments with Ansi C comments (Kalle) - Check that existing Ansi C comments comply with net/ "compact" style - Drop one obsolete comment - Remove comments after '#endif' in header files - Remove macro redefinitions in hif_api_general.h (Kalle) - Replace compiletime_assert() with BUILD_BUG_ON_MSG() (Kalle) - Rename ieee80211_is_action_back() (Kalle) - Add a comment explaining how the PDS isent to the device (Kalle) - Add a comment about case where CONFIG_MMC==m in the Makefile (Kalle) - Fix irrevelant comment about CONFIG_VMAP_STACK (Kalle) - Talk about the unreliable SDIO Vendor ID in the Kconfig help (Kalle) - Mention the firmware status in the cover letter (Kalle) - Fix misaligned function arguments in key.c v3: - dt-bindings: Rename config-file property (Rob) - dt-bindings: No additional properties are allowed (spi-max-frequency is already listed) (Rob) - dt-bindings: Remove references for mac-address properties (Rob) - Rebase on staging/staging-next v2: - dt-bindings: Improve device description and add link to the datasheet (Rob) - dt-bindings: Add blank lines between each DT property (Rob) - dt-bindings: Explicitly mention mac-address and local-mac-address and add references to ethernet-controller.yaml (Rob) - dt-bindings: "config-file" is not for development/debug (Rob) - dt-bindings: Remove description of "spi-max-frequency" (Rob) - dt-bindings: Use "folded scalar" syntax instead of escaping the colons - bus_sdio.c: A compatible node in the DT is now mandatory to probe the device. Also change documentation of dt-bindings accordingly (Pali, Ulf) - bus_sdio.c: Move SDIO IDs to sdio_ids.h (Pali) - bh.c: Import patch "staging: wfx: fix test on return value of gpiod_get_value()" (Nathan) - data_tx.c: Import patch "staging: wfx: fix use of uninitialized pointer" - sta.c: Import patch "staging: wfx: make a const array static, makes object smaller" (Colin) v1: - Drop the function name in the warning message (Kalle) - Replace goto by return in wfx_send_pdata_pds() (Kalle, Dan) - Improve error label in wfx_send_pdata_pds() (Kalle) J?r?me Pouiller (24): mmc: sdio: add SDIO IDs for Silabs WF200 chip dt-bindings: introduce silabs,wfx.yaml wfx: add Makefile/Kconfig wfx: add wfx.h wfx: add main.c/main.h wfx: add bus.h wfx: add bus_spi.c wfx: add bus_sdio.c wfx: add hwio.c/hwio.h wfx: add fwio.c/fwio.h wfx: add bh.c/bh.h wfx: add hif_api_*.h wfx: add hif_tx*.c/hif_tx*.h wfx: add key.c/key.h wfx: add hif_rx.c/hif_rx.h wfx: add data_rx.c/data_rx.h wfx: add queue.c/queue.h wfx: add data_tx.c/data_tx.h wfx: add sta.c/sta.h wfx: add scan.c/scan.h wfx: add debug.c/debug.h wfx: add traces.h wfx: remove from the staging area wfx: get out from the staging area .../bindings/net/wireless/silabs,wfx.yaml | 58 ++++++++------ MAINTAINERS | 3 +- drivers/net/wireless/Kconfig | 1 + drivers/net/wireless/Makefile | 1 + drivers/net/wireless/silabs/Kconfig | 18 +++++ drivers/net/wireless/silabs/Makefile | 3 + .../wireless/silabs}/wfx/Kconfig | 4 + .../wireless/silabs}/wfx/Makefile | 1 + .../{staging => net/wireless/silabs}/wfx/bh.c | 31 ++++---- .../{staging => net/wireless/silabs}/wfx/bh.h | 2 +- .../wireless/silabs}/wfx/bus.h | 0 .../wireless/silabs}/wfx/bus_sdio.c | 24 ++---- .../wireless/silabs}/wfx/bus_spi.c | 18 ++--- .../wireless/silabs}/wfx/data_rx.c | 5 +- .../wireless/silabs}/wfx/data_rx.h | 2 +- .../wireless/silabs}/wfx/data_tx.c | 67 ++++++++-------- .../wireless/silabs}/wfx/data_tx.h | 4 +- .../wireless/silabs}/wfx/debug.c | 12 +-- .../wireless/silabs}/wfx/debug.h | 2 +- .../wireless/silabs}/wfx/fwio.c | 26 +++---- .../wireless/silabs}/wfx/fwio.h | 2 +- .../wireless/silabs}/wfx/hif_api_cmd.h | 12 +-- .../wireless/silabs}/wfx/hif_api_general.h | 23 +++--- .../wireless/silabs}/wfx/hif_api_mib.h | 2 +- .../wireless/silabs}/wfx/hif_rx.c | 17 +++-- .../wireless/silabs}/wfx/hif_rx.h | 0 .../wireless/silabs}/wfx/hif_tx.c | 32 ++++---- .../wireless/silabs}/wfx/hif_tx.h | 0 .../wireless/silabs}/wfx/hif_tx_mib.c | 4 +- .../wireless/silabs}/wfx/hif_tx_mib.h | 0 .../wireless/silabs}/wfx/hwio.c | 18 +---- .../wireless/silabs}/wfx/hwio.h | 22 +++--- .../wireless/silabs}/wfx/key.c | 30 ++++---- .../wireless/silabs}/wfx/key.h | 2 +- .../wireless/silabs}/wfx/main.c | 37 ++++++--- .../wireless/silabs}/wfx/main.h | 3 +- .../wireless/silabs}/wfx/queue.c | 27 ++++--- .../wireless/silabs}/wfx/queue.h | 4 +- .../wireless/silabs}/wfx/scan.c | 3 +- .../wireless/silabs}/wfx/scan.h | 2 +- .../wireless/silabs}/wfx/sta.c | 76 ++++++++++--------- .../wireless/silabs}/wfx/sta.h | 8 +- .../wireless/silabs}/wfx/traces.h | 2 +- .../wireless/silabs}/wfx/wfx.h | 4 +- drivers/staging/Kconfig | 2 - drivers/staging/Makefile | 1 - drivers/staging/wfx/TODO | 6 -- include/linux/mmc/sdio_ids.h | 7 ++ 48 files changed, 335 insertions(+), 293 deletions(-) rename {drivers/staging/wfx/Documentation => Documentation}/devicetree/bindings/net/wireless/silabs,wfx.yaml (71%) create mode 100644 drivers/net/wireless/silabs/Kconfig create mode 100644 drivers/net/wireless/silabs/Makefile rename drivers/{staging => net/wireless/silabs}/wfx/Kconfig (65%) rename drivers/{staging => net/wireless/silabs}/wfx/Makefile (85%) rename drivers/{staging => net/wireless/silabs}/wfx/bh.c (93%) rename drivers/{staging => net/wireless/silabs}/wfx/bh.h (97%) rename drivers/{staging => net/wireless/silabs}/wfx/bus.h (100%) rename drivers/{staging => net/wireless/silabs}/wfx/bus_sdio.c (89%) rename drivers/{staging => net/wireless/silabs}/wfx/bus_spi.c (94%) rename drivers/{staging => net/wireless/silabs}/wfx/data_rx.c (95%) rename drivers/{staging => net/wireless/silabs}/wfx/data_rx.h (93%) rename drivers/{staging => net/wireless/silabs}/wfx/data_tx.c (91%) rename drivers/{staging => net/wireless/silabs}/wfx/data_tx.h (94%) rename drivers/{staging => net/wireless/silabs}/wfx/debug.c (96%) rename drivers/{staging => net/wireless/silabs}/wfx/debug.h (94%) rename drivers/{staging => net/wireless/silabs}/wfx/fwio.c (95%) rename drivers/{staging => net/wireless/silabs}/wfx/fwio.h (91%) rename drivers/{staging => net/wireless/silabs}/wfx/hif_api_cmd.h (97%) rename drivers/{staging => net/wireless/silabs}/wfx/hif_api_general.h (93%) rename drivers/{staging => net/wireless/silabs}/wfx/hif_api_mib.h (99%) rename drivers/{staging => net/wireless/silabs}/wfx/hif_rx.c (96%) rename drivers/{staging => net/wireless/silabs}/wfx/hif_rx.h (100%) rename drivers/{staging => net/wireless/silabs}/wfx/hif_tx.c (95%) rename drivers/{staging => net/wireless/silabs}/wfx/hif_tx.h (100%) rename drivers/{staging => net/wireless/silabs}/wfx/hif_tx_mib.c (98%) rename drivers/{staging => net/wireless/silabs}/wfx/hif_tx_mib.h (100%) rename drivers/{staging => net/wireless/silabs}/wfx/hwio.c (93%) rename drivers/{staging => net/wireless/silabs}/wfx/hwio.h (77%) rename drivers/{staging => net/wireless/silabs}/wfx/key.c (91%) rename drivers/{staging => net/wireless/silabs}/wfx/key.h (94%) rename drivers/{staging => net/wireless/silabs}/wfx/main.c (92%) rename drivers/{staging => net/wireless/silabs}/wfx/main.h (94%) rename drivers/{staging => net/wireless/silabs}/wfx/queue.c (92%) rename drivers/{staging => net/wireless/silabs}/wfx/queue.h (94%) rename drivers/{staging => net/wireless/silabs}/wfx/scan.c (98%) rename drivers/{staging => net/wireless/silabs}/wfx/scan.h (95%) rename drivers/{staging => net/wireless/silabs}/wfx/sta.c (92%) rename drivers/{staging => net/wireless/silabs}/wfx/sta.h (97%) rename drivers/{staging => net/wireless/silabs}/wfx/traces.h (99%) rename drivers/{staging => net/wireless/silabs}/wfx/wfx.h (97%) delete mode 100644 drivers/staging/wfx/TODO -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:39 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:39 +0100 Subject: [PATCH v5 02/24] dt-bindings: introduce silabs,wfx.yaml In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-3-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Prepare the inclusion of the wfx driver in the kernel. Signed-off-by: J?r?me Pouiller --- .../bindings/net/wireless/silabs,wfx.yaml | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml diff --git a/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml b/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml new file mode 100644 index 000000000000..9e71240ea026 --- /dev/null +++ b/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml @@ -0,0 +1,133 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (c) 2020, Silicon Laboratories, Inc. +%YAML 1.2 +--- + +$id: http://devicetree.org/schemas/net/wireless/silabs,wfx.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Silicon Labs WFxxx devicetree bindings + +maintainers: + - J?r?me Pouiller + +description: > + Support for the Wifi chip WFxxx from Silicon Labs. Currently, the only device + from the WFxxx series is the WF200 described here: + https://www.silabs.com/documents/public/data-sheets/wf200-datasheet.pdf + + The WF200 can be connected via SPI or via SDIO. + + For SDIO: + + Declaring the WFxxx chip in device tree is mandatory (usually, the VID/PID is + sufficient for the SDIO devices). + + It is recommended to declare a mmc-pwrseq on SDIO host above WFx. Without + it, you may encounter issues during reboot. The mmc-pwrseq should be + compatible with mmc-pwrseq-simple. Please consult + Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt for more + information. + + For SPI: + + In add of the properties below, please consult + Documentation/devicetree/bindings/spi/spi-controller.yaml for optional SPI + related properties. + +properties: + compatible: + const: silabs,wf200 + + reg: + description: + When used on SDIO bus, must be set to 1. When used on SPI bus, it is + the chip select address of the device as defined in the SPI devices + bindings. + maxItems: 1 + + spi-max-frequency: true + + interrupts: + description: The interrupt line. Triggers IRQ_TYPE_LEVEL_HIGH and + IRQ_TYPE_EDGE_RISING are both supported by the chip and the driver. When + SPI is used, this property is required. When SDIO is used, the "in-band" + interrupt provided by the SDIO bus is used unless an interrupt is defined + in the Device Tree. + maxItems: 1 + + reset-gpios: + description: (SPI only) Phandle of gpio that will be used to reset chip + during probe. Without this property, you may encounter issues with warm + boot. (For legacy purpose, the gpio in inverted when compatible == + "silabs,wfx-spi") + + For SDIO, the reset gpio should declared using a mmc-pwrseq. + maxItems: 1 + + wakeup-gpios: + description: Phandle of gpio that will be used to wake-up chip. Without this + property, driver will disable most of power saving features. + maxItems: 1 + + silabs,antenna-config-file: + $ref: /schemas/types.yaml#/definitions/string + description: Use an alternative file for antenna configuration (aka + "Platform Data Set" in Silabs jargon). Default is 'wf200.pds'. + + local-mac-address: true + + mac-address: true + +additionalProperties: false + +required: + - compatible + - reg + +examples: + - | + #include + #include + + spi0 { + #address-cells = <1>; + #size-cells = <0>; + + wifi at 0 { + compatible = "silabs,wf200"; + pinctrl-names = "default"; + pinctrl-0 = <&wfx_irq &wfx_gpios>; + reg = <0>; + interrupts-extended = <&gpio 16 IRQ_TYPE_EDGE_RISING>; + wakeup-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + spi-max-frequency = <42000000>; + }; + }; + + - | + #include + #include + + wfx_pwrseq: wfx_pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-names = "default"; + pinctrl-0 = <&wfx_reset>; + reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + mmc0 { + mmc-pwrseq = <&wfx_pwrseq>; + #address-cells = <1>; + #size-cells = <0>; + + wifi at 1 { + compatible = "silabs,wf200"; + pinctrl-names = "default"; + pinctrl-0 = <&wfx_wakeup>; + reg = <1>; + wakeup-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; + }; + }; +... -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:40 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:40 +0100 Subject: [PATCH v5 03/24] wfx: add Makefile/Kconfig In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-4-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/Kconfig | 12 +++++++++++ drivers/net/wireless/silabs/wfx/Makefile | 26 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/Kconfig create mode 100644 drivers/net/wireless/silabs/wfx/Makefile diff --git a/drivers/net/wireless/silabs/wfx/Kconfig b/drivers/net/wireless/silabs/wfx/Kconfig new file mode 100644 index 000000000000..3be4b1e735e1 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/Kconfig @@ -0,0 +1,12 @@ +config WFX + tristate "Silicon Labs wireless chips WF200 and further" + depends on MAC80211 + depends on MMC || !MMC # do not allow WFX=y if MMC=m + depends on (SPI || MMC) + help + This is a driver for Silicons Labs WFxxx series (WF200 and further) + chipsets. This chip can be found on SPI or SDIO buses. + + Silabs does not use a reliable SDIO vendor ID. So, to avoid conflicts, + the driver won't probe the device if it is not also declared in the + Device Tree. diff --git a/drivers/net/wireless/silabs/wfx/Makefile b/drivers/net/wireless/silabs/wfx/Makefile new file mode 100644 index 000000000000..f399962c8619 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/Makefile @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0 + +# Necessary for CREATE_TRACE_POINTS +CFLAGS_debug.o = -I$(src) + +wfx-y := \ + bh.o \ + hwio.o \ + fwio.o \ + hif_tx_mib.o \ + hif_tx.o \ + hif_rx.o \ + queue.o \ + data_tx.o \ + data_rx.o \ + scan.o \ + sta.o \ + key.o \ + main.o \ + sta.o \ + debug.o +wfx-$(CONFIG_SPI) += bus_spi.o +# When CONFIG_MMC == m, append to 'wfx-y' (and not to 'wfx-m') +wfx-$(subst m,y,$(CONFIG_MMC)) += bus_sdio.o + +obj-$(CONFIG_WFX) += wfx.o -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:41 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:41 +0100 Subject: [PATCH v5 04/24] wfx: add wfx.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-5-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/wfx.h | 166 ++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/wfx.h diff --git a/drivers/net/wireless/silabs/wfx/wfx.h b/drivers/net/wireless/silabs/wfx/wfx.h new file mode 100644 index 000000000000..ba18bbfacd2b --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/wfx.h @@ -0,0 +1,166 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Common private data for Silicon Labs WFx chips. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + * Copyright (c) 2006, Michael Wu + * Copyright 2004-2006 Jean-Baptiste Note , et al. + */ +#ifndef WFX_H +#define WFX_H + +#include +#include +#include +#include +#include + +#include "bh.h" +#include "data_tx.h" +#include "main.h" +#include "queue.h" +#include "hif_tx.h" + +#define USEC_PER_TXOP 32 /* see struct ieee80211_tx_queue_params */ +#define USEC_PER_TU 1024 + +struct hwbus_ops; + +struct wfx_dev { + struct wfx_platform_data pdata; + struct device *dev; + struct ieee80211_hw *hw; + struct ieee80211_vif *vif[2]; + struct mac_address addresses[2]; + const struct hwbus_ops *hwbus_ops; + void *hwbus_priv; + + u8 keyset; + struct completion firmware_ready; + struct hif_ind_startup hw_caps; + struct wfx_hif hif; + struct delayed_work cooling_timeout_work; + bool poll_irq; + bool chip_frozen; + struct mutex conf_mutex; + + struct wfx_hif_cmd hif_cmd; + struct sk_buff_head tx_pending; + wait_queue_head_t tx_dequeue; + atomic_t tx_lock; + + atomic_t packet_id; + u32 key_map; + + struct hif_rx_stats rx_stats; + struct mutex rx_stats_lock; + struct hif_tx_power_loop_info tx_power_loop_info; + struct mutex tx_power_loop_info_lock; + int force_ps_timeout; +}; + +struct wfx_vif { + struct wfx_dev *wdev; + struct ieee80211_vif *vif; + struct ieee80211_channel *channel; + int id; + + u32 link_id_map; + + bool after_dtim_tx_allowed; + bool join_in_progress; + + struct delayed_work beacon_loss_work; + + struct wfx_queue tx_queue[4]; + struct tx_policy_cache tx_policy_cache; + struct work_struct tx_policy_upload_work; + + struct work_struct update_tim_work; + + unsigned long uapsd_mask; + + /* avoid some operations in parallel with scan */ + struct mutex scan_lock; + struct work_struct scan_work; + struct completion scan_complete; + bool scan_abort; + struct ieee80211_scan_request *scan_req; + + struct completion set_pm_mode_complete; +}; + +static inline struct wfx_vif *wdev_to_wvif(struct wfx_dev *wdev, int vif_id) +{ + if (vif_id >= ARRAY_SIZE(wdev->vif)) { + dev_dbg(wdev->dev, "requesting non-existent vif: %d\n", vif_id); + return NULL; + } + vif_id = array_index_nospec(vif_id, ARRAY_SIZE(wdev->vif)); + if (!wdev->vif[vif_id]) { + dev_dbg(wdev->dev, "requesting non-allocated vif: %d\n", + vif_id); + return NULL; + } + return (struct wfx_vif *) wdev->vif[vif_id]->drv_priv; +} + +static inline struct wfx_vif *wvif_iterate(struct wfx_dev *wdev, + struct wfx_vif *cur) +{ + int i; + int mark = 0; + struct wfx_vif *tmp; + + if (!cur) + mark = 1; + for (i = 0; i < ARRAY_SIZE(wdev->vif); i++) { + tmp = wdev_to_wvif(wdev, i); + if (mark && tmp) + return tmp; + if (tmp == cur) + mark = 1; + } + return NULL; +} + +static inline int wvif_count(struct wfx_dev *wdev) +{ + int i; + int ret = 0; + struct wfx_vif *wvif; + + for (i = 0; i < ARRAY_SIZE(wdev->vif); i++) { + wvif = wdev_to_wvif(wdev, i); + if (wvif) + ret++; + } + return ret; +} + +static inline void memreverse(u8 *src, u8 length) +{ + u8 *lo = src; + u8 *hi = src + length - 1; + u8 swap; + + while (lo < hi) { + swap = *lo; + *lo++ = *hi; + *hi-- = swap; + } +} + +static inline int memzcmp(void *src, unsigned int size) +{ + u8 *buf = src; + + if (!size) + return 0; + if (*buf) + return 1; + return memcmp(buf, buf + 1, size - 1); +} + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:42 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:42 +0100 Subject: [PATCH v5 05/24] wfx: add main.c/main.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-6-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/main.c | 503 +++++++++++++++++++++++++ drivers/net/wireless/silabs/wfx/main.h | 43 +++ 2 files changed, 546 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/main.c create mode 100644 drivers/net/wireless/silabs/wfx/main.h diff --git a/drivers/net/wireless/silabs/wfx/main.c b/drivers/net/wireless/silabs/wfx/main.c new file mode 100644 index 000000000000..16c4806fc932 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/main.c @@ -0,0 +1,503 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Device probe and register. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + * Copyright (c) 2008, Johannes Berg + * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 2007-2009, Christian Lamparter + * Copyright (c) 2006, Michael Wu + * Copyright (c) 2004-2006 Jean-Baptiste Note , et al. + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "main.h" +#include "wfx.h" +#include "fwio.h" +#include "hwio.h" +#include "bus.h" +#include "bh.h" +#include "sta.h" +#include "key.h" +#include "scan.h" +#include "debug.h" +#include "data_tx.h" +#include "hif_tx_mib.h" +#include "hif_api_cmd.h" + +#define WFX_PDS_MAX_SIZE 1500 + +MODULE_DESCRIPTION("Silicon Labs 802.11 Wireless LAN driver for WFx"); +MODULE_AUTHOR("J?r?me Pouiller "); +MODULE_LICENSE("GPL"); + +#define RATETAB_ENT(_rate, _rateid, _flags) { \ + .bitrate = (_rate), \ + .hw_value = (_rateid), \ + .flags = (_flags), \ +} + +static struct ieee80211_rate wfx_rates[] = { + RATETAB_ENT(10, 0, 0), + RATETAB_ENT(20, 1, IEEE80211_RATE_SHORT_PREAMBLE), + RATETAB_ENT(55, 2, IEEE80211_RATE_SHORT_PREAMBLE), + RATETAB_ENT(110, 3, IEEE80211_RATE_SHORT_PREAMBLE), + RATETAB_ENT(60, 6, 0), + RATETAB_ENT(90, 7, 0), + RATETAB_ENT(120, 8, 0), + RATETAB_ENT(180, 9, 0), + RATETAB_ENT(240, 10, 0), + RATETAB_ENT(360, 11, 0), + RATETAB_ENT(480, 12, 0), + RATETAB_ENT(540, 13, 0), +}; + +#define CHAN2G(_channel, _freq, _flags) { \ + .band = NL80211_BAND_2GHZ, \ + .center_freq = (_freq), \ + .hw_value = (_channel), \ + .flags = (_flags), \ + .max_antenna_gain = 0, \ + .max_power = 30, \ +} + +static struct ieee80211_channel wfx_2ghz_chantable[] = { + CHAN2G(1, 2412, 0), + CHAN2G(2, 2417, 0), + CHAN2G(3, 2422, 0), + CHAN2G(4, 2427, 0), + CHAN2G(5, 2432, 0), + CHAN2G(6, 2437, 0), + CHAN2G(7, 2442, 0), + CHAN2G(8, 2447, 0), + CHAN2G(9, 2452, 0), + CHAN2G(10, 2457, 0), + CHAN2G(11, 2462, 0), + CHAN2G(12, 2467, 0), + CHAN2G(13, 2472, 0), + CHAN2G(14, 2484, 0), +}; + +static const struct ieee80211_supported_band wfx_band_2ghz = { + .channels = wfx_2ghz_chantable, + .n_channels = ARRAY_SIZE(wfx_2ghz_chantable), + .bitrates = wfx_rates, + .n_bitrates = ARRAY_SIZE(wfx_rates), + .ht_cap = { + /* Receive caps */ + .cap = IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_20 | + IEEE80211_HT_CAP_MAX_AMSDU | + (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT), + .ht_supported = 1, + .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, + .ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE, + .mcs = { + .rx_mask = { 0xFF }, /* MCS0 to MCS7 */ + .rx_highest = cpu_to_le16(72), + .tx_params = IEEE80211_HT_MCS_TX_DEFINED, + }, + }, +}; + +static const struct ieee80211_iface_limit wdev_iface_limits[] = { + { .max = 1, .types = BIT(NL80211_IFTYPE_STATION) }, + { .max = 1, .types = BIT(NL80211_IFTYPE_AP) }, +}; + +static const struct ieee80211_iface_combination wfx_iface_combinations[] = { + { + .num_different_channels = 2, + .max_interfaces = 2, + .limits = wdev_iface_limits, + .n_limits = ARRAY_SIZE(wdev_iface_limits), + } +}; + +static const struct ieee80211_ops wfx_ops = { + .start = wfx_start, + .stop = wfx_stop, + .add_interface = wfx_add_interface, + .remove_interface = wfx_remove_interface, + .config = wfx_config, + .tx = wfx_tx, + .join_ibss = wfx_join_ibss, + .leave_ibss = wfx_leave_ibss, + .conf_tx = wfx_conf_tx, + .hw_scan = wfx_hw_scan, + .cancel_hw_scan = wfx_cancel_hw_scan, + .start_ap = wfx_start_ap, + .stop_ap = wfx_stop_ap, + .sta_add = wfx_sta_add, + .sta_remove = wfx_sta_remove, + .set_tim = wfx_set_tim, + .set_key = wfx_set_key, + .set_rts_threshold = wfx_set_rts_threshold, + .set_default_unicast_key = wfx_set_default_unicast_key, + .bss_info_changed = wfx_bss_info_changed, + .configure_filter = wfx_configure_filter, + .ampdu_action = wfx_ampdu_action, + .flush = wfx_flush, + .add_chanctx = wfx_add_chanctx, + .remove_chanctx = wfx_remove_chanctx, + .change_chanctx = wfx_change_chanctx, + .assign_vif_chanctx = wfx_assign_vif_chanctx, + .unassign_vif_chanctx = wfx_unassign_vif_chanctx, +}; + +bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor) +{ + if (wdev->hw_caps.api_version_major < major) + return true; + if (wdev->hw_caps.api_version_major > major) + return false; + if (wdev->hw_caps.api_version_minor < minor) + return true; + return false; +} + +/* The device needs data about the antenna configuration. This information in + * provided by PDS (Platform Data Set, this is the wording used in WF200 + * documentation) files. For hardware integrators, the full process to create + * PDS files is described here: + * https:github.com/SiliconLabs/wfx-firmware/blob/master/PDS/README.md + * + * So this function aims to send PDS to the device. However, the PDS file is + * often bigger than Rx buffers of the chip, so it has to be sent in multiple + * parts. + * + * In add, the PDS data cannot be split anywhere. The PDS files contains tree + * structures. Braces are used to enter/leave a level of the tree (in a JSON + * fashion). PDS files can only been split between root nodes. + */ +int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) +{ + int ret; + int start, brace_level, i; + + start = 0; + brace_level = 0; + if (buf[0] != '{') { + dev_err(wdev->dev, "valid PDS start with '{'. Did you forget to compress it?\n"); + return -EINVAL; + } + for (i = 1; i < len - 1; i++) { + if (buf[i] == '{') + brace_level++; + if (buf[i] == '}') + brace_level--; + if (buf[i] == '}' && !brace_level) { + i++; + if (i - start + 1 > WFX_PDS_MAX_SIZE) + return -EFBIG; + buf[start] = '{'; + buf[i] = 0; + dev_dbg(wdev->dev, "send PDS '%s}'\n", buf + start); + buf[i] = '}'; + ret = hif_configuration(wdev, buf + start, + i - start + 1); + if (ret > 0) { + dev_err(wdev->dev, "PDS bytes %d to %d: invalid data (unsupported options?)\n", + start, i); + return -EINVAL; + } + if (ret == -ETIMEDOUT) { + dev_err(wdev->dev, "PDS bytes %d to %d: chip didn't reply (corrupted file?)\n", + start, i); + return ret; + } + if (ret) { + dev_err(wdev->dev, "PDS bytes %d to %d: chip returned an unknown error\n", + start, i); + return -EIO; + } + buf[i] = ','; + start = i; + } + } + return 0; +} + +static int wfx_send_pdata_pds(struct wfx_dev *wdev) +{ + int ret = 0; + const struct firmware *pds; + u8 *tmp_buf; + + ret = request_firmware(&pds, wdev->pdata.file_pds, wdev->dev); + if (ret) { + dev_err(wdev->dev, "can't load PDS file %s\n", + wdev->pdata.file_pds); + return ret; + } + tmp_buf = kmemdup(pds->data, pds->size, GFP_KERNEL); + if (!tmp_buf) { + ret = -ENOMEM; + goto release_fw; + } + ret = wfx_send_pds(wdev, tmp_buf, pds->size); + kfree(tmp_buf); +release_fw: + release_firmware(pds); + return ret; +} + +static void wfx_free_common(void *data) +{ + struct wfx_dev *wdev = data; + + mutex_destroy(&wdev->tx_power_loop_info_lock); + mutex_destroy(&wdev->rx_stats_lock); + mutex_destroy(&wdev->conf_mutex); + ieee80211_free_hw(wdev->hw); +} + +struct wfx_dev *wfx_init_common(struct device *dev, + const struct wfx_platform_data *pdata, + const struct hwbus_ops *hwbus_ops, + void *hwbus_priv) +{ + struct ieee80211_hw *hw; + struct wfx_dev *wdev; + + hw = ieee80211_alloc_hw(sizeof(struct wfx_dev), &wfx_ops); + if (!hw) + return NULL; + + SET_IEEE80211_DEV(hw, dev); + + ieee80211_hw_set(hw, TX_AMPDU_SETUP_IN_HW); + ieee80211_hw_set(hw, AMPDU_AGGREGATION); + ieee80211_hw_set(hw, CONNECTION_MONITOR); + ieee80211_hw_set(hw, REPORTS_TX_ACK_STATUS); + ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS); + ieee80211_hw_set(hw, SIGNAL_DBM); + ieee80211_hw_set(hw, SUPPORTS_PS); + ieee80211_hw_set(hw, MFP_CAPABLE); + + hw->vif_data_size = sizeof(struct wfx_vif); + hw->sta_data_size = sizeof(struct wfx_sta_priv); + hw->queues = 4; + hw->max_rates = 8; + hw->max_rate_tries = 8; + hw->extra_tx_headroom = sizeof(struct hif_msg) + + sizeof(struct hif_req_tx) + + 4 /* alignment */ + 8 /* TKIP IV */; + hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | + BIT(NL80211_IFTYPE_ADHOC) | + BIT(NL80211_IFTYPE_AP); + hw->wiphy->probe_resp_offload = NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS | + NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 | + NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P | + NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U; + hw->wiphy->features |= NL80211_FEATURE_AP_SCAN; + hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD; + hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; + hw->wiphy->max_ap_assoc_sta = HIF_LINK_ID_MAX; + hw->wiphy->max_scan_ssids = 2; + hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; + hw->wiphy->n_iface_combinations = ARRAY_SIZE(wfx_iface_combinations); + hw->wiphy->iface_combinations = wfx_iface_combinations; + hw->wiphy->bands[NL80211_BAND_2GHZ] = devm_kmalloc(dev, sizeof(wfx_band_2ghz), GFP_KERNEL); + /* FIXME: also copy wfx_rates and wfx_2ghz_chantable */ + memcpy(hw->wiphy->bands[NL80211_BAND_2GHZ], &wfx_band_2ghz, + sizeof(wfx_band_2ghz)); + + wdev = hw->priv; + wdev->hw = hw; + wdev->dev = dev; + wdev->hwbus_ops = hwbus_ops; + wdev->hwbus_priv = hwbus_priv; + memcpy(&wdev->pdata, pdata, sizeof(*pdata)); + of_property_read_string(dev->of_node, "silabs,antenna-config-file", + &wdev->pdata.file_pds); + wdev->pdata.gpio_wakeup = devm_gpiod_get_optional(dev, "wakeup", + GPIOD_OUT_LOW); + if (IS_ERR(wdev->pdata.gpio_wakeup)) + return NULL; + if (wdev->pdata.gpio_wakeup) + gpiod_set_consumer_name(wdev->pdata.gpio_wakeup, "wfx wakeup"); + + mutex_init(&wdev->conf_mutex); + mutex_init(&wdev->rx_stats_lock); + mutex_init(&wdev->tx_power_loop_info_lock); + init_completion(&wdev->firmware_ready); + INIT_DELAYED_WORK(&wdev->cooling_timeout_work, + wfx_cooling_timeout_work); + skb_queue_head_init(&wdev->tx_pending); + init_waitqueue_head(&wdev->tx_dequeue); + wfx_init_hif_cmd(&wdev->hif_cmd); + wdev->force_ps_timeout = -1; + + if (devm_add_action_or_reset(dev, wfx_free_common, wdev)) + return NULL; + + return wdev; +} + +int wfx_probe(struct wfx_dev *wdev) +{ + int i; + int err; + const void *macaddr; + struct gpio_desc *gpio_saved; + + /* During first part of boot, gpio_wakeup cannot yet been used. So + * prevent bh() to touch it. + */ + gpio_saved = wdev->pdata.gpio_wakeup; + wdev->pdata.gpio_wakeup = NULL; + wdev->poll_irq = true; + + wfx_bh_register(wdev); + + err = wfx_init_device(wdev); + if (err) + goto err0; + + wfx_bh_poll_irq(wdev); + err = wait_for_completion_timeout(&wdev->firmware_ready, 1 * HZ); + if (err <= 0) { + if (err == 0) { + dev_err(wdev->dev, "timeout while waiting for startup indication\n"); + err = -ETIMEDOUT; + } else if (err == -ERESTARTSYS) { + dev_info(wdev->dev, "probe interrupted by user\n"); + } + goto err0; + } + + /* FIXME: fill wiphy::hw_version */ + dev_info(wdev->dev, "started firmware %d.%d.%d \"%s\" (API: %d.%d, keyset: %02X, caps: 0x%.8X)\n", + wdev->hw_caps.firmware_major, wdev->hw_caps.firmware_minor, + wdev->hw_caps.firmware_build, wdev->hw_caps.firmware_label, + wdev->hw_caps.api_version_major, wdev->hw_caps.api_version_minor, + wdev->keyset, wdev->hw_caps.link_mode); + snprintf(wdev->hw->wiphy->fw_version, + sizeof(wdev->hw->wiphy->fw_version), + "%d.%d.%d", + wdev->hw_caps.firmware_major, + wdev->hw_caps.firmware_minor, + wdev->hw_caps.firmware_build); + + if (wfx_api_older_than(wdev, 1, 0)) { + dev_err(wdev->dev, + "unsupported firmware API version (expect 1 while firmware returns %d)\n", + wdev->hw_caps.api_version_major); + err = -ENOTSUPP; + goto err0; + } + + if (wdev->hw_caps.link_mode == SEC_LINK_ENFORCED) { + dev_err(wdev->dev, + "chip require secure_link, but can't negotiate it\n"); + goto err0; + } + + if (wdev->hw_caps.region_sel_mode) { + wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[11].flags |= IEEE80211_CHAN_NO_IR; + wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[12].flags |= IEEE80211_CHAN_NO_IR; + wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[13].flags |= IEEE80211_CHAN_DISABLED; + } + + dev_dbg(wdev->dev, "sending configuration file %s\n", + wdev->pdata.file_pds); + err = wfx_send_pdata_pds(wdev); + if (err < 0) + goto err0; + + wdev->poll_irq = false; + err = wdev->hwbus_ops->irq_subscribe(wdev->hwbus_priv); + if (err) + goto err0; + + err = hif_use_multi_tx_conf(wdev, true); + if (err) + dev_err(wdev->dev, "misconfigured IRQ?\n"); + + wdev->pdata.gpio_wakeup = gpio_saved; + if (wdev->pdata.gpio_wakeup) { + dev_dbg(wdev->dev, + "enable 'quiescent' power mode with wakeup GPIO and PDS file %s\n", + wdev->pdata.file_pds); + gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1); + control_reg_write(wdev, 0); + hif_set_operational_mode(wdev, HIF_OP_POWER_MODE_QUIESCENT); + } else { + hif_set_operational_mode(wdev, HIF_OP_POWER_MODE_DOZE); + } + + for (i = 0; i < ARRAY_SIZE(wdev->addresses); i++) { + eth_zero_addr(wdev->addresses[i].addr); + macaddr = of_get_mac_address(wdev->dev->of_node); + if (!IS_ERR_OR_NULL(macaddr)) { + ether_addr_copy(wdev->addresses[i].addr, macaddr); + wdev->addresses[i].addr[ETH_ALEN - 1] += i; + } else { + ether_addr_copy(wdev->addresses[i].addr, + wdev->hw_caps.mac_addr[i]); + } + if (!is_valid_ether_addr(wdev->addresses[i].addr)) { + dev_warn(wdev->dev, "using random MAC address\n"); + eth_random_addr(wdev->addresses[i].addr); + } + dev_info(wdev->dev, "MAC address %d: %pM\n", i, + wdev->addresses[i].addr); + } + wdev->hw->wiphy->n_addresses = ARRAY_SIZE(wdev->addresses); + wdev->hw->wiphy->addresses = wdev->addresses; + + err = ieee80211_register_hw(wdev->hw); + if (err) + goto err1; + + err = wfx_debug_init(wdev); + if (err) + goto err2; + + return 0; + +err2: + ieee80211_unregister_hw(wdev->hw); +err1: + wdev->hwbus_ops->irq_unsubscribe(wdev->hwbus_priv); +err0: + wfx_bh_unregister(wdev); + return err; +} + +void wfx_release(struct wfx_dev *wdev) +{ + ieee80211_unregister_hw(wdev->hw); + hif_shutdown(wdev); + wdev->hwbus_ops->irq_unsubscribe(wdev->hwbus_priv); + wfx_bh_unregister(wdev); +} + +static int __init wfx_core_init(void) +{ + int ret = 0; + + if (IS_ENABLED(CONFIG_SPI)) + ret = spi_register_driver(&wfx_spi_driver); + if (IS_ENABLED(CONFIG_MMC) && !ret) + ret = sdio_register_driver(&wfx_sdio_driver); + return ret; +} +module_init(wfx_core_init); + +static void __exit wfx_core_exit(void) +{ + if (IS_ENABLED(CONFIG_MMC)) + sdio_unregister_driver(&wfx_sdio_driver); + if (IS_ENABLED(CONFIG_SPI)) + spi_unregister_driver(&wfx_spi_driver); +} +module_exit(wfx_core_exit); diff --git a/drivers/net/wireless/silabs/wfx/main.h b/drivers/net/wireless/silabs/wfx/main.h new file mode 100644 index 000000000000..115abd2d4378 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/main.h @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Device probe and register. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + * Copyright (c) 2006, Michael Wu + * Copyright 2004-2006 Jean-Baptiste Note , et al. + */ +#ifndef WFX_MAIN_H +#define WFX_MAIN_H + +#include +#include + +#include "hif_api_general.h" + +struct wfx_dev; +struct hwbus_ops; + +struct wfx_platform_data { + /* Keyset and ".sec" extension will be appended to this string */ + const char *file_fw; + const char *file_pds; + struct gpio_desc *gpio_wakeup; + /* if true HIF D_out is sampled on the rising edge of the clock + * (intended to be used in 50Mhz SDIO) + */ + bool use_rising_clk; +}; + +struct wfx_dev *wfx_init_common(struct device *dev, + const struct wfx_platform_data *pdata, + const struct hwbus_ops *hwbus_ops, + void *hwbus_priv); + +int wfx_probe(struct wfx_dev *wdev); +void wfx_release(struct wfx_dev *wdev); + +bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor); +int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len); + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:43 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:43 +0100 Subject: [PATCH v5 06/24] wfx: add bus.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-7-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/bus.h | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/bus.h diff --git a/drivers/net/wireless/silabs/wfx/bus.h b/drivers/net/wireless/silabs/wfx/bus.h new file mode 100644 index 000000000000..ca04b3da6204 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/bus.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Common bus abstraction layer. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#ifndef WFX_BUS_H +#define WFX_BUS_H + +#include +#include + +#define WFX_REG_CONFIG 0x0 +#define WFX_REG_CONTROL 0x1 +#define WFX_REG_IN_OUT_QUEUE 0x2 +#define WFX_REG_AHB_DPORT 0x3 +#define WFX_REG_BASE_ADDR 0x4 +#define WFX_REG_SRAM_DPORT 0x5 +#define WFX_REG_SET_GEN_R_W 0x6 +#define WFX_REG_FRAME_OUT 0x7 + +struct hwbus_ops { + int (*copy_from_io)(void *bus_priv, unsigned int addr, + void *dst, size_t count); + int (*copy_to_io)(void *bus_priv, unsigned int addr, + const void *src, size_t count); + int (*irq_subscribe)(void *bus_priv); + int (*irq_unsubscribe)(void *bus_priv); + void (*lock)(void *bus_priv); + void (*unlock)(void *bus_priv); + size_t (*align_size)(void *bus_priv, size_t size); +}; + +extern struct sdio_driver wfx_sdio_driver; +extern struct spi_driver wfx_spi_driver; + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:44 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:44 +0100 Subject: [PATCH v5 07/24] wfx: add bus_spi.c In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-8-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/bus_spi.c | 271 ++++++++++++++++++++++ 1 file changed, 271 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/bus_spi.c diff --git a/drivers/net/wireless/silabs/wfx/bus_spi.c b/drivers/net/wireless/silabs/wfx/bus_spi.c new file mode 100644 index 000000000000..56375004c920 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/bus_spi.c @@ -0,0 +1,271 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * SPI interface. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2011, Sagrad Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#include +#include +#include +#include +#include +#include +#include + +#include "bus.h" +#include "wfx.h" +#include "hwio.h" +#include "main.h" +#include "bh.h" + +#define SET_WRITE 0x7FFF /* usage: and operation */ +#define SET_READ 0x8000 /* usage: or operation */ + +#define WFX_RESET_INVERTED 1 + +static const struct wfx_platform_data wfx_spi_pdata = { + .file_fw = "wfm_wf200", + .file_pds = "wf200.pds", + .use_rising_clk = true, +}; + +struct wfx_spi_priv { + struct spi_device *func; + struct wfx_dev *core; + struct gpio_desc *gpio_reset; + bool need_swab; +}; + +/* WFx chip read data 16bits at time and place them directly into (little + * endian) CPU register. So, chip expect byte order like "B1 B0 B3 B2" (while + * LE is "B0 B1 B2 B3" and BE is "B3 B2 B1 B0") + * + * A little endian host with bits_per_word == 16 should do the right job + * natively. The code below to support big endian host and commonly used SPI + * 8bits. + */ +static int wfx_spi_copy_from_io(void *priv, unsigned int addr, + void *dst, size_t count) +{ + struct wfx_spi_priv *bus = priv; + u16 regaddr = (addr << 12) | (count / 2) | SET_READ; + struct spi_message m; + struct spi_transfer t_addr = { + .tx_buf = ®addr, + .len = sizeof(regaddr), + }; + struct spi_transfer t_msg = { + .rx_buf = dst, + .len = count, + }; + u16 *dst16 = dst; + int ret, i; + + WARN(count % 2, "buffer size must be a multiple of 2"); + + cpu_to_le16s(®addr); + if (bus->need_swab) + swab16s(®addr); + + spi_message_init(&m); + spi_message_add_tail(&t_addr, &m); + spi_message_add_tail(&t_msg, &m); + ret = spi_sync(bus->func, &m); + + if (bus->need_swab && addr == WFX_REG_CONFIG) + for (i = 0; i < count / 2; i++) + swab16s(&dst16[i]); + return ret; +} + +static int wfx_spi_copy_to_io(void *priv, unsigned int addr, + const void *src, size_t count) +{ + struct wfx_spi_priv *bus = priv; + u16 regaddr = (addr << 12) | (count / 2); + /* FIXME: use a bounce buffer */ + u16 *src16 = (void *)src; + int ret, i; + struct spi_message m; + struct spi_transfer t_addr = { + .tx_buf = ®addr, + .len = sizeof(regaddr), + }; + struct spi_transfer t_msg = { + .tx_buf = src, + .len = count, + }; + + WARN(count % 2, "buffer size must be a multiple of 2"); + WARN(regaddr & SET_READ, "bad addr or size overflow"); + + cpu_to_le16s(®addr); + + /* Register address and CONFIG content always use 16bit big endian + * ("BADC" order) + */ + if (bus->need_swab) + swab16s(®addr); + if (bus->need_swab && addr == WFX_REG_CONFIG) + for (i = 0; i < count / 2; i++) + swab16s(&src16[i]); + + spi_message_init(&m); + spi_message_add_tail(&t_addr, &m); + spi_message_add_tail(&t_msg, &m); + ret = spi_sync(bus->func, &m); + + if (bus->need_swab && addr == WFX_REG_CONFIG) + for (i = 0; i < count / 2; i++) + swab16s(&src16[i]); + return ret; +} + +static void wfx_spi_lock(void *priv) +{ +} + +static void wfx_spi_unlock(void *priv) +{ +} + +static irqreturn_t wfx_spi_irq_handler(int irq, void *priv) +{ + struct wfx_spi_priv *bus = priv; + + wfx_bh_request_rx(bus->core); + return IRQ_HANDLED; +} + +static int wfx_spi_irq_subscribe(void *priv) +{ + struct wfx_spi_priv *bus = priv; + u32 flags; + + flags = irq_get_trigger_type(bus->func->irq); + if (!flags) + flags = IRQF_TRIGGER_HIGH; + flags |= IRQF_ONESHOT; + return devm_request_threaded_irq(&bus->func->dev, bus->func->irq, NULL, + wfx_spi_irq_handler, IRQF_ONESHOT, + "wfx", bus); +} + +static int wfx_spi_irq_unsubscribe(void *priv) +{ + struct wfx_spi_priv *bus = priv; + + devm_free_irq(&bus->func->dev, bus->func->irq, bus); + return 0; +} + +static size_t wfx_spi_align_size(void *priv, size_t size) +{ + /* Most of SPI controllers avoid DMA if buffer size is not 32bit aligned + */ + return ALIGN(size, 4); +} + +static const struct hwbus_ops wfx_spi_hwbus_ops = { + .copy_from_io = wfx_spi_copy_from_io, + .copy_to_io = wfx_spi_copy_to_io, + .irq_subscribe = wfx_spi_irq_subscribe, + .irq_unsubscribe = wfx_spi_irq_unsubscribe, + .lock = wfx_spi_lock, + .unlock = wfx_spi_unlock, + .align_size = wfx_spi_align_size, +}; + +static int wfx_spi_probe(struct spi_device *func) +{ + struct wfx_spi_priv *bus; + int ret; + + if (!func->bits_per_word) + func->bits_per_word = 16; + ret = spi_setup(func); + if (ret) + return ret; + /* Trace below is also displayed by spi_setup() if compiled with DEBUG */ + dev_dbg(&func->dev, "SPI params: CS=%d, mode=%d bits/word=%d speed=%d\n", + func->chip_select, func->mode, func->bits_per_word, + func->max_speed_hz); + if (func->bits_per_word != 16 && func->bits_per_word != 8) + dev_warn(&func->dev, "unusual bits/word value: %d\n", + func->bits_per_word); + if (func->max_speed_hz > 50000000) + dev_warn(&func->dev, "%dHz is a very high speed\n", + func->max_speed_hz); + + bus = devm_kzalloc(&func->dev, sizeof(*bus), GFP_KERNEL); + if (!bus) + return -ENOMEM; + bus->func = func; + if (func->bits_per_word == 8 || IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) + bus->need_swab = true; + spi_set_drvdata(func, bus); + + bus->gpio_reset = devm_gpiod_get_optional(&func->dev, "reset", + GPIOD_OUT_LOW); + if (IS_ERR(bus->gpio_reset)) + return PTR_ERR(bus->gpio_reset); + if (!bus->gpio_reset) { + dev_warn(&func->dev, + "gpio reset is not defined, trying to load firmware anyway\n"); + } else { + gpiod_set_consumer_name(bus->gpio_reset, "wfx reset"); + if (spi_get_device_id(func)->driver_data & WFX_RESET_INVERTED) + gpiod_toggle_active_low(bus->gpio_reset); + gpiod_set_value_cansleep(bus->gpio_reset, 1); + usleep_range(100, 150); + gpiod_set_value_cansleep(bus->gpio_reset, 0); + usleep_range(2000, 2500); + } + + bus->core = wfx_init_common(&func->dev, &wfx_spi_pdata, + &wfx_spi_hwbus_ops, bus); + if (!bus->core) + return -EIO; + + return wfx_probe(bus->core); +} + +static int wfx_spi_remove(struct spi_device *func) +{ + struct wfx_spi_priv *bus = spi_get_drvdata(func); + + wfx_release(bus->core); + return 0; +} + +/* For dynamic driver binding, kernel does not use OF to match driver. It only + * use modalias and modalias is a copy of 'compatible' DT node with vendor + * stripped. + */ +static const struct spi_device_id wfx_spi_id[] = { + { "wfx-spi", WFX_RESET_INVERTED }, + { "wf200", 0 }, + { }, +}; +MODULE_DEVICE_TABLE(spi, wfx_spi_id); + +#ifdef CONFIG_OF +static const struct of_device_id wfx_spi_of_match[] = { + { .compatible = "silabs,wfx-spi", .data = (void *)WFX_RESET_INVERTED }, + { .compatible = "silabs,wf200" }, + { }, +}; +MODULE_DEVICE_TABLE(of, wfx_spi_of_match); +#endif + +struct spi_driver wfx_spi_driver = { + .driver = { + .name = "wfx-spi", + .of_match_table = of_match_ptr(wfx_spi_of_match), + }, + .id_table = wfx_spi_id, + .probe = wfx_spi_probe, + .remove = wfx_spi_remove, +}; -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:45 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:45 +0100 Subject: [PATCH v5 08/24] wfx: add bus_sdio.c In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-9-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/bus_sdio.c | 259 +++++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/bus_sdio.c diff --git a/drivers/net/wireless/silabs/wfx/bus_sdio.c b/drivers/net/wireless/silabs/wfx/bus_sdio.c new file mode 100644 index 000000000000..55b6728416ba --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/bus_sdio.c @@ -0,0 +1,259 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * SDIO interface. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "bus.h" +#include "wfx.h" +#include "hwio.h" +#include "main.h" +#include "bh.h" + +static const struct wfx_platform_data wfx_sdio_pdata = { + .file_fw = "wfm_wf200", + .file_pds = "wf200.pds", +}; + +struct wfx_sdio_priv { + struct sdio_func *func; + struct wfx_dev *core; + u8 buf_id_tx; + u8 buf_id_rx; + int of_irq; +}; + +static int wfx_sdio_copy_from_io(void *priv, unsigned int reg_id, + void *dst, size_t count) +{ + struct wfx_sdio_priv *bus = priv; + unsigned int sdio_addr = reg_id << 2; + int ret; + + WARN(reg_id > 7, "chip only has 7 registers"); + WARN(((uintptr_t)dst) & 3, "unaligned buffer size"); + WARN(count & 3, "unaligned buffer address"); + + /* Use queue mode buffers */ + if (reg_id == WFX_REG_IN_OUT_QUEUE) + sdio_addr |= (bus->buf_id_rx + 1) << 7; + ret = sdio_memcpy_fromio(bus->func, dst, sdio_addr, count); + if (!ret && reg_id == WFX_REG_IN_OUT_QUEUE) + bus->buf_id_rx = (bus->buf_id_rx + 1) % 4; + + return ret; +} + +static int wfx_sdio_copy_to_io(void *priv, unsigned int reg_id, + const void *src, size_t count) +{ + struct wfx_sdio_priv *bus = priv; + unsigned int sdio_addr = reg_id << 2; + int ret; + + WARN(reg_id > 7, "chip only has 7 registers"); + WARN(((uintptr_t)src) & 3, "unaligned buffer size"); + WARN(count & 3, "unaligned buffer address"); + + /* Use queue mode buffers */ + if (reg_id == WFX_REG_IN_OUT_QUEUE) + sdio_addr |= bus->buf_id_tx << 7; + /* FIXME: discards 'const' qualifier for src */ + ret = sdio_memcpy_toio(bus->func, sdio_addr, (void *)src, count); + if (!ret && reg_id == WFX_REG_IN_OUT_QUEUE) + bus->buf_id_tx = (bus->buf_id_tx + 1) % 32; + + return ret; +} + +static void wfx_sdio_lock(void *priv) +{ + struct wfx_sdio_priv *bus = priv; + + sdio_claim_host(bus->func); +} + +static void wfx_sdio_unlock(void *priv) +{ + struct wfx_sdio_priv *bus = priv; + + sdio_release_host(bus->func); +} + +static void wfx_sdio_irq_handler(struct sdio_func *func) +{ + struct wfx_sdio_priv *bus = sdio_get_drvdata(func); + + wfx_bh_request_rx(bus->core); +} + +static irqreturn_t wfx_sdio_irq_handler_ext(int irq, void *priv) +{ + struct wfx_sdio_priv *bus = priv; + + sdio_claim_host(bus->func); + wfx_bh_request_rx(bus->core); + sdio_release_host(bus->func); + return IRQ_HANDLED; +} + +static int wfx_sdio_irq_subscribe(void *priv) +{ + struct wfx_sdio_priv *bus = priv; + u32 flags; + int ret; + u8 cccr; + + if (!bus->of_irq) { + sdio_claim_host(bus->func); + ret = sdio_claim_irq(bus->func, wfx_sdio_irq_handler); + sdio_release_host(bus->func); + return ret; + } + + sdio_claim_host(bus->func); + cccr = sdio_f0_readb(bus->func, SDIO_CCCR_IENx, NULL); + cccr |= BIT(0); + cccr |= BIT(bus->func->num); + sdio_f0_writeb(bus->func, cccr, SDIO_CCCR_IENx, NULL); + sdio_release_host(bus->func); + flags = irq_get_trigger_type(bus->of_irq); + if (!flags) + flags = IRQF_TRIGGER_HIGH; + flags |= IRQF_ONESHOT; + return devm_request_threaded_irq(&bus->func->dev, bus->of_irq, NULL, + wfx_sdio_irq_handler_ext, flags, + "wfx", bus); +} + +static int wfx_sdio_irq_unsubscribe(void *priv) +{ + struct wfx_sdio_priv *bus = priv; + int ret; + + if (bus->of_irq) + devm_free_irq(&bus->func->dev, bus->of_irq, bus); + sdio_claim_host(bus->func); + ret = sdio_release_irq(bus->func); + sdio_release_host(bus->func); + return ret; +} + +static size_t wfx_sdio_align_size(void *priv, size_t size) +{ + struct wfx_sdio_priv *bus = priv; + + return sdio_align_size(bus->func, size); +} + +static const struct hwbus_ops wfx_sdio_hwbus_ops = { + .copy_from_io = wfx_sdio_copy_from_io, + .copy_to_io = wfx_sdio_copy_to_io, + .irq_subscribe = wfx_sdio_irq_subscribe, + .irq_unsubscribe = wfx_sdio_irq_unsubscribe, + .lock = wfx_sdio_lock, + .unlock = wfx_sdio_unlock, + .align_size = wfx_sdio_align_size, +}; + +static const struct of_device_id wfx_sdio_of_match[] = { + { .compatible = "silabs,wfx-sdio" }, + { .compatible = "silabs,wf200" }, + { }, +}; +MODULE_DEVICE_TABLE(of, wfx_sdio_of_match); + +static int wfx_sdio_probe(struct sdio_func *func, + const struct sdio_device_id *id) +{ + struct device_node *np = func->dev.of_node; + struct wfx_sdio_priv *bus; + int ret; + + if (func->num != 1) { + dev_err(&func->dev, "SDIO function number is %d while it should always be 1 (unsupported chip?)\n", + func->num); + return -ENODEV; + } + + bus = devm_kzalloc(&func->dev, sizeof(*bus), GFP_KERNEL); + if (!bus) + return -ENOMEM; + + if (!np || !of_match_node(wfx_sdio_of_match, np)) { + dev_warn(&func->dev, "no compatible device found in DT\n"); + return -ENODEV; + } + + bus->func = func; + bus->of_irq = irq_of_parse_and_map(np, 0); + sdio_set_drvdata(func, bus); + func->card->quirks |= MMC_QUIRK_LENIENT_FN0 | + MMC_QUIRK_BLKSZ_FOR_BYTE_MODE | + MMC_QUIRK_BROKEN_BYTE_MODE_512; + + sdio_claim_host(func); + ret = sdio_enable_func(func); + /* Block of 64 bytes is more efficient than 512B for frame sizes < 4k */ + sdio_set_block_size(func, 64); + sdio_release_host(func); + if (ret) + goto err0; + + bus->core = wfx_init_common(&func->dev, &wfx_sdio_pdata, + &wfx_sdio_hwbus_ops, bus); + if (!bus->core) { + ret = -EIO; + goto err1; + } + + ret = wfx_probe(bus->core); + if (ret) + goto err1; + + return 0; + +err1: + sdio_claim_host(func); + sdio_disable_func(func); + sdio_release_host(func); +err0: + return ret; +} + +static void wfx_sdio_remove(struct sdio_func *func) +{ + struct wfx_sdio_priv *bus = sdio_get_drvdata(func); + + wfx_release(bus->core); + sdio_claim_host(func); + sdio_disable_func(func); + sdio_release_host(func); +} + +static const struct sdio_device_id wfx_sdio_ids[] = { + { SDIO_DEVICE(SDIO_VENDOR_ID_SILABS, SDIO_DEVICE_ID_SILABS_WF200) }, + { }, +}; +MODULE_DEVICE_TABLE(sdio, wfx_sdio_ids); + +struct sdio_driver wfx_sdio_driver = { + .name = "wfx-sdio", + .id_table = wfx_sdio_ids, + .probe = wfx_sdio_probe, + .remove = wfx_sdio_remove, + .drv = { + .owner = THIS_MODULE, + .of_match_table = wfx_sdio_of_match, + } +}; -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:46 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:46 +0100 Subject: [PATCH v5 09/24] wfx: add hwio.c/hwio.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-10-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/hwio.c | 340 +++++++++++++++++++++++++ drivers/net/wireless/silabs/wfx/hwio.h | 79 ++++++ 2 files changed, 419 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/hwio.c create mode 100644 drivers/net/wireless/silabs/wfx/hwio.h diff --git a/drivers/net/wireless/silabs/wfx/hwio.c b/drivers/net/wireless/silabs/wfx/hwio.c new file mode 100644 index 000000000000..393bcb1e2f4e --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/hwio.c @@ -0,0 +1,340 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Low-level I/O functions. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#include +#include +#include + +#include "hwio.h" +#include "wfx.h" +#include "bus.h" +#include "traces.h" + +static int read32(struct wfx_dev *wdev, int reg, u32 *val) +{ + int ret; + __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); + + *val = ~0; /* Never return undefined value */ + if (!tmp) + return -ENOMEM; + ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, reg, tmp, + sizeof(u32)); + if (ret >= 0) + *val = le32_to_cpu(*tmp); + kfree(tmp); + if (ret) + dev_err(wdev->dev, "%s: bus communication error: %d\n", + __func__, ret); + return ret; +} + +static int write32(struct wfx_dev *wdev, int reg, u32 val) +{ + int ret; + __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); + + if (!tmp) + return -ENOMEM; + *tmp = cpu_to_le32(val); + ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, reg, tmp, + sizeof(u32)); + kfree(tmp); + if (ret) + dev_err(wdev->dev, "%s: bus communication error: %d\n", + __func__, ret); + return ret; +} + +static int read32_locked(struct wfx_dev *wdev, int reg, u32 *val) +{ + int ret; + + wdev->hwbus_ops->lock(wdev->hwbus_priv); + ret = read32(wdev, reg, val); + _trace_io_read32(reg, *val); + wdev->hwbus_ops->unlock(wdev->hwbus_priv); + return ret; +} + +static int write32_locked(struct wfx_dev *wdev, int reg, u32 val) +{ + int ret; + + wdev->hwbus_ops->lock(wdev->hwbus_priv); + ret = write32(wdev, reg, val); + _trace_io_write32(reg, val); + wdev->hwbus_ops->unlock(wdev->hwbus_priv); + return ret; +} + +static int write32_bits_locked(struct wfx_dev *wdev, int reg, u32 mask, u32 val) +{ + int ret; + u32 val_r, val_w; + + WARN_ON(~mask & val); + val &= mask; + wdev->hwbus_ops->lock(wdev->hwbus_priv); + ret = read32(wdev, reg, &val_r); + _trace_io_read32(reg, val_r); + if (ret < 0) + goto err; + val_w = (val_r & ~mask) | val; + if (val_w != val_r) { + ret = write32(wdev, reg, val_w); + _trace_io_write32(reg, val_w); + } +err: + wdev->hwbus_ops->unlock(wdev->hwbus_priv); + return ret; +} + +static int indirect_read(struct wfx_dev *wdev, int reg, u32 addr, + void *buf, size_t len) +{ + int ret; + int i; + u32 cfg; + u32 prefetch; + + WARN_ON(len >= 0x2000); + WARN_ON(reg != WFX_REG_AHB_DPORT && reg != WFX_REG_SRAM_DPORT); + + if (reg == WFX_REG_AHB_DPORT) + prefetch = CFG_PREFETCH_AHB; + else if (reg == WFX_REG_SRAM_DPORT) + prefetch = CFG_PREFETCH_SRAM; + else + return -ENODEV; + + ret = write32(wdev, WFX_REG_BASE_ADDR, addr); + if (ret < 0) + goto err; + + ret = read32(wdev, WFX_REG_CONFIG, &cfg); + if (ret < 0) + goto err; + + ret = write32(wdev, WFX_REG_CONFIG, cfg | prefetch); + if (ret < 0) + goto err; + + for (i = 0; i < 20; i++) { + ret = read32(wdev, WFX_REG_CONFIG, &cfg); + if (ret < 0) + goto err; + if (!(cfg & prefetch)) + break; + usleep_range(200, 250); + } + if (i == 20) { + ret = -ETIMEDOUT; + goto err; + } + + ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, reg, buf, len); + +err: + if (ret < 0) + memset(buf, 0xFF, len); /* Never return undefined value */ + return ret; +} + +static int indirect_write(struct wfx_dev *wdev, int reg, u32 addr, + const void *buf, size_t len) +{ + int ret; + + WARN_ON(len >= 0x2000); + WARN_ON(reg != WFX_REG_AHB_DPORT && reg != WFX_REG_SRAM_DPORT); + ret = write32(wdev, WFX_REG_BASE_ADDR, addr); + if (ret < 0) + return ret; + + return wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, reg, buf, len); +} + +static int indirect_read_locked(struct wfx_dev *wdev, int reg, u32 addr, + void *buf, size_t len) +{ + int ret; + + wdev->hwbus_ops->lock(wdev->hwbus_priv); + ret = indirect_read(wdev, reg, addr, buf, len); + _trace_io_ind_read(reg, addr, buf, len); + wdev->hwbus_ops->unlock(wdev->hwbus_priv); + return ret; +} + +static int indirect_write_locked(struct wfx_dev *wdev, int reg, u32 addr, + const void *buf, size_t len) +{ + int ret; + + wdev->hwbus_ops->lock(wdev->hwbus_priv); + ret = indirect_write(wdev, reg, addr, buf, len); + _trace_io_ind_write(reg, addr, buf, len); + wdev->hwbus_ops->unlock(wdev->hwbus_priv); + return ret; +} + +static int indirect_read32_locked(struct wfx_dev *wdev, int reg, + u32 addr, u32 *val) +{ + int ret; + __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); + + if (!tmp) + return -ENOMEM; + wdev->hwbus_ops->lock(wdev->hwbus_priv); + ret = indirect_read(wdev, reg, addr, tmp, sizeof(u32)); + *val = le32_to_cpu(*tmp); + _trace_io_ind_read32(reg, addr, *val); + wdev->hwbus_ops->unlock(wdev->hwbus_priv); + kfree(tmp); + return ret; +} + +static int indirect_write32_locked(struct wfx_dev *wdev, int reg, + u32 addr, u32 val) +{ + int ret; + __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); + + if (!tmp) + return -ENOMEM; + *tmp = cpu_to_le32(val); + wdev->hwbus_ops->lock(wdev->hwbus_priv); + ret = indirect_write(wdev, reg, addr, tmp, sizeof(u32)); + _trace_io_ind_write32(reg, addr, val); + wdev->hwbus_ops->unlock(wdev->hwbus_priv); + kfree(tmp); + return ret; +} + +int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t len) +{ + int ret; + + WARN((long)buf & 3, "%s: unaligned buffer", __func__); + wdev->hwbus_ops->lock(wdev->hwbus_priv); + ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, + WFX_REG_IN_OUT_QUEUE, buf, len); + _trace_io_read(WFX_REG_IN_OUT_QUEUE, buf, len); + wdev->hwbus_ops->unlock(wdev->hwbus_priv); + if (ret) + dev_err(wdev->dev, "%s: bus communication error: %d\n", + __func__, ret); + return ret; +} + +int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t len) +{ + int ret; + + WARN((long)buf & 3, "%s: unaligned buffer", __func__); + wdev->hwbus_ops->lock(wdev->hwbus_priv); + ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, + WFX_REG_IN_OUT_QUEUE, buf, len); + _trace_io_write(WFX_REG_IN_OUT_QUEUE, buf, len); + wdev->hwbus_ops->unlock(wdev->hwbus_priv); + if (ret) + dev_err(wdev->dev, "%s: bus communication error: %d\n", + __func__, ret); + return ret; +} + +int sram_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len) +{ + return indirect_read_locked(wdev, WFX_REG_SRAM_DPORT, addr, buf, len); +} + +int ahb_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len) +{ + return indirect_read_locked(wdev, WFX_REG_AHB_DPORT, addr, buf, len); +} + +int sram_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len) +{ + return indirect_write_locked(wdev, WFX_REG_SRAM_DPORT, addr, buf, len); +} + +int ahb_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len) +{ + return indirect_write_locked(wdev, WFX_REG_AHB_DPORT, addr, buf, len); +} + +int sram_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val) +{ + return indirect_read32_locked(wdev, WFX_REG_SRAM_DPORT, addr, val); +} + +int ahb_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val) +{ + return indirect_read32_locked(wdev, WFX_REG_AHB_DPORT, addr, val); +} + +int sram_reg_write(struct wfx_dev *wdev, u32 addr, u32 val) +{ + return indirect_write32_locked(wdev, WFX_REG_SRAM_DPORT, addr, val); +} + +int ahb_reg_write(struct wfx_dev *wdev, u32 addr, u32 val) +{ + return indirect_write32_locked(wdev, WFX_REG_AHB_DPORT, addr, val); +} + +int config_reg_read(struct wfx_dev *wdev, u32 *val) +{ + return read32_locked(wdev, WFX_REG_CONFIG, val); +} + +int config_reg_write(struct wfx_dev *wdev, u32 val) +{ + return write32_locked(wdev, WFX_REG_CONFIG, val); +} + +int config_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val) +{ + return write32_bits_locked(wdev, WFX_REG_CONFIG, mask, val); +} + +int control_reg_read(struct wfx_dev *wdev, u32 *val) +{ + return read32_locked(wdev, WFX_REG_CONTROL, val); +} + +int control_reg_write(struct wfx_dev *wdev, u32 val) +{ + return write32_locked(wdev, WFX_REG_CONTROL, val); +} + +int control_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val) +{ + return write32_bits_locked(wdev, WFX_REG_CONTROL, mask, val); +} + +int igpr_reg_read(struct wfx_dev *wdev, int index, u32 *val) +{ + int ret; + + *val = ~0; /* Never return undefined value */ + ret = write32_locked(wdev, WFX_REG_SET_GEN_R_W, IGPR_RW | index << 24); + if (ret) + return ret; + ret = read32_locked(wdev, WFX_REG_SET_GEN_R_W, val); + if (ret) + return ret; + *val &= IGPR_VALUE; + return ret; +} + +int igpr_reg_write(struct wfx_dev *wdev, int index, u32 val) +{ + return write32_locked(wdev, WFX_REG_SET_GEN_R_W, index << 24 | val); +} diff --git a/drivers/net/wireless/silabs/wfx/hwio.h b/drivers/net/wireless/silabs/wfx/hwio.h new file mode 100644 index 000000000000..20b1d7a6a7de --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/hwio.h @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Low-level API. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#ifndef WFX_HWIO_H +#define WFX_HWIO_H + +#include + +struct wfx_dev; + +/* Caution: in the functions below, 'buf' will used with a DMA. So, it must be + * kmalloc'd (do not use stack allocated buffers). In doubt, enable + * CONFIG_DEBUG_SG to detect badly located buffer. + */ +int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t buf_len); +int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t buf_len); + +int sram_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len); +int sram_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len); + +int ahb_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len); +int ahb_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len); + +int sram_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val); +int sram_reg_write(struct wfx_dev *wdev, u32 addr, u32 val); + +int ahb_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val); +int ahb_reg_write(struct wfx_dev *wdev, u32 addr, u32 val); + +#define CFG_ERR_SPI_FRAME 0x00000001 /* only with SPI */ +#define CFG_ERR_SDIO_BUF_MISMATCH 0x00000001 /* only with SDIO */ +#define CFG_ERR_BUF_UNDERRUN 0x00000002 +#define CFG_ERR_DATA_IN_TOO_LARGE 0x00000004 +#define CFG_ERR_HOST_NO_OUT_QUEUE 0x00000008 +#define CFG_ERR_BUF_OVERRUN 0x00000010 +#define CFG_ERR_DATA_OUT_TOO_LARGE 0x00000020 +#define CFG_ERR_HOST_NO_IN_QUEUE 0x00000040 +#define CFG_ERR_HOST_CRC_MISS 0x00000080 /* only with SDIO */ +#define CFG_SPI_IGNORE_CS 0x00000080 /* only with SPI */ +#define CFG_BYTE_ORDER_MASK 0x00000300 /* only writable with SPI */ +#define CFG_BYTE_ORDER_BADC 0x00000000 +#define CFG_BYTE_ORDER_DCBA 0x00000100 +#define CFG_BYTE_ORDER_ABCD 0x00000200 /* SDIO always use this value */ +#define CFG_DIRECT_ACCESS_MODE 0x00000400 +#define CFG_PREFETCH_AHB 0x00000800 +#define CFG_DISABLE_CPU_CLK 0x00001000 +#define CFG_PREFETCH_SRAM 0x00002000 +#define CFG_CPU_RESET 0x00004000 +#define CFG_SDIO_DISABLE_IRQ 0x00008000 /* only with SDIO */ +#define CFG_IRQ_ENABLE_DATA 0x00010000 +#define CFG_IRQ_ENABLE_WRDY 0x00020000 +#define CFG_CLK_RISE_EDGE 0x00040000 +#define CFG_SDIO_DISABLE_CRC_CHK 0x00080000 /* only with SDIO */ +#define CFG_RESERVED 0x00F00000 +#define CFG_DEVICE_ID_MAJOR 0x07000000 +#define CFG_DEVICE_ID_RESERVED 0x78000000 +#define CFG_DEVICE_ID_TYPE 0x80000000 +int config_reg_read(struct wfx_dev *wdev, u32 *val); +int config_reg_write(struct wfx_dev *wdev, u32 val); +int config_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val); + +#define CTRL_NEXT_LEN_MASK 0x00000FFF +#define CTRL_WLAN_WAKEUP 0x00001000 +#define CTRL_WLAN_READY 0x00002000 +int control_reg_read(struct wfx_dev *wdev, u32 *val); +int control_reg_write(struct wfx_dev *wdev, u32 val); +int control_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val); + +#define IGPR_RW 0x80000000 +#define IGPR_INDEX 0x7F000000 +#define IGPR_VALUE 0x00FFFFFF +int igpr_reg_read(struct wfx_dev *wdev, int index, u32 *val); +int igpr_reg_write(struct wfx_dev *wdev, int index, u32 val); + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:47 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:47 +0100 Subject: [PATCH v5 10/24] wfx: add fwio.c/fwio.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-11-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/fwio.c | 405 +++++++++++++++++++++++++ drivers/net/wireless/silabs/wfx/fwio.h | 15 + 2 files changed, 420 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/fwio.c create mode 100644 drivers/net/wireless/silabs/wfx/fwio.h diff --git a/drivers/net/wireless/silabs/wfx/fwio.c b/drivers/net/wireless/silabs/wfx/fwio.c new file mode 100644 index 000000000000..3c8b0b787f42 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/fwio.c @@ -0,0 +1,405 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Firmware loading. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#include +#include +#include +#include + +#include "fwio.h" +#include "wfx.h" +#include "hwio.h" + +/* Addresses below are in SRAM area */ +#define WFX_DNLD_FIFO 0x09004000 +#define DNLD_BLOCK_SIZE 0x0400 +#define DNLD_FIFO_SIZE 0x8000 /* (32 * DNLD_BLOCK_SIZE) */ +/* Download Control Area (DCA) */ +#define WFX_DCA_IMAGE_SIZE 0x0900C000 +#define WFX_DCA_PUT 0x0900C004 +#define WFX_DCA_GET 0x0900C008 +#define WFX_DCA_HOST_STATUS 0x0900C00C +#define HOST_READY 0x87654321 +#define HOST_INFO_READ 0xA753BD99 +#define HOST_UPLOAD_PENDING 0xABCDDCBA +#define HOST_UPLOAD_COMPLETE 0xD4C64A99 +#define HOST_OK_TO_JUMP 0x174FC882 +#define WFX_DCA_NCP_STATUS 0x0900C010 +#define NCP_NOT_READY 0x12345678 +#define NCP_READY 0x87654321 +#define NCP_INFO_READY 0xBD53EF99 +#define NCP_DOWNLOAD_PENDING 0xABCDDCBA +#define NCP_DOWNLOAD_COMPLETE 0xCAFEFECA +#define NCP_AUTH_OK 0xD4C64A99 +#define NCP_AUTH_FAIL 0x174FC882 +#define NCP_PUB_KEY_RDY 0x7AB41D19 +#define WFX_DCA_FW_SIGNATURE 0x0900C014 +#define FW_SIGNATURE_SIZE 0x40 +#define WFX_DCA_FW_HASH 0x0900C054 +#define FW_HASH_SIZE 0x08 +#define WFX_DCA_FW_VERSION 0x0900C05C +#define FW_VERSION_SIZE 0x04 +#define WFX_DCA_RESERVED 0x0900C060 +#define DCA_RESERVED_SIZE 0x20 +#define WFX_STATUS_INFO 0x0900C080 +#define WFX_BOOTLOADER_LABEL 0x0900C084 +#define BOOTLOADER_LABEL_SIZE 0x3C +#define WFX_PTE_INFO 0x0900C0C0 +#define PTE_INFO_KEYSET_IDX 0x0D +#define PTE_INFO_SIZE 0x10 +#define WFX_ERR_INFO 0x0900C0D0 +#define ERR_INVALID_SEC_TYPE 0x05 +#define ERR_SIG_VERIF_FAILED 0x0F +#define ERR_AES_CTRL_KEY 0x10 +#define ERR_ECC_PUB_KEY 0x11 +#define ERR_MAC_KEY 0x18 + +#define DCA_TIMEOUT 50 /* milliseconds */ +#define WAKEUP_TIMEOUT 200 /* milliseconds */ + +static const char * const fwio_errors[] = { + [ERR_INVALID_SEC_TYPE] = "Invalid section type or wrong encryption", + [ERR_SIG_VERIF_FAILED] = "Signature verification failed", + [ERR_AES_CTRL_KEY] = "AES control key not initialized", + [ERR_ECC_PUB_KEY] = "ECC public key not initialized", + [ERR_MAC_KEY] = "MAC key not initialized", +}; + +/* request_firmware() allocate data using vmalloc(). It is not compatible with + * underlying hardware that use DMA. Function below detect this case and + * allocate a bounce buffer if necessary. + * + * Notice that, in doubt, you can enable CONFIG_DEBUG_SG to ask kernel to + * detect this problem at runtime (else, kernel silently fail). + * + * NOTE: it may also be possible to use 'pages' from struct firmware and avoid + * bounce buffer + */ +static int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf, + size_t len) +{ + int ret; + const u8 *tmp; + + if (!virt_addr_valid(buf)) { + tmp = kmemdup(buf, len, GFP_KERNEL); + if (!tmp) + return -ENOMEM; + } else { + tmp = buf; + } + ret = sram_buf_write(wdev, addr, tmp, len); + if (tmp != buf) + kfree(tmp); + return ret; +} + +static int get_firmware(struct wfx_dev *wdev, u32 keyset_chip, + const struct firmware **fw, int *file_offset) +{ + int keyset_file; + char filename[256]; + const char *data; + int ret; + + snprintf(filename, sizeof(filename), "%s_%02X.sec", + wdev->pdata.file_fw, keyset_chip); + ret = firmware_request_nowarn(fw, filename, wdev->dev); + if (ret) { + dev_info(wdev->dev, "can't load %s, falling back to %s.sec\n", + filename, wdev->pdata.file_fw); + snprintf(filename, sizeof(filename), "%s.sec", + wdev->pdata.file_fw); + ret = request_firmware(fw, filename, wdev->dev); + if (ret) { + dev_err(wdev->dev, "can't load %s\n", filename); + *fw = NULL; + return ret; + } + } + + data = (*fw)->data; + if (memcmp(data, "KEYSET", 6) != 0) { + /* Legacy firmware format */ + *file_offset = 0; + keyset_file = 0x90; + } else { + *file_offset = 8; + keyset_file = (hex_to_bin(data[6]) * 16) | hex_to_bin(data[7]); + if (keyset_file < 0) { + dev_err(wdev->dev, "%s corrupted\n", filename); + release_firmware(*fw); + *fw = NULL; + return -EINVAL; + } + } + if (keyset_file != keyset_chip) { + dev_err(wdev->dev, "firmware keyset is incompatible with chip (file: 0x%02X, chip: 0x%02X)\n", + keyset_file, keyset_chip); + release_firmware(*fw); + *fw = NULL; + return -ENODEV; + } + wdev->keyset = keyset_file; + return 0; +} + +static int wait_ncp_status(struct wfx_dev *wdev, u32 status) +{ + ktime_t now, start; + u32 reg; + int ret; + + start = ktime_get(); + for (;;) { + ret = sram_reg_read(wdev, WFX_DCA_NCP_STATUS, ®); + if (ret < 0) + return -EIO; + now = ktime_get(); + if (reg == status) + break; + if (ktime_after(now, ktime_add_ms(start, DCA_TIMEOUT))) + return -ETIMEDOUT; + } + if (ktime_compare(now, start)) + dev_dbg(wdev->dev, "chip answer after %lldus\n", + ktime_us_delta(now, start)); + else + dev_dbg(wdev->dev, "chip answer immediately\n"); + return 0; +} + +static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len) +{ + int ret; + u32 offs, bytes_done = 0; + ktime_t now, start; + + if (len % DNLD_BLOCK_SIZE) { + dev_err(wdev->dev, "firmware size is not aligned. Buffer overrun will occur\n"); + return -EIO; + } + offs = 0; + while (offs < len) { + start = ktime_get(); + for (;;) { + now = ktime_get(); + if (offs + DNLD_BLOCK_SIZE - bytes_done < DNLD_FIFO_SIZE) + break; + if (ktime_after(now, ktime_add_ms(start, DCA_TIMEOUT))) + return -ETIMEDOUT; + ret = sram_reg_read(wdev, WFX_DCA_GET, &bytes_done); + if (ret < 0) + return ret; + } + if (ktime_compare(now, start)) + dev_dbg(wdev->dev, "answer after %lldus\n", + ktime_us_delta(now, start)); + + ret = sram_write_dma_safe(wdev, WFX_DNLD_FIFO + + (offs % DNLD_FIFO_SIZE), + data + offs, DNLD_BLOCK_SIZE); + if (ret < 0) + return ret; + + /* WFx seems to not support writing 0 in this register during + * first loop + */ + offs += DNLD_BLOCK_SIZE; + ret = sram_reg_write(wdev, WFX_DCA_PUT, offs); + if (ret < 0) + return ret; + } + return 0; +} + +static void print_boot_status(struct wfx_dev *wdev) +{ + u32 reg; + + sram_reg_read(wdev, WFX_STATUS_INFO, ®); + if (reg == 0x12345678) + return; + sram_reg_read(wdev, WFX_ERR_INFO, ®); + if (reg < ARRAY_SIZE(fwio_errors) && fwio_errors[reg]) + dev_info(wdev->dev, "secure boot: %s\n", fwio_errors[reg]); + else + dev_info(wdev->dev, "secure boot: Error %#02x\n", reg); +} + +static int load_firmware_secure(struct wfx_dev *wdev) +{ + const struct firmware *fw = NULL; + int header_size; + int fw_offset; + ktime_t start; + u8 *buf; + int ret; + + BUILD_BUG_ON(PTE_INFO_SIZE > BOOTLOADER_LABEL_SIZE); + buf = kmalloc(BOOTLOADER_LABEL_SIZE + 1, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_READY); + ret = wait_ncp_status(wdev, NCP_INFO_READY); + if (ret) + goto error; + + sram_buf_read(wdev, WFX_BOOTLOADER_LABEL, buf, BOOTLOADER_LABEL_SIZE); + buf[BOOTLOADER_LABEL_SIZE] = 0; + dev_dbg(wdev->dev, "bootloader: \"%s\"\n", buf); + + sram_buf_read(wdev, WFX_PTE_INFO, buf, PTE_INFO_SIZE); + ret = get_firmware(wdev, buf[PTE_INFO_KEYSET_IDX], &fw, &fw_offset); + if (ret) + goto error; + header_size = fw_offset + FW_SIGNATURE_SIZE + FW_HASH_SIZE; + + sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_INFO_READ); + ret = wait_ncp_status(wdev, NCP_READY); + if (ret) + goto error; + + sram_reg_write(wdev, WFX_DNLD_FIFO, 0xFFFFFFFF); /* Fifo init */ + sram_write_dma_safe(wdev, WFX_DCA_FW_VERSION, "\x01\x00\x00\x00", + FW_VERSION_SIZE); + sram_write_dma_safe(wdev, WFX_DCA_FW_SIGNATURE, fw->data + fw_offset, + FW_SIGNATURE_SIZE); + sram_write_dma_safe(wdev, WFX_DCA_FW_HASH, + fw->data + fw_offset + FW_SIGNATURE_SIZE, + FW_HASH_SIZE); + sram_reg_write(wdev, WFX_DCA_IMAGE_SIZE, fw->size - header_size); + sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_UPLOAD_PENDING); + ret = wait_ncp_status(wdev, NCP_DOWNLOAD_PENDING); + if (ret) + goto error; + + start = ktime_get(); + ret = upload_firmware(wdev, fw->data + header_size, + fw->size - header_size); + if (ret) + goto error; + dev_dbg(wdev->dev, "firmware load after %lldus\n", + ktime_us_delta(ktime_get(), start)); + + sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_UPLOAD_COMPLETE); + ret = wait_ncp_status(wdev, NCP_AUTH_OK); + /* Legacy ROM support */ + if (ret < 0) + ret = wait_ncp_status(wdev, NCP_PUB_KEY_RDY); + if (ret < 0) + goto error; + sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_OK_TO_JUMP); + +error: + kfree(buf); + if (fw) + release_firmware(fw); + if (ret) + print_boot_status(wdev); + return ret; +} + +static int init_gpr(struct wfx_dev *wdev) +{ + int ret, i; + static const struct { + int index; + u32 value; + } gpr_init[] = { + { 0x07, 0x208775 }, + { 0x08, 0x2EC020 }, + { 0x09, 0x3C3C3C }, + { 0x0B, 0x322C44 }, + { 0x0C, 0xA06497 }, + }; + + for (i = 0; i < ARRAY_SIZE(gpr_init); i++) { + ret = igpr_reg_write(wdev, gpr_init[i].index, + gpr_init[i].value); + if (ret < 0) + return ret; + dev_dbg(wdev->dev, " index %02x: %08x\n", + gpr_init[i].index, gpr_init[i].value); + } + return 0; +} + +int wfx_init_device(struct wfx_dev *wdev) +{ + int ret; + int hw_revision, hw_type; + int wakeup_timeout = 50; /* ms */ + ktime_t now, start; + u32 reg; + + reg = CFG_DIRECT_ACCESS_MODE | CFG_CPU_RESET | CFG_BYTE_ORDER_ABCD; + if (wdev->pdata.use_rising_clk) + reg |= CFG_CLK_RISE_EDGE; + ret = config_reg_write(wdev, reg); + if (ret < 0) { + dev_err(wdev->dev, "bus returned an error during first write access. Host configuration error?\n"); + return -EIO; + } + + ret = config_reg_read(wdev, ®); + if (ret < 0) { + dev_err(wdev->dev, "bus returned an error during first read access. Bus configuration error?\n"); + return -EIO; + } + if (reg == 0 || reg == ~0) { + dev_err(wdev->dev, "chip mute. Bus configuration error or chip wasn't reset?\n"); + return -EIO; + } + dev_dbg(wdev->dev, "initial config register value: %08x\n", reg); + + hw_revision = FIELD_GET(CFG_DEVICE_ID_MAJOR, reg); + if (hw_revision == 0) { + dev_err(wdev->dev, "bad hardware revision number: %d\n", + hw_revision); + return -ENODEV; + } + hw_type = FIELD_GET(CFG_DEVICE_ID_TYPE, reg); + if (hw_type == 1) { + dev_notice(wdev->dev, "development hardware detected\n"); + wakeup_timeout = 2000; + } + + ret = init_gpr(wdev); + if (ret < 0) + return ret; + + ret = control_reg_write(wdev, CTRL_WLAN_WAKEUP); + if (ret < 0) + return -EIO; + start = ktime_get(); + for (;;) { + ret = control_reg_read(wdev, ®); + now = ktime_get(); + if (reg & CTRL_WLAN_READY) + break; + if (ktime_after(now, ktime_add_ms(start, wakeup_timeout))) { + dev_err(wdev->dev, "chip didn't wake up. Chip wasn't reset?\n"); + return -ETIMEDOUT; + } + } + dev_dbg(wdev->dev, "chip wake up after %lldus\n", + ktime_us_delta(now, start)); + + ret = config_reg_write_bits(wdev, CFG_CPU_RESET, 0); + if (ret < 0) + return ret; + ret = load_firmware_secure(wdev); + if (ret < 0) + return ret; + return config_reg_write_bits(wdev, + CFG_DIRECT_ACCESS_MODE | + CFG_IRQ_ENABLE_DATA | + CFG_IRQ_ENABLE_WRDY, + CFG_IRQ_ENABLE_DATA); +} diff --git a/drivers/net/wireless/silabs/wfx/fwio.h b/drivers/net/wireless/silabs/wfx/fwio.h new file mode 100644 index 000000000000..eeea61210eca --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/fwio.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Firmware loading. + * + * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#ifndef WFX_FWIO_H +#define WFX_FWIO_H + +struct wfx_dev; + +int wfx_init_device(struct wfx_dev *wdev); + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:48 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:48 +0100 Subject: [PATCH v5 11/24] wfx: add bh.c/bh.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-12-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/bh.c | 332 +++++++++++++++++++++++++++ drivers/net/wireless/silabs/wfx/bh.h | 33 +++ 2 files changed, 365 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/bh.c create mode 100644 drivers/net/wireless/silabs/wfx/bh.h diff --git a/drivers/net/wireless/silabs/wfx/bh.c b/drivers/net/wireless/silabs/wfx/bh.c new file mode 100644 index 000000000000..80de528ce974 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/bh.c @@ -0,0 +1,332 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Interrupt bottom half (BH). + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#include +#include + +#include "bh.h" +#include "wfx.h" +#include "hwio.h" +#include "traces.h" +#include "hif_rx.h" +#include "hif_api_cmd.h" + +static void device_wakeup(struct wfx_dev *wdev) +{ + int max_retry = 3; + + if (!wdev->pdata.gpio_wakeup) + return; + if (gpiod_get_value_cansleep(wdev->pdata.gpio_wakeup) > 0) + return; + + if (wfx_api_older_than(wdev, 1, 4)) { + gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1); + if (!completion_done(&wdev->hif.ctrl_ready)) + usleep_range(2000, 2500); + return; + } + for (;;) { + gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1); + /* completion.h does not provide any function to wait + * completion without consume it (a kind of + * wait_for_completion_done_timeout()). So we have to emulate + * it. + */ + if (wait_for_completion_timeout(&wdev->hif.ctrl_ready, + msecs_to_jiffies(2))) { + complete(&wdev->hif.ctrl_ready); + return; + } else if (max_retry-- > 0) { + /* Older firmwares have a race in sleep/wake-up process. + * Redo the process is sufficient to unfreeze the + * chip. + */ + dev_err(wdev->dev, "timeout while wake up chip\n"); + gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 0); + usleep_range(2000, 2500); + } else { + dev_err(wdev->dev, "max wake-up retries reached\n"); + return; + } + } +} + +static void device_release(struct wfx_dev *wdev) +{ + if (!wdev->pdata.gpio_wakeup) + return; + + gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 0); +} + +static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf) +{ + struct sk_buff *skb; + struct hif_msg *hif; + size_t alloc_len; + size_t computed_len; + int release_count; + int piggyback = 0; + + WARN(read_len > round_down(0xFFF, 2) * sizeof(u16), + "%s: request exceed WFx capability", __func__); + + /* Add 2 to take into account piggyback size */ + alloc_len = wdev->hwbus_ops->align_size(wdev->hwbus_priv, read_len + 2); + skb = dev_alloc_skb(alloc_len); + if (!skb) + return -ENOMEM; + + if (wfx_data_read(wdev, skb->data, alloc_len)) + goto err; + + piggyback = le16_to_cpup((__le16 *)(skb->data + alloc_len - 2)); + _trace_piggyback(piggyback, false); + + hif = (struct hif_msg *)skb->data; + WARN(hif->encrypted & 0x3, "encryption is unsupported"); + if (WARN(read_len < sizeof(struct hif_msg), "corrupted read")) + goto err; + computed_len = le16_to_cpu(hif->len); + computed_len = round_up(computed_len, 2); + if (computed_len != read_len) { + dev_err(wdev->dev, "inconsistent message length: %zu != %zu\n", + computed_len, read_len); + print_hex_dump(KERN_INFO, "hif: ", DUMP_PREFIX_OFFSET, 16, 1, + hif, read_len, true); + goto err; + } + + if (!(hif->id & HIF_ID_IS_INDICATION)) { + (*is_cnf)++; + if (hif->id == HIF_CNF_ID_MULTI_TRANSMIT) + release_count = ((struct hif_cnf_multi_transmit *)hif->body)->num_tx_confs; + else + release_count = 1; + WARN(wdev->hif.tx_buffers_used < release_count, "corrupted buffer counter"); + wdev->hif.tx_buffers_used -= release_count; + } + _trace_hif_recv(hif, wdev->hif.tx_buffers_used); + + if (hif->id != HIF_IND_ID_EXCEPTION && hif->id != HIF_IND_ID_ERROR) { + if (hif->seqnum != wdev->hif.rx_seqnum) + dev_warn(wdev->dev, "wrong message sequence: %d != %d\n", + hif->seqnum, wdev->hif.rx_seqnum); + wdev->hif.rx_seqnum = (hif->seqnum + 1) % (HIF_COUNTER_MAX + 1); + } + + skb_put(skb, le16_to_cpu(hif->len)); + /* wfx_handle_rx takes care on SKB livetime */ + wfx_handle_rx(wdev, skb); + if (!wdev->hif.tx_buffers_used) + wake_up(&wdev->hif.tx_buffers_empty); + + return piggyback; + +err: + if (skb) + dev_kfree_skb(skb); + return -EIO; +} + +static int bh_work_rx(struct wfx_dev *wdev, int max_msg, int *num_cnf) +{ + size_t len; + int i; + int ctrl_reg, piggyback; + + piggyback = 0; + for (i = 0; i < max_msg; i++) { + if (piggyback & CTRL_NEXT_LEN_MASK) + ctrl_reg = piggyback; + else if (try_wait_for_completion(&wdev->hif.ctrl_ready)) + ctrl_reg = atomic_xchg(&wdev->hif.ctrl_reg, 0); + else + ctrl_reg = 0; + if (!(ctrl_reg & CTRL_NEXT_LEN_MASK)) + return i; + /* ctrl_reg units are 16bits words */ + len = (ctrl_reg & CTRL_NEXT_LEN_MASK) * 2; + piggyback = rx_helper(wdev, len, num_cnf); + if (piggyback < 0) + return i; + if (!(piggyback & CTRL_WLAN_READY)) + dev_err(wdev->dev, "unexpected piggyback value: ready bit not set: %04x\n", + piggyback); + } + if (piggyback & CTRL_NEXT_LEN_MASK) { + ctrl_reg = atomic_xchg(&wdev->hif.ctrl_reg, piggyback); + complete(&wdev->hif.ctrl_ready); + if (ctrl_reg) + dev_err(wdev->dev, "unexpected IRQ happened: %04x/%04x\n", + ctrl_reg, piggyback); + } + return i; +} + +static void tx_helper(struct wfx_dev *wdev, struct hif_msg *hif) +{ + int ret; + void *data; + bool is_encrypted = false; + size_t len = le16_to_cpu(hif->len); + + WARN(len < sizeof(*hif), "try to send corrupted data"); + + hif->seqnum = wdev->hif.tx_seqnum; + wdev->hif.tx_seqnum = (wdev->hif.tx_seqnum + 1) % (HIF_COUNTER_MAX + 1); + + data = hif; + WARN(len > wdev->hw_caps.size_inp_ch_buf, + "%s: request exceed WFx capability: %zu > %d\n", __func__, + len, wdev->hw_caps.size_inp_ch_buf); + len = wdev->hwbus_ops->align_size(wdev->hwbus_priv, len); + ret = wfx_data_write(wdev, data, len); + if (ret) + goto end; + + wdev->hif.tx_buffers_used++; + _trace_hif_send(hif, wdev->hif.tx_buffers_used); +end: + if (is_encrypted) + kfree(data); +} + +static int bh_work_tx(struct wfx_dev *wdev, int max_msg) +{ + struct hif_msg *hif; + int i; + + for (i = 0; i < max_msg; i++) { + hif = NULL; + if (wdev->hif.tx_buffers_used < wdev->hw_caps.num_inp_ch_bufs) { + if (try_wait_for_completion(&wdev->hif_cmd.ready)) { + WARN(!mutex_is_locked(&wdev->hif_cmd.lock), "data locking error"); + hif = wdev->hif_cmd.buf_send; + } else { + hif = wfx_tx_queues_get(wdev); + } + } + if (!hif) + return i; + tx_helper(wdev, hif); + } + return i; +} + +/* In SDIO mode, it is necessary to make an access to a register to acknowledge + * last received message. It could be possible to restrict this acknowledge to + * SDIO mode and only if last operation was rx. + */ +static void ack_sdio_data(struct wfx_dev *wdev) +{ + u32 cfg_reg; + + config_reg_read(wdev, &cfg_reg); + if (cfg_reg & 0xFF) { + dev_warn(wdev->dev, "chip reports errors: %02x\n", + cfg_reg & 0xFF); + config_reg_write_bits(wdev, 0xFF, 0x00); + } +} + +static void bh_work(struct work_struct *work) +{ + struct wfx_dev *wdev = container_of(work, struct wfx_dev, hif.bh); + int stats_req = 0, stats_cnf = 0, stats_ind = 0; + bool release_chip = false, last_op_is_rx = false; + int num_tx, num_rx; + + device_wakeup(wdev); + do { + num_tx = bh_work_tx(wdev, 32); + stats_req += num_tx; + if (num_tx) + last_op_is_rx = false; + num_rx = bh_work_rx(wdev, 32, &stats_cnf); + stats_ind += num_rx; + if (num_rx) + last_op_is_rx = true; + } while (num_rx || num_tx); + stats_ind -= stats_cnf; + + if (last_op_is_rx) + ack_sdio_data(wdev); + if (!wdev->hif.tx_buffers_used && !work_pending(work)) { + device_release(wdev); + release_chip = true; + } + _trace_bh_stats(stats_ind, stats_req, stats_cnf, + wdev->hif.tx_buffers_used, release_chip); +} + +/* An IRQ from chip did occur + */ +void wfx_bh_request_rx(struct wfx_dev *wdev) +{ + u32 cur, prev; + + control_reg_read(wdev, &cur); + prev = atomic_xchg(&wdev->hif.ctrl_reg, cur); + complete(&wdev->hif.ctrl_ready); + queue_work(system_highpri_wq, &wdev->hif.bh); + + if (!(cur & CTRL_NEXT_LEN_MASK)) + dev_err(wdev->dev, "unexpected control register value: length field is 0: %04x\n", + cur); + if (prev != 0) + dev_err(wdev->dev, "received IRQ but previous data was not (yet) read: %04x/%04x\n", + prev, cur); +} + +/* Driver want to send data + */ +void wfx_bh_request_tx(struct wfx_dev *wdev) +{ + queue_work(system_highpri_wq, &wdev->hif.bh); +} + +/* If IRQ is not available, this function allow to manually poll the control + * register and simulate an IRQ ahen an event happened. + * + * Note that the device has a bug: If an IRQ raise while host read control + * register, the IRQ is lost. So, use this function carefully (only duing + * device initialisation). + */ +void wfx_bh_poll_irq(struct wfx_dev *wdev) +{ + ktime_t now, start; + u32 reg; + + WARN(!wdev->poll_irq, "unexpected IRQ polling can mask IRQ"); + start = ktime_get(); + for (;;) { + control_reg_read(wdev, ®); + now = ktime_get(); + if (reg & 0xFFF) + break; + if (ktime_after(now, ktime_add_ms(start, 1000))) { + dev_err(wdev->dev, "time out while polling control register\n"); + return; + } + udelay(200); + } + wfx_bh_request_rx(wdev); +} + +void wfx_bh_register(struct wfx_dev *wdev) +{ + INIT_WORK(&wdev->hif.bh, bh_work); + init_completion(&wdev->hif.ctrl_ready); + init_waitqueue_head(&wdev->hif.tx_buffers_empty); +} + +void wfx_bh_unregister(struct wfx_dev *wdev) +{ + flush_work(&wdev->hif.bh); +} diff --git a/drivers/net/wireless/silabs/wfx/bh.h b/drivers/net/wireless/silabs/wfx/bh.h new file mode 100644 index 000000000000..4bcbfa9ffc2b --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/bh.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Interrupt bottom half. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#ifndef WFX_BH_H +#define WFX_BH_H + +#include +#include +#include + +struct wfx_dev; + +struct wfx_hif { + struct work_struct bh; + struct completion ctrl_ready; + wait_queue_head_t tx_buffers_empty; + atomic_t ctrl_reg; + int rx_seqnum; + int tx_seqnum; + int tx_buffers_used; +}; + +void wfx_bh_register(struct wfx_dev *wdev); +void wfx_bh_unregister(struct wfx_dev *wdev); +void wfx_bh_request_rx(struct wfx_dev *wdev); +void wfx_bh_request_tx(struct wfx_dev *wdev); +void wfx_bh_poll_irq(struct wfx_dev *wdev); + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:49 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:49 +0100 Subject: [PATCH v5 12/24] wfx: add hif_api_*.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-13-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/hif_api_cmd.h | 555 ++++++++++++++++++ .../net/wireless/silabs/wfx/hif_api_general.h | 262 +++++++++ drivers/net/wireless/silabs/wfx/hif_api_mib.h | 343 +++++++++++ 3 files changed, 1160 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/hif_api_cmd.h create mode 100644 drivers/net/wireless/silabs/wfx/hif_api_general.h create mode 100644 drivers/net/wireless/silabs/wfx/hif_api_mib.h diff --git a/drivers/net/wireless/silabs/wfx/hif_api_cmd.h b/drivers/net/wireless/silabs/wfx/hif_api_cmd.h new file mode 100644 index 000000000000..9d380291f567 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/hif_api_cmd.h @@ -0,0 +1,555 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* + * WFx hardware interface definitions + * + * Copyright (c) 2018-2020, Silicon Laboratories Inc. + */ + +#ifndef WFX_HIF_API_CMD_H +#define WFX_HIF_API_CMD_H + +#include + +#include "hif_api_general.h" + +enum hif_requests_ids { + HIF_REQ_ID_RESET = 0x0a, + HIF_REQ_ID_READ_MIB = 0x05, + HIF_REQ_ID_WRITE_MIB = 0x06, + HIF_REQ_ID_START_SCAN = 0x07, + HIF_REQ_ID_STOP_SCAN = 0x08, + HIF_REQ_ID_TX = 0x04, + HIF_REQ_ID_JOIN = 0x0b, + HIF_REQ_ID_SET_PM_MODE = 0x10, + HIF_REQ_ID_SET_BSS_PARAMS = 0x11, + HIF_REQ_ID_ADD_KEY = 0x0c, + HIF_REQ_ID_REMOVE_KEY = 0x0d, + HIF_REQ_ID_EDCA_QUEUE_PARAMS = 0x13, + HIF_REQ_ID_START = 0x17, + HIF_REQ_ID_BEACON_TRANSMIT = 0x18, + HIF_REQ_ID_UPDATE_IE = 0x1b, + HIF_REQ_ID_MAP_LINK = 0x1c, +}; + +enum hif_confirmations_ids { + HIF_CNF_ID_RESET = 0x0a, + HIF_CNF_ID_READ_MIB = 0x05, + HIF_CNF_ID_WRITE_MIB = 0x06, + HIF_CNF_ID_START_SCAN = 0x07, + HIF_CNF_ID_STOP_SCAN = 0x08, + HIF_CNF_ID_TX = 0x04, + HIF_CNF_ID_MULTI_TRANSMIT = 0x1e, + HIF_CNF_ID_JOIN = 0x0b, + HIF_CNF_ID_SET_PM_MODE = 0x10, + HIF_CNF_ID_SET_BSS_PARAMS = 0x11, + HIF_CNF_ID_ADD_KEY = 0x0c, + HIF_CNF_ID_REMOVE_KEY = 0x0d, + HIF_CNF_ID_EDCA_QUEUE_PARAMS = 0x13, + HIF_CNF_ID_START = 0x17, + HIF_CNF_ID_BEACON_TRANSMIT = 0x18, + HIF_CNF_ID_UPDATE_IE = 0x1b, + HIF_CNF_ID_MAP_LINK = 0x1c, +}; + +enum hif_indications_ids { + HIF_IND_ID_RX = 0x84, + HIF_IND_ID_SCAN_CMPL = 0x86, + HIF_IND_ID_JOIN_COMPLETE = 0x8f, + HIF_IND_ID_SET_PM_MODE_CMPL = 0x89, + HIF_IND_ID_SUSPEND_RESUME_TX = 0x8c, + HIF_IND_ID_EVENT = 0x85 +}; + +struct hif_req_reset { + u8 reset_stat:1; + u8 reset_all_int:1; + u8 reserved1:6; + u8 reserved2[3]; +} __packed; + +struct hif_cnf_reset { + __le32 status; +} __packed; + +struct hif_req_read_mib { + __le16 mib_id; + __le16 reserved; +} __packed; + +struct hif_cnf_read_mib { + __le32 status; + __le16 mib_id; + __le16 length; + u8 mib_data[]; +} __packed; + +struct hif_req_write_mib { + __le16 mib_id; + __le16 length; + u8 mib_data[]; +} __packed; + +struct hif_cnf_write_mib { + __le32 status; +} __packed; + +struct hif_req_update_ie { + u8 beacon:1; + u8 probe_resp:1; + u8 probe_req:1; + u8 reserved1:5; + u8 reserved2; + __le16 num_ies; + u8 ie[]; +} __packed; + +struct hif_cnf_update_ie { + __le32 status; +} __packed; + +struct hif_ssid_def { + __le32 ssid_length; + u8 ssid[IEEE80211_MAX_SSID_LEN]; +} __packed; + +#define HIF_API_MAX_NB_SSIDS 2 +#define HIF_API_MAX_NB_CHANNELS 14 + +struct hif_req_start_scan_alt { + u8 band; + u8 maintain_current_bss:1; + u8 periodic:1; + u8 reserved1:6; + u8 disallow_ps:1; + u8 reserved2:1; + u8 short_preamble:1; + u8 reserved3:5; + u8 max_transmit_rate; + __le16 periodic_interval; + u8 reserved4; + s8 periodic_rssi_thr; + u8 num_of_probe_requests; + u8 probe_delay; + u8 num_of_ssids; + u8 num_of_channels; + __le32 min_channel_time; + __le32 max_channel_time; + __le32 tx_power_level; /* signed value */ + struct hif_ssid_def ssid_def[HIF_API_MAX_NB_SSIDS]; + u8 channel_list[]; +} __packed; + +struct hif_cnf_start_scan { + __le32 status; +} __packed; + +struct hif_cnf_stop_scan { + __le32 status; +} __packed; + +enum hif_pm_mode_status { + HIF_PM_MODE_ACTIVE = 0x0, + HIF_PM_MODE_PS = 0x1, + HIF_PM_MODE_UNDETERMINED = 0x2 +}; + +struct hif_ind_scan_cmpl { + __le32 status; + u8 pm_mode; + u8 num_channels_completed; + __le16 reserved; +} __packed; + +enum hif_queue_id { + HIF_QUEUE_ID_BACKGROUND = 0x0, + HIF_QUEUE_ID_BESTEFFORT = 0x1, + HIF_QUEUE_ID_VIDEO = 0x2, + HIF_QUEUE_ID_VOICE = 0x3 +}; + +enum hif_frame_format { + HIF_FRAME_FORMAT_NON_HT = 0x0, + HIF_FRAME_FORMAT_MIXED_FORMAT_HT = 0x1, + HIF_FRAME_FORMAT_GF_HT_11N = 0x2 +}; + +struct hif_req_tx { + /* packet_id is not interpreted by the device, so it is not necessary to + * declare it little endian + */ + u32 packet_id; + u8 max_tx_rate; + u8 queue_id:2; + u8 peer_sta_id:4; + u8 reserved1:2; + u8 more:1; + u8 fc_offset:3; + u8 after_dtim:1; + u8 reserved2:3; + u8 start_exp:1; + u8 reserved3:3; + u8 retry_policy_index:4; + __le32 reserved4; + __le32 expire_time; + u8 frame_format:4; + u8 fec_coding:1; + u8 short_gi:1; + u8 reserved5:1; + u8 stbc:1; + u8 reserved6; + u8 aggregation:1; + u8 reserved7:7; + u8 reserved8; + u8 frame[]; +} __packed; + +enum hif_qos_ackplcy { + HIF_QOS_ACKPLCY_NORMAL = 0x0, + HIF_QOS_ACKPLCY_TXNOACK = 0x1, + HIF_QOS_ACKPLCY_NOEXPACK = 0x2, + HIF_QOS_ACKPLCY_BLCKACK = 0x3 +}; + +struct hif_cnf_tx { + __le32 status; + /* packet_id is copied from struct hif_req_tx without been interpreted + * by the device, so it is not necessary to declare it little endian + */ + u32 packet_id; + u8 txed_rate; + u8 ack_failures; + u8 aggr:1; + u8 requeue:1; + u8 ack_policy:2; + u8 txop_limit:1; + u8 reserved1:3; + u8 reserved2; + __le32 media_delay; + __le32 tx_queue_delay; +} __packed; + +struct hif_cnf_multi_transmit { + u8 num_tx_confs; + u8 reserved[3]; + struct hif_cnf_tx tx_conf_payload[]; +} __packed; + +enum hif_ri_flags_encrypt { + HIF_RI_FLAGS_UNENCRYPTED = 0x0, + HIF_RI_FLAGS_WEP_ENCRYPTED = 0x1, + HIF_RI_FLAGS_TKIP_ENCRYPTED = 0x2, + HIF_RI_FLAGS_AES_ENCRYPTED = 0x3, + HIF_RI_FLAGS_WAPI_ENCRYPTED = 0x4 +}; + +struct hif_ind_rx { + __le32 status; + u8 channel_number; + u8 reserved1; + u8 rxed_rate; + u8 rcpi_rssi; + u8 encryp:3; + u8 in_aggr:1; + u8 first_aggr:1; + u8 last_aggr:1; + u8 defrag:1; + u8 beacon:1; + u8 tim:1; + u8 bitmap:1; + u8 match_ssid:1; + u8 match_bssid:1; + u8 more:1; + u8 reserved2:1; + u8 ht:1; + u8 stbc:1; + u8 match_uc_addr:1; + u8 match_mc_addr:1; + u8 match_bc_addr:1; + u8 key_type:1; + u8 key_index:4; + u8 reserved3:1; + u8 peer_sta_id:4; + u8 reserved4:2; + u8 reserved5:1; + u8 frame[]; +} __packed; + +struct hif_req_edca_queue_params { + u8 queue_id; + u8 reserved1; + u8 aifsn; + u8 reserved2; + __le16 cw_min; + __le16 cw_max; + __le16 tx_op_limit; + __le16 allowed_medium_time; + __le32 reserved3; +} __packed; + +struct hif_cnf_edca_queue_params { + __le32 status; +} __packed; + +struct hif_req_join { + u8 infrastructure_bss_mode:1; + u8 reserved1:7; + u8 band; + u8 channel_number; + u8 reserved2; + u8 bssid[ETH_ALEN]; + __le16 atim_window; + u8 short_preamble:1; + u8 reserved3:7; + u8 probe_for_join; + u8 reserved4; + u8 reserved5:2; + u8 force_no_beacon:1; + u8 force_with_ind:1; + u8 reserved6:4; + __le32 ssid_length; + u8 ssid[IEEE80211_MAX_SSID_LEN]; + __le32 beacon_interval; + __le32 basic_rate_set; +} __packed; + +struct hif_cnf_join { + __le32 status; +} __packed; + +struct hif_ind_join_complete { + __le32 status; +} __packed; + +struct hif_req_set_bss_params { + u8 lost_count_only:1; + u8 reserved:7; + u8 beacon_lost_count; + __le16 aid; + __le32 operational_rate_set; +} __packed; + +struct hif_cnf_set_bss_params { + __le32 status; +} __packed; + +struct hif_req_set_pm_mode { + u8 enter_psm:1; + u8 reserved:6; + u8 fast_psm:1; + u8 fast_psm_idle_period; + u8 ap_psm_change_period; + u8 min_auto_ps_poll_period; +} __packed; + +struct hif_cnf_set_pm_mode { + __le32 status; +} __packed; + +struct hif_ind_set_pm_mode_cmpl { + __le32 status; + u8 pm_mode; + u8 reserved[3]; +} __packed; + +struct hif_req_start { + u8 mode; + u8 band; + u8 channel_number; + u8 reserved1; + __le32 reserved2; + __le32 beacon_interval; + u8 dtim_period; + u8 short_preamble:1; + u8 reserved3:7; + u8 reserved4; + u8 ssid_length; + u8 ssid[IEEE80211_MAX_SSID_LEN]; + __le32 basic_rate_set; +} __packed; + +struct hif_cnf_start { + __le32 status; +} __packed; + +struct hif_req_beacon_transmit { + u8 enable_beaconing; + u8 reserved[3]; +} __packed; + +struct hif_cnf_beacon_transmit { + __le32 status; +} __packed; + +#define HIF_LINK_ID_MAX 14 +#define HIF_LINK_ID_NOT_ASSOCIATED (HIF_LINK_ID_MAX + 1) + +struct hif_req_map_link { + u8 mac_addr[ETH_ALEN]; + u8 unmap:1; + u8 mfpc:1; + u8 reserved:6; + u8 peer_sta_id; +} __packed; + +struct hif_cnf_map_link { + __le32 status; +} __packed; + +struct hif_ind_suspend_resume_tx { + u8 resume:1; + u8 reserved1:2; + u8 bc_mc_only:1; + u8 reserved2:4; + u8 reserved3; + __le16 peer_sta_set; +} __packed; + + +#define MAX_KEY_ENTRIES 24 +#define HIF_API_WEP_KEY_DATA_SIZE 16 +#define HIF_API_TKIP_KEY_DATA_SIZE 16 +#define HIF_API_RX_MIC_KEY_SIZE 8 +#define HIF_API_TX_MIC_KEY_SIZE 8 +#define HIF_API_AES_KEY_DATA_SIZE 16 +#define HIF_API_WAPI_KEY_DATA_SIZE 16 +#define HIF_API_MIC_KEY_DATA_SIZE 16 +#define HIF_API_IGTK_KEY_DATA_SIZE 16 +#define HIF_API_RX_SEQUENCE_COUNTER_SIZE 8 +#define HIF_API_IPN_SIZE 8 + +enum hif_key_type { + HIF_KEY_TYPE_WEP_DEFAULT = 0x0, + HIF_KEY_TYPE_WEP_PAIRWISE = 0x1, + HIF_KEY_TYPE_TKIP_GROUP = 0x2, + HIF_KEY_TYPE_TKIP_PAIRWISE = 0x3, + HIF_KEY_TYPE_AES_GROUP = 0x4, + HIF_KEY_TYPE_AES_PAIRWISE = 0x5, + HIF_KEY_TYPE_WAPI_GROUP = 0x6, + HIF_KEY_TYPE_WAPI_PAIRWISE = 0x7, + HIF_KEY_TYPE_IGTK_GROUP = 0x8, + HIF_KEY_TYPE_NONE = 0x9 +}; + +struct hif_wep_pairwise_key { + u8 peer_address[ETH_ALEN]; + u8 reserved; + u8 key_length; + u8 key_data[HIF_API_WEP_KEY_DATA_SIZE]; +} __packed; + +struct hif_wep_group_key { + u8 key_id; + u8 key_length; + u8 reserved[2]; + u8 key_data[HIF_API_WEP_KEY_DATA_SIZE]; +} __packed; + +struct hif_tkip_pairwise_key { + u8 peer_address[ETH_ALEN]; + u8 reserved[2]; + u8 tkip_key_data[HIF_API_TKIP_KEY_DATA_SIZE]; + u8 rx_mic_key[HIF_API_RX_MIC_KEY_SIZE]; + u8 tx_mic_key[HIF_API_TX_MIC_KEY_SIZE]; +} __packed; + +struct hif_tkip_group_key { + u8 tkip_key_data[HIF_API_TKIP_KEY_DATA_SIZE]; + u8 rx_mic_key[HIF_API_RX_MIC_KEY_SIZE]; + u8 key_id; + u8 reserved[3]; + u8 rx_sequence_counter[HIF_API_RX_SEQUENCE_COUNTER_SIZE]; +} __packed; + +struct hif_aes_pairwise_key { + u8 peer_address[ETH_ALEN]; + u8 reserved[2]; + u8 aes_key_data[HIF_API_AES_KEY_DATA_SIZE]; +} __packed; + +struct hif_aes_group_key { + u8 aes_key_data[HIF_API_AES_KEY_DATA_SIZE]; + u8 key_id; + u8 reserved[3]; + u8 rx_sequence_counter[HIF_API_RX_SEQUENCE_COUNTER_SIZE]; +} __packed; + +struct hif_wapi_pairwise_key { + u8 peer_address[ETH_ALEN]; + u8 key_id; + u8 reserved; + u8 wapi_key_data[HIF_API_WAPI_KEY_DATA_SIZE]; + u8 mic_key_data[HIF_API_MIC_KEY_DATA_SIZE]; +} __packed; + +struct hif_wapi_group_key { + u8 wapi_key_data[HIF_API_WAPI_KEY_DATA_SIZE]; + u8 mic_key_data[HIF_API_MIC_KEY_DATA_SIZE]; + u8 key_id; + u8 reserved[3]; +} __packed; + +struct hif_igtk_group_key { + u8 igtk_key_data[HIF_API_IGTK_KEY_DATA_SIZE]; + u8 key_id; + u8 reserved[3]; + u8 ipn[HIF_API_IPN_SIZE]; +} __packed; + +struct hif_req_add_key { + u8 type; + u8 entry_index; + u8 int_id:2; + u8 reserved1:6; + u8 reserved2; + union { + struct hif_wep_pairwise_key wep_pairwise_key; + struct hif_wep_group_key wep_group_key; + struct hif_tkip_pairwise_key tkip_pairwise_key; + struct hif_tkip_group_key tkip_group_key; + struct hif_aes_pairwise_key aes_pairwise_key; + struct hif_aes_group_key aes_group_key; + struct hif_wapi_pairwise_key wapi_pairwise_key; + struct hif_wapi_group_key wapi_group_key; + struct hif_igtk_group_key igtk_group_key; + } key; +} __packed; + +struct hif_cnf_add_key { + __le32 status; +} __packed; + +struct hif_req_remove_key { + u8 entry_index; + u8 reserved[3]; +} __packed; + +struct hif_cnf_remove_key { + __le32 status; +} __packed; + +enum hif_event_ind { + HIF_EVENT_IND_BSSLOST = 0x1, + HIF_EVENT_IND_BSSREGAINED = 0x2, + HIF_EVENT_IND_RCPI_RSSI = 0x3, + HIF_EVENT_IND_PS_MODE_ERROR = 0x4, + HIF_EVENT_IND_INACTIVITY = 0x5 +}; + +enum hif_ps_mode_error { + HIF_PS_ERROR_NO_ERROR = 0, + HIF_PS_ERROR_AP_NOT_RESP_TO_POLL = 1, + HIF_PS_ERROR_AP_NOT_RESP_TO_UAPSD_TRIGGER = 2, + HIF_PS_ERROR_AP_SENT_UNICAST_IN_DOZE = 3, + HIF_PS_ERROR_AP_NO_DATA_AFTER_TIM = 4 +}; + +struct hif_ind_event { + __le32 event_id; + union { + u8 rcpi_rssi; + __le32 ps_mode_error; + __le32 peer_sta_set; + } event_data; +} __packed; + +#endif diff --git a/drivers/net/wireless/silabs/wfx/hif_api_general.h b/drivers/net/wireless/silabs/wfx/hif_api_general.h new file mode 100644 index 000000000000..8ccd58b023d0 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/hif_api_general.h @@ -0,0 +1,262 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* + * WFx hardware interface definitions + * + * Copyright (c) 2018-2020, Silicon Laboratories Inc. + */ + +#ifndef WFX_HIF_API_GENERAL_H +#define WFX_HIF_API_GENERAL_H + +#include +#include + +#define HIF_ID_IS_INDICATION 0x80 +#define HIF_COUNTER_MAX 7 + +struct hif_msg { + __le16 len; + u8 id; + u8 reserved:1; + u8 interface:2; + u8 seqnum:3; + u8 encrypted:2; + u8 body[]; +} __packed; + +enum hif_general_requests_ids { + HIF_REQ_ID_CONFIGURATION = 0x09, + HIF_REQ_ID_CONTROL_GPIO = 0x26, + HIF_REQ_ID_SET_SL_MAC_KEY = 0x27, + HIF_REQ_ID_SL_EXCHANGE_PUB_KEYS = 0x28, + HIF_REQ_ID_SL_CONFIGURE = 0x29, + HIF_REQ_ID_PREVENT_ROLLBACK = 0x2a, + HIF_REQ_ID_PTA_SETTINGS = 0x2b, + HIF_REQ_ID_PTA_PRIORITY = 0x2c, + HIF_REQ_ID_PTA_STATE = 0x2d, + HIF_REQ_ID_SHUT_DOWN = 0x32, +}; + +enum hif_general_confirmations_ids { + HIF_CNF_ID_CONFIGURATION = 0x09, + HIF_CNF_ID_CONTROL_GPIO = 0x26, + HIF_CNF_ID_SET_SL_MAC_KEY = 0x27, + HIF_CNF_ID_SL_EXCHANGE_PUB_KEYS = 0x28, + HIF_CNF_ID_SL_CONFIGURE = 0x29, + HIF_CNF_ID_PREVENT_ROLLBACK = 0x2a, + HIF_CNF_ID_PTA_SETTINGS = 0x2b, + HIF_CNF_ID_PTA_PRIORITY = 0x2c, + HIF_CNF_ID_PTA_STATE = 0x2d, + HIF_CNF_ID_SHUT_DOWN = 0x32, +}; + +enum hif_general_indications_ids { + HIF_IND_ID_EXCEPTION = 0xe0, + HIF_IND_ID_STARTUP = 0xe1, + HIF_IND_ID_WAKEUP = 0xe2, + HIF_IND_ID_GENERIC = 0xe3, + HIF_IND_ID_ERROR = 0xe4, + HIF_IND_ID_SL_EXCHANGE_PUB_KEYS = 0xe5 +}; + +#define HIF_STATUS_SUCCESS (cpu_to_le32(0x0000)) +#define HIF_STATUS_FAIL (cpu_to_le32(0x0001)) +#define HIF_STATUS_INVALID_PARAMETER (cpu_to_le32(0x0002)) +#define HIF_STATUS_WARNING (cpu_to_le32(0x0003)) +#define HIF_STATUS_UNKNOWN_REQUEST (cpu_to_le32(0x0004)) +#define HIF_STATUS_RX_FAIL_DECRYPT (cpu_to_le32(0x0010)) +#define HIF_STATUS_RX_FAIL_MIC (cpu_to_le32(0x0011)) +#define HIF_STATUS_RX_FAIL_NO_KEY (cpu_to_le32(0x0012)) +#define HIF_STATUS_TX_FAIL_RETRIES (cpu_to_le32(0x0013)) +#define HIF_STATUS_TX_FAIL_TIMEOUT (cpu_to_le32(0x0014)) +#define HIF_STATUS_TX_FAIL_REQUEUE (cpu_to_le32(0x0015)) +#define HIF_STATUS_REFUSED (cpu_to_le32(0x0016)) +#define HIF_STATUS_BUSY (cpu_to_le32(0x0017)) +#define HIF_STATUS_SLK_SET_KEY_SUCCESS (cpu_to_le32(0x005A)) +#define HIF_STATUS_SLK_SET_KEY_ALREADY_BURNED (cpu_to_le32(0x006B)) +#define HIF_STATUS_SLK_SET_KEY_DISALLOWED_MODE (cpu_to_le32(0x007C)) +#define HIF_STATUS_SLK_SET_KEY_UNKNOWN_MODE (cpu_to_le32(0x008D)) +#define HIF_STATUS_SLK_NEGO_SUCCESS (cpu_to_le32(0x009E)) +#define HIF_STATUS_SLK_NEGO_FAILED (cpu_to_le32(0x00AF)) +#define HIF_STATUS_ROLLBACK_SUCCESS (cpu_to_le32(0x1234)) +#define HIF_STATUS_ROLLBACK_FAIL (cpu_to_le32(0x1256)) + +enum hif_api_rate_index { + API_RATE_INDEX_B_1MBPS = 0, + API_RATE_INDEX_B_2MBPS = 1, + API_RATE_INDEX_B_5P5MBPS = 2, + API_RATE_INDEX_B_11MBPS = 3, + API_RATE_INDEX_PBCC_22MBPS = 4, + API_RATE_INDEX_PBCC_33MBPS = 5, + API_RATE_INDEX_G_6MBPS = 6, + API_RATE_INDEX_G_9MBPS = 7, + API_RATE_INDEX_G_12MBPS = 8, + API_RATE_INDEX_G_18MBPS = 9, + API_RATE_INDEX_G_24MBPS = 10, + API_RATE_INDEX_G_36MBPS = 11, + API_RATE_INDEX_G_48MBPS = 12, + API_RATE_INDEX_G_54MBPS = 13, + API_RATE_INDEX_N_6P5MBPS = 14, + API_RATE_INDEX_N_13MBPS = 15, + API_RATE_INDEX_N_19P5MBPS = 16, + API_RATE_INDEX_N_26MBPS = 17, + API_RATE_INDEX_N_39MBPS = 18, + API_RATE_INDEX_N_52MBPS = 19, + API_RATE_INDEX_N_58P5MBPS = 20, + API_RATE_INDEX_N_65MBPS = 21, + API_RATE_NUM_ENTRIES = 22 +}; + +enum hif_fw_type { + HIF_FW_TYPE_ETF = 0x0, + HIF_FW_TYPE_WFM = 0x1, + HIF_FW_TYPE_WSM = 0x2 +}; + +struct hif_ind_startup { + /* As the others, this struct is interpreted as little endian by the + * device. However, this struct is also used by the driver. We prefer to + * declare it in native order and doing byte swap on reception. + */ + __le32 status; + u16 hardware_id; + u8 opn[14]; + u8 uid[8]; + u16 num_inp_ch_bufs; + u16 size_inp_ch_buf; + u8 num_links_ap; + u8 num_interfaces; + u8 mac_addr[2][ETH_ALEN]; + u8 api_version_minor; + u8 api_version_major; + u8 link_mode:2; + u8 reserved1:6; + u8 reserved2; + u8 reserved3; + u8 reserved4; + u8 firmware_build; + u8 firmware_minor; + u8 firmware_major; + u8 firmware_type; + u8 disabled_channel_list[2]; + u8 region_sel_mode:4; + u8 reserved5:4; + u8 phy1_region:3; + u8 phy0_region:3; + u8 otp_phy_ver:2; + u32 supported_rate_mask; + u8 firmware_label[128]; +} __packed; + +struct hif_ind_wakeup { +} __packed; + +struct hif_req_configuration { + __le16 length; + u8 pds_data[]; +} __packed; + +struct hif_cnf_configuration { + __le32 status; +} __packed; + +enum hif_gpio_mode { + HIF_GPIO_MODE_D0 = 0x0, + HIF_GPIO_MODE_D1 = 0x1, + HIF_GPIO_MODE_OD0 = 0x2, + HIF_GPIO_MODE_OD1 = 0x3, + HIF_GPIO_MODE_TRISTATE = 0x4, + HIF_GPIO_MODE_TOGGLE = 0x5, + HIF_GPIO_MODE_READ = 0x6 +}; + +struct hif_req_control_gpio { + u8 gpio_label; + u8 gpio_mode; +} __packed; + +struct hif_cnf_control_gpio { + __le32 status; + __le32 value; +} __packed; + +enum hif_generic_indication_type { + HIF_GENERIC_INDICATION_TYPE_RAW = 0x0, + HIF_GENERIC_INDICATION_TYPE_STRING = 0x1, + HIF_GENERIC_INDICATION_TYPE_RX_STATS = 0x2, + HIF_GENERIC_INDICATION_TYPE_TX_POWER_LOOP_INFO = 0x3, +}; + +struct hif_rx_stats { + __le32 nb_rx_frame; + __le32 nb_crc_frame; + __le32 per_total; + __le32 throughput; + __le32 nb_rx_by_rate[API_RATE_NUM_ENTRIES]; + __le16 per[API_RATE_NUM_ENTRIES]; + __le16 snr[API_RATE_NUM_ENTRIES]; /* signed value */ + __le16 rssi[API_RATE_NUM_ENTRIES]; /* signed value */ + __le16 cfo[API_RATE_NUM_ENTRIES]; /* signed value */ + __le32 date; + __le32 pwr_clk_freq; + u8 is_ext_pwr_clk; + s8 current_temp; +} __packed; + +struct hif_tx_power_loop_info { + __le16 tx_gain_dig; + __le16 tx_gain_pa; + __le16 target_pout; /* signed value */ + __le16 p_estimation; /* signed value */ + __le16 vpdet; + u8 measurement_index; + u8 reserved; +} __packed; + +struct hif_ind_generic { + __le32 type; + union { + struct hif_rx_stats rx_stats; + struct hif_tx_power_loop_info tx_power_loop_info; + } data; +} __packed; + +enum hif_error { + HIF_ERROR_FIRMWARE_ROLLBACK = 0x00, + HIF_ERROR_FIRMWARE_DEBUG_ENABLED = 0x01, + HIF_ERROR_SLK_OUTDATED_SESSION_KEY = 0x02, + HIF_ERROR_SLK_SESSION_KEY = 0x03, + HIF_ERROR_OOR_VOLTAGE = 0x04, + HIF_ERROR_PDS_PAYLOAD = 0x05, + HIF_ERROR_OOR_TEMPERATURE = 0x06, + HIF_ERROR_SLK_REQ_DURING_KEY_EXCHANGE = 0x07, + HIF_ERROR_SLK_MULTI_TX_UNSUPPORTED = 0x08, + HIF_ERROR_SLK_OVERFLOW = 0x09, + HIF_ERROR_SLK_DECRYPTION = 0x0a, + HIF_ERROR_SLK_WRONG_ENCRYPTION_STATE = 0x0b, + HIF_ERROR_HIF_BUS_FREQUENCY_TOO_LOW = 0x0c, + HIF_ERROR_HIF_RX_DATA_TOO_LARGE = 0x0e, + HIF_ERROR_HIF_TX_QUEUE_FULL = 0x0d, + HIF_ERROR_HIF_BUS = 0x0f, + HIF_ERROR_PDS_TESTFEATURE = 0x10, + HIF_ERROR_SLK_UNCONFIGURED = 0x11, +}; + +struct hif_ind_error { + __le32 type; + u8 data[]; +} __packed; + +struct hif_ind_exception { + __le32 type; + u8 data[]; +} __packed; + +enum hif_secure_link_state { + SEC_LINK_UNAVAILABLE = 0x0, + SEC_LINK_RESERVED = 0x1, + SEC_LINK_EVAL = 0x2, + SEC_LINK_ENFORCED = 0x3 +}; + +#endif diff --git a/drivers/net/wireless/silabs/wfx/hif_api_mib.h b/drivers/net/wireless/silabs/wfx/hif_api_mib.h new file mode 100644 index 000000000000..e50afb014e76 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/hif_api_mib.h @@ -0,0 +1,343 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* + * WFx hardware interface definitions + * + * Copyright (c) 2018-2020, Silicon Laboratories Inc. + */ + +#ifndef WFX_HIF_API_MIB_H +#define WFX_HIF_API_MIB_H + +#include "hif_api_general.h" + +#define HIF_API_IPV4_ADDRESS_SIZE 4 +#define HIF_API_IPV6_ADDRESS_SIZE 16 + +enum hif_mib_ids { + HIF_MIB_ID_GL_OPERATIONAL_POWER_MODE = 0x2000, + HIF_MIB_ID_GL_BLOCK_ACK_INFO = 0x2001, + HIF_MIB_ID_GL_SET_MULTI_MSG = 0x2002, + HIF_MIB_ID_CCA_CONFIG = 0x2003, + HIF_MIB_ID_ETHERTYPE_DATAFRAME_CONDITION = 0x2010, + HIF_MIB_ID_PORT_DATAFRAME_CONDITION = 0x2011, + HIF_MIB_ID_MAGIC_DATAFRAME_CONDITION = 0x2012, + HIF_MIB_ID_MAC_ADDR_DATAFRAME_CONDITION = 0x2013, + HIF_MIB_ID_IPV4_ADDR_DATAFRAME_CONDITION = 0x2014, + HIF_MIB_ID_IPV6_ADDR_DATAFRAME_CONDITION = 0x2015, + HIF_MIB_ID_UC_MC_BC_DATAFRAME_CONDITION = 0x2016, + HIF_MIB_ID_CONFIG_DATA_FILTER = 0x2017, + HIF_MIB_ID_SET_DATA_FILTERING = 0x2018, + HIF_MIB_ID_ARP_IP_ADDRESSES_TABLE = 0x2019, + HIF_MIB_ID_NS_IP_ADDRESSES_TABLE = 0x201A, + HIF_MIB_ID_RX_FILTER = 0x201B, + HIF_MIB_ID_BEACON_FILTER_TABLE = 0x201C, + HIF_MIB_ID_BEACON_FILTER_ENABLE = 0x201D, + HIF_MIB_ID_GRP_SEQ_COUNTER = 0x2030, + HIF_MIB_ID_TSF_COUNTER = 0x2031, + HIF_MIB_ID_STATISTICS_TABLE = 0x2032, + HIF_MIB_ID_COUNTERS_TABLE = 0x2033, + HIF_MIB_ID_MAX_TX_POWER_LEVEL = 0x2034, + HIF_MIB_ID_EXTENDED_COUNTERS_TABLE = 0x2035, + HIF_MIB_ID_DOT11_MAC_ADDRESS = 0x2040, + HIF_MIB_ID_DOT11_MAX_TRANSMIT_MSDU_LIFETIME = 0x2041, + HIF_MIB_ID_DOT11_MAX_RECEIVE_LIFETIME = 0x2042, + HIF_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID = 0x2043, + HIF_MIB_ID_DOT11_RTS_THRESHOLD = 0x2044, + HIF_MIB_ID_SLOT_TIME = 0x2045, + HIF_MIB_ID_CURRENT_TX_POWER_LEVEL = 0x2046, + HIF_MIB_ID_NON_ERP_PROTECTION = 0x2047, + HIF_MIB_ID_TEMPLATE_FRAME = 0x2048, + HIF_MIB_ID_BEACON_WAKEUP_PERIOD = 0x2049, + HIF_MIB_ID_RCPI_RSSI_THRESHOLD = 0x204A, + HIF_MIB_ID_BLOCK_ACK_POLICY = 0x204B, + HIF_MIB_ID_OVERRIDE_INTERNAL_TX_RATE = 0x204C, + HIF_MIB_ID_SET_ASSOCIATION_MODE = 0x204D, + HIF_MIB_ID_SET_UAPSD_INFORMATION = 0x204E, + HIF_MIB_ID_SET_TX_RATE_RETRY_POLICY = 0x204F, + HIF_MIB_ID_PROTECTED_MGMT_POLICY = 0x2050, + HIF_MIB_ID_SET_HT_PROTECTION = 0x2051, + HIF_MIB_ID_KEEP_ALIVE_PERIOD = 0x2052, + HIF_MIB_ID_ARP_KEEP_ALIVE_PERIOD = 0x2053, + HIF_MIB_ID_INACTIVITY_TIMER = 0x2054, + HIF_MIB_ID_INTERFACE_PROTECTION = 0x2055, + HIF_MIB_ID_BEACON_STATS = 0x2056, +}; + +enum hif_op_power_mode { + HIF_OP_POWER_MODE_ACTIVE = 0x0, + HIF_OP_POWER_MODE_DOZE = 0x1, + HIF_OP_POWER_MODE_QUIESCENT = 0x2 +}; + +struct hif_mib_gl_operational_power_mode { + u8 power_mode:4; + u8 reserved1:3; + u8 wup_ind_activation:1; + u8 reserved2[3]; +} __packed; + +struct hif_mib_gl_set_multi_msg { + u8 enable_multi_tx_conf:1; + u8 reserved1:7; + u8 reserved2[3]; +} __packed; + +enum hif_arp_ns_frame_treatment { + HIF_ARP_NS_FILTERING_DISABLE = 0x0, + HIF_ARP_NS_FILTERING_ENABLE = 0x1, + HIF_ARP_NS_REPLY_ENABLE = 0x2 +}; + +struct hif_mib_arp_ip_addr_table { + u8 condition_idx; + u8 arp_enable; + u8 reserved[2]; + u8 ipv4_address[HIF_API_IPV4_ADDRESS_SIZE]; +} __packed; + +struct hif_mib_rx_filter { + u8 reserved1:1; + u8 bssid_filter:1; + u8 reserved2:1; + u8 fwd_probe_req:1; + u8 keep_alive_filter:1; + u8 reserved3:3; + u8 reserved4[3]; +} __packed; + +struct hif_ie_table_entry { + u8 ie_id; + u8 has_changed:1; + u8 no_longer:1; + u8 has_appeared:1; + u8 reserved:1; + u8 num_match_data:4; + u8 oui[3]; + u8 match_data[3]; +} __packed; + +struct hif_mib_bcn_filter_table { + __le32 num_of_info_elmts; + struct hif_ie_table_entry ie_table[]; +} __packed; + +enum hif_beacon_filter { + HIF_BEACON_FILTER_DISABLE = 0x0, + HIF_BEACON_FILTER_ENABLE = 0x1, + HIF_BEACON_FILTER_AUTO_ERP = 0x2 +}; + +struct hif_mib_bcn_filter_enable { + __le32 enable; + __le32 bcn_count; +} __packed; + +struct hif_mib_extended_count_table { + __le32 count_plcp_errors; + __le32 count_fcs_errors; + __le32 count_tx_packets; + __le32 count_rx_packets; + __le32 count_rx_packet_errors; + __le32 count_rx_decryption_failures; + __le32 count_rx_mic_failures; + __le32 count_rx_no_key_failures; + __le32 count_tx_multicast_frames; + __le32 count_tx_frames_success; + __le32 count_tx_frame_failures; + __le32 count_tx_frames_retried; + __le32 count_tx_frames_multi_retried; + __le32 count_rx_frame_duplicates; + __le32 count_rts_success; + __le32 count_rts_failures; + __le32 count_ack_failures; + __le32 count_rx_multicast_frames; + __le32 count_rx_frames_success; + __le32 count_rx_cmacicv_errors; + __le32 count_rx_cmac_replays; + __le32 count_rx_mgmt_ccmp_replays; + __le32 count_rx_bipmic_errors; + __le32 count_rx_beacon; + __le32 count_miss_beacon; + __le32 reserved[15]; +} __packed; + +struct hif_mib_count_table { + __le32 count_plcp_errors; + __le32 count_fcs_errors; + __le32 count_tx_packets; + __le32 count_rx_packets; + __le32 count_rx_packet_errors; + __le32 count_rx_decryption_failures; + __le32 count_rx_mic_failures; + __le32 count_rx_no_key_failures; + __le32 count_tx_multicast_frames; + __le32 count_tx_frames_success; + __le32 count_tx_frame_failures; + __le32 count_tx_frames_retried; + __le32 count_tx_frames_multi_retried; + __le32 count_rx_frame_duplicates; + __le32 count_rts_success; + __le32 count_rts_failures; + __le32 count_ack_failures; + __le32 count_rx_multicast_frames; + __le32 count_rx_frames_success; + __le32 count_rx_cmacicv_errors; + __le32 count_rx_cmac_replays; + __le32 count_rx_mgmt_ccmp_replays; + __le32 count_rx_bipmic_errors; +} __packed; + +struct hif_mib_mac_address { + u8 mac_addr[ETH_ALEN]; + __le16 reserved; +} __packed; + +struct hif_mib_wep_default_key_id { + u8 wep_default_key_id; + u8 reserved[3]; +} __packed; + +struct hif_mib_dot11_rts_threshold { + __le32 threshold; +} __packed; + +struct hif_mib_slot_time { + __le32 slot_time; +} __packed; + +struct hif_mib_current_tx_power_level { + __le32 power_level; /* signed value */ +} __packed; + +struct hif_mib_non_erp_protection { + u8 use_cts_to_self:1; + u8 reserved1:7; + u8 reserved2[3]; +} __packed; + +enum hif_tmplt { + HIF_TMPLT_PRBREQ = 0x0, + HIF_TMPLT_BCN = 0x1, + HIF_TMPLT_NULL = 0x2, + HIF_TMPLT_QOSNUL = 0x3, + HIF_TMPLT_PSPOLL = 0x4, + HIF_TMPLT_PRBRES = 0x5, + HIF_TMPLT_ARP = 0x6, + HIF_TMPLT_NA = 0x7 +}; + +#define HIF_API_MAX_TEMPLATE_FRAME_SIZE 700 + +struct hif_mib_template_frame { + u8 frame_type; + u8 init_rate:7; + u8 mode:1; + __le16 frame_length; + u8 frame[]; +} __packed; + +struct hif_mib_beacon_wake_up_period { + u8 wakeup_period_min; + u8 receive_dtim:1; + u8 reserved1:7; + u8 wakeup_period_max; + u8 reserved2; +} __packed; + +struct hif_mib_rcpi_rssi_threshold { + u8 detection:1; + u8 rcpi_rssi:1; + u8 upperthresh:1; + u8 lowerthresh:1; + u8 reserved:4; + u8 lower_threshold; + u8 upper_threshold; + u8 rolling_average_count; +} __packed; + +#define DEFAULT_BA_MAX_RX_BUFFER_SIZE 16 + +struct hif_mib_block_ack_policy { + u8 block_ack_tx_tid_policy; + u8 reserved1; + u8 block_ack_rx_tid_policy; + u8 block_ack_rx_max_buffer_size; +} __packed; + +enum hif_mpdu_start_spacing { + HIF_MPDU_START_SPACING_NO_RESTRIC = 0x0, + HIF_MPDU_START_SPACING_QUARTER = 0x1, + HIF_MPDU_START_SPACING_HALF = 0x2, + HIF_MPDU_START_SPACING_ONE = 0x3, + HIF_MPDU_START_SPACING_TWO = 0x4, + HIF_MPDU_START_SPACING_FOUR = 0x5, + HIF_MPDU_START_SPACING_EIGHT = 0x6, + HIF_MPDU_START_SPACING_SIXTEEN = 0x7 +}; + +struct hif_mib_set_association_mode { + u8 preambtype_use:1; + u8 mode:1; + u8 rateset:1; + u8 spacing:1; + u8 reserved1:4; + u8 short_preamble:1; + u8 reserved2:7; + u8 greenfield:1; + u8 reserved3:7; + u8 mpdu_start_spacing; + __le32 basic_rate_set; +} __packed; + +struct hif_mib_set_uapsd_information { + u8 trig_bckgrnd:1; + u8 trig_be:1; + u8 trig_video:1; + u8 trig_voice:1; + u8 reserved1:4; + u8 deliv_bckgrnd:1; + u8 deliv_be:1; + u8 deliv_video:1; + u8 deliv_voice:1; + u8 reserved2:4; + __le16 min_auto_trigger_interval; + __le16 max_auto_trigger_interval; + __le16 auto_trigger_step; +} __packed; + +struct hif_tx_rate_retry_policy { + u8 policy_index; + u8 short_retry_count; + u8 long_retry_count; + u8 first_rate_sel:2; + u8 terminate:1; + u8 count_init:1; + u8 reserved1:4; + u8 rate_recovery_count; + u8 reserved2[3]; + u8 rates[12]; +} __packed; + +#define HIF_TX_RETRY_POLICY_MAX 15 +#define HIF_TX_RETRY_POLICY_INVALID HIF_TX_RETRY_POLICY_MAX + +struct hif_mib_set_tx_rate_retry_policy { + u8 num_tx_rate_policies; + u8 reserved[3]; + struct hif_tx_rate_retry_policy tx_rate_retry_policy[]; +} __packed; + +struct hif_mib_protected_mgmt_policy { + u8 pmf_enable:1; + u8 unpmf_allowed:1; + u8 host_enc_auth_frames:1; + u8 reserved1:5; + u8 reserved2[3]; +} __packed; + +struct hif_mib_keep_alive_period { + __le16 keep_alive_period; + u8 reserved[2]; +} __packed; + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:50 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:50 +0100 Subject: [PATCH v5 13/24] wfx: add hif_tx*.c/hif_tx*.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-14-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/hif_tx.c | 527 +++++++++++++++++++ drivers/net/wireless/silabs/wfx/hif_tx.h | 60 +++ drivers/net/wireless/silabs/wfx/hif_tx_mib.c | 324 ++++++++++++ drivers/net/wireless/silabs/wfx/hif_tx_mib.h | 49 ++ 4 files changed, 960 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/hif_tx.c create mode 100644 drivers/net/wireless/silabs/wfx/hif_tx.h create mode 100644 drivers/net/wireless/silabs/wfx/hif_tx_mib.c create mode 100644 drivers/net/wireless/silabs/wfx/hif_tx_mib.h diff --git a/drivers/net/wireless/silabs/wfx/hif_tx.c b/drivers/net/wireless/silabs/wfx/hif_tx.c new file mode 100644 index 000000000000..626a6b5aee1e --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/hif_tx.c @@ -0,0 +1,527 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Implementation of host-to-chip commands (aka request/confirmation) of WFxxx + * Split Mac (WSM) API. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#include + +#include "hif_tx.h" +#include "wfx.h" +#include "bh.h" +#include "hwio.h" +#include "debug.h" +#include "sta.h" + +void wfx_init_hif_cmd(struct wfx_hif_cmd *hif_cmd) +{ + init_completion(&hif_cmd->ready); + init_completion(&hif_cmd->done); + mutex_init(&hif_cmd->lock); +} + +static void wfx_fill_header(struct hif_msg *hif, int if_id, + unsigned int cmd, size_t size) +{ + if (if_id == -1) + if_id = 2; + + WARN(cmd > 0x3f, "invalid WSM command %#.2x", cmd); + WARN(size > 0xFFF, "requested buffer is too large: %zu bytes", size); + WARN(if_id > 0x3, "invalid interface ID %d", if_id); + + hif->len = cpu_to_le16(size + 4); + hif->id = cmd; + hif->interface = if_id; +} + +static void *wfx_alloc_hif(size_t body_len, struct hif_msg **hif) +{ + *hif = kzalloc(sizeof(struct hif_msg) + body_len, GFP_KERNEL); + if (*hif) + return (*hif)->body; + else + return NULL; +} + +int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request, + void *reply, size_t reply_len, bool no_reply) +{ + const char *mib_name = ""; + const char *mib_sep = ""; + int cmd = request->id; + int vif = request->interface; + int ret; + + /* Do not wait for any reply if chip is frozen */ + if (wdev->chip_frozen) + return -ETIMEDOUT; + + mutex_lock(&wdev->hif_cmd.lock); + WARN(wdev->hif_cmd.buf_send, "data locking error"); + + /* Note: call to complete() below has an implicit memory barrier that + * hopefully protect buf_send + */ + wdev->hif_cmd.buf_send = request; + wdev->hif_cmd.buf_recv = reply; + wdev->hif_cmd.len_recv = reply_len; + complete(&wdev->hif_cmd.ready); + + wfx_bh_request_tx(wdev); + + if (no_reply) { + /* Chip won't reply. Give enough time to the wq to send the + * buffer. + */ + msleep(100); + wdev->hif_cmd.buf_send = NULL; + mutex_unlock(&wdev->hif_cmd.lock); + return 0; + } + + if (wdev->poll_irq) + wfx_bh_poll_irq(wdev); + + ret = wait_for_completion_timeout(&wdev->hif_cmd.done, 1 * HZ); + if (!ret) { + dev_err(wdev->dev, "chip is abnormally long to answer\n"); + reinit_completion(&wdev->hif_cmd.ready); + ret = wait_for_completion_timeout(&wdev->hif_cmd.done, 3 * HZ); + } + if (!ret) { + dev_err(wdev->dev, "chip did not answer\n"); + wfx_pending_dump_old_frames(wdev, 3000); + wdev->chip_frozen = true; + reinit_completion(&wdev->hif_cmd.done); + ret = -ETIMEDOUT; + } else { + ret = wdev->hif_cmd.ret; + } + + wdev->hif_cmd.buf_send = NULL; + mutex_unlock(&wdev->hif_cmd.lock); + + if (ret && + (cmd == HIF_REQ_ID_READ_MIB || cmd == HIF_REQ_ID_WRITE_MIB)) { + mib_name = get_mib_name(((u16 *)request)[2]); + mib_sep = "/"; + } + if (ret < 0) + dev_err(wdev->dev, + "WSM request %s%s%s (%#.2x) on vif %d returned error %d\n", + get_hif_name(cmd), mib_sep, mib_name, cmd, vif, ret); + if (ret > 0) + dev_warn(wdev->dev, + "WSM request %s%s%s (%#.2x) on vif %d returned status %d\n", + get_hif_name(cmd), mib_sep, mib_name, cmd, vif, ret); + + return ret; +} + +/* This function is special. After HIF_REQ_ID_SHUT_DOWN, chip won't reply to any + * request anymore. Obviously, only call this function during device unregister. + */ +int hif_shutdown(struct wfx_dev *wdev) +{ + int ret; + struct hif_msg *hif; + + wfx_alloc_hif(0, &hif); + if (!hif) + return -ENOMEM; + wfx_fill_header(hif, -1, HIF_REQ_ID_SHUT_DOWN, 0); + ret = wfx_cmd_send(wdev, hif, NULL, 0, true); + if (wdev->pdata.gpio_wakeup) + gpiod_set_value(wdev->pdata.gpio_wakeup, 0); + else + control_reg_write(wdev, 0); + kfree(hif); + return ret; +} + +int hif_configuration(struct wfx_dev *wdev, const u8 *conf, size_t len) +{ + int ret; + size_t buf_len = sizeof(struct hif_req_configuration) + len; + struct hif_msg *hif; + struct hif_req_configuration *body = wfx_alloc_hif(buf_len, &hif); + + if (!hif) + return -ENOMEM; + body->length = cpu_to_le16(len); + memcpy(body->pds_data, conf, len); + wfx_fill_header(hif, -1, HIF_REQ_ID_CONFIGURATION, buf_len); + ret = wfx_cmd_send(wdev, hif, NULL, 0, false); + kfree(hif); + return ret; +} + +int hif_reset(struct wfx_vif *wvif, bool reset_stat) +{ + int ret; + struct hif_msg *hif; + struct hif_req_reset *body = wfx_alloc_hif(sizeof(*body), &hif); + + if (!hif) + return -ENOMEM; + body->reset_stat = reset_stat; + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_RESET, sizeof(*body)); + ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); + kfree(hif); + return ret; +} + +int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, + void *val, size_t val_len) +{ + int ret; + struct hif_msg *hif; + int buf_len = sizeof(struct hif_cnf_read_mib) + val_len; + struct hif_req_read_mib *body = wfx_alloc_hif(sizeof(*body), &hif); + struct hif_cnf_read_mib *reply = kmalloc(buf_len, GFP_KERNEL); + + if (!body || !reply) { + ret = -ENOMEM; + goto out; + } + body->mib_id = cpu_to_le16(mib_id); + wfx_fill_header(hif, vif_id, HIF_REQ_ID_READ_MIB, sizeof(*body)); + ret = wfx_cmd_send(wdev, hif, reply, buf_len, false); + + if (!ret && mib_id != le16_to_cpu(reply->mib_id)) { + dev_warn(wdev->dev, "%s: confirmation mismatch request\n", + __func__); + ret = -EIO; + } + if (ret == -ENOMEM) + dev_err(wdev->dev, "buffer is too small to receive %s (%zu < %d)\n", + get_mib_name(mib_id), val_len, + le16_to_cpu(reply->length)); + if (!ret) + memcpy(val, &reply->mib_data, le16_to_cpu(reply->length)); + else + memset(val, 0xFF, val_len); +out: + kfree(hif); + kfree(reply); + return ret; +} + +int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, + void *val, size_t val_len) +{ + int ret; + struct hif_msg *hif; + int buf_len = sizeof(struct hif_req_write_mib) + val_len; + struct hif_req_write_mib *body = wfx_alloc_hif(buf_len, &hif); + + if (!hif) + return -ENOMEM; + body->mib_id = cpu_to_le16(mib_id); + body->length = cpu_to_le16(val_len); + memcpy(&body->mib_data, val, val_len); + wfx_fill_header(hif, vif_id, HIF_REQ_ID_WRITE_MIB, buf_len); + ret = wfx_cmd_send(wdev, hif, NULL, 0, false); + kfree(hif); + return ret; +} + +int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, + int chan_start_idx, int chan_num, int *timeout) +{ + int ret, i; + struct hif_msg *hif; + size_t buf_len = + sizeof(struct hif_req_start_scan_alt) + chan_num * sizeof(u8); + struct hif_req_start_scan_alt *body = wfx_alloc_hif(buf_len, &hif); + int tmo_chan_fg, tmo_chan_bg, tmo; + + WARN(chan_num > HIF_API_MAX_NB_CHANNELS, "invalid params"); + WARN(req->n_ssids > HIF_API_MAX_NB_SSIDS, "invalid params"); + + if (!hif) + return -ENOMEM; + for (i = 0; i < req->n_ssids; i++) { + memcpy(body->ssid_def[i].ssid, req->ssids[i].ssid, + IEEE80211_MAX_SSID_LEN); + body->ssid_def[i].ssid_length = + cpu_to_le32(req->ssids[i].ssid_len); + } + body->num_of_ssids = HIF_API_MAX_NB_SSIDS; + body->maintain_current_bss = 1; + body->disallow_ps = 1; + body->tx_power_level = + cpu_to_le32(req->channels[chan_start_idx]->max_power); + body->num_of_channels = chan_num; + for (i = 0; i < chan_num; i++) + body->channel_list[i] = + req->channels[i + chan_start_idx]->hw_value; + if (req->no_cck) + body->max_transmit_rate = API_RATE_INDEX_G_6MBPS; + else + body->max_transmit_rate = API_RATE_INDEX_B_1MBPS; + if (req->channels[chan_start_idx]->flags & IEEE80211_CHAN_NO_IR) { + body->min_channel_time = cpu_to_le32(50); + body->max_channel_time = cpu_to_le32(150); + } else { + body->min_channel_time = cpu_to_le32(10); + body->max_channel_time = cpu_to_le32(50); + body->num_of_probe_requests = 2; + body->probe_delay = 100; + } + tmo_chan_bg = le32_to_cpu(body->max_channel_time) * USEC_PER_TU; + tmo_chan_fg = 512 * USEC_PER_TU + body->probe_delay; + tmo_chan_fg *= body->num_of_probe_requests; + tmo = chan_num * max(tmo_chan_bg, tmo_chan_fg) + 512 * USEC_PER_TU; + if (timeout) + *timeout = usecs_to_jiffies(tmo); + + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START_SCAN, buf_len); + ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); + kfree(hif); + return ret; +} + +int hif_stop_scan(struct wfx_vif *wvif) +{ + int ret; + struct hif_msg *hif; + /* body associated to HIF_REQ_ID_STOP_SCAN is empty */ + wfx_alloc_hif(0, &hif); + + if (!hif) + return -ENOMEM; + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_STOP_SCAN, 0); + ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); + kfree(hif); + return ret; +} + +int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, + struct ieee80211_channel *channel, const u8 *ssid, int ssidlen) +{ + int ret; + struct hif_msg *hif; + struct hif_req_join *body = wfx_alloc_hif(sizeof(*body), &hif); + + WARN_ON(!conf->beacon_int); + WARN_ON(!conf->basic_rates); + WARN_ON(sizeof(body->ssid) < ssidlen); + WARN(!conf->ibss_joined && !ssidlen, "joining an unknown BSS"); + if (WARN_ON(!channel)) + return -EINVAL; + if (!hif) + return -ENOMEM; + body->infrastructure_bss_mode = !conf->ibss_joined; + body->short_preamble = conf->use_short_preamble; + if (channel->flags & IEEE80211_CHAN_NO_IR) + body->probe_for_join = 0; + else + body->probe_for_join = 1; + body->channel_number = channel->hw_value; + body->beacon_interval = cpu_to_le32(conf->beacon_int); + body->basic_rate_set = + cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates)); + memcpy(body->bssid, conf->bssid, sizeof(body->bssid)); + if (ssid) { + body->ssid_length = cpu_to_le32(ssidlen); + memcpy(body->ssid, ssid, ssidlen); + } + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_JOIN, sizeof(*body)); + ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); + kfree(hif); + return ret; +} + +int hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count) +{ + int ret; + struct hif_msg *hif; + struct hif_req_set_bss_params *body = + wfx_alloc_hif(sizeof(*body), &hif); + + if (!hif) + return -ENOMEM; + body->aid = cpu_to_le16(aid); + body->beacon_lost_count = beacon_lost_count; + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_SET_BSS_PARAMS, + sizeof(*body)); + ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); + kfree(hif); + return ret; +} + +int hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg) +{ + int ret; + struct hif_msg *hif; + /* FIXME: only send necessary bits */ + struct hif_req_add_key *body = wfx_alloc_hif(sizeof(*body), &hif); + + if (!hif) + return -ENOMEM; + /* FIXME: swap bytes as necessary in body */ + memcpy(body, arg, sizeof(*body)); + if (wfx_api_older_than(wdev, 1, 5)) + /* Legacy firmwares expect that add_key to be sent on right + * interface. + */ + wfx_fill_header(hif, arg->int_id, HIF_REQ_ID_ADD_KEY, + sizeof(*body)); + else + wfx_fill_header(hif, -1, HIF_REQ_ID_ADD_KEY, sizeof(*body)); + ret = wfx_cmd_send(wdev, hif, NULL, 0, false); + kfree(hif); + return ret; +} + +int hif_remove_key(struct wfx_dev *wdev, int idx) +{ + int ret; + struct hif_msg *hif; + struct hif_req_remove_key *body = wfx_alloc_hif(sizeof(*body), &hif); + + if (!hif) + return -ENOMEM; + body->entry_index = idx; + wfx_fill_header(hif, -1, HIF_REQ_ID_REMOVE_KEY, sizeof(*body)); + ret = wfx_cmd_send(wdev, hif, NULL, 0, false); + kfree(hif); + return ret; +} + +int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, + const struct ieee80211_tx_queue_params *arg) +{ + int ret; + struct hif_msg *hif; + struct hif_req_edca_queue_params *body = wfx_alloc_hif(sizeof(*body), + &hif); + + if (!body) + return -ENOMEM; + + WARN_ON(arg->aifs > 255); + if (!hif) + return -ENOMEM; + body->aifsn = arg->aifs; + body->cw_min = cpu_to_le16(arg->cw_min); + body->cw_max = cpu_to_le16(arg->cw_max); + body->tx_op_limit = cpu_to_le16(arg->txop * USEC_PER_TXOP); + body->queue_id = 3 - queue; + /* API 2.0 has changed queue IDs values */ + if (wfx_api_older_than(wvif->wdev, 2, 0) && queue == IEEE80211_AC_BE) + body->queue_id = HIF_QUEUE_ID_BACKGROUND; + if (wfx_api_older_than(wvif->wdev, 2, 0) && queue == IEEE80211_AC_BK) + body->queue_id = HIF_QUEUE_ID_BESTEFFORT; + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_EDCA_QUEUE_PARAMS, + sizeof(*body)); + ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); + kfree(hif); + return ret; +} + +int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout) +{ + int ret; + struct hif_msg *hif; + struct hif_req_set_pm_mode *body = wfx_alloc_hif(sizeof(*body), &hif); + + if (!body) + return -ENOMEM; + + if (!hif) + return -ENOMEM; + if (ps) { + body->enter_psm = 1; + /* Firmware does not support more than 128ms */ + body->fast_psm_idle_period = min(dynamic_ps_timeout * 2, 255); + if (body->fast_psm_idle_period) + body->fast_psm = 1; + } + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_SET_PM_MODE, sizeof(*body)); + ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); + kfree(hif); + return ret; +} + +int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, + const struct ieee80211_channel *channel) +{ + int ret; + struct hif_msg *hif; + struct hif_req_start *body = wfx_alloc_hif(sizeof(*body), &hif); + + WARN_ON(!conf->beacon_int); + if (!hif) + return -ENOMEM; + body->dtim_period = conf->dtim_period; + body->short_preamble = conf->use_short_preamble; + body->channel_number = channel->hw_value; + body->beacon_interval = cpu_to_le32(conf->beacon_int); + body->basic_rate_set = + cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates)); + body->ssid_length = conf->ssid_len; + memcpy(body->ssid, conf->ssid, conf->ssid_len); + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START, sizeof(*body)); + ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); + kfree(hif); + return ret; +} + +int hif_beacon_transmit(struct wfx_vif *wvif, bool enable) +{ + int ret; + struct hif_msg *hif; + struct hif_req_beacon_transmit *body = wfx_alloc_hif(sizeof(*body), + &hif); + + if (!hif) + return -ENOMEM; + body->enable_beaconing = enable ? 1 : 0; + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_BEACON_TRANSMIT, + sizeof(*body)); + ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); + kfree(hif); + return ret; +} + +int hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, bool mfp) +{ + int ret; + struct hif_msg *hif; + struct hif_req_map_link *body = wfx_alloc_hif(sizeof(*body), &hif); + + if (!hif) + return -ENOMEM; + if (mac_addr) + ether_addr_copy(body->mac_addr, mac_addr); + body->mfpc = mfp ? 1 : 0; + body->unmap = unmap ? 1 : 0; + body->peer_sta_id = sta_id; + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_MAP_LINK, sizeof(*body)); + ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); + kfree(hif); + return ret; +} + +int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len) +{ + int ret; + struct hif_msg *hif; + int buf_len = sizeof(struct hif_req_update_ie) + ies_len; + struct hif_req_update_ie *body = wfx_alloc_hif(buf_len, &hif); + + if (!hif) + return -ENOMEM; + body->beacon = 1; + body->num_ies = cpu_to_le16(1); + memcpy(body->ie, ies, ies_len); + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_UPDATE_IE, buf_len); + ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); + kfree(hif); + return ret; +} diff --git a/drivers/net/wireless/silabs/wfx/hif_tx.h b/drivers/net/wireless/silabs/wfx/hif_tx.h new file mode 100644 index 000000000000..3521c545ae6b --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/hif_tx.h @@ -0,0 +1,60 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Implementation of host-to-chip commands (aka request/confirmation) of WFxxx + * Split Mac (WSM) API. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + * Copyright (C) 2010, ST-Ericsson SA + */ +#ifndef WFX_HIF_TX_H +#define WFX_HIF_TX_H + +struct ieee80211_channel; +struct ieee80211_bss_conf; +struct ieee80211_tx_queue_params; +struct cfg80211_scan_request; +struct hif_req_add_key; +struct wfx_dev; +struct wfx_vif; + +struct wfx_hif_cmd { + struct mutex lock; + struct completion ready; + struct completion done; + struct hif_msg *buf_send; + void *buf_recv; + size_t len_recv; + int ret; +}; + +void wfx_init_hif_cmd(struct wfx_hif_cmd *wfx_hif_cmd); +int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request, + void *reply, size_t reply_len, bool async); + +int hif_shutdown(struct wfx_dev *wdev); +int hif_configuration(struct wfx_dev *wdev, const u8 *conf, size_t len); +int hif_reset(struct wfx_vif *wvif, bool reset_stat); +int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, + void *buf, size_t buf_size); +int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, + void *buf, size_t buf_size); +int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req80211, + int chan_start, int chan_num, int *timeout); +int hif_stop_scan(struct wfx_vif *wvif); +int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, + struct ieee80211_channel *channel, const u8 *ssid, int ssidlen); +int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout); +int hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count); +int hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg); +int hif_remove_key(struct wfx_dev *wdev, int idx); +int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, + const struct ieee80211_tx_queue_params *arg); +int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, + const struct ieee80211_channel *channel); +int hif_beacon_transmit(struct wfx_vif *wvif, bool enable); +int hif_map_link(struct wfx_vif *wvif, + bool unmap, u8 *mac_addr, int sta_id, bool mfp); +int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len); + +#endif diff --git a/drivers/net/wireless/silabs/wfx/hif_tx_mib.c b/drivers/net/wireless/silabs/wfx/hif_tx_mib.c new file mode 100644 index 000000000000..0ad661bf724b --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/hif_tx_mib.c @@ -0,0 +1,324 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Implementation of host-to-chip MIBs of WFxxx Split Mac (WSM) API. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + * Copyright (C) 2010, ST-Ericsson SA + */ + +#include + +#include "wfx.h" +#include "hif_tx.h" +#include "hif_tx_mib.h" +#include "hif_api_mib.h" + +int hif_set_output_power(struct wfx_vif *wvif, int val) +{ + struct hif_mib_current_tx_power_level arg = { + .power_level = cpu_to_le32(val * 10), + }; + + return hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_CURRENT_TX_POWER_LEVEL, + &arg, sizeof(arg)); +} + +int hif_set_beacon_wakeup_period(struct wfx_vif *wvif, + unsigned int dtim_interval, + unsigned int listen_interval) +{ + struct hif_mib_beacon_wake_up_period arg = { + .wakeup_period_min = dtim_interval, + .receive_dtim = 0, + .wakeup_period_max = listen_interval, + }; + + if (dtim_interval > 0xFF || listen_interval > 0xFFFF) + return -EINVAL; + return hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_BEACON_WAKEUP_PERIOD, + &arg, sizeof(arg)); +} + +int hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, + int rssi_thold, int rssi_hyst) +{ + struct hif_mib_rcpi_rssi_threshold arg = { + .rolling_average_count = 8, + .detection = 1, + }; + + if (!rssi_thold && !rssi_hyst) { + arg.upperthresh = 1; + arg.lowerthresh = 1; + } else { + arg.upper_threshold = rssi_thold + rssi_hyst; + arg.upper_threshold = (arg.upper_threshold + 110) * 2; + arg.lower_threshold = rssi_thold; + arg.lower_threshold = (arg.lower_threshold + 110) * 2; + } + + return hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_RCPI_RSSI_THRESHOLD, &arg, sizeof(arg)); +} + +int hif_get_counters_table(struct wfx_dev *wdev, int vif_id, + struct hif_mib_extended_count_table *arg) +{ + if (wfx_api_older_than(wdev, 1, 3)) { + /* extended_count_table is wider than count_table */ + memset(arg, 0xFF, sizeof(*arg)); + return hif_read_mib(wdev, vif_id, HIF_MIB_ID_COUNTERS_TABLE, + arg, sizeof(struct hif_mib_count_table)); + } else { + return hif_read_mib(wdev, vif_id, + HIF_MIB_ID_EXTENDED_COUNTERS_TABLE, arg, + sizeof(struct hif_mib_extended_count_table)); + } +} + +int hif_set_macaddr(struct wfx_vif *wvif, u8 *mac) +{ + struct hif_mib_mac_address msg = { }; + + if (mac) + ether_addr_copy(msg.mac_addr, mac); + return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_DOT11_MAC_ADDRESS, + &msg, sizeof(msg)); +} + +int hif_set_rx_filter(struct wfx_vif *wvif, + bool filter_bssid, bool filter_prbreq) +{ + struct hif_mib_rx_filter arg = { }; + + if (filter_bssid) + arg.bssid_filter = 1; + if (!filter_prbreq) + arg.fwd_probe_req = 1; + return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_RX_FILTER, + &arg, sizeof(arg)); +} + +int hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, + const struct hif_ie_table_entry *tbl) +{ + int ret; + struct hif_mib_bcn_filter_table *arg; + int buf_len = struct_size(arg, ie_table, tbl_len); + + arg = kzalloc(buf_len, GFP_KERNEL); + if (!arg) + return -ENOMEM; + arg->num_of_info_elmts = cpu_to_le32(tbl_len); + memcpy(arg->ie_table, tbl, flex_array_size(arg, ie_table, tbl_len)); + ret = hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_BEACON_FILTER_TABLE, arg, buf_len); + kfree(arg); + return ret; +} + +int hif_beacon_filter_control(struct wfx_vif *wvif, + int enable, int beacon_count) +{ + struct hif_mib_bcn_filter_enable arg = { + .enable = cpu_to_le32(enable), + .bcn_count = cpu_to_le32(beacon_count), + }; + return hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_BEACON_FILTER_ENABLE, + &arg, sizeof(arg)); +} + +int hif_set_operational_mode(struct wfx_dev *wdev, enum hif_op_power_mode mode) +{ + struct hif_mib_gl_operational_power_mode arg = { + .power_mode = mode, + .wup_ind_activation = 1, + }; + + return hif_write_mib(wdev, -1, HIF_MIB_ID_GL_OPERATIONAL_POWER_MODE, + &arg, sizeof(arg)); +} + +int hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, + u8 frame_type, int init_rate) +{ + struct hif_mib_template_frame *arg; + + WARN(skb->len > HIF_API_MAX_TEMPLATE_FRAME_SIZE, "frame is too big"); + skb_push(skb, 4); + arg = (struct hif_mib_template_frame *)skb->data; + skb_pull(skb, 4); + arg->init_rate = init_rate; + arg->frame_type = frame_type; + arg->frame_length = cpu_to_le16(skb->len); + return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_TEMPLATE_FRAME, + arg, sizeof(*arg) + skb->len); +} + +int hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required) +{ + struct hif_mib_protected_mgmt_policy arg = { }; + + WARN(required && !capable, "incoherent arguments"); + if (capable) { + arg.pmf_enable = 1; + arg.host_enc_auth_frames = 1; + } + if (!required) + arg.unpmf_allowed = 1; + return hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_PROTECTED_MGMT_POLICY, + &arg, sizeof(arg)); +} + +int hif_set_block_ack_policy(struct wfx_vif *wvif, + u8 tx_tid_policy, u8 rx_tid_policy) +{ + struct hif_mib_block_ack_policy arg = { + .block_ack_tx_tid_policy = tx_tid_policy, + .block_ack_rx_tid_policy = rx_tid_policy, + }; + + return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_BLOCK_ACK_POLICY, + &arg, sizeof(arg)); +} + +int hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, + bool greenfield, bool short_preamble) +{ + struct hif_mib_set_association_mode arg = { + .preambtype_use = 1, + .mode = 1, + .spacing = 1, + .short_preamble = short_preamble, + .greenfield = greenfield, + .mpdu_start_spacing = ampdu_density, + }; + + return hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_SET_ASSOCIATION_MODE, &arg, sizeof(arg)); +} + +int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, + int policy_index, u8 *rates) +{ + struct hif_mib_set_tx_rate_retry_policy *arg; + size_t size = struct_size(arg, tx_rate_retry_policy, 1); + int ret; + + arg = kzalloc(size, GFP_KERNEL); + if (!arg) + return -ENOMEM; + arg->num_tx_rate_policies = 1; + arg->tx_rate_retry_policy[0].policy_index = policy_index; + arg->tx_rate_retry_policy[0].short_retry_count = 255; + arg->tx_rate_retry_policy[0].long_retry_count = 255; + arg->tx_rate_retry_policy[0].first_rate_sel = 1; + arg->tx_rate_retry_policy[0].terminate = 1; + arg->tx_rate_retry_policy[0].count_init = 1; + memcpy(&arg->tx_rate_retry_policy[0].rates, rates, + sizeof(arg->tx_rate_retry_policy[0].rates)); + ret = hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_SET_TX_RATE_RETRY_POLICY, arg, size); + kfree(arg); + return ret; +} + +int hif_keep_alive_period(struct wfx_vif *wvif, int period) +{ + struct hif_mib_keep_alive_period arg = { + .keep_alive_period = cpu_to_le16(period), + }; + + return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_KEEP_ALIVE_PERIOD, + &arg, sizeof(arg)); +}; + +int hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr) +{ + struct hif_mib_arp_ip_addr_table arg = { + .condition_idx = idx, + .arp_enable = HIF_ARP_NS_FILTERING_DISABLE, + }; + + if (addr) { + /* Caution: type of addr is __be32 */ + memcpy(arg.ipv4_address, addr, sizeof(arg.ipv4_address)); + arg.arp_enable = HIF_ARP_NS_FILTERING_ENABLE; + } + return hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_ARP_IP_ADDRESSES_TABLE, + &arg, sizeof(arg)); +} + +int hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable) +{ + struct hif_mib_gl_set_multi_msg arg = { + .enable_multi_tx_conf = enable, + }; + + return hif_write_mib(wdev, -1, HIF_MIB_ID_GL_SET_MULTI_MSG, + &arg, sizeof(arg)); +} + +int hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val) +{ + struct hif_mib_set_uapsd_information arg = { }; + + if (val & BIT(IEEE80211_AC_VO)) + arg.trig_voice = 1; + if (val & BIT(IEEE80211_AC_VI)) + arg.trig_video = 1; + if (val & BIT(IEEE80211_AC_BE)) + arg.trig_be = 1; + if (val & BIT(IEEE80211_AC_BK)) + arg.trig_bckgrnd = 1; + return hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_SET_UAPSD_INFORMATION, + &arg, sizeof(arg)); +} + +int hif_erp_use_protection(struct wfx_vif *wvif, bool enable) +{ + struct hif_mib_non_erp_protection arg = { + .use_cts_to_self = enable, + }; + + return hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_NON_ERP_PROTECTION, &arg, sizeof(arg)); +} + +int hif_slot_time(struct wfx_vif *wvif, int val) +{ + struct hif_mib_slot_time arg = { + .slot_time = cpu_to_le32(val), + }; + + return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SLOT_TIME, + &arg, sizeof(arg)); +} + +int hif_wep_default_key_id(struct wfx_vif *wvif, int val) +{ + struct hif_mib_wep_default_key_id arg = { + .wep_default_key_id = val, + }; + + return hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID, + &arg, sizeof(arg)); +} + +int hif_rts_threshold(struct wfx_vif *wvif, int val) +{ + struct hif_mib_dot11_rts_threshold arg = { + .threshold = cpu_to_le32(val >= 0 ? val : 0xFFFF), + }; + + return hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_DOT11_RTS_THRESHOLD, &arg, sizeof(arg)); +} diff --git a/drivers/net/wireless/silabs/wfx/hif_tx_mib.h b/drivers/net/wireless/silabs/wfx/hif_tx_mib.h new file mode 100644 index 000000000000..812b3ba0f00e --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/hif_tx_mib.h @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Implementation of host-to-chip MIBs of WFxxx Split Mac (WSM) API. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + * Copyright (C) 2010, ST-Ericsson SA + */ +#ifndef WFX_HIF_TX_MIB_H +#define WFX_HIF_TX_MIB_H + +struct wfx_vif; +struct sk_buff; + +int hif_set_output_power(struct wfx_vif *wvif, int val); +int hif_set_beacon_wakeup_period(struct wfx_vif *wvif, + unsigned int dtim_interval, + unsigned int listen_interval); +int hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, + int rssi_thold, int rssi_hyst); +int hif_get_counters_table(struct wfx_dev *wdev, int vif_id, + struct hif_mib_extended_count_table *arg); +int hif_set_macaddr(struct wfx_vif *wvif, u8 *mac); +int hif_set_rx_filter(struct wfx_vif *wvif, + bool filter_bssid, bool fwd_probe_req); +int hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, + const struct hif_ie_table_entry *tbl); +int hif_beacon_filter_control(struct wfx_vif *wvif, + int enable, int beacon_count); +int hif_set_operational_mode(struct wfx_dev *wdev, enum hif_op_power_mode mode); +int hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, + u8 frame_type, int init_rate); +int hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required); +int hif_set_block_ack_policy(struct wfx_vif *wvif, + u8 tx_tid_policy, u8 rx_tid_policy); +int hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, + bool greenfield, bool short_preamble); +int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, + int policy_index, u8 *rates); +int hif_keep_alive_period(struct wfx_vif *wvif, int period); +int hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr); +int hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable); +int hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val); +int hif_erp_use_protection(struct wfx_vif *wvif, bool enable); +int hif_slot_time(struct wfx_vif *wvif, int val); +int hif_wep_default_key_id(struct wfx_vif *wvif, int val); +int hif_rts_threshold(struct wfx_vif *wvif, int val); + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:51 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:51 +0100 Subject: [PATCH v5 14/24] wfx: add key.c/key.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-15-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/key.c | 241 ++++++++++++++++++++++++++ drivers/net/wireless/silabs/wfx/key.h | 20 +++ 2 files changed, 261 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/key.c create mode 100644 drivers/net/wireless/silabs/wfx/key.h diff --git a/drivers/net/wireless/silabs/wfx/key.c b/drivers/net/wireless/silabs/wfx/key.c new file mode 100644 index 000000000000..65134a174683 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/key.c @@ -0,0 +1,241 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Key management related functions. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#include +#include + +#include "key.h" +#include "wfx.h" +#include "hif_tx_mib.h" + +static int wfx_alloc_key(struct wfx_dev *wdev) +{ + int idx; + + idx = ffs(~wdev->key_map) - 1; + if (idx < 0 || idx >= MAX_KEY_ENTRIES) + return -1; + + wdev->key_map |= BIT(idx); + return idx; +} + +static void wfx_free_key(struct wfx_dev *wdev, int idx) +{ + WARN(!(wdev->key_map & BIT(idx)), "inconsistent key allocation"); + wdev->key_map &= ~BIT(idx); +} + +static u8 fill_wep_pair(struct hif_wep_pairwise_key *msg, + struct ieee80211_key_conf *key, u8 *peer_addr) +{ + WARN(key->keylen > sizeof(msg->key_data), "inconsistent data"); + msg->key_length = key->keylen; + memcpy(msg->key_data, key->key, key->keylen); + ether_addr_copy(msg->peer_address, peer_addr); + return HIF_KEY_TYPE_WEP_PAIRWISE; +} + +static u8 fill_wep_group(struct hif_wep_group_key *msg, + struct ieee80211_key_conf *key) +{ + WARN(key->keylen > sizeof(msg->key_data), "inconsistent data"); + msg->key_id = key->keyidx; + msg->key_length = key->keylen; + memcpy(msg->key_data, key->key, key->keylen); + return HIF_KEY_TYPE_WEP_DEFAULT; +} + +static u8 fill_tkip_pair(struct hif_tkip_pairwise_key *msg, + struct ieee80211_key_conf *key, u8 *peer_addr) +{ + u8 *keybuf = key->key; + + WARN(key->keylen != sizeof(msg->tkip_key_data) + + sizeof(msg->tx_mic_key) + + sizeof(msg->rx_mic_key), "inconsistent data"); + memcpy(msg->tkip_key_data, keybuf, sizeof(msg->tkip_key_data)); + keybuf += sizeof(msg->tkip_key_data); + memcpy(msg->tx_mic_key, keybuf, sizeof(msg->tx_mic_key)); + keybuf += sizeof(msg->tx_mic_key); + memcpy(msg->rx_mic_key, keybuf, sizeof(msg->rx_mic_key)); + ether_addr_copy(msg->peer_address, peer_addr); + return HIF_KEY_TYPE_TKIP_PAIRWISE; +} + +static u8 fill_tkip_group(struct hif_tkip_group_key *msg, + struct ieee80211_key_conf *key, + struct ieee80211_key_seq *seq, + enum nl80211_iftype iftype) +{ + u8 *keybuf = key->key; + + WARN(key->keylen != sizeof(msg->tkip_key_data) + + 2 * sizeof(msg->rx_mic_key), "inconsistent data"); + msg->key_id = key->keyidx; + memcpy(msg->rx_sequence_counter, + &seq->tkip.iv16, sizeof(seq->tkip.iv16)); + memcpy(msg->rx_sequence_counter + sizeof(u16), + &seq->tkip.iv32, sizeof(seq->tkip.iv32)); + memcpy(msg->tkip_key_data, keybuf, sizeof(msg->tkip_key_data)); + keybuf += sizeof(msg->tkip_key_data); + if (iftype == NL80211_IFTYPE_AP) + /* Use Tx MIC Key */ + memcpy(msg->rx_mic_key, keybuf + 0, sizeof(msg->rx_mic_key)); + else + /* Use Rx MIC Key */ + memcpy(msg->rx_mic_key, keybuf + 8, sizeof(msg->rx_mic_key)); + return HIF_KEY_TYPE_TKIP_GROUP; +} + +static u8 fill_ccmp_pair(struct hif_aes_pairwise_key *msg, + struct ieee80211_key_conf *key, u8 *peer_addr) +{ + WARN(key->keylen != sizeof(msg->aes_key_data), "inconsistent data"); + ether_addr_copy(msg->peer_address, peer_addr); + memcpy(msg->aes_key_data, key->key, key->keylen); + return HIF_KEY_TYPE_AES_PAIRWISE; +} + +static u8 fill_ccmp_group(struct hif_aes_group_key *msg, + struct ieee80211_key_conf *key, + struct ieee80211_key_seq *seq) +{ + WARN(key->keylen != sizeof(msg->aes_key_data), "inconsistent data"); + memcpy(msg->aes_key_data, key->key, key->keylen); + memcpy(msg->rx_sequence_counter, seq->ccmp.pn, sizeof(seq->ccmp.pn)); + memreverse(msg->rx_sequence_counter, sizeof(seq->ccmp.pn)); + msg->key_id = key->keyidx; + return HIF_KEY_TYPE_AES_GROUP; +} + +static u8 fill_sms4_pair(struct hif_wapi_pairwise_key *msg, + struct ieee80211_key_conf *key, u8 *peer_addr) +{ + u8 *keybuf = key->key; + + WARN(key->keylen != sizeof(msg->wapi_key_data) + + sizeof(msg->mic_key_data), "inconsistent data"); + ether_addr_copy(msg->peer_address, peer_addr); + memcpy(msg->wapi_key_data, keybuf, sizeof(msg->wapi_key_data)); + keybuf += sizeof(msg->wapi_key_data); + memcpy(msg->mic_key_data, keybuf, sizeof(msg->mic_key_data)); + msg->key_id = key->keyidx; + return HIF_KEY_TYPE_WAPI_PAIRWISE; +} + +static u8 fill_sms4_group(struct hif_wapi_group_key *msg, + struct ieee80211_key_conf *key) +{ + u8 *keybuf = key->key; + + WARN(key->keylen != sizeof(msg->wapi_key_data) + + sizeof(msg->mic_key_data), "inconsistent data"); + memcpy(msg->wapi_key_data, keybuf, sizeof(msg->wapi_key_data)); + keybuf += sizeof(msg->wapi_key_data); + memcpy(msg->mic_key_data, keybuf, sizeof(msg->mic_key_data)); + msg->key_id = key->keyidx; + return HIF_KEY_TYPE_WAPI_GROUP; +} + +static u8 fill_aes_cmac_group(struct hif_igtk_group_key *msg, + struct ieee80211_key_conf *key, + struct ieee80211_key_seq *seq) +{ + WARN(key->keylen != sizeof(msg->igtk_key_data), "inconsistent data"); + memcpy(msg->igtk_key_data, key->key, key->keylen); + memcpy(msg->ipn, seq->aes_cmac.pn, sizeof(seq->aes_cmac.pn)); + memreverse(msg->ipn, sizeof(seq->aes_cmac.pn)); + msg->key_id = key->keyidx; + return HIF_KEY_TYPE_IGTK_GROUP; +} + +static int wfx_add_key(struct wfx_vif *wvif, struct ieee80211_sta *sta, + struct ieee80211_key_conf *key) +{ + int ret; + struct hif_req_add_key k = { }; + struct ieee80211_key_seq seq; + struct wfx_dev *wdev = wvif->wdev; + int idx = wfx_alloc_key(wvif->wdev); + bool pairwise = key->flags & IEEE80211_KEY_FLAG_PAIRWISE; + + WARN(key->flags & IEEE80211_KEY_FLAG_PAIRWISE && !sta, "inconsistent data"); + ieee80211_get_key_rx_seq(key, 0, &seq); + if (idx < 0) + return -EINVAL; + k.int_id = wvif->id; + k.entry_index = idx; + if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || + key->cipher == WLAN_CIPHER_SUITE_WEP104) { + if (pairwise) + k.type = fill_wep_pair(&k.key.wep_pairwise_key, key, + sta->addr); + else + k.type = fill_wep_group(&k.key.wep_group_key, key); + } else if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { + if (pairwise) + k.type = fill_tkip_pair(&k.key.tkip_pairwise_key, key, + sta->addr); + else + k.type = fill_tkip_group(&k.key.tkip_group_key, key, + &seq, wvif->vif->type); + } else if (key->cipher == WLAN_CIPHER_SUITE_CCMP) { + if (pairwise) + k.type = fill_ccmp_pair(&k.key.aes_pairwise_key, key, + sta->addr); + else + k.type = fill_ccmp_group(&k.key.aes_group_key, key, + &seq); + } else if (key->cipher == WLAN_CIPHER_SUITE_SMS4) { + if (pairwise) + k.type = fill_sms4_pair(&k.key.wapi_pairwise_key, key, + sta->addr); + else + k.type = fill_sms4_group(&k.key.wapi_group_key, key); + } else if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC) { + k.type = fill_aes_cmac_group(&k.key.igtk_group_key, key, &seq); + key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIE; + } else { + dev_warn(wdev->dev, "unsupported key type %d\n", key->cipher); + wfx_free_key(wdev, idx); + return -EOPNOTSUPP; + } + ret = hif_add_key(wdev, &k); + if (ret) { + wfx_free_key(wdev, idx); + return -EOPNOTSUPP; + } + key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE | + IEEE80211_KEY_FLAG_RESERVE_TAILROOM; + key->hw_key_idx = idx; + return 0; +} + +static int wfx_remove_key(struct wfx_vif *wvif, struct ieee80211_key_conf *key) +{ + WARN(key->hw_key_idx >= MAX_KEY_ENTRIES, "corrupted hw_key_idx"); + wfx_free_key(wvif->wdev, key->hw_key_idx); + return hif_remove_key(wvif->wdev, key->hw_key_idx); +} + +int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, + struct ieee80211_vif *vif, struct ieee80211_sta *sta, + struct ieee80211_key_conf *key) +{ + int ret = -EOPNOTSUPP; + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + + mutex_lock(&wvif->wdev->conf_mutex); + if (cmd == SET_KEY) + ret = wfx_add_key(wvif, sta, key); + if (cmd == DISABLE_KEY) + ret = wfx_remove_key(wvif, key); + mutex_unlock(&wvif->wdev->conf_mutex); + return ret; +} + diff --git a/drivers/net/wireless/silabs/wfx/key.h b/drivers/net/wireless/silabs/wfx/key.h new file mode 100644 index 000000000000..eba7ac56080c --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/key.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Implementation of mac80211 API. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#ifndef WFX_KEY_H +#define WFX_KEY_H + +#include + +struct wfx_dev; +struct wfx_vif; + +int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, + struct ieee80211_vif *vif, struct ieee80211_sta *sta, + struct ieee80211_key_conf *key); + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:52 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:52 +0100 Subject: [PATCH v5 15/24] wfx: add hif_rx.c/hif_rx.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-16-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/hif_rx.c | 416 +++++++++++++++++++++++ drivers/net/wireless/silabs/wfx/hif_rx.h | 18 + 2 files changed, 434 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/hif_rx.c create mode 100644 drivers/net/wireless/silabs/wfx/hif_rx.h diff --git a/drivers/net/wireless/silabs/wfx/hif_rx.c b/drivers/net/wireless/silabs/wfx/hif_rx.c new file mode 100644 index 000000000000..8cd49aca34ab --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/hif_rx.c @@ -0,0 +1,416 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Implementation of chip-to-host event (aka indications) of WFxxx Split Mac + * (WSM) API. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#include +#include + +#include "hif_rx.h" +#include "wfx.h" +#include "scan.h" +#include "bh.h" +#include "sta.h" +#include "data_rx.h" +#include "hif_api_cmd.h" + +static int hif_generic_confirm(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf) +{ + /* All confirm messages start with status */ + int status = le32_to_cpup((__le32 *)buf); + int cmd = hif->id; + int len = le16_to_cpu(hif->len) - 4; /* drop header */ + + WARN(!mutex_is_locked(&wdev->hif_cmd.lock), "data locking error"); + + if (!wdev->hif_cmd.buf_send) { + dev_warn(wdev->dev, "unexpected confirmation: 0x%.2x\n", cmd); + return -EINVAL; + } + + if (cmd != wdev->hif_cmd.buf_send->id) { + dev_warn(wdev->dev, + "chip response mismatch request: 0x%.2x vs 0x%.2x\n", + cmd, wdev->hif_cmd.buf_send->id); + return -EINVAL; + } + + if (wdev->hif_cmd.buf_recv) { + if (wdev->hif_cmd.len_recv >= len && len > 0) + memcpy(wdev->hif_cmd.buf_recv, buf, len); + else + status = -EIO; + } + wdev->hif_cmd.ret = status; + + complete(&wdev->hif_cmd.done); + return status; +} + +static int hif_tx_confirm(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf) +{ + const struct hif_cnf_tx *body = buf; + + wfx_tx_confirm_cb(wdev, body); + return 0; +} + +static int hif_multi_tx_confirm(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf) +{ + const struct hif_cnf_multi_transmit *body = buf; + int i; + + WARN(body->num_tx_confs <= 0, "corrupted message"); + for (i = 0; i < body->num_tx_confs; i++) + wfx_tx_confirm_cb(wdev, &body->tx_conf_payload[i]); + return 0; +} + +static int hif_startup_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf) +{ + const struct hif_ind_startup *body = buf; + + if (body->status || body->firmware_type > 4) { + dev_err(wdev->dev, "received invalid startup indication"); + return -EINVAL; + } + memcpy(&wdev->hw_caps, body, sizeof(struct hif_ind_startup)); + le16_to_cpus((__le16 *)&wdev->hw_caps.hardware_id); + le16_to_cpus((__le16 *)&wdev->hw_caps.num_inp_ch_bufs); + le16_to_cpus((__le16 *)&wdev->hw_caps.size_inp_ch_buf); + le32_to_cpus((__le32 *)&wdev->hw_caps.supported_rate_mask); + + complete(&wdev->firmware_ready); + return 0; +} + +static int hif_wakeup_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf) +{ + if (!wdev->pdata.gpio_wakeup || + gpiod_get_value(wdev->pdata.gpio_wakeup) == 0) { + dev_warn(wdev->dev, "unexpected wake-up indication\n"); + return -EIO; + } + return 0; +} + +static int hif_receive_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, + const void *buf, struct sk_buff *skb) +{ + struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); + const struct hif_ind_rx *body = buf; + + if (!wvif) { + dev_warn(wdev->dev, "%s: ignore rx data for non-existent vif %d\n", + __func__, hif->interface); + return -EIO; + } + skb_pull(skb, sizeof(struct hif_msg) + sizeof(struct hif_ind_rx)); + wfx_rx_cb(wvif, body, skb); + + return 0; +} + +static int hif_event_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf) +{ + struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); + const struct hif_ind_event *body = buf; + int type = le32_to_cpu(body->event_id); + + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } + + switch (type) { + case HIF_EVENT_IND_RCPI_RSSI: + wfx_event_report_rssi(wvif, body->event_data.rcpi_rssi); + break; + case HIF_EVENT_IND_BSSLOST: + schedule_delayed_work(&wvif->beacon_loss_work, 0); + break; + case HIF_EVENT_IND_BSSREGAINED: + cancel_delayed_work(&wvif->beacon_loss_work); + dev_dbg(wdev->dev, "ignore BSSREGAINED indication\n"); + break; + case HIF_EVENT_IND_PS_MODE_ERROR: + dev_warn(wdev->dev, "error while processing power save request: %d\n", + le32_to_cpu(body->event_data.ps_mode_error)); + break; + default: + dev_warn(wdev->dev, "unhandled event indication: %.2x\n", + type); + break; + } + return 0; +} + +static int hif_pm_mode_complete_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, + const void *buf) +{ + struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); + + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } + complete(&wvif->set_pm_mode_complete); + + return 0; +} + +static int hif_scan_complete_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, + const void *buf) +{ + struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); + + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } + + wfx_scan_complete(wvif); + + return 0; +} + +static int hif_join_complete_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, + const void *buf) +{ + struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); + + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } + dev_warn(wdev->dev, "unattended JoinCompleteInd\n"); + + return 0; +} + +static int hif_suspend_resume_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, + const void *buf) +{ + const struct hif_ind_suspend_resume_tx *body = buf; + struct wfx_vif *wvif; + + if (body->bc_mc_only) { + wvif = wdev_to_wvif(wdev, hif->interface); + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } + if (body->resume) + wfx_suspend_resume_mc(wvif, STA_NOTIFY_AWAKE); + else + wfx_suspend_resume_mc(wvif, STA_NOTIFY_SLEEP); + } else { + WARN(body->peer_sta_set, "misunderstood indication"); + WARN(hif->interface != 2, "misunderstood indication"); + if (body->resume) + wfx_suspend_hot_dev(wdev, STA_NOTIFY_AWAKE); + else + wfx_suspend_hot_dev(wdev, STA_NOTIFY_SLEEP); + } + + return 0; +} + +static int hif_generic_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf) +{ + const struct hif_ind_generic *body = buf; + int type = le32_to_cpu(body->type); + + switch (type) { + case HIF_GENERIC_INDICATION_TYPE_RAW: + return 0; + case HIF_GENERIC_INDICATION_TYPE_STRING: + dev_info(wdev->dev, "firmware says: %s\n", (char *)&body->data); + return 0; + case HIF_GENERIC_INDICATION_TYPE_RX_STATS: + mutex_lock(&wdev->rx_stats_lock); + /* Older firmware send a generic indication beside RxStats */ + if (!wfx_api_older_than(wdev, 1, 4)) + dev_info(wdev->dev, "Rx test ongoing. Temperature: %d degrees C\n", + body->data.rx_stats.current_temp); + memcpy(&wdev->rx_stats, &body->data.rx_stats, + sizeof(wdev->rx_stats)); + mutex_unlock(&wdev->rx_stats_lock); + return 0; + case HIF_GENERIC_INDICATION_TYPE_TX_POWER_LOOP_INFO: + mutex_lock(&wdev->tx_power_loop_info_lock); + memcpy(&wdev->tx_power_loop_info, + &body->data.tx_power_loop_info, + sizeof(wdev->tx_power_loop_info)); + mutex_unlock(&wdev->tx_power_loop_info_lock); + return 0; + default: + dev_err(wdev->dev, "generic_indication: unknown indication type: %#.8x\n", + type); + return -EIO; + } +} + +static const struct { + int val; + const char *str; + bool has_param; +} hif_errors[] = { + { HIF_ERROR_FIRMWARE_ROLLBACK, + "rollback status" }, + { HIF_ERROR_FIRMWARE_DEBUG_ENABLED, + "debug feature enabled" }, + { HIF_ERROR_PDS_PAYLOAD, + "PDS version is not supported" }, + { HIF_ERROR_PDS_TESTFEATURE, + "PDS ask for an unknown test mode" }, + { HIF_ERROR_OOR_VOLTAGE, + "out-of-range power supply voltage", true }, + { HIF_ERROR_OOR_TEMPERATURE, + "out-of-range temperature", true }, + { HIF_ERROR_SLK_REQ_DURING_KEY_EXCHANGE, + "secure link does not expect request during key exchange" }, + { HIF_ERROR_SLK_SESSION_KEY, + "secure link session key is invalid" }, + { HIF_ERROR_SLK_OVERFLOW, + "secure link overflow" }, + { HIF_ERROR_SLK_WRONG_ENCRYPTION_STATE, + "secure link messages list does not match message encryption" }, + { HIF_ERROR_SLK_UNCONFIGURED, + "secure link not yet configured" }, + { HIF_ERROR_HIF_BUS_FREQUENCY_TOO_LOW, + "bus clock is too slow (<1kHz)" }, + { HIF_ERROR_HIF_RX_DATA_TOO_LARGE, + "HIF message too large" }, + /* Following errors only exists in old firmware versions: */ + { HIF_ERROR_HIF_TX_QUEUE_FULL, + "HIF messages queue is full" }, + { HIF_ERROR_HIF_BUS, + "HIF bus" }, + { HIF_ERROR_SLK_MULTI_TX_UNSUPPORTED, + "secure link does not support multi-tx confirmations" }, + { HIF_ERROR_SLK_OUTDATED_SESSION_KEY, + "secure link session key is outdated" }, + { HIF_ERROR_SLK_DECRYPTION, + "secure link params (nonce or tag) mismatch" }, +}; + +static int hif_error_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf) +{ + const struct hif_ind_error *body = buf; + int type = le32_to_cpu(body->type); + int param = (s8)body->data[0]; + int i; + + for (i = 0; i < ARRAY_SIZE(hif_errors); i++) + if (type == hif_errors[i].val) + break; + if (i < ARRAY_SIZE(hif_errors)) + if (hif_errors[i].has_param) + dev_err(wdev->dev, "asynchronous error: %s: %d\n", + hif_errors[i].str, param); + else + dev_err(wdev->dev, "asynchronous error: %s\n", + hif_errors[i].str); + else + dev_err(wdev->dev, "asynchronous error: unknown: %08x\n", type); + print_hex_dump(KERN_INFO, "hif: ", DUMP_PREFIX_OFFSET, + 16, 1, hif, le16_to_cpu(hif->len), false); + wdev->chip_frozen = true; + + return 0; +}; + +static int hif_exception_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf) +{ + const struct hif_ind_exception *body = buf; + int type = le32_to_cpu(body->type); + + if (type == 4) + dev_err(wdev->dev, "firmware assert %d\n", + le32_to_cpup((__le32 *)body->data)); + else + dev_err(wdev->dev, "firmware exception\n"); + print_hex_dump(KERN_INFO, "hif: ", DUMP_PREFIX_OFFSET, + 16, 1, hif, le16_to_cpu(hif->len), false); + wdev->chip_frozen = true; + + return -1; +} + +static const struct { + int msg_id; + int (*handler)(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf); +} hif_handlers[] = { + /* Confirmations */ + { HIF_CNF_ID_TX, hif_tx_confirm }, + { HIF_CNF_ID_MULTI_TRANSMIT, hif_multi_tx_confirm }, + /* Indications */ + { HIF_IND_ID_STARTUP, hif_startup_indication }, + { HIF_IND_ID_WAKEUP, hif_wakeup_indication }, + { HIF_IND_ID_JOIN_COMPLETE, hif_join_complete_indication }, + { HIF_IND_ID_SET_PM_MODE_CMPL, hif_pm_mode_complete_indication }, + { HIF_IND_ID_SCAN_CMPL, hif_scan_complete_indication }, + { HIF_IND_ID_SUSPEND_RESUME_TX, hif_suspend_resume_indication }, + { HIF_IND_ID_EVENT, hif_event_indication }, + { HIF_IND_ID_GENERIC, hif_generic_indication }, + { HIF_IND_ID_ERROR, hif_error_indication }, + { HIF_IND_ID_EXCEPTION, hif_exception_indication }, + /* FIXME: allocate skb_p from hif_receive_indication and make it generic */ + //{ HIF_IND_ID_RX, hif_receive_indication }, +}; + +void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb) +{ + int i; + const struct hif_msg *hif = (const struct hif_msg *)skb->data; + int hif_id = hif->id; + + if (hif_id == HIF_IND_ID_RX) { + /* hif_receive_indication take care of skb lifetime */ + hif_receive_indication(wdev, hif, hif->body, skb); + return; + } + /* Note: mutex_is_lock cause an implicit memory barrier that protect + * buf_send + */ + if (mutex_is_locked(&wdev->hif_cmd.lock) && + wdev->hif_cmd.buf_send && + wdev->hif_cmd.buf_send->id == hif_id) { + hif_generic_confirm(wdev, hif, hif->body); + goto free; + } + for (i = 0; i < ARRAY_SIZE(hif_handlers); i++) { + if (hif_handlers[i].msg_id == hif_id) { + if (hif_handlers[i].handler) + hif_handlers[i].handler(wdev, hif, hif->body); + goto free; + } + } + if (hif_id & 0x80) + dev_err(wdev->dev, "unsupported HIF indication: ID %02x\n", + hif_id); + else + dev_err(wdev->dev, "unexpected HIF confirmation: ID %02x\n", + hif_id); +free: + dev_kfree_skb(skb); +} diff --git a/drivers/net/wireless/silabs/wfx/hif_rx.h b/drivers/net/wireless/silabs/wfx/hif_rx.h new file mode 100644 index 000000000000..f07c10c8c6bd --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/hif_rx.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Implementation of chip-to-host event (aka indications) of WFxxx Split Mac + * (WSM) API. + * + * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + * Copyright (C) 2010, ST-Ericsson SA + */ +#ifndef WFX_HIF_RX_H +#define WFX_HIF_RX_H + +struct wfx_dev; +struct sk_buff; + +void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb); + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:53 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:53 +0100 Subject: [PATCH v5 16/24] wfx: add data_rx.c/data_rx.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-17-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/data_rx.c | 94 +++++++++++++++++++++++ drivers/net/wireless/silabs/wfx/data_rx.h | 18 +++++ 2 files changed, 112 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/data_rx.c create mode 100644 drivers/net/wireless/silabs/wfx/data_rx.h diff --git a/drivers/net/wireless/silabs/wfx/data_rx.c b/drivers/net/wireless/silabs/wfx/data_rx.c new file mode 100644 index 000000000000..e6d9d8746d4d --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/data_rx.c @@ -0,0 +1,94 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Datapath implementation. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#include +#include + +#include "data_rx.h" +#include "wfx.h" +#include "bh.h" +#include "sta.h" + +static void wfx_rx_handle_ba(struct wfx_vif *wvif, struct ieee80211_mgmt *mgmt) +{ + int params, tid; + + if (wfx_api_older_than(wvif->wdev, 3, 6)) + return; + + switch (mgmt->u.action.u.addba_req.action_code) { + case WLAN_ACTION_ADDBA_REQ: + params = le16_to_cpu(mgmt->u.action.u.addba_req.capab); + tid = (params & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2; + ieee80211_start_rx_ba_session_offl(wvif->vif, mgmt->sa, tid); + break; + case WLAN_ACTION_DELBA: + params = le16_to_cpu(mgmt->u.action.u.delba.params); + tid = (params & IEEE80211_DELBA_PARAM_TID_MASK) >> 12; + ieee80211_stop_rx_ba_session_offl(wvif->vif, mgmt->sa, tid); + break; + } +} + +void wfx_rx_cb(struct wfx_vif *wvif, + const struct hif_ind_rx *arg, struct sk_buff *skb) +{ + struct ieee80211_rx_status *hdr = IEEE80211_SKB_RXCB(skb); + struct ieee80211_hdr *frame = (struct ieee80211_hdr *)skb->data; + struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; + + memset(hdr, 0, sizeof(*hdr)); + + if (arg->status == HIF_STATUS_RX_FAIL_MIC) + hdr->flag |= RX_FLAG_MMIC_ERROR | RX_FLAG_IV_STRIPPED; + else if (arg->status) + goto drop; + + if (skb->len < sizeof(struct ieee80211_pspoll)) { + dev_warn(wvif->wdev->dev, "malformed SDU received\n"); + goto drop; + } + + hdr->band = NL80211_BAND_2GHZ; + hdr->freq = ieee80211_channel_to_frequency(arg->channel_number, + hdr->band); + + if (arg->rxed_rate >= 14) { + hdr->encoding = RX_ENC_HT; + hdr->rate_idx = arg->rxed_rate - 14; + } else if (arg->rxed_rate >= 4) { + hdr->rate_idx = arg->rxed_rate - 2; + } else { + hdr->rate_idx = arg->rxed_rate; + } + + if (!arg->rcpi_rssi) { + hdr->flag |= RX_FLAG_NO_SIGNAL_VAL; + dev_info(wvif->wdev->dev, "received frame without RSSI data\n"); + } + hdr->signal = arg->rcpi_rssi / 2 - 110; + hdr->antenna = 0; + + if (arg->encryp) + hdr->flag |= RX_FLAG_DECRYPTED; + + /* Block ack negotiation is offloaded by the firmware. However, + * re-ordering must be done by the mac80211. + */ + if (ieee80211_is_action(frame->frame_control) && + mgmt->u.action.category == WLAN_CATEGORY_BACK && + skb->len > IEEE80211_MIN_ACTION_SIZE) { + wfx_rx_handle_ba(wvif, mgmt); + goto drop; + } + + ieee80211_rx_irqsafe(wvif->wdev->hw, skb); + return; + +drop: + dev_kfree_skb(skb); +} diff --git a/drivers/net/wireless/silabs/wfx/data_rx.h b/drivers/net/wireless/silabs/wfx/data_rx.h new file mode 100644 index 000000000000..a320cd858273 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/data_rx.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Datapath implementation. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#ifndef WFX_DATA_RX_H +#define WFX_DATA_RX_H + +struct wfx_vif; +struct sk_buff; +struct hif_ind_rx; + +void wfx_rx_cb(struct wfx_vif *wvif, + const struct hif_ind_rx *arg, struct sk_buff *skb); + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:54 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:54 +0100 Subject: [PATCH v5 17/24] wfx: add queue.c/queue.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-18-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/queue.c | 307 ++++++++++++++++++++++++ drivers/net/wireless/silabs/wfx/queue.h | 45 ++++ 2 files changed, 352 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/queue.c create mode 100644 drivers/net/wireless/silabs/wfx/queue.h diff --git a/drivers/net/wireless/silabs/wfx/queue.c b/drivers/net/wireless/silabs/wfx/queue.c new file mode 100644 index 000000000000..4dc161f5ff71 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/queue.c @@ -0,0 +1,307 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * O(1) TX queue with built-in allocator. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#include +#include + +#include "queue.h" +#include "wfx.h" +#include "sta.h" +#include "data_tx.h" +#include "traces.h" + +void wfx_tx_lock(struct wfx_dev *wdev) +{ + atomic_inc(&wdev->tx_lock); +} + +void wfx_tx_unlock(struct wfx_dev *wdev) +{ + int tx_lock = atomic_dec_return(&wdev->tx_lock); + + WARN(tx_lock < 0, "inconsistent tx_lock value"); + if (!tx_lock) + wfx_bh_request_tx(wdev); +} + +void wfx_tx_flush(struct wfx_dev *wdev) +{ + int ret; + + /* Do not wait for any reply if chip is frozen */ + if (wdev->chip_frozen) + return; + + wfx_tx_lock(wdev); + mutex_lock(&wdev->hif_cmd.lock); + ret = wait_event_timeout(wdev->hif.tx_buffers_empty, + !wdev->hif.tx_buffers_used, + msecs_to_jiffies(3000)); + if (!ret) { + dev_warn(wdev->dev, "cannot flush tx buffers (%d still busy)\n", + wdev->hif.tx_buffers_used); + wfx_pending_dump_old_frames(wdev, 3000); + /* FIXME: drop pending frames here */ + wdev->chip_frozen = true; + } + mutex_unlock(&wdev->hif_cmd.lock); + wfx_tx_unlock(wdev); +} + +void wfx_tx_lock_flush(struct wfx_dev *wdev) +{ + wfx_tx_lock(wdev); + wfx_tx_flush(wdev); +} + +void wfx_tx_queues_init(struct wfx_vif *wvif) +{ + /* The device is in charge to respect the details of the QoS parameters. + * The driver just ensure that it roughtly respect the priorities to + * avoid any shortage. + */ + const int priorities[IEEE80211_NUM_ACS] = { 1, 2, 64, 128 }; + int i; + + for (i = 0; i < IEEE80211_NUM_ACS; ++i) { + skb_queue_head_init(&wvif->tx_queue[i].normal); + skb_queue_head_init(&wvif->tx_queue[i].cab); + wvif->tx_queue[i].priority = priorities[i]; + } +} + +void wfx_tx_queues_check_empty(struct wfx_vif *wvif) +{ + int i; + + for (i = 0; i < IEEE80211_NUM_ACS; ++i) { + WARN_ON(atomic_read(&wvif->tx_queue[i].pending_frames)); + WARN_ON(!skb_queue_empty_lockless(&wvif->tx_queue[i].normal)); + WARN_ON(!skb_queue_empty_lockless(&wvif->tx_queue[i].cab)); + } +} + +bool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue) +{ + return skb_queue_empty(&queue->normal) && skb_queue_empty(&queue->cab); +} + +static void __wfx_tx_queue_drop(struct wfx_vif *wvif, + struct sk_buff_head *skb_queue, + struct sk_buff_head *dropped) +{ + struct sk_buff *skb, *tmp; + + spin_lock_bh(&skb_queue->lock); + skb_queue_walk_safe(skb_queue, skb, tmp) { + __skb_unlink(skb, skb_queue); + skb_queue_head(dropped, skb); + } + spin_unlock_bh(&skb_queue->lock); +} + +void wfx_tx_queue_drop(struct wfx_vif *wvif, struct wfx_queue *queue, + struct sk_buff_head *dropped) +{ + __wfx_tx_queue_drop(wvif, &queue->cab, dropped); + __wfx_tx_queue_drop(wvif, &queue->normal, dropped); + wake_up(&wvif->wdev->tx_dequeue); +} + +void wfx_tx_queues_put(struct wfx_vif *wvif, struct sk_buff *skb) +{ + struct wfx_queue *queue = &wvif->tx_queue[skb_get_queue_mapping(skb)]; + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); + + if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) + skb_queue_tail(&queue->cab, skb); + else + skb_queue_tail(&queue->normal, skb); +} + +void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped) +{ + struct wfx_queue *queue; + struct wfx_vif *wvif; + struct hif_msg *hif; + struct sk_buff *skb; + + WARN(!wdev->chip_frozen, "%s should only be used to recover a frozen device", + __func__); + while ((skb = skb_dequeue(&wdev->tx_pending)) != NULL) { + hif = (struct hif_msg *)skb->data; + wvif = wdev_to_wvif(wdev, hif->interface); + if (wvif) { + queue = &wvif->tx_queue[skb_get_queue_mapping(skb)]; + WARN_ON(skb_get_queue_mapping(skb) > 3); + WARN_ON(!atomic_read(&queue->pending_frames)); + atomic_dec(&queue->pending_frames); + } + skb_queue_head(dropped, skb); + } +} + +struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id) +{ + struct wfx_queue *queue; + struct hif_req_tx *req; + struct wfx_vif *wvif; + struct hif_msg *hif; + struct sk_buff *skb; + + spin_lock_bh(&wdev->tx_pending.lock); + skb_queue_walk(&wdev->tx_pending, skb) { + hif = (struct hif_msg *)skb->data; + req = (struct hif_req_tx *)hif->body; + if (req->packet_id != packet_id) + continue; + spin_unlock_bh(&wdev->tx_pending.lock); + wvif = wdev_to_wvif(wdev, hif->interface); + if (wvif) { + queue = &wvif->tx_queue[skb_get_queue_mapping(skb)]; + WARN_ON(skb_get_queue_mapping(skb) > 3); + WARN_ON(!atomic_read(&queue->pending_frames)); + atomic_dec(&queue->pending_frames); + } + skb_unlink(skb, &wdev->tx_pending); + return skb; + } + spin_unlock_bh(&wdev->tx_pending.lock); + WARN(1, "cannot find packet in pending queue"); + return NULL; +} + +void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms) +{ + ktime_t now = ktime_get(); + struct wfx_tx_priv *tx_priv; + struct hif_req_tx *req; + struct sk_buff *skb; + bool first = true; + + spin_lock_bh(&wdev->tx_pending.lock); + skb_queue_walk(&wdev->tx_pending, skb) { + tx_priv = wfx_skb_tx_priv(skb); + req = wfx_skb_txreq(skb); + if (ktime_after(now, ktime_add_ms(tx_priv->xmit_timestamp, + limit_ms))) { + if (first) { + dev_info(wdev->dev, "frames stuck in firmware since %dms or more:\n", + limit_ms); + first = false; + } + dev_info(wdev->dev, " id %08x sent %lldms ago\n", + req->packet_id, + ktime_ms_delta(now, tx_priv->xmit_timestamp)); + } + } + spin_unlock_bh(&wdev->tx_pending.lock); +} + +unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, + struct sk_buff *skb) +{ + ktime_t now = ktime_get(); + struct wfx_tx_priv *tx_priv = wfx_skb_tx_priv(skb); + + return ktime_us_delta(now, tx_priv->xmit_timestamp); +} + +bool wfx_tx_queues_has_cab(struct wfx_vif *wvif) +{ + int i; + + if (wvif->vif->type != NL80211_IFTYPE_AP) + return false; + for (i = 0; i < IEEE80211_NUM_ACS; ++i) + /* Note: since only AP can have mcast frames in queue and only + * one vif can be AP, all queued frames has same interface id + */ + if (!skb_queue_empty_lockless(&wvif->tx_queue[i].cab)) + return true; + return false; +} + +static int wfx_tx_queue_get_weight(struct wfx_queue *queue) +{ + return atomic_read(&queue->pending_frames) * queue->priority; +} + +static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev) +{ + struct wfx_queue *queues[IEEE80211_NUM_ACS * ARRAY_SIZE(wdev->vif)]; + int i, j, num_queues = 0; + struct wfx_vif *wvif; + struct hif_msg *hif; + struct sk_buff *skb; + + /* sort the queues */ + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + WARN_ON(num_queues >= ARRAY_SIZE(queues)); + queues[num_queues] = &wvif->tx_queue[i]; + for (j = num_queues; j > 0; j--) + if (wfx_tx_queue_get_weight(queues[j]) < + wfx_tx_queue_get_weight(queues[j - 1])) + swap(queues[j - 1], queues[j]); + num_queues++; + } + } + + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { + if (!wvif->after_dtim_tx_allowed) + continue; + for (i = 0; i < num_queues; i++) { + skb = skb_dequeue(&queues[i]->cab); + if (!skb) + continue; + /* Note: since only AP can have mcast frames in queue + * and only one vif can be AP, all queued frames has + * same interface id + */ + hif = (struct hif_msg *)skb->data; + WARN_ON(hif->interface != wvif->id); + WARN_ON(queues[i] != + &wvif->tx_queue[skb_get_queue_mapping(skb)]); + atomic_inc(&queues[i]->pending_frames); + trace_queues_stats(wdev, queues[i]); + return skb; + } + /* No more multicast to sent */ + wvif->after_dtim_tx_allowed = false; + schedule_work(&wvif->update_tim_work); + } + + for (i = 0; i < num_queues; i++) { + skb = skb_dequeue(&queues[i]->normal); + if (skb) { + atomic_inc(&queues[i]->pending_frames); + trace_queues_stats(wdev, queues[i]); + return skb; + } + } + return NULL; +} + +struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) +{ + struct wfx_tx_priv *tx_priv; + struct sk_buff *skb; + + if (atomic_read(&wdev->tx_lock)) + return NULL; + skb = wfx_tx_queues_get_skb(wdev); + if (!skb) + return NULL; + skb_queue_tail(&wdev->tx_pending, skb); + wake_up(&wdev->tx_dequeue); + tx_priv = wfx_skb_tx_priv(skb); + tx_priv->xmit_timestamp = ktime_get(); + return (struct hif_msg *)skb->data; +} diff --git a/drivers/net/wireless/silabs/wfx/queue.h b/drivers/net/wireless/silabs/wfx/queue.h new file mode 100644 index 000000000000..a4842cab669c --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/queue.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * O(1) TX queue with built-in allocator. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#ifndef WFX_QUEUE_H +#define WFX_QUEUE_H + +#include +#include + +struct wfx_dev; +struct wfx_vif; + +struct wfx_queue { + struct sk_buff_head normal; + struct sk_buff_head cab; /* Content After (DTIM) Beacon */ + atomic_t pending_frames; + int priority; +}; + +void wfx_tx_lock(struct wfx_dev *wdev); +void wfx_tx_unlock(struct wfx_dev *wdev); +void wfx_tx_flush(struct wfx_dev *wdev); +void wfx_tx_lock_flush(struct wfx_dev *wdev); + +void wfx_tx_queues_init(struct wfx_vif *wvif); +void wfx_tx_queues_check_empty(struct wfx_vif *wvif); +bool wfx_tx_queues_has_cab(struct wfx_vif *wvif); +void wfx_tx_queues_put(struct wfx_vif *wvif, struct sk_buff *skb); +struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev); + +bool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue); +void wfx_tx_queue_drop(struct wfx_vif *wvif, struct wfx_queue *queue, + struct sk_buff_head *dropped); + +struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id); +void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped); +unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, + struct sk_buff *skb); +void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms); + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:55 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:55 +0100 Subject: [PATCH v5 18/24] wfx: add data_tx.c/data_tx.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-19-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/data_tx.c | 598 ++++++++++++++++++++++ drivers/net/wireless/silabs/wfx/data_tx.h | 68 +++ 2 files changed, 666 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/data_tx.c create mode 100644 drivers/net/wireless/silabs/wfx/data_tx.h diff --git a/drivers/net/wireless/silabs/wfx/data_tx.c b/drivers/net/wireless/silabs/wfx/data_tx.c new file mode 100644 index 000000000000..957fe4b21243 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/data_tx.c @@ -0,0 +1,598 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Datapath implementation. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#include +#include + +#include "data_tx.h" +#include "wfx.h" +#include "bh.h" +#include "sta.h" +#include "queue.h" +#include "debug.h" +#include "traces.h" +#include "hif_tx_mib.h" + +static int wfx_get_hw_rate(struct wfx_dev *wdev, + const struct ieee80211_tx_rate *rate) +{ + struct ieee80211_supported_band *band; + + if (rate->idx < 0) + return -1; + if (rate->flags & IEEE80211_TX_RC_MCS) { + if (rate->idx > 7) { + WARN(1, "wrong rate->idx value: %d", rate->idx); + return -1; + } + return rate->idx + 14; + } + /* WFx only support 2GHz, else band information should be retrieved + * from ieee80211_tx_info + */ + band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]; + if (rate->idx >= band->n_bitrates) { + WARN(1, "wrong rate->idx value: %d", rate->idx); + return -1; + } + return band->bitrates[rate->idx].hw_value; +} + +/* TX policy cache implementation */ + +static void wfx_tx_policy_build(struct wfx_vif *wvif, struct tx_policy *policy, + struct ieee80211_tx_rate *rates) +{ + struct wfx_dev *wdev = wvif->wdev; + int i, rateid; + u8 count; + + WARN(rates[0].idx < 0, "invalid rate policy"); + memset(policy, 0, sizeof(*policy)); + for (i = 0; i < IEEE80211_TX_MAX_RATES; ++i) { + if (rates[i].idx < 0) + break; + WARN_ON(rates[i].count > 15); + rateid = wfx_get_hw_rate(wdev, &rates[i]); + /* Pack two values in each byte of policy->rates */ + count = rates[i].count; + if (rateid % 2) + count <<= 4; + policy->rates[rateid / 2] |= count; + } +} + +static bool tx_policy_is_equal(const struct tx_policy *a, + const struct tx_policy *b) +{ + return !memcmp(a->rates, b->rates, sizeof(a->rates)); +} + +static int wfx_tx_policy_find(struct tx_policy_cache *cache, + struct tx_policy *wanted) +{ + struct tx_policy *it; + + list_for_each_entry(it, &cache->used, link) + if (tx_policy_is_equal(wanted, it)) + return it - cache->cache; + list_for_each_entry(it, &cache->free, link) + if (tx_policy_is_equal(wanted, it)) + return it - cache->cache; + return -1; +} + +static void wfx_tx_policy_use(struct tx_policy_cache *cache, + struct tx_policy *entry) +{ + ++entry->usage_count; + list_move(&entry->link, &cache->used); +} + +static int wfx_tx_policy_release(struct tx_policy_cache *cache, + struct tx_policy *entry) +{ + int ret = --entry->usage_count; + + if (!ret) + list_move(&entry->link, &cache->free); + return ret; +} + +static int wfx_tx_policy_get(struct wfx_vif *wvif, + struct ieee80211_tx_rate *rates, bool *renew) +{ + int idx; + struct tx_policy_cache *cache = &wvif->tx_policy_cache; + struct tx_policy wanted; + + wfx_tx_policy_build(wvif, &wanted, rates); + + spin_lock_bh(&cache->lock); + if (list_empty(&cache->free)) { + WARN(1, "unable to get a valid Tx policy"); + spin_unlock_bh(&cache->lock); + return HIF_TX_RETRY_POLICY_INVALID; + } + idx = wfx_tx_policy_find(cache, &wanted); + if (idx >= 0) { + *renew = false; + } else { + struct tx_policy *entry; + *renew = true; + /* If policy is not found create a new one + * using the oldest entry in "free" list + */ + entry = list_entry(cache->free.prev, struct tx_policy, link); + memcpy(entry->rates, wanted.rates, sizeof(entry->rates)); + entry->uploaded = false; + entry->usage_count = 0; + idx = entry - cache->cache; + } + wfx_tx_policy_use(cache, &cache->cache[idx]); + if (list_empty(&cache->free)) + ieee80211_stop_queues(wvif->wdev->hw); + spin_unlock_bh(&cache->lock); + return idx; +} + +static void wfx_tx_policy_put(struct wfx_vif *wvif, int idx) +{ + int usage, locked; + struct tx_policy_cache *cache = &wvif->tx_policy_cache; + + if (idx == HIF_TX_RETRY_POLICY_INVALID) + return; + spin_lock_bh(&cache->lock); + locked = list_empty(&cache->free); + usage = wfx_tx_policy_release(cache, &cache->cache[idx]); + if (locked && !usage) + ieee80211_wake_queues(wvif->wdev->hw); + spin_unlock_bh(&cache->lock); +} + +static int wfx_tx_policy_upload(struct wfx_vif *wvif) +{ + struct tx_policy *policies = wvif->tx_policy_cache.cache; + u8 tmp_rates[12]; + int i, is_used; + + do { + spin_lock_bh(&wvif->tx_policy_cache.lock); + for (i = 0; i < ARRAY_SIZE(wvif->tx_policy_cache.cache); ++i) { + is_used = memzcmp(policies[i].rates, + sizeof(policies[i].rates)); + if (!policies[i].uploaded && is_used) + break; + } + if (i < ARRAY_SIZE(wvif->tx_policy_cache.cache)) { + policies[i].uploaded = true; + memcpy(tmp_rates, policies[i].rates, sizeof(tmp_rates)); + spin_unlock_bh(&wvif->tx_policy_cache.lock); + hif_set_tx_rate_retry_policy(wvif, i, tmp_rates); + } else { + spin_unlock_bh(&wvif->tx_policy_cache.lock); + } + } while (i < ARRAY_SIZE(wvif->tx_policy_cache.cache)); + return 0; +} + +void wfx_tx_policy_upload_work(struct work_struct *work) +{ + struct wfx_vif *wvif = + container_of(work, struct wfx_vif, tx_policy_upload_work); + + wfx_tx_policy_upload(wvif); + wfx_tx_unlock(wvif->wdev); +} + +void wfx_tx_policy_init(struct wfx_vif *wvif) +{ + struct tx_policy_cache *cache = &wvif->tx_policy_cache; + int i; + + memset(cache, 0, sizeof(*cache)); + + spin_lock_init(&cache->lock); + INIT_LIST_HEAD(&cache->used); + INIT_LIST_HEAD(&cache->free); + + for (i = 0; i < ARRAY_SIZE(cache->cache); ++i) + list_add(&cache->cache[i].link, &cache->free); +} + +/* Tx implementation */ + +static bool wfx_is_action_back(struct ieee80211_hdr *hdr) +{ + struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)hdr; + + if (!ieee80211_is_action(mgmt->frame_control)) + return false; + if (mgmt->u.action.category != WLAN_CATEGORY_BACK) + return false; + return true; +} + +static u8 wfx_tx_get_link_id(struct wfx_vif *wvif, struct ieee80211_sta *sta, + struct ieee80211_hdr *hdr) +{ + struct wfx_sta_priv *sta_priv = + sta ? (struct wfx_sta_priv *)&sta->drv_priv : NULL; + const u8 *da = ieee80211_get_DA(hdr); + + if (sta_priv && sta_priv->link_id) + return sta_priv->link_id; + if (wvif->vif->type != NL80211_IFTYPE_AP) + return 0; + if (is_multicast_ether_addr(da)) + return 0; + return HIF_LINK_ID_NOT_ASSOCIATED; +} + +static void wfx_tx_fixup_rates(struct ieee80211_tx_rate *rates) +{ + int i; + bool finished; + + /* Firmware is not able to mix rates with different flags */ + for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { + if (rates[0].flags & IEEE80211_TX_RC_SHORT_GI) + rates[i].flags |= IEEE80211_TX_RC_SHORT_GI; + if (!(rates[0].flags & IEEE80211_TX_RC_SHORT_GI)) + rates[i].flags &= ~IEEE80211_TX_RC_SHORT_GI; + if (!(rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS)) + rates[i].flags &= ~IEEE80211_TX_RC_USE_RTS_CTS; + } + + /* Sort rates and remove duplicates */ + do { + finished = true; + for (i = 0; i < IEEE80211_TX_MAX_RATES - 1; i++) { + if (rates[i + 1].idx == rates[i].idx && + rates[i].idx != -1) { + rates[i].count += rates[i + 1].count; + if (rates[i].count > 15) + rates[i].count = 15; + rates[i + 1].idx = -1; + rates[i + 1].count = 0; + + finished = false; + } + if (rates[i + 1].idx > rates[i].idx) { + swap(rates[i + 1], rates[i]); + finished = false; + } + } + } while (!finished); + /* Ensure that MCS0 or 1Mbps is present at the end of the retry list */ + for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { + if (rates[i].idx == 0) + break; + if (rates[i].idx == -1) { + rates[i].idx = 0; + rates[i].count = 8; /* == hw->max_rate_tries */ + rates[i].flags = rates[i - 1].flags & + IEEE80211_TX_RC_MCS; + break; + } + } + /* All retries use long GI */ + for (i = 1; i < IEEE80211_TX_MAX_RATES; i++) + rates[i].flags &= ~IEEE80211_TX_RC_SHORT_GI; +} + +static u8 wfx_tx_get_rate_id(struct wfx_vif *wvif, + struct ieee80211_tx_info *tx_info) +{ + bool tx_policy_renew = false; + u8 rate_id; + + rate_id = wfx_tx_policy_get(wvif, + tx_info->driver_rates, &tx_policy_renew); + if (rate_id == HIF_TX_RETRY_POLICY_INVALID) + dev_warn(wvif->wdev->dev, "unable to get a valid Tx policy"); + + if (tx_policy_renew) { + wfx_tx_lock(wvif->wdev); + if (!schedule_work(&wvif->tx_policy_upload_work)) + wfx_tx_unlock(wvif->wdev); + } + return rate_id; +} + +static int wfx_tx_get_frame_format(struct ieee80211_tx_info *tx_info) +{ + if (!(tx_info->driver_rates[0].flags & IEEE80211_TX_RC_MCS)) + return HIF_FRAME_FORMAT_NON_HT; + else if (!(tx_info->driver_rates[0].flags & IEEE80211_TX_RC_GREEN_FIELD)) + return HIF_FRAME_FORMAT_MIXED_FORMAT_HT; + else + return HIF_FRAME_FORMAT_GF_HT_11N; +} + +static int wfx_tx_get_icv_len(struct ieee80211_key_conf *hw_key) +{ + int mic_space; + + if (!hw_key) + return 0; + if (hw_key->cipher == WLAN_CIPHER_SUITE_AES_CMAC) + return 0; + mic_space = (hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) ? 8 : 0; + return hw_key->icv_len + mic_space; +} + +static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, + struct sk_buff *skb) +{ + struct hif_msg *hif_msg; + struct hif_req_tx *req; + struct wfx_tx_priv *tx_priv; + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); + struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + int queue_id = skb_get_queue_mapping(skb); + size_t offset = (size_t)skb->data & 3; + int wmsg_len = sizeof(struct hif_msg) + + sizeof(struct hif_req_tx) + offset; + + WARN(queue_id >= IEEE80211_NUM_ACS, "unsupported queue_id"); + wfx_tx_fixup_rates(tx_info->driver_rates); + + /* From now tx_info->control is unusable */ + memset(tx_info->rate_driver_data, 0, sizeof(struct wfx_tx_priv)); + /* Fill tx_priv */ + tx_priv = (struct wfx_tx_priv *)tx_info->rate_driver_data; + tx_priv->icv_size = wfx_tx_get_icv_len(hw_key); + + /* Fill hif_msg */ + WARN(skb_headroom(skb) < wmsg_len, "not enough space in skb"); + WARN(offset & 1, "attempt to transmit an unaligned frame"); + skb_put(skb, tx_priv->icv_size); + skb_push(skb, wmsg_len); + memset(skb->data, 0, wmsg_len); + hif_msg = (struct hif_msg *)skb->data; + hif_msg->len = cpu_to_le16(skb->len); + hif_msg->id = HIF_REQ_ID_TX; + hif_msg->interface = wvif->id; + if (skb->len > wvif->wdev->hw_caps.size_inp_ch_buf) { + dev_warn(wvif->wdev->dev, + "requested frame size (%d) is larger than maximum supported (%d)\n", + skb->len, wvif->wdev->hw_caps.size_inp_ch_buf); + skb_pull(skb, wmsg_len); + return -EIO; + } + + /* Fill tx request */ + req = (struct hif_req_tx *)hif_msg->body; + /* packet_id just need to be unique on device. 32bits are more than + * necessary for that task, so we take advantage of it to add some extra + * data for debug. + */ + req->packet_id = atomic_add_return(1, &wvif->wdev->packet_id) & 0xFFFF; + req->packet_id |= IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)) << 16; + req->packet_id |= queue_id << 28; + + req->fc_offset = offset; + if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) + req->after_dtim = 1; + req->peer_sta_id = wfx_tx_get_link_id(wvif, sta, hdr); + /* Queue index are inverted between firmware and Linux */ + req->queue_id = 3 - queue_id; + req->retry_policy_index = wfx_tx_get_rate_id(wvif, tx_info); + req->frame_format = wfx_tx_get_frame_format(tx_info); + if (tx_info->driver_rates[0].flags & IEEE80211_TX_RC_SHORT_GI) + req->short_gi = 1; + + /* Auxiliary operations */ + wfx_tx_queues_put(wvif, skb); + if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) + schedule_work(&wvif->update_tim_work); + wfx_bh_request_tx(wvif->wdev); + return 0; +} + +void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, + struct sk_buff *skb) +{ + struct wfx_dev *wdev = hw->priv; + struct wfx_vif *wvif; + struct ieee80211_sta *sta = control ? control->sta : NULL; + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + size_t driver_data_room = sizeof_field(struct ieee80211_tx_info, + rate_driver_data); + + BUILD_BUG_ON_MSG(sizeof(struct wfx_tx_priv) > driver_data_room, + "struct tx_priv is too large"); + WARN(skb->next || skb->prev, "skb is already member of a list"); + /* control.vif can be NULL for injected frames */ + if (tx_info->control.vif) + wvif = (struct wfx_vif *)tx_info->control.vif->drv_priv; + else + wvif = wvif_iterate(wdev, NULL); + if (WARN_ON(!wvif)) + goto drop; + /* Because of TX_AMPDU_SETUP_IN_HW, mac80211 does not try to send any + * BlockAck session management frame. The check below exist just in case. + */ + if (wfx_is_action_back(hdr)) { + dev_info(wdev->dev, "drop BA action\n"); + goto drop; + } + if (wfx_tx_inner(wvif, sta, skb)) + goto drop; + + return; + +drop: + ieee80211_tx_status_irqsafe(wdev->hw, skb); +} + +static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb) +{ + struct hif_msg *hif = (struct hif_msg *)skb->data; + struct hif_req_tx *req = (struct hif_req_tx *)hif->body; + unsigned int offset = sizeof(struct hif_msg) + + sizeof(struct hif_req_tx) + + req->fc_offset; + + if (!wvif) { + pr_warn("vif associated with the skb does not exist anymore\n"); + return; + } + wfx_tx_policy_put(wvif, req->retry_policy_index); + skb_pull(skb, offset); + ieee80211_tx_status_irqsafe(wvif->wdev->hw, skb); +} + +static void wfx_tx_fill_rates(struct wfx_dev *wdev, + struct ieee80211_tx_info *tx_info, + const struct hif_cnf_tx *arg) +{ + struct ieee80211_tx_rate *rate; + int tx_count; + int i; + + tx_count = arg->ack_failures; + if (!arg->status || arg->ack_failures) + tx_count += 1; /* Also report success */ + for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { + rate = &tx_info->status.rates[i]; + if (rate->idx < 0) + break; + if (tx_count < rate->count && + arg->status == HIF_STATUS_TX_FAIL_RETRIES && + arg->ack_failures) + dev_dbg(wdev->dev, "all retries were not consumed: %d != %d\n", + rate->count, tx_count); + if (tx_count <= rate->count && tx_count && + arg->txed_rate != wfx_get_hw_rate(wdev, rate)) + dev_dbg(wdev->dev, "inconsistent tx_info rates: %d != %d\n", + arg->txed_rate, wfx_get_hw_rate(wdev, rate)); + if (tx_count > rate->count) { + tx_count -= rate->count; + } else if (!tx_count) { + rate->count = 0; + rate->idx = -1; + } else { + rate->count = tx_count; + tx_count = 0; + } + } + if (tx_count) + dev_dbg(wdev->dev, "%d more retries than expected\n", tx_count); +} + +void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg) +{ + const struct wfx_tx_priv *tx_priv; + struct ieee80211_tx_info *tx_info; + struct wfx_vif *wvif; + struct sk_buff *skb; + + skb = wfx_pending_get(wdev, arg->packet_id); + if (!skb) { + dev_warn(wdev->dev, "received unknown packet_id (%#.8x) from chip\n", + arg->packet_id); + return; + } + tx_info = IEEE80211_SKB_CB(skb); + tx_priv = wfx_skb_tx_priv(skb); + wvif = wdev_to_wvif(wdev, ((struct hif_msg *)skb->data)->interface); + WARN_ON(!wvif); + if (!wvif) + return; + + /* Note that wfx_pending_get_pkt_us_delay() get data from tx_info */ + _trace_tx_stats(arg, skb, wfx_pending_get_pkt_us_delay(wdev, skb)); + wfx_tx_fill_rates(wdev, tx_info, arg); + skb_trim(skb, skb->len - tx_priv->icv_size); + + /* From now, you can touch to tx_info->status, but do not touch to + * tx_priv anymore + */ + /* FIXME: use ieee80211_tx_info_clear_status() */ + memset(tx_info->rate_driver_data, 0, sizeof(tx_info->rate_driver_data)); + memset(tx_info->pad, 0, sizeof(tx_info->pad)); + + if (!arg->status) { + tx_info->status.tx_time = + le32_to_cpu(arg->media_delay) - + le32_to_cpu(arg->tx_queue_delay); + if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) + tx_info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED; + else + tx_info->flags |= IEEE80211_TX_STAT_ACK; + } else if (arg->status == HIF_STATUS_TX_FAIL_REQUEUE) { + WARN(!arg->requeue, "incoherent status and result_flags"); + if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { + /* DTIM period elapsed */ + wvif->after_dtim_tx_allowed = false; + schedule_work(&wvif->update_tim_work); + } + tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; + } + wfx_skb_dtor(wvif, skb); +} + +static void wfx_flush_vif(struct wfx_vif *wvif, u32 queues, + struct sk_buff_head *dropped) +{ + struct wfx_queue *queue; + int i; + + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + if (!(BIT(i) & queues)) + continue; + queue = &wvif->tx_queue[i]; + if (dropped) + wfx_tx_queue_drop(wvif, queue, dropped); + } + if (wvif->wdev->chip_frozen) + return; + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + if (!(BIT(i) & queues)) + continue; + queue = &wvif->tx_queue[i]; + if (wait_event_timeout(wvif->wdev->tx_dequeue, + wfx_tx_queue_empty(wvif, queue), + msecs_to_jiffies(1000)) <= 0) + dev_warn(wvif->wdev->dev, + "frames queued while flushing tx queues?"); + } +} + +void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + u32 queues, bool drop) +{ + struct wfx_dev *wdev = hw->priv; + struct sk_buff_head dropped; + struct wfx_vif *wvif; + struct hif_msg *hif; + struct sk_buff *skb; + + skb_queue_head_init(&dropped); + if (vif) { + wvif = (struct wfx_vif *)vif->drv_priv; + wfx_flush_vif(wvif, queues, drop ? &dropped : NULL); + } else { + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) + wfx_flush_vif(wvif, queues, drop ? &dropped : NULL); + } + wfx_tx_flush(wdev); + if (wdev->chip_frozen) + wfx_pending_drop(wdev, &dropped); + while ((skb = skb_dequeue(&dropped)) != NULL) { + hif = (struct hif_msg *)skb->data; + wvif = wdev_to_wvif(wdev, hif->interface); + ieee80211_tx_info_clear_status(IEEE80211_SKB_CB(skb)); + wfx_skb_dtor(wvif, skb); + } +} diff --git a/drivers/net/wireless/silabs/wfx/data_tx.h b/drivers/net/wireless/silabs/wfx/data_tx.h new file mode 100644 index 000000000000..6becf1f86767 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/data_tx.h @@ -0,0 +1,68 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Datapath implementation. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#ifndef WFX_DATA_TX_H +#define WFX_DATA_TX_H + +#include +#include + +#include "hif_api_cmd.h" +#include "hif_api_mib.h" + +struct wfx_tx_priv; +struct wfx_dev; +struct wfx_vif; + +struct tx_policy { + struct list_head link; + int usage_count; + u8 rates[12]; + bool uploaded; +}; + +struct tx_policy_cache { + struct tx_policy cache[HIF_TX_RETRY_POLICY_MAX]; + /* FIXME: use a trees and drop hash from tx_policy */ + struct list_head used; + struct list_head free; + spinlock_t lock; +}; + +struct wfx_tx_priv { + ktime_t xmit_timestamp; + unsigned char icv_size; +}; + +void wfx_tx_policy_init(struct wfx_vif *wvif); +void wfx_tx_policy_upload_work(struct work_struct *work); + +void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, + struct sk_buff *skb); +void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg); +void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + u32 queues, bool drop); + +static inline struct wfx_tx_priv *wfx_skb_tx_priv(struct sk_buff *skb) +{ + struct ieee80211_tx_info *tx_info; + + if (!skb) + return NULL; + tx_info = IEEE80211_SKB_CB(skb); + return (struct wfx_tx_priv *)tx_info->rate_driver_data; +} + +static inline struct hif_req_tx *wfx_skb_txreq(struct sk_buff *skb) +{ + struct hif_msg *hif = (struct hif_msg *)skb->data; + struct hif_req_tx *req = (struct hif_req_tx *)hif->body; + + return req; +} + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:56 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:56 +0100 Subject: [PATCH v5 19/24] wfx: add sta.c/sta.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-20-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/sta.c | 809 ++++++++++++++++++++++++++ drivers/net/wireless/silabs/wfx/sta.h | 73 +++ 2 files changed, 882 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/sta.c create mode 100644 drivers/net/wireless/silabs/wfx/sta.h diff --git a/drivers/net/wireless/silabs/wfx/sta.c b/drivers/net/wireless/silabs/wfx/sta.c new file mode 100644 index 000000000000..81bfca8faffd --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/sta.c @@ -0,0 +1,809 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Implementation of mac80211 API. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#include +#include + +#include "sta.h" +#include "wfx.h" +#include "fwio.h" +#include "bh.h" +#include "key.h" +#include "scan.h" +#include "debug.h" +#include "hif_tx.h" +#include "hif_tx_mib.h" + +#define HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES 2 + +u32 wfx_rate_mask_to_hw(struct wfx_dev *wdev, u32 rates) +{ + int i; + u32 ret = 0; + /* WF200 only support 2GHz */ + struct ieee80211_supported_band *sband = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]; + + for (i = 0; i < sband->n_bitrates; i++) { + if (rates & BIT(i)) { + if (i >= sband->n_bitrates) + dev_warn(wdev->dev, "unsupported basic rate\n"); + else + ret |= BIT(sband->bitrates[i].hw_value); + } + } + return ret; +} + +void wfx_cooling_timeout_work(struct work_struct *work) +{ + struct wfx_dev *wdev = container_of(to_delayed_work(work), + struct wfx_dev, + cooling_timeout_work); + + wdev->chip_frozen = true; + wfx_tx_unlock(wdev); +} + +void wfx_suspend_hot_dev(struct wfx_dev *wdev, enum sta_notify_cmd cmd) +{ + if (cmd == STA_NOTIFY_AWAKE) { + /* Device recover normal temperature */ + if (cancel_delayed_work(&wdev->cooling_timeout_work)) + wfx_tx_unlock(wdev); + } else { + /* Device is too hot */ + schedule_delayed_work(&wdev->cooling_timeout_work, 10 * HZ); + wfx_tx_lock(wdev); + } +} + +static void wfx_filter_beacon(struct wfx_vif *wvif, bool filter_beacon) +{ + static const struct hif_ie_table_entry filter_ies[] = { + { + .ie_id = WLAN_EID_VENDOR_SPECIFIC, + .has_changed = 1, + .no_longer = 1, + .has_appeared = 1, + .oui = { 0x50, 0x6F, 0x9A }, + }, { + .ie_id = WLAN_EID_HT_OPERATION, + .has_changed = 1, + .no_longer = 1, + .has_appeared = 1, + }, { + .ie_id = WLAN_EID_ERP_INFO, + .has_changed = 1, + .no_longer = 1, + .has_appeared = 1, + } + }; + + if (!filter_beacon) { + hif_beacon_filter_control(wvif, 0, 1); + } else { + hif_set_beacon_filter_table(wvif, 3, filter_ies); + hif_beacon_filter_control(wvif, HIF_BEACON_FILTER_ENABLE, 0); + } +} + +void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, + unsigned int *total_flags, u64 unused) +{ + struct wfx_vif *wvif = NULL; + struct wfx_dev *wdev = hw->priv; + bool filter_bssid, filter_prbreq, filter_beacon; + + /* Notes: + * - Probe responses (FIF_BCN_PRBRESP_PROMISC) are never filtered + * - PS-Poll (FIF_PSPOLL) are never filtered + * - RTS, CTS and Ack (FIF_CONTROL) are always filtered + * - Broken frames (FIF_FCSFAIL and FIF_PLCPFAIL) are always filtered + * - Firmware does (yet) allow to forward unicast traffic sent to + * other stations (aka. promiscuous mode) + */ + *total_flags &= FIF_BCN_PRBRESP_PROMISC | FIF_ALLMULTI | FIF_OTHER_BSS | + FIF_PROBE_REQ | FIF_PSPOLL; + + mutex_lock(&wdev->conf_mutex); + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { + mutex_lock(&wvif->scan_lock); + + /* Note: FIF_BCN_PRBRESP_PROMISC covers probe response and + * beacons from other BSS + */ + if (*total_flags & FIF_BCN_PRBRESP_PROMISC) + filter_beacon = false; + else + filter_beacon = true; + wfx_filter_beacon(wvif, filter_beacon); + + if (*total_flags & FIF_OTHER_BSS) + filter_bssid = false; + else + filter_bssid = true; + + /* In AP mode, chip can reply to probe request itself */ + if (*total_flags & FIF_PROBE_REQ && + wvif->vif->type == NL80211_IFTYPE_AP) { + dev_dbg(wdev->dev, "do not forward probe request in AP mode\n"); + *total_flags &= ~FIF_PROBE_REQ; + } + + if (*total_flags & FIF_PROBE_REQ) + filter_prbreq = false; + else + filter_prbreq = true; + hif_set_rx_filter(wvif, filter_bssid, filter_prbreq); + + mutex_unlock(&wvif->scan_lock); + } + mutex_unlock(&wdev->conf_mutex); +} + +static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps) +{ + struct ieee80211_channel *chan0 = NULL, *chan1 = NULL; + struct ieee80211_conf *conf = &wvif->wdev->hw->conf; + + WARN(!wvif->vif->bss_conf.assoc && enable_ps, + "enable_ps is reliable only if associated"); + if (wdev_to_wvif(wvif->wdev, 0)) + chan0 = wdev_to_wvif(wvif->wdev, 0)->vif->bss_conf.chandef.chan; + if (wdev_to_wvif(wvif->wdev, 1)) + chan1 = wdev_to_wvif(wvif->wdev, 1)->vif->bss_conf.chandef.chan; + if (chan0 && chan1 && chan0->hw_value != chan1->hw_value && + wvif->vif->type != NL80211_IFTYPE_AP) { + /* It is necessary to enable powersave if channels are different */ + if (enable_ps) + *enable_ps = true; + if (wvif->wdev->force_ps_timeout > -1) + return wvif->wdev->force_ps_timeout; + else if (wfx_api_older_than(wvif->wdev, 3, 2)) + return 0; + else + return 30; + } + if (enable_ps) + *enable_ps = wvif->vif->bss_conf.ps; + if (wvif->wdev->force_ps_timeout > -1) + return wvif->wdev->force_ps_timeout; + else if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps) + return conf->dynamic_ps_timeout; + else + return -1; +} + +int wfx_update_pm(struct wfx_vif *wvif) +{ + int ps_timeout; + bool ps; + + if (!wvif->vif->bss_conf.assoc) + return 0; + ps_timeout = wfx_get_ps_timeout(wvif, &ps); + if (!ps) + ps_timeout = 0; + WARN_ON(ps_timeout < 0); + if (wvif->uapsd_mask) + ps_timeout = 0; + + if (!wait_for_completion_timeout(&wvif->set_pm_mode_complete, + TU_TO_JIFFIES(512))) + dev_warn(wvif->wdev->dev, + "timeout while waiting of set_pm_mode_complete\n"); + return hif_set_pm(wvif, ps, ps_timeout); +} + +int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + u16 queue, const struct ieee80211_tx_queue_params *params) +{ + struct wfx_dev *wdev = hw->priv; + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + int old_uapsd = wvif->uapsd_mask; + + WARN_ON(queue >= hw->queues); + + mutex_lock(&wdev->conf_mutex); + assign_bit(queue, &wvif->uapsd_mask, params->uapsd); + hif_set_edca_queue_params(wvif, queue, params); + if (wvif->vif->type == NL80211_IFTYPE_STATION && + old_uapsd != wvif->uapsd_mask) { + hif_set_uapsd_info(wvif, wvif->uapsd_mask); + wfx_update_pm(wvif); + } + mutex_unlock(&wdev->conf_mutex); + return 0; +} + +int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value) +{ + struct wfx_dev *wdev = hw->priv; + struct wfx_vif *wvif = NULL; + + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) + hif_rts_threshold(wvif, value); + return 0; +} + +void wfx_event_report_rssi(struct wfx_vif *wvif, u8 raw_rcpi_rssi) +{ + /* RSSI: signed Q8.0, RCPI: unsigned Q7.1 + * RSSI = RCPI / 2 - 110 + */ + int rcpi_rssi; + int cqm_evt; + + rcpi_rssi = raw_rcpi_rssi / 2 - 110; + if (rcpi_rssi <= wvif->vif->bss_conf.cqm_rssi_thold) + cqm_evt = NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW; + else + cqm_evt = NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH; + ieee80211_cqm_rssi_notify(wvif->vif, cqm_evt, rcpi_rssi, GFP_KERNEL); +} + +static void wfx_beacon_loss_work(struct work_struct *work) +{ + struct wfx_vif *wvif = container_of(to_delayed_work(work), + struct wfx_vif, beacon_loss_work); + struct ieee80211_bss_conf *bss_conf = &wvif->vif->bss_conf; + + ieee80211_beacon_loss(wvif->vif); + schedule_delayed_work(to_delayed_work(work), + msecs_to_jiffies(bss_conf->beacon_int)); +} + +void wfx_set_default_unicast_key(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, int idx) +{ + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + + hif_wep_default_key_id(wvif, idx); +} + +void wfx_reset(struct wfx_vif *wvif) +{ + struct wfx_dev *wdev = wvif->wdev; + + wfx_tx_lock_flush(wdev); + hif_reset(wvif, false); + wfx_tx_policy_init(wvif); + if (wvif_count(wdev) <= 1) + hif_set_block_ack_policy(wvif, 0xFF, 0xFF); + wfx_tx_unlock(wdev); + wvif->join_in_progress = false; + cancel_delayed_work_sync(&wvif->beacon_loss_work); + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) + wfx_update_pm(wvif); +} + +int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_sta *sta) +{ + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; + + sta_priv->vif_id = wvif->id; + + if (vif->type == NL80211_IFTYPE_STATION) + hif_set_mfp(wvif, sta->mfp, sta->mfp); + + /* In station mode, the firmware interprets new link-id as a TDLS peer */ + if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) + return 0; + sta_priv->link_id = ffz(wvif->link_id_map); + wvif->link_id_map |= BIT(sta_priv->link_id); + WARN_ON(!sta_priv->link_id); + WARN_ON(sta_priv->link_id >= HIF_LINK_ID_MAX); + hif_map_link(wvif, false, sta->addr, sta_priv->link_id, sta->mfp); + + return 0; +} + +int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_sta *sta) +{ + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; + + /* See note in wfx_sta_add() */ + if (!sta_priv->link_id) + return 0; + /* FIXME add a mutex? */ + hif_map_link(wvif, true, sta->addr, sta_priv->link_id, false); + wvif->link_id_map &= ~BIT(sta_priv->link_id); + return 0; +} + +static int wfx_upload_ap_templates(struct wfx_vif *wvif) +{ + struct sk_buff *skb; + + skb = ieee80211_beacon_get(wvif->wdev->hw, wvif->vif); + if (!skb) + return -ENOMEM; + hif_set_template_frame(wvif, skb, HIF_TMPLT_BCN, + API_RATE_INDEX_B_1MBPS); + dev_kfree_skb(skb); + + skb = ieee80211_proberesp_get(wvif->wdev->hw, wvif->vif); + if (!skb) + return -ENOMEM; + hif_set_template_frame(wvif, skb, HIF_TMPLT_PRBRES, + API_RATE_INDEX_B_1MBPS); + dev_kfree_skb(skb); + return 0; +} + +static void wfx_set_mfp_ap(struct wfx_vif *wvif) +{ + struct sk_buff *skb = ieee80211_beacon_get(wvif->wdev->hw, wvif->vif); + const int ieoffset = offsetof(struct ieee80211_mgmt, u.beacon.variable); + const u16 *ptr = (u16 *)cfg80211_find_ie(WLAN_EID_RSN, + skb->data + ieoffset, + skb->len - ieoffset); + const int pairwise_cipher_suite_count_offset = 8 / sizeof(u16); + const int pairwise_cipher_suite_size = 4 / sizeof(u16); + const int akm_suite_size = 4 / sizeof(u16); + + if (ptr) { + ptr += pairwise_cipher_suite_count_offset; + if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) + return; + ptr += 1 + pairwise_cipher_suite_size * *ptr; + if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) + return; + ptr += 1 + akm_suite_size * *ptr; + if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) + return; + hif_set_mfp(wvif, *ptr & BIT(7), *ptr & BIT(6)); + } +} + +int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) +{ + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + struct wfx_dev *wdev = wvif->wdev; + int ret; + + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) + wfx_update_pm(wvif); + wvif = (struct wfx_vif *)vif->drv_priv; + wfx_upload_ap_templates(wvif); + ret = hif_start(wvif, &vif->bss_conf, wvif->channel); + if (ret > 0) + return -EIO; + wfx_set_mfp_ap(wvif); + return ret; +} + +void wfx_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) +{ + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + + wfx_reset(wvif); +} + +static void wfx_join(struct wfx_vif *wvif) +{ + int ret; + struct ieee80211_bss_conf *conf = &wvif->vif->bss_conf; + struct cfg80211_bss *bss = NULL; + u8 ssid[IEEE80211_MAX_SSID_LEN]; + const u8 *ssidie = NULL; + int ssidlen = 0; + + wfx_tx_lock_flush(wvif->wdev); + + bss = cfg80211_get_bss(wvif->wdev->hw->wiphy, wvif->channel, + conf->bssid, NULL, 0, + IEEE80211_BSS_TYPE_ANY, IEEE80211_PRIVACY_ANY); + if (!bss && !conf->ibss_joined) { + wfx_tx_unlock(wvif->wdev); + return; + } + + rcu_read_lock(); /* protect ssidie */ + if (bss) + ssidie = ieee80211_bss_get_ie(bss, WLAN_EID_SSID); + if (ssidie) { + ssidlen = ssidie[1]; + if (ssidlen > IEEE80211_MAX_SSID_LEN) + ssidlen = IEEE80211_MAX_SSID_LEN; + memcpy(ssid, &ssidie[2], ssidlen); + } + rcu_read_unlock(); + + cfg80211_put_bss(wvif->wdev->hw->wiphy, bss); + + wvif->join_in_progress = true; + ret = hif_join(wvif, conf, wvif->channel, ssid, ssidlen); + if (ret) { + ieee80211_connection_loss(wvif->vif); + wfx_reset(wvif); + } else { + /* Due to beacon filtering it is possible that the + * AP's beacon is not known for the mac80211 stack. + * Disable filtering temporary to make sure the stack + * receives at least one + */ + wfx_filter_beacon(wvif, false); + } + wfx_tx_unlock(wvif->wdev); +} + +static void wfx_join_finalize(struct wfx_vif *wvif, + struct ieee80211_bss_conf *info) +{ + struct ieee80211_sta *sta = NULL; + int ampdu_density = 0; + bool greenfield = false; + + rcu_read_lock(); /* protect sta */ + if (info->bssid && !info->ibss_joined) + sta = ieee80211_find_sta(wvif->vif, info->bssid); + if (sta && sta->ht_cap.ht_supported) + ampdu_density = sta->ht_cap.ampdu_density; + if (sta && sta->ht_cap.ht_supported && + !(info->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT)) + greenfield = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD); + rcu_read_unlock(); + + wvif->join_in_progress = false; + hif_set_association_mode(wvif, ampdu_density, greenfield, + info->use_short_preamble); + hif_keep_alive_period(wvif, 0); + /* beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use + * the same value. + */ + hif_set_bss_params(wvif, info->aid, 7); + hif_set_beacon_wakeup_period(wvif, 1, 1); + wfx_update_pm(wvif); +} + +int wfx_join_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vif) +{ + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + + wfx_upload_ap_templates(wvif); + wfx_join(wvif); + return 0; +} + +void wfx_leave_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vif) +{ + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + + wfx_reset(wvif); +} + +static void wfx_enable_beacon(struct wfx_vif *wvif, bool enable) +{ + /* Driver has Content After DTIM Beacon in queue. Driver is waiting for + * a signal from the firmware. Since we are going to stop to send + * beacons, this signal will never happens. See also + * wfx_suspend_resume_mc() + */ + if (!enable && wfx_tx_queues_has_cab(wvif)) { + wvif->after_dtim_tx_allowed = true; + wfx_bh_request_tx(wvif->wdev); + } + hif_beacon_transmit(wvif, enable); +} + +void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_bss_conf *info, u32 changed) +{ + struct wfx_dev *wdev = hw->priv; + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + int i; + + mutex_lock(&wdev->conf_mutex); + + if (changed & BSS_CHANGED_BASIC_RATES || + changed & BSS_CHANGED_BEACON_INT || + changed & BSS_CHANGED_BSSID) { + if (vif->type == NL80211_IFTYPE_STATION) + wfx_join(wvif); + } + + if (changed & BSS_CHANGED_ASSOC) { + if (info->assoc || info->ibss_joined) + wfx_join_finalize(wvif, info); + else if (!info->assoc && vif->type == NL80211_IFTYPE_STATION) + wfx_reset(wvif); + else + dev_warn(wdev->dev, "%s: misunderstood change: ASSOC\n", + __func__); + } + + if (changed & BSS_CHANGED_BEACON_INFO) { + if (vif->type != NL80211_IFTYPE_STATION) + dev_warn(wdev->dev, "%s: misunderstood change: BEACON_INFO\n", + __func__); + hif_set_beacon_wakeup_period(wvif, info->dtim_period, + info->dtim_period); + /* We temporary forwarded beacon for join process. It is now no + * more necessary. + */ + wfx_filter_beacon(wvif, true); + } + + if (changed & BSS_CHANGED_ARP_FILTER) { + for (i = 0; i < HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES; i++) { + __be32 *arp_addr = &info->arp_addr_list[i]; + + if (info->arp_addr_cnt > HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES) + arp_addr = NULL; + if (i >= info->arp_addr_cnt) + arp_addr = NULL; + hif_set_arp_ipv4_filter(wvif, i, arp_addr); + } + } + + if (changed & BSS_CHANGED_AP_PROBE_RESP || + changed & BSS_CHANGED_BEACON) + wfx_upload_ap_templates(wvif); + + if (changed & BSS_CHANGED_BEACON_ENABLED) + wfx_enable_beacon(wvif, info->enable_beacon); + + if (changed & BSS_CHANGED_KEEP_ALIVE) + hif_keep_alive_period(wvif, info->max_idle_period * + USEC_PER_TU / USEC_PER_MSEC); + + if (changed & BSS_CHANGED_ERP_CTS_PROT) + hif_erp_use_protection(wvif, info->use_cts_prot); + + if (changed & BSS_CHANGED_ERP_SLOT) + hif_slot_time(wvif, info->use_short_slot ? 9 : 20); + + if (changed & BSS_CHANGED_CQM) + hif_set_rcpi_rssi_threshold(wvif, info->cqm_rssi_thold, + info->cqm_rssi_hyst); + + if (changed & BSS_CHANGED_TXPOWER) + hif_set_output_power(wvif, info->txpower); + + if (changed & BSS_CHANGED_PS) + wfx_update_pm(wvif); + + mutex_unlock(&wdev->conf_mutex); +} + +static int wfx_update_tim(struct wfx_vif *wvif) +{ + struct sk_buff *skb; + u16 tim_offset, tim_length; + u8 *tim_ptr; + + skb = ieee80211_beacon_get_tim(wvif->wdev->hw, wvif->vif, + &tim_offset, &tim_length); + if (!skb) + return -ENOENT; + tim_ptr = skb->data + tim_offset; + + if (tim_offset && tim_length >= 6) { + /* Ignore DTIM count from mac80211: + * firmware handles DTIM internally. + */ + tim_ptr[2] = 0; + + /* Set/reset aid0 bit */ + if (wfx_tx_queues_has_cab(wvif)) + tim_ptr[4] |= 1; + else + tim_ptr[4] &= ~1; + } + + hif_update_ie_beacon(wvif, tim_ptr, tim_length); + dev_kfree_skb(skb); + + return 0; +} + +static void wfx_update_tim_work(struct work_struct *work) +{ + struct wfx_vif *wvif = container_of(work, struct wfx_vif, update_tim_work); + + wfx_update_tim(wvif); +} + +int wfx_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set) +{ + struct wfx_dev *wdev = hw->priv; + struct wfx_sta_priv *sta_dev = (struct wfx_sta_priv *)&sta->drv_priv; + struct wfx_vif *wvif = wdev_to_wvif(wdev, sta_dev->vif_id); + + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } + schedule_work(&wvif->update_tim_work); + return 0; +} + +void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd notify_cmd) +{ + if (notify_cmd != STA_NOTIFY_AWAKE) + return; + WARN(!wfx_tx_queues_has_cab(wvif), "incorrect sequence"); + WARN(wvif->after_dtim_tx_allowed, "incorrect sequence"); + wvif->after_dtim_tx_allowed = true; + wfx_bh_request_tx(wvif->wdev); +} + +int wfx_ampdu_action(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_ampdu_params *params) +{ + /* Aggregation is implemented fully in firmware */ + switch (params->action) { + case IEEE80211_AMPDU_RX_START: + case IEEE80211_AMPDU_RX_STOP: + /* Just acknowledge it to enable frame re-ordering */ + return 0; + default: + /* Leave the firmware doing its business for tx aggregation */ + return -ENOTSUPP; + } +} + +int wfx_add_chanctx(struct ieee80211_hw *hw, + struct ieee80211_chanctx_conf *conf) +{ + return 0; +} + +void wfx_remove_chanctx(struct ieee80211_hw *hw, + struct ieee80211_chanctx_conf *conf) +{ +} + +void wfx_change_chanctx(struct ieee80211_hw *hw, + struct ieee80211_chanctx_conf *conf, + u32 changed) +{ +} + +int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_chanctx_conf *conf) +{ + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + struct ieee80211_channel *ch = conf->def.chan; + + WARN(wvif->channel, "channel overwrite"); + wvif->channel = ch; + + return 0; +} + +void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_chanctx_conf *conf) +{ + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + struct ieee80211_channel *ch = conf->def.chan; + + WARN(wvif->channel != ch, "channel mismatch"); + wvif->channel = NULL; +} + +int wfx_config(struct ieee80211_hw *hw, u32 changed) +{ + return 0; +} + +int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) +{ + int i, ret = 0; + struct wfx_dev *wdev = hw->priv; + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + + vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | + IEEE80211_VIF_SUPPORTS_UAPSD | + IEEE80211_VIF_SUPPORTS_CQM_RSSI; + + mutex_lock(&wdev->conf_mutex); + + switch (vif->type) { + case NL80211_IFTYPE_STATION: + case NL80211_IFTYPE_ADHOC: + case NL80211_IFTYPE_AP: + break; + default: + mutex_unlock(&wdev->conf_mutex); + return -EOPNOTSUPP; + } + + /* FIXME: prefer use of container_of() to get vif */ + wvif->vif = vif; + wvif->wdev = wdev; + + wvif->link_id_map = 1; /* link-id 0 is reserved for multicast */ + INIT_WORK(&wvif->update_tim_work, wfx_update_tim_work); + INIT_DELAYED_WORK(&wvif->beacon_loss_work, wfx_beacon_loss_work); + + init_completion(&wvif->set_pm_mode_complete); + complete(&wvif->set_pm_mode_complete); + INIT_WORK(&wvif->tx_policy_upload_work, wfx_tx_policy_upload_work); + + mutex_init(&wvif->scan_lock); + init_completion(&wvif->scan_complete); + INIT_WORK(&wvif->scan_work, wfx_hw_scan_work); + + wfx_tx_queues_init(wvif); + wfx_tx_policy_init(wvif); + + for (i = 0; i < ARRAY_SIZE(wdev->vif); i++) { + if (!wdev->vif[i]) { + wdev->vif[i] = vif; + wvif->id = i; + break; + } + } + WARN(i == ARRAY_SIZE(wdev->vif), "try to instantiate more vif than supported"); + + hif_set_macaddr(wvif, vif->addr); + + mutex_unlock(&wdev->conf_mutex); + + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { + /* Combo mode does not support Block Acks. We can re-enable them */ + if (wvif_count(wdev) == 1) + hif_set_block_ack_policy(wvif, 0xFF, 0xFF); + else + hif_set_block_ack_policy(wvif, 0x00, 0x00); + } + return ret; +} + +void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) +{ + struct wfx_dev *wdev = hw->priv; + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + + wait_for_completion_timeout(&wvif->set_pm_mode_complete, msecs_to_jiffies(300)); + wfx_tx_queues_check_empty(wvif); + + mutex_lock(&wdev->conf_mutex); + WARN(wvif->link_id_map != 1, "corrupted state"); + + hif_reset(wvif, false); + hif_set_macaddr(wvif, NULL); + wfx_tx_policy_init(wvif); + + cancel_delayed_work_sync(&wvif->beacon_loss_work); + wdev->vif[wvif->id] = NULL; + wvif->vif = NULL; + + mutex_unlock(&wdev->conf_mutex); + + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { + /* Combo mode does not support Block Acks. We can re-enable them */ + if (wvif_count(wdev) == 1) + hif_set_block_ack_policy(wvif, 0xFF, 0xFF); + else + hif_set_block_ack_policy(wvif, 0x00, 0x00); + } +} + +int wfx_start(struct ieee80211_hw *hw) +{ + return 0; +} + +void wfx_stop(struct ieee80211_hw *hw) +{ + struct wfx_dev *wdev = hw->priv; + + WARN_ON(!skb_queue_empty_lockless(&wdev->tx_pending)); +} diff --git a/drivers/net/wireless/silabs/wfx/sta.h b/drivers/net/wireless/silabs/wfx/sta.h new file mode 100644 index 000000000000..969f840d8c91 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/sta.h @@ -0,0 +1,73 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Implementation of mac80211 API. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#ifndef WFX_STA_H +#define WFX_STA_H + +#include + +struct wfx_dev; +struct wfx_vif; + +struct wfx_sta_priv { + int link_id; + int vif_id; +}; + +/* mac80211 interface */ +int wfx_start(struct ieee80211_hw *hw); +void wfx_stop(struct ieee80211_hw *hw); +int wfx_config(struct ieee80211_hw *hw, u32 changed); +int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value); +void wfx_set_default_unicast_key(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, int idx); +void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, + unsigned int *total_flags, u64 unused); + +int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif); +void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif); +int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif); +void wfx_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif); +int wfx_join_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vif); +void wfx_leave_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vif); +int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + u16 queue, const struct ieee80211_tx_queue_params *params); +void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_bss_conf *info, u32 changed); +int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_sta *sta); +int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_sta *sta); +void wfx_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + enum sta_notify_cmd cmd, struct ieee80211_sta *sta); +int wfx_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set); +int wfx_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_ampdu_params *params); +int wfx_add_chanctx(struct ieee80211_hw *hw, + struct ieee80211_chanctx_conf *conf); +void wfx_remove_chanctx(struct ieee80211_hw *hw, + struct ieee80211_chanctx_conf *conf); +void wfx_change_chanctx(struct ieee80211_hw *hw, + struct ieee80211_chanctx_conf *conf, u32 changed); +int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_chanctx_conf *conf); +void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_chanctx_conf *conf); + +/* WSM Callbacks */ +void wfx_cooling_timeout_work(struct work_struct *work); +void wfx_suspend_hot_dev(struct wfx_dev *wdev, enum sta_notify_cmd cmd); +void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd cmd); +void wfx_event_report_rssi(struct wfx_vif *wvif, u8 raw_rcpi_rssi); +int wfx_update_pm(struct wfx_vif *wvif); + +/* Other Helpers */ +void wfx_reset(struct wfx_vif *wvif); +u32 wfx_rate_mask_to_hw(struct wfx_dev *wdev, u32 rates); + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:57 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:57 +0100 Subject: [PATCH v5 20/24] wfx: add scan.c/scan.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-21-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/scan.c | 131 +++++++++++++++++++++++++ drivers/net/wireless/silabs/wfx/scan.h | 22 +++++ 2 files changed, 153 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/scan.c create mode 100644 drivers/net/wireless/silabs/wfx/scan.h diff --git a/drivers/net/wireless/silabs/wfx/scan.c b/drivers/net/wireless/silabs/wfx/scan.c new file mode 100644 index 000000000000..3d5f13c89bac --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/scan.c @@ -0,0 +1,131 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Scan related functions. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#include + +#include "scan.h" +#include "wfx.h" +#include "sta.h" +#include "hif_tx_mib.h" + +static void __ieee80211_scan_completed_compat(struct ieee80211_hw *hw, + bool aborted) +{ + struct cfg80211_scan_info info = { + .aborted = aborted, + }; + + ieee80211_scan_completed(hw, &info); +} + +static int update_probe_tmpl(struct wfx_vif *wvif, + struct cfg80211_scan_request *req) +{ + struct sk_buff *skb; + + skb = ieee80211_probereq_get(wvif->wdev->hw, wvif->vif->addr, + NULL, 0, req->ie_len); + if (!skb) + return -ENOMEM; + + skb_put_data(skb, req->ie, req->ie_len); + hif_set_template_frame(wvif, skb, HIF_TMPLT_PRBREQ, 0); + dev_kfree_skb(skb); + return 0; +} + +static int send_scan_req(struct wfx_vif *wvif, + struct cfg80211_scan_request *req, int start_idx) +{ + int i, ret, timeout; + struct ieee80211_channel *ch_start, *ch_cur; + + for (i = start_idx; i < req->n_channels; i++) { + ch_start = req->channels[start_idx]; + ch_cur = req->channels[i]; + WARN(ch_cur->band != NL80211_BAND_2GHZ, "band not supported"); + if (ch_cur->max_power != ch_start->max_power) + break; + if ((ch_cur->flags ^ ch_start->flags) & IEEE80211_CHAN_NO_IR) + break; + } + wfx_tx_lock_flush(wvif->wdev); + wvif->scan_abort = false; + reinit_completion(&wvif->scan_complete); + ret = hif_scan(wvif, req, start_idx, i - start_idx, &timeout); + if (ret) { + wfx_tx_unlock(wvif->wdev); + return -EIO; + } + ret = wait_for_completion_timeout(&wvif->scan_complete, timeout); + if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower) + hif_set_output_power(wvif, wvif->vif->bss_conf.txpower); + wfx_tx_unlock(wvif->wdev); + if (!ret) { + dev_notice(wvif->wdev->dev, "scan timeout\n"); + hif_stop_scan(wvif); + return -ETIMEDOUT; + } + if (wvif->scan_abort) { + dev_notice(wvif->wdev->dev, "scan abort\n"); + return -ECONNABORTED; + } + return i - start_idx; +} + +/* It is not really necessary to run scan request asynchronously. However, + * there is a bug in "iw scan" when ieee80211_scan_completed() is called before + * wfx_hw_scan() return + */ +void wfx_hw_scan_work(struct work_struct *work) +{ + struct wfx_vif *wvif = container_of(work, struct wfx_vif, scan_work); + struct ieee80211_scan_request *hw_req = wvif->scan_req; + int chan_cur, ret; + + mutex_lock(&wvif->wdev->conf_mutex); + mutex_lock(&wvif->scan_lock); + if (wvif->join_in_progress) { + dev_info(wvif->wdev->dev, "%s: abort in-progress REQ_JOIN", + __func__); + wfx_reset(wvif); + } + update_probe_tmpl(wvif, &hw_req->req); + chan_cur = 0; + do { + ret = send_scan_req(wvif, &hw_req->req, chan_cur); + if (ret > 0) + chan_cur += ret; + } while (ret > 0 && chan_cur < hw_req->req.n_channels); + mutex_unlock(&wvif->scan_lock); + mutex_unlock(&wvif->wdev->conf_mutex); + __ieee80211_scan_completed_compat(wvif->wdev->hw, ret < 0); +} + +int wfx_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_scan_request *hw_req) +{ + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + + WARN_ON(hw_req->req.n_channels > HIF_API_MAX_NB_CHANNELS); + wvif->scan_req = hw_req; + schedule_work(&wvif->scan_work); + return 0; +} + +void wfx_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif) +{ + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + + wvif->scan_abort = true; + hif_stop_scan(wvif); +} + +void wfx_scan_complete(struct wfx_vif *wvif) +{ + complete(&wvif->scan_complete); +} diff --git a/drivers/net/wireless/silabs/wfx/scan.h b/drivers/net/wireless/silabs/wfx/scan.h new file mode 100644 index 000000000000..6d70717f2bf7 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/scan.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Scan related functions. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#ifndef WFX_SCAN_H +#define WFX_SCAN_H + +#include + +struct wfx_dev; +struct wfx_vif; + +void wfx_hw_scan_work(struct work_struct *work); +int wfx_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_scan_request *req); +void wfx_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif); +void wfx_scan_complete(struct wfx_vif *wvif); + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:58 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:58 +0100 Subject: [PATCH v5 21/24] wfx: add debug.c/debug.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-22-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/debug.c | 361 ++++++++++++++++++++++++ drivers/net/wireless/silabs/wfx/debug.h | 19 ++ 2 files changed, 380 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/debug.c create mode 100644 drivers/net/wireless/silabs/wfx/debug.h diff --git a/drivers/net/wireless/silabs/wfx/debug.c b/drivers/net/wireless/silabs/wfx/debug.c new file mode 100644 index 000000000000..3f7101213df3 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/debug.c @@ -0,0 +1,361 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Debugfs interface. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#include +#include +#include + +#include "debug.h" +#include "wfx.h" +#include "sta.h" +#include "main.h" +#include "hif_tx.h" +#include "hif_tx_mib.h" + +#define CREATE_TRACE_POINTS +#include "traces.h" + +static const struct trace_print_flags hif_msg_print_map[] = { + hif_msg_list, +}; + +static const struct trace_print_flags hif_mib_print_map[] = { + hif_mib_list, +}; + +static const struct trace_print_flags wfx_reg_print_map[] = { + wfx_reg_list, +}; + +static const char *get_symbol(unsigned long val, + const struct trace_print_flags *symbol_array) +{ + int i; + + for (i = 0; symbol_array[i].mask != -1; i++) { + if (val == symbol_array[i].mask) + return symbol_array[i].name; + } + + return "unknown"; +} + +const char *get_hif_name(unsigned long id) +{ + return get_symbol(id, hif_msg_print_map); +} + +const char *get_mib_name(unsigned long id) +{ + return get_symbol(id, hif_mib_print_map); +} + +const char *get_reg_name(unsigned long id) +{ + return get_symbol(id, wfx_reg_print_map); +} + +static int wfx_counters_show(struct seq_file *seq, void *v) +{ + int ret, i; + struct wfx_dev *wdev = seq->private; + struct hif_mib_extended_count_table counters[3]; + + for (i = 0; i < ARRAY_SIZE(counters); i++) { + ret = hif_get_counters_table(wdev, i, counters + i); + if (ret < 0) + return ret; + if (ret > 0) + return -EIO; + } + + seq_printf(seq, "%-24s %12s %12s %12s\n", + "", "global", "iface 0", "iface 1"); + +#define PUT_COUNTER(name) \ + seq_printf(seq, "%-24s %12d %12d %12d\n", #name, \ + le32_to_cpu(counters[2].count_##name), \ + le32_to_cpu(counters[0].count_##name), \ + le32_to_cpu(counters[1].count_##name)) + + PUT_COUNTER(tx_packets); + PUT_COUNTER(tx_multicast_frames); + PUT_COUNTER(tx_frames_success); + PUT_COUNTER(tx_frame_failures); + PUT_COUNTER(tx_frames_retried); + PUT_COUNTER(tx_frames_multi_retried); + + PUT_COUNTER(rts_success); + PUT_COUNTER(rts_failures); + PUT_COUNTER(ack_failures); + + PUT_COUNTER(rx_packets); + PUT_COUNTER(rx_frames_success); + PUT_COUNTER(rx_packet_errors); + PUT_COUNTER(plcp_errors); + PUT_COUNTER(fcs_errors); + PUT_COUNTER(rx_decryption_failures); + PUT_COUNTER(rx_mic_failures); + PUT_COUNTER(rx_no_key_failures); + PUT_COUNTER(rx_frame_duplicates); + PUT_COUNTER(rx_multicast_frames); + PUT_COUNTER(rx_cmacicv_errors); + PUT_COUNTER(rx_cmac_replays); + PUT_COUNTER(rx_mgmt_ccmp_replays); + + PUT_COUNTER(rx_beacon); + PUT_COUNTER(miss_beacon); + +#undef PUT_COUNTER + + for (i = 0; i < ARRAY_SIZE(counters[0].reserved); i++) + seq_printf(seq, "reserved[%02d]%12s %12d %12d %12d\n", i, "", + le32_to_cpu(counters[2].reserved[i]), + le32_to_cpu(counters[0].reserved[i]), + le32_to_cpu(counters[1].reserved[i])); + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(wfx_counters); + +static const char * const channel_names[] = { + [0] = "1M", + [1] = "2M", + [2] = "5.5M", + [3] = "11M", + /* Entries 4 and 5 does not exist */ + [6] = "6M", + [7] = "9M", + [8] = "12M", + [9] = "18M", + [10] = "24M", + [11] = "36M", + [12] = "48M", + [13] = "54M", + [14] = "MCS0", + [15] = "MCS1", + [16] = "MCS2", + [17] = "MCS3", + [18] = "MCS4", + [19] = "MCS5", + [20] = "MCS6", + [21] = "MCS7", +}; + +static int wfx_rx_stats_show(struct seq_file *seq, void *v) +{ + struct wfx_dev *wdev = seq->private; + struct hif_rx_stats *st = &wdev->rx_stats; + int i; + + mutex_lock(&wdev->rx_stats_lock); + seq_printf(seq, "Timestamp: %dus\n", st->date); + seq_printf(seq, "Low power clock: frequency %uHz, external %s\n", + le32_to_cpu(st->pwr_clk_freq), + st->is_ext_pwr_clk ? "yes" : "no"); + seq_printf(seq, + "Num. of frames: %d, PER (x10e4): %d, Throughput: %dKbps/s\n", + st->nb_rx_frame, st->per_total, st->throughput); + seq_puts(seq, " Num. of PER RSSI SNR CFO\n"); + seq_puts(seq, " frames (x10e4) (dBm) (dB) (kHz)\n"); + for (i = 0; i < ARRAY_SIZE(channel_names); i++) { + if (channel_names[i]) + seq_printf(seq, "%5s %8d %8d %8d %8d %8d\n", + channel_names[i], + le32_to_cpu(st->nb_rx_by_rate[i]), + le16_to_cpu(st->per[i]), + (s16)le16_to_cpu(st->rssi[i]) / 100, + (s16)le16_to_cpu(st->snr[i]) / 100, + (s16)le16_to_cpu(st->cfo[i])); + } + mutex_unlock(&wdev->rx_stats_lock); + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(wfx_rx_stats); + +static int wfx_tx_power_loop_show(struct seq_file *seq, void *v) +{ + struct wfx_dev *wdev = seq->private; + struct hif_tx_power_loop_info *st = &wdev->tx_power_loop_info; + int tmp; + + mutex_lock(&wdev->tx_power_loop_info_lock); + tmp = le16_to_cpu(st->tx_gain_dig); + seq_printf(seq, "Tx gain digital: %d\n", tmp); + tmp = le16_to_cpu(st->tx_gain_pa); + seq_printf(seq, "Tx gain PA: %d\n", tmp); + tmp = (s16)le16_to_cpu(st->target_pout); + seq_printf(seq, "Target Pout: %d.%02d dBm\n", tmp / 4, (tmp % 4) * 25); + tmp = (s16)le16_to_cpu(st->p_estimation); + seq_printf(seq, "FEM Pout: %d.%02d dBm\n", tmp / 4, (tmp % 4) * 25); + tmp = le16_to_cpu(st->vpdet); + seq_printf(seq, "Vpdet: %d mV\n", tmp); + seq_printf(seq, "Measure index: %d\n", st->measurement_index); + mutex_unlock(&wdev->tx_power_loop_info_lock); + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(wfx_tx_power_loop); + +static ssize_t wfx_send_pds_write(struct file *file, + const char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct wfx_dev *wdev = file->private_data; + char *buf; + int ret; + + if (*ppos != 0) { + dev_dbg(wdev->dev, "PDS data must be written in one transaction"); + return -EBUSY; + } + buf = memdup_user(user_buf, count); + if (IS_ERR(buf)) + return PTR_ERR(buf); + *ppos = *ppos + count; + ret = wfx_send_pds(wdev, buf, count); + kfree(buf); + if (ret < 0) + return ret; + return count; +} + +static const struct file_operations wfx_send_pds_fops = { + .open = simple_open, + .write = wfx_send_pds_write, +}; + +struct dbgfs_hif_msg { + struct wfx_dev *wdev; + struct completion complete; + u8 reply[1024]; + int ret; +}; + +static ssize_t wfx_send_hif_msg_write(struct file *file, + const char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct dbgfs_hif_msg *context = file->private_data; + struct wfx_dev *wdev = context->wdev; + struct hif_msg *request; + + if (completion_done(&context->complete)) { + dev_dbg(wdev->dev, "read previous result before start a new one\n"); + return -EBUSY; + } + if (count < sizeof(struct hif_msg)) + return -EINVAL; + + /* wfx_cmd_send() checks that reply buffer is wide enough, but does not + * return precise length read. User have to know how many bytes should + * be read. Filling reply buffer with a memory pattern may help user. + */ + memset(context->reply, 0xFF, sizeof(context->reply)); + request = memdup_user(user_buf, count); + if (IS_ERR(request)) + return PTR_ERR(request); + if (le16_to_cpu(request->len) != count) { + kfree(request); + return -EINVAL; + } + context->ret = wfx_cmd_send(wdev, request, context->reply, + sizeof(context->reply), false); + + kfree(request); + complete(&context->complete); + return count; +} + +static ssize_t wfx_send_hif_msg_read(struct file *file, char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct dbgfs_hif_msg *context = file->private_data; + int ret; + + if (count > sizeof(context->reply)) + return -EINVAL; + ret = wait_for_completion_interruptible(&context->complete); + if (ret) + return ret; + if (context->ret < 0) + return context->ret; + /* Be careful, write() is waiting for a full message while read() + * only returns a payload + */ + if (copy_to_user(user_buf, context->reply, count)) + return -EFAULT; + + return count; +} + +static int wfx_send_hif_msg_open(struct inode *inode, struct file *file) +{ + struct dbgfs_hif_msg *context = kzalloc(sizeof(*context), GFP_KERNEL); + + if (!context) + return -ENOMEM; + context->wdev = inode->i_private; + init_completion(&context->complete); + file->private_data = context; + return 0; +} + +static int wfx_send_hif_msg_release(struct inode *inode, struct file *file) +{ + struct dbgfs_hif_msg *context = file->private_data; + + kfree(context); + return 0; +} + +static const struct file_operations wfx_send_hif_msg_fops = { + .open = wfx_send_hif_msg_open, + .release = wfx_send_hif_msg_release, + .write = wfx_send_hif_msg_write, + .read = wfx_send_hif_msg_read, +}; + +static int wfx_ps_timeout_set(void *data, u64 val) +{ + struct wfx_dev *wdev = (struct wfx_dev *)data; + struct wfx_vif *wvif; + + wdev->force_ps_timeout = val; + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) + wfx_update_pm(wvif); + return 0; +} + +static int wfx_ps_timeout_get(void *data, u64 *val) +{ + struct wfx_dev *wdev = (struct wfx_dev *)data; + + *val = wdev->force_ps_timeout; + return 0; +} + +DEFINE_DEBUGFS_ATTRIBUTE(wfx_ps_timeout_fops, wfx_ps_timeout_get, wfx_ps_timeout_set, "%lld\n"); + +int wfx_debug_init(struct wfx_dev *wdev) +{ + struct dentry *d; + + d = debugfs_create_dir("wfx", wdev->hw->wiphy->debugfsdir); + debugfs_create_file("counters", 0444, d, wdev, &wfx_counters_fops); + debugfs_create_file("rx_stats", 0444, d, wdev, &wfx_rx_stats_fops); + debugfs_create_file("tx_power_loop", 0444, d, wdev, + &wfx_tx_power_loop_fops); + debugfs_create_file("send_pds", 0200, d, wdev, &wfx_send_pds_fops); + debugfs_create_file("send_hif_msg", 0600, d, wdev, + &wfx_send_hif_msg_fops); + debugfs_create_file("ps_timeout", 0600, d, wdev, &wfx_ps_timeout_fops); + + return 0; +} diff --git a/drivers/net/wireless/silabs/wfx/debug.h b/drivers/net/wireless/silabs/wfx/debug.h new file mode 100644 index 000000000000..4b9c49a9fffb --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/debug.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Debugfs interface. + * + * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2011, ST-Ericsson + */ +#ifndef WFX_DEBUG_H +#define WFX_DEBUG_H + +struct wfx_dev; + +int wfx_debug_init(struct wfx_dev *wdev); + +const char *get_hif_name(unsigned long id); +const char *get_mib_name(unsigned long id); +const char *get_reg_name(unsigned long id); + +#endif -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:24:59 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:24:59 +0100 Subject: [PATCH v5 22/24] wfx: add traces.h In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-23-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- drivers/net/wireless/silabs/wfx/traces.h | 501 +++++++++++++++++++++++ 1 file changed, 501 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/traces.h diff --git a/drivers/net/wireless/silabs/wfx/traces.h b/drivers/net/wireless/silabs/wfx/traces.h new file mode 100644 index 000000000000..e90dc73c4b01 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/traces.h @@ -0,0 +1,501 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Tracepoints definitions. + * + * Copyright (c) 2018-2020, Silicon Laboratories, Inc. + */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM wfx + +#if !defined(_WFX_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) +#define _WFX_TRACE_H + +#include +#include + +#include "bus.h" +#include "hif_api_cmd.h" +#include "hif_api_mib.h" + +/* The hell below need some explanations. For each symbolic number, we need to + * define it with TRACE_DEFINE_ENUM() and in a list for __print_symbolic. + * + * 1. Define a new macro that call TRACE_DEFINE_ENUM(): + * + * #define xxx_name(sym) TRACE_DEFINE_ENUM(sym); + * + * 2. Define list of all symbols: + * + * #define list_names \ + * ... \ + * xxx_name(XXX) \ + * ... + * + * 3. Instantiate that list_names: + * + * list_names + * + * 4. Redefine xxx_name() as an entry of array for __print_symbolic() + * + * #undef xxx_name + * #define xxx_name(msg) { msg, #msg }, + * + * 5. list_name can now nearly be used with __print_symbolic() but, + * __print_symbolic() dislike last comma of list. So we define a new list + * with a dummy element: + * + * #define list_for_print_symbolic list_names { -1, NULL } + */ + +#define _hif_msg_list \ + hif_cnf_name(ADD_KEY) \ + hif_cnf_name(BEACON_TRANSMIT) \ + hif_cnf_name(EDCA_QUEUE_PARAMS) \ + hif_cnf_name(JOIN) \ + hif_cnf_name(MAP_LINK) \ + hif_cnf_name(READ_MIB) \ + hif_cnf_name(REMOVE_KEY) \ + hif_cnf_name(RESET) \ + hif_cnf_name(SET_BSS_PARAMS) \ + hif_cnf_name(SET_PM_MODE) \ + hif_cnf_name(START) \ + hif_cnf_name(START_SCAN) \ + hif_cnf_name(STOP_SCAN) \ + hif_cnf_name(TX) \ + hif_cnf_name(MULTI_TRANSMIT) \ + hif_cnf_name(UPDATE_IE) \ + hif_cnf_name(WRITE_MIB) \ + hif_cnf_name(CONFIGURATION) \ + hif_cnf_name(CONTROL_GPIO) \ + hif_cnf_name(PREVENT_ROLLBACK) \ + hif_cnf_name(SET_SL_MAC_KEY) \ + hif_cnf_name(SL_CONFIGURE) \ + hif_cnf_name(SL_EXCHANGE_PUB_KEYS) \ + hif_cnf_name(SHUT_DOWN) \ + hif_ind_name(EVENT) \ + hif_ind_name(JOIN_COMPLETE) \ + hif_ind_name(RX) \ + hif_ind_name(SCAN_CMPL) \ + hif_ind_name(SET_PM_MODE_CMPL) \ + hif_ind_name(SUSPEND_RESUME_TX) \ + hif_ind_name(SL_EXCHANGE_PUB_KEYS) \ + hif_ind_name(ERROR) \ + hif_ind_name(EXCEPTION) \ + hif_ind_name(GENERIC) \ + hif_ind_name(WAKEUP) \ + hif_ind_name(STARTUP) + +#define hif_msg_list_enum _hif_msg_list + +#undef hif_cnf_name +#undef hif_ind_name +#define hif_cnf_name(msg) TRACE_DEFINE_ENUM(HIF_CNF_ID_##msg); +#define hif_ind_name(msg) TRACE_DEFINE_ENUM(HIF_IND_ID_##msg); +hif_msg_list_enum +#undef hif_cnf_name +#undef hif_ind_name +#define hif_cnf_name(msg) { HIF_CNF_ID_##msg, #msg }, +#define hif_ind_name(msg) { HIF_IND_ID_##msg, #msg }, +#define hif_msg_list hif_msg_list_enum { -1, NULL } + +#define _hif_mib_list \ + hif_mib_name(ARP_IP_ADDRESSES_TABLE) \ + hif_mib_name(ARP_KEEP_ALIVE_PERIOD) \ + hif_mib_name(BEACON_FILTER_ENABLE) \ + hif_mib_name(BEACON_FILTER_TABLE) \ + hif_mib_name(BEACON_STATS) \ + hif_mib_name(BEACON_WAKEUP_PERIOD) \ + hif_mib_name(BLOCK_ACK_POLICY) \ + hif_mib_name(CCA_CONFIG) \ + hif_mib_name(CONFIG_DATA_FILTER) \ + hif_mib_name(COUNTERS_TABLE) \ + hif_mib_name(CURRENT_TX_POWER_LEVEL) \ + hif_mib_name(DOT11_MAC_ADDRESS) \ + hif_mib_name(DOT11_MAX_RECEIVE_LIFETIME) \ + hif_mib_name(DOT11_MAX_TRANSMIT_MSDU_LIFETIME) \ + hif_mib_name(DOT11_RTS_THRESHOLD) \ + hif_mib_name(DOT11_WEP_DEFAULT_KEY_ID) \ + hif_mib_name(ETHERTYPE_DATAFRAME_CONDITION) \ + hif_mib_name(EXTENDED_COUNTERS_TABLE) \ + hif_mib_name(GL_BLOCK_ACK_INFO) \ + hif_mib_name(GL_OPERATIONAL_POWER_MODE) \ + hif_mib_name(GL_SET_MULTI_MSG) \ + hif_mib_name(GRP_SEQ_COUNTER) \ + hif_mib_name(INACTIVITY_TIMER) \ + hif_mib_name(INTERFACE_PROTECTION) \ + hif_mib_name(IPV4_ADDR_DATAFRAME_CONDITION) \ + hif_mib_name(IPV6_ADDR_DATAFRAME_CONDITION) \ + hif_mib_name(KEEP_ALIVE_PERIOD) \ + hif_mib_name(MAC_ADDR_DATAFRAME_CONDITION) \ + hif_mib_name(MAGIC_DATAFRAME_CONDITION) \ + hif_mib_name(MAX_TX_POWER_LEVEL) \ + hif_mib_name(NON_ERP_PROTECTION) \ + hif_mib_name(NS_IP_ADDRESSES_TABLE) \ + hif_mib_name(OVERRIDE_INTERNAL_TX_RATE) \ + hif_mib_name(PORT_DATAFRAME_CONDITION) \ + hif_mib_name(PROTECTED_MGMT_POLICY) \ + hif_mib_name(RCPI_RSSI_THRESHOLD) \ + hif_mib_name(RX_FILTER) \ + hif_mib_name(SET_ASSOCIATION_MODE) \ + hif_mib_name(SET_DATA_FILTERING) \ + hif_mib_name(SET_HT_PROTECTION) \ + hif_mib_name(SET_TX_RATE_RETRY_POLICY) \ + hif_mib_name(SET_UAPSD_INFORMATION) \ + hif_mib_name(SLOT_TIME) \ + hif_mib_name(STATISTICS_TABLE) \ + hif_mib_name(TEMPLATE_FRAME) \ + hif_mib_name(TSF_COUNTER) \ + hif_mib_name(UC_MC_BC_DATAFRAME_CONDITION) + +#define hif_mib_list_enum _hif_mib_list + +#undef hif_mib_name +#define hif_mib_name(mib) TRACE_DEFINE_ENUM(HIF_MIB_ID_##mib); +hif_mib_list_enum +#undef hif_mib_name +#define hif_mib_name(mib) { HIF_MIB_ID_##mib, #mib }, +#define hif_mib_list hif_mib_list_enum { -1, NULL } + +DECLARE_EVENT_CLASS(hif_data, + TP_PROTO(const struct hif_msg *hif, int tx_fill_level, bool is_recv), + TP_ARGS(hif, tx_fill_level, is_recv), + TP_STRUCT__entry( + __field(int, tx_fill_level) + __field(int, msg_id) + __field(const char *, msg_type) + __field(int, msg_len) + __field(int, buf_len) + __field(int, if_id) + __field(int, mib) + __array(u8, buf, 128) + ), + TP_fast_assign( + int header_len; + + __entry->tx_fill_level = tx_fill_level; + __entry->msg_len = le16_to_cpu(hif->len); + __entry->msg_id = hif->id; + __entry->if_id = hif->interface; + if (is_recv) + __entry->msg_type = __entry->msg_id & 0x80 ? "IND" : "CNF"; + else + __entry->msg_type = "REQ"; + if (!is_recv && + (__entry->msg_id == HIF_REQ_ID_READ_MIB || + __entry->msg_id == HIF_REQ_ID_WRITE_MIB)) { + __entry->mib = le16_to_cpup((__le16 *)hif->body); + header_len = 4; + } else { + __entry->mib = -1; + header_len = 0; + } + __entry->buf_len = min_t(int, __entry->msg_len, + sizeof(__entry->buf)) + - sizeof(struct hif_msg) - header_len; + memcpy(__entry->buf, hif->body + header_len, __entry->buf_len); + ), + TP_printk("%d:%d:%s_%s%s%s: %s%s (%d bytes)", + __entry->tx_fill_level, + __entry->if_id, + __entry->msg_type, + __print_symbolic(__entry->msg_id, hif_msg_list), + __entry->mib != -1 ? "/" : "", + __entry->mib != -1 ? __print_symbolic(__entry->mib, hif_mib_list) : "", + __print_hex(__entry->buf, __entry->buf_len), + __entry->msg_len > sizeof(__entry->buf) ? " ..." : "", + __entry->msg_len + ) +); +DEFINE_EVENT(hif_data, hif_send, + TP_PROTO(const struct hif_msg *hif, int tx_fill_level, bool is_recv), + TP_ARGS(hif, tx_fill_level, is_recv)); +#define _trace_hif_send(hif, tx_fill_level)\ + trace_hif_send(hif, tx_fill_level, false) +DEFINE_EVENT(hif_data, hif_recv, + TP_PROTO(const struct hif_msg *hif, int tx_fill_level, bool is_recv), + TP_ARGS(hif, tx_fill_level, is_recv)); +#define _trace_hif_recv(hif, tx_fill_level)\ + trace_hif_recv(hif, tx_fill_level, true) + +#define wfx_reg_list_enum \ + wfx_reg_name(WFX_REG_CONFIG, "CONFIG") \ + wfx_reg_name(WFX_REG_CONTROL, "CONTROL") \ + wfx_reg_name(WFX_REG_IN_OUT_QUEUE, "QUEUE") \ + wfx_reg_name(WFX_REG_AHB_DPORT, "AHB") \ + wfx_reg_name(WFX_REG_BASE_ADDR, "BASE_ADDR") \ + wfx_reg_name(WFX_REG_SRAM_DPORT, "SRAM") \ + wfx_reg_name(WFX_REG_SET_GEN_R_W, "SET_GEN_R_W") \ + wfx_reg_name(WFX_REG_FRAME_OUT, "FRAME_OUT") + +#undef wfx_reg_name +#define wfx_reg_name(sym, name) TRACE_DEFINE_ENUM(sym); +wfx_reg_list_enum +#undef wfx_reg_name +#define wfx_reg_name(sym, name) { sym, name }, +#define wfx_reg_list wfx_reg_list_enum { -1, NULL } + +DECLARE_EVENT_CLASS(io_data, + TP_PROTO(int reg, int addr, const void *io_buf, size_t len), + TP_ARGS(reg, addr, io_buf, len), + TP_STRUCT__entry( + __field(int, reg) + __field(int, addr) + __field(int, msg_len) + __field(int, buf_len) + __array(u8, buf, 32) + __array(u8, addr_str, 10) + ), + TP_fast_assign( + __entry->reg = reg; + __entry->addr = addr; + __entry->msg_len = len; + __entry->buf_len = min_t(int, sizeof(__entry->buf), + __entry->msg_len); + memcpy(__entry->buf, io_buf, __entry->buf_len); + if (addr >= 0) + snprintf(__entry->addr_str, 10, "/%08x", addr); + else + __entry->addr_str[0] = 0; + ), + TP_printk("%s%s: %s%s (%d bytes)", + __print_symbolic(__entry->reg, wfx_reg_list), + __entry->addr_str, + __print_hex(__entry->buf, __entry->buf_len), + __entry->msg_len > sizeof(__entry->buf) ? " ..." : "", + __entry->msg_len + ) +); +DEFINE_EVENT(io_data, io_write, + TP_PROTO(int reg, int addr, const void *io_buf, size_t len), + TP_ARGS(reg, addr, io_buf, len)); +#define _trace_io_ind_write(reg, addr, io_buf, len)\ + trace_io_write(reg, addr, io_buf, len) +#define _trace_io_write(reg, io_buf, len) trace_io_write(reg, -1, io_buf, len) +DEFINE_EVENT(io_data, io_read, + TP_PROTO(int reg, int addr, const void *io_buf, size_t len), + TP_ARGS(reg, addr, io_buf, len)); +#define _trace_io_ind_read(reg, addr, io_buf, len)\ + trace_io_read(reg, addr, io_buf, len) +#define _trace_io_read(reg, io_buf, len) trace_io_read(reg, -1, io_buf, len) + +DECLARE_EVENT_CLASS(io_data32, + TP_PROTO(int reg, int addr, u32 val), + TP_ARGS(reg, addr, val), + TP_STRUCT__entry( + __field(int, reg) + __field(int, addr) + __field(int, val) + __array(u8, addr_str, 10) + ), + TP_fast_assign( + __entry->reg = reg; + __entry->addr = addr; + __entry->val = val; + if (addr >= 0) + snprintf(__entry->addr_str, 10, "/%08x", addr); + else + __entry->addr_str[0] = 0; + ), + TP_printk("%s%s: %08x", + __print_symbolic(__entry->reg, wfx_reg_list), + __entry->addr_str, + __entry->val + ) +); +DEFINE_EVENT(io_data32, io_write32, + TP_PROTO(int reg, int addr, u32 val), + TP_ARGS(reg, addr, val)); +#define _trace_io_ind_write32(reg, addr, val) trace_io_write32(reg, addr, val) +#define _trace_io_write32(reg, val) trace_io_write32(reg, -1, val) +DEFINE_EVENT(io_data32, io_read32, + TP_PROTO(int reg, int addr, u32 val), + TP_ARGS(reg, addr, val)); +#define _trace_io_ind_read32(reg, addr, val) trace_io_read32(reg, addr, val) +#define _trace_io_read32(reg, val) trace_io_read32(reg, -1, val) + +DECLARE_EVENT_CLASS(piggyback, + TP_PROTO(u32 val, bool ignored), + TP_ARGS(val, ignored), + TP_STRUCT__entry( + __field(int, val) + __field(bool, ignored) + ), + TP_fast_assign( + __entry->val = val; + __entry->ignored = ignored; + ), + TP_printk("CONTROL: %08x%s", + __entry->val, + __entry->ignored ? " (ignored)" : "" + ) +); +DEFINE_EVENT(piggyback, piggyback, + TP_PROTO(u32 val, bool ignored), + TP_ARGS(val, ignored)); +#define _trace_piggyback(val, ignored) trace_piggyback(val, ignored) + +TRACE_EVENT(bh_stats, + TP_PROTO(int ind, int req, int cnf, int busy, bool release), + TP_ARGS(ind, req, cnf, busy, release), + TP_STRUCT__entry( + __field(int, ind) + __field(int, req) + __field(int, cnf) + __field(int, busy) + __field(bool, release) + ), + TP_fast_assign( + __entry->ind = ind; + __entry->req = req; + __entry->cnf = cnf; + __entry->busy = busy; + __entry->release = release; + ), + TP_printk("IND/REQ/CNF:%3d/%3d/%3d, REQ in progress:%3d, WUP: %s", + __entry->ind, + __entry->req, + __entry->cnf, + __entry->busy, + __entry->release ? "release" : "keep" + ) +); +#define _trace_bh_stats(ind, req, cnf, busy, release)\ + trace_bh_stats(ind, req, cnf, busy, release) + +TRACE_EVENT(tx_stats, + TP_PROTO(const struct hif_cnf_tx *tx_cnf, const struct sk_buff *skb, + int delay), + TP_ARGS(tx_cnf, skb, delay), + TP_STRUCT__entry( + __field(int, pkt_id) + __field(int, delay_media) + __field(int, delay_queue) + __field(int, delay_fw) + __field(int, ack_failures) + __field(int, flags) + __array(int, rate, 4) + __array(int, tx_count, 4) + ), + TP_fast_assign( + /* Keep sync with wfx_rates definition in main.c */ + static const int hw_rate[] = { 0, 1, 2, 3, 6, 7, 8, 9, + 10, 11, 12, 13 }; + const struct ieee80211_tx_info *tx_info = + (const struct ieee80211_tx_info *)skb->cb; + const struct ieee80211_tx_rate *rates = tx_info->driver_rates; + int i; + + __entry->pkt_id = tx_cnf->packet_id; + __entry->delay_media = le32_to_cpu(tx_cnf->media_delay); + __entry->delay_queue = le32_to_cpu(tx_cnf->tx_queue_delay); + __entry->delay_fw = delay; + __entry->ack_failures = tx_cnf->ack_failures; + if (!tx_cnf->status || __entry->ack_failures) + __entry->ack_failures += 1; + + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + if (rates[0].flags & IEEE80211_TX_RC_MCS) + __entry->rate[i] = rates[i].idx; + else + __entry->rate[i] = hw_rate[rates[i].idx]; + __entry->tx_count[i] = rates[i].count; + } + __entry->flags = 0; + if (rates[0].flags & IEEE80211_TX_RC_MCS) + __entry->flags |= 0x01; + if (rates[0].flags & IEEE80211_TX_RC_SHORT_GI) + __entry->flags |= 0x02; + if (rates[0].flags & IEEE80211_TX_RC_GREEN_FIELD) + __entry->flags |= 0x04; + if (rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) + __entry->flags |= 0x08; + if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) + __entry->flags |= 0x10; + if (tx_cnf->status) + __entry->flags |= 0x20; + if (tx_cnf->status == HIF_STATUS_TX_FAIL_REQUEUE) + __entry->flags |= 0x40; + ), + TP_printk("packet ID: %08x, rate policy: %s %d|%d %d|%d %d|%d %d|%d -> %d attempt, Delays media/queue/total: %4dus/%4dus/%4dus", + __entry->pkt_id, + __print_flags(__entry->flags, NULL, + { 0x01, "M" }, { 0x02, "S" }, { 0x04, "G" }, + { 0x08, "R" }, { 0x10, "D" }, { 0x20, "F" }, + { 0x40, "Q" }), + __entry->rate[0], + __entry->tx_count[0], + __entry->rate[1], + __entry->tx_count[1], + __entry->rate[2], + __entry->tx_count[2], + __entry->rate[3], + __entry->tx_count[3], + __entry->ack_failures, + __entry->delay_media, + __entry->delay_queue, + __entry->delay_fw + ) +); +#define _trace_tx_stats(tx_cnf, skb, delay) trace_tx_stats(tx_cnf, skb, delay) + +TRACE_EVENT(queues_stats, + TP_PROTO(struct wfx_dev *wdev, const struct wfx_queue *elected_queue), + TP_ARGS(wdev, elected_queue), + TP_STRUCT__entry( + __field(int, vif_id) + __field(int, queue_id) + __array(int, hw, IEEE80211_NUM_ACS * 2) + __array(int, drv, IEEE80211_NUM_ACS * 2) + __array(int, cab, IEEE80211_NUM_ACS * 2) + ), + TP_fast_assign( + const struct wfx_queue *queue; + struct wfx_vif *wvif; + int i, j; + + for (j = 0; j < IEEE80211_NUM_ACS * 2; j++) { + __entry->hw[j] = -1; + __entry->drv[j] = -1; + __entry->cab[j] = -1; + } + __entry->vif_id = -1; + __entry->queue_id = -1; + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + j = wvif->id * IEEE80211_NUM_ACS + i; + WARN_ON(j >= IEEE80211_NUM_ACS * 2); + queue = &wvif->tx_queue[i]; + __entry->hw[j] = atomic_read(&queue->pending_frames); + __entry->drv[j] = skb_queue_len(&queue->normal); + __entry->cab[j] = skb_queue_len(&queue->cab); + if (queue == elected_queue) { + __entry->vif_id = wvif->id; + __entry->queue_id = i; + } + } + } + ), + TP_printk("got skb from %d/%d, pend. hw/norm/cab: [ %d/%d/%d %d/%d/%d %d/%d/%d %d/%d/%d ] [ %d/%d/%d %d/%d/%d %d/%d/%d %d/%d/%d ]", + __entry->vif_id, __entry->queue_id, + __entry->hw[0], __entry->drv[0], __entry->cab[0], + __entry->hw[1], __entry->drv[1], __entry->cab[1], + __entry->hw[2], __entry->drv[2], __entry->cab[2], + __entry->hw[3], __entry->drv[3], __entry->cab[3], + __entry->hw[4], __entry->drv[4], __entry->cab[4], + __entry->hw[5], __entry->drv[5], __entry->cab[5], + __entry->hw[6], __entry->drv[6], __entry->cab[6], + __entry->hw[7], __entry->drv[7], __entry->cab[7] + ) +); + +#endif + +/* This part must be outside protection */ +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH . +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_FILE traces + +#include -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:25:01 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:25:01 +0100 Subject: [PATCH v5 24/24] wfx: get out from the staging area In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-25-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller The wfx driver is now mature enough to leave the staging area. Signed-off-by: J?r?me Pouiller --- MAINTAINERS | 3 ++- drivers/net/wireless/Kconfig | 1 + drivers/net/wireless/Makefile | 1 + drivers/net/wireless/silabs/Kconfig | 18 ++++++++++++++++++ drivers/net/wireless/silabs/Makefile | 3 +++ drivers/staging/Kconfig | 2 -- drivers/staging/Makefile | 1 - drivers/staging/wfx/TODO | 6 ------ 8 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 drivers/net/wireless/silabs/Kconfig create mode 100644 drivers/net/wireless/silabs/Makefile delete mode 100644 drivers/staging/wfx/TODO diff --git a/MAINTAINERS b/MAINTAINERS index aa84121c5611..1d0be0c04456 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16344,7 +16344,8 @@ F: drivers/platform/x86/touchscreen_dmi.c SILICON LABS WIRELESS DRIVERS (for WFxxx series) M: J?r?me Pouiller S: Supported -F: drivers/staging/wfx/ +F: Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml +F: drivers/net/wireless/silabs/wfx/ SILICON MOTION SM712 FRAME BUFFER DRIVER M: Sudip Mukherjee diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 7add2002ff4c..e78ff7af6517 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig @@ -31,6 +31,7 @@ source "drivers/net/wireless/microchip/Kconfig" source "drivers/net/wireless/ralink/Kconfig" source "drivers/net/wireless/realtek/Kconfig" source "drivers/net/wireless/rsi/Kconfig" +source "drivers/net/wireless/silabs/Kconfig" source "drivers/net/wireless/st/Kconfig" source "drivers/net/wireless/ti/Kconfig" source "drivers/net/wireless/zydas/Kconfig" diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile index 80b324499786..76885e5f0ea7 100644 --- a/drivers/net/wireless/Makefile +++ b/drivers/net/wireless/Makefile @@ -16,6 +16,7 @@ obj-$(CONFIG_WLAN_VENDOR_MICROCHIP) += microchip/ obj-$(CONFIG_WLAN_VENDOR_RALINK) += ralink/ obj-$(CONFIG_WLAN_VENDOR_REALTEK) += realtek/ obj-$(CONFIG_WLAN_VENDOR_RSI) += rsi/ +obj-$(CONFIG_WLAN_VENDOR_SILABS) += silabs/ obj-$(CONFIG_WLAN_VENDOR_ST) += st/ obj-$(CONFIG_WLAN_VENDOR_TI) += ti/ obj-$(CONFIG_WLAN_VENDOR_ZYDAS) += zydas/ diff --git a/drivers/net/wireless/silabs/Kconfig b/drivers/net/wireless/silabs/Kconfig new file mode 100644 index 000000000000..6262a799bf36 --- /dev/null +++ b/drivers/net/wireless/silabs/Kconfig @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0 + +config WLAN_VENDOR_SILABS + bool "Silicon Laboratories devices" + default y + help + If you have a wireless card belonging to this class, say Y. + + Note that the answer to this question doesn't directly affect the + kernel: saying N will just cause the configurator to skip all the + questions about these cards. If you say Y, you will be asked for + your specific card in the following questions. + +if WLAN_VENDOR_SILABS + +source "drivers/net/wireless/silabs/wfx/Kconfig" + +endif # WLAN_VENDOR_SILABS diff --git a/drivers/net/wireless/silabs/Makefile b/drivers/net/wireless/silabs/Makefile new file mode 100644 index 000000000000..c2263ee21006 --- /dev/null +++ b/drivers/net/wireless/silabs/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_WFX) += wfx/ diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index b22f73d7bfc4..b07de39b9f0a 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -110,8 +110,6 @@ source "drivers/staging/qlge/Kconfig" source "drivers/staging/wimax/Kconfig" -source "drivers/staging/wfx/Kconfig" - source "drivers/staging/hikey9xx/Kconfig" endif # STAGING diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 2245059e69c7..c6a992d1edd5 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -45,5 +45,4 @@ obj-$(CONFIG_FIELDBUS_DEV) += fieldbus/ obj-$(CONFIG_KPC2000) += kpc2000/ obj-$(CONFIG_QLGE) += qlge/ obj-$(CONFIG_WIMAX) += wimax/ -obj-$(CONFIG_WFX) += wfx/ obj-y += hikey9xx/ diff --git a/drivers/staging/wfx/TODO b/drivers/staging/wfx/TODO deleted file mode 100644 index 1b4bc2af94b6..000000000000 --- a/drivers/staging/wfx/TODO +++ /dev/null @@ -1,6 +0,0 @@ -This is a list of things that need to be done to get this driver out of the -staging directory. - - - As suggested by Felix, rate control could be improved following this idea: - https://lore.kernel.org/lkml/3099559.gv3Q75KnN1 at pc-42/ - -- 2.30.2 From Jerome.Pouiller at silabs.com Mon Mar 15 13:25:00 2021 From: Jerome.Pouiller at silabs.com (Jerome Pouiller) Date: Mon, 15 Mar 2021 14:25:00 +0100 Subject: [PATCH v5 23/24] wfx: remove from the staging area In-Reply-To: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> Message-ID: <20210315132501.441681-24-Jerome.Pouiller@silabs.com> From: J?r?me Pouiller Signed-off-by: J?r?me Pouiller --- .../bindings/net/wireless/silabs,wfx.yaml | 125 --- drivers/staging/wfx/Kconfig | 8 - drivers/staging/wfx/Makefile | 25 - drivers/staging/wfx/bh.c | 333 -------- drivers/staging/wfx/bh.h | 33 - drivers/staging/wfx/bus.h | 38 - drivers/staging/wfx/bus_sdio.c | 269 ------ drivers/staging/wfx/bus_spi.c | 271 ------ drivers/staging/wfx/data_rx.c | 93 -- drivers/staging/wfx/data_rx.h | 18 - drivers/staging/wfx/data_tx.c | 593 ------------- drivers/staging/wfx/data_tx.h | 68 -- drivers/staging/wfx/debug.c | 359 -------- drivers/staging/wfx/debug.h | 19 - drivers/staging/wfx/fwio.c | 405 --------- drivers/staging/wfx/fwio.h | 15 - drivers/staging/wfx/hif_api_cmd.h | 553 ------------ drivers/staging/wfx/hif_api_general.h | 267 ------ drivers/staging/wfx/hif_api_mib.h | 343 -------- drivers/staging/wfx/hif_rx.c | 415 --------- drivers/staging/wfx/hif_rx.h | 18 - drivers/staging/wfx/hif_tx.c | 523 ------------ drivers/staging/wfx/hif_tx.h | 60 -- drivers/staging/wfx/hif_tx_mib.c | 324 ------- drivers/staging/wfx/hif_tx_mib.h | 49 -- drivers/staging/wfx/hwio.c | 352 -------- drivers/staging/wfx/hwio.h | 75 -- drivers/staging/wfx/key.c | 241 ------ drivers/staging/wfx/key.h | 20 - drivers/staging/wfx/main.c | 490 ----------- drivers/staging/wfx/main.h | 44 - drivers/staging/wfx/queue.c | 304 ------- drivers/staging/wfx/queue.h | 45 - drivers/staging/wfx/scan.c | 132 --- drivers/staging/wfx/scan.h | 22 - drivers/staging/wfx/sta.c | 807 ------------------ drivers/staging/wfx/sta.h | 73 -- drivers/staging/wfx/traces.h | 501 ----------- drivers/staging/wfx/wfx.h | 166 ---- 39 files changed, 8496 deletions(-) delete mode 100644 drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml delete mode 100644 drivers/staging/wfx/Kconfig delete mode 100644 drivers/staging/wfx/Makefile delete mode 100644 drivers/staging/wfx/bh.c delete mode 100644 drivers/staging/wfx/bh.h delete mode 100644 drivers/staging/wfx/bus.h delete mode 100644 drivers/staging/wfx/bus_sdio.c delete mode 100644 drivers/staging/wfx/bus_spi.c delete mode 100644 drivers/staging/wfx/data_rx.c delete mode 100644 drivers/staging/wfx/data_rx.h delete mode 100644 drivers/staging/wfx/data_tx.c delete mode 100644 drivers/staging/wfx/data_tx.h delete mode 100644 drivers/staging/wfx/debug.c delete mode 100644 drivers/staging/wfx/debug.h delete mode 100644 drivers/staging/wfx/fwio.c delete mode 100644 drivers/staging/wfx/fwio.h delete mode 100644 drivers/staging/wfx/hif_api_cmd.h delete mode 100644 drivers/staging/wfx/hif_api_general.h delete mode 100644 drivers/staging/wfx/hif_api_mib.h delete mode 100644 drivers/staging/wfx/hif_rx.c delete mode 100644 drivers/staging/wfx/hif_rx.h delete mode 100644 drivers/staging/wfx/hif_tx.c delete mode 100644 drivers/staging/wfx/hif_tx.h delete mode 100644 drivers/staging/wfx/hif_tx_mib.c delete mode 100644 drivers/staging/wfx/hif_tx_mib.h delete mode 100644 drivers/staging/wfx/hwio.c delete mode 100644 drivers/staging/wfx/hwio.h delete mode 100644 drivers/staging/wfx/key.c delete mode 100644 drivers/staging/wfx/key.h delete mode 100644 drivers/staging/wfx/main.c delete mode 100644 drivers/staging/wfx/main.h delete mode 100644 drivers/staging/wfx/queue.c delete mode 100644 drivers/staging/wfx/queue.h delete mode 100644 drivers/staging/wfx/scan.c delete mode 100644 drivers/staging/wfx/scan.h delete mode 100644 drivers/staging/wfx/sta.c delete mode 100644 drivers/staging/wfx/sta.h delete mode 100644 drivers/staging/wfx/traces.h delete mode 100644 drivers/staging/wfx/wfx.h diff --git a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml b/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml deleted file mode 100644 index 510edd12ed19..000000000000 --- a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml +++ /dev/null @@ -1,125 +0,0 @@ -# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -# Copyright (c) 2020, Silicon Laboratories, Inc. -%YAML 1.2 ---- - -$id: http://devicetree.org/schemas/net/wireless/silabs,wfx.yaml# -$schema: http://devicetree.org/meta-schemas/core.yaml# - -title: Silicon Labs WFxxx devicetree bindings - -maintainers: - - J?r?me Pouiller - -description: - The WFxxx chip series can be connected via SPI or via SDIO. - - For SDIO':' - - The driver is able to detect a WFxxx chip on SDIO bus by matching its Vendor - ID and Product ID. However, driver will only provide limited features in - this case. Thus declaring WFxxx chip in device tree is recommended (and may - become mandatory in the future). - - In addition, it is recommended to declare a mmc-pwrseq on SDIO host above - WFx. Without it, you may encounter issues with warm boot. The mmc-pwrseq - should be compatible with mmc-pwrseq-simple. Please consult - Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml for more - information. - - For SPI':' - - In add of the properties below, please consult - Documentation/devicetree/bindings/spi/spi-controller.yaml for optional SPI - related properties. - - Note that in add of the properties below, the WFx driver also supports - `mac-address` and `local-mac-address` as described in - Documentation/devicetree/bindings/net/ethernet.txt - -properties: - compatible: - const: silabs,wf200 - reg: - description: - When used on SDIO bus, must be set to 1. When used on SPI bus, it is - the chip select address of the device as defined in the SPI devices - bindings. - maxItems: 1 - spi-max-frequency: - description: (SPI only) Maximum SPI clocking speed of device in Hz. - maxItems: 1 - interrupts: - description: The interrupt line. Triggers IRQ_TYPE_LEVEL_HIGH and - IRQ_TYPE_EDGE_RISING are both supported by the chip and the driver. When - SPI is used, this property is required. When SDIO is used, the "in-band" - interrupt provided by the SDIO bus is used unless an interrupt is defined - in the Device Tree. - maxItems: 1 - reset-gpios: - description: (SPI only) Phandle of gpio that will be used to reset chip - during probe. Without this property, you may encounter issues with warm - boot. (For legacy purpose, the gpio in inverted when compatible == - "silabs,wfx-spi") - - For SDIO, the reset gpio should declared using a mmc-pwrseq. - maxItems: 1 - wakeup-gpios: - description: Phandle of gpio that will be used to wake-up chip. Without this - property, driver will disable most of power saving features. - maxItems: 1 - config-file: - description: Use an alternative file as PDS. Default is `wf200.pds`. Only - necessary for development/debug purpose. - maxItems: 1 - -required: - - compatible - - reg - -examples: - - | - #include - #include - - spi0 { - #address-cells = <1>; - #size-cells = <0>; - - wfx at 0 { - compatible = "silabs,wf200"; - pinctrl-names = "default"; - pinctrl-0 = <&wfx_irq &wfx_gpios>; - reg = <0>; - interrupts-extended = <&gpio 16 IRQ_TYPE_EDGE_RISING>; - wakeup-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; - reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - spi-max-frequency = <42000000>; - }; - }; - - - | - #include - #include - - wfx_pwrseq: wfx_pwrseq { - compatible = "mmc-pwrseq-simple"; - pinctrl-names = "default"; - pinctrl-0 = <&wfx_reset>; - reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - }; - - mmc0 { - mmc-pwrseq = <&wfx_pwrseq>; - #address-cells = <1>; - #size-cells = <0>; - - mmc at 1 { - compatible = "silabs,wf200"; - pinctrl-names = "default"; - pinctrl-0 = <&wfx_wakeup>; - reg = <1>; - wakeup-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; - }; - }; -... diff --git a/drivers/staging/wfx/Kconfig b/drivers/staging/wfx/Kconfig deleted file mode 100644 index 83ee4d0ca8c6..000000000000 --- a/drivers/staging/wfx/Kconfig +++ /dev/null @@ -1,8 +0,0 @@ -config WFX - tristate "Silicon Labs wireless chips WF200 and further" - depends on MAC80211 - depends on MMC || !MMC # do not allow WFX=y if MMC=m - depends on (SPI || MMC) - help - This is a driver for Silicons Labs WFxxx series (WF200 and further) - chipsets. This chip can be found on SPI or SDIO buses. diff --git a/drivers/staging/wfx/Makefile b/drivers/staging/wfx/Makefile deleted file mode 100644 index 0e0cc982ceab..000000000000 --- a/drivers/staging/wfx/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 - -# Necessary for CREATE_TRACE_POINTS -CFLAGS_debug.o = -I$(src) - -wfx-y := \ - bh.o \ - hwio.o \ - fwio.o \ - hif_tx_mib.o \ - hif_tx.o \ - hif_rx.o \ - queue.o \ - data_tx.o \ - data_rx.o \ - scan.o \ - sta.o \ - key.o \ - main.o \ - sta.o \ - debug.o -wfx-$(CONFIG_SPI) += bus_spi.o -wfx-$(subst m,y,$(CONFIG_MMC)) += bus_sdio.o - -obj-$(CONFIG_WFX) += wfx.o diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c deleted file mode 100644 index ed53d0b45592..000000000000 --- a/drivers/staging/wfx/bh.c +++ /dev/null @@ -1,333 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Interrupt bottom half (BH). - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#include -#include - -#include "bh.h" -#include "wfx.h" -#include "hwio.h" -#include "traces.h" -#include "hif_rx.h" -#include "hif_api_cmd.h" - -static void device_wakeup(struct wfx_dev *wdev) -{ - int max_retry = 3; - - if (!wdev->pdata.gpio_wakeup) - return; - if (gpiod_get_value_cansleep(wdev->pdata.gpio_wakeup) > 0) - return; - - if (wfx_api_older_than(wdev, 1, 4)) { - gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1); - if (!completion_done(&wdev->hif.ctrl_ready)) - usleep_range(2000, 2500); - return; - } - for (;;) { - gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1); - // completion.h does not provide any function to wait - // completion without consume it (a kind of - // wait_for_completion_done_timeout()). So we have to emulate - // it. - if (wait_for_completion_timeout(&wdev->hif.ctrl_ready, - msecs_to_jiffies(2))) { - complete(&wdev->hif.ctrl_ready); - return; - } else if (max_retry-- > 0) { - // Older firmwares have a race in sleep/wake-up process. - // Redo the process is sufficient to unfreeze the - // chip. - dev_err(wdev->dev, "timeout while wake up chip\n"); - gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 0); - usleep_range(2000, 2500); - } else { - dev_err(wdev->dev, "max wake-up retries reached\n"); - return; - } - } -} - -static void device_release(struct wfx_dev *wdev) -{ - if (!wdev->pdata.gpio_wakeup) - return; - - gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 0); -} - -static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf) -{ - struct sk_buff *skb; - struct hif_msg *hif; - size_t alloc_len; - size_t computed_len; - int release_count; - int piggyback = 0; - - WARN(read_len > round_down(0xFFF, 2) * sizeof(u16), - "%s: request exceed WFx capability", __func__); - - // Add 2 to take into account piggyback size - alloc_len = wdev->hwbus_ops->align_size(wdev->hwbus_priv, read_len + 2); - skb = dev_alloc_skb(alloc_len); - if (!skb) - return -ENOMEM; - - if (wfx_data_read(wdev, skb->data, alloc_len)) - goto err; - - piggyback = le16_to_cpup((__le16 *)(skb->data + alloc_len - 2)); - _trace_piggyback(piggyback, false); - - hif = (struct hif_msg *)skb->data; - WARN(hif->encrypted & 0x3, "encryption is unsupported"); - if (WARN(read_len < sizeof(struct hif_msg), "corrupted read")) - goto err; - computed_len = le16_to_cpu(hif->len); - computed_len = round_up(computed_len, 2); - if (computed_len != read_len) { - dev_err(wdev->dev, "inconsistent message length: %zu != %zu\n", - computed_len, read_len); - print_hex_dump(KERN_INFO, "hif: ", DUMP_PREFIX_OFFSET, 16, 1, - hif, read_len, true); - goto err; - } - - if (!(hif->id & HIF_ID_IS_INDICATION)) { - (*is_cnf)++; - if (hif->id == HIF_CNF_ID_MULTI_TRANSMIT) - release_count = ((struct hif_cnf_multi_transmit *)hif->body)->num_tx_confs; - else - release_count = 1; - WARN(wdev->hif.tx_buffers_used < release_count, "corrupted buffer counter"); - wdev->hif.tx_buffers_used -= release_count; - } - _trace_hif_recv(hif, wdev->hif.tx_buffers_used); - - if (hif->id != HIF_IND_ID_EXCEPTION && hif->id != HIF_IND_ID_ERROR) { - if (hif->seqnum != wdev->hif.rx_seqnum) - dev_warn(wdev->dev, "wrong message sequence: %d != %d\n", - hif->seqnum, wdev->hif.rx_seqnum); - wdev->hif.rx_seqnum = (hif->seqnum + 1) % (HIF_COUNTER_MAX + 1); - } - - skb_put(skb, le16_to_cpu(hif->len)); - // wfx_handle_rx takes care on SKB livetime - wfx_handle_rx(wdev, skb); - if (!wdev->hif.tx_buffers_used) - wake_up(&wdev->hif.tx_buffers_empty); - - return piggyback; - -err: - if (skb) - dev_kfree_skb(skb); - return -EIO; -} - -static int bh_work_rx(struct wfx_dev *wdev, int max_msg, int *num_cnf) -{ - size_t len; - int i; - int ctrl_reg, piggyback; - - piggyback = 0; - for (i = 0; i < max_msg; i++) { - if (piggyback & CTRL_NEXT_LEN_MASK) - ctrl_reg = piggyback; - else if (try_wait_for_completion(&wdev->hif.ctrl_ready)) - ctrl_reg = atomic_xchg(&wdev->hif.ctrl_reg, 0); - else - ctrl_reg = 0; - if (!(ctrl_reg & CTRL_NEXT_LEN_MASK)) - return i; - // ctrl_reg units are 16bits words - len = (ctrl_reg & CTRL_NEXT_LEN_MASK) * 2; - piggyback = rx_helper(wdev, len, num_cnf); - if (piggyback < 0) - return i; - if (!(piggyback & CTRL_WLAN_READY)) - dev_err(wdev->dev, "unexpected piggyback value: ready bit not set: %04x\n", - piggyback); - } - if (piggyback & CTRL_NEXT_LEN_MASK) { - ctrl_reg = atomic_xchg(&wdev->hif.ctrl_reg, piggyback); - complete(&wdev->hif.ctrl_ready); - if (ctrl_reg) - dev_err(wdev->dev, "unexpected IRQ happened: %04x/%04x\n", - ctrl_reg, piggyback); - } - return i; -} - -static void tx_helper(struct wfx_dev *wdev, struct hif_msg *hif) -{ - int ret; - void *data; - bool is_encrypted = false; - size_t len = le16_to_cpu(hif->len); - - WARN(len < sizeof(*hif), "try to send corrupted data"); - - hif->seqnum = wdev->hif.tx_seqnum; - wdev->hif.tx_seqnum = (wdev->hif.tx_seqnum + 1) % (HIF_COUNTER_MAX + 1); - - data = hif; - WARN(len > wdev->hw_caps.size_inp_ch_buf, - "%s: request exceed WFx capability: %zu > %d\n", __func__, - len, wdev->hw_caps.size_inp_ch_buf); - len = wdev->hwbus_ops->align_size(wdev->hwbus_priv, len); - ret = wfx_data_write(wdev, data, len); - if (ret) - goto end; - - wdev->hif.tx_buffers_used++; - _trace_hif_send(hif, wdev->hif.tx_buffers_used); -end: - if (is_encrypted) - kfree(data); -} - -static int bh_work_tx(struct wfx_dev *wdev, int max_msg) -{ - struct hif_msg *hif; - int i; - - for (i = 0; i < max_msg; i++) { - hif = NULL; - if (wdev->hif.tx_buffers_used < wdev->hw_caps.num_inp_ch_bufs) { - if (try_wait_for_completion(&wdev->hif_cmd.ready)) { - WARN(!mutex_is_locked(&wdev->hif_cmd.lock), "data locking error"); - hif = wdev->hif_cmd.buf_send; - } else { - hif = wfx_tx_queues_get(wdev); - } - } - if (!hif) - return i; - tx_helper(wdev, hif); - } - return i; -} - -/* In SDIO mode, it is necessary to make an access to a register to acknowledge - * last received message. It could be possible to restrict this acknowledge to - * SDIO mode and only if last operation was rx. - */ -static void ack_sdio_data(struct wfx_dev *wdev) -{ - u32 cfg_reg; - - config_reg_read(wdev, &cfg_reg); - if (cfg_reg & 0xFF) { - dev_warn(wdev->dev, "chip reports errors: %02x\n", - cfg_reg & 0xFF); - config_reg_write_bits(wdev, 0xFF, 0x00); - } -} - -static void bh_work(struct work_struct *work) -{ - struct wfx_dev *wdev = container_of(work, struct wfx_dev, hif.bh); - int stats_req = 0, stats_cnf = 0, stats_ind = 0; - bool release_chip = false, last_op_is_rx = false; - int num_tx, num_rx; - - device_wakeup(wdev); - do { - num_tx = bh_work_tx(wdev, 32); - stats_req += num_tx; - if (num_tx) - last_op_is_rx = false; - num_rx = bh_work_rx(wdev, 32, &stats_cnf); - stats_ind += num_rx; - if (num_rx) - last_op_is_rx = true; - } while (num_rx || num_tx); - stats_ind -= stats_cnf; - - if (last_op_is_rx) - ack_sdio_data(wdev); - if (!wdev->hif.tx_buffers_used && !work_pending(work)) { - device_release(wdev); - release_chip = true; - } - _trace_bh_stats(stats_ind, stats_req, stats_cnf, - wdev->hif.tx_buffers_used, release_chip); -} - -/* - * An IRQ from chip did occur - */ -void wfx_bh_request_rx(struct wfx_dev *wdev) -{ - u32 cur, prev; - - control_reg_read(wdev, &cur); - prev = atomic_xchg(&wdev->hif.ctrl_reg, cur); - complete(&wdev->hif.ctrl_ready); - queue_work(system_highpri_wq, &wdev->hif.bh); - - if (!(cur & CTRL_NEXT_LEN_MASK)) - dev_err(wdev->dev, "unexpected control register value: length field is 0: %04x\n", - cur); - if (prev != 0) - dev_err(wdev->dev, "received IRQ but previous data was not (yet) read: %04x/%04x\n", - prev, cur); -} - -/* - * Driver want to send data - */ -void wfx_bh_request_tx(struct wfx_dev *wdev) -{ - queue_work(system_highpri_wq, &wdev->hif.bh); -} - -/* - * If IRQ is not available, this function allow to manually poll the control - * register and simulate an IRQ ahen an event happened. - * - * Note that the device has a bug: If an IRQ raise while host read control - * register, the IRQ is lost. So, use this function carefully (only duing - * device initialisation). - */ -void wfx_bh_poll_irq(struct wfx_dev *wdev) -{ - ktime_t now, start; - u32 reg; - - WARN(!wdev->poll_irq, "unexpected IRQ polling can mask IRQ"); - start = ktime_get(); - for (;;) { - control_reg_read(wdev, ®); - now = ktime_get(); - if (reg & 0xFFF) - break; - if (ktime_after(now, ktime_add_ms(start, 1000))) { - dev_err(wdev->dev, "time out while polling control register\n"); - return; - } - udelay(200); - } - wfx_bh_request_rx(wdev); -} - -void wfx_bh_register(struct wfx_dev *wdev) -{ - INIT_WORK(&wdev->hif.bh, bh_work); - init_completion(&wdev->hif.ctrl_ready); - init_waitqueue_head(&wdev->hif.tx_buffers_empty); -} - -void wfx_bh_unregister(struct wfx_dev *wdev) -{ - flush_work(&wdev->hif.bh); -} diff --git a/drivers/staging/wfx/bh.h b/drivers/staging/wfx/bh.h deleted file mode 100644 index 78c49329e22a..000000000000 --- a/drivers/staging/wfx/bh.h +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Interrupt bottom half. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#ifndef WFX_BH_H -#define WFX_BH_H - -#include -#include -#include - -struct wfx_dev; - -struct wfx_hif { - struct work_struct bh; - struct completion ctrl_ready; - wait_queue_head_t tx_buffers_empty; - atomic_t ctrl_reg; - int rx_seqnum; - int tx_seqnum; - int tx_buffers_used; -}; - -void wfx_bh_register(struct wfx_dev *wdev); -void wfx_bh_unregister(struct wfx_dev *wdev); -void wfx_bh_request_rx(struct wfx_dev *wdev); -void wfx_bh_request_tx(struct wfx_dev *wdev); -void wfx_bh_poll_irq(struct wfx_dev *wdev); - -#endif /* WFX_BH_H */ diff --git a/drivers/staging/wfx/bus.h b/drivers/staging/wfx/bus.h deleted file mode 100644 index ca04b3da6204..000000000000 --- a/drivers/staging/wfx/bus.h +++ /dev/null @@ -1,38 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Common bus abstraction layer. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#ifndef WFX_BUS_H -#define WFX_BUS_H - -#include -#include - -#define WFX_REG_CONFIG 0x0 -#define WFX_REG_CONTROL 0x1 -#define WFX_REG_IN_OUT_QUEUE 0x2 -#define WFX_REG_AHB_DPORT 0x3 -#define WFX_REG_BASE_ADDR 0x4 -#define WFX_REG_SRAM_DPORT 0x5 -#define WFX_REG_SET_GEN_R_W 0x6 -#define WFX_REG_FRAME_OUT 0x7 - -struct hwbus_ops { - int (*copy_from_io)(void *bus_priv, unsigned int addr, - void *dst, size_t count); - int (*copy_to_io)(void *bus_priv, unsigned int addr, - const void *src, size_t count); - int (*irq_subscribe)(void *bus_priv); - int (*irq_unsubscribe)(void *bus_priv); - void (*lock)(void *bus_priv); - void (*unlock)(void *bus_priv); - size_t (*align_size)(void *bus_priv, size_t size); -}; - -extern struct sdio_driver wfx_sdio_driver; -extern struct spi_driver wfx_spi_driver; - -#endif diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c deleted file mode 100644 index e06d7e1ebe9c..000000000000 --- a/drivers/staging/wfx/bus_sdio.c +++ /dev/null @@ -1,269 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * SDIO interface. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#include -#include -#include -#include -#include -#include -#include - -#include "bus.h" -#include "wfx.h" -#include "hwio.h" -#include "main.h" -#include "bh.h" - -static const struct wfx_platform_data wfx_sdio_pdata = { - .file_fw = "wfm_wf200", - .file_pds = "wf200.pds", -}; - -struct wfx_sdio_priv { - struct sdio_func *func; - struct wfx_dev *core; - u8 buf_id_tx; - u8 buf_id_rx; - int of_irq; -}; - -static int wfx_sdio_copy_from_io(void *priv, unsigned int reg_id, - void *dst, size_t count) -{ - struct wfx_sdio_priv *bus = priv; - unsigned int sdio_addr = reg_id << 2; - int ret; - - WARN(reg_id > 7, "chip only has 7 registers"); - WARN(((uintptr_t)dst) & 3, "unaligned buffer size"); - WARN(count & 3, "unaligned buffer address"); - - /* Use queue mode buffers */ - if (reg_id == WFX_REG_IN_OUT_QUEUE) - sdio_addr |= (bus->buf_id_rx + 1) << 7; - ret = sdio_memcpy_fromio(bus->func, dst, sdio_addr, count); - if (!ret && reg_id == WFX_REG_IN_OUT_QUEUE) - bus->buf_id_rx = (bus->buf_id_rx + 1) % 4; - - return ret; -} - -static int wfx_sdio_copy_to_io(void *priv, unsigned int reg_id, - const void *src, size_t count) -{ - struct wfx_sdio_priv *bus = priv; - unsigned int sdio_addr = reg_id << 2; - int ret; - - WARN(reg_id > 7, "chip only has 7 registers"); - WARN(((uintptr_t)src) & 3, "unaligned buffer size"); - WARN(count & 3, "unaligned buffer address"); - - /* Use queue mode buffers */ - if (reg_id == WFX_REG_IN_OUT_QUEUE) - sdio_addr |= bus->buf_id_tx << 7; - // FIXME: discards 'const' qualifier for src - ret = sdio_memcpy_toio(bus->func, sdio_addr, (void *)src, count); - if (!ret && reg_id == WFX_REG_IN_OUT_QUEUE) - bus->buf_id_tx = (bus->buf_id_tx + 1) % 32; - - return ret; -} - -static void wfx_sdio_lock(void *priv) -{ - struct wfx_sdio_priv *bus = priv; - - sdio_claim_host(bus->func); -} - -static void wfx_sdio_unlock(void *priv) -{ - struct wfx_sdio_priv *bus = priv; - - sdio_release_host(bus->func); -} - -static void wfx_sdio_irq_handler(struct sdio_func *func) -{ - struct wfx_sdio_priv *bus = sdio_get_drvdata(func); - - wfx_bh_request_rx(bus->core); -} - -static irqreturn_t wfx_sdio_irq_handler_ext(int irq, void *priv) -{ - struct wfx_sdio_priv *bus = priv; - - sdio_claim_host(bus->func); - wfx_bh_request_rx(bus->core); - sdio_release_host(bus->func); - return IRQ_HANDLED; -} - -static int wfx_sdio_irq_subscribe(void *priv) -{ - struct wfx_sdio_priv *bus = priv; - u32 flags; - int ret; - u8 cccr; - - if (!bus->of_irq) { - sdio_claim_host(bus->func); - ret = sdio_claim_irq(bus->func, wfx_sdio_irq_handler); - sdio_release_host(bus->func); - return ret; - } - - sdio_claim_host(bus->func); - cccr = sdio_f0_readb(bus->func, SDIO_CCCR_IENx, NULL); - cccr |= BIT(0); - cccr |= BIT(bus->func->num); - sdio_f0_writeb(bus->func, cccr, SDIO_CCCR_IENx, NULL); - sdio_release_host(bus->func); - flags = irq_get_trigger_type(bus->of_irq); - if (!flags) - flags = IRQF_TRIGGER_HIGH; - flags |= IRQF_ONESHOT; - return devm_request_threaded_irq(&bus->func->dev, bus->of_irq, NULL, - wfx_sdio_irq_handler_ext, flags, - "wfx", bus); -} - -static int wfx_sdio_irq_unsubscribe(void *priv) -{ - struct wfx_sdio_priv *bus = priv; - int ret; - - if (bus->of_irq) - devm_free_irq(&bus->func->dev, bus->of_irq, bus); - sdio_claim_host(bus->func); - ret = sdio_release_irq(bus->func); - sdio_release_host(bus->func); - return ret; -} - -static size_t wfx_sdio_align_size(void *priv, size_t size) -{ - struct wfx_sdio_priv *bus = priv; - - return sdio_align_size(bus->func, size); -} - -static const struct hwbus_ops wfx_sdio_hwbus_ops = { - .copy_from_io = wfx_sdio_copy_from_io, - .copy_to_io = wfx_sdio_copy_to_io, - .irq_subscribe = wfx_sdio_irq_subscribe, - .irq_unsubscribe = wfx_sdio_irq_unsubscribe, - .lock = wfx_sdio_lock, - .unlock = wfx_sdio_unlock, - .align_size = wfx_sdio_align_size, -}; - -static const struct of_device_id wfx_sdio_of_match[] = { - { .compatible = "silabs,wfx-sdio" }, - { .compatible = "silabs,wf200" }, - { }, -}; -MODULE_DEVICE_TABLE(of, wfx_sdio_of_match); - -static int wfx_sdio_probe(struct sdio_func *func, - const struct sdio_device_id *id) -{ - struct device_node *np = func->dev.of_node; - struct wfx_sdio_priv *bus; - int ret; - - if (func->num != 1) { - dev_err(&func->dev, "SDIO function number is %d while it should always be 1 (unsupported chip?)\n", - func->num); - return -ENODEV; - } - - bus = devm_kzalloc(&func->dev, sizeof(*bus), GFP_KERNEL); - if (!bus) - return -ENOMEM; - - if (np) { - if (!of_match_node(wfx_sdio_of_match, np)) { - dev_warn(&func->dev, "no compatible device found in DT\n"); - return -ENODEV; - } - bus->of_irq = irq_of_parse_and_map(np, 0); - } else { - dev_warn(&func->dev, - "device is not declared in DT, features will be limited\n"); - // FIXME: ignore VID/PID and only rely on device tree - // return -ENODEV; - } - - bus->func = func; - sdio_set_drvdata(func, bus); - func->card->quirks |= MMC_QUIRK_LENIENT_FN0 | - MMC_QUIRK_BLKSZ_FOR_BYTE_MODE | - MMC_QUIRK_BROKEN_BYTE_MODE_512; - - sdio_claim_host(func); - ret = sdio_enable_func(func); - // Block of 64 bytes is more efficient than 512B for frame sizes < 4k - sdio_set_block_size(func, 64); - sdio_release_host(func); - if (ret) - goto err0; - - bus->core = wfx_init_common(&func->dev, &wfx_sdio_pdata, - &wfx_sdio_hwbus_ops, bus); - if (!bus->core) { - ret = -EIO; - goto err1; - } - - ret = wfx_probe(bus->core); - if (ret) - goto err1; - - return 0; - -err1: - sdio_claim_host(func); - sdio_disable_func(func); - sdio_release_host(func); -err0: - return ret; -} - -static void wfx_sdio_remove(struct sdio_func *func) -{ - struct wfx_sdio_priv *bus = sdio_get_drvdata(func); - - wfx_release(bus->core); - sdio_claim_host(func); - sdio_disable_func(func); - sdio_release_host(func); -} - -#define SDIO_VENDOR_ID_SILABS 0x0000 -#define SDIO_DEVICE_ID_SILABS_WF200 0x1000 -static const struct sdio_device_id wfx_sdio_ids[] = { - { SDIO_DEVICE(SDIO_VENDOR_ID_SILABS, SDIO_DEVICE_ID_SILABS_WF200) }, - // FIXME: ignore VID/PID and only rely on device tree - // { SDIO_DEVICE(SDIO_ANY_ID, SDIO_ANY_ID) }, - { }, -}; -MODULE_DEVICE_TABLE(sdio, wfx_sdio_ids); - -struct sdio_driver wfx_sdio_driver = { - .name = "wfx-sdio", - .id_table = wfx_sdio_ids, - .probe = wfx_sdio_probe, - .remove = wfx_sdio_remove, - .drv = { - .owner = THIS_MODULE, - .of_match_table = wfx_sdio_of_match, - } -}; diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c deleted file mode 100644 index a99125d1a30d..000000000000 --- a/drivers/staging/wfx/bus_spi.c +++ /dev/null @@ -1,271 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * SPI interface. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2011, Sagrad Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#include -#include -#include -#include -#include -#include -#include - -#include "bus.h" -#include "wfx.h" -#include "hwio.h" -#include "main.h" -#include "bh.h" - -#define SET_WRITE 0x7FFF /* usage: and operation */ -#define SET_READ 0x8000 /* usage: or operation */ - -#define WFX_RESET_INVERTED 1 - -static const struct wfx_platform_data wfx_spi_pdata = { - .file_fw = "wfm_wf200", - .file_pds = "wf200.pds", - .use_rising_clk = true, -}; - -struct wfx_spi_priv { - struct spi_device *func; - struct wfx_dev *core; - struct gpio_desc *gpio_reset; - bool need_swab; -}; - -/* - * WFx chip read data 16bits at time and place them directly into (little - * endian) CPU register. So, chip expect byte order like "B1 B0 B3 B2" (while - * LE is "B0 B1 B2 B3" and BE is "B3 B2 B1 B0") - * - * A little endian host with bits_per_word == 16 should do the right job - * natively. The code below to support big endian host and commonly used SPI - * 8bits. - */ -static int wfx_spi_copy_from_io(void *priv, unsigned int addr, - void *dst, size_t count) -{ - struct wfx_spi_priv *bus = priv; - u16 regaddr = (addr << 12) | (count / 2) | SET_READ; - struct spi_message m; - struct spi_transfer t_addr = { - .tx_buf = ®addr, - .len = sizeof(regaddr), - }; - struct spi_transfer t_msg = { - .rx_buf = dst, - .len = count, - }; - u16 *dst16 = dst; - int ret, i; - - WARN(count % 2, "buffer size must be a multiple of 2"); - - cpu_to_le16s(®addr); - if (bus->need_swab) - swab16s(®addr); - - spi_message_init(&m); - spi_message_add_tail(&t_addr, &m); - spi_message_add_tail(&t_msg, &m); - ret = spi_sync(bus->func, &m); - - if (bus->need_swab && addr == WFX_REG_CONFIG) - for (i = 0; i < count / 2; i++) - swab16s(&dst16[i]); - return ret; -} - -static int wfx_spi_copy_to_io(void *priv, unsigned int addr, - const void *src, size_t count) -{ - struct wfx_spi_priv *bus = priv; - u16 regaddr = (addr << 12) | (count / 2); - // FIXME: use a bounce buffer - u16 *src16 = (void *)src; - int ret, i; - struct spi_message m; - struct spi_transfer t_addr = { - .tx_buf = ®addr, - .len = sizeof(regaddr), - }; - struct spi_transfer t_msg = { - .tx_buf = src, - .len = count, - }; - - WARN(count % 2, "buffer size must be a multiple of 2"); - WARN(regaddr & SET_READ, "bad addr or size overflow"); - - cpu_to_le16s(®addr); - - // Register address and CONFIG content always use 16bit big endian - // ("BADC" order) - if (bus->need_swab) - swab16s(®addr); - if (bus->need_swab && addr == WFX_REG_CONFIG) - for (i = 0; i < count / 2; i++) - swab16s(&src16[i]); - - spi_message_init(&m); - spi_message_add_tail(&t_addr, &m); - spi_message_add_tail(&t_msg, &m); - ret = spi_sync(bus->func, &m); - - if (bus->need_swab && addr == WFX_REG_CONFIG) - for (i = 0; i < count / 2; i++) - swab16s(&src16[i]); - return ret; -} - -static void wfx_spi_lock(void *priv) -{ -} - -static void wfx_spi_unlock(void *priv) -{ -} - -static irqreturn_t wfx_spi_irq_handler(int irq, void *priv) -{ - struct wfx_spi_priv *bus = priv; - - wfx_bh_request_rx(bus->core); - return IRQ_HANDLED; -} - -static int wfx_spi_irq_subscribe(void *priv) -{ - struct wfx_spi_priv *bus = priv; - u32 flags; - - flags = irq_get_trigger_type(bus->func->irq); - if (!flags) - flags = IRQF_TRIGGER_HIGH; - flags |= IRQF_ONESHOT; - return devm_request_threaded_irq(&bus->func->dev, bus->func->irq, NULL, - wfx_spi_irq_handler, IRQF_ONESHOT, - "wfx", bus); -} - -static int wfx_spi_irq_unsubscribe(void *priv) -{ - struct wfx_spi_priv *bus = priv; - - devm_free_irq(&bus->func->dev, bus->func->irq, bus); - return 0; -} - -static size_t wfx_spi_align_size(void *priv, size_t size) -{ - // Most of SPI controllers avoid DMA if buffer size is not 32bit aligned - return ALIGN(size, 4); -} - -static const struct hwbus_ops wfx_spi_hwbus_ops = { - .copy_from_io = wfx_spi_copy_from_io, - .copy_to_io = wfx_spi_copy_to_io, - .irq_subscribe = wfx_spi_irq_subscribe, - .irq_unsubscribe = wfx_spi_irq_unsubscribe, - .lock = wfx_spi_lock, - .unlock = wfx_spi_unlock, - .align_size = wfx_spi_align_size, -}; - -static int wfx_spi_probe(struct spi_device *func) -{ - struct wfx_spi_priv *bus; - int ret; - - if (!func->bits_per_word) - func->bits_per_word = 16; - ret = spi_setup(func); - if (ret) - return ret; - // Trace below is also displayed by spi_setup() if compiled with DEBUG - dev_dbg(&func->dev, "SPI params: CS=%d, mode=%d bits/word=%d speed=%d\n", - func->chip_select, func->mode, func->bits_per_word, - func->max_speed_hz); - if (func->bits_per_word != 16 && func->bits_per_word != 8) - dev_warn(&func->dev, "unusual bits/word value: %d\n", - func->bits_per_word); - if (func->max_speed_hz > 50000000) - dev_warn(&func->dev, "%dHz is a very high speed\n", - func->max_speed_hz); - - bus = devm_kzalloc(&func->dev, sizeof(*bus), GFP_KERNEL); - if (!bus) - return -ENOMEM; - bus->func = func; - if (func->bits_per_word == 8 || IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) - bus->need_swab = true; - spi_set_drvdata(func, bus); - - bus->gpio_reset = devm_gpiod_get_optional(&func->dev, "reset", - GPIOD_OUT_LOW); - if (IS_ERR(bus->gpio_reset)) - return PTR_ERR(bus->gpio_reset); - if (!bus->gpio_reset) { - dev_warn(&func->dev, - "gpio reset is not defined, trying to load firmware anyway\n"); - } else { - gpiod_set_consumer_name(bus->gpio_reset, "wfx reset"); - if (spi_get_device_id(func)->driver_data & WFX_RESET_INVERTED) - gpiod_toggle_active_low(bus->gpio_reset); - gpiod_set_value_cansleep(bus->gpio_reset, 1); - usleep_range(100, 150); - gpiod_set_value_cansleep(bus->gpio_reset, 0); - usleep_range(2000, 2500); - } - - bus->core = wfx_init_common(&func->dev, &wfx_spi_pdata, - &wfx_spi_hwbus_ops, bus); - if (!bus->core) - return -EIO; - - return wfx_probe(bus->core); -} - -static int wfx_spi_remove(struct spi_device *func) -{ - struct wfx_spi_priv *bus = spi_get_drvdata(func); - - wfx_release(bus->core); - return 0; -} - -/* - * For dynamic driver binding, kernel does not use OF to match driver. It only - * use modalias and modalias is a copy of 'compatible' DT node with vendor - * stripped. - */ -static const struct spi_device_id wfx_spi_id[] = { - { "wfx-spi", WFX_RESET_INVERTED }, - { "wf200", 0 }, - { }, -}; -MODULE_DEVICE_TABLE(spi, wfx_spi_id); - -#ifdef CONFIG_OF -static const struct of_device_id wfx_spi_of_match[] = { - { .compatible = "silabs,wfx-spi", .data = (void *)WFX_RESET_INVERTED }, - { .compatible = "silabs,wf200" }, - { }, -}; -MODULE_DEVICE_TABLE(of, wfx_spi_of_match); -#endif - -struct spi_driver wfx_spi_driver = { - .driver = { - .name = "wfx-spi", - .of_match_table = of_match_ptr(wfx_spi_of_match), - }, - .id_table = wfx_spi_id, - .probe = wfx_spi_probe, - .remove = wfx_spi_remove, -}; diff --git a/drivers/staging/wfx/data_rx.c b/drivers/staging/wfx/data_rx.c deleted file mode 100644 index 385f2d42a0e2..000000000000 --- a/drivers/staging/wfx/data_rx.c +++ /dev/null @@ -1,93 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Datapath implementation. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#include -#include - -#include "data_rx.h" -#include "wfx.h" -#include "bh.h" -#include "sta.h" - -static void wfx_rx_handle_ba(struct wfx_vif *wvif, struct ieee80211_mgmt *mgmt) -{ - int params, tid; - - if (wfx_api_older_than(wvif->wdev, 3, 6)) - return; - - switch (mgmt->u.action.u.addba_req.action_code) { - case WLAN_ACTION_ADDBA_REQ: - params = le16_to_cpu(mgmt->u.action.u.addba_req.capab); - tid = (params & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2; - ieee80211_start_rx_ba_session_offl(wvif->vif, mgmt->sa, tid); - break; - case WLAN_ACTION_DELBA: - params = le16_to_cpu(mgmt->u.action.u.delba.params); - tid = (params & IEEE80211_DELBA_PARAM_TID_MASK) >> 12; - ieee80211_stop_rx_ba_session_offl(wvif->vif, mgmt->sa, tid); - break; - } -} - -void wfx_rx_cb(struct wfx_vif *wvif, - const struct hif_ind_rx *arg, struct sk_buff *skb) -{ - struct ieee80211_rx_status *hdr = IEEE80211_SKB_RXCB(skb); - struct ieee80211_hdr *frame = (struct ieee80211_hdr *)skb->data; - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; - - memset(hdr, 0, sizeof(*hdr)); - - if (arg->status == HIF_STATUS_RX_FAIL_MIC) - hdr->flag |= RX_FLAG_MMIC_ERROR | RX_FLAG_IV_STRIPPED; - else if (arg->status) - goto drop; - - if (skb->len < sizeof(struct ieee80211_pspoll)) { - dev_warn(wvif->wdev->dev, "malformed SDU received\n"); - goto drop; - } - - hdr->band = NL80211_BAND_2GHZ; - hdr->freq = ieee80211_channel_to_frequency(arg->channel_number, - hdr->band); - - if (arg->rxed_rate >= 14) { - hdr->encoding = RX_ENC_HT; - hdr->rate_idx = arg->rxed_rate - 14; - } else if (arg->rxed_rate >= 4) { - hdr->rate_idx = arg->rxed_rate - 2; - } else { - hdr->rate_idx = arg->rxed_rate; - } - - if (!arg->rcpi_rssi) { - hdr->flag |= RX_FLAG_NO_SIGNAL_VAL; - dev_info(wvif->wdev->dev, "received frame without RSSI data\n"); - } - hdr->signal = arg->rcpi_rssi / 2 - 110; - hdr->antenna = 0; - - if (arg->encryp) - hdr->flag |= RX_FLAG_DECRYPTED; - - // Block ack negotiation is offloaded by the firmware. However, - // re-ordering must be done by the mac80211. - if (ieee80211_is_action(frame->frame_control) && - mgmt->u.action.category == WLAN_CATEGORY_BACK && - skb->len > IEEE80211_MIN_ACTION_SIZE) { - wfx_rx_handle_ba(wvif, mgmt); - goto drop; - } - - ieee80211_rx_irqsafe(wvif->wdev->hw, skb); - return; - -drop: - dev_kfree_skb(skb); -} diff --git a/drivers/staging/wfx/data_rx.h b/drivers/staging/wfx/data_rx.h deleted file mode 100644 index 4c0da37f2084..000000000000 --- a/drivers/staging/wfx/data_rx.h +++ /dev/null @@ -1,18 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Datapath implementation. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#ifndef WFX_DATA_RX_H -#define WFX_DATA_RX_H - -struct wfx_vif; -struct sk_buff; -struct hif_ind_rx; - -void wfx_rx_cb(struct wfx_vif *wvif, - const struct hif_ind_rx *arg, struct sk_buff *skb); - -#endif /* WFX_DATA_RX_H */ diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c deleted file mode 100644 index 77fb104efdec..000000000000 --- a/drivers/staging/wfx/data_tx.c +++ /dev/null @@ -1,593 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Datapath implementation. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#include -#include - -#include "data_tx.h" -#include "wfx.h" -#include "bh.h" -#include "sta.h" -#include "queue.h" -#include "debug.h" -#include "traces.h" -#include "hif_tx_mib.h" - -static int wfx_get_hw_rate(struct wfx_dev *wdev, - const struct ieee80211_tx_rate *rate) -{ - struct ieee80211_supported_band *band; - - if (rate->idx < 0) - return -1; - if (rate->flags & IEEE80211_TX_RC_MCS) { - if (rate->idx > 7) { - WARN(1, "wrong rate->idx value: %d", rate->idx); - return -1; - } - return rate->idx + 14; - } - // WFx only support 2GHz, else band information should be retrieved - // from ieee80211_tx_info - band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]; - if (rate->idx >= band->n_bitrates) { - WARN(1, "wrong rate->idx value: %d", rate->idx); - return -1; - } - return band->bitrates[rate->idx].hw_value; -} - -/* TX policy cache implementation */ - -static void wfx_tx_policy_build(struct wfx_vif *wvif, struct tx_policy *policy, - struct ieee80211_tx_rate *rates) -{ - struct wfx_dev *wdev = wvif->wdev; - int i, rateid; - u8 count; - - WARN(rates[0].idx < 0, "invalid rate policy"); - memset(policy, 0, sizeof(*policy)); - for (i = 0; i < IEEE80211_TX_MAX_RATES; ++i) { - if (rates[i].idx < 0) - break; - WARN_ON(rates[i].count > 15); - rateid = wfx_get_hw_rate(wdev, &rates[i]); - // Pack two values in each byte of policy->rates - count = rates[i].count; - if (rateid % 2) - count <<= 4; - policy->rates[rateid / 2] |= count; - } -} - -static bool tx_policy_is_equal(const struct tx_policy *a, - const struct tx_policy *b) -{ - return !memcmp(a->rates, b->rates, sizeof(a->rates)); -} - -static int wfx_tx_policy_find(struct tx_policy_cache *cache, - struct tx_policy *wanted) -{ - struct tx_policy *it; - - list_for_each_entry(it, &cache->used, link) - if (tx_policy_is_equal(wanted, it)) - return it - cache->cache; - list_for_each_entry(it, &cache->free, link) - if (tx_policy_is_equal(wanted, it)) - return it - cache->cache; - return -1; -} - -static void wfx_tx_policy_use(struct tx_policy_cache *cache, - struct tx_policy *entry) -{ - ++entry->usage_count; - list_move(&entry->link, &cache->used); -} - -static int wfx_tx_policy_release(struct tx_policy_cache *cache, - struct tx_policy *entry) -{ - int ret = --entry->usage_count; - - if (!ret) - list_move(&entry->link, &cache->free); - return ret; -} - -static int wfx_tx_policy_get(struct wfx_vif *wvif, - struct ieee80211_tx_rate *rates, bool *renew) -{ - int idx; - struct tx_policy_cache *cache = &wvif->tx_policy_cache; - struct tx_policy wanted; - - wfx_tx_policy_build(wvif, &wanted, rates); - - spin_lock_bh(&cache->lock); - if (list_empty(&cache->free)) { - WARN(1, "unable to get a valid Tx policy"); - spin_unlock_bh(&cache->lock); - return HIF_TX_RETRY_POLICY_INVALID; - } - idx = wfx_tx_policy_find(cache, &wanted); - if (idx >= 0) { - *renew = false; - } else { - struct tx_policy *entry; - *renew = true; - /* If policy is not found create a new one - * using the oldest entry in "free" list - */ - entry = list_entry(cache->free.prev, struct tx_policy, link); - memcpy(entry->rates, wanted.rates, sizeof(entry->rates)); - entry->uploaded = false; - entry->usage_count = 0; - idx = entry - cache->cache; - } - wfx_tx_policy_use(cache, &cache->cache[idx]); - if (list_empty(&cache->free)) - ieee80211_stop_queues(wvif->wdev->hw); - spin_unlock_bh(&cache->lock); - return idx; -} - -static void wfx_tx_policy_put(struct wfx_vif *wvif, int idx) -{ - int usage, locked; - struct tx_policy_cache *cache = &wvif->tx_policy_cache; - - if (idx == HIF_TX_RETRY_POLICY_INVALID) - return; - spin_lock_bh(&cache->lock); - locked = list_empty(&cache->free); - usage = wfx_tx_policy_release(cache, &cache->cache[idx]); - if (locked && !usage) - ieee80211_wake_queues(wvif->wdev->hw); - spin_unlock_bh(&cache->lock); -} - -static int wfx_tx_policy_upload(struct wfx_vif *wvif) -{ - struct tx_policy *policies = wvif->tx_policy_cache.cache; - u8 tmp_rates[12]; - int i, is_used; - - do { - spin_lock_bh(&wvif->tx_policy_cache.lock); - for (i = 0; i < ARRAY_SIZE(wvif->tx_policy_cache.cache); ++i) { - is_used = memzcmp(policies[i].rates, - sizeof(policies[i].rates)); - if (!policies[i].uploaded && is_used) - break; - } - if (i < ARRAY_SIZE(wvif->tx_policy_cache.cache)) { - policies[i].uploaded = true; - memcpy(tmp_rates, policies[i].rates, sizeof(tmp_rates)); - spin_unlock_bh(&wvif->tx_policy_cache.lock); - hif_set_tx_rate_retry_policy(wvif, i, tmp_rates); - } else { - spin_unlock_bh(&wvif->tx_policy_cache.lock); - } - } while (i < ARRAY_SIZE(wvif->tx_policy_cache.cache)); - return 0; -} - -void wfx_tx_policy_upload_work(struct work_struct *work) -{ - struct wfx_vif *wvif = - container_of(work, struct wfx_vif, tx_policy_upload_work); - - wfx_tx_policy_upload(wvif); - wfx_tx_unlock(wvif->wdev); -} - -void wfx_tx_policy_init(struct wfx_vif *wvif) -{ - struct tx_policy_cache *cache = &wvif->tx_policy_cache; - int i; - - memset(cache, 0, sizeof(*cache)); - - spin_lock_init(&cache->lock); - INIT_LIST_HEAD(&cache->used); - INIT_LIST_HEAD(&cache->free); - - for (i = 0; i < ARRAY_SIZE(cache->cache); ++i) - list_add(&cache->cache[i].link, &cache->free); -} - -/* Tx implementation */ - -static bool ieee80211_is_action_back(struct ieee80211_hdr *hdr) -{ - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)hdr; - - if (!ieee80211_is_action(mgmt->frame_control)) - return false; - if (mgmt->u.action.category != WLAN_CATEGORY_BACK) - return false; - return true; -} - -static u8 wfx_tx_get_link_id(struct wfx_vif *wvif, struct ieee80211_sta *sta, - struct ieee80211_hdr *hdr) -{ - struct wfx_sta_priv *sta_priv = - sta ? (struct wfx_sta_priv *)&sta->drv_priv : NULL; - const u8 *da = ieee80211_get_DA(hdr); - - if (sta_priv && sta_priv->link_id) - return sta_priv->link_id; - if (wvif->vif->type != NL80211_IFTYPE_AP) - return 0; - if (is_multicast_ether_addr(da)) - return 0; - return HIF_LINK_ID_NOT_ASSOCIATED; -} - -static void wfx_tx_fixup_rates(struct ieee80211_tx_rate *rates) -{ - int i; - bool finished; - - // Firmware is not able to mix rates with different flags - for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { - if (rates[0].flags & IEEE80211_TX_RC_SHORT_GI) - rates[i].flags |= IEEE80211_TX_RC_SHORT_GI; - if (!(rates[0].flags & IEEE80211_TX_RC_SHORT_GI)) - rates[i].flags &= ~IEEE80211_TX_RC_SHORT_GI; - if (!(rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS)) - rates[i].flags &= ~IEEE80211_TX_RC_USE_RTS_CTS; - } - - // Sort rates and remove duplicates - do { - finished = true; - for (i = 0; i < IEEE80211_TX_MAX_RATES - 1; i++) { - if (rates[i + 1].idx == rates[i].idx && - rates[i].idx != -1) { - rates[i].count += rates[i + 1].count; - if (rates[i].count > 15) - rates[i].count = 15; - rates[i + 1].idx = -1; - rates[i + 1].count = 0; - - finished = false; - } - if (rates[i + 1].idx > rates[i].idx) { - swap(rates[i + 1], rates[i]); - finished = false; - } - } - } while (!finished); - // Ensure that MCS0 or 1Mbps is present at the end of the retry list - for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { - if (rates[i].idx == 0) - break; - if (rates[i].idx == -1) { - rates[i].idx = 0; - rates[i].count = 8; // == hw->max_rate_tries - rates[i].flags = rates[i - 1].flags & - IEEE80211_TX_RC_MCS; - break; - } - } - // All retries use long GI - for (i = 1; i < IEEE80211_TX_MAX_RATES; i++) - rates[i].flags &= ~IEEE80211_TX_RC_SHORT_GI; -} - -static u8 wfx_tx_get_rate_id(struct wfx_vif *wvif, - struct ieee80211_tx_info *tx_info) -{ - bool tx_policy_renew = false; - u8 rate_id; - - rate_id = wfx_tx_policy_get(wvif, - tx_info->driver_rates, &tx_policy_renew); - if (rate_id == HIF_TX_RETRY_POLICY_INVALID) - dev_warn(wvif->wdev->dev, "unable to get a valid Tx policy"); - - if (tx_policy_renew) { - wfx_tx_lock(wvif->wdev); - if (!schedule_work(&wvif->tx_policy_upload_work)) - wfx_tx_unlock(wvif->wdev); - } - return rate_id; -} - -static int wfx_tx_get_frame_format(struct ieee80211_tx_info *tx_info) -{ - if (!(tx_info->driver_rates[0].flags & IEEE80211_TX_RC_MCS)) - return HIF_FRAME_FORMAT_NON_HT; - else if (!(tx_info->driver_rates[0].flags & IEEE80211_TX_RC_GREEN_FIELD)) - return HIF_FRAME_FORMAT_MIXED_FORMAT_HT; - else - return HIF_FRAME_FORMAT_GF_HT_11N; -} - -static int wfx_tx_get_icv_len(struct ieee80211_key_conf *hw_key) -{ - int mic_space; - - if (!hw_key) - return 0; - if (hw_key->cipher == WLAN_CIPHER_SUITE_AES_CMAC) - return 0; - mic_space = (hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) ? 8 : 0; - return hw_key->icv_len + mic_space; -} - -static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, - struct sk_buff *skb) -{ - struct hif_msg *hif_msg; - struct hif_req_tx *req; - struct wfx_tx_priv *tx_priv; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - int queue_id = skb_get_queue_mapping(skb); - size_t offset = (size_t)skb->data & 3; - int wmsg_len = sizeof(struct hif_msg) + - sizeof(struct hif_req_tx) + offset; - - WARN(queue_id >= IEEE80211_NUM_ACS, "unsupported queue_id"); - wfx_tx_fixup_rates(tx_info->driver_rates); - - // From now tx_info->control is unusable - memset(tx_info->rate_driver_data, 0, sizeof(struct wfx_tx_priv)); - // Fill tx_priv - tx_priv = (struct wfx_tx_priv *)tx_info->rate_driver_data; - tx_priv->icv_size = wfx_tx_get_icv_len(hw_key); - - // Fill hif_msg - WARN(skb_headroom(skb) < wmsg_len, "not enough space in skb"); - WARN(offset & 1, "attempt to transmit an unaligned frame"); - skb_put(skb, tx_priv->icv_size); - skb_push(skb, wmsg_len); - memset(skb->data, 0, wmsg_len); - hif_msg = (struct hif_msg *)skb->data; - hif_msg->len = cpu_to_le16(skb->len); - hif_msg->id = HIF_REQ_ID_TX; - hif_msg->interface = wvif->id; - if (skb->len > wvif->wdev->hw_caps.size_inp_ch_buf) { - dev_warn(wvif->wdev->dev, - "requested frame size (%d) is larger than maximum supported (%d)\n", - skb->len, wvif->wdev->hw_caps.size_inp_ch_buf); - skb_pull(skb, wmsg_len); - return -EIO; - } - - // Fill tx request - req = (struct hif_req_tx *)hif_msg->body; - // packet_id just need to be unique on device. 32bits are more than - // necessary for that task, so we tae advantage of it to add some extra - // data for debug. - req->packet_id = atomic_add_return(1, &wvif->wdev->packet_id) & 0xFFFF; - req->packet_id |= IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)) << 16; - req->packet_id |= queue_id << 28; - - req->fc_offset = offset; - if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) - req->after_dtim = 1; - req->peer_sta_id = wfx_tx_get_link_id(wvif, sta, hdr); - // Queue index are inverted between firmware and Linux - req->queue_id = 3 - queue_id; - req->retry_policy_index = wfx_tx_get_rate_id(wvif, tx_info); - req->frame_format = wfx_tx_get_frame_format(tx_info); - if (tx_info->driver_rates[0].flags & IEEE80211_TX_RC_SHORT_GI) - req->short_gi = 1; - - // Auxiliary operations - wfx_tx_queues_put(wvif, skb); - if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) - schedule_work(&wvif->update_tim_work); - wfx_bh_request_tx(wvif->wdev); - return 0; -} - -void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct wfx_dev *wdev = hw->priv; - struct wfx_vif *wvif; - struct ieee80211_sta *sta = control ? control->sta : NULL; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - size_t driver_data_room = sizeof_field(struct ieee80211_tx_info, - rate_driver_data); - - compiletime_assert(sizeof(struct wfx_tx_priv) <= driver_data_room, - "struct tx_priv is too large"); - WARN(skb->next || skb->prev, "skb is already member of a list"); - // control.vif can be NULL for injected frames - if (tx_info->control.vif) - wvif = (struct wfx_vif *)tx_info->control.vif->drv_priv; - else - wvif = wvif_iterate(wdev, NULL); - if (WARN_ON(!wvif)) - goto drop; - // Because of TX_AMPDU_SETUP_IN_HW, mac80211 does not try to send any - // BlockAck session management frame. The check below exist just in case. - if (ieee80211_is_action_back(hdr)) { - dev_info(wdev->dev, "drop BA action\n"); - goto drop; - } - if (wfx_tx_inner(wvif, sta, skb)) - goto drop; - - return; - -drop: - ieee80211_tx_status_irqsafe(wdev->hw, skb); -} - -static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb) -{ - struct hif_msg *hif = (struct hif_msg *)skb->data; - struct hif_req_tx *req = (struct hif_req_tx *)hif->body; - unsigned int offset = sizeof(struct hif_msg) + - sizeof(struct hif_req_tx) + - req->fc_offset; - - if (!wvif) { - pr_warn("%s: vif associated with the skb does not exist anymore\n", __func__); - return; - } - wfx_tx_policy_put(wvif, req->retry_policy_index); - skb_pull(skb, offset); - ieee80211_tx_status_irqsafe(wvif->wdev->hw, skb); -} - -static void wfx_tx_fill_rates(struct wfx_dev *wdev, - struct ieee80211_tx_info *tx_info, - const struct hif_cnf_tx *arg) -{ - struct ieee80211_tx_rate *rate; - int tx_count; - int i; - - tx_count = arg->ack_failures; - if (!arg->status || arg->ack_failures) - tx_count += 1; // Also report success - for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { - rate = &tx_info->status.rates[i]; - if (rate->idx < 0) - break; - if (tx_count < rate->count && - arg->status == HIF_STATUS_TX_FAIL_RETRIES && - arg->ack_failures) - dev_dbg(wdev->dev, "all retries were not consumed: %d != %d\n", - rate->count, tx_count); - if (tx_count <= rate->count && tx_count && - arg->txed_rate != wfx_get_hw_rate(wdev, rate)) - dev_dbg(wdev->dev, "inconsistent tx_info rates: %d != %d\n", - arg->txed_rate, wfx_get_hw_rate(wdev, rate)); - if (tx_count > rate->count) { - tx_count -= rate->count; - } else if (!tx_count) { - rate->count = 0; - rate->idx = -1; - } else { - rate->count = tx_count; - tx_count = 0; - } - } - if (tx_count) - dev_dbg(wdev->dev, "%d more retries than expected\n", tx_count); -} - -void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg) -{ - const struct wfx_tx_priv *tx_priv; - struct ieee80211_tx_info *tx_info; - struct wfx_vif *wvif; - struct sk_buff *skb; - - skb = wfx_pending_get(wdev, arg->packet_id); - if (!skb) { - dev_warn(wdev->dev, "received unknown packet_id (%#.8x) from chip\n", - arg->packet_id); - return; - } - tx_info = IEEE80211_SKB_CB(skb); - tx_priv = wfx_skb_tx_priv(skb); - wvif = wdev_to_wvif(wdev, ((struct hif_msg *)skb->data)->interface); - WARN_ON(!wvif); - if (!wvif) - return; - - // Note that wfx_pending_get_pkt_us_delay() get data from tx_info - _trace_tx_stats(arg, skb, wfx_pending_get_pkt_us_delay(wdev, skb)); - wfx_tx_fill_rates(wdev, tx_info, arg); - skb_trim(skb, skb->len - tx_priv->icv_size); - - // From now, you can touch to tx_info->status, but do not touch to - // tx_priv anymore - // FIXME: use ieee80211_tx_info_clear_status() - memset(tx_info->rate_driver_data, 0, sizeof(tx_info->rate_driver_data)); - memset(tx_info->pad, 0, sizeof(tx_info->pad)); - - if (!arg->status) { - tx_info->status.tx_time = - le32_to_cpu(arg->media_delay) - - le32_to_cpu(arg->tx_queue_delay); - if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) - tx_info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED; - else - tx_info->flags |= IEEE80211_TX_STAT_ACK; - } else if (arg->status == HIF_STATUS_TX_FAIL_REQUEUE) { - WARN(!arg->requeue, "incoherent status and result_flags"); - if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { - wvif->after_dtim_tx_allowed = false; // DTIM period elapsed - schedule_work(&wvif->update_tim_work); - } - tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; - } - wfx_skb_dtor(wvif, skb); -} - -static void wfx_flush_vif(struct wfx_vif *wvif, u32 queues, - struct sk_buff_head *dropped) -{ - struct wfx_queue *queue; - int i; - - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - if (!(BIT(i) & queues)) - continue; - queue = &wvif->tx_queue[i]; - if (dropped) - wfx_tx_queue_drop(wvif, queue, dropped); - } - if (wvif->wdev->chip_frozen) - return; - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - if (!(BIT(i) & queues)) - continue; - queue = &wvif->tx_queue[i]; - if (wait_event_timeout(wvif->wdev->tx_dequeue, - wfx_tx_queue_empty(wvif, queue), - msecs_to_jiffies(1000)) <= 0) - dev_warn(wvif->wdev->dev, - "frames queued while flushing tx queues?"); - } -} - -void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - u32 queues, bool drop) -{ - struct wfx_dev *wdev = hw->priv; - struct sk_buff_head dropped; - struct wfx_vif *wvif; - struct hif_msg *hif; - struct sk_buff *skb; - - skb_queue_head_init(&dropped); - if (vif) { - wvif = (struct wfx_vif *)vif->drv_priv; - wfx_flush_vif(wvif, queues, drop ? &dropped : NULL); - } else { - wvif = NULL; - while ((wvif = wvif_iterate(wdev, wvif)) != NULL) - wfx_flush_vif(wvif, queues, drop ? &dropped : NULL); - } - wfx_tx_flush(wdev); - if (wdev->chip_frozen) - wfx_pending_drop(wdev, &dropped); - while ((skb = skb_dequeue(&dropped)) != NULL) { - hif = (struct hif_msg *)skb->data; - wvif = wdev_to_wvif(wdev, hif->interface); - ieee80211_tx_info_clear_status(IEEE80211_SKB_CB(skb)); - wfx_skb_dtor(wvif, skb); - } -} diff --git a/drivers/staging/wfx/data_tx.h b/drivers/staging/wfx/data_tx.h deleted file mode 100644 index 401363d6b563..000000000000 --- a/drivers/staging/wfx/data_tx.h +++ /dev/null @@ -1,68 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Datapath implementation. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#ifndef WFX_DATA_TX_H -#define WFX_DATA_TX_H - -#include -#include - -#include "hif_api_cmd.h" -#include "hif_api_mib.h" - -struct wfx_tx_priv; -struct wfx_dev; -struct wfx_vif; - -struct tx_policy { - struct list_head link; - int usage_count; - u8 rates[12]; - bool uploaded; -}; - -struct tx_policy_cache { - struct tx_policy cache[HIF_TX_RETRY_POLICY_MAX]; - // FIXME: use a trees and drop hash from tx_policy - struct list_head used; - struct list_head free; - spinlock_t lock; -}; - -struct wfx_tx_priv { - ktime_t xmit_timestamp; - unsigned char icv_size; -}; - -void wfx_tx_policy_init(struct wfx_vif *wvif); -void wfx_tx_policy_upload_work(struct work_struct *work); - -void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, - struct sk_buff *skb); -void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg); -void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - u32 queues, bool drop); - -static inline struct wfx_tx_priv *wfx_skb_tx_priv(struct sk_buff *skb) -{ - struct ieee80211_tx_info *tx_info; - - if (!skb) - return NULL; - tx_info = IEEE80211_SKB_CB(skb); - return (struct wfx_tx_priv *)tx_info->rate_driver_data; -} - -static inline struct hif_req_tx *wfx_skb_txreq(struct sk_buff *skb) -{ - struct hif_msg *hif = (struct hif_msg *)skb->data; - struct hif_req_tx *req = (struct hif_req_tx *)hif->body; - - return req; -} - -#endif /* WFX_DATA_TX_H */ diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c deleted file mode 100644 index eedada78c25f..000000000000 --- a/drivers/staging/wfx/debug.c +++ /dev/null @@ -1,359 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Debugfs interface. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#include -#include -#include - -#include "debug.h" -#include "wfx.h" -#include "sta.h" -#include "main.h" -#include "hif_tx.h" -#include "hif_tx_mib.h" - -#define CREATE_TRACE_POINTS -#include "traces.h" - -static const struct trace_print_flags hif_msg_print_map[] = { - hif_msg_list, -}; - -static const struct trace_print_flags hif_mib_print_map[] = { - hif_mib_list, -}; - -static const struct trace_print_flags wfx_reg_print_map[] = { - wfx_reg_list, -}; - -static const char *get_symbol(unsigned long val, - const struct trace_print_flags *symbol_array) -{ - int i; - - for (i = 0; symbol_array[i].mask != -1; i++) { - if (val == symbol_array[i].mask) - return symbol_array[i].name; - } - - return "unknown"; -} - -const char *get_hif_name(unsigned long id) -{ - return get_symbol(id, hif_msg_print_map); -} - -const char *get_mib_name(unsigned long id) -{ - return get_symbol(id, hif_mib_print_map); -} - -const char *get_reg_name(unsigned long id) -{ - return get_symbol(id, wfx_reg_print_map); -} - -static int wfx_counters_show(struct seq_file *seq, void *v) -{ - int ret, i; - struct wfx_dev *wdev = seq->private; - struct hif_mib_extended_count_table counters[3]; - - for (i = 0; i < ARRAY_SIZE(counters); i++) { - ret = hif_get_counters_table(wdev, i, counters + i); - if (ret < 0) - return ret; - if (ret > 0) - return -EIO; - } - - seq_printf(seq, "%-24s %12s %12s %12s\n", - "", "global", "iface 0", "iface 1"); - -#define PUT_COUNTER(name) \ - seq_printf(seq, "%-24s %12d %12d %12d\n", #name, \ - le32_to_cpu(counters[2].count_##name), \ - le32_to_cpu(counters[0].count_##name), \ - le32_to_cpu(counters[1].count_##name)) - - PUT_COUNTER(tx_packets); - PUT_COUNTER(tx_multicast_frames); - PUT_COUNTER(tx_frames_success); - PUT_COUNTER(tx_frame_failures); - PUT_COUNTER(tx_frames_retried); - PUT_COUNTER(tx_frames_multi_retried); - - PUT_COUNTER(rts_success); - PUT_COUNTER(rts_failures); - PUT_COUNTER(ack_failures); - - PUT_COUNTER(rx_packets); - PUT_COUNTER(rx_frames_success); - PUT_COUNTER(rx_packet_errors); - PUT_COUNTER(plcp_errors); - PUT_COUNTER(fcs_errors); - PUT_COUNTER(rx_decryption_failures); - PUT_COUNTER(rx_mic_failures); - PUT_COUNTER(rx_no_key_failures); - PUT_COUNTER(rx_frame_duplicates); - PUT_COUNTER(rx_multicast_frames); - PUT_COUNTER(rx_cmacicv_errors); - PUT_COUNTER(rx_cmac_replays); - PUT_COUNTER(rx_mgmt_ccmp_replays); - - PUT_COUNTER(rx_beacon); - PUT_COUNTER(miss_beacon); - -#undef PUT_COUNTER - - for (i = 0; i < ARRAY_SIZE(counters[0].reserved); i++) - seq_printf(seq, "reserved[%02d]%12s %12d %12d %12d\n", i, "", - le32_to_cpu(counters[2].reserved[i]), - le32_to_cpu(counters[0].reserved[i]), - le32_to_cpu(counters[1].reserved[i])); - - return 0; -} -DEFINE_SHOW_ATTRIBUTE(wfx_counters); - -static const char * const channel_names[] = { - [0] = "1M", - [1] = "2M", - [2] = "5.5M", - [3] = "11M", - /* Entries 4 and 5 does not exist */ - [6] = "6M", - [7] = "9M", - [8] = "12M", - [9] = "18M", - [10] = "24M", - [11] = "36M", - [12] = "48M", - [13] = "54M", - [14] = "MCS0", - [15] = "MCS1", - [16] = "MCS2", - [17] = "MCS3", - [18] = "MCS4", - [19] = "MCS5", - [20] = "MCS6", - [21] = "MCS7", -}; - -static int wfx_rx_stats_show(struct seq_file *seq, void *v) -{ - struct wfx_dev *wdev = seq->private; - struct hif_rx_stats *st = &wdev->rx_stats; - int i; - - mutex_lock(&wdev->rx_stats_lock); - seq_printf(seq, "Timestamp: %dus\n", st->date); - seq_printf(seq, "Low power clock: frequency %uHz, external %s\n", - le32_to_cpu(st->pwr_clk_freq), - st->is_ext_pwr_clk ? "yes" : "no"); - seq_printf(seq, - "Num. of frames: %d, PER (x10e4): %d, Throughput: %dKbps/s\n", - st->nb_rx_frame, st->per_total, st->throughput); - seq_puts(seq, " Num. of PER RSSI SNR CFO\n"); - seq_puts(seq, " frames (x10e4) (dBm) (dB) (kHz)\n"); - for (i = 0; i < ARRAY_SIZE(channel_names); i++) { - if (channel_names[i]) - seq_printf(seq, "%5s %8d %8d %8d %8d %8d\n", - channel_names[i], - le32_to_cpu(st->nb_rx_by_rate[i]), - le16_to_cpu(st->per[i]), - (s16)le16_to_cpu(st->rssi[i]) / 100, - (s16)le16_to_cpu(st->snr[i]) / 100, - (s16)le16_to_cpu(st->cfo[i])); - } - mutex_unlock(&wdev->rx_stats_lock); - - return 0; -} -DEFINE_SHOW_ATTRIBUTE(wfx_rx_stats); - -static int wfx_tx_power_loop_show(struct seq_file *seq, void *v) -{ - struct wfx_dev *wdev = seq->private; - struct hif_tx_power_loop_info *st = &wdev->tx_power_loop_info; - int tmp; - - mutex_lock(&wdev->tx_power_loop_info_lock); - tmp = le16_to_cpu(st->tx_gain_dig); - seq_printf(seq, "Tx gain digital: %d\n", tmp); - tmp = le16_to_cpu(st->tx_gain_pa); - seq_printf(seq, "Tx gain PA: %d\n", tmp); - tmp = (s16)le16_to_cpu(st->target_pout); - seq_printf(seq, "Target Pout: %d.%02d dBm\n", tmp / 4, (tmp % 4) * 25); - tmp = (s16)le16_to_cpu(st->p_estimation); - seq_printf(seq, "FEM Pout: %d.%02d dBm\n", tmp / 4, (tmp % 4) * 25); - tmp = le16_to_cpu(st->vpdet); - seq_printf(seq, "Vpdet: %d mV\n", tmp); - seq_printf(seq, "Measure index: %d\n", st->measurement_index); - mutex_unlock(&wdev->tx_power_loop_info_lock); - - return 0; -} -DEFINE_SHOW_ATTRIBUTE(wfx_tx_power_loop); - -static ssize_t wfx_send_pds_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wfx_dev *wdev = file->private_data; - char *buf; - int ret; - - if (*ppos != 0) { - dev_dbg(wdev->dev, "PDS data must be written in one transaction"); - return -EBUSY; - } - buf = memdup_user(user_buf, count); - if (IS_ERR(buf)) - return PTR_ERR(buf); - *ppos = *ppos + count; - ret = wfx_send_pds(wdev, buf, count); - kfree(buf); - if (ret < 0) - return ret; - return count; -} - -static const struct file_operations wfx_send_pds_fops = { - .open = simple_open, - .write = wfx_send_pds_write, -}; - -struct dbgfs_hif_msg { - struct wfx_dev *wdev; - struct completion complete; - u8 reply[1024]; - int ret; -}; - -static ssize_t wfx_send_hif_msg_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct dbgfs_hif_msg *context = file->private_data; - struct wfx_dev *wdev = context->wdev; - struct hif_msg *request; - - if (completion_done(&context->complete)) { - dev_dbg(wdev->dev, "read previous result before start a new one\n"); - return -EBUSY; - } - if (count < sizeof(struct hif_msg)) - return -EINVAL; - - // wfx_cmd_send() checks that reply buffer is wide enough, but does not - // return precise length read. User have to know how many bytes should - // be read. Filling reply buffer with a memory pattern may help user. - memset(context->reply, 0xFF, sizeof(context->reply)); - request = memdup_user(user_buf, count); - if (IS_ERR(request)) - return PTR_ERR(request); - if (le16_to_cpu(request->len) != count) { - kfree(request); - return -EINVAL; - } - context->ret = wfx_cmd_send(wdev, request, context->reply, - sizeof(context->reply), false); - - kfree(request); - complete(&context->complete); - return count; -} - -static ssize_t wfx_send_hif_msg_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct dbgfs_hif_msg *context = file->private_data; - int ret; - - if (count > sizeof(context->reply)) - return -EINVAL; - ret = wait_for_completion_interruptible(&context->complete); - if (ret) - return ret; - if (context->ret < 0) - return context->ret; - // Be careful, write() is waiting for a full message while read() - // only returns a payload - if (copy_to_user(user_buf, context->reply, count)) - return -EFAULT; - - return count; -} - -static int wfx_send_hif_msg_open(struct inode *inode, struct file *file) -{ - struct dbgfs_hif_msg *context = kzalloc(sizeof(*context), GFP_KERNEL); - - if (!context) - return -ENOMEM; - context->wdev = inode->i_private; - init_completion(&context->complete); - file->private_data = context; - return 0; -} - -static int wfx_send_hif_msg_release(struct inode *inode, struct file *file) -{ - struct dbgfs_hif_msg *context = file->private_data; - - kfree(context); - return 0; -} - -static const struct file_operations wfx_send_hif_msg_fops = { - .open = wfx_send_hif_msg_open, - .release = wfx_send_hif_msg_release, - .write = wfx_send_hif_msg_write, - .read = wfx_send_hif_msg_read, -}; - -static int wfx_ps_timeout_set(void *data, u64 val) -{ - struct wfx_dev *wdev = (struct wfx_dev *)data; - struct wfx_vif *wvif; - - wdev->force_ps_timeout = val; - wvif = NULL; - while ((wvif = wvif_iterate(wdev, wvif)) != NULL) - wfx_update_pm(wvif); - return 0; -} - -static int wfx_ps_timeout_get(void *data, u64 *val) -{ - struct wfx_dev *wdev = (struct wfx_dev *)data; - - *val = wdev->force_ps_timeout; - return 0; -} - -DEFINE_DEBUGFS_ATTRIBUTE(wfx_ps_timeout_fops, wfx_ps_timeout_get, wfx_ps_timeout_set, "%lld\n"); - -int wfx_debug_init(struct wfx_dev *wdev) -{ - struct dentry *d; - - d = debugfs_create_dir("wfx", wdev->hw->wiphy->debugfsdir); - debugfs_create_file("counters", 0444, d, wdev, &wfx_counters_fops); - debugfs_create_file("rx_stats", 0444, d, wdev, &wfx_rx_stats_fops); - debugfs_create_file("tx_power_loop", 0444, d, wdev, - &wfx_tx_power_loop_fops); - debugfs_create_file("send_pds", 0200, d, wdev, &wfx_send_pds_fops); - debugfs_create_file("send_hif_msg", 0600, d, wdev, - &wfx_send_hif_msg_fops); - debugfs_create_file("ps_timeout", 0600, d, wdev, &wfx_ps_timeout_fops); - - return 0; -} diff --git a/drivers/staging/wfx/debug.h b/drivers/staging/wfx/debug.h deleted file mode 100644 index 6f2f84d64c9e..000000000000 --- a/drivers/staging/wfx/debug.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Debugfs interface. - * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. - * Copyright (c) 2011, ST-Ericsson - */ -#ifndef WFX_DEBUG_H -#define WFX_DEBUG_H - -struct wfx_dev; - -int wfx_debug_init(struct wfx_dev *wdev); - -const char *get_hif_name(unsigned long id); -const char *get_mib_name(unsigned long id); -const char *get_reg_name(unsigned long id); - -#endif /* WFX_DEBUG_H */ diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c deleted file mode 100644 index 1b8aec02d169..000000000000 --- a/drivers/staging/wfx/fwio.c +++ /dev/null @@ -1,405 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Firmware loading. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#include -#include -#include -#include - -#include "fwio.h" -#include "wfx.h" -#include "hwio.h" - -// Addresses below are in SRAM area -#define WFX_DNLD_FIFO 0x09004000 -#define DNLD_BLOCK_SIZE 0x0400 -#define DNLD_FIFO_SIZE 0x8000 // (32 * DNLD_BLOCK_SIZE) -// Download Control Area (DCA) -#define WFX_DCA_IMAGE_SIZE 0x0900C000 -#define WFX_DCA_PUT 0x0900C004 -#define WFX_DCA_GET 0x0900C008 -#define WFX_DCA_HOST_STATUS 0x0900C00C -#define HOST_READY 0x87654321 -#define HOST_INFO_READ 0xA753BD99 -#define HOST_UPLOAD_PENDING 0xABCDDCBA -#define HOST_UPLOAD_COMPLETE 0xD4C64A99 -#define HOST_OK_TO_JUMP 0x174FC882 -#define WFX_DCA_NCP_STATUS 0x0900C010 -#define NCP_NOT_READY 0x12345678 -#define NCP_READY 0x87654321 -#define NCP_INFO_READY 0xBD53EF99 -#define NCP_DOWNLOAD_PENDING 0xABCDDCBA -#define NCP_DOWNLOAD_COMPLETE 0xCAFEFECA -#define NCP_AUTH_OK 0xD4C64A99 -#define NCP_AUTH_FAIL 0x174FC882 -#define NCP_PUB_KEY_RDY 0x7AB41D19 -#define WFX_DCA_FW_SIGNATURE 0x0900C014 -#define FW_SIGNATURE_SIZE 0x40 -#define WFX_DCA_FW_HASH 0x0900C054 -#define FW_HASH_SIZE 0x08 -#define WFX_DCA_FW_VERSION 0x0900C05C -#define FW_VERSION_SIZE 0x04 -#define WFX_DCA_RESERVED 0x0900C060 -#define DCA_RESERVED_SIZE 0x20 -#define WFX_STATUS_INFO 0x0900C080 -#define WFX_BOOTLOADER_LABEL 0x0900C084 -#define BOOTLOADER_LABEL_SIZE 0x3C -#define WFX_PTE_INFO 0x0900C0C0 -#define PTE_INFO_KEYSET_IDX 0x0D -#define PTE_INFO_SIZE 0x10 -#define WFX_ERR_INFO 0x0900C0D0 -#define ERR_INVALID_SEC_TYPE 0x05 -#define ERR_SIG_VERIF_FAILED 0x0F -#define ERR_AES_CTRL_KEY 0x10 -#define ERR_ECC_PUB_KEY 0x11 -#define ERR_MAC_KEY 0x18 - -#define DCA_TIMEOUT 50 // milliseconds -#define WAKEUP_TIMEOUT 200 // milliseconds - -static const char * const fwio_errors[] = { - [ERR_INVALID_SEC_TYPE] = "Invalid section type or wrong encryption", - [ERR_SIG_VERIF_FAILED] = "Signature verification failed", - [ERR_AES_CTRL_KEY] = "AES control key not initialized", - [ERR_ECC_PUB_KEY] = "ECC public key not initialized", - [ERR_MAC_KEY] = "MAC key not initialized", -}; - -/* - * request_firmware() allocate data using vmalloc(). It is not compatible with - * underlying hardware that use DMA. Function below detect this case and - * allocate a bounce buffer if necessary. - * - * Notice that, in doubt, you can enable CONFIG_DEBUG_SG to ask kernel to - * detect this problem at runtime (else, kernel silently fail). - * - * NOTE: it may also be possible to use 'pages' from struct firmware and avoid - * bounce buffer - */ -static int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf, - size_t len) -{ - int ret; - const u8 *tmp; - - if (!virt_addr_valid(buf)) { - tmp = kmemdup(buf, len, GFP_KERNEL); - if (!tmp) - return -ENOMEM; - } else { - tmp = buf; - } - ret = sram_buf_write(wdev, addr, tmp, len); - if (tmp != buf) - kfree(tmp); - return ret; -} - -static int get_firmware(struct wfx_dev *wdev, u32 keyset_chip, - const struct firmware **fw, int *file_offset) -{ - int keyset_file; - char filename[256]; - const char *data; - int ret; - - snprintf(filename, sizeof(filename), "%s_%02X.sec", - wdev->pdata.file_fw, keyset_chip); - ret = firmware_request_nowarn(fw, filename, wdev->dev); - if (ret) { - dev_info(wdev->dev, "can't load %s, falling back to %s.sec\n", - filename, wdev->pdata.file_fw); - snprintf(filename, sizeof(filename), "%s.sec", - wdev->pdata.file_fw); - ret = request_firmware(fw, filename, wdev->dev); - if (ret) { - dev_err(wdev->dev, "can't load %s\n", filename); - *fw = NULL; - return ret; - } - } - - data = (*fw)->data; - if (memcmp(data, "KEYSET", 6) != 0) { - // Legacy firmware format - *file_offset = 0; - keyset_file = 0x90; - } else { - *file_offset = 8; - keyset_file = (hex_to_bin(data[6]) * 16) | hex_to_bin(data[7]); - if (keyset_file < 0) { - dev_err(wdev->dev, "%s corrupted\n", filename); - release_firmware(*fw); - *fw = NULL; - return -EINVAL; - } - } - if (keyset_file != keyset_chip) { - dev_err(wdev->dev, "firmware keyset is incompatible with chip (file: 0x%02X, chip: 0x%02X)\n", - keyset_file, keyset_chip); - release_firmware(*fw); - *fw = NULL; - return -ENODEV; - } - wdev->keyset = keyset_file; - return 0; -} - -static int wait_ncp_status(struct wfx_dev *wdev, u32 status) -{ - ktime_t now, start; - u32 reg; - int ret; - - start = ktime_get(); - for (;;) { - ret = sram_reg_read(wdev, WFX_DCA_NCP_STATUS, ®); - if (ret < 0) - return -EIO; - now = ktime_get(); - if (reg == status) - break; - if (ktime_after(now, ktime_add_ms(start, DCA_TIMEOUT))) - return -ETIMEDOUT; - } - if (ktime_compare(now, start)) - dev_dbg(wdev->dev, "chip answer after %lldus\n", - ktime_us_delta(now, start)); - else - dev_dbg(wdev->dev, "chip answer immediately\n"); - return 0; -} - -static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len) -{ - int ret; - u32 offs, bytes_done = 0; - ktime_t now, start; - - if (len % DNLD_BLOCK_SIZE) { - dev_err(wdev->dev, "firmware size is not aligned. Buffer overrun will occur\n"); - return -EIO; - } - offs = 0; - while (offs < len) { - start = ktime_get(); - for (;;) { - now = ktime_get(); - if (offs + DNLD_BLOCK_SIZE - bytes_done < DNLD_FIFO_SIZE) - break; - if (ktime_after(now, ktime_add_ms(start, DCA_TIMEOUT))) - return -ETIMEDOUT; - ret = sram_reg_read(wdev, WFX_DCA_GET, &bytes_done); - if (ret < 0) - return ret; - } - if (ktime_compare(now, start)) - dev_dbg(wdev->dev, "answer after %lldus\n", - ktime_us_delta(now, start)); - - ret = sram_write_dma_safe(wdev, WFX_DNLD_FIFO + - (offs % DNLD_FIFO_SIZE), - data + offs, DNLD_BLOCK_SIZE); - if (ret < 0) - return ret; - - // WFx seems to not support writing 0 in this register during - // first loop - offs += DNLD_BLOCK_SIZE; - ret = sram_reg_write(wdev, WFX_DCA_PUT, offs); - if (ret < 0) - return ret; - } - return 0; -} - -static void print_boot_status(struct wfx_dev *wdev) -{ - u32 reg; - - sram_reg_read(wdev, WFX_STATUS_INFO, ®); - if (reg == 0x12345678) - return; - sram_reg_read(wdev, WFX_ERR_INFO, ®); - if (reg < ARRAY_SIZE(fwio_errors) && fwio_errors[reg]) - dev_info(wdev->dev, "secure boot: %s\n", fwio_errors[reg]); - else - dev_info(wdev->dev, "secure boot: Error %#02x\n", reg); -} - -static int load_firmware_secure(struct wfx_dev *wdev) -{ - const struct firmware *fw = NULL; - int header_size; - int fw_offset; - ktime_t start; - u8 *buf; - int ret; - - BUILD_BUG_ON(PTE_INFO_SIZE > BOOTLOADER_LABEL_SIZE); - buf = kmalloc(BOOTLOADER_LABEL_SIZE + 1, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_READY); - ret = wait_ncp_status(wdev, NCP_INFO_READY); - if (ret) - goto error; - - sram_buf_read(wdev, WFX_BOOTLOADER_LABEL, buf, BOOTLOADER_LABEL_SIZE); - buf[BOOTLOADER_LABEL_SIZE] = 0; - dev_dbg(wdev->dev, "bootloader: \"%s\"\n", buf); - - sram_buf_read(wdev, WFX_PTE_INFO, buf, PTE_INFO_SIZE); - ret = get_firmware(wdev, buf[PTE_INFO_KEYSET_IDX], &fw, &fw_offset); - if (ret) - goto error; - header_size = fw_offset + FW_SIGNATURE_SIZE + FW_HASH_SIZE; - - sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_INFO_READ); - ret = wait_ncp_status(wdev, NCP_READY); - if (ret) - goto error; - - sram_reg_write(wdev, WFX_DNLD_FIFO, 0xFFFFFFFF); // Fifo init - sram_write_dma_safe(wdev, WFX_DCA_FW_VERSION, "\x01\x00\x00\x00", - FW_VERSION_SIZE); - sram_write_dma_safe(wdev, WFX_DCA_FW_SIGNATURE, fw->data + fw_offset, - FW_SIGNATURE_SIZE); - sram_write_dma_safe(wdev, WFX_DCA_FW_HASH, - fw->data + fw_offset + FW_SIGNATURE_SIZE, - FW_HASH_SIZE); - sram_reg_write(wdev, WFX_DCA_IMAGE_SIZE, fw->size - header_size); - sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_UPLOAD_PENDING); - ret = wait_ncp_status(wdev, NCP_DOWNLOAD_PENDING); - if (ret) - goto error; - - start = ktime_get(); - ret = upload_firmware(wdev, fw->data + header_size, - fw->size - header_size); - if (ret) - goto error; - dev_dbg(wdev->dev, "firmware load after %lldus\n", - ktime_us_delta(ktime_get(), start)); - - sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_UPLOAD_COMPLETE); - ret = wait_ncp_status(wdev, NCP_AUTH_OK); - // Legacy ROM support - if (ret < 0) - ret = wait_ncp_status(wdev, NCP_PUB_KEY_RDY); - if (ret < 0) - goto error; - sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_OK_TO_JUMP); - -error: - kfree(buf); - if (fw) - release_firmware(fw); - if (ret) - print_boot_status(wdev); - return ret; -} - -static int init_gpr(struct wfx_dev *wdev) -{ - int ret, i; - static const struct { - int index; - u32 value; - } gpr_init[] = { - { 0x07, 0x208775 }, - { 0x08, 0x2EC020 }, - { 0x09, 0x3C3C3C }, - { 0x0B, 0x322C44 }, - { 0x0C, 0xA06497 }, - }; - - for (i = 0; i < ARRAY_SIZE(gpr_init); i++) { - ret = igpr_reg_write(wdev, gpr_init[i].index, - gpr_init[i].value); - if (ret < 0) - return ret; - dev_dbg(wdev->dev, " index %02x: %08x\n", - gpr_init[i].index, gpr_init[i].value); - } - return 0; -} - -int wfx_init_device(struct wfx_dev *wdev) -{ - int ret; - int hw_revision, hw_type; - int wakeup_timeout = 50; // ms - ktime_t now, start; - u32 reg; - - reg = CFG_DIRECT_ACCESS_MODE | CFG_CPU_RESET | CFG_BYTE_ORDER_ABCD; - if (wdev->pdata.use_rising_clk) - reg |= CFG_CLK_RISE_EDGE; - ret = config_reg_write(wdev, reg); - if (ret < 0) { - dev_err(wdev->dev, "bus returned an error during first write access. Host configuration error?\n"); - return -EIO; - } - - ret = config_reg_read(wdev, ®); - if (ret < 0) { - dev_err(wdev->dev, "bus returned an error during first read access. Bus configuration error?\n"); - return -EIO; - } - if (reg == 0 || reg == ~0) { - dev_err(wdev->dev, "chip mute. Bus configuration error or chip wasn't reset?\n"); - return -EIO; - } - dev_dbg(wdev->dev, "initial config register value: %08x\n", reg); - - hw_revision = FIELD_GET(CFG_DEVICE_ID_MAJOR, reg); - if (hw_revision == 0) { - dev_err(wdev->dev, "bad hardware revision number: %d\n", - hw_revision); - return -ENODEV; - } - hw_type = FIELD_GET(CFG_DEVICE_ID_TYPE, reg); - if (hw_type == 1) { - dev_notice(wdev->dev, "development hardware detected\n"); - wakeup_timeout = 2000; - } - - ret = init_gpr(wdev); - if (ret < 0) - return ret; - - ret = control_reg_write(wdev, CTRL_WLAN_WAKEUP); - if (ret < 0) - return -EIO; - start = ktime_get(); - for (;;) { - ret = control_reg_read(wdev, ®); - now = ktime_get(); - if (reg & CTRL_WLAN_READY) - break; - if (ktime_after(now, ktime_add_ms(start, wakeup_timeout))) { - dev_err(wdev->dev, "chip didn't wake up. Chip wasn't reset?\n"); - return -ETIMEDOUT; - } - } - dev_dbg(wdev->dev, "chip wake up after %lldus\n", - ktime_us_delta(now, start)); - - ret = config_reg_write_bits(wdev, CFG_CPU_RESET, 0); - if (ret < 0) - return ret; - ret = load_firmware_secure(wdev); - if (ret < 0) - return ret; - return config_reg_write_bits(wdev, - CFG_DIRECT_ACCESS_MODE | - CFG_IRQ_ENABLE_DATA | - CFG_IRQ_ENABLE_WRDY, - CFG_IRQ_ENABLE_DATA); -} diff --git a/drivers/staging/wfx/fwio.h b/drivers/staging/wfx/fwio.h deleted file mode 100644 index 6028f92503fe..000000000000 --- a/drivers/staging/wfx/fwio.h +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Firmware loading. - * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#ifndef WFX_FWIO_H -#define WFX_FWIO_H - -struct wfx_dev; - -int wfx_init_device(struct wfx_dev *wdev); - -#endif /* WFX_FWIO_H */ diff --git a/drivers/staging/wfx/hif_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h deleted file mode 100644 index 58c9bb036011..000000000000 --- a/drivers/staging/wfx/hif_api_cmd.h +++ /dev/null @@ -1,553 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* - * WFx hardware interface definitions - * - * Copyright (c) 2018-2020, Silicon Laboratories Inc. - */ - -#ifndef WFX_HIF_API_CMD_H -#define WFX_HIF_API_CMD_H - -#include - -#include "hif_api_general.h" - -enum hif_requests_ids { - HIF_REQ_ID_RESET = 0x0a, - HIF_REQ_ID_READ_MIB = 0x05, - HIF_REQ_ID_WRITE_MIB = 0x06, - HIF_REQ_ID_START_SCAN = 0x07, - HIF_REQ_ID_STOP_SCAN = 0x08, - HIF_REQ_ID_TX = 0x04, - HIF_REQ_ID_JOIN = 0x0b, - HIF_REQ_ID_SET_PM_MODE = 0x10, - HIF_REQ_ID_SET_BSS_PARAMS = 0x11, - HIF_REQ_ID_ADD_KEY = 0x0c, - HIF_REQ_ID_REMOVE_KEY = 0x0d, - HIF_REQ_ID_EDCA_QUEUE_PARAMS = 0x13, - HIF_REQ_ID_START = 0x17, - HIF_REQ_ID_BEACON_TRANSMIT = 0x18, - HIF_REQ_ID_UPDATE_IE = 0x1b, - HIF_REQ_ID_MAP_LINK = 0x1c, -}; - -enum hif_confirmations_ids { - HIF_CNF_ID_RESET = 0x0a, - HIF_CNF_ID_READ_MIB = 0x05, - HIF_CNF_ID_WRITE_MIB = 0x06, - HIF_CNF_ID_START_SCAN = 0x07, - HIF_CNF_ID_STOP_SCAN = 0x08, - HIF_CNF_ID_TX = 0x04, - HIF_CNF_ID_MULTI_TRANSMIT = 0x1e, - HIF_CNF_ID_JOIN = 0x0b, - HIF_CNF_ID_SET_PM_MODE = 0x10, - HIF_CNF_ID_SET_BSS_PARAMS = 0x11, - HIF_CNF_ID_ADD_KEY = 0x0c, - HIF_CNF_ID_REMOVE_KEY = 0x0d, - HIF_CNF_ID_EDCA_QUEUE_PARAMS = 0x13, - HIF_CNF_ID_START = 0x17, - HIF_CNF_ID_BEACON_TRANSMIT = 0x18, - HIF_CNF_ID_UPDATE_IE = 0x1b, - HIF_CNF_ID_MAP_LINK = 0x1c, -}; - -enum hif_indications_ids { - HIF_IND_ID_RX = 0x84, - HIF_IND_ID_SCAN_CMPL = 0x86, - HIF_IND_ID_JOIN_COMPLETE = 0x8f, - HIF_IND_ID_SET_PM_MODE_CMPL = 0x89, - HIF_IND_ID_SUSPEND_RESUME_TX = 0x8c, - HIF_IND_ID_EVENT = 0x85 -}; - -struct hif_req_reset { - u8 reset_stat:1; - u8 reset_all_int:1; - u8 reserved1:6; - u8 reserved2[3]; -} __packed; - -struct hif_cnf_reset { - __le32 status; -} __packed; - -struct hif_req_read_mib { - __le16 mib_id; - __le16 reserved; -} __packed; - -struct hif_cnf_read_mib { - __le32 status; - __le16 mib_id; - __le16 length; - u8 mib_data[]; -} __packed; - -struct hif_req_write_mib { - __le16 mib_id; - __le16 length; - u8 mib_data[]; -} __packed; - -struct hif_cnf_write_mib { - __le32 status; -} __packed; - -struct hif_req_update_ie { - u8 beacon:1; - u8 probe_resp:1; - u8 probe_req:1; - u8 reserved1:5; - u8 reserved2; - __le16 num_ies; - u8 ie[]; -} __packed; - -struct hif_cnf_update_ie { - __le32 status; -} __packed; - -struct hif_ssid_def { - __le32 ssid_length; - u8 ssid[IEEE80211_MAX_SSID_LEN]; -} __packed; - -#define HIF_API_MAX_NB_SSIDS 2 -#define HIF_API_MAX_NB_CHANNELS 14 - -struct hif_req_start_scan_alt { - u8 band; - u8 maintain_current_bss:1; - u8 periodic:1; - u8 reserved1:6; - u8 disallow_ps:1; - u8 reserved2:1; - u8 short_preamble:1; - u8 reserved3:5; - u8 max_transmit_rate; - __le16 periodic_interval; - u8 reserved4; - s8 periodic_rssi_thr; - u8 num_of_probe_requests; - u8 probe_delay; - u8 num_of_ssids; - u8 num_of_channels; - __le32 min_channel_time; - __le32 max_channel_time; - __le32 tx_power_level; // signed value - struct hif_ssid_def ssid_def[HIF_API_MAX_NB_SSIDS]; - u8 channel_list[]; -} __packed; - -struct hif_cnf_start_scan { - __le32 status; -} __packed; - -struct hif_cnf_stop_scan { - __le32 status; -} __packed; - -enum hif_pm_mode_status { - HIF_PM_MODE_ACTIVE = 0x0, - HIF_PM_MODE_PS = 0x1, - HIF_PM_MODE_UNDETERMINED = 0x2 -}; - -struct hif_ind_scan_cmpl { - __le32 status; - u8 pm_mode; - u8 num_channels_completed; - __le16 reserved; -} __packed; - -enum hif_queue_id { - HIF_QUEUE_ID_BACKGROUND = 0x0, - HIF_QUEUE_ID_BESTEFFORT = 0x1, - HIF_QUEUE_ID_VIDEO = 0x2, - HIF_QUEUE_ID_VOICE = 0x3 -}; - -enum hif_frame_format { - HIF_FRAME_FORMAT_NON_HT = 0x0, - HIF_FRAME_FORMAT_MIXED_FORMAT_HT = 0x1, - HIF_FRAME_FORMAT_GF_HT_11N = 0x2 -}; - -struct hif_req_tx { - // packet_id is not interpreted by the device, so it is not necessary to - // declare it little endian - u32 packet_id; - u8 max_tx_rate; - u8 queue_id:2; - u8 peer_sta_id:4; - u8 reserved1:2; - u8 more:1; - u8 fc_offset:3; - u8 after_dtim:1; - u8 reserved2:3; - u8 start_exp:1; - u8 reserved3:3; - u8 retry_policy_index:4; - __le32 reserved4; - __le32 expire_time; - u8 frame_format:4; - u8 fec_coding:1; - u8 short_gi:1; - u8 reserved5:1; - u8 stbc:1; - u8 reserved6; - u8 aggregation:1; - u8 reserved7:7; - u8 reserved8; - u8 frame[]; -} __packed; - -enum hif_qos_ackplcy { - HIF_QOS_ACKPLCY_NORMAL = 0x0, - HIF_QOS_ACKPLCY_TXNOACK = 0x1, - HIF_QOS_ACKPLCY_NOEXPACK = 0x2, - HIF_QOS_ACKPLCY_BLCKACK = 0x3 -}; - -struct hif_cnf_tx { - __le32 status; - // packet_id is copied from struct hif_req_tx without been interpreted - // by the device, so it is not necessary to declare it little endian - u32 packet_id; - u8 txed_rate; - u8 ack_failures; - u8 aggr:1; - u8 requeue:1; - u8 ack_policy:2; - u8 txop_limit:1; - u8 reserved1:3; - u8 reserved2; - __le32 media_delay; - __le32 tx_queue_delay; -} __packed; - -struct hif_cnf_multi_transmit { - u8 num_tx_confs; - u8 reserved[3]; - struct hif_cnf_tx tx_conf_payload[]; -} __packed; - -enum hif_ri_flags_encrypt { - HIF_RI_FLAGS_UNENCRYPTED = 0x0, - HIF_RI_FLAGS_WEP_ENCRYPTED = 0x1, - HIF_RI_FLAGS_TKIP_ENCRYPTED = 0x2, - HIF_RI_FLAGS_AES_ENCRYPTED = 0x3, - HIF_RI_FLAGS_WAPI_ENCRYPTED = 0x4 -}; - -struct hif_ind_rx { - __le32 status; - u8 channel_number; - u8 reserved1; - u8 rxed_rate; - u8 rcpi_rssi; - u8 encryp:3; - u8 in_aggr:1; - u8 first_aggr:1; - u8 last_aggr:1; - u8 defrag:1; - u8 beacon:1; - u8 tim:1; - u8 bitmap:1; - u8 match_ssid:1; - u8 match_bssid:1; - u8 more:1; - u8 reserved2:1; - u8 ht:1; - u8 stbc:1; - u8 match_uc_addr:1; - u8 match_mc_addr:1; - u8 match_bc_addr:1; - u8 key_type:1; - u8 key_index:4; - u8 reserved3:1; - u8 peer_sta_id:4; - u8 reserved4:2; - u8 reserved5:1; - u8 frame[]; -} __packed; - -struct hif_req_edca_queue_params { - u8 queue_id; - u8 reserved1; - u8 aifsn; - u8 reserved2; - __le16 cw_min; - __le16 cw_max; - __le16 tx_op_limit; - __le16 allowed_medium_time; - __le32 reserved3; -} __packed; - -struct hif_cnf_edca_queue_params { - __le32 status; -} __packed; - -struct hif_req_join { - u8 infrastructure_bss_mode:1; - u8 reserved1:7; - u8 band; - u8 channel_number; - u8 reserved2; - u8 bssid[ETH_ALEN]; - __le16 atim_window; - u8 short_preamble:1; - u8 reserved3:7; - u8 probe_for_join; - u8 reserved4; - u8 reserved5:2; - u8 force_no_beacon:1; - u8 force_with_ind:1; - u8 reserved6:4; - __le32 ssid_length; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - __le32 beacon_interval; - __le32 basic_rate_set; -} __packed; - -struct hif_cnf_join { - __le32 status; -} __packed; - -struct hif_ind_join_complete { - __le32 status; -} __packed; - -struct hif_req_set_bss_params { - u8 lost_count_only:1; - u8 reserved:7; - u8 beacon_lost_count; - __le16 aid; - __le32 operational_rate_set; -} __packed; - -struct hif_cnf_set_bss_params { - __le32 status; -} __packed; - -struct hif_req_set_pm_mode { - u8 enter_psm:1; - u8 reserved:6; - u8 fast_psm:1; - u8 fast_psm_idle_period; - u8 ap_psm_change_period; - u8 min_auto_ps_poll_period; -} __packed; - -struct hif_cnf_set_pm_mode { - __le32 status; -} __packed; - -struct hif_ind_set_pm_mode_cmpl { - __le32 status; - u8 pm_mode; - u8 reserved[3]; -} __packed; - -struct hif_req_start { - u8 mode; - u8 band; - u8 channel_number; - u8 reserved1; - __le32 reserved2; - __le32 beacon_interval; - u8 dtim_period; - u8 short_preamble:1; - u8 reserved3:7; - u8 reserved4; - u8 ssid_length; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - __le32 basic_rate_set; -} __packed; - -struct hif_cnf_start { - __le32 status; -} __packed; - -struct hif_req_beacon_transmit { - u8 enable_beaconing; - u8 reserved[3]; -} __packed; - -struct hif_cnf_beacon_transmit { - __le32 status; -} __packed; - -#define HIF_LINK_ID_MAX 14 -#define HIF_LINK_ID_NOT_ASSOCIATED (HIF_LINK_ID_MAX + 1) - -struct hif_req_map_link { - u8 mac_addr[ETH_ALEN]; - u8 unmap:1; - u8 mfpc:1; - u8 reserved:6; - u8 peer_sta_id; -} __packed; - -struct hif_cnf_map_link { - __le32 status; -} __packed; - -struct hif_ind_suspend_resume_tx { - u8 resume:1; - u8 reserved1:2; - u8 bc_mc_only:1; - u8 reserved2:4; - u8 reserved3; - __le16 peer_sta_set; -} __packed; - - -#define MAX_KEY_ENTRIES 24 -#define HIF_API_WEP_KEY_DATA_SIZE 16 -#define HIF_API_TKIP_KEY_DATA_SIZE 16 -#define HIF_API_RX_MIC_KEY_SIZE 8 -#define HIF_API_TX_MIC_KEY_SIZE 8 -#define HIF_API_AES_KEY_DATA_SIZE 16 -#define HIF_API_WAPI_KEY_DATA_SIZE 16 -#define HIF_API_MIC_KEY_DATA_SIZE 16 -#define HIF_API_IGTK_KEY_DATA_SIZE 16 -#define HIF_API_RX_SEQUENCE_COUNTER_SIZE 8 -#define HIF_API_IPN_SIZE 8 - -enum hif_key_type { - HIF_KEY_TYPE_WEP_DEFAULT = 0x0, - HIF_KEY_TYPE_WEP_PAIRWISE = 0x1, - HIF_KEY_TYPE_TKIP_GROUP = 0x2, - HIF_KEY_TYPE_TKIP_PAIRWISE = 0x3, - HIF_KEY_TYPE_AES_GROUP = 0x4, - HIF_KEY_TYPE_AES_PAIRWISE = 0x5, - HIF_KEY_TYPE_WAPI_GROUP = 0x6, - HIF_KEY_TYPE_WAPI_PAIRWISE = 0x7, - HIF_KEY_TYPE_IGTK_GROUP = 0x8, - HIF_KEY_TYPE_NONE = 0x9 -}; - -struct hif_wep_pairwise_key { - u8 peer_address[ETH_ALEN]; - u8 reserved; - u8 key_length; - u8 key_data[HIF_API_WEP_KEY_DATA_SIZE]; -} __packed; - -struct hif_wep_group_key { - u8 key_id; - u8 key_length; - u8 reserved[2]; - u8 key_data[HIF_API_WEP_KEY_DATA_SIZE]; -} __packed; - -struct hif_tkip_pairwise_key { - u8 peer_address[ETH_ALEN]; - u8 reserved[2]; - u8 tkip_key_data[HIF_API_TKIP_KEY_DATA_SIZE]; - u8 rx_mic_key[HIF_API_RX_MIC_KEY_SIZE]; - u8 tx_mic_key[HIF_API_TX_MIC_KEY_SIZE]; -} __packed; - -struct hif_tkip_group_key { - u8 tkip_key_data[HIF_API_TKIP_KEY_DATA_SIZE]; - u8 rx_mic_key[HIF_API_RX_MIC_KEY_SIZE]; - u8 key_id; - u8 reserved[3]; - u8 rx_sequence_counter[HIF_API_RX_SEQUENCE_COUNTER_SIZE]; -} __packed; - -struct hif_aes_pairwise_key { - u8 peer_address[ETH_ALEN]; - u8 reserved[2]; - u8 aes_key_data[HIF_API_AES_KEY_DATA_SIZE]; -} __packed; - -struct hif_aes_group_key { - u8 aes_key_data[HIF_API_AES_KEY_DATA_SIZE]; - u8 key_id; - u8 reserved[3]; - u8 rx_sequence_counter[HIF_API_RX_SEQUENCE_COUNTER_SIZE]; -} __packed; - -struct hif_wapi_pairwise_key { - u8 peer_address[ETH_ALEN]; - u8 key_id; - u8 reserved; - u8 wapi_key_data[HIF_API_WAPI_KEY_DATA_SIZE]; - u8 mic_key_data[HIF_API_MIC_KEY_DATA_SIZE]; -} __packed; - -struct hif_wapi_group_key { - u8 wapi_key_data[HIF_API_WAPI_KEY_DATA_SIZE]; - u8 mic_key_data[HIF_API_MIC_KEY_DATA_SIZE]; - u8 key_id; - u8 reserved[3]; -} __packed; - -struct hif_igtk_group_key { - u8 igtk_key_data[HIF_API_IGTK_KEY_DATA_SIZE]; - u8 key_id; - u8 reserved[3]; - u8 ipn[HIF_API_IPN_SIZE]; -} __packed; - -struct hif_req_add_key { - u8 type; - u8 entry_index; - u8 int_id:2; - u8 reserved1:6; - u8 reserved2; - union { - struct hif_wep_pairwise_key wep_pairwise_key; - struct hif_wep_group_key wep_group_key; - struct hif_tkip_pairwise_key tkip_pairwise_key; - struct hif_tkip_group_key tkip_group_key; - struct hif_aes_pairwise_key aes_pairwise_key; - struct hif_aes_group_key aes_group_key; - struct hif_wapi_pairwise_key wapi_pairwise_key; - struct hif_wapi_group_key wapi_group_key; - struct hif_igtk_group_key igtk_group_key; - } key; -} __packed; - -struct hif_cnf_add_key { - __le32 status; -} __packed; - -struct hif_req_remove_key { - u8 entry_index; - u8 reserved[3]; -} __packed; - -struct hif_cnf_remove_key { - __le32 status; -} __packed; - -enum hif_event_ind { - HIF_EVENT_IND_BSSLOST = 0x1, - HIF_EVENT_IND_BSSREGAINED = 0x2, - HIF_EVENT_IND_RCPI_RSSI = 0x3, - HIF_EVENT_IND_PS_MODE_ERROR = 0x4, - HIF_EVENT_IND_INACTIVITY = 0x5 -}; - -enum hif_ps_mode_error { - HIF_PS_ERROR_NO_ERROR = 0, - HIF_PS_ERROR_AP_NOT_RESP_TO_POLL = 1, - HIF_PS_ERROR_AP_NOT_RESP_TO_UAPSD_TRIGGER = 2, - HIF_PS_ERROR_AP_SENT_UNICAST_IN_DOZE = 3, - HIF_PS_ERROR_AP_NO_DATA_AFTER_TIM = 4 -}; - -struct hif_ind_event { - __le32 event_id; - union { - u8 rcpi_rssi; - __le32 ps_mode_error; - __le32 peer_sta_set; - } event_data; -} __packed; - -#endif diff --git a/drivers/staging/wfx/hif_api_general.h b/drivers/staging/wfx/hif_api_general.h deleted file mode 100644 index 24188945718d..000000000000 --- a/drivers/staging/wfx/hif_api_general.h +++ /dev/null @@ -1,267 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* - * WFx hardware interface definitions - * - * Copyright (c) 2018-2020, Silicon Laboratories Inc. - */ - -#ifndef WFX_HIF_API_GENERAL_H -#define WFX_HIF_API_GENERAL_H - -#ifdef __KERNEL__ -#include -#include -#else -#include -#include -#define __packed __attribute__((__packed__)) -#endif - -#define HIF_ID_IS_INDICATION 0x80 -#define HIF_COUNTER_MAX 7 - -struct hif_msg { - __le16 len; - u8 id; - u8 reserved:1; - u8 interface:2; - u8 seqnum:3; - u8 encrypted:2; - u8 body[]; -} __packed; - -enum hif_general_requests_ids { - HIF_REQ_ID_CONFIGURATION = 0x09, - HIF_REQ_ID_CONTROL_GPIO = 0x26, - HIF_REQ_ID_SET_SL_MAC_KEY = 0x27, - HIF_REQ_ID_SL_EXCHANGE_PUB_KEYS = 0x28, - HIF_REQ_ID_SL_CONFIGURE = 0x29, - HIF_REQ_ID_PREVENT_ROLLBACK = 0x2a, - HIF_REQ_ID_PTA_SETTINGS = 0x2b, - HIF_REQ_ID_PTA_PRIORITY = 0x2c, - HIF_REQ_ID_PTA_STATE = 0x2d, - HIF_REQ_ID_SHUT_DOWN = 0x32, -}; - -enum hif_general_confirmations_ids { - HIF_CNF_ID_CONFIGURATION = 0x09, - HIF_CNF_ID_CONTROL_GPIO = 0x26, - HIF_CNF_ID_SET_SL_MAC_KEY = 0x27, - HIF_CNF_ID_SL_EXCHANGE_PUB_KEYS = 0x28, - HIF_CNF_ID_SL_CONFIGURE = 0x29, - HIF_CNF_ID_PREVENT_ROLLBACK = 0x2a, - HIF_CNF_ID_PTA_SETTINGS = 0x2b, - HIF_CNF_ID_PTA_PRIORITY = 0x2c, - HIF_CNF_ID_PTA_STATE = 0x2d, - HIF_CNF_ID_SHUT_DOWN = 0x32, -}; - -enum hif_general_indications_ids { - HIF_IND_ID_EXCEPTION = 0xe0, - HIF_IND_ID_STARTUP = 0xe1, - HIF_IND_ID_WAKEUP = 0xe2, - HIF_IND_ID_GENERIC = 0xe3, - HIF_IND_ID_ERROR = 0xe4, - HIF_IND_ID_SL_EXCHANGE_PUB_KEYS = 0xe5 -}; - -#define HIF_STATUS_SUCCESS (cpu_to_le32(0x0000)) -#define HIF_STATUS_FAIL (cpu_to_le32(0x0001)) -#define HIF_STATUS_INVALID_PARAMETER (cpu_to_le32(0x0002)) -#define HIF_STATUS_WARNING (cpu_to_le32(0x0003)) -#define HIF_STATUS_UNKNOWN_REQUEST (cpu_to_le32(0x0004)) -#define HIF_STATUS_RX_FAIL_DECRYPT (cpu_to_le32(0x0010)) -#define HIF_STATUS_RX_FAIL_MIC (cpu_to_le32(0x0011)) -#define HIF_STATUS_RX_FAIL_NO_KEY (cpu_to_le32(0x0012)) -#define HIF_STATUS_TX_FAIL_RETRIES (cpu_to_le32(0x0013)) -#define HIF_STATUS_TX_FAIL_TIMEOUT (cpu_to_le32(0x0014)) -#define HIF_STATUS_TX_FAIL_REQUEUE (cpu_to_le32(0x0015)) -#define HIF_STATUS_REFUSED (cpu_to_le32(0x0016)) -#define HIF_STATUS_BUSY (cpu_to_le32(0x0017)) -#define HIF_STATUS_SLK_SET_KEY_SUCCESS (cpu_to_le32(0x005A)) -#define HIF_STATUS_SLK_SET_KEY_ALREADY_BURNED (cpu_to_le32(0x006B)) -#define HIF_STATUS_SLK_SET_KEY_DISALLOWED_MODE (cpu_to_le32(0x007C)) -#define HIF_STATUS_SLK_SET_KEY_UNKNOWN_MODE (cpu_to_le32(0x008D)) -#define HIF_STATUS_SLK_NEGO_SUCCESS (cpu_to_le32(0x009E)) -#define HIF_STATUS_SLK_NEGO_FAILED (cpu_to_le32(0x00AF)) -#define HIF_STATUS_ROLLBACK_SUCCESS (cpu_to_le32(0x1234)) -#define HIF_STATUS_ROLLBACK_FAIL (cpu_to_le32(0x1256)) - -enum hif_api_rate_index { - API_RATE_INDEX_B_1MBPS = 0, - API_RATE_INDEX_B_2MBPS = 1, - API_RATE_INDEX_B_5P5MBPS = 2, - API_RATE_INDEX_B_11MBPS = 3, - API_RATE_INDEX_PBCC_22MBPS = 4, - API_RATE_INDEX_PBCC_33MBPS = 5, - API_RATE_INDEX_G_6MBPS = 6, - API_RATE_INDEX_G_9MBPS = 7, - API_RATE_INDEX_G_12MBPS = 8, - API_RATE_INDEX_G_18MBPS = 9, - API_RATE_INDEX_G_24MBPS = 10, - API_RATE_INDEX_G_36MBPS = 11, - API_RATE_INDEX_G_48MBPS = 12, - API_RATE_INDEX_G_54MBPS = 13, - API_RATE_INDEX_N_6P5MBPS = 14, - API_RATE_INDEX_N_13MBPS = 15, - API_RATE_INDEX_N_19P5MBPS = 16, - API_RATE_INDEX_N_26MBPS = 17, - API_RATE_INDEX_N_39MBPS = 18, - API_RATE_INDEX_N_52MBPS = 19, - API_RATE_INDEX_N_58P5MBPS = 20, - API_RATE_INDEX_N_65MBPS = 21, - API_RATE_NUM_ENTRIES = 22 -}; - -enum hif_fw_type { - HIF_FW_TYPE_ETF = 0x0, - HIF_FW_TYPE_WFM = 0x1, - HIF_FW_TYPE_WSM = 0x2 -}; - -struct hif_ind_startup { - // As the others, this struct is interpreted as little endian by the - // device. However, this struct is also used by the driver. We prefer to - // declare it in native order and doing byte swap on reception. - __le32 status; - u16 hardware_id; - u8 opn[14]; - u8 uid[8]; - u16 num_inp_ch_bufs; - u16 size_inp_ch_buf; - u8 num_links_ap; - u8 num_interfaces; - u8 mac_addr[2][ETH_ALEN]; - u8 api_version_minor; - u8 api_version_major; - u8 link_mode:2; - u8 reserved1:6; - u8 reserved2; - u8 reserved3; - u8 reserved4; - u8 firmware_build; - u8 firmware_minor; - u8 firmware_major; - u8 firmware_type; - u8 disabled_channel_list[2]; - u8 region_sel_mode:4; - u8 reserved5:4; - u8 phy1_region:3; - u8 phy0_region:3; - u8 otp_phy_ver:2; - u32 supported_rate_mask; - u8 firmware_label[128]; -} __packed; - -struct hif_ind_wakeup { -} __packed; - -struct hif_req_configuration { - __le16 length; - u8 pds_data[]; -} __packed; - -struct hif_cnf_configuration { - __le32 status; -} __packed; - -enum hif_gpio_mode { - HIF_GPIO_MODE_D0 = 0x0, - HIF_GPIO_MODE_D1 = 0x1, - HIF_GPIO_MODE_OD0 = 0x2, - HIF_GPIO_MODE_OD1 = 0x3, - HIF_GPIO_MODE_TRISTATE = 0x4, - HIF_GPIO_MODE_TOGGLE = 0x5, - HIF_GPIO_MODE_READ = 0x6 -}; - -struct hif_req_control_gpio { - u8 gpio_label; - u8 gpio_mode; -} __packed; - -struct hif_cnf_control_gpio { - __le32 status; - __le32 value; -} __packed; - -enum hif_generic_indication_type { - HIF_GENERIC_INDICATION_TYPE_RAW = 0x0, - HIF_GENERIC_INDICATION_TYPE_STRING = 0x1, - HIF_GENERIC_INDICATION_TYPE_RX_STATS = 0x2, - HIF_GENERIC_INDICATION_TYPE_TX_POWER_LOOP_INFO = 0x3, -}; - -struct hif_rx_stats { - __le32 nb_rx_frame; - __le32 nb_crc_frame; - __le32 per_total; - __le32 throughput; - __le32 nb_rx_by_rate[API_RATE_NUM_ENTRIES]; - __le16 per[API_RATE_NUM_ENTRIES]; - __le16 snr[API_RATE_NUM_ENTRIES]; // signed value - __le16 rssi[API_RATE_NUM_ENTRIES]; // signed value - __le16 cfo[API_RATE_NUM_ENTRIES]; // signed value - __le32 date; - __le32 pwr_clk_freq; - u8 is_ext_pwr_clk; - s8 current_temp; -} __packed; - -struct hif_tx_power_loop_info { - __le16 tx_gain_dig; - __le16 tx_gain_pa; - __le16 target_pout; // signed value - __le16 p_estimation; // signed value - __le16 vpdet; - u8 measurement_index; - u8 reserved; -} __packed; - -struct hif_ind_generic { - __le32 type; - union { - struct hif_rx_stats rx_stats; - struct hif_tx_power_loop_info tx_power_loop_info; - } data; -} __packed; - -enum hif_error { - HIF_ERROR_FIRMWARE_ROLLBACK = 0x00, - HIF_ERROR_FIRMWARE_DEBUG_ENABLED = 0x01, - HIF_ERROR_SLK_OUTDATED_SESSION_KEY = 0x02, - HIF_ERROR_SLK_SESSION_KEY = 0x03, - HIF_ERROR_OOR_VOLTAGE = 0x04, - HIF_ERROR_PDS_PAYLOAD = 0x05, - HIF_ERROR_OOR_TEMPERATURE = 0x06, - HIF_ERROR_SLK_REQ_DURING_KEY_EXCHANGE = 0x07, - HIF_ERROR_SLK_MULTI_TX_UNSUPPORTED = 0x08, - HIF_ERROR_SLK_OVERFLOW = 0x09, - HIF_ERROR_SLK_DECRYPTION = 0x0a, - HIF_ERROR_SLK_WRONG_ENCRYPTION_STATE = 0x0b, - HIF_ERROR_HIF_BUS_FREQUENCY_TOO_LOW = 0x0c, - HIF_ERROR_HIF_RX_DATA_TOO_LARGE = 0x0e, - HIF_ERROR_HIF_TX_QUEUE_FULL = 0x0d, - HIF_ERROR_HIF_BUS = 0x0f, - HIF_ERROR_PDS_TESTFEATURE = 0x10, - HIF_ERROR_SLK_UNCONFIGURED = 0x11, -}; - -struct hif_ind_error { - __le32 type; - u8 data[]; -} __packed; - -struct hif_ind_exception { - __le32 type; - u8 data[]; -} __packed; - -enum hif_secure_link_state { - SEC_LINK_UNAVAILABLE = 0x0, - SEC_LINK_RESERVED = 0x1, - SEC_LINK_EVAL = 0x2, - SEC_LINK_ENFORCED = 0x3 -}; - -#endif diff --git a/drivers/staging/wfx/hif_api_mib.h b/drivers/staging/wfx/hif_api_mib.h deleted file mode 100644 index ace924720ce6..000000000000 --- a/drivers/staging/wfx/hif_api_mib.h +++ /dev/null @@ -1,343 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* - * WFx hardware interface definitions - * - * Copyright (c) 2018-2020, Silicon Laboratories Inc. - */ - -#ifndef WFX_HIF_API_MIB_H -#define WFX_HIF_API_MIB_H - -#include "hif_api_general.h" - -#define HIF_API_IPV4_ADDRESS_SIZE 4 -#define HIF_API_IPV6_ADDRESS_SIZE 16 - -enum hif_mib_ids { - HIF_MIB_ID_GL_OPERATIONAL_POWER_MODE = 0x2000, - HIF_MIB_ID_GL_BLOCK_ACK_INFO = 0x2001, - HIF_MIB_ID_GL_SET_MULTI_MSG = 0x2002, - HIF_MIB_ID_CCA_CONFIG = 0x2003, - HIF_MIB_ID_ETHERTYPE_DATAFRAME_CONDITION = 0x2010, - HIF_MIB_ID_PORT_DATAFRAME_CONDITION = 0x2011, - HIF_MIB_ID_MAGIC_DATAFRAME_CONDITION = 0x2012, - HIF_MIB_ID_MAC_ADDR_DATAFRAME_CONDITION = 0x2013, - HIF_MIB_ID_IPV4_ADDR_DATAFRAME_CONDITION = 0x2014, - HIF_MIB_ID_IPV6_ADDR_DATAFRAME_CONDITION = 0x2015, - HIF_MIB_ID_UC_MC_BC_DATAFRAME_CONDITION = 0x2016, - HIF_MIB_ID_CONFIG_DATA_FILTER = 0x2017, - HIF_MIB_ID_SET_DATA_FILTERING = 0x2018, - HIF_MIB_ID_ARP_IP_ADDRESSES_TABLE = 0x2019, - HIF_MIB_ID_NS_IP_ADDRESSES_TABLE = 0x201A, - HIF_MIB_ID_RX_FILTER = 0x201B, - HIF_MIB_ID_BEACON_FILTER_TABLE = 0x201C, - HIF_MIB_ID_BEACON_FILTER_ENABLE = 0x201D, - HIF_MIB_ID_GRP_SEQ_COUNTER = 0x2030, - HIF_MIB_ID_TSF_COUNTER = 0x2031, - HIF_MIB_ID_STATISTICS_TABLE = 0x2032, - HIF_MIB_ID_COUNTERS_TABLE = 0x2033, - HIF_MIB_ID_MAX_TX_POWER_LEVEL = 0x2034, - HIF_MIB_ID_EXTENDED_COUNTERS_TABLE = 0x2035, - HIF_MIB_ID_DOT11_MAC_ADDRESS = 0x2040, - HIF_MIB_ID_DOT11_MAX_TRANSMIT_MSDU_LIFETIME = 0x2041, - HIF_MIB_ID_DOT11_MAX_RECEIVE_LIFETIME = 0x2042, - HIF_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID = 0x2043, - HIF_MIB_ID_DOT11_RTS_THRESHOLD = 0x2044, - HIF_MIB_ID_SLOT_TIME = 0x2045, - HIF_MIB_ID_CURRENT_TX_POWER_LEVEL = 0x2046, - HIF_MIB_ID_NON_ERP_PROTECTION = 0x2047, - HIF_MIB_ID_TEMPLATE_FRAME = 0x2048, - HIF_MIB_ID_BEACON_WAKEUP_PERIOD = 0x2049, - HIF_MIB_ID_RCPI_RSSI_THRESHOLD = 0x204A, - HIF_MIB_ID_BLOCK_ACK_POLICY = 0x204B, - HIF_MIB_ID_OVERRIDE_INTERNAL_TX_RATE = 0x204C, - HIF_MIB_ID_SET_ASSOCIATION_MODE = 0x204D, - HIF_MIB_ID_SET_UAPSD_INFORMATION = 0x204E, - HIF_MIB_ID_SET_TX_RATE_RETRY_POLICY = 0x204F, - HIF_MIB_ID_PROTECTED_MGMT_POLICY = 0x2050, - HIF_MIB_ID_SET_HT_PROTECTION = 0x2051, - HIF_MIB_ID_KEEP_ALIVE_PERIOD = 0x2052, - HIF_MIB_ID_ARP_KEEP_ALIVE_PERIOD = 0x2053, - HIF_MIB_ID_INACTIVITY_TIMER = 0x2054, - HIF_MIB_ID_INTERFACE_PROTECTION = 0x2055, - HIF_MIB_ID_BEACON_STATS = 0x2056, -}; - -enum hif_op_power_mode { - HIF_OP_POWER_MODE_ACTIVE = 0x0, - HIF_OP_POWER_MODE_DOZE = 0x1, - HIF_OP_POWER_MODE_QUIESCENT = 0x2 -}; - -struct hif_mib_gl_operational_power_mode { - u8 power_mode:4; - u8 reserved1:3; - u8 wup_ind_activation:1; - u8 reserved2[3]; -} __packed; - -struct hif_mib_gl_set_multi_msg { - u8 enable_multi_tx_conf:1; - u8 reserved1:7; - u8 reserved2[3]; -} __packed; - -enum hif_arp_ns_frame_treatment { - HIF_ARP_NS_FILTERING_DISABLE = 0x0, - HIF_ARP_NS_FILTERING_ENABLE = 0x1, - HIF_ARP_NS_REPLY_ENABLE = 0x2 -}; - -struct hif_mib_arp_ip_addr_table { - u8 condition_idx; - u8 arp_enable; - u8 reserved[2]; - u8 ipv4_address[HIF_API_IPV4_ADDRESS_SIZE]; -} __packed; - -struct hif_mib_rx_filter { - u8 reserved1:1; - u8 bssid_filter:1; - u8 reserved2:1; - u8 fwd_probe_req:1; - u8 keep_alive_filter:1; - u8 reserved3:3; - u8 reserved4[3]; -} __packed; - -struct hif_ie_table_entry { - u8 ie_id; - u8 has_changed:1; - u8 no_longer:1; - u8 has_appeared:1; - u8 reserved:1; - u8 num_match_data:4; - u8 oui[3]; - u8 match_data[3]; -} __packed; - -struct hif_mib_bcn_filter_table { - __le32 num_of_info_elmts; - struct hif_ie_table_entry ie_table[]; -} __packed; - -enum hif_beacon_filter { - HIF_BEACON_FILTER_DISABLE = 0x0, - HIF_BEACON_FILTER_ENABLE = 0x1, - HIF_BEACON_FILTER_AUTO_ERP = 0x2 -}; - -struct hif_mib_bcn_filter_enable { - __le32 enable; - __le32 bcn_count; -} __packed; - -struct hif_mib_extended_count_table { - __le32 count_plcp_errors; - __le32 count_fcs_errors; - __le32 count_tx_packets; - __le32 count_rx_packets; - __le32 count_rx_packet_errors; - __le32 count_rx_decryption_failures; - __le32 count_rx_mic_failures; - __le32 count_rx_no_key_failures; - __le32 count_tx_multicast_frames; - __le32 count_tx_frames_success; - __le32 count_tx_frame_failures; - __le32 count_tx_frames_retried; - __le32 count_tx_frames_multi_retried; - __le32 count_rx_frame_duplicates; - __le32 count_rts_success; - __le32 count_rts_failures; - __le32 count_ack_failures; - __le32 count_rx_multicast_frames; - __le32 count_rx_frames_success; - __le32 count_rx_cmacicv_errors; - __le32 count_rx_cmac_replays; - __le32 count_rx_mgmt_ccmp_replays; - __le32 count_rx_bipmic_errors; - __le32 count_rx_beacon; - __le32 count_miss_beacon; - __le32 reserved[15]; -} __packed; - -struct hif_mib_count_table { - __le32 count_plcp_errors; - __le32 count_fcs_errors; - __le32 count_tx_packets; - __le32 count_rx_packets; - __le32 count_rx_packet_errors; - __le32 count_rx_decryption_failures; - __le32 count_rx_mic_failures; - __le32 count_rx_no_key_failures; - __le32 count_tx_multicast_frames; - __le32 count_tx_frames_success; - __le32 count_tx_frame_failures; - __le32 count_tx_frames_retried; - __le32 count_tx_frames_multi_retried; - __le32 count_rx_frame_duplicates; - __le32 count_rts_success; - __le32 count_rts_failures; - __le32 count_ack_failures; - __le32 count_rx_multicast_frames; - __le32 count_rx_frames_success; - __le32 count_rx_cmacicv_errors; - __le32 count_rx_cmac_replays; - __le32 count_rx_mgmt_ccmp_replays; - __le32 count_rx_bipmic_errors; -} __packed; - -struct hif_mib_mac_address { - u8 mac_addr[ETH_ALEN]; - __le16 reserved; -} __packed; - -struct hif_mib_wep_default_key_id { - u8 wep_default_key_id; - u8 reserved[3]; -} __packed; - -struct hif_mib_dot11_rts_threshold { - __le32 threshold; -} __packed; - -struct hif_mib_slot_time { - __le32 slot_time; -} __packed; - -struct hif_mib_current_tx_power_level { - __le32 power_level; // signed value -} __packed; - -struct hif_mib_non_erp_protection { - u8 use_cts_to_self:1; - u8 reserved1:7; - u8 reserved2[3]; -} __packed; - -enum hif_tmplt { - HIF_TMPLT_PRBREQ = 0x0, - HIF_TMPLT_BCN = 0x1, - HIF_TMPLT_NULL = 0x2, - HIF_TMPLT_QOSNUL = 0x3, - HIF_TMPLT_PSPOLL = 0x4, - HIF_TMPLT_PRBRES = 0x5, - HIF_TMPLT_ARP = 0x6, - HIF_TMPLT_NA = 0x7 -}; - -#define HIF_API_MAX_TEMPLATE_FRAME_SIZE 700 - -struct hif_mib_template_frame { - u8 frame_type; - u8 init_rate:7; - u8 mode:1; - __le16 frame_length; - u8 frame[]; -} __packed; - -struct hif_mib_beacon_wake_up_period { - u8 wakeup_period_min; - u8 receive_dtim:1; - u8 reserved1:7; - u8 wakeup_period_max; - u8 reserved2; -} __packed; - -struct hif_mib_rcpi_rssi_threshold { - u8 detection:1; - u8 rcpi_rssi:1; - u8 upperthresh:1; - u8 lowerthresh:1; - u8 reserved:4; - u8 lower_threshold; - u8 upper_threshold; - u8 rolling_average_count; -} __packed; - -#define DEFAULT_BA_MAX_RX_BUFFER_SIZE 16 - -struct hif_mib_block_ack_policy { - u8 block_ack_tx_tid_policy; - u8 reserved1; - u8 block_ack_rx_tid_policy; - u8 block_ack_rx_max_buffer_size; -} __packed; - -enum hif_mpdu_start_spacing { - HIF_MPDU_START_SPACING_NO_RESTRIC = 0x0, - HIF_MPDU_START_SPACING_QUARTER = 0x1, - HIF_MPDU_START_SPACING_HALF = 0x2, - HIF_MPDU_START_SPACING_ONE = 0x3, - HIF_MPDU_START_SPACING_TWO = 0x4, - HIF_MPDU_START_SPACING_FOUR = 0x5, - HIF_MPDU_START_SPACING_EIGHT = 0x6, - HIF_MPDU_START_SPACING_SIXTEEN = 0x7 -}; - -struct hif_mib_set_association_mode { - u8 preambtype_use:1; - u8 mode:1; - u8 rateset:1; - u8 spacing:1; - u8 reserved1:4; - u8 short_preamble:1; - u8 reserved2:7; - u8 greenfield:1; - u8 reserved3:7; - u8 mpdu_start_spacing; - __le32 basic_rate_set; -} __packed; - -struct hif_mib_set_uapsd_information { - u8 trig_bckgrnd:1; - u8 trig_be:1; - u8 trig_video:1; - u8 trig_voice:1; - u8 reserved1:4; - u8 deliv_bckgrnd:1; - u8 deliv_be:1; - u8 deliv_video:1; - u8 deliv_voice:1; - u8 reserved2:4; - __le16 min_auto_trigger_interval; - __le16 max_auto_trigger_interval; - __le16 auto_trigger_step; -} __packed; - -struct hif_tx_rate_retry_policy { - u8 policy_index; - u8 short_retry_count; - u8 long_retry_count; - u8 first_rate_sel:2; - u8 terminate:1; - u8 count_init:1; - u8 reserved1:4; - u8 rate_recovery_count; - u8 reserved2[3]; - u8 rates[12]; -} __packed; - -#define HIF_TX_RETRY_POLICY_MAX 15 -#define HIF_TX_RETRY_POLICY_INVALID HIF_TX_RETRY_POLICY_MAX - -struct hif_mib_set_tx_rate_retry_policy { - u8 num_tx_rate_policies; - u8 reserved[3]; - struct hif_tx_rate_retry_policy tx_rate_retry_policy[]; -} __packed; - -struct hif_mib_protected_mgmt_policy { - u8 pmf_enable:1; - u8 unpmf_allowed:1; - u8 host_enc_auth_frames:1; - u8 reserved1:5; - u8 reserved2[3]; -} __packed; - -struct hif_mib_keep_alive_period { - __le16 keep_alive_period; - u8 reserved[2]; -} __packed; - -#endif diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c deleted file mode 100644 index 9fca7f26372a..000000000000 --- a/drivers/staging/wfx/hif_rx.c +++ /dev/null @@ -1,415 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Implementation of chip-to-host event (aka indications) of WFxxx Split Mac - * (WSM) API. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#include -#include - -#include "hif_rx.h" -#include "wfx.h" -#include "scan.h" -#include "bh.h" -#include "sta.h" -#include "data_rx.h" -#include "hif_api_cmd.h" - -static int hif_generic_confirm(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) -{ - // All confirm messages start with status - int status = le32_to_cpup((__le32 *)buf); - int cmd = hif->id; - int len = le16_to_cpu(hif->len) - 4; // drop header - - WARN(!mutex_is_locked(&wdev->hif_cmd.lock), "data locking error"); - - if (!wdev->hif_cmd.buf_send) { - dev_warn(wdev->dev, "unexpected confirmation: 0x%.2x\n", cmd); - return -EINVAL; - } - - if (cmd != wdev->hif_cmd.buf_send->id) { - dev_warn(wdev->dev, - "chip response mismatch request: 0x%.2x vs 0x%.2x\n", - cmd, wdev->hif_cmd.buf_send->id); - return -EINVAL; - } - - if (wdev->hif_cmd.buf_recv) { - if (wdev->hif_cmd.len_recv >= len && len > 0) - memcpy(wdev->hif_cmd.buf_recv, buf, len); - else - status = -EIO; - } - wdev->hif_cmd.ret = status; - - complete(&wdev->hif_cmd.done); - return status; -} - -static int hif_tx_confirm(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) -{ - const struct hif_cnf_tx *body = buf; - - wfx_tx_confirm_cb(wdev, body); - return 0; -} - -static int hif_multi_tx_confirm(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) -{ - const struct hif_cnf_multi_transmit *body = buf; - int i; - - WARN(body->num_tx_confs <= 0, "corrupted message"); - for (i = 0; i < body->num_tx_confs; i++) - wfx_tx_confirm_cb(wdev, &body->tx_conf_payload[i]); - return 0; -} - -static int hif_startup_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) -{ - const struct hif_ind_startup *body = buf; - - if (body->status || body->firmware_type > 4) { - dev_err(wdev->dev, "received invalid startup indication"); - return -EINVAL; - } - memcpy(&wdev->hw_caps, body, sizeof(struct hif_ind_startup)); - le16_to_cpus((__le16 *)&wdev->hw_caps.hardware_id); - le16_to_cpus((__le16 *)&wdev->hw_caps.num_inp_ch_bufs); - le16_to_cpus((__le16 *)&wdev->hw_caps.size_inp_ch_buf); - le32_to_cpus((__le32 *)&wdev->hw_caps.supported_rate_mask); - - complete(&wdev->firmware_ready); - return 0; -} - -static int hif_wakeup_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) -{ - if (!wdev->pdata.gpio_wakeup || - gpiod_get_value(wdev->pdata.gpio_wakeup) == 0) { - dev_warn(wdev->dev, "unexpected wake-up indication\n"); - return -EIO; - } - return 0; -} - -static int hif_receive_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, - const void *buf, struct sk_buff *skb) -{ - struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); - const struct hif_ind_rx *body = buf; - - if (!wvif) { - dev_warn(wdev->dev, "%s: ignore rx data for non-existent vif %d\n", - __func__, hif->interface); - return -EIO; - } - skb_pull(skb, sizeof(struct hif_msg) + sizeof(struct hif_ind_rx)); - wfx_rx_cb(wvif, body, skb); - - return 0; -} - -static int hif_event_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) -{ - struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); - const struct hif_ind_event *body = buf; - int type = le32_to_cpu(body->event_id); - - if (!wvif) { - dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); - return -EIO; - } - - switch (type) { - case HIF_EVENT_IND_RCPI_RSSI: - wfx_event_report_rssi(wvif, body->event_data.rcpi_rssi); - break; - case HIF_EVENT_IND_BSSLOST: - schedule_delayed_work(&wvif->beacon_loss_work, 0); - break; - case HIF_EVENT_IND_BSSREGAINED: - cancel_delayed_work(&wvif->beacon_loss_work); - dev_dbg(wdev->dev, "ignore BSSREGAINED indication\n"); - break; - case HIF_EVENT_IND_PS_MODE_ERROR: - dev_warn(wdev->dev, "error while processing power save request: %d\n", - le32_to_cpu(body->event_data.ps_mode_error)); - break; - default: - dev_warn(wdev->dev, "unhandled event indication: %.2x\n", - type); - break; - } - return 0; -} - -static int hif_pm_mode_complete_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, - const void *buf) -{ - struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); - - if (!wvif) { - dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); - return -EIO; - } - complete(&wvif->set_pm_mode_complete); - - return 0; -} - -static int hif_scan_complete_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, - const void *buf) -{ - struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); - - if (!wvif) { - dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); - return -EIO; - } - - wfx_scan_complete(wvif); - - return 0; -} - -static int hif_join_complete_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, - const void *buf) -{ - struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); - - if (!wvif) { - dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); - return -EIO; - } - dev_warn(wdev->dev, "unattended JoinCompleteInd\n"); - - return 0; -} - -static int hif_suspend_resume_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, - const void *buf) -{ - const struct hif_ind_suspend_resume_tx *body = buf; - struct wfx_vif *wvif; - - if (body->bc_mc_only) { - wvif = wdev_to_wvif(wdev, hif->interface); - if (!wvif) { - dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); - return -EIO; - } - if (body->resume) - wfx_suspend_resume_mc(wvif, STA_NOTIFY_AWAKE); - else - wfx_suspend_resume_mc(wvif, STA_NOTIFY_SLEEP); - } else { - WARN(body->peer_sta_set, "misunderstood indication"); - WARN(hif->interface != 2, "misunderstood indication"); - if (body->resume) - wfx_suspend_hot_dev(wdev, STA_NOTIFY_AWAKE); - else - wfx_suspend_hot_dev(wdev, STA_NOTIFY_SLEEP); - } - - return 0; -} - -static int hif_generic_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) -{ - const struct hif_ind_generic *body = buf; - int type = le32_to_cpu(body->type); - - switch (type) { - case HIF_GENERIC_INDICATION_TYPE_RAW: - return 0; - case HIF_GENERIC_INDICATION_TYPE_STRING: - dev_info(wdev->dev, "firmware says: %s\n", (char *)&body->data); - return 0; - case HIF_GENERIC_INDICATION_TYPE_RX_STATS: - mutex_lock(&wdev->rx_stats_lock); - // Older firmware send a generic indication beside RxStats - if (!wfx_api_older_than(wdev, 1, 4)) - dev_info(wdev->dev, "Rx test ongoing. Temperature: %d degrees C\n", - body->data.rx_stats.current_temp); - memcpy(&wdev->rx_stats, &body->data.rx_stats, - sizeof(wdev->rx_stats)); - mutex_unlock(&wdev->rx_stats_lock); - return 0; - case HIF_GENERIC_INDICATION_TYPE_TX_POWER_LOOP_INFO: - mutex_lock(&wdev->tx_power_loop_info_lock); - memcpy(&wdev->tx_power_loop_info, - &body->data.tx_power_loop_info, - sizeof(wdev->tx_power_loop_info)); - mutex_unlock(&wdev->tx_power_loop_info_lock); - return 0; - default: - dev_err(wdev->dev, "generic_indication: unknown indication type: %#.8x\n", - type); - return -EIO; - } -} - -static const struct { - int val; - const char *str; - bool has_param; -} hif_errors[] = { - { HIF_ERROR_FIRMWARE_ROLLBACK, - "rollback status" }, - { HIF_ERROR_FIRMWARE_DEBUG_ENABLED, - "debug feature enabled" }, - { HIF_ERROR_PDS_PAYLOAD, - "PDS version is not supported" }, - { HIF_ERROR_PDS_TESTFEATURE, - "PDS ask for an unknown test mode" }, - { HIF_ERROR_OOR_VOLTAGE, - "out-of-range power supply voltage", true }, - { HIF_ERROR_OOR_TEMPERATURE, - "out-of-range temperature", true }, - { HIF_ERROR_SLK_REQ_DURING_KEY_EXCHANGE, - "secure link does not expect request during key exchange" }, - { HIF_ERROR_SLK_SESSION_KEY, - "secure link session key is invalid" }, - { HIF_ERROR_SLK_OVERFLOW, - "secure link overflow" }, - { HIF_ERROR_SLK_WRONG_ENCRYPTION_STATE, - "secure link messages list does not match message encryption" }, - { HIF_ERROR_SLK_UNCONFIGURED, - "secure link not yet configured" }, - { HIF_ERROR_HIF_BUS_FREQUENCY_TOO_LOW, - "bus clock is too slow (<1kHz)" }, - { HIF_ERROR_HIF_RX_DATA_TOO_LARGE, - "HIF message too large" }, - // Following errors only exists in old firmware versions: - { HIF_ERROR_HIF_TX_QUEUE_FULL, - "HIF messages queue is full" }, - { HIF_ERROR_HIF_BUS, - "HIF bus" }, - { HIF_ERROR_SLK_MULTI_TX_UNSUPPORTED, - "secure link does not support multi-tx confirmations" }, - { HIF_ERROR_SLK_OUTDATED_SESSION_KEY, - "secure link session key is outdated" }, - { HIF_ERROR_SLK_DECRYPTION, - "secure link params (nonce or tag) mismatch" }, -}; - -static int hif_error_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) -{ - const struct hif_ind_error *body = buf; - int type = le32_to_cpu(body->type); - int param = (s8)body->data[0]; - int i; - - for (i = 0; i < ARRAY_SIZE(hif_errors); i++) - if (type == hif_errors[i].val) - break; - if (i < ARRAY_SIZE(hif_errors)) - if (hif_errors[i].has_param) - dev_err(wdev->dev, "asynchronous error: %s: %d\n", - hif_errors[i].str, param); - else - dev_err(wdev->dev, "asynchronous error: %s\n", - hif_errors[i].str); - else - dev_err(wdev->dev, "asynchronous error: unknown: %08x\n", type); - print_hex_dump(KERN_INFO, "hif: ", DUMP_PREFIX_OFFSET, - 16, 1, hif, le16_to_cpu(hif->len), false); - wdev->chip_frozen = true; - - return 0; -}; - -static int hif_exception_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) -{ - const struct hif_ind_exception *body = buf; - int type = le32_to_cpu(body->type); - - if (type == 4) - dev_err(wdev->dev, "firmware assert %d\n", - le32_to_cpup((__le32 *)body->data)); - else - dev_err(wdev->dev, "firmware exception\n"); - print_hex_dump(KERN_INFO, "hif: ", DUMP_PREFIX_OFFSET, - 16, 1, hif, le16_to_cpu(hif->len), false); - wdev->chip_frozen = true; - - return -1; -} - -static const struct { - int msg_id; - int (*handler)(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf); -} hif_handlers[] = { - /* Confirmations */ - { HIF_CNF_ID_TX, hif_tx_confirm }, - { HIF_CNF_ID_MULTI_TRANSMIT, hif_multi_tx_confirm }, - /* Indications */ - { HIF_IND_ID_STARTUP, hif_startup_indication }, - { HIF_IND_ID_WAKEUP, hif_wakeup_indication }, - { HIF_IND_ID_JOIN_COMPLETE, hif_join_complete_indication }, - { HIF_IND_ID_SET_PM_MODE_CMPL, hif_pm_mode_complete_indication }, - { HIF_IND_ID_SCAN_CMPL, hif_scan_complete_indication }, - { HIF_IND_ID_SUSPEND_RESUME_TX, hif_suspend_resume_indication }, - { HIF_IND_ID_EVENT, hif_event_indication }, - { HIF_IND_ID_GENERIC, hif_generic_indication }, - { HIF_IND_ID_ERROR, hif_error_indication }, - { HIF_IND_ID_EXCEPTION, hif_exception_indication }, - // FIXME: allocate skb_p from hif_receive_indication and make it generic - //{ HIF_IND_ID_RX, hif_receive_indication }, -}; - -void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb) -{ - int i; - const struct hif_msg *hif = (const struct hif_msg *)skb->data; - int hif_id = hif->id; - - if (hif_id == HIF_IND_ID_RX) { - // hif_receive_indication take care of skb lifetime - hif_receive_indication(wdev, hif, hif->body, skb); - return; - } - // Note: mutex_is_lock cause an implicit memory barrier that protect - // buf_send - if (mutex_is_locked(&wdev->hif_cmd.lock) && - wdev->hif_cmd.buf_send && - wdev->hif_cmd.buf_send->id == hif_id) { - hif_generic_confirm(wdev, hif, hif->body); - goto free; - } - for (i = 0; i < ARRAY_SIZE(hif_handlers); i++) { - if (hif_handlers[i].msg_id == hif_id) { - if (hif_handlers[i].handler) - hif_handlers[i].handler(wdev, hif, hif->body); - goto free; - } - } - if (hif_id & 0x80) - dev_err(wdev->dev, "unsupported HIF indication: ID %02x\n", - hif_id); - else - dev_err(wdev->dev, "unexpected HIF confirmation: ID %02x\n", - hif_id); -free: - dev_kfree_skb(skb); -} diff --git a/drivers/staging/wfx/hif_rx.h b/drivers/staging/wfx/hif_rx.h deleted file mode 100644 index f07c10c8c6bd..000000000000 --- a/drivers/staging/wfx/hif_rx.h +++ /dev/null @@ -1,18 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Implementation of chip-to-host event (aka indications) of WFxxx Split Mac - * (WSM) API. - * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - * Copyright (C) 2010, ST-Ericsson SA - */ -#ifndef WFX_HIF_RX_H -#define WFX_HIF_RX_H - -struct wfx_dev; -struct sk_buff; - -void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb); - -#endif diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c deleted file mode 100644 index 63b437261eb7..000000000000 --- a/drivers/staging/wfx/hif_tx.c +++ /dev/null @@ -1,523 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Implementation of host-to-chip commands (aka request/confirmation) of WFxxx - * Split Mac (WSM) API. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#include - -#include "hif_tx.h" -#include "wfx.h" -#include "bh.h" -#include "hwio.h" -#include "debug.h" -#include "sta.h" - -void wfx_init_hif_cmd(struct wfx_hif_cmd *hif_cmd) -{ - init_completion(&hif_cmd->ready); - init_completion(&hif_cmd->done); - mutex_init(&hif_cmd->lock); -} - -static void wfx_fill_header(struct hif_msg *hif, int if_id, - unsigned int cmd, size_t size) -{ - if (if_id == -1) - if_id = 2; - - WARN(cmd > 0x3f, "invalid WSM command %#.2x", cmd); - WARN(size > 0xFFF, "requested buffer is too large: %zu bytes", size); - WARN(if_id > 0x3, "invalid interface ID %d", if_id); - - hif->len = cpu_to_le16(size + 4); - hif->id = cmd; - hif->interface = if_id; -} - -static void *wfx_alloc_hif(size_t body_len, struct hif_msg **hif) -{ - *hif = kzalloc(sizeof(struct hif_msg) + body_len, GFP_KERNEL); - if (*hif) - return (*hif)->body; - else - return NULL; -} - -int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request, - void *reply, size_t reply_len, bool no_reply) -{ - const char *mib_name = ""; - const char *mib_sep = ""; - int cmd = request->id; - int vif = request->interface; - int ret; - - // Do not wait for any reply if chip is frozen - if (wdev->chip_frozen) - return -ETIMEDOUT; - - mutex_lock(&wdev->hif_cmd.lock); - WARN(wdev->hif_cmd.buf_send, "data locking error"); - - // Note: call to complete() below has an implicit memory barrier that - // hopefully protect buf_send - wdev->hif_cmd.buf_send = request; - wdev->hif_cmd.buf_recv = reply; - wdev->hif_cmd.len_recv = reply_len; - complete(&wdev->hif_cmd.ready); - - wfx_bh_request_tx(wdev); - - if (no_reply) { - // Chip won't reply. Give enough time to the wq to send the - // buffer. - msleep(100); - wdev->hif_cmd.buf_send = NULL; - mutex_unlock(&wdev->hif_cmd.lock); - return 0; - } - - if (wdev->poll_irq) - wfx_bh_poll_irq(wdev); - - ret = wait_for_completion_timeout(&wdev->hif_cmd.done, 1 * HZ); - if (!ret) { - dev_err(wdev->dev, "chip is abnormally long to answer\n"); - reinit_completion(&wdev->hif_cmd.ready); - ret = wait_for_completion_timeout(&wdev->hif_cmd.done, 3 * HZ); - } - if (!ret) { - dev_err(wdev->dev, "chip did not answer\n"); - wfx_pending_dump_old_frames(wdev, 3000); - wdev->chip_frozen = true; - reinit_completion(&wdev->hif_cmd.done); - ret = -ETIMEDOUT; - } else { - ret = wdev->hif_cmd.ret; - } - - wdev->hif_cmd.buf_send = NULL; - mutex_unlock(&wdev->hif_cmd.lock); - - if (ret && - (cmd == HIF_REQ_ID_READ_MIB || cmd == HIF_REQ_ID_WRITE_MIB)) { - mib_name = get_mib_name(((u16 *)request)[2]); - mib_sep = "/"; - } - if (ret < 0) - dev_err(wdev->dev, - "WSM request %s%s%s (%#.2x) on vif %d returned error %d\n", - get_hif_name(cmd), mib_sep, mib_name, cmd, vif, ret); - if (ret > 0) - dev_warn(wdev->dev, - "WSM request %s%s%s (%#.2x) on vif %d returned status %d\n", - get_hif_name(cmd), mib_sep, mib_name, cmd, vif, ret); - - return ret; -} - -// This function is special. After HIF_REQ_ID_SHUT_DOWN, chip won't reply to any -// request anymore. Obviously, only call this function during device unregister. -int hif_shutdown(struct wfx_dev *wdev) -{ - int ret; - struct hif_msg *hif; - - wfx_alloc_hif(0, &hif); - if (!hif) - return -ENOMEM; - wfx_fill_header(hif, -1, HIF_REQ_ID_SHUT_DOWN, 0); - ret = wfx_cmd_send(wdev, hif, NULL, 0, true); - if (wdev->pdata.gpio_wakeup) - gpiod_set_value(wdev->pdata.gpio_wakeup, 0); - else - control_reg_write(wdev, 0); - kfree(hif); - return ret; -} - -int hif_configuration(struct wfx_dev *wdev, const u8 *conf, size_t len) -{ - int ret; - size_t buf_len = sizeof(struct hif_req_configuration) + len; - struct hif_msg *hif; - struct hif_req_configuration *body = wfx_alloc_hif(buf_len, &hif); - - if (!hif) - return -ENOMEM; - body->length = cpu_to_le16(len); - memcpy(body->pds_data, conf, len); - wfx_fill_header(hif, -1, HIF_REQ_ID_CONFIGURATION, buf_len); - ret = wfx_cmd_send(wdev, hif, NULL, 0, false); - kfree(hif); - return ret; -} - -int hif_reset(struct wfx_vif *wvif, bool reset_stat) -{ - int ret; - struct hif_msg *hif; - struct hif_req_reset *body = wfx_alloc_hif(sizeof(*body), &hif); - - if (!hif) - return -ENOMEM; - body->reset_stat = reset_stat; - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_RESET, sizeof(*body)); - ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); - kfree(hif); - return ret; -} - -int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, - void *val, size_t val_len) -{ - int ret; - struct hif_msg *hif; - int buf_len = sizeof(struct hif_cnf_read_mib) + val_len; - struct hif_req_read_mib *body = wfx_alloc_hif(sizeof(*body), &hif); - struct hif_cnf_read_mib *reply = kmalloc(buf_len, GFP_KERNEL); - - if (!body || !reply) { - ret = -ENOMEM; - goto out; - } - body->mib_id = cpu_to_le16(mib_id); - wfx_fill_header(hif, vif_id, HIF_REQ_ID_READ_MIB, sizeof(*body)); - ret = wfx_cmd_send(wdev, hif, reply, buf_len, false); - - if (!ret && mib_id != le16_to_cpu(reply->mib_id)) { - dev_warn(wdev->dev, "%s: confirmation mismatch request\n", - __func__); - ret = -EIO; - } - if (ret == -ENOMEM) - dev_err(wdev->dev, "buffer is too small to receive %s (%zu < %d)\n", - get_mib_name(mib_id), val_len, - le16_to_cpu(reply->length)); - if (!ret) - memcpy(val, &reply->mib_data, le16_to_cpu(reply->length)); - else - memset(val, 0xFF, val_len); -out: - kfree(hif); - kfree(reply); - return ret; -} - -int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, - void *val, size_t val_len) -{ - int ret; - struct hif_msg *hif; - int buf_len = sizeof(struct hif_req_write_mib) + val_len; - struct hif_req_write_mib *body = wfx_alloc_hif(buf_len, &hif); - - if (!hif) - return -ENOMEM; - body->mib_id = cpu_to_le16(mib_id); - body->length = cpu_to_le16(val_len); - memcpy(&body->mib_data, val, val_len); - wfx_fill_header(hif, vif_id, HIF_REQ_ID_WRITE_MIB, buf_len); - ret = wfx_cmd_send(wdev, hif, NULL, 0, false); - kfree(hif); - return ret; -} - -int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, - int chan_start_idx, int chan_num, int *timeout) -{ - int ret, i; - struct hif_msg *hif; - size_t buf_len = - sizeof(struct hif_req_start_scan_alt) + chan_num * sizeof(u8); - struct hif_req_start_scan_alt *body = wfx_alloc_hif(buf_len, &hif); - int tmo_chan_fg, tmo_chan_bg, tmo; - - WARN(chan_num > HIF_API_MAX_NB_CHANNELS, "invalid params"); - WARN(req->n_ssids > HIF_API_MAX_NB_SSIDS, "invalid params"); - - if (!hif) - return -ENOMEM; - for (i = 0; i < req->n_ssids; i++) { - memcpy(body->ssid_def[i].ssid, req->ssids[i].ssid, - IEEE80211_MAX_SSID_LEN); - body->ssid_def[i].ssid_length = - cpu_to_le32(req->ssids[i].ssid_len); - } - body->num_of_ssids = HIF_API_MAX_NB_SSIDS; - body->maintain_current_bss = 1; - body->disallow_ps = 1; - body->tx_power_level = - cpu_to_le32(req->channels[chan_start_idx]->max_power); - body->num_of_channels = chan_num; - for (i = 0; i < chan_num; i++) - body->channel_list[i] = - req->channels[i + chan_start_idx]->hw_value; - if (req->no_cck) - body->max_transmit_rate = API_RATE_INDEX_G_6MBPS; - else - body->max_transmit_rate = API_RATE_INDEX_B_1MBPS; - if (req->channels[chan_start_idx]->flags & IEEE80211_CHAN_NO_IR) { - body->min_channel_time = cpu_to_le32(50); - body->max_channel_time = cpu_to_le32(150); - } else { - body->min_channel_time = cpu_to_le32(10); - body->max_channel_time = cpu_to_le32(50); - body->num_of_probe_requests = 2; - body->probe_delay = 100; - } - tmo_chan_bg = le32_to_cpu(body->max_channel_time) * USEC_PER_TU; - tmo_chan_fg = 512 * USEC_PER_TU + body->probe_delay; - tmo_chan_fg *= body->num_of_probe_requests; - tmo = chan_num * max(tmo_chan_bg, tmo_chan_fg) + 512 * USEC_PER_TU; - if (timeout) - *timeout = usecs_to_jiffies(tmo); - - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START_SCAN, buf_len); - ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); - kfree(hif); - return ret; -} - -int hif_stop_scan(struct wfx_vif *wvif) -{ - int ret; - struct hif_msg *hif; - // body associated to HIF_REQ_ID_STOP_SCAN is empty - wfx_alloc_hif(0, &hif); - - if (!hif) - return -ENOMEM; - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_STOP_SCAN, 0); - ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); - kfree(hif); - return ret; -} - -int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, - struct ieee80211_channel *channel, const u8 *ssid, int ssidlen) -{ - int ret; - struct hif_msg *hif; - struct hif_req_join *body = wfx_alloc_hif(sizeof(*body), &hif); - - WARN_ON(!conf->beacon_int); - WARN_ON(!conf->basic_rates); - WARN_ON(sizeof(body->ssid) < ssidlen); - WARN(!conf->ibss_joined && !ssidlen, "joining an unknown BSS"); - if (WARN_ON(!channel)) - return -EINVAL; - if (!hif) - return -ENOMEM; - body->infrastructure_bss_mode = !conf->ibss_joined; - body->short_preamble = conf->use_short_preamble; - if (channel->flags & IEEE80211_CHAN_NO_IR) - body->probe_for_join = 0; - else - body->probe_for_join = 1; - body->channel_number = channel->hw_value; - body->beacon_interval = cpu_to_le32(conf->beacon_int); - body->basic_rate_set = - cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates)); - memcpy(body->bssid, conf->bssid, sizeof(body->bssid)); - if (ssid) { - body->ssid_length = cpu_to_le32(ssidlen); - memcpy(body->ssid, ssid, ssidlen); - } - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_JOIN, sizeof(*body)); - ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); - kfree(hif); - return ret; -} - -int hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count) -{ - int ret; - struct hif_msg *hif; - struct hif_req_set_bss_params *body = - wfx_alloc_hif(sizeof(*body), &hif); - - if (!hif) - return -ENOMEM; - body->aid = cpu_to_le16(aid); - body->beacon_lost_count = beacon_lost_count; - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_SET_BSS_PARAMS, - sizeof(*body)); - ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); - kfree(hif); - return ret; -} - -int hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg) -{ - int ret; - struct hif_msg *hif; - // FIXME: only send necessary bits - struct hif_req_add_key *body = wfx_alloc_hif(sizeof(*body), &hif); - - if (!hif) - return -ENOMEM; - // FIXME: swap bytes as necessary in body - memcpy(body, arg, sizeof(*body)); - if (wfx_api_older_than(wdev, 1, 5)) - // Legacy firmwares expect that add_key to be sent on right - // interface. - wfx_fill_header(hif, arg->int_id, HIF_REQ_ID_ADD_KEY, - sizeof(*body)); - else - wfx_fill_header(hif, -1, HIF_REQ_ID_ADD_KEY, sizeof(*body)); - ret = wfx_cmd_send(wdev, hif, NULL, 0, false); - kfree(hif); - return ret; -} - -int hif_remove_key(struct wfx_dev *wdev, int idx) -{ - int ret; - struct hif_msg *hif; - struct hif_req_remove_key *body = wfx_alloc_hif(sizeof(*body), &hif); - - if (!hif) - return -ENOMEM; - body->entry_index = idx; - wfx_fill_header(hif, -1, HIF_REQ_ID_REMOVE_KEY, sizeof(*body)); - ret = wfx_cmd_send(wdev, hif, NULL, 0, false); - kfree(hif); - return ret; -} - -int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, - const struct ieee80211_tx_queue_params *arg) -{ - int ret; - struct hif_msg *hif; - struct hif_req_edca_queue_params *body = wfx_alloc_hif(sizeof(*body), - &hif); - - if (!body) - return -ENOMEM; - - WARN_ON(arg->aifs > 255); - if (!hif) - return -ENOMEM; - body->aifsn = arg->aifs; - body->cw_min = cpu_to_le16(arg->cw_min); - body->cw_max = cpu_to_le16(arg->cw_max); - body->tx_op_limit = cpu_to_le16(arg->txop * USEC_PER_TXOP); - body->queue_id = 3 - queue; - // API 2.0 has changed queue IDs values - if (wfx_api_older_than(wvif->wdev, 2, 0) && queue == IEEE80211_AC_BE) - body->queue_id = HIF_QUEUE_ID_BACKGROUND; - if (wfx_api_older_than(wvif->wdev, 2, 0) && queue == IEEE80211_AC_BK) - body->queue_id = HIF_QUEUE_ID_BESTEFFORT; - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_EDCA_QUEUE_PARAMS, - sizeof(*body)); - ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); - kfree(hif); - return ret; -} - -int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout) -{ - int ret; - struct hif_msg *hif; - struct hif_req_set_pm_mode *body = wfx_alloc_hif(sizeof(*body), &hif); - - if (!body) - return -ENOMEM; - - if (!hif) - return -ENOMEM; - if (ps) { - body->enter_psm = 1; - // Firmware does not support more than 128ms - body->fast_psm_idle_period = min(dynamic_ps_timeout * 2, 255); - if (body->fast_psm_idle_period) - body->fast_psm = 1; - } - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_SET_PM_MODE, sizeof(*body)); - ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); - kfree(hif); - return ret; -} - -int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, - const struct ieee80211_channel *channel) -{ - int ret; - struct hif_msg *hif; - struct hif_req_start *body = wfx_alloc_hif(sizeof(*body), &hif); - - WARN_ON(!conf->beacon_int); - if (!hif) - return -ENOMEM; - body->dtim_period = conf->dtim_period; - body->short_preamble = conf->use_short_preamble; - body->channel_number = channel->hw_value; - body->beacon_interval = cpu_to_le32(conf->beacon_int); - body->basic_rate_set = - cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates)); - body->ssid_length = conf->ssid_len; - memcpy(body->ssid, conf->ssid, conf->ssid_len); - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START, sizeof(*body)); - ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); - kfree(hif); - return ret; -} - -int hif_beacon_transmit(struct wfx_vif *wvif, bool enable) -{ - int ret; - struct hif_msg *hif; - struct hif_req_beacon_transmit *body = wfx_alloc_hif(sizeof(*body), - &hif); - - if (!hif) - return -ENOMEM; - body->enable_beaconing = enable ? 1 : 0; - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_BEACON_TRANSMIT, - sizeof(*body)); - ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); - kfree(hif); - return ret; -} - -int hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, bool mfp) -{ - int ret; - struct hif_msg *hif; - struct hif_req_map_link *body = wfx_alloc_hif(sizeof(*body), &hif); - - if (!hif) - return -ENOMEM; - if (mac_addr) - ether_addr_copy(body->mac_addr, mac_addr); - body->mfpc = mfp ? 1 : 0; - body->unmap = unmap ? 1 : 0; - body->peer_sta_id = sta_id; - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_MAP_LINK, sizeof(*body)); - ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); - kfree(hif); - return ret; -} - -int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len) -{ - int ret; - struct hif_msg *hif; - int buf_len = sizeof(struct hif_req_update_ie) + ies_len; - struct hif_req_update_ie *body = wfx_alloc_hif(buf_len, &hif); - - if (!hif) - return -ENOMEM; - body->beacon = 1; - body->num_ies = cpu_to_le16(1); - memcpy(body->ie, ies, ies_len); - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_UPDATE_IE, buf_len); - ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); - kfree(hif); - return ret; -} diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h deleted file mode 100644 index 3521c545ae6b..000000000000 --- a/drivers/staging/wfx/hif_tx.h +++ /dev/null @@ -1,60 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Implementation of host-to-chip commands (aka request/confirmation) of WFxxx - * Split Mac (WSM) API. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - * Copyright (C) 2010, ST-Ericsson SA - */ -#ifndef WFX_HIF_TX_H -#define WFX_HIF_TX_H - -struct ieee80211_channel; -struct ieee80211_bss_conf; -struct ieee80211_tx_queue_params; -struct cfg80211_scan_request; -struct hif_req_add_key; -struct wfx_dev; -struct wfx_vif; - -struct wfx_hif_cmd { - struct mutex lock; - struct completion ready; - struct completion done; - struct hif_msg *buf_send; - void *buf_recv; - size_t len_recv; - int ret; -}; - -void wfx_init_hif_cmd(struct wfx_hif_cmd *wfx_hif_cmd); -int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request, - void *reply, size_t reply_len, bool async); - -int hif_shutdown(struct wfx_dev *wdev); -int hif_configuration(struct wfx_dev *wdev, const u8 *conf, size_t len); -int hif_reset(struct wfx_vif *wvif, bool reset_stat); -int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, - void *buf, size_t buf_size); -int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, - void *buf, size_t buf_size); -int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req80211, - int chan_start, int chan_num, int *timeout); -int hif_stop_scan(struct wfx_vif *wvif); -int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, - struct ieee80211_channel *channel, const u8 *ssid, int ssidlen); -int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout); -int hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count); -int hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg); -int hif_remove_key(struct wfx_dev *wdev, int idx); -int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, - const struct ieee80211_tx_queue_params *arg); -int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, - const struct ieee80211_channel *channel); -int hif_beacon_transmit(struct wfx_vif *wvif, bool enable); -int hif_map_link(struct wfx_vif *wvif, - bool unmap, u8 *mac_addr, int sta_id, bool mfp); -int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len); - -#endif diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c deleted file mode 100644 index 1926cf1b62be..000000000000 --- a/drivers/staging/wfx/hif_tx_mib.c +++ /dev/null @@ -1,324 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Implementation of host-to-chip MIBs of WFxxx Split Mac (WSM) API. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - * Copyright (C) 2010, ST-Ericsson SA - */ - -#include - -#include "wfx.h" -#include "hif_tx.h" -#include "hif_tx_mib.h" -#include "hif_api_mib.h" - -int hif_set_output_power(struct wfx_vif *wvif, int val) -{ - struct hif_mib_current_tx_power_level arg = { - .power_level = cpu_to_le32(val * 10), - }; - - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_CURRENT_TX_POWER_LEVEL, - &arg, sizeof(arg)); -} - -int hif_set_beacon_wakeup_period(struct wfx_vif *wvif, - unsigned int dtim_interval, - unsigned int listen_interval) -{ - struct hif_mib_beacon_wake_up_period arg = { - .wakeup_period_min = dtim_interval, - .receive_dtim = 0, - .wakeup_period_max = listen_interval, - }; - - if (dtim_interval > 0xFF || listen_interval > 0xFFFF) - return -EINVAL; - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_BEACON_WAKEUP_PERIOD, - &arg, sizeof(arg)); -} - -int hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, - int rssi_thold, int rssi_hyst) -{ - struct hif_mib_rcpi_rssi_threshold arg = { - .rolling_average_count = 8, - .detection = 1, - }; - - if (!rssi_thold && !rssi_hyst) { - arg.upperthresh = 1; - arg.lowerthresh = 1; - } else { - arg.upper_threshold = rssi_thold + rssi_hyst; - arg.upper_threshold = (arg.upper_threshold + 110) * 2; - arg.lower_threshold = rssi_thold; - arg.lower_threshold = (arg.lower_threshold + 110) * 2; - } - - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_RCPI_RSSI_THRESHOLD, &arg, sizeof(arg)); -} - -int hif_get_counters_table(struct wfx_dev *wdev, int vif_id, - struct hif_mib_extended_count_table *arg) -{ - if (wfx_api_older_than(wdev, 1, 3)) { - // extended_count_table is wider than count_table - memset(arg, 0xFF, sizeof(*arg)); - return hif_read_mib(wdev, vif_id, HIF_MIB_ID_COUNTERS_TABLE, - arg, sizeof(struct hif_mib_count_table)); - } else { - return hif_read_mib(wdev, vif_id, - HIF_MIB_ID_EXTENDED_COUNTERS_TABLE, arg, - sizeof(struct hif_mib_extended_count_table)); - } -} - -int hif_set_macaddr(struct wfx_vif *wvif, u8 *mac) -{ - struct hif_mib_mac_address msg = { }; - - if (mac) - ether_addr_copy(msg.mac_addr, mac); - return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_DOT11_MAC_ADDRESS, - &msg, sizeof(msg)); -} - -int hif_set_rx_filter(struct wfx_vif *wvif, - bool filter_bssid, bool filter_prbreq) -{ - struct hif_mib_rx_filter arg = { }; - - if (filter_bssid) - arg.bssid_filter = 1; - if (!filter_prbreq) - arg.fwd_probe_req = 1; - return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_RX_FILTER, - &arg, sizeof(arg)); -} - -int hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, - const struct hif_ie_table_entry *tbl) -{ - int ret; - struct hif_mib_bcn_filter_table *arg; - int buf_len = struct_size(arg, ie_table, tbl_len); - - arg = kzalloc(buf_len, GFP_KERNEL); - if (!arg) - return -ENOMEM; - arg->num_of_info_elmts = cpu_to_le32(tbl_len); - memcpy(arg->ie_table, tbl, flex_array_size(arg, ie_table, tbl_len)); - ret = hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_BEACON_FILTER_TABLE, arg, buf_len); - kfree(arg); - return ret; -} - -int hif_beacon_filter_control(struct wfx_vif *wvif, - int enable, int beacon_count) -{ - struct hif_mib_bcn_filter_enable arg = { - .enable = cpu_to_le32(enable), - .bcn_count = cpu_to_le32(beacon_count), - }; - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_BEACON_FILTER_ENABLE, - &arg, sizeof(arg)); -} - -int hif_set_operational_mode(struct wfx_dev *wdev, enum hif_op_power_mode mode) -{ - struct hif_mib_gl_operational_power_mode arg = { - .power_mode = mode, - .wup_ind_activation = 1, - }; - - return hif_write_mib(wdev, -1, HIF_MIB_ID_GL_OPERATIONAL_POWER_MODE, - &arg, sizeof(arg)); -} - -int hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, - u8 frame_type, int init_rate) -{ - struct hif_mib_template_frame *arg; - - WARN(skb->len > HIF_API_MAX_TEMPLATE_FRAME_SIZE, "frame is too big"); - skb_push(skb, 4); - arg = (struct hif_mib_template_frame *)skb->data; - skb_pull(skb, 4); - arg->init_rate = init_rate; - arg->frame_type = frame_type; - arg->frame_length = cpu_to_le16(skb->len); - return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_TEMPLATE_FRAME, - arg, sizeof(*arg) + skb->len); -} - -int hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required) -{ - struct hif_mib_protected_mgmt_policy arg = { }; - - WARN(required && !capable, "incoherent arguments"); - if (capable) { - arg.pmf_enable = 1; - arg.host_enc_auth_frames = 1; - } - if (!required) - arg.unpmf_allowed = 1; - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_PROTECTED_MGMT_POLICY, - &arg, sizeof(arg)); -} - -int hif_set_block_ack_policy(struct wfx_vif *wvif, - u8 tx_tid_policy, u8 rx_tid_policy) -{ - struct hif_mib_block_ack_policy arg = { - .block_ack_tx_tid_policy = tx_tid_policy, - .block_ack_rx_tid_policy = rx_tid_policy, - }; - - return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_BLOCK_ACK_POLICY, - &arg, sizeof(arg)); -} - -int hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, - bool greenfield, bool short_preamble) -{ - struct hif_mib_set_association_mode arg = { - .preambtype_use = 1, - .mode = 1, - .spacing = 1, - .short_preamble = short_preamble, - .greenfield = greenfield, - .mpdu_start_spacing = ampdu_density, - }; - - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_SET_ASSOCIATION_MODE, &arg, sizeof(arg)); -} - -int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, - int policy_index, u8 *rates) -{ - struct hif_mib_set_tx_rate_retry_policy *arg; - size_t size = struct_size(arg, tx_rate_retry_policy, 1); - int ret; - - arg = kzalloc(size, GFP_KERNEL); - if (!arg) - return -ENOMEM; - arg->num_tx_rate_policies = 1; - arg->tx_rate_retry_policy[0].policy_index = policy_index; - arg->tx_rate_retry_policy[0].short_retry_count = 255; - arg->tx_rate_retry_policy[0].long_retry_count = 255; - arg->tx_rate_retry_policy[0].first_rate_sel = 1; - arg->tx_rate_retry_policy[0].terminate = 1; - arg->tx_rate_retry_policy[0].count_init = 1; - memcpy(&arg->tx_rate_retry_policy[0].rates, rates, - sizeof(arg->tx_rate_retry_policy[0].rates)); - ret = hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_SET_TX_RATE_RETRY_POLICY, arg, size); - kfree(arg); - return ret; -} - -int hif_keep_alive_period(struct wfx_vif *wvif, int period) -{ - struct hif_mib_keep_alive_period arg = { - .keep_alive_period = cpu_to_le16(period), - }; - - return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_KEEP_ALIVE_PERIOD, - &arg, sizeof(arg)); -}; - -int hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr) -{ - struct hif_mib_arp_ip_addr_table arg = { - .condition_idx = idx, - .arp_enable = HIF_ARP_NS_FILTERING_DISABLE, - }; - - if (addr) { - // Caution: type of addr is __be32 - memcpy(arg.ipv4_address, addr, sizeof(arg.ipv4_address)); - arg.arp_enable = HIF_ARP_NS_FILTERING_ENABLE; - } - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_ARP_IP_ADDRESSES_TABLE, - &arg, sizeof(arg)); -} - -int hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable) -{ - struct hif_mib_gl_set_multi_msg arg = { - .enable_multi_tx_conf = enable, - }; - - return hif_write_mib(wdev, -1, HIF_MIB_ID_GL_SET_MULTI_MSG, - &arg, sizeof(arg)); -} - -int hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val) -{ - struct hif_mib_set_uapsd_information arg = { }; - - if (val & BIT(IEEE80211_AC_VO)) - arg.trig_voice = 1; - if (val & BIT(IEEE80211_AC_VI)) - arg.trig_video = 1; - if (val & BIT(IEEE80211_AC_BE)) - arg.trig_be = 1; - if (val & BIT(IEEE80211_AC_BK)) - arg.trig_bckgrnd = 1; - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_SET_UAPSD_INFORMATION, - &arg, sizeof(arg)); -} - -int hif_erp_use_protection(struct wfx_vif *wvif, bool enable) -{ - struct hif_mib_non_erp_protection arg = { - .use_cts_to_self = enable, - }; - - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_NON_ERP_PROTECTION, &arg, sizeof(arg)); -} - -int hif_slot_time(struct wfx_vif *wvif, int val) -{ - struct hif_mib_slot_time arg = { - .slot_time = cpu_to_le32(val), - }; - - return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SLOT_TIME, - &arg, sizeof(arg)); -} - -int hif_wep_default_key_id(struct wfx_vif *wvif, int val) -{ - struct hif_mib_wep_default_key_id arg = { - .wep_default_key_id = val, - }; - - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID, - &arg, sizeof(arg)); -} - -int hif_rts_threshold(struct wfx_vif *wvif, int val) -{ - struct hif_mib_dot11_rts_threshold arg = { - .threshold = cpu_to_le32(val >= 0 ? val : 0xFFFF), - }; - - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_DOT11_RTS_THRESHOLD, &arg, sizeof(arg)); -} diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h deleted file mode 100644 index 812b3ba0f00e..000000000000 --- a/drivers/staging/wfx/hif_tx_mib.h +++ /dev/null @@ -1,49 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Implementation of host-to-chip MIBs of WFxxx Split Mac (WSM) API. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - * Copyright (C) 2010, ST-Ericsson SA - */ -#ifndef WFX_HIF_TX_MIB_H -#define WFX_HIF_TX_MIB_H - -struct wfx_vif; -struct sk_buff; - -int hif_set_output_power(struct wfx_vif *wvif, int val); -int hif_set_beacon_wakeup_period(struct wfx_vif *wvif, - unsigned int dtim_interval, - unsigned int listen_interval); -int hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, - int rssi_thold, int rssi_hyst); -int hif_get_counters_table(struct wfx_dev *wdev, int vif_id, - struct hif_mib_extended_count_table *arg); -int hif_set_macaddr(struct wfx_vif *wvif, u8 *mac); -int hif_set_rx_filter(struct wfx_vif *wvif, - bool filter_bssid, bool fwd_probe_req); -int hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, - const struct hif_ie_table_entry *tbl); -int hif_beacon_filter_control(struct wfx_vif *wvif, - int enable, int beacon_count); -int hif_set_operational_mode(struct wfx_dev *wdev, enum hif_op_power_mode mode); -int hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, - u8 frame_type, int init_rate); -int hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required); -int hif_set_block_ack_policy(struct wfx_vif *wvif, - u8 tx_tid_policy, u8 rx_tid_policy); -int hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, - bool greenfield, bool short_preamble); -int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, - int policy_index, u8 *rates); -int hif_keep_alive_period(struct wfx_vif *wvif, int period); -int hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr); -int hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable); -int hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val); -int hif_erp_use_protection(struct wfx_vif *wvif, bool enable); -int hif_slot_time(struct wfx_vif *wvif, int val); -int hif_wep_default_key_id(struct wfx_vif *wvif, int val); -int hif_rts_threshold(struct wfx_vif *wvif, int val); - -#endif diff --git a/drivers/staging/wfx/hwio.c b/drivers/staging/wfx/hwio.c deleted file mode 100644 index 36fbc5b5d64c..000000000000 --- a/drivers/staging/wfx/hwio.c +++ /dev/null @@ -1,352 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Low-level I/O functions. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#include -#include -#include - -#include "hwio.h" -#include "wfx.h" -#include "bus.h" -#include "traces.h" - -/* - * Internal helpers. - * - * About CONFIG_VMAP_STACK: - * When CONFIG_VMAP_STACK is enabled, it is not possible to run DMA on stack - * allocated data. Functions below that work with registers (aka functions - * ending with "32") automatically reallocate buffers with kmalloc. However, - * functions that work with arbitrary length buffers let's caller to handle - * memory location. In doubt, enable CONFIG_DEBUG_SG to detect badly located - * buffer. - */ - -static int read32(struct wfx_dev *wdev, int reg, u32 *val) -{ - int ret; - __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); - - *val = ~0; // Never return undefined value - if (!tmp) - return -ENOMEM; - ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, reg, tmp, - sizeof(u32)); - if (ret >= 0) - *val = le32_to_cpu(*tmp); - kfree(tmp); - if (ret) - dev_err(wdev->dev, "%s: bus communication error: %d\n", - __func__, ret); - return ret; -} - -static int write32(struct wfx_dev *wdev, int reg, u32 val) -{ - int ret; - __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); - - if (!tmp) - return -ENOMEM; - *tmp = cpu_to_le32(val); - ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, reg, tmp, - sizeof(u32)); - kfree(tmp); - if (ret) - dev_err(wdev->dev, "%s: bus communication error: %d\n", - __func__, ret); - return ret; -} - -static int read32_locked(struct wfx_dev *wdev, int reg, u32 *val) -{ - int ret; - - wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = read32(wdev, reg, val); - _trace_io_read32(reg, *val); - wdev->hwbus_ops->unlock(wdev->hwbus_priv); - return ret; -} - -static int write32_locked(struct wfx_dev *wdev, int reg, u32 val) -{ - int ret; - - wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = write32(wdev, reg, val); - _trace_io_write32(reg, val); - wdev->hwbus_ops->unlock(wdev->hwbus_priv); - return ret; -} - -static int write32_bits_locked(struct wfx_dev *wdev, int reg, u32 mask, u32 val) -{ - int ret; - u32 val_r, val_w; - - WARN_ON(~mask & val); - val &= mask; - wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = read32(wdev, reg, &val_r); - _trace_io_read32(reg, val_r); - if (ret < 0) - goto err; - val_w = (val_r & ~mask) | val; - if (val_w != val_r) { - ret = write32(wdev, reg, val_w); - _trace_io_write32(reg, val_w); - } -err: - wdev->hwbus_ops->unlock(wdev->hwbus_priv); - return ret; -} - -static int indirect_read(struct wfx_dev *wdev, int reg, u32 addr, - void *buf, size_t len) -{ - int ret; - int i; - u32 cfg; - u32 prefetch; - - WARN_ON(len >= 0x2000); - WARN_ON(reg != WFX_REG_AHB_DPORT && reg != WFX_REG_SRAM_DPORT); - - if (reg == WFX_REG_AHB_DPORT) - prefetch = CFG_PREFETCH_AHB; - else if (reg == WFX_REG_SRAM_DPORT) - prefetch = CFG_PREFETCH_SRAM; - else - return -ENODEV; - - ret = write32(wdev, WFX_REG_BASE_ADDR, addr); - if (ret < 0) - goto err; - - ret = read32(wdev, WFX_REG_CONFIG, &cfg); - if (ret < 0) - goto err; - - ret = write32(wdev, WFX_REG_CONFIG, cfg | prefetch); - if (ret < 0) - goto err; - - for (i = 0; i < 20; i++) { - ret = read32(wdev, WFX_REG_CONFIG, &cfg); - if (ret < 0) - goto err; - if (!(cfg & prefetch)) - break; - usleep_range(200, 250); - } - if (i == 20) { - ret = -ETIMEDOUT; - goto err; - } - - ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, reg, buf, len); - -err: - if (ret < 0) - memset(buf, 0xFF, len); // Never return undefined value - return ret; -} - -static int indirect_write(struct wfx_dev *wdev, int reg, u32 addr, - const void *buf, size_t len) -{ - int ret; - - WARN_ON(len >= 0x2000); - WARN_ON(reg != WFX_REG_AHB_DPORT && reg != WFX_REG_SRAM_DPORT); - ret = write32(wdev, WFX_REG_BASE_ADDR, addr); - if (ret < 0) - return ret; - - return wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, reg, buf, len); -} - -static int indirect_read_locked(struct wfx_dev *wdev, int reg, u32 addr, - void *buf, size_t len) -{ - int ret; - - wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = indirect_read(wdev, reg, addr, buf, len); - _trace_io_ind_read(reg, addr, buf, len); - wdev->hwbus_ops->unlock(wdev->hwbus_priv); - return ret; -} - -static int indirect_write_locked(struct wfx_dev *wdev, int reg, u32 addr, - const void *buf, size_t len) -{ - int ret; - - wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = indirect_write(wdev, reg, addr, buf, len); - _trace_io_ind_write(reg, addr, buf, len); - wdev->hwbus_ops->unlock(wdev->hwbus_priv); - return ret; -} - -static int indirect_read32_locked(struct wfx_dev *wdev, int reg, - u32 addr, u32 *val) -{ - int ret; - __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); - - if (!tmp) - return -ENOMEM; - wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = indirect_read(wdev, reg, addr, tmp, sizeof(u32)); - *val = le32_to_cpu(*tmp); - _trace_io_ind_read32(reg, addr, *val); - wdev->hwbus_ops->unlock(wdev->hwbus_priv); - kfree(tmp); - return ret; -} - -static int indirect_write32_locked(struct wfx_dev *wdev, int reg, - u32 addr, u32 val) -{ - int ret; - __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); - - if (!tmp) - return -ENOMEM; - *tmp = cpu_to_le32(val); - wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = indirect_write(wdev, reg, addr, tmp, sizeof(u32)); - _trace_io_ind_write32(reg, addr, val); - wdev->hwbus_ops->unlock(wdev->hwbus_priv); - kfree(tmp); - return ret; -} - -int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t len) -{ - int ret; - - WARN((long)buf & 3, "%s: unaligned buffer", __func__); - wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, - WFX_REG_IN_OUT_QUEUE, buf, len); - _trace_io_read(WFX_REG_IN_OUT_QUEUE, buf, len); - wdev->hwbus_ops->unlock(wdev->hwbus_priv); - if (ret) - dev_err(wdev->dev, "%s: bus communication error: %d\n", - __func__, ret); - return ret; -} - -int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t len) -{ - int ret; - - WARN((long)buf & 3, "%s: unaligned buffer", __func__); - wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, - WFX_REG_IN_OUT_QUEUE, buf, len); - _trace_io_write(WFX_REG_IN_OUT_QUEUE, buf, len); - wdev->hwbus_ops->unlock(wdev->hwbus_priv); - if (ret) - dev_err(wdev->dev, "%s: bus communication error: %d\n", - __func__, ret); - return ret; -} - -int sram_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len) -{ - return indirect_read_locked(wdev, WFX_REG_SRAM_DPORT, addr, buf, len); -} - -int ahb_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len) -{ - return indirect_read_locked(wdev, WFX_REG_AHB_DPORT, addr, buf, len); -} - -int sram_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len) -{ - return indirect_write_locked(wdev, WFX_REG_SRAM_DPORT, addr, buf, len); -} - -int ahb_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len) -{ - return indirect_write_locked(wdev, WFX_REG_AHB_DPORT, addr, buf, len); -} - -int sram_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val) -{ - return indirect_read32_locked(wdev, WFX_REG_SRAM_DPORT, addr, val); -} - -int ahb_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val) -{ - return indirect_read32_locked(wdev, WFX_REG_AHB_DPORT, addr, val); -} - -int sram_reg_write(struct wfx_dev *wdev, u32 addr, u32 val) -{ - return indirect_write32_locked(wdev, WFX_REG_SRAM_DPORT, addr, val); -} - -int ahb_reg_write(struct wfx_dev *wdev, u32 addr, u32 val) -{ - return indirect_write32_locked(wdev, WFX_REG_AHB_DPORT, addr, val); -} - -int config_reg_read(struct wfx_dev *wdev, u32 *val) -{ - return read32_locked(wdev, WFX_REG_CONFIG, val); -} - -int config_reg_write(struct wfx_dev *wdev, u32 val) -{ - return write32_locked(wdev, WFX_REG_CONFIG, val); -} - -int config_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val) -{ - return write32_bits_locked(wdev, WFX_REG_CONFIG, mask, val); -} - -int control_reg_read(struct wfx_dev *wdev, u32 *val) -{ - return read32_locked(wdev, WFX_REG_CONTROL, val); -} - -int control_reg_write(struct wfx_dev *wdev, u32 val) -{ - return write32_locked(wdev, WFX_REG_CONTROL, val); -} - -int control_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val) -{ - return write32_bits_locked(wdev, WFX_REG_CONTROL, mask, val); -} - -int igpr_reg_read(struct wfx_dev *wdev, int index, u32 *val) -{ - int ret; - - *val = ~0; // Never return undefined value - ret = write32_locked(wdev, WFX_REG_SET_GEN_R_W, IGPR_RW | index << 24); - if (ret) - return ret; - ret = read32_locked(wdev, WFX_REG_SET_GEN_R_W, val); - if (ret) - return ret; - *val &= IGPR_VALUE; - return ret; -} - -int igpr_reg_write(struct wfx_dev *wdev, int index, u32 val) -{ - return write32_locked(wdev, WFX_REG_SET_GEN_R_W, index << 24 | val); -} diff --git a/drivers/staging/wfx/hwio.h b/drivers/staging/wfx/hwio.h deleted file mode 100644 index 0b8e4f7157df..000000000000 --- a/drivers/staging/wfx/hwio.h +++ /dev/null @@ -1,75 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Low-level API. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#ifndef WFX_HWIO_H -#define WFX_HWIO_H - -#include - -struct wfx_dev; - -int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t buf_len); -int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t buf_len); - -int sram_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len); -int sram_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len); - -int ahb_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len); -int ahb_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len); - -int sram_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val); -int sram_reg_write(struct wfx_dev *wdev, u32 addr, u32 val); - -int ahb_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val); -int ahb_reg_write(struct wfx_dev *wdev, u32 addr, u32 val); - -#define CFG_ERR_SPI_FRAME 0x00000001 // only with SPI -#define CFG_ERR_SDIO_BUF_MISMATCH 0x00000001 // only with SDIO -#define CFG_ERR_BUF_UNDERRUN 0x00000002 -#define CFG_ERR_DATA_IN_TOO_LARGE 0x00000004 -#define CFG_ERR_HOST_NO_OUT_QUEUE 0x00000008 -#define CFG_ERR_BUF_OVERRUN 0x00000010 -#define CFG_ERR_DATA_OUT_TOO_LARGE 0x00000020 -#define CFG_ERR_HOST_NO_IN_QUEUE 0x00000040 -#define CFG_ERR_HOST_CRC_MISS 0x00000080 // only with SDIO -#define CFG_SPI_IGNORE_CS 0x00000080 // only with SPI -#define CFG_BYTE_ORDER_MASK 0x00000300 // only writable with SPI -#define CFG_BYTE_ORDER_BADC 0x00000000 -#define CFG_BYTE_ORDER_DCBA 0x00000100 -#define CFG_BYTE_ORDER_ABCD 0x00000200 // SDIO always use this value -#define CFG_DIRECT_ACCESS_MODE 0x00000400 -#define CFG_PREFETCH_AHB 0x00000800 -#define CFG_DISABLE_CPU_CLK 0x00001000 -#define CFG_PREFETCH_SRAM 0x00002000 -#define CFG_CPU_RESET 0x00004000 -#define CFG_SDIO_DISABLE_IRQ 0x00008000 // only with SDIO -#define CFG_IRQ_ENABLE_DATA 0x00010000 -#define CFG_IRQ_ENABLE_WRDY 0x00020000 -#define CFG_CLK_RISE_EDGE 0x00040000 -#define CFG_SDIO_DISABLE_CRC_CHK 0x00080000 // only with SDIO -#define CFG_RESERVED 0x00F00000 -#define CFG_DEVICE_ID_MAJOR 0x07000000 -#define CFG_DEVICE_ID_RESERVED 0x78000000 -#define CFG_DEVICE_ID_TYPE 0x80000000 -int config_reg_read(struct wfx_dev *wdev, u32 *val); -int config_reg_write(struct wfx_dev *wdev, u32 val); -int config_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val); - -#define CTRL_NEXT_LEN_MASK 0x00000FFF -#define CTRL_WLAN_WAKEUP 0x00001000 -#define CTRL_WLAN_READY 0x00002000 -int control_reg_read(struct wfx_dev *wdev, u32 *val); -int control_reg_write(struct wfx_dev *wdev, u32 val); -int control_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val); - -#define IGPR_RW 0x80000000 -#define IGPR_INDEX 0x7F000000 -#define IGPR_VALUE 0x00FFFFFF -int igpr_reg_read(struct wfx_dev *wdev, int index, u32 *val); -int igpr_reg_write(struct wfx_dev *wdev, int index, u32 val); - -#endif /* WFX_HWIO_H */ diff --git a/drivers/staging/wfx/key.c b/drivers/staging/wfx/key.c deleted file mode 100644 index 2ab82bed4c1b..000000000000 --- a/drivers/staging/wfx/key.c +++ /dev/null @@ -1,241 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Key management related functions. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#include -#include - -#include "key.h" -#include "wfx.h" -#include "hif_tx_mib.h" - -static int wfx_alloc_key(struct wfx_dev *wdev) -{ - int idx; - - idx = ffs(~wdev->key_map) - 1; - if (idx < 0 || idx >= MAX_KEY_ENTRIES) - return -1; - - wdev->key_map |= BIT(idx); - return idx; -} - -static void wfx_free_key(struct wfx_dev *wdev, int idx) -{ - WARN(!(wdev->key_map & BIT(idx)), "inconsistent key allocation"); - wdev->key_map &= ~BIT(idx); -} - -static u8 fill_wep_pair(struct hif_wep_pairwise_key *msg, - struct ieee80211_key_conf *key, u8 *peer_addr) -{ - WARN(key->keylen > sizeof(msg->key_data), "inconsistent data"); - msg->key_length = key->keylen; - memcpy(msg->key_data, key->key, key->keylen); - ether_addr_copy(msg->peer_address, peer_addr); - return HIF_KEY_TYPE_WEP_PAIRWISE; -} - -static u8 fill_wep_group(struct hif_wep_group_key *msg, - struct ieee80211_key_conf *key) -{ - WARN(key->keylen > sizeof(msg->key_data), "inconsistent data"); - msg->key_id = key->keyidx; - msg->key_length = key->keylen; - memcpy(msg->key_data, key->key, key->keylen); - return HIF_KEY_TYPE_WEP_DEFAULT; -} - -static u8 fill_tkip_pair(struct hif_tkip_pairwise_key *msg, - struct ieee80211_key_conf *key, u8 *peer_addr) -{ - u8 *keybuf = key->key; - - WARN(key->keylen != sizeof(msg->tkip_key_data) - + sizeof(msg->tx_mic_key) - + sizeof(msg->rx_mic_key), "inconsistent data"); - memcpy(msg->tkip_key_data, keybuf, sizeof(msg->tkip_key_data)); - keybuf += sizeof(msg->tkip_key_data); - memcpy(msg->tx_mic_key, keybuf, sizeof(msg->tx_mic_key)); - keybuf += sizeof(msg->tx_mic_key); - memcpy(msg->rx_mic_key, keybuf, sizeof(msg->rx_mic_key)); - ether_addr_copy(msg->peer_address, peer_addr); - return HIF_KEY_TYPE_TKIP_PAIRWISE; -} - -static u8 fill_tkip_group(struct hif_tkip_group_key *msg, - struct ieee80211_key_conf *key, - struct ieee80211_key_seq *seq, - enum nl80211_iftype iftype) -{ - u8 *keybuf = key->key; - - WARN(key->keylen != sizeof(msg->tkip_key_data) - + 2 * sizeof(msg->rx_mic_key), "inconsistent data"); - msg->key_id = key->keyidx; - memcpy(msg->rx_sequence_counter, - &seq->tkip.iv16, sizeof(seq->tkip.iv16)); - memcpy(msg->rx_sequence_counter + sizeof(u16), - &seq->tkip.iv32, sizeof(seq->tkip.iv32)); - memcpy(msg->tkip_key_data, keybuf, sizeof(msg->tkip_key_data)); - keybuf += sizeof(msg->tkip_key_data); - if (iftype == NL80211_IFTYPE_AP) - // Use Tx MIC Key - memcpy(msg->rx_mic_key, keybuf + 0, sizeof(msg->rx_mic_key)); - else - // Use Rx MIC Key - memcpy(msg->rx_mic_key, keybuf + 8, sizeof(msg->rx_mic_key)); - return HIF_KEY_TYPE_TKIP_GROUP; -} - -static u8 fill_ccmp_pair(struct hif_aes_pairwise_key *msg, - struct ieee80211_key_conf *key, u8 *peer_addr) -{ - WARN(key->keylen != sizeof(msg->aes_key_data), "inconsistent data"); - ether_addr_copy(msg->peer_address, peer_addr); - memcpy(msg->aes_key_data, key->key, key->keylen); - return HIF_KEY_TYPE_AES_PAIRWISE; -} - -static u8 fill_ccmp_group(struct hif_aes_group_key *msg, - struct ieee80211_key_conf *key, - struct ieee80211_key_seq *seq) -{ - WARN(key->keylen != sizeof(msg->aes_key_data), "inconsistent data"); - memcpy(msg->aes_key_data, key->key, key->keylen); - memcpy(msg->rx_sequence_counter, seq->ccmp.pn, sizeof(seq->ccmp.pn)); - memreverse(msg->rx_sequence_counter, sizeof(seq->ccmp.pn)); - msg->key_id = key->keyidx; - return HIF_KEY_TYPE_AES_GROUP; -} - -static u8 fill_sms4_pair(struct hif_wapi_pairwise_key *msg, - struct ieee80211_key_conf *key, u8 *peer_addr) -{ - u8 *keybuf = key->key; - - WARN(key->keylen != sizeof(msg->wapi_key_data) - + sizeof(msg->mic_key_data), "inconsistent data"); - ether_addr_copy(msg->peer_address, peer_addr); - memcpy(msg->wapi_key_data, keybuf, sizeof(msg->wapi_key_data)); - keybuf += sizeof(msg->wapi_key_data); - memcpy(msg->mic_key_data, keybuf, sizeof(msg->mic_key_data)); - msg->key_id = key->keyidx; - return HIF_KEY_TYPE_WAPI_PAIRWISE; -} - -static u8 fill_sms4_group(struct hif_wapi_group_key *msg, - struct ieee80211_key_conf *key) -{ - u8 *keybuf = key->key; - - WARN(key->keylen != sizeof(msg->wapi_key_data) - + sizeof(msg->mic_key_data), "inconsistent data"); - memcpy(msg->wapi_key_data, keybuf, sizeof(msg->wapi_key_data)); - keybuf += sizeof(msg->wapi_key_data); - memcpy(msg->mic_key_data, keybuf, sizeof(msg->mic_key_data)); - msg->key_id = key->keyidx; - return HIF_KEY_TYPE_WAPI_GROUP; -} - -static u8 fill_aes_cmac_group(struct hif_igtk_group_key *msg, - struct ieee80211_key_conf *key, - struct ieee80211_key_seq *seq) -{ - WARN(key->keylen != sizeof(msg->igtk_key_data), "inconsistent data"); - memcpy(msg->igtk_key_data, key->key, key->keylen); - memcpy(msg->ipn, seq->aes_cmac.pn, sizeof(seq->aes_cmac.pn)); - memreverse(msg->ipn, sizeof(seq->aes_cmac.pn)); - msg->key_id = key->keyidx; - return HIF_KEY_TYPE_IGTK_GROUP; -} - -static int wfx_add_key(struct wfx_vif *wvif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - int ret; - struct hif_req_add_key k = { }; - struct ieee80211_key_seq seq; - struct wfx_dev *wdev = wvif->wdev; - int idx = wfx_alloc_key(wvif->wdev); - bool pairwise = key->flags & IEEE80211_KEY_FLAG_PAIRWISE; - - WARN(key->flags & IEEE80211_KEY_FLAG_PAIRWISE && !sta, "inconsistent data"); - ieee80211_get_key_rx_seq(key, 0, &seq); - if (idx < 0) - return -EINVAL; - k.int_id = wvif->id; - k.entry_index = idx; - if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || - key->cipher == WLAN_CIPHER_SUITE_WEP104) { - if (pairwise) - k.type = fill_wep_pair(&k.key.wep_pairwise_key, key, - sta->addr); - else - k.type = fill_wep_group(&k.key.wep_group_key, key); - } else if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { - if (pairwise) - k.type = fill_tkip_pair(&k.key.tkip_pairwise_key, key, - sta->addr); - else - k.type = fill_tkip_group(&k.key.tkip_group_key, key, - &seq, wvif->vif->type); - } else if (key->cipher == WLAN_CIPHER_SUITE_CCMP) { - if (pairwise) - k.type = fill_ccmp_pair(&k.key.aes_pairwise_key, key, - sta->addr); - else - k.type = fill_ccmp_group(&k.key.aes_group_key, key, - &seq); - } else if (key->cipher == WLAN_CIPHER_SUITE_SMS4) { - if (pairwise) - k.type = fill_sms4_pair(&k.key.wapi_pairwise_key, key, - sta->addr); - else - k.type = fill_sms4_group(&k.key.wapi_group_key, key); - } else if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC) { - k.type = fill_aes_cmac_group(&k.key.igtk_group_key, key, &seq); - key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIE; - } else { - dev_warn(wdev->dev, "unsupported key type %d\n", key->cipher); - wfx_free_key(wdev, idx); - return -EOPNOTSUPP; - } - ret = hif_add_key(wdev, &k); - if (ret) { - wfx_free_key(wdev, idx); - return -EOPNOTSUPP; - } - key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE | - IEEE80211_KEY_FLAG_RESERVE_TAILROOM; - key->hw_key_idx = idx; - return 0; -} - -static int wfx_remove_key(struct wfx_vif *wvif, struct ieee80211_key_conf *key) -{ - WARN(key->hw_key_idx >= MAX_KEY_ENTRIES, "corrupted hw_key_idx"); - wfx_free_key(wvif->wdev, key->hw_key_idx); - return hif_remove_key(wvif->wdev, key->hw_key_idx); -} - -int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - int ret = -EOPNOTSUPP; - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - - mutex_lock(&wvif->wdev->conf_mutex); - if (cmd == SET_KEY) - ret = wfx_add_key(wvif, sta, key); - if (cmd == DISABLE_KEY) - ret = wfx_remove_key(wvif, key); - mutex_unlock(&wvif->wdev->conf_mutex); - return ret; -} - diff --git a/drivers/staging/wfx/key.h b/drivers/staging/wfx/key.h deleted file mode 100644 index 70a44d0ca35e..000000000000 --- a/drivers/staging/wfx/key.h +++ /dev/null @@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Implementation of mac80211 API. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#ifndef WFX_KEY_H -#define WFX_KEY_H - -#include - -struct wfx_dev; -struct wfx_vif; - -int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key); - -#endif /* WFX_STA_H */ diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c deleted file mode 100644 index e7bc1988124a..000000000000 --- a/drivers/staging/wfx/main.c +++ /dev/null @@ -1,490 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Device probe and register. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - * Copyright (c) 2008, Johannes Berg - * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). - * Copyright (c) 2007-2009, Christian Lamparter - * Copyright (c) 2006, Michael Wu - * Copyright (c) 2004-2006 Jean-Baptiste Note , et al. - */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "main.h" -#include "wfx.h" -#include "fwio.h" -#include "hwio.h" -#include "bus.h" -#include "bh.h" -#include "sta.h" -#include "key.h" -#include "scan.h" -#include "debug.h" -#include "data_tx.h" -#include "hif_tx_mib.h" -#include "hif_api_cmd.h" - -#define WFX_PDS_MAX_SIZE 1500 - -MODULE_DESCRIPTION("Silicon Labs 802.11 Wireless LAN driver for WFx"); -MODULE_AUTHOR("J?r?me Pouiller "); -MODULE_LICENSE("GPL"); - -#define RATETAB_ENT(_rate, _rateid, _flags) { \ - .bitrate = (_rate), \ - .hw_value = (_rateid), \ - .flags = (_flags), \ -} - -static struct ieee80211_rate wfx_rates[] = { - RATETAB_ENT(10, 0, 0), - RATETAB_ENT(20, 1, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(55, 2, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(110, 3, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(60, 6, 0), - RATETAB_ENT(90, 7, 0), - RATETAB_ENT(120, 8, 0), - RATETAB_ENT(180, 9, 0), - RATETAB_ENT(240, 10, 0), - RATETAB_ENT(360, 11, 0), - RATETAB_ENT(480, 12, 0), - RATETAB_ENT(540, 13, 0), -}; - -#define CHAN2G(_channel, _freq, _flags) { \ - .band = NL80211_BAND_2GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} - -static struct ieee80211_channel wfx_2ghz_chantable[] = { - CHAN2G(1, 2412, 0), - CHAN2G(2, 2417, 0), - CHAN2G(3, 2422, 0), - CHAN2G(4, 2427, 0), - CHAN2G(5, 2432, 0), - CHAN2G(6, 2437, 0), - CHAN2G(7, 2442, 0), - CHAN2G(8, 2447, 0), - CHAN2G(9, 2452, 0), - CHAN2G(10, 2457, 0), - CHAN2G(11, 2462, 0), - CHAN2G(12, 2467, 0), - CHAN2G(13, 2472, 0), - CHAN2G(14, 2484, 0), -}; - -static const struct ieee80211_supported_band wfx_band_2ghz = { - .channels = wfx_2ghz_chantable, - .n_channels = ARRAY_SIZE(wfx_2ghz_chantable), - .bitrates = wfx_rates, - .n_bitrates = ARRAY_SIZE(wfx_rates), - .ht_cap = { - // Receive caps - .cap = IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_20 | - IEEE80211_HT_CAP_MAX_AMSDU | - (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT), - .ht_supported = 1, - .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, - .ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE, - .mcs = { - .rx_mask = { 0xFF }, // MCS0 to MCS7 - .rx_highest = cpu_to_le16(72), - .tx_params = IEEE80211_HT_MCS_TX_DEFINED, - }, - }, -}; - -static const struct ieee80211_iface_limit wdev_iface_limits[] = { - { .max = 1, .types = BIT(NL80211_IFTYPE_STATION) }, - { .max = 1, .types = BIT(NL80211_IFTYPE_AP) }, -}; - -static const struct ieee80211_iface_combination wfx_iface_combinations[] = { - { - .num_different_channels = 2, - .max_interfaces = 2, - .limits = wdev_iface_limits, - .n_limits = ARRAY_SIZE(wdev_iface_limits), - } -}; - -static const struct ieee80211_ops wfx_ops = { - .start = wfx_start, - .stop = wfx_stop, - .add_interface = wfx_add_interface, - .remove_interface = wfx_remove_interface, - .config = wfx_config, - .tx = wfx_tx, - .join_ibss = wfx_join_ibss, - .leave_ibss = wfx_leave_ibss, - .conf_tx = wfx_conf_tx, - .hw_scan = wfx_hw_scan, - .cancel_hw_scan = wfx_cancel_hw_scan, - .start_ap = wfx_start_ap, - .stop_ap = wfx_stop_ap, - .sta_add = wfx_sta_add, - .sta_remove = wfx_sta_remove, - .set_tim = wfx_set_tim, - .set_key = wfx_set_key, - .set_rts_threshold = wfx_set_rts_threshold, - .set_default_unicast_key = wfx_set_default_unicast_key, - .bss_info_changed = wfx_bss_info_changed, - .configure_filter = wfx_configure_filter, - .ampdu_action = wfx_ampdu_action, - .flush = wfx_flush, - .add_chanctx = wfx_add_chanctx, - .remove_chanctx = wfx_remove_chanctx, - .change_chanctx = wfx_change_chanctx, - .assign_vif_chanctx = wfx_assign_vif_chanctx, - .unassign_vif_chanctx = wfx_unassign_vif_chanctx, -}; - -bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor) -{ - if (wdev->hw_caps.api_version_major < major) - return true; - if (wdev->hw_caps.api_version_major > major) - return false; - if (wdev->hw_caps.api_version_minor < minor) - return true; - return false; -} - -/* NOTE: wfx_send_pds() destroy buf */ -int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) -{ - int ret; - int start, brace_level, i; - - start = 0; - brace_level = 0; - if (buf[0] != '{') { - dev_err(wdev->dev, "valid PDS start with '{'. Did you forget to compress it?\n"); - return -EINVAL; - } - for (i = 1; i < len - 1; i++) { - if (buf[i] == '{') - brace_level++; - if (buf[i] == '}') - brace_level--; - if (buf[i] == '}' && !brace_level) { - i++; - if (i - start + 1 > WFX_PDS_MAX_SIZE) - return -EFBIG; - buf[start] = '{'; - buf[i] = 0; - dev_dbg(wdev->dev, "send PDS '%s}'\n", buf + start); - buf[i] = '}'; - ret = hif_configuration(wdev, buf + start, - i - start + 1); - if (ret > 0) { - dev_err(wdev->dev, "PDS bytes %d to %d: invalid data (unsupported options?)\n", - start, i); - return -EINVAL; - } - if (ret == -ETIMEDOUT) { - dev_err(wdev->dev, "PDS bytes %d to %d: chip didn't reply (corrupted file?)\n", - start, i); - return ret; - } - if (ret) { - dev_err(wdev->dev, "PDS bytes %d to %d: chip returned an unknown error\n", - start, i); - return -EIO; - } - buf[i] = ','; - start = i; - } - } - return 0; -} - -static int wfx_send_pdata_pds(struct wfx_dev *wdev) -{ - int ret = 0; - const struct firmware *pds; - u8 *tmp_buf; - - ret = request_firmware(&pds, wdev->pdata.file_pds, wdev->dev); - if (ret) { - dev_err(wdev->dev, "can't load PDS file %s\n", - wdev->pdata.file_pds); - goto err1; - } - tmp_buf = kmemdup(pds->data, pds->size, GFP_KERNEL); - if (!tmp_buf) { - ret = -ENOMEM; - goto err2; - } - ret = wfx_send_pds(wdev, tmp_buf, pds->size); - kfree(tmp_buf); -err2: - release_firmware(pds); -err1: - return ret; -} - -static void wfx_free_common(void *data) -{ - struct wfx_dev *wdev = data; - - mutex_destroy(&wdev->tx_power_loop_info_lock); - mutex_destroy(&wdev->rx_stats_lock); - mutex_destroy(&wdev->conf_mutex); - ieee80211_free_hw(wdev->hw); -} - -struct wfx_dev *wfx_init_common(struct device *dev, - const struct wfx_platform_data *pdata, - const struct hwbus_ops *hwbus_ops, - void *hwbus_priv) -{ - struct ieee80211_hw *hw; - struct wfx_dev *wdev; - - hw = ieee80211_alloc_hw(sizeof(struct wfx_dev), &wfx_ops); - if (!hw) - return NULL; - - SET_IEEE80211_DEV(hw, dev); - - ieee80211_hw_set(hw, TX_AMPDU_SETUP_IN_HW); - ieee80211_hw_set(hw, AMPDU_AGGREGATION); - ieee80211_hw_set(hw, CONNECTION_MONITOR); - ieee80211_hw_set(hw, REPORTS_TX_ACK_STATUS); - ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS); - ieee80211_hw_set(hw, SIGNAL_DBM); - ieee80211_hw_set(hw, SUPPORTS_PS); - ieee80211_hw_set(hw, MFP_CAPABLE); - - hw->vif_data_size = sizeof(struct wfx_vif); - hw->sta_data_size = sizeof(struct wfx_sta_priv); - hw->queues = 4; - hw->max_rates = 8; - hw->max_rate_tries = 8; - hw->extra_tx_headroom = sizeof(struct hif_msg) - + sizeof(struct hif_req_tx) - + 4 /* alignment */ + 8 /* TKIP IV */; - hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_AP); - hw->wiphy->probe_resp_offload = NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS | - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 | - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P | - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U; - hw->wiphy->features |= NL80211_FEATURE_AP_SCAN; - hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD; - hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; - hw->wiphy->max_ap_assoc_sta = HIF_LINK_ID_MAX; - hw->wiphy->max_scan_ssids = 2; - hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; - hw->wiphy->n_iface_combinations = ARRAY_SIZE(wfx_iface_combinations); - hw->wiphy->iface_combinations = wfx_iface_combinations; - hw->wiphy->bands[NL80211_BAND_2GHZ] = devm_kmalloc(dev, sizeof(wfx_band_2ghz), GFP_KERNEL); - // FIXME: also copy wfx_rates and wfx_2ghz_chantable - memcpy(hw->wiphy->bands[NL80211_BAND_2GHZ], &wfx_band_2ghz, - sizeof(wfx_band_2ghz)); - - wdev = hw->priv; - wdev->hw = hw; - wdev->dev = dev; - wdev->hwbus_ops = hwbus_ops; - wdev->hwbus_priv = hwbus_priv; - memcpy(&wdev->pdata, pdata, sizeof(*pdata)); - of_property_read_string(dev->of_node, "config-file", - &wdev->pdata.file_pds); - wdev->pdata.gpio_wakeup = devm_gpiod_get_optional(dev, "wakeup", - GPIOD_OUT_LOW); - if (IS_ERR(wdev->pdata.gpio_wakeup)) - return NULL; - if (wdev->pdata.gpio_wakeup) - gpiod_set_consumer_name(wdev->pdata.gpio_wakeup, "wfx wakeup"); - - mutex_init(&wdev->conf_mutex); - mutex_init(&wdev->rx_stats_lock); - mutex_init(&wdev->tx_power_loop_info_lock); - init_completion(&wdev->firmware_ready); - INIT_DELAYED_WORK(&wdev->cooling_timeout_work, - wfx_cooling_timeout_work); - skb_queue_head_init(&wdev->tx_pending); - init_waitqueue_head(&wdev->tx_dequeue); - wfx_init_hif_cmd(&wdev->hif_cmd); - wdev->force_ps_timeout = -1; - - if (devm_add_action_or_reset(dev, wfx_free_common, wdev)) - return NULL; - - return wdev; -} - -int wfx_probe(struct wfx_dev *wdev) -{ - int i; - int err; - const void *macaddr; - struct gpio_desc *gpio_saved; - - // During first part of boot, gpio_wakeup cannot yet been used. So - // prevent bh() to touch it. - gpio_saved = wdev->pdata.gpio_wakeup; - wdev->pdata.gpio_wakeup = NULL; - wdev->poll_irq = true; - - wfx_bh_register(wdev); - - err = wfx_init_device(wdev); - if (err) - goto err0; - - wfx_bh_poll_irq(wdev); - err = wait_for_completion_timeout(&wdev->firmware_ready, 1 * HZ); - if (err <= 0) { - if (err == 0) { - dev_err(wdev->dev, "timeout while waiting for startup indication\n"); - err = -ETIMEDOUT; - } else if (err == -ERESTARTSYS) { - dev_info(wdev->dev, "probe interrupted by user\n"); - } - goto err0; - } - - // FIXME: fill wiphy::hw_version - dev_info(wdev->dev, "started firmware %d.%d.%d \"%s\" (API: %d.%d, keyset: %02X, caps: 0x%.8X)\n", - wdev->hw_caps.firmware_major, wdev->hw_caps.firmware_minor, - wdev->hw_caps.firmware_build, wdev->hw_caps.firmware_label, - wdev->hw_caps.api_version_major, wdev->hw_caps.api_version_minor, - wdev->keyset, wdev->hw_caps.link_mode); - snprintf(wdev->hw->wiphy->fw_version, - sizeof(wdev->hw->wiphy->fw_version), - "%d.%d.%d", - wdev->hw_caps.firmware_major, - wdev->hw_caps.firmware_minor, - wdev->hw_caps.firmware_build); - - if (wfx_api_older_than(wdev, 1, 0)) { - dev_err(wdev->dev, - "unsupported firmware API version (expect 1 while firmware returns %d)\n", - wdev->hw_caps.api_version_major); - err = -ENOTSUPP; - goto err0; - } - - if (wdev->hw_caps.link_mode == SEC_LINK_ENFORCED) { - dev_err(wdev->dev, - "chip require secure_link, but can't negotiate it\n"); - goto err0; - } - - if (wdev->hw_caps.region_sel_mode) { - wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[11].flags |= IEEE80211_CHAN_NO_IR; - wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[12].flags |= IEEE80211_CHAN_NO_IR; - wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[13].flags |= IEEE80211_CHAN_DISABLED; - } - - dev_dbg(wdev->dev, "sending configuration file %s\n", - wdev->pdata.file_pds); - err = wfx_send_pdata_pds(wdev); - if (err < 0) - goto err0; - - wdev->poll_irq = false; - err = wdev->hwbus_ops->irq_subscribe(wdev->hwbus_priv); - if (err) - goto err0; - - err = hif_use_multi_tx_conf(wdev, true); - if (err) - dev_err(wdev->dev, "misconfigured IRQ?\n"); - - wdev->pdata.gpio_wakeup = gpio_saved; - if (wdev->pdata.gpio_wakeup) { - dev_dbg(wdev->dev, - "enable 'quiescent' power mode with wakeup GPIO and PDS file %s\n", - wdev->pdata.file_pds); - gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1); - control_reg_write(wdev, 0); - hif_set_operational_mode(wdev, HIF_OP_POWER_MODE_QUIESCENT); - } else { - hif_set_operational_mode(wdev, HIF_OP_POWER_MODE_DOZE); - } - - for (i = 0; i < ARRAY_SIZE(wdev->addresses); i++) { - eth_zero_addr(wdev->addresses[i].addr); - macaddr = of_get_mac_address(wdev->dev->of_node); - if (!IS_ERR_OR_NULL(macaddr)) { - ether_addr_copy(wdev->addresses[i].addr, macaddr); - wdev->addresses[i].addr[ETH_ALEN - 1] += i; - } else { - ether_addr_copy(wdev->addresses[i].addr, - wdev->hw_caps.mac_addr[i]); - } - if (!is_valid_ether_addr(wdev->addresses[i].addr)) { - dev_warn(wdev->dev, "using random MAC address\n"); - eth_random_addr(wdev->addresses[i].addr); - } - dev_info(wdev->dev, "MAC address %d: %pM\n", i, - wdev->addresses[i].addr); - } - wdev->hw->wiphy->n_addresses = ARRAY_SIZE(wdev->addresses); - wdev->hw->wiphy->addresses = wdev->addresses; - - err = ieee80211_register_hw(wdev->hw); - if (err) - goto err1; - - err = wfx_debug_init(wdev); - if (err) - goto err2; - - return 0; - -err2: - ieee80211_unregister_hw(wdev->hw); -err1: - wdev->hwbus_ops->irq_unsubscribe(wdev->hwbus_priv); -err0: - wfx_bh_unregister(wdev); - return err; -} - -void wfx_release(struct wfx_dev *wdev) -{ - ieee80211_unregister_hw(wdev->hw); - hif_shutdown(wdev); - wdev->hwbus_ops->irq_unsubscribe(wdev->hwbus_priv); - wfx_bh_unregister(wdev); -} - -static int __init wfx_core_init(void) -{ - int ret = 0; - - if (IS_ENABLED(CONFIG_SPI)) - ret = spi_register_driver(&wfx_spi_driver); - if (IS_ENABLED(CONFIG_MMC) && !ret) - ret = sdio_register_driver(&wfx_sdio_driver); - return ret; -} -module_init(wfx_core_init); - -static void __exit wfx_core_exit(void) -{ - if (IS_ENABLED(CONFIG_MMC)) - sdio_unregister_driver(&wfx_sdio_driver); - if (IS_ENABLED(CONFIG_SPI)) - spi_unregister_driver(&wfx_spi_driver); -} -module_exit(wfx_core_exit); diff --git a/drivers/staging/wfx/main.h b/drivers/staging/wfx/main.h deleted file mode 100644 index a0db322383a3..000000000000 --- a/drivers/staging/wfx/main.h +++ /dev/null @@ -1,44 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Device probe and register. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - * Copyright (c) 2006, Michael Wu - * Copyright 2004-2006 Jean-Baptiste Note , et al. - */ -#ifndef WFX_MAIN_H -#define WFX_MAIN_H - -#include -#include - -#include "hif_api_general.h" - -struct wfx_dev; -struct hwbus_ops; - -struct wfx_platform_data { - /* Keyset and ".sec" extension will be appended to this string */ - const char *file_fw; - const char *file_pds; - struct gpio_desc *gpio_wakeup; - /* - * if true HIF D_out is sampled on the rising edge of the clock - * (intended to be used in 50Mhz SDIO) - */ - bool use_rising_clk; -}; - -struct wfx_dev *wfx_init_common(struct device *dev, - const struct wfx_platform_data *pdata, - const struct hwbus_ops *hwbus_ops, - void *hwbus_priv); - -int wfx_probe(struct wfx_dev *wdev); -void wfx_release(struct wfx_dev *wdev); - -bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor); -int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len); - -#endif diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c deleted file mode 100644 index 31c37f69c295..000000000000 --- a/drivers/staging/wfx/queue.c +++ /dev/null @@ -1,304 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * O(1) TX queue with built-in allocator. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#include -#include - -#include "queue.h" -#include "wfx.h" -#include "sta.h" -#include "data_tx.h" -#include "traces.h" - -void wfx_tx_lock(struct wfx_dev *wdev) -{ - atomic_inc(&wdev->tx_lock); -} - -void wfx_tx_unlock(struct wfx_dev *wdev) -{ - int tx_lock = atomic_dec_return(&wdev->tx_lock); - - WARN(tx_lock < 0, "inconsistent tx_lock value"); - if (!tx_lock) - wfx_bh_request_tx(wdev); -} - -void wfx_tx_flush(struct wfx_dev *wdev) -{ - int ret; - - // Do not wait for any reply if chip is frozen - if (wdev->chip_frozen) - return; - - wfx_tx_lock(wdev); - mutex_lock(&wdev->hif_cmd.lock); - ret = wait_event_timeout(wdev->hif.tx_buffers_empty, - !wdev->hif.tx_buffers_used, - msecs_to_jiffies(3000)); - if (!ret) { - dev_warn(wdev->dev, "cannot flush tx buffers (%d still busy)\n", - wdev->hif.tx_buffers_used); - wfx_pending_dump_old_frames(wdev, 3000); - // FIXME: drop pending frames here - wdev->chip_frozen = true; - } - mutex_unlock(&wdev->hif_cmd.lock); - wfx_tx_unlock(wdev); -} - -void wfx_tx_lock_flush(struct wfx_dev *wdev) -{ - wfx_tx_lock(wdev); - wfx_tx_flush(wdev); -} - -void wfx_tx_queues_init(struct wfx_vif *wvif) -{ - // The device is in charge to respect the details of the QoS parameters. - // The driver just ensure that it roughtly respect the priorities to - // avoid any shortage. - const int priorities[IEEE80211_NUM_ACS] = { 1, 2, 64, 128 }; - int i; - - for (i = 0; i < IEEE80211_NUM_ACS; ++i) { - skb_queue_head_init(&wvif->tx_queue[i].normal); - skb_queue_head_init(&wvif->tx_queue[i].cab); - wvif->tx_queue[i].priority = priorities[i]; - } -} - -void wfx_tx_queues_check_empty(struct wfx_vif *wvif) -{ - int i; - - for (i = 0; i < IEEE80211_NUM_ACS; ++i) { - WARN_ON(atomic_read(&wvif->tx_queue[i].pending_frames)); - WARN_ON(!skb_queue_empty_lockless(&wvif->tx_queue[i].normal)); - WARN_ON(!skb_queue_empty_lockless(&wvif->tx_queue[i].cab)); - } -} - -bool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue) -{ - return skb_queue_empty(&queue->normal) && skb_queue_empty(&queue->cab); -} - -static void __wfx_tx_queue_drop(struct wfx_vif *wvif, - struct sk_buff_head *skb_queue, - struct sk_buff_head *dropped) -{ - struct sk_buff *skb, *tmp; - - spin_lock_bh(&skb_queue->lock); - skb_queue_walk_safe(skb_queue, skb, tmp) { - __skb_unlink(skb, skb_queue); - skb_queue_head(dropped, skb); - } - spin_unlock_bh(&skb_queue->lock); -} - -void wfx_tx_queue_drop(struct wfx_vif *wvif, struct wfx_queue *queue, - struct sk_buff_head *dropped) -{ - __wfx_tx_queue_drop(wvif, &queue->cab, dropped); - __wfx_tx_queue_drop(wvif, &queue->normal, dropped); - wake_up(&wvif->wdev->tx_dequeue); -} - -void wfx_tx_queues_put(struct wfx_vif *wvif, struct sk_buff *skb) -{ - struct wfx_queue *queue = &wvif->tx_queue[skb_get_queue_mapping(skb)]; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - - if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) - skb_queue_tail(&queue->cab, skb); - else - skb_queue_tail(&queue->normal, skb); -} - -void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped) -{ - struct wfx_queue *queue; - struct wfx_vif *wvif; - struct hif_msg *hif; - struct sk_buff *skb; - - WARN(!wdev->chip_frozen, "%s should only be used to recover a frozen device", - __func__); - while ((skb = skb_dequeue(&wdev->tx_pending)) != NULL) { - hif = (struct hif_msg *)skb->data; - wvif = wdev_to_wvif(wdev, hif->interface); - if (wvif) { - queue = &wvif->tx_queue[skb_get_queue_mapping(skb)]; - WARN_ON(skb_get_queue_mapping(skb) > 3); - WARN_ON(!atomic_read(&queue->pending_frames)); - atomic_dec(&queue->pending_frames); - } - skb_queue_head(dropped, skb); - } -} - -struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id) -{ - struct wfx_queue *queue; - struct hif_req_tx *req; - struct wfx_vif *wvif; - struct hif_msg *hif; - struct sk_buff *skb; - - spin_lock_bh(&wdev->tx_pending.lock); - skb_queue_walk(&wdev->tx_pending, skb) { - hif = (struct hif_msg *)skb->data; - req = (struct hif_req_tx *)hif->body; - if (req->packet_id != packet_id) - continue; - spin_unlock_bh(&wdev->tx_pending.lock); - wvif = wdev_to_wvif(wdev, hif->interface); - if (wvif) { - queue = &wvif->tx_queue[skb_get_queue_mapping(skb)]; - WARN_ON(skb_get_queue_mapping(skb) > 3); - WARN_ON(!atomic_read(&queue->pending_frames)); - atomic_dec(&queue->pending_frames); - } - skb_unlink(skb, &wdev->tx_pending); - return skb; - } - spin_unlock_bh(&wdev->tx_pending.lock); - WARN(1, "cannot find packet in pending queue"); - return NULL; -} - -void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms) -{ - ktime_t now = ktime_get(); - struct wfx_tx_priv *tx_priv; - struct hif_req_tx *req; - struct sk_buff *skb; - bool first = true; - - spin_lock_bh(&wdev->tx_pending.lock); - skb_queue_walk(&wdev->tx_pending, skb) { - tx_priv = wfx_skb_tx_priv(skb); - req = wfx_skb_txreq(skb); - if (ktime_after(now, ktime_add_ms(tx_priv->xmit_timestamp, - limit_ms))) { - if (first) { - dev_info(wdev->dev, "frames stuck in firmware since %dms or more:\n", - limit_ms); - first = false; - } - dev_info(wdev->dev, " id %08x sent %lldms ago\n", - req->packet_id, - ktime_ms_delta(now, tx_priv->xmit_timestamp)); - } - } - spin_unlock_bh(&wdev->tx_pending.lock); -} - -unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, - struct sk_buff *skb) -{ - ktime_t now = ktime_get(); - struct wfx_tx_priv *tx_priv = wfx_skb_tx_priv(skb); - - return ktime_us_delta(now, tx_priv->xmit_timestamp); -} - -bool wfx_tx_queues_has_cab(struct wfx_vif *wvif) -{ - int i; - - if (wvif->vif->type != NL80211_IFTYPE_AP) - return false; - for (i = 0; i < IEEE80211_NUM_ACS; ++i) - // Note: since only AP can have mcast frames in queue and only - // one vif can be AP, all queued frames has same interface id - if (!skb_queue_empty_lockless(&wvif->tx_queue[i].cab)) - return true; - return false; -} - -static int wfx_tx_queue_get_weight(struct wfx_queue *queue) -{ - return atomic_read(&queue->pending_frames) * queue->priority; -} - -static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev) -{ - struct wfx_queue *queues[IEEE80211_NUM_ACS * ARRAY_SIZE(wdev->vif)]; - int i, j, num_queues = 0; - struct wfx_vif *wvif; - struct hif_msg *hif; - struct sk_buff *skb; - - // sort the queues - wvif = NULL; - while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - WARN_ON(num_queues >= ARRAY_SIZE(queues)); - queues[num_queues] = &wvif->tx_queue[i]; - for (j = num_queues; j > 0; j--) - if (wfx_tx_queue_get_weight(queues[j]) < - wfx_tx_queue_get_weight(queues[j - 1])) - swap(queues[j - 1], queues[j]); - num_queues++; - } - } - - wvif = NULL; - while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { - if (!wvif->after_dtim_tx_allowed) - continue; - for (i = 0; i < num_queues; i++) { - skb = skb_dequeue(&queues[i]->cab); - if (!skb) - continue; - // Note: since only AP can have mcast frames in queue - // and only one vif can be AP, all queued frames has - // same interface id - hif = (struct hif_msg *)skb->data; - WARN_ON(hif->interface != wvif->id); - WARN_ON(queues[i] != - &wvif->tx_queue[skb_get_queue_mapping(skb)]); - atomic_inc(&queues[i]->pending_frames); - trace_queues_stats(wdev, queues[i]); - return skb; - } - // No more multicast to sent - wvif->after_dtim_tx_allowed = false; - schedule_work(&wvif->update_tim_work); - } - - for (i = 0; i < num_queues; i++) { - skb = skb_dequeue(&queues[i]->normal); - if (skb) { - atomic_inc(&queues[i]->pending_frames); - trace_queues_stats(wdev, queues[i]); - return skb; - } - } - return NULL; -} - -struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) -{ - struct wfx_tx_priv *tx_priv; - struct sk_buff *skb; - - if (atomic_read(&wdev->tx_lock)) - return NULL; - skb = wfx_tx_queues_get_skb(wdev); - if (!skb) - return NULL; - skb_queue_tail(&wdev->tx_pending, skb); - wake_up(&wdev->tx_dequeue); - tx_priv = wfx_skb_tx_priv(skb); - tx_priv->xmit_timestamp = ktime_get(); - return (struct hif_msg *)skb->data; -} diff --git a/drivers/staging/wfx/queue.h b/drivers/staging/wfx/queue.h deleted file mode 100644 index 80ba19455ef3..000000000000 --- a/drivers/staging/wfx/queue.h +++ /dev/null @@ -1,45 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * O(1) TX queue with built-in allocator. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#ifndef WFX_QUEUE_H -#define WFX_QUEUE_H - -#include -#include - -struct wfx_dev; -struct wfx_vif; - -struct wfx_queue { - struct sk_buff_head normal; - struct sk_buff_head cab; // Content After (DTIM) Beacon - atomic_t pending_frames; - int priority; -}; - -void wfx_tx_lock(struct wfx_dev *wdev); -void wfx_tx_unlock(struct wfx_dev *wdev); -void wfx_tx_flush(struct wfx_dev *wdev); -void wfx_tx_lock_flush(struct wfx_dev *wdev); - -void wfx_tx_queues_init(struct wfx_vif *wvif); -void wfx_tx_queues_check_empty(struct wfx_vif *wvif); -bool wfx_tx_queues_has_cab(struct wfx_vif *wvif); -void wfx_tx_queues_put(struct wfx_vif *wvif, struct sk_buff *skb); -struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev); - -bool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue); -void wfx_tx_queue_drop(struct wfx_vif *wvif, struct wfx_queue *queue, - struct sk_buff_head *dropped); - -struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id); -void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped); -unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, - struct sk_buff *skb); -void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms); - -#endif /* WFX_QUEUE_H */ diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c deleted file mode 100644 index fb47c7cddf2f..000000000000 --- a/drivers/staging/wfx/scan.c +++ /dev/null @@ -1,132 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Scan related functions. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#include - -#include "scan.h" -#include "wfx.h" -#include "sta.h" -#include "hif_tx_mib.h" - -static void __ieee80211_scan_completed_compat(struct ieee80211_hw *hw, - bool aborted) -{ - struct cfg80211_scan_info info = { - .aborted = aborted, - }; - - ieee80211_scan_completed(hw, &info); -} - -static int update_probe_tmpl(struct wfx_vif *wvif, - struct cfg80211_scan_request *req) -{ - struct sk_buff *skb; - - skb = ieee80211_probereq_get(wvif->wdev->hw, wvif->vif->addr, - NULL, 0, req->ie_len); - if (!skb) - return -ENOMEM; - - skb_put_data(skb, req->ie, req->ie_len); - hif_set_template_frame(wvif, skb, HIF_TMPLT_PRBREQ, 0); - dev_kfree_skb(skb); - return 0; -} - -static int send_scan_req(struct wfx_vif *wvif, - struct cfg80211_scan_request *req, int start_idx) -{ - int i, ret, timeout; - struct ieee80211_channel *ch_start, *ch_cur; - - for (i = start_idx; i < req->n_channels; i++) { - ch_start = req->channels[start_idx]; - ch_cur = req->channels[i]; - WARN(ch_cur->band != NL80211_BAND_2GHZ, "band not supported"); - if (ch_cur->max_power != ch_start->max_power) - break; - if ((ch_cur->flags ^ ch_start->flags) & IEEE80211_CHAN_NO_IR) - break; - } - wfx_tx_lock_flush(wvif->wdev); - wvif->scan_abort = false; - reinit_completion(&wvif->scan_complete); - ret = hif_scan(wvif, req, start_idx, i - start_idx, &timeout); - if (ret) { - wfx_tx_unlock(wvif->wdev); - return -EIO; - } - ret = wait_for_completion_timeout(&wvif->scan_complete, timeout); - if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower) - hif_set_output_power(wvif, wvif->vif->bss_conf.txpower); - wfx_tx_unlock(wvif->wdev); - if (!ret) { - dev_notice(wvif->wdev->dev, "scan timeout\n"); - hif_stop_scan(wvif); - return -ETIMEDOUT; - } - if (wvif->scan_abort) { - dev_notice(wvif->wdev->dev, "scan abort\n"); - return -ECONNABORTED; - } - return i - start_idx; -} - -/* - * It is not really necessary to run scan request asynchronously. However, - * there is a bug in "iw scan" when ieee80211_scan_completed() is called before - * wfx_hw_scan() return - */ -void wfx_hw_scan_work(struct work_struct *work) -{ - struct wfx_vif *wvif = container_of(work, struct wfx_vif, scan_work); - struct ieee80211_scan_request *hw_req = wvif->scan_req; - int chan_cur, ret; - - mutex_lock(&wvif->wdev->conf_mutex); - mutex_lock(&wvif->scan_lock); - if (wvif->join_in_progress) { - dev_info(wvif->wdev->dev, "%s: abort in-progress REQ_JOIN", - __func__); - wfx_reset(wvif); - } - update_probe_tmpl(wvif, &hw_req->req); - chan_cur = 0; - do { - ret = send_scan_req(wvif, &hw_req->req, chan_cur); - if (ret > 0) - chan_cur += ret; - } while (ret > 0 && chan_cur < hw_req->req.n_channels); - mutex_unlock(&wvif->scan_lock); - mutex_unlock(&wvif->wdev->conf_mutex); - __ieee80211_scan_completed_compat(wvif->wdev->hw, ret < 0); -} - -int wfx_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_scan_request *hw_req) -{ - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - - WARN_ON(hw_req->req.n_channels > HIF_API_MAX_NB_CHANNELS); - wvif->scan_req = hw_req; - schedule_work(&wvif->scan_work); - return 0; -} - -void wfx_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - - wvif->scan_abort = true; - hif_stop_scan(wvif); -} - -void wfx_scan_complete(struct wfx_vif *wvif) -{ - complete(&wvif->scan_complete); -} diff --git a/drivers/staging/wfx/scan.h b/drivers/staging/wfx/scan.h deleted file mode 100644 index c7496a766478..000000000000 --- a/drivers/staging/wfx/scan.h +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Scan related functions. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#ifndef WFX_SCAN_H -#define WFX_SCAN_H - -#include - -struct wfx_dev; -struct wfx_vif; - -void wfx_hw_scan_work(struct work_struct *work); -int wfx_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_scan_request *req); -void wfx_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif); -void wfx_scan_complete(struct wfx_vif *wvif); - -#endif /* WFX_SCAN_H */ diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c deleted file mode 100644 index cb7e8abdf43c..000000000000 --- a/drivers/staging/wfx/sta.c +++ /dev/null @@ -1,807 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Implementation of mac80211 API. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#include -#include - -#include "sta.h" -#include "wfx.h" -#include "fwio.h" -#include "bh.h" -#include "key.h" -#include "scan.h" -#include "debug.h" -#include "hif_tx.h" -#include "hif_tx_mib.h" - -#define HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES 2 - -u32 wfx_rate_mask_to_hw(struct wfx_dev *wdev, u32 rates) -{ - int i; - u32 ret = 0; - // WFx only support 2GHz - struct ieee80211_supported_band *sband = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]; - - for (i = 0; i < sband->n_bitrates; i++) { - if (rates & BIT(i)) { - if (i >= sband->n_bitrates) - dev_warn(wdev->dev, "unsupported basic rate\n"); - else - ret |= BIT(sband->bitrates[i].hw_value); - } - } - return ret; -} - -void wfx_cooling_timeout_work(struct work_struct *work) -{ - struct wfx_dev *wdev = container_of(to_delayed_work(work), - struct wfx_dev, - cooling_timeout_work); - - wdev->chip_frozen = true; - wfx_tx_unlock(wdev); -} - -void wfx_suspend_hot_dev(struct wfx_dev *wdev, enum sta_notify_cmd cmd) -{ - if (cmd == STA_NOTIFY_AWAKE) { - // Device recover normal temperature - if (cancel_delayed_work(&wdev->cooling_timeout_work)) - wfx_tx_unlock(wdev); - } else { - // Device is too hot - schedule_delayed_work(&wdev->cooling_timeout_work, 10 * HZ); - wfx_tx_lock(wdev); - } -} - -static void wfx_filter_beacon(struct wfx_vif *wvif, bool filter_beacon) -{ - static const struct hif_ie_table_entry filter_ies[] = { - { - .ie_id = WLAN_EID_VENDOR_SPECIFIC, - .has_changed = 1, - .no_longer = 1, - .has_appeared = 1, - .oui = { 0x50, 0x6F, 0x9A }, - }, { - .ie_id = WLAN_EID_HT_OPERATION, - .has_changed = 1, - .no_longer = 1, - .has_appeared = 1, - }, { - .ie_id = WLAN_EID_ERP_INFO, - .has_changed = 1, - .no_longer = 1, - .has_appeared = 1, - } - }; - - if (!filter_beacon) { - hif_beacon_filter_control(wvif, 0, 1); - } else { - hif_set_beacon_filter_table(wvif, 3, filter_ies); - hif_beacon_filter_control(wvif, HIF_BEACON_FILTER_ENABLE, 0); - } -} - -void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, - unsigned int *total_flags, u64 unused) -{ - struct wfx_vif *wvif = NULL; - struct wfx_dev *wdev = hw->priv; - bool filter_bssid, filter_prbreq, filter_beacon; - - // Notes: - // - Probe responses (FIF_BCN_PRBRESP_PROMISC) are never filtered - // - PS-Poll (FIF_PSPOLL) are never filtered - // - RTS, CTS and Ack (FIF_CONTROL) are always filtered - // - Broken frames (FIF_FCSFAIL and FIF_PLCPFAIL) are always filtered - // - Firmware does (yet) allow to forward unicast traffic sent to - // other stations (aka. promiscuous mode) - *total_flags &= FIF_BCN_PRBRESP_PROMISC | FIF_ALLMULTI | FIF_OTHER_BSS | - FIF_PROBE_REQ | FIF_PSPOLL; - - mutex_lock(&wdev->conf_mutex); - while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { - mutex_lock(&wvif->scan_lock); - - // Note: FIF_BCN_PRBRESP_PROMISC covers probe response and - // beacons from other BSS - if (*total_flags & FIF_BCN_PRBRESP_PROMISC) - filter_beacon = false; - else - filter_beacon = true; - wfx_filter_beacon(wvif, filter_beacon); - - if (*total_flags & FIF_OTHER_BSS) - filter_bssid = false; - else - filter_bssid = true; - - // In AP mode, chip can reply to probe request itself - if (*total_flags & FIF_PROBE_REQ && - wvif->vif->type == NL80211_IFTYPE_AP) { - dev_dbg(wdev->dev, "do not forward probe request in AP mode\n"); - *total_flags &= ~FIF_PROBE_REQ; - } - - if (*total_flags & FIF_PROBE_REQ) - filter_prbreq = false; - else - filter_prbreq = true; - hif_set_rx_filter(wvif, filter_bssid, filter_prbreq); - - mutex_unlock(&wvif->scan_lock); - } - mutex_unlock(&wdev->conf_mutex); -} - -static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps) -{ - struct ieee80211_channel *chan0 = NULL, *chan1 = NULL; - struct ieee80211_conf *conf = &wvif->wdev->hw->conf; - - WARN(!wvif->vif->bss_conf.assoc && enable_ps, - "enable_ps is reliable only if associated"); - if (wdev_to_wvif(wvif->wdev, 0)) - chan0 = wdev_to_wvif(wvif->wdev, 0)->vif->bss_conf.chandef.chan; - if (wdev_to_wvif(wvif->wdev, 1)) - chan1 = wdev_to_wvif(wvif->wdev, 1)->vif->bss_conf.chandef.chan; - if (chan0 && chan1 && chan0->hw_value != chan1->hw_value && - wvif->vif->type != NL80211_IFTYPE_AP) { - // It is necessary to enable powersave if channels - // are different. - if (enable_ps) - *enable_ps = true; - if (wvif->wdev->force_ps_timeout > -1) - return wvif->wdev->force_ps_timeout; - else if (wfx_api_older_than(wvif->wdev, 3, 2)) - return 0; - else - return 30; - } - if (enable_ps) - *enable_ps = wvif->vif->bss_conf.ps; - if (wvif->wdev->force_ps_timeout > -1) - return wvif->wdev->force_ps_timeout; - else if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps) - return conf->dynamic_ps_timeout; - else - return -1; -} - -int wfx_update_pm(struct wfx_vif *wvif) -{ - int ps_timeout; - bool ps; - - if (!wvif->vif->bss_conf.assoc) - return 0; - ps_timeout = wfx_get_ps_timeout(wvif, &ps); - if (!ps) - ps_timeout = 0; - WARN_ON(ps_timeout < 0); - if (wvif->uapsd_mask) - ps_timeout = 0; - - if (!wait_for_completion_timeout(&wvif->set_pm_mode_complete, - TU_TO_JIFFIES(512))) - dev_warn(wvif->wdev->dev, - "timeout while waiting of set_pm_mode_complete\n"); - return hif_set_pm(wvif, ps, ps_timeout); -} - -int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - u16 queue, const struct ieee80211_tx_queue_params *params) -{ - struct wfx_dev *wdev = hw->priv; - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - int old_uapsd = wvif->uapsd_mask; - - WARN_ON(queue >= hw->queues); - - mutex_lock(&wdev->conf_mutex); - assign_bit(queue, &wvif->uapsd_mask, params->uapsd); - hif_set_edca_queue_params(wvif, queue, params); - if (wvif->vif->type == NL80211_IFTYPE_STATION && - old_uapsd != wvif->uapsd_mask) { - hif_set_uapsd_info(wvif, wvif->uapsd_mask); - wfx_update_pm(wvif); - } - mutex_unlock(&wdev->conf_mutex); - return 0; -} - -int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value) -{ - struct wfx_dev *wdev = hw->priv; - struct wfx_vif *wvif = NULL; - - while ((wvif = wvif_iterate(wdev, wvif)) != NULL) - hif_rts_threshold(wvif, value); - return 0; -} - -/* WSM callbacks */ - -void wfx_event_report_rssi(struct wfx_vif *wvif, u8 raw_rcpi_rssi) -{ - /* RSSI: signed Q8.0, RCPI: unsigned Q7.1 - * RSSI = RCPI / 2 - 110 - */ - int rcpi_rssi; - int cqm_evt; - - rcpi_rssi = raw_rcpi_rssi / 2 - 110; - if (rcpi_rssi <= wvif->vif->bss_conf.cqm_rssi_thold) - cqm_evt = NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW; - else - cqm_evt = NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH; - ieee80211_cqm_rssi_notify(wvif->vif, cqm_evt, rcpi_rssi, GFP_KERNEL); -} - -static void wfx_beacon_loss_work(struct work_struct *work) -{ - struct wfx_vif *wvif = container_of(to_delayed_work(work), - struct wfx_vif, beacon_loss_work); - struct ieee80211_bss_conf *bss_conf = &wvif->vif->bss_conf; - - ieee80211_beacon_loss(wvif->vif); - schedule_delayed_work(to_delayed_work(work), - msecs_to_jiffies(bss_conf->beacon_int)); -} - -void wfx_set_default_unicast_key(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, int idx) -{ - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - - hif_wep_default_key_id(wvif, idx); -} - -void wfx_reset(struct wfx_vif *wvif) -{ - struct wfx_dev *wdev = wvif->wdev; - - wfx_tx_lock_flush(wdev); - hif_reset(wvif, false); - wfx_tx_policy_init(wvif); - if (wvif_count(wdev) <= 1) - hif_set_block_ack_policy(wvif, 0xFF, 0xFF); - wfx_tx_unlock(wdev); - wvif->join_in_progress = false; - cancel_delayed_work_sync(&wvif->beacon_loss_work); - wvif = NULL; - while ((wvif = wvif_iterate(wdev, wvif)) != NULL) - wfx_update_pm(wvif); -} - -int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; - - sta_priv->vif_id = wvif->id; - - if (vif->type == NL80211_IFTYPE_STATION) - hif_set_mfp(wvif, sta->mfp, sta->mfp); - - // In station mode, the firmware interprets new link-id as a TDLS peer. - if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) - return 0; - sta_priv->link_id = ffz(wvif->link_id_map); - wvif->link_id_map |= BIT(sta_priv->link_id); - WARN_ON(!sta_priv->link_id); - WARN_ON(sta_priv->link_id >= HIF_LINK_ID_MAX); - hif_map_link(wvif, false, sta->addr, sta_priv->link_id, sta->mfp); - - return 0; -} - -int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; - - // See note in wfx_sta_add() - if (!sta_priv->link_id) - return 0; - // FIXME add a mutex? - hif_map_link(wvif, true, sta->addr, sta_priv->link_id, false); - wvif->link_id_map &= ~BIT(sta_priv->link_id); - return 0; -} - -static int wfx_upload_ap_templates(struct wfx_vif *wvif) -{ - struct sk_buff *skb; - - skb = ieee80211_beacon_get(wvif->wdev->hw, wvif->vif); - if (!skb) - return -ENOMEM; - hif_set_template_frame(wvif, skb, HIF_TMPLT_BCN, - API_RATE_INDEX_B_1MBPS); - dev_kfree_skb(skb); - - skb = ieee80211_proberesp_get(wvif->wdev->hw, wvif->vif); - if (!skb) - return -ENOMEM; - hif_set_template_frame(wvif, skb, HIF_TMPLT_PRBRES, - API_RATE_INDEX_B_1MBPS); - dev_kfree_skb(skb); - return 0; -} - -static void wfx_set_mfp_ap(struct wfx_vif *wvif) -{ - struct sk_buff *skb = ieee80211_beacon_get(wvif->wdev->hw, wvif->vif); - const int ieoffset = offsetof(struct ieee80211_mgmt, u.beacon.variable); - const u16 *ptr = (u16 *)cfg80211_find_ie(WLAN_EID_RSN, - skb->data + ieoffset, - skb->len - ieoffset); - const int pairwise_cipher_suite_count_offset = 8 / sizeof(u16); - const int pairwise_cipher_suite_size = 4 / sizeof(u16); - const int akm_suite_size = 4 / sizeof(u16); - - if (ptr) { - ptr += pairwise_cipher_suite_count_offset; - if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) - return; - ptr += 1 + pairwise_cipher_suite_size * *ptr; - if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) - return; - ptr += 1 + akm_suite_size * *ptr; - if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) - return; - hif_set_mfp(wvif, *ptr & BIT(7), *ptr & BIT(6)); - } -} - -int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - struct wfx_dev *wdev = wvif->wdev; - int ret; - - wvif = NULL; - while ((wvif = wvif_iterate(wdev, wvif)) != NULL) - wfx_update_pm(wvif); - wvif = (struct wfx_vif *)vif->drv_priv; - wfx_upload_ap_templates(wvif); - ret = hif_start(wvif, &vif->bss_conf, wvif->channel); - if (ret > 0) - return -EIO; - wfx_set_mfp_ap(wvif); - return ret; -} - -void wfx_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - - wfx_reset(wvif); -} - -static void wfx_join(struct wfx_vif *wvif) -{ - int ret; - struct ieee80211_bss_conf *conf = &wvif->vif->bss_conf; - struct cfg80211_bss *bss = NULL; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - const u8 *ssidie = NULL; - int ssidlen = 0; - - wfx_tx_lock_flush(wvif->wdev); - - bss = cfg80211_get_bss(wvif->wdev->hw->wiphy, wvif->channel, - conf->bssid, NULL, 0, - IEEE80211_BSS_TYPE_ANY, IEEE80211_PRIVACY_ANY); - if (!bss && !conf->ibss_joined) { - wfx_tx_unlock(wvif->wdev); - return; - } - - rcu_read_lock(); // protect ssidie - if (bss) - ssidie = ieee80211_bss_get_ie(bss, WLAN_EID_SSID); - if (ssidie) { - ssidlen = ssidie[1]; - if (ssidlen > IEEE80211_MAX_SSID_LEN) - ssidlen = IEEE80211_MAX_SSID_LEN; - memcpy(ssid, &ssidie[2], ssidlen); - } - rcu_read_unlock(); - - cfg80211_put_bss(wvif->wdev->hw->wiphy, bss); - - wvif->join_in_progress = true; - ret = hif_join(wvif, conf, wvif->channel, ssid, ssidlen); - if (ret) { - ieee80211_connection_loss(wvif->vif); - wfx_reset(wvif); - } else { - /* Due to beacon filtering it is possible that the - * AP's beacon is not known for the mac80211 stack. - * Disable filtering temporary to make sure the stack - * receives at least one - */ - wfx_filter_beacon(wvif, false); - } - wfx_tx_unlock(wvif->wdev); -} - -static void wfx_join_finalize(struct wfx_vif *wvif, - struct ieee80211_bss_conf *info) -{ - struct ieee80211_sta *sta = NULL; - int ampdu_density = 0; - bool greenfield = false; - - rcu_read_lock(); // protect sta - if (info->bssid && !info->ibss_joined) - sta = ieee80211_find_sta(wvif->vif, info->bssid); - if (sta && sta->ht_cap.ht_supported) - ampdu_density = sta->ht_cap.ampdu_density; - if (sta && sta->ht_cap.ht_supported && - !(info->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT)) - greenfield = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD); - rcu_read_unlock(); - - wvif->join_in_progress = false; - hif_set_association_mode(wvif, ampdu_density, greenfield, - info->use_short_preamble); - hif_keep_alive_period(wvif, 0); - // beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use - // the same value. - hif_set_bss_params(wvif, info->aid, 7); - hif_set_beacon_wakeup_period(wvif, 1, 1); - wfx_update_pm(wvif); -} - -int wfx_join_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - - wfx_upload_ap_templates(wvif); - wfx_join(wvif); - return 0; -} - -void wfx_leave_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - - wfx_reset(wvif); -} - -static void wfx_enable_beacon(struct wfx_vif *wvif, bool enable) -{ - // Driver has Content After DTIM Beacon in queue. Driver is waiting for - // a signal from the firmware. Since we are going to stop to send - // beacons, this signal will never happens. See also - // wfx_suspend_resume_mc() - if (!enable && wfx_tx_queues_has_cab(wvif)) { - wvif->after_dtim_tx_allowed = true; - wfx_bh_request_tx(wvif->wdev); - } - hif_beacon_transmit(wvif, enable); -} - -void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_bss_conf *info, u32 changed) -{ - struct wfx_dev *wdev = hw->priv; - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - int i; - - mutex_lock(&wdev->conf_mutex); - - if (changed & BSS_CHANGED_BASIC_RATES || - changed & BSS_CHANGED_BEACON_INT || - changed & BSS_CHANGED_BSSID) { - if (vif->type == NL80211_IFTYPE_STATION) - wfx_join(wvif); - } - - if (changed & BSS_CHANGED_ASSOC) { - if (info->assoc || info->ibss_joined) - wfx_join_finalize(wvif, info); - else if (!info->assoc && vif->type == NL80211_IFTYPE_STATION) - wfx_reset(wvif); - else - dev_warn(wdev->dev, "%s: misunderstood change: ASSOC\n", - __func__); - } - - if (changed & BSS_CHANGED_BEACON_INFO) { - if (vif->type != NL80211_IFTYPE_STATION) - dev_warn(wdev->dev, "%s: misunderstood change: BEACON_INFO\n", - __func__); - hif_set_beacon_wakeup_period(wvif, info->dtim_period, - info->dtim_period); - // We temporary forwarded beacon for join process. It is now no - // more necessary. - wfx_filter_beacon(wvif, true); - } - - if (changed & BSS_CHANGED_ARP_FILTER) { - for (i = 0; i < HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES; i++) { - __be32 *arp_addr = &info->arp_addr_list[i]; - - if (info->arp_addr_cnt > HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES) - arp_addr = NULL; - if (i >= info->arp_addr_cnt) - arp_addr = NULL; - hif_set_arp_ipv4_filter(wvif, i, arp_addr); - } - } - - if (changed & BSS_CHANGED_AP_PROBE_RESP || - changed & BSS_CHANGED_BEACON) - wfx_upload_ap_templates(wvif); - - if (changed & BSS_CHANGED_BEACON_ENABLED) - wfx_enable_beacon(wvif, info->enable_beacon); - - if (changed & BSS_CHANGED_KEEP_ALIVE) - hif_keep_alive_period(wvif, info->max_idle_period * - USEC_PER_TU / USEC_PER_MSEC); - - if (changed & BSS_CHANGED_ERP_CTS_PROT) - hif_erp_use_protection(wvif, info->use_cts_prot); - - if (changed & BSS_CHANGED_ERP_SLOT) - hif_slot_time(wvif, info->use_short_slot ? 9 : 20); - - if (changed & BSS_CHANGED_CQM) - hif_set_rcpi_rssi_threshold(wvif, info->cqm_rssi_thold, - info->cqm_rssi_hyst); - - if (changed & BSS_CHANGED_TXPOWER) - hif_set_output_power(wvif, info->txpower); - - if (changed & BSS_CHANGED_PS) - wfx_update_pm(wvif); - - mutex_unlock(&wdev->conf_mutex); -} - -static int wfx_update_tim(struct wfx_vif *wvif) -{ - struct sk_buff *skb; - u16 tim_offset, tim_length; - u8 *tim_ptr; - - skb = ieee80211_beacon_get_tim(wvif->wdev->hw, wvif->vif, - &tim_offset, &tim_length); - if (!skb) - return -ENOENT; - tim_ptr = skb->data + tim_offset; - - if (tim_offset && tim_length >= 6) { - /* Ignore DTIM count from mac80211: - * firmware handles DTIM internally. - */ - tim_ptr[2] = 0; - - /* Set/reset aid0 bit */ - if (wfx_tx_queues_has_cab(wvif)) - tim_ptr[4] |= 1; - else - tim_ptr[4] &= ~1; - } - - hif_update_ie_beacon(wvif, tim_ptr, tim_length); - dev_kfree_skb(skb); - - return 0; -} - -static void wfx_update_tim_work(struct work_struct *work) -{ - struct wfx_vif *wvif = container_of(work, struct wfx_vif, update_tim_work); - - wfx_update_tim(wvif); -} - -int wfx_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set) -{ - struct wfx_dev *wdev = hw->priv; - struct wfx_sta_priv *sta_dev = (struct wfx_sta_priv *)&sta->drv_priv; - struct wfx_vif *wvif = wdev_to_wvif(wdev, sta_dev->vif_id); - - if (!wvif) { - dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); - return -EIO; - } - schedule_work(&wvif->update_tim_work); - return 0; -} - -void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd notify_cmd) -{ - if (notify_cmd != STA_NOTIFY_AWAKE) - return; - WARN(!wfx_tx_queues_has_cab(wvif), "incorrect sequence"); - WARN(wvif->after_dtim_tx_allowed, "incorrect sequence"); - wvif->after_dtim_tx_allowed = true; - wfx_bh_request_tx(wvif->wdev); -} - -int wfx_ampdu_action(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_ampdu_params *params) -{ - // Aggregation is implemented fully in firmware - switch (params->action) { - case IEEE80211_AMPDU_RX_START: - case IEEE80211_AMPDU_RX_STOP: - // Just acknowledge it to enable frame re-ordering - return 0; - default: - // Leave the firmware doing its business for tx aggregation - return -ENOTSUPP; - } -} - -int wfx_add_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *conf) -{ - return 0; -} - -void wfx_remove_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *conf) -{ -} - -void wfx_change_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *conf, - u32 changed) -{ -} - -int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_chanctx_conf *conf) -{ - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - struct ieee80211_channel *ch = conf->def.chan; - - WARN(wvif->channel, "channel overwrite"); - wvif->channel = ch; - - return 0; -} - -void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_chanctx_conf *conf) -{ - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - struct ieee80211_channel *ch = conf->def.chan; - - WARN(wvif->channel != ch, "channel mismatch"); - wvif->channel = NULL; -} - -int wfx_config(struct ieee80211_hw *hw, u32 changed) -{ - return 0; -} - -int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - int i, ret = 0; - struct wfx_dev *wdev = hw->priv; - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - - vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | - IEEE80211_VIF_SUPPORTS_UAPSD | - IEEE80211_VIF_SUPPORTS_CQM_RSSI; - - mutex_lock(&wdev->conf_mutex); - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_AP: - break; - default: - mutex_unlock(&wdev->conf_mutex); - return -EOPNOTSUPP; - } - - // FIXME: prefer use of container_of() to get vif - wvif->vif = vif; - wvif->wdev = wdev; - - wvif->link_id_map = 1; // link-id 0 is reserved for multicast - INIT_WORK(&wvif->update_tim_work, wfx_update_tim_work); - INIT_DELAYED_WORK(&wvif->beacon_loss_work, wfx_beacon_loss_work); - - init_completion(&wvif->set_pm_mode_complete); - complete(&wvif->set_pm_mode_complete); - INIT_WORK(&wvif->tx_policy_upload_work, wfx_tx_policy_upload_work); - - mutex_init(&wvif->scan_lock); - init_completion(&wvif->scan_complete); - INIT_WORK(&wvif->scan_work, wfx_hw_scan_work); - - wfx_tx_queues_init(wvif); - wfx_tx_policy_init(wvif); - - for (i = 0; i < ARRAY_SIZE(wdev->vif); i++) { - if (!wdev->vif[i]) { - wdev->vif[i] = vif; - wvif->id = i; - break; - } - } - WARN(i == ARRAY_SIZE(wdev->vif), "try to instantiate more vif than supported"); - - hif_set_macaddr(wvif, vif->addr); - - mutex_unlock(&wdev->conf_mutex); - - wvif = NULL; - while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { - // Combo mode does not support Block Acks. We can re-enable them - if (wvif_count(wdev) == 1) - hif_set_block_ack_policy(wvif, 0xFF, 0xFF); - else - hif_set_block_ack_policy(wvif, 0x00, 0x00); - } - return ret; -} - -void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct wfx_dev *wdev = hw->priv; - struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - - wait_for_completion_timeout(&wvif->set_pm_mode_complete, msecs_to_jiffies(300)); - wfx_tx_queues_check_empty(wvif); - - mutex_lock(&wdev->conf_mutex); - WARN(wvif->link_id_map != 1, "corrupted state"); - - hif_reset(wvif, false); - hif_set_macaddr(wvif, NULL); - wfx_tx_policy_init(wvif); - - cancel_delayed_work_sync(&wvif->beacon_loss_work); - wdev->vif[wvif->id] = NULL; - wvif->vif = NULL; - - mutex_unlock(&wdev->conf_mutex); - - wvif = NULL; - while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { - // Combo mode does not support Block Acks. We can re-enable them - if (wvif_count(wdev) == 1) - hif_set_block_ack_policy(wvif, 0xFF, 0xFF); - else - hif_set_block_ack_policy(wvif, 0x00, 0x00); - } -} - -int wfx_start(struct ieee80211_hw *hw) -{ - return 0; -} - -void wfx_stop(struct ieee80211_hw *hw) -{ - struct wfx_dev *wdev = hw->priv; - - WARN_ON(!skb_queue_empty_lockless(&wdev->tx_pending)); -} diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h deleted file mode 100644 index d7b5df5ea4e6..000000000000 --- a/drivers/staging/wfx/sta.h +++ /dev/null @@ -1,73 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Implementation of mac80211 API. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - */ -#ifndef WFX_STA_H -#define WFX_STA_H - -#include - -struct wfx_dev; -struct wfx_vif; - -struct wfx_sta_priv { - int link_id; - int vif_id; -}; - -// mac80211 interface -int wfx_start(struct ieee80211_hw *hw); -void wfx_stop(struct ieee80211_hw *hw); -int wfx_config(struct ieee80211_hw *hw, u32 changed); -int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value); -void wfx_set_default_unicast_key(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, int idx); -void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, - unsigned int *total_flags, u64 unused); - -int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif); -void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif); -int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif); -void wfx_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif); -int wfx_join_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vif); -void wfx_leave_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vif); -int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - u16 queue, const struct ieee80211_tx_queue_params *params); -void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_bss_conf *info, u32 changed); -int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta); -int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta); -void wfx_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - enum sta_notify_cmd cmd, struct ieee80211_sta *sta); -int wfx_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set); -int wfx_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_ampdu_params *params); -int wfx_add_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *conf); -void wfx_remove_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *conf); -void wfx_change_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *conf, u32 changed); -int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_chanctx_conf *conf); -void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_chanctx_conf *conf); - -// WSM Callbacks -void wfx_cooling_timeout_work(struct work_struct *work); -void wfx_suspend_hot_dev(struct wfx_dev *wdev, enum sta_notify_cmd cmd); -void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd cmd); -void wfx_event_report_rssi(struct wfx_vif *wvif, u8 raw_rcpi_rssi); -int wfx_update_pm(struct wfx_vif *wvif); - -// Other Helpers -void wfx_reset(struct wfx_vif *wvif); -u32 wfx_rate_mask_to_hw(struct wfx_dev *wdev, u32 rates); - -#endif /* WFX_STA_H */ diff --git a/drivers/staging/wfx/traces.h b/drivers/staging/wfx/traces.h deleted file mode 100644 index e34c7a538c65..000000000000 --- a/drivers/staging/wfx/traces.h +++ /dev/null @@ -1,501 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Tracepoints definitions. - * - * Copyright (c) 2018-2020, Silicon Laboratories, Inc. - */ - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM wfx - -#if !defined(_WFX_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) -#define _WFX_TRACE_H - -#include -#include - -#include "bus.h" -#include "hif_api_cmd.h" -#include "hif_api_mib.h" - -/* The hell below need some explanations. For each symbolic number, we need to - * define it with TRACE_DEFINE_ENUM() and in a list for __print_symbolic. - * - * 1. Define a new macro that call TRACE_DEFINE_ENUM(): - * - * #define xxx_name(sym) TRACE_DEFINE_ENUM(sym); - * - * 2. Define list of all symbols: - * - * #define list_names \ - * ... \ - * xxx_name(XXX) \ - * ... - * - * 3. Instantiate that list_names: - * - * list_names - * - * 4. Redefine xxx_name() as an entry of array for __print_symbolic() - * - * #undef xxx_name - * #define xxx_name(msg) { msg, #msg }, - * - * 5. list_name can now nearly be used with __print_symbolic() but, - * __print_symbolic() dislike last comma of list. So we define a new list - * with a dummy element: - * - * #define list_for_print_symbolic list_names { -1, NULL } - */ - -#define _hif_msg_list \ - hif_cnf_name(ADD_KEY) \ - hif_cnf_name(BEACON_TRANSMIT) \ - hif_cnf_name(EDCA_QUEUE_PARAMS) \ - hif_cnf_name(JOIN) \ - hif_cnf_name(MAP_LINK) \ - hif_cnf_name(READ_MIB) \ - hif_cnf_name(REMOVE_KEY) \ - hif_cnf_name(RESET) \ - hif_cnf_name(SET_BSS_PARAMS) \ - hif_cnf_name(SET_PM_MODE) \ - hif_cnf_name(START) \ - hif_cnf_name(START_SCAN) \ - hif_cnf_name(STOP_SCAN) \ - hif_cnf_name(TX) \ - hif_cnf_name(MULTI_TRANSMIT) \ - hif_cnf_name(UPDATE_IE) \ - hif_cnf_name(WRITE_MIB) \ - hif_cnf_name(CONFIGURATION) \ - hif_cnf_name(CONTROL_GPIO) \ - hif_cnf_name(PREVENT_ROLLBACK) \ - hif_cnf_name(SET_SL_MAC_KEY) \ - hif_cnf_name(SL_CONFIGURE) \ - hif_cnf_name(SL_EXCHANGE_PUB_KEYS) \ - hif_cnf_name(SHUT_DOWN) \ - hif_ind_name(EVENT) \ - hif_ind_name(JOIN_COMPLETE) \ - hif_ind_name(RX) \ - hif_ind_name(SCAN_CMPL) \ - hif_ind_name(SET_PM_MODE_CMPL) \ - hif_ind_name(SUSPEND_RESUME_TX) \ - hif_ind_name(SL_EXCHANGE_PUB_KEYS) \ - hif_ind_name(ERROR) \ - hif_ind_name(EXCEPTION) \ - hif_ind_name(GENERIC) \ - hif_ind_name(WAKEUP) \ - hif_ind_name(STARTUP) - -#define hif_msg_list_enum _hif_msg_list - -#undef hif_cnf_name -#undef hif_ind_name -#define hif_cnf_name(msg) TRACE_DEFINE_ENUM(HIF_CNF_ID_##msg); -#define hif_ind_name(msg) TRACE_DEFINE_ENUM(HIF_IND_ID_##msg); -hif_msg_list_enum -#undef hif_cnf_name -#undef hif_ind_name -#define hif_cnf_name(msg) { HIF_CNF_ID_##msg, #msg }, -#define hif_ind_name(msg) { HIF_IND_ID_##msg, #msg }, -#define hif_msg_list hif_msg_list_enum { -1, NULL } - -#define _hif_mib_list \ - hif_mib_name(ARP_IP_ADDRESSES_TABLE) \ - hif_mib_name(ARP_KEEP_ALIVE_PERIOD) \ - hif_mib_name(BEACON_FILTER_ENABLE) \ - hif_mib_name(BEACON_FILTER_TABLE) \ - hif_mib_name(BEACON_STATS) \ - hif_mib_name(BEACON_WAKEUP_PERIOD) \ - hif_mib_name(BLOCK_ACK_POLICY) \ - hif_mib_name(CCA_CONFIG) \ - hif_mib_name(CONFIG_DATA_FILTER) \ - hif_mib_name(COUNTERS_TABLE) \ - hif_mib_name(CURRENT_TX_POWER_LEVEL) \ - hif_mib_name(DOT11_MAC_ADDRESS) \ - hif_mib_name(DOT11_MAX_RECEIVE_LIFETIME) \ - hif_mib_name(DOT11_MAX_TRANSMIT_MSDU_LIFETIME) \ - hif_mib_name(DOT11_RTS_THRESHOLD) \ - hif_mib_name(DOT11_WEP_DEFAULT_KEY_ID) \ - hif_mib_name(ETHERTYPE_DATAFRAME_CONDITION) \ - hif_mib_name(EXTENDED_COUNTERS_TABLE) \ - hif_mib_name(GL_BLOCK_ACK_INFO) \ - hif_mib_name(GL_OPERATIONAL_POWER_MODE) \ - hif_mib_name(GL_SET_MULTI_MSG) \ - hif_mib_name(GRP_SEQ_COUNTER) \ - hif_mib_name(INACTIVITY_TIMER) \ - hif_mib_name(INTERFACE_PROTECTION) \ - hif_mib_name(IPV4_ADDR_DATAFRAME_CONDITION) \ - hif_mib_name(IPV6_ADDR_DATAFRAME_CONDITION) \ - hif_mib_name(KEEP_ALIVE_PERIOD) \ - hif_mib_name(MAC_ADDR_DATAFRAME_CONDITION) \ - hif_mib_name(MAGIC_DATAFRAME_CONDITION) \ - hif_mib_name(MAX_TX_POWER_LEVEL) \ - hif_mib_name(NON_ERP_PROTECTION) \ - hif_mib_name(NS_IP_ADDRESSES_TABLE) \ - hif_mib_name(OVERRIDE_INTERNAL_TX_RATE) \ - hif_mib_name(PORT_DATAFRAME_CONDITION) \ - hif_mib_name(PROTECTED_MGMT_POLICY) \ - hif_mib_name(RCPI_RSSI_THRESHOLD) \ - hif_mib_name(RX_FILTER) \ - hif_mib_name(SET_ASSOCIATION_MODE) \ - hif_mib_name(SET_DATA_FILTERING) \ - hif_mib_name(SET_HT_PROTECTION) \ - hif_mib_name(SET_TX_RATE_RETRY_POLICY) \ - hif_mib_name(SET_UAPSD_INFORMATION) \ - hif_mib_name(SLOT_TIME) \ - hif_mib_name(STATISTICS_TABLE) \ - hif_mib_name(TEMPLATE_FRAME) \ - hif_mib_name(TSF_COUNTER) \ - hif_mib_name(UC_MC_BC_DATAFRAME_CONDITION) - -#define hif_mib_list_enum _hif_mib_list - -#undef hif_mib_name -#define hif_mib_name(mib) TRACE_DEFINE_ENUM(HIF_MIB_ID_##mib); -hif_mib_list_enum -#undef hif_mib_name -#define hif_mib_name(mib) { HIF_MIB_ID_##mib, #mib }, -#define hif_mib_list hif_mib_list_enum { -1, NULL } - -DECLARE_EVENT_CLASS(hif_data, - TP_PROTO(const struct hif_msg *hif, int tx_fill_level, bool is_recv), - TP_ARGS(hif, tx_fill_level, is_recv), - TP_STRUCT__entry( - __field(int, tx_fill_level) - __field(int, msg_id) - __field(const char *, msg_type) - __field(int, msg_len) - __field(int, buf_len) - __field(int, if_id) - __field(int, mib) - __array(u8, buf, 128) - ), - TP_fast_assign( - int header_len; - - __entry->tx_fill_level = tx_fill_level; - __entry->msg_len = le16_to_cpu(hif->len); - __entry->msg_id = hif->id; - __entry->if_id = hif->interface; - if (is_recv) - __entry->msg_type = __entry->msg_id & 0x80 ? "IND" : "CNF"; - else - __entry->msg_type = "REQ"; - if (!is_recv && - (__entry->msg_id == HIF_REQ_ID_READ_MIB || - __entry->msg_id == HIF_REQ_ID_WRITE_MIB)) { - __entry->mib = le16_to_cpup((__le16 *)hif->body); - header_len = 4; - } else { - __entry->mib = -1; - header_len = 0; - } - __entry->buf_len = min_t(int, __entry->msg_len, - sizeof(__entry->buf)) - - sizeof(struct hif_msg) - header_len; - memcpy(__entry->buf, hif->body + header_len, __entry->buf_len); - ), - TP_printk("%d:%d:%s_%s%s%s: %s%s (%d bytes)", - __entry->tx_fill_level, - __entry->if_id, - __entry->msg_type, - __print_symbolic(__entry->msg_id, hif_msg_list), - __entry->mib != -1 ? "/" : "", - __entry->mib != -1 ? __print_symbolic(__entry->mib, hif_mib_list) : "", - __print_hex(__entry->buf, __entry->buf_len), - __entry->msg_len > sizeof(__entry->buf) ? " ..." : "", - __entry->msg_len - ) -); -DEFINE_EVENT(hif_data, hif_send, - TP_PROTO(const struct hif_msg *hif, int tx_fill_level, bool is_recv), - TP_ARGS(hif, tx_fill_level, is_recv)); -#define _trace_hif_send(hif, tx_fill_level)\ - trace_hif_send(hif, tx_fill_level, false) -DEFINE_EVENT(hif_data, hif_recv, - TP_PROTO(const struct hif_msg *hif, int tx_fill_level, bool is_recv), - TP_ARGS(hif, tx_fill_level, is_recv)); -#define _trace_hif_recv(hif, tx_fill_level)\ - trace_hif_recv(hif, tx_fill_level, true) - -#define wfx_reg_list_enum \ - wfx_reg_name(WFX_REG_CONFIG, "CONFIG") \ - wfx_reg_name(WFX_REG_CONTROL, "CONTROL") \ - wfx_reg_name(WFX_REG_IN_OUT_QUEUE, "QUEUE") \ - wfx_reg_name(WFX_REG_AHB_DPORT, "AHB") \ - wfx_reg_name(WFX_REG_BASE_ADDR, "BASE_ADDR") \ - wfx_reg_name(WFX_REG_SRAM_DPORT, "SRAM") \ - wfx_reg_name(WFX_REG_SET_GEN_R_W, "SET_GEN_R_W") \ - wfx_reg_name(WFX_REG_FRAME_OUT, "FRAME_OUT") - -#undef wfx_reg_name -#define wfx_reg_name(sym, name) TRACE_DEFINE_ENUM(sym); -wfx_reg_list_enum -#undef wfx_reg_name -#define wfx_reg_name(sym, name) { sym, name }, -#define wfx_reg_list wfx_reg_list_enum { -1, NULL } - -DECLARE_EVENT_CLASS(io_data, - TP_PROTO(int reg, int addr, const void *io_buf, size_t len), - TP_ARGS(reg, addr, io_buf, len), - TP_STRUCT__entry( - __field(int, reg) - __field(int, addr) - __field(int, msg_len) - __field(int, buf_len) - __array(u8, buf, 32) - __array(u8, addr_str, 10) - ), - TP_fast_assign( - __entry->reg = reg; - __entry->addr = addr; - __entry->msg_len = len; - __entry->buf_len = min_t(int, sizeof(__entry->buf), - __entry->msg_len); - memcpy(__entry->buf, io_buf, __entry->buf_len); - if (addr >= 0) - snprintf(__entry->addr_str, 10, "/%08x", addr); - else - __entry->addr_str[0] = 0; - ), - TP_printk("%s%s: %s%s (%d bytes)", - __print_symbolic(__entry->reg, wfx_reg_list), - __entry->addr_str, - __print_hex(__entry->buf, __entry->buf_len), - __entry->msg_len > sizeof(__entry->buf) ? " ..." : "", - __entry->msg_len - ) -); -DEFINE_EVENT(io_data, io_write, - TP_PROTO(int reg, int addr, const void *io_buf, size_t len), - TP_ARGS(reg, addr, io_buf, len)); -#define _trace_io_ind_write(reg, addr, io_buf, len)\ - trace_io_write(reg, addr, io_buf, len) -#define _trace_io_write(reg, io_buf, len) trace_io_write(reg, -1, io_buf, len) -DEFINE_EVENT(io_data, io_read, - TP_PROTO(int reg, int addr, const void *io_buf, size_t len), - TP_ARGS(reg, addr, io_buf, len)); -#define _trace_io_ind_read(reg, addr, io_buf, len)\ - trace_io_read(reg, addr, io_buf, len) -#define _trace_io_read(reg, io_buf, len) trace_io_read(reg, -1, io_buf, len) - -DECLARE_EVENT_CLASS(io_data32, - TP_PROTO(int reg, int addr, u32 val), - TP_ARGS(reg, addr, val), - TP_STRUCT__entry( - __field(int, reg) - __field(int, addr) - __field(int, val) - __array(u8, addr_str, 10) - ), - TP_fast_assign( - __entry->reg = reg; - __entry->addr = addr; - __entry->val = val; - if (addr >= 0) - snprintf(__entry->addr_str, 10, "/%08x", addr); - else - __entry->addr_str[0] = 0; - ), - TP_printk("%s%s: %08x", - __print_symbolic(__entry->reg, wfx_reg_list), - __entry->addr_str, - __entry->val - ) -); -DEFINE_EVENT(io_data32, io_write32, - TP_PROTO(int reg, int addr, u32 val), - TP_ARGS(reg, addr, val)); -#define _trace_io_ind_write32(reg, addr, val) trace_io_write32(reg, addr, val) -#define _trace_io_write32(reg, val) trace_io_write32(reg, -1, val) -DEFINE_EVENT(io_data32, io_read32, - TP_PROTO(int reg, int addr, u32 val), - TP_ARGS(reg, addr, val)); -#define _trace_io_ind_read32(reg, addr, val) trace_io_read32(reg, addr, val) -#define _trace_io_read32(reg, val) trace_io_read32(reg, -1, val) - -DECLARE_EVENT_CLASS(piggyback, - TP_PROTO(u32 val, bool ignored), - TP_ARGS(val, ignored), - TP_STRUCT__entry( - __field(int, val) - __field(bool, ignored) - ), - TP_fast_assign( - __entry->val = val; - __entry->ignored = ignored; - ), - TP_printk("CONTROL: %08x%s", - __entry->val, - __entry->ignored ? " (ignored)" : "" - ) -); -DEFINE_EVENT(piggyback, piggyback, - TP_PROTO(u32 val, bool ignored), - TP_ARGS(val, ignored)); -#define _trace_piggyback(val, ignored) trace_piggyback(val, ignored) - -TRACE_EVENT(bh_stats, - TP_PROTO(int ind, int req, int cnf, int busy, bool release), - TP_ARGS(ind, req, cnf, busy, release), - TP_STRUCT__entry( - __field(int, ind) - __field(int, req) - __field(int, cnf) - __field(int, busy) - __field(bool, release) - ), - TP_fast_assign( - __entry->ind = ind; - __entry->req = req; - __entry->cnf = cnf; - __entry->busy = busy; - __entry->release = release; - ), - TP_printk("IND/REQ/CNF:%3d/%3d/%3d, REQ in progress:%3d, WUP: %s", - __entry->ind, - __entry->req, - __entry->cnf, - __entry->busy, - __entry->release ? "release" : "keep" - ) -); -#define _trace_bh_stats(ind, req, cnf, busy, release)\ - trace_bh_stats(ind, req, cnf, busy, release) - -TRACE_EVENT(tx_stats, - TP_PROTO(const struct hif_cnf_tx *tx_cnf, const struct sk_buff *skb, - int delay), - TP_ARGS(tx_cnf, skb, delay), - TP_STRUCT__entry( - __field(int, pkt_id) - __field(int, delay_media) - __field(int, delay_queue) - __field(int, delay_fw) - __field(int, ack_failures) - __field(int, flags) - __array(int, rate, 4) - __array(int, tx_count, 4) - ), - TP_fast_assign( - // Keep sync with wfx_rates definition in main.c - static const int hw_rate[] = { 0, 1, 2, 3, 6, 7, 8, 9, - 10, 11, 12, 13 }; - const struct ieee80211_tx_info *tx_info = - (const struct ieee80211_tx_info *)skb->cb; - const struct ieee80211_tx_rate *rates = tx_info->driver_rates; - int i; - - __entry->pkt_id = tx_cnf->packet_id; - __entry->delay_media = le32_to_cpu(tx_cnf->media_delay); - __entry->delay_queue = le32_to_cpu(tx_cnf->tx_queue_delay); - __entry->delay_fw = delay; - __entry->ack_failures = tx_cnf->ack_failures; - if (!tx_cnf->status || __entry->ack_failures) - __entry->ack_failures += 1; - - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - if (rates[0].flags & IEEE80211_TX_RC_MCS) - __entry->rate[i] = rates[i].idx; - else - __entry->rate[i] = hw_rate[rates[i].idx]; - __entry->tx_count[i] = rates[i].count; - } - __entry->flags = 0; - if (rates[0].flags & IEEE80211_TX_RC_MCS) - __entry->flags |= 0x01; - if (rates[0].flags & IEEE80211_TX_RC_SHORT_GI) - __entry->flags |= 0x02; - if (rates[0].flags & IEEE80211_TX_RC_GREEN_FIELD) - __entry->flags |= 0x04; - if (rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) - __entry->flags |= 0x08; - if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) - __entry->flags |= 0x10; - if (tx_cnf->status) - __entry->flags |= 0x20; - if (tx_cnf->status == HIF_STATUS_TX_FAIL_REQUEUE) - __entry->flags |= 0x40; - ), - TP_printk("packet ID: %08x, rate policy: %s %d|%d %d|%d %d|%d %d|%d -> %d attempt, Delays media/queue/total: %4dus/%4dus/%4dus", - __entry->pkt_id, - __print_flags(__entry->flags, NULL, - { 0x01, "M" }, { 0x02, "S" }, { 0x04, "G" }, - { 0x08, "R" }, { 0x10, "D" }, { 0x20, "F" }, - { 0x40, "Q" }), - __entry->rate[0], - __entry->tx_count[0], - __entry->rate[1], - __entry->tx_count[1], - __entry->rate[2], - __entry->tx_count[2], - __entry->rate[3], - __entry->tx_count[3], - __entry->ack_failures, - __entry->delay_media, - __entry->delay_queue, - __entry->delay_fw - ) -); -#define _trace_tx_stats(tx_cnf, skb, delay) trace_tx_stats(tx_cnf, skb, delay) - -TRACE_EVENT(queues_stats, - TP_PROTO(struct wfx_dev *wdev, const struct wfx_queue *elected_queue), - TP_ARGS(wdev, elected_queue), - TP_STRUCT__entry( - __field(int, vif_id) - __field(int, queue_id) - __array(int, hw, IEEE80211_NUM_ACS * 2) - __array(int, drv, IEEE80211_NUM_ACS * 2) - __array(int, cab, IEEE80211_NUM_ACS * 2) - ), - TP_fast_assign( - const struct wfx_queue *queue; - struct wfx_vif *wvif; - int i, j; - - for (j = 0; j < IEEE80211_NUM_ACS * 2; j++) { - __entry->hw[j] = -1; - __entry->drv[j] = -1; - __entry->cab[j] = -1; - } - __entry->vif_id = -1; - __entry->queue_id = -1; - wvif = NULL; - while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - j = wvif->id * IEEE80211_NUM_ACS + i; - WARN_ON(j >= IEEE80211_NUM_ACS * 2); - queue = &wvif->tx_queue[i]; - __entry->hw[j] = atomic_read(&queue->pending_frames); - __entry->drv[j] = skb_queue_len(&queue->normal); - __entry->cab[j] = skb_queue_len(&queue->cab); - if (queue == elected_queue) { - __entry->vif_id = wvif->id; - __entry->queue_id = i; - } - } - } - ), - TP_printk("got skb from %d/%d, pend. hw/norm/cab: [ %d/%d/%d %d/%d/%d %d/%d/%d %d/%d/%d ] [ %d/%d/%d %d/%d/%d %d/%d/%d %d/%d/%d ]", - __entry->vif_id, __entry->queue_id, - __entry->hw[0], __entry->drv[0], __entry->cab[0], - __entry->hw[1], __entry->drv[1], __entry->cab[1], - __entry->hw[2], __entry->drv[2], __entry->cab[2], - __entry->hw[3], __entry->drv[3], __entry->cab[3], - __entry->hw[4], __entry->drv[4], __entry->cab[4], - __entry->hw[5], __entry->drv[5], __entry->cab[5], - __entry->hw[6], __entry->drv[6], __entry->cab[6], - __entry->hw[7], __entry->drv[7], __entry->cab[7] - ) -); - -#endif - -/* This part must be outside protection */ -#undef TRACE_INCLUDE_PATH -#define TRACE_INCLUDE_PATH . -#undef TRACE_INCLUDE_FILE -#define TRACE_INCLUDE_FILE traces - -#include diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h deleted file mode 100644 index 94898680ccde..000000000000 --- a/drivers/staging/wfx/wfx.h +++ /dev/null @@ -1,166 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Common private data for Silicon Labs WFx chips. - * - * Copyright (c) 2017-2020, Silicon Laboratories, Inc. - * Copyright (c) 2010, ST-Ericsson - * Copyright (c) 2006, Michael Wu - * Copyright 2004-2006 Jean-Baptiste Note , et al. - */ -#ifndef WFX_H -#define WFX_H - -#include -#include -#include -#include -#include - -#include "bh.h" -#include "data_tx.h" -#include "main.h" -#include "queue.h" -#include "hif_tx.h" - -#define USEC_PER_TXOP 32 // see struct ieee80211_tx_queue_params -#define USEC_PER_TU 1024 - -struct hwbus_ops; - -struct wfx_dev { - struct wfx_platform_data pdata; - struct device *dev; - struct ieee80211_hw *hw; - struct ieee80211_vif *vif[2]; - struct mac_address addresses[2]; - const struct hwbus_ops *hwbus_ops; - void *hwbus_priv; - - u8 keyset; - struct completion firmware_ready; - struct hif_ind_startup hw_caps; - struct wfx_hif hif; - struct delayed_work cooling_timeout_work; - bool poll_irq; - bool chip_frozen; - struct mutex conf_mutex; - - struct wfx_hif_cmd hif_cmd; - struct sk_buff_head tx_pending; - wait_queue_head_t tx_dequeue; - atomic_t tx_lock; - - atomic_t packet_id; - u32 key_map; - - struct hif_rx_stats rx_stats; - struct mutex rx_stats_lock; - struct hif_tx_power_loop_info tx_power_loop_info; - struct mutex tx_power_loop_info_lock; - int force_ps_timeout; -}; - -struct wfx_vif { - struct wfx_dev *wdev; - struct ieee80211_vif *vif; - struct ieee80211_channel *channel; - int id; - - u32 link_id_map; - - bool after_dtim_tx_allowed; - bool join_in_progress; - - struct delayed_work beacon_loss_work; - - struct wfx_queue tx_queue[4]; - struct tx_policy_cache tx_policy_cache; - struct work_struct tx_policy_upload_work; - - struct work_struct update_tim_work; - - unsigned long uapsd_mask; - - /* avoid some operations in parallel with scan */ - struct mutex scan_lock; - struct work_struct scan_work; - struct completion scan_complete; - bool scan_abort; - struct ieee80211_scan_request *scan_req; - - struct completion set_pm_mode_complete; -}; - -static inline struct wfx_vif *wdev_to_wvif(struct wfx_dev *wdev, int vif_id) -{ - if (vif_id >= ARRAY_SIZE(wdev->vif)) { - dev_dbg(wdev->dev, "requesting non-existent vif: %d\n", vif_id); - return NULL; - } - vif_id = array_index_nospec(vif_id, ARRAY_SIZE(wdev->vif)); - if (!wdev->vif[vif_id]) { - dev_dbg(wdev->dev, "requesting non-allocated vif: %d\n", - vif_id); - return NULL; - } - return (struct wfx_vif *) wdev->vif[vif_id]->drv_priv; -} - -static inline struct wfx_vif *wvif_iterate(struct wfx_dev *wdev, - struct wfx_vif *cur) -{ - int i; - int mark = 0; - struct wfx_vif *tmp; - - if (!cur) - mark = 1; - for (i = 0; i < ARRAY_SIZE(wdev->vif); i++) { - tmp = wdev_to_wvif(wdev, i); - if (mark && tmp) - return tmp; - if (tmp == cur) - mark = 1; - } - return NULL; -} - -static inline int wvif_count(struct wfx_dev *wdev) -{ - int i; - int ret = 0; - struct wfx_vif *wvif; - - for (i = 0; i < ARRAY_SIZE(wdev->vif); i++) { - wvif = wdev_to_wvif(wdev, i); - if (wvif) - ret++; - } - return ret; -} - -static inline void memreverse(u8 *src, u8 length) -{ - u8 *lo = src; - u8 *hi = src + length - 1; - u8 swap; - - while (lo < hi) { - swap = *lo; - *lo++ = *hi; - *hi-- = swap; - } -} - -static inline int memzcmp(void *src, unsigned int size) -{ - u8 *buf = src; - - if (!size) - return 0; - if (*buf) - return 1; - return memcmp(buf, buf + 1, size - 1); -} - -#endif /* WFX_H */ -- 2.30.2 From dmugil2000 at gmail.com Mon Mar 15 13:37:11 2021 From: dmugil2000 at gmail.com (Mugilraj Dhavachelvan) Date: Mon, 15 Mar 2021 19:07:11 +0530 Subject: [PATCH] staging: iio: ad9832: kernel-doc fixes Message-ID: <20210315133711.26860-1-dmugil2000@gmail.com> 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 --- drivers/staging/iio/frequency/ad9832.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c index 74308a2e72db..e31ebba47a3c 100644 --- a/drivers/staging/iio/frequency/ad9832.c +++ b/drivers/staging/iio/frequency/ad9832.c @@ -86,7 +86,7 @@ * @freq_msg: tuning word spi message * @phase_xfer: tuning word spi transfer * @phase_msg: tuning word spi message - * @lock protect sensor state + * @lock: protect sensor state * @data: spi transmit buffer * @phase_data: tuning word spi transmit buffer * @freq_data: tuning word spi transmit buffer @@ -248,7 +248,7 @@ static ssize_t ad9832_write(struct device *dev, struct device_attribute *attr, return ret ? ret : len; } -/** +/* * see dds.h for further information */ -- 2.25.1 From dan.carpenter at oracle.com Mon Mar 15 14:14:15 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Mon, 15 Mar 2021 17:14:15 +0300 Subject: [PATCH 01/33] staging: rtl8723bs: remove typedefs in HalBtcOutSrc.h In-Reply-To: <20210312082638.25512-2-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> <20210312082638.25512-2-marco.cesati@gmail.com> Message-ID: <20210315141414.GO2087@kadam> On Fri, Mar 12, 2021 at 09:26:06AM +0100, Marco Cesati wrote: > diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c > index ef8c6a0f31ae..87dc63408133 100644 > --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c > +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c > @@ -151,7 +151,7 @@ static u8 halbtc8723b1ant_BtRssiState( > } > > static void halbtc8723b1ant_UpdateRaMask( > - PBTC_COEXIST pBtCoexist, bool bForceExec, u32 disRateMask > + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u32 disRateMask There is an extra space between the "* pBtCoexist" which checkpatch warned you about. :/ It makes me sad that you did all this work without looking at the checkpatch output. ERROR: "foo * bar" should be "foo *bar" #146: FILE: drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c:154: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u32 disRateMask regards, dan carpenter From dan.carpenter at oracle.com Mon Mar 15 14:17:46 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Mon, 15 Mar 2021 17:17:46 +0300 Subject: [PATCH 02/33] staging: rtl8723bs: remove typedefs in rtw_mlme.h In-Reply-To: <20210312082638.25512-3-marco.cesati@gmail.com> References: <20210312082638.25512-1-marco.cesati@gmail.com> <20210312082638.25512-3-marco.cesati@gmail.com> Message-ID: <20210315141746.GP2087@kadam> On Fri, Mar 12, 2021 at 09:26:07AM +0100, Marco Cesati wrote: > diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h > index 1567831caf91..ed6b03c25367 100644 > --- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h > +++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h > @@ -419,7 +419,7 @@ struct mlme_ext_info { > /* The channel information about this channel including joining, scanning, and power constraints. */ > typedef struct _RT_CHANNEL_INFO { > u8 ChannelNum; /* The channel number. */ > - RT_SCAN_TYPE ScanType; /* Scan type such as passive or active scan. */ > + enum RT_SCAN_TYPE ScanType; /* Scan type such as passive or active scan. */ Originally ChannelNum and ScanType were aligned but now the indenting is whacky. I think you did these patches with a script which is fine, but always take a look over the over finished patch to double check by hand. regards, dan carpenter From marcocesati at gmail.com Mon Mar 15 14:21:44 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 15:21:44 +0100 Subject: [PATCH 01/33] staging: rtl8723bs: remove typedefs in HalBtcOutSrc.h In-Reply-To: <20210315141414.GO2087@kadam> References: <20210312082638.25512-1-marco.cesati@gmail.com> <20210312082638.25512-2-marco.cesati@gmail.com> <20210315141414.GO2087@kadam> Message-ID: <20210315142144.nxddidcvsyafyfuv@cesati.gmail.com> On Mon, Mar 15, 2021 at 05:14:15PM +0300, Dan Carpenter wrote: > On Fri, Mar 12, 2021 at 09:26:06AM +0100, Marco Cesati wrote: > > diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c > > index ef8c6a0f31ae..87dc63408133 100644 > > --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c > > +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c > > @@ -151,7 +151,7 @@ static u8 halbtc8723b1ant_BtRssiState( > > } > > > > static void halbtc8723b1ant_UpdateRaMask( > > - PBTC_COEXIST pBtCoexist, bool bForceExec, u32 disRateMask > > + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u32 disRateMask > > There is an extra space between the "* pBtCoexist" which checkpatch > warned you about. :/ It makes me sad that you did all this work > without looking at the checkpatch output. > > ERROR: "foo * bar" should be "foo *bar" > #146: FILE: drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c:154: > + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u32 disRateMask > > regards, > dan carpenter You are right, it was a fault of mine. However, I am sending another patchset that fixes all POINTER_LOCATION errors in staging/rtl8723bs. Marco ---- Marco Cesati, PhD Dept. of Civil Engineering and Computer Science Engineering Univ. of Rome Tor Vergata via del Politecnico 1, I-00133 Rome, Italy Tel. +39 06 7259 7389 From leon at kernel.org Mon Mar 15 15:11:52 2021 From: leon at kernel.org (Leon Romanovsky) Date: Mon, 15 Mar 2021 17:11:52 +0200 Subject: [PATCH v5 03/24] wfx: add Makefile/Kconfig In-Reply-To: <20210315132501.441681-4-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> <20210315132501.441681-4-Jerome.Pouiller@silabs.com> Message-ID: On Mon, Mar 15, 2021 at 02:24:40PM +0100, Jerome Pouiller wrote: > From: J?r?me Pouiller > > Signed-off-by: J?r?me Pouiller > --- > drivers/net/wireless/silabs/wfx/Kconfig | 12 +++++++++++ > drivers/net/wireless/silabs/wfx/Makefile | 26 ++++++++++++++++++++++++ > 2 files changed, 38 insertions(+) > create mode 100644 drivers/net/wireless/silabs/wfx/Kconfig > create mode 100644 drivers/net/wireless/silabs/wfx/Makefile > > diff --git a/drivers/net/wireless/silabs/wfx/Kconfig b/drivers/net/wireless/silabs/wfx/Kconfig > new file mode 100644 > index 000000000000..3be4b1e735e1 > --- /dev/null > +++ b/drivers/net/wireless/silabs/wfx/Kconfig > @@ -0,0 +1,12 @@ > +config WFX > + tristate "Silicon Labs wireless chips WF200 and further" > + depends on MAC80211 > + depends on MMC || !MMC # do not allow WFX=y if MMC=m > + depends on (SPI || MMC) > + help > + This is a driver for Silicons Labs WFxxx series (WF200 and further) > + chipsets. This chip can be found on SPI or SDIO buses. > + > + Silabs does not use a reliable SDIO vendor ID. So, to avoid conflicts, > + the driver won't probe the device if it is not also declared in the > + Device Tree. > diff --git a/drivers/net/wireless/silabs/wfx/Makefile b/drivers/net/wireless/silabs/wfx/Makefile > new file mode 100644 > index 000000000000..f399962c8619 > --- /dev/null > +++ b/drivers/net/wireless/silabs/wfx/Makefile > @@ -0,0 +1,26 @@ > +# SPDX-License-Identifier: GPL-2.0 > + > +# Necessary for CREATE_TRACE_POINTS > +CFLAGS_debug.o = -I$(src) I wonder if it is still relevant outside of the staging tree. Thanks From gregkh at linuxfoundation.org Mon Mar 15 15:44:13 2021 From: gregkh at linuxfoundation.org (gregkh at linuxfoundation.org) Date: Mon, 15 Mar 2021 16:44:13 +0100 Subject: [PATCH] staging: gasket: remove it from the kernel Message-ID: <20210315154413.3084149-1-gregkh@linuxfoundation.org> From: Greg Kroah-Hartman As none of the proposed things that need to be changed in the gasket drivers have ever been done, and there has not been any forward progress to get this out of staging, it seems totally abandonded so remove the code entirely so that people do not spend their time doing tiny cleanups for code that will never get out of staging. If this code is actually being used, it can be reverted simply and then cleaned up properly, but as it is abandoned, let's just get rid of it. Cc: Rob Springer Cc: Todd Poynor Cc: Ben Chan Cc: Richard Yeh Signed-off-by: Greg Kroah-Hartman --- MAINTAINERS | 8 - drivers/staging/Kconfig | 2 - drivers/staging/Makefile | 1 - drivers/staging/gasket/Kconfig | 25 - drivers/staging/gasket/Makefile | 10 - drivers/staging/gasket/TODO | 22 - drivers/staging/gasket/apex.h | 30 - drivers/staging/gasket/apex_driver.c | 726 -------- drivers/staging/gasket/gasket.h | 122 -- drivers/staging/gasket/gasket_constants.h | 44 - drivers/staging/gasket/gasket_core.c | 1815 -------------------- drivers/staging/gasket/gasket_core.h | 638 ------- drivers/staging/gasket/gasket_interrupt.c | 515 ------ drivers/staging/gasket/gasket_interrupt.h | 95 - drivers/staging/gasket/gasket_ioctl.c | 388 ----- drivers/staging/gasket/gasket_ioctl.h | 28 - drivers/staging/gasket/gasket_page_table.c | 1357 --------------- drivers/staging/gasket/gasket_page_table.h | 249 --- drivers/staging/gasket/gasket_sysfs.c | 398 ----- drivers/staging/gasket/gasket_sysfs.h | 175 -- 20 files changed, 6648 deletions(-) delete mode 100644 drivers/staging/gasket/Kconfig delete mode 100644 drivers/staging/gasket/Makefile delete mode 100644 drivers/staging/gasket/TODO delete mode 100644 drivers/staging/gasket/apex.h delete mode 100644 drivers/staging/gasket/apex_driver.c delete mode 100644 drivers/staging/gasket/gasket.h delete mode 100644 drivers/staging/gasket/gasket_constants.h delete mode 100644 drivers/staging/gasket/gasket_core.c delete mode 100644 drivers/staging/gasket/gasket_core.h delete mode 100644 drivers/staging/gasket/gasket_interrupt.c delete mode 100644 drivers/staging/gasket/gasket_interrupt.h delete mode 100644 drivers/staging/gasket/gasket_ioctl.c delete mode 100644 drivers/staging/gasket/gasket_ioctl.h delete mode 100644 drivers/staging/gasket/gasket_page_table.c delete mode 100644 drivers/staging/gasket/gasket_page_table.h delete mode 100644 drivers/staging/gasket/gasket_sysfs.c delete mode 100644 drivers/staging/gasket/gasket_sysfs.h diff --git a/MAINTAINERS b/MAINTAINERS index aa84121c5611..392647241626 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7385,14 +7385,6 @@ F: Documentation/hwmon/gsc-hwmon.rst F: drivers/hwmon/gsc-hwmon.c F: include/linux/platform_data/gsc_hwmon.h -GASKET DRIVER FRAMEWORK -M: Rob Springer -M: Todd Poynor -M: Ben Chan -M: Richard Yeh -S: Maintained -F: drivers/staging/gasket/ - GCC PLUGINS M: Kees Cook L: linux-hardening at vger.kernel.org diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index b22f73d7bfc4..efddc50c81f9 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -98,8 +98,6 @@ source "drivers/staging/ralink-gdma/Kconfig" source "drivers/staging/mt7621-dts/Kconfig" -source "drivers/staging/gasket/Kconfig" - source "drivers/staging/axis-fifo/Kconfig" source "drivers/staging/fieldbus/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 2245059e69c7..e2e95a20081a 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -39,7 +39,6 @@ obj-$(CONFIG_PCI_MT7621) += mt7621-pci/ obj-$(CONFIG_SOC_MT7621) += mt7621-dma/ obj-$(CONFIG_DMA_RALINK) += ralink-gdma/ obj-$(CONFIG_SOC_MT7621) += mt7621-dts/ -obj-$(CONFIG_STAGING_GASKET_FRAMEWORK) += gasket/ obj-$(CONFIG_XIL_AXIS_FIFO) += axis-fifo/ obj-$(CONFIG_FIELDBUS_DEV) += fieldbus/ obj-$(CONFIG_KPC2000) += kpc2000/ diff --git a/drivers/staging/gasket/Kconfig b/drivers/staging/gasket/Kconfig deleted file mode 100644 index d9bef8ca41ef..000000000000 --- a/drivers/staging/gasket/Kconfig +++ /dev/null @@ -1,25 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -menu "Gasket devices" - -config STAGING_GASKET_FRAMEWORK - tristate "Gasket framework" - depends on PCI && (X86_64 || ARM64) - help - This framework supports Gasket-compatible devices, such as Apex. - It is required for any of the following module(s). - - To compile this driver as a module, choose M here. The module - will be called "gasket". - -config STAGING_APEX_DRIVER - tristate "Apex Driver" - depends on STAGING_GASKET_FRAMEWORK - help - This driver supports the Apex Edge TPU device. See - https://cloud.google.com/edge-tpu/ for more information. - Say Y if you want to include this driver in the kernel. - - To compile this driver as a module, choose M here. The module - will be called "apex". - -endmenu diff --git a/drivers/staging/gasket/Makefile b/drivers/staging/gasket/Makefile deleted file mode 100644 index ce03e256f501..000000000000 --- a/drivers/staging/gasket/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Makefile for Gasket framework and dependent drivers. -# - -obj-$(CONFIG_STAGING_GASKET_FRAMEWORK) += gasket.o -obj-$(CONFIG_STAGING_APEX_DRIVER) += apex.o - -gasket-objs := gasket_core.o gasket_ioctl.o gasket_interrupt.o gasket_page_table.o gasket_sysfs.o -apex-objs := apex_driver.o diff --git a/drivers/staging/gasket/TODO b/drivers/staging/gasket/TODO deleted file mode 100644 index 5b1865f8af2d..000000000000 --- a/drivers/staging/gasket/TODO +++ /dev/null @@ -1,22 +0,0 @@ -This is a list of things that need to be done to get this driver out of the -staging directory. - -- Implement the gasket framework's functionality through UIO instead of - introducing a new user-space drivers framework that is quite similar. - - UIO provides the necessary bits to implement user-space drivers. Meanwhile - the gasket APIs adds some extra conveniences like PCI BAR mapping, and - MSI interrupts. Add these features to the UIO subsystem, then re-implement - the Apex driver as a basic UIO driver instead (include/linux/uio_driver.h) - -- Document sysfs files with Documentation/ABI/ entries. - -- Use misc interface instead of major number for driver version description. - -- Add descriptions of module_param's - -- apex_get_status() should actually check status. - -- "drivers" should never be dealing with "raw" sysfs calls or mess around with - kobjects at all. The driver core should handle all of this for you - automaically. There should not be a need for raw attribute macros. diff --git a/drivers/staging/gasket/apex.h b/drivers/staging/gasket/apex.h deleted file mode 100644 index 3bbceffff5e4..000000000000 --- a/drivers/staging/gasket/apex.h +++ /dev/null @@ -1,30 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Apex kernel-userspace interface definitions. - * - * Copyright (C) 2018 Google, Inc. - */ -#ifndef __APEX_H__ -#define __APEX_H__ - -#include - -/* Clock Gating ioctl. */ -struct apex_gate_clock_ioctl { - /* Enter or leave clock gated state. */ - u64 enable; - - /* If set, enter clock gating state, regardless of custom block's - * internal idle state - */ - u64 force_idle; -}; - -/* Base number for all Apex-common IOCTLs */ -#define APEX_IOCTL_BASE 0x7F - -/* Enable/Disable clock gating. */ -#define APEX_IOCTL_GATE_CLOCK \ - _IOW(APEX_IOCTL_BASE, 0, struct apex_gate_clock_ioctl) - -#endif /* __APEX_H__ */ diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c deleted file mode 100644 index f12f81c8dd2f..000000000000 --- a/drivers/staging/gasket/apex_driver.c +++ /dev/null @@ -1,726 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Driver for the Apex chip. - * - * Copyright (C) 2018 Google, Inc. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "apex.h" - -#include "gasket_core.h" -#include "gasket_interrupt.h" -#include "gasket_page_table.h" -#include "gasket_sysfs.h" - -/* Constants */ -#define APEX_DEVICE_NAME "Apex" -#define APEX_DRIVER_VERSION "1.0" - -/* CSRs are in BAR 2. */ -#define APEX_BAR_INDEX 2 - -#define APEX_PCI_VENDOR_ID 0x1ac1 -#define APEX_PCI_DEVICE_ID 0x089a - -/* Bar Offsets. */ -#define APEX_BAR_OFFSET 0 -#define APEX_CM_OFFSET 0x1000000 - -/* The sizes of each Apex BAR 2. */ -#define APEX_BAR_BYTES 0x100000 -#define APEX_CH_MEM_BYTES (PAGE_SIZE * MAX_NUM_COHERENT_PAGES) - -/* The number of user-mappable memory ranges in BAR2 of a Apex chip. */ -#define NUM_REGIONS 3 - -/* The number of nodes in a Apex chip. */ -#define NUM_NODES 1 - -/* - * The total number of entries in the page table. Should match the value read - * from the register APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE_SIZE. - */ -#define APEX_PAGE_TABLE_TOTAL_ENTRIES 8192 - -#define APEX_EXTENDED_SHIFT 63 /* Extended address bit position. */ - -/* Check reset 120 times */ -#define APEX_RESET_RETRY 120 -/* Wait 100 ms between checks. Total 12 sec wait maximum. */ -#define APEX_RESET_DELAY 100 - -/* Enumeration of the supported sysfs entries. */ -enum sysfs_attribute_type { - ATTR_KERNEL_HIB_PAGE_TABLE_SIZE, - ATTR_KERNEL_HIB_SIMPLE_PAGE_TABLE_SIZE, - ATTR_KERNEL_HIB_NUM_ACTIVE_PAGES, -}; - -/* - * Register offsets into BAR2 memory. - * Only values necessary for driver implementation are defined. - */ -enum apex_bar2_regs { - APEX_BAR2_REG_SCU_BASE = 0x1A300, - APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE_SIZE = 0x46000, - APEX_BAR2_REG_KERNEL_HIB_EXTENDED_TABLE = 0x46008, - APEX_BAR2_REG_KERNEL_HIB_TRANSLATION_ENABLE = 0x46010, - APEX_BAR2_REG_KERNEL_HIB_INSTR_QUEUE_INTVECCTL = 0x46018, - APEX_BAR2_REG_KERNEL_HIB_INPUT_ACTV_QUEUE_INTVECCTL = 0x46020, - APEX_BAR2_REG_KERNEL_HIB_PARAM_QUEUE_INTVECCTL = 0x46028, - APEX_BAR2_REG_KERNEL_HIB_OUTPUT_ACTV_QUEUE_INTVECCTL = 0x46030, - APEX_BAR2_REG_KERNEL_HIB_SC_HOST_INTVECCTL = 0x46038, - APEX_BAR2_REG_KERNEL_HIB_TOP_LEVEL_INTVECCTL = 0x46040, - APEX_BAR2_REG_KERNEL_HIB_FATAL_ERR_INTVECCTL = 0x46048, - APEX_BAR2_REG_KERNEL_HIB_DMA_PAUSE = 0x46050, - APEX_BAR2_REG_KERNEL_HIB_DMA_PAUSE_MASK = 0x46058, - APEX_BAR2_REG_KERNEL_HIB_STATUS_BLOCK_DELAY = 0x46060, - APEX_BAR2_REG_KERNEL_HIB_MSIX_PENDING_BIT_ARRAY0 = 0x46068, - APEX_BAR2_REG_KERNEL_HIB_MSIX_PENDING_BIT_ARRAY1 = 0x46070, - APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE_INIT = 0x46078, - APEX_BAR2_REG_KERNEL_HIB_MSIX_TABLE_INIT = 0x46080, - APEX_BAR2_REG_KERNEL_WIRE_INT_PENDING_BIT_ARRAY = 0x48778, - APEX_BAR2_REG_KERNEL_WIRE_INT_MASK_ARRAY = 0x48780, - APEX_BAR2_REG_USER_HIB_DMA_PAUSE = 0x486D8, - APEX_BAR2_REG_USER_HIB_DMA_PAUSED = 0x486E0, - APEX_BAR2_REG_IDLEGENERATOR_IDLEGEN_IDLEREGISTER = 0x4A000, - APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE = 0x50000, - - /* Error registers - Used mostly for debug */ - APEX_BAR2_REG_USER_HIB_ERROR_STATUS = 0x86f0, - APEX_BAR2_REG_SCALAR_CORE_ERROR_STATUS = 0x41a0, -}; - -/* Addresses for packed registers. */ -#define APEX_BAR2_REG_AXI_QUIESCE (APEX_BAR2_REG_SCU_BASE + 0x2C) -#define APEX_BAR2_REG_GCB_CLOCK_GATE (APEX_BAR2_REG_SCU_BASE + 0x14) -#define APEX_BAR2_REG_SCU_0 (APEX_BAR2_REG_SCU_BASE + 0xc) -#define APEX_BAR2_REG_SCU_1 (APEX_BAR2_REG_SCU_BASE + 0x10) -#define APEX_BAR2_REG_SCU_2 (APEX_BAR2_REG_SCU_BASE + 0x14) -#define APEX_BAR2_REG_SCU_3 (APEX_BAR2_REG_SCU_BASE + 0x18) -#define APEX_BAR2_REG_SCU_4 (APEX_BAR2_REG_SCU_BASE + 0x1c) -#define APEX_BAR2_REG_SCU_5 (APEX_BAR2_REG_SCU_BASE + 0x20) - -#define SCU3_RG_PWR_STATE_OVR_BIT_OFFSET 26 -#define SCU3_RG_PWR_STATE_OVR_MASK_WIDTH 2 -#define SCU3_CUR_RST_GCB_BIT_MASK 0x10 -#define SCU2_RG_RST_GCB_BIT_MASK 0xc - -/* Configuration for page table. */ -static struct gasket_page_table_config apex_page_table_configs[NUM_NODES] = { - { - .id = 0, - .mode = GASKET_PAGE_TABLE_MODE_NORMAL, - .total_entries = APEX_PAGE_TABLE_TOTAL_ENTRIES, - .base_reg = APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE, - .extended_reg = APEX_BAR2_REG_KERNEL_HIB_EXTENDED_TABLE, - .extended_bit = APEX_EXTENDED_SHIFT, - }, -}; - -/* The regions in the BAR2 space that can be mapped into user space. */ -static const struct gasket_mappable_region mappable_regions[NUM_REGIONS] = { - { 0x40000, 0x1000 }, - { 0x44000, 0x1000 }, - { 0x48000, 0x1000 }, -}; - -/* Gasket device interrupts enums must be dense (i.e., no empty slots). */ -enum apex_interrupt { - APEX_INTERRUPT_INSTR_QUEUE = 0, - APEX_INTERRUPT_INPUT_ACTV_QUEUE = 1, - APEX_INTERRUPT_PARAM_QUEUE = 2, - APEX_INTERRUPT_OUTPUT_ACTV_QUEUE = 3, - APEX_INTERRUPT_SC_HOST_0 = 4, - APEX_INTERRUPT_SC_HOST_1 = 5, - APEX_INTERRUPT_SC_HOST_2 = 6, - APEX_INTERRUPT_SC_HOST_3 = 7, - APEX_INTERRUPT_TOP_LEVEL_0 = 8, - APEX_INTERRUPT_TOP_LEVEL_1 = 9, - APEX_INTERRUPT_TOP_LEVEL_2 = 10, - APEX_INTERRUPT_TOP_LEVEL_3 = 11, - APEX_INTERRUPT_FATAL_ERR = 12, - APEX_INTERRUPT_COUNT = 13, -}; - -/* Interrupt descriptors for Apex */ -static struct gasket_interrupt_desc apex_interrupts[] = { - { - APEX_INTERRUPT_INSTR_QUEUE, - APEX_BAR2_REG_KERNEL_HIB_INSTR_QUEUE_INTVECCTL, - UNPACKED, - }, - { - APEX_INTERRUPT_INPUT_ACTV_QUEUE, - APEX_BAR2_REG_KERNEL_HIB_INPUT_ACTV_QUEUE_INTVECCTL, - UNPACKED - }, - { - APEX_INTERRUPT_PARAM_QUEUE, - APEX_BAR2_REG_KERNEL_HIB_PARAM_QUEUE_INTVECCTL, - UNPACKED - }, - { - APEX_INTERRUPT_OUTPUT_ACTV_QUEUE, - APEX_BAR2_REG_KERNEL_HIB_OUTPUT_ACTV_QUEUE_INTVECCTL, - UNPACKED - }, - { - APEX_INTERRUPT_SC_HOST_0, - APEX_BAR2_REG_KERNEL_HIB_SC_HOST_INTVECCTL, - PACK_0 - }, - { - APEX_INTERRUPT_SC_HOST_1, - APEX_BAR2_REG_KERNEL_HIB_SC_HOST_INTVECCTL, - PACK_1 - }, - { - APEX_INTERRUPT_SC_HOST_2, - APEX_BAR2_REG_KERNEL_HIB_SC_HOST_INTVECCTL, - PACK_2 - }, - { - APEX_INTERRUPT_SC_HOST_3, - APEX_BAR2_REG_KERNEL_HIB_SC_HOST_INTVECCTL, - PACK_3 - }, - { - APEX_INTERRUPT_TOP_LEVEL_0, - APEX_BAR2_REG_KERNEL_HIB_TOP_LEVEL_INTVECCTL, - PACK_0 - }, - { - APEX_INTERRUPT_TOP_LEVEL_1, - APEX_BAR2_REG_KERNEL_HIB_TOP_LEVEL_INTVECCTL, - PACK_1 - }, - { - APEX_INTERRUPT_TOP_LEVEL_2, - APEX_BAR2_REG_KERNEL_HIB_TOP_LEVEL_INTVECCTL, - PACK_2 - }, - { - APEX_INTERRUPT_TOP_LEVEL_3, - APEX_BAR2_REG_KERNEL_HIB_TOP_LEVEL_INTVECCTL, - PACK_3 - }, - { - APEX_INTERRUPT_FATAL_ERR, - APEX_BAR2_REG_KERNEL_HIB_FATAL_ERR_INTVECCTL, - UNPACKED - }, -}; - -/* Allows device to enter power save upon driver close(). */ -static int allow_power_save = 1; - -/* Allows SW based clock gating. */ -static int allow_sw_clock_gating; - -/* Allows HW based clock gating. */ -/* Note: this is not mutual exclusive with SW clock gating. */ -static int allow_hw_clock_gating = 1; - -/* Act as if only GCB is instantiated. */ -static int bypass_top_level; - -module_param(allow_power_save, int, 0644); -module_param(allow_sw_clock_gating, int, 0644); -module_param(allow_hw_clock_gating, int, 0644); -module_param(bypass_top_level, int, 0644); - -/* Check the device status registers and return device status ALIVE or DEAD. */ -static int apex_get_status(struct gasket_dev *gasket_dev) -{ - /* TODO: Check device status. */ - return GASKET_STATUS_ALIVE; -} - -/* Enter GCB reset state. */ -static int apex_enter_reset(struct gasket_dev *gasket_dev) -{ - if (bypass_top_level) - return 0; - - /* - * Software reset: - * Enable sleep mode - * - Software force GCB idle - * - Enable GCB idle - */ - gasket_read_modify_write_64(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_IDLEGENERATOR_IDLEGEN_IDLEREGISTER, - 0x0, 1, 32); - - /* - Initiate DMA pause */ - gasket_dev_write_64(gasket_dev, 1, APEX_BAR_INDEX, - APEX_BAR2_REG_USER_HIB_DMA_PAUSE); - - /* - Wait for DMA pause complete. */ - if (gasket_wait_with_reschedule(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_USER_HIB_DMA_PAUSED, 1, 1, - APEX_RESET_DELAY, APEX_RESET_RETRY)) { - dev_err(gasket_dev->dev, - "DMAs did not quiesce within timeout (%d ms)\n", - APEX_RESET_RETRY * APEX_RESET_DELAY); - return -ETIMEDOUT; - } - - /* - Enable GCB reset (0x1 to rg_rst_gcb) */ - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_2, 0x1, 2, 2); - - /* - Enable GCB clock Gate (0x1 to rg_gated_gcb) */ - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_2, 0x1, 2, 18); - - /* - Enable GCB memory shut down (0x3 to rg_force_ram_sd) */ - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_3, 0x3, 2, 14); - - /* - Wait for RAM shutdown. */ - if (gasket_wait_with_reschedule(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_3, BIT(6), BIT(6), - APEX_RESET_DELAY, APEX_RESET_RETRY)) { - dev_err(gasket_dev->dev, - "RAM did not shut down within timeout (%d ms)\n", - APEX_RESET_RETRY * APEX_RESET_DELAY); - return -ETIMEDOUT; - } - - return 0; -} - -/* Quit GCB reset state. */ -static int apex_quit_reset(struct gasket_dev *gasket_dev) -{ - u32 val0, val1; - - if (bypass_top_level) - return 0; - - /* - * Disable sleep mode: - * - Disable GCB memory shut down: - * - b00: Not forced (HW controlled) - * - b1x: Force disable - */ - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_3, 0x0, 2, 14); - - /* - * - Disable software clock gate: - * - b00: Not forced (HW controlled) - * - b1x: Force disable - */ - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_2, 0x0, 2, 18); - - /* - * - Disable GCB reset (rg_rst_gcb): - * - b00: Not forced (HW controlled) - * - b1x: Force disable = Force not Reset - */ - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_2, 0x2, 2, 2); - - /* - Wait for RAM enable. */ - if (gasket_wait_with_reschedule(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_3, BIT(6), 0, - APEX_RESET_DELAY, APEX_RESET_RETRY)) { - dev_err(gasket_dev->dev, - "RAM did not enable within timeout (%d ms)\n", - APEX_RESET_RETRY * APEX_RESET_DELAY); - return -ETIMEDOUT; - } - - /* - Wait for Reset complete. */ - if (gasket_wait_with_reschedule(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_3, - SCU3_CUR_RST_GCB_BIT_MASK, 0, - APEX_RESET_DELAY, APEX_RESET_RETRY)) { - dev_err(gasket_dev->dev, - "GCB did not leave reset within timeout (%d ms)\n", - APEX_RESET_RETRY * APEX_RESET_DELAY); - return -ETIMEDOUT; - } - - if (!allow_hw_clock_gating) { - val0 = gasket_dev_read_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_3); - /* Inactive and Sleep mode are disabled. */ - gasket_read_modify_write_32(gasket_dev, - APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_3, 0x3, - SCU3_RG_PWR_STATE_OVR_MASK_WIDTH, - SCU3_RG_PWR_STATE_OVR_BIT_OFFSET); - val1 = gasket_dev_read_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_3); - dev_dbg(gasket_dev->dev, - "Disallow HW clock gating 0x%x -> 0x%x\n", val0, val1); - } else { - val0 = gasket_dev_read_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_3); - /* Inactive mode enabled - Sleep mode disabled. */ - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_3, 2, - SCU3_RG_PWR_STATE_OVR_MASK_WIDTH, - SCU3_RG_PWR_STATE_OVR_BIT_OFFSET); - val1 = gasket_dev_read_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_3); - dev_dbg(gasket_dev->dev, "Allow HW clock gating 0x%x -> 0x%x\n", - val0, val1); - } - - return 0; -} - -/* Reset the Apex hardware. Called on final close via device_close_cb. */ -static int apex_device_cleanup(struct gasket_dev *gasket_dev) -{ - u64 scalar_error; - u64 hib_error; - int ret = 0; - - hib_error = gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_USER_HIB_ERROR_STATUS); - scalar_error = gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCALAR_CORE_ERROR_STATUS); - - dev_dbg(gasket_dev->dev, - "%s 0x%p hib_error 0x%llx scalar_error 0x%llx\n", - __func__, gasket_dev, hib_error, scalar_error); - - if (allow_power_save) - ret = apex_enter_reset(gasket_dev); - - return ret; -} - -/* Determine if GCB is in reset state. */ -static bool is_gcb_in_reset(struct gasket_dev *gasket_dev) -{ - u32 val = gasket_dev_read_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCU_3); - - /* Masks rg_rst_gcb bit of SCU_CTRL_2 */ - return (val & SCU3_CUR_RST_GCB_BIT_MASK); -} - -/* Reset the hardware, then quit reset. Called on device open. */ -static int apex_reset(struct gasket_dev *gasket_dev) -{ - int ret; - - if (bypass_top_level) - return 0; - - if (!is_gcb_in_reset(gasket_dev)) { - /* We are not in reset - toggle the reset bit so as to force - * re-init of custom block - */ - dev_dbg(gasket_dev->dev, "%s: toggle reset\n", __func__); - - ret = apex_enter_reset(gasket_dev); - if (ret) - return ret; - } - return apex_quit_reset(gasket_dev); -} - -/* - * Check permissions for Apex ioctls. - * Returns true if the current user may execute this ioctl, and false otherwise. - */ -static bool apex_ioctl_check_permissions(struct file *filp, uint cmd) -{ - return !!(filp->f_mode & FMODE_WRITE); -} - -/* Gates or un-gates Apex clock. */ -static long apex_clock_gating(struct gasket_dev *gasket_dev, - struct apex_gate_clock_ioctl __user *argp) -{ - struct apex_gate_clock_ioctl ibuf; - - if (bypass_top_level || !allow_sw_clock_gating) - return 0; - - if (copy_from_user(&ibuf, argp, sizeof(ibuf))) - return -EFAULT; - - dev_dbg(gasket_dev->dev, "%s %llu\n", __func__, ibuf.enable); - - if (ibuf.enable) { - /* Quiesce AXI, gate GCB clock. */ - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_AXI_QUIESCE, 0x1, 1, - 16); - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_GCB_CLOCK_GATE, 0x1, - 2, 18); - } else { - /* Un-gate GCB clock, un-quiesce AXI. */ - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_GCB_CLOCK_GATE, 0x0, - 2, 18); - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_AXI_QUIESCE, 0x0, 1, - 16); - } - return 0; -} - -/* Apex-specific ioctl handler. */ -static long apex_ioctl(struct file *filp, uint cmd, void __user *argp) -{ - struct gasket_dev *gasket_dev = filp->private_data; - - if (!apex_ioctl_check_permissions(filp, cmd)) - return -EPERM; - - switch (cmd) { - case APEX_IOCTL_GATE_CLOCK: - return apex_clock_gating(gasket_dev, argp); - default: - return -ENOTTY; /* unknown command */ - } -} - -/* Display driver sysfs entries. */ -static ssize_t sysfs_show(struct device *device, struct device_attribute *attr, - char *buf) -{ - int ret; - struct gasket_dev *gasket_dev; - struct gasket_sysfs_attribute *gasket_attr; - enum sysfs_attribute_type type; - struct gasket_page_table *gpt; - uint val; - - gasket_dev = gasket_sysfs_get_device_data(device); - if (!gasket_dev) { - dev_err(device, "No Apex device sysfs mapping found\n"); - return -ENODEV; - } - - gasket_attr = gasket_sysfs_get_attr(device, attr); - if (!gasket_attr) { - dev_err(device, "No Apex device sysfs attr data found\n"); - gasket_sysfs_put_device_data(device, gasket_dev); - return -ENODEV; - } - - type = (enum sysfs_attribute_type)gasket_attr->data.attr_type; - gpt = gasket_dev->page_table[0]; - switch (type) { - case ATTR_KERNEL_HIB_PAGE_TABLE_SIZE: - val = gasket_page_table_num_entries(gpt); - break; - case ATTR_KERNEL_HIB_SIMPLE_PAGE_TABLE_SIZE: - val = gasket_page_table_num_simple_entries(gpt); - break; - case ATTR_KERNEL_HIB_NUM_ACTIVE_PAGES: - val = gasket_page_table_num_active_pages(gpt); - break; - default: - dev_dbg(gasket_dev->dev, "Unknown attribute: %s\n", - attr->attr.name); - ret = 0; - goto exit; - } - ret = scnprintf(buf, PAGE_SIZE, "%u\n", val); -exit: - gasket_sysfs_put_attr(device, gasket_attr); - gasket_sysfs_put_device_data(device, gasket_dev); - return ret; -} - -static struct gasket_sysfs_attribute apex_sysfs_attrs[] = { - GASKET_SYSFS_RO(node_0_page_table_entries, sysfs_show, - ATTR_KERNEL_HIB_PAGE_TABLE_SIZE), - GASKET_SYSFS_RO(node_0_simple_page_table_entries, sysfs_show, - ATTR_KERNEL_HIB_SIMPLE_PAGE_TABLE_SIZE), - GASKET_SYSFS_RO(node_0_num_mapped_pages, sysfs_show, - ATTR_KERNEL_HIB_NUM_ACTIVE_PAGES), - GASKET_END_OF_ATTR_ARRAY -}; - -/* On device open, perform a core reinit reset. */ -static int apex_device_open_cb(struct gasket_dev *gasket_dev) -{ - return gasket_reset_nolock(gasket_dev); -} - -static const struct pci_device_id apex_pci_ids[] = { - { PCI_DEVICE(APEX_PCI_VENDOR_ID, APEX_PCI_DEVICE_ID) }, { 0 } -}; - -static int apex_pci_probe(struct pci_dev *pci_dev, - const struct pci_device_id *id) -{ - int ret; - ulong page_table_ready, msix_table_ready; - int retries = 0; - struct gasket_dev *gasket_dev; - - ret = pci_enable_device(pci_dev); - if (ret) { - dev_err(&pci_dev->dev, "error enabling PCI device\n"); - return ret; - } - - pci_set_master(pci_dev); - - ret = gasket_pci_add_device(pci_dev, &gasket_dev); - if (ret) { - dev_err(&pci_dev->dev, "error adding gasket device\n"); - pci_disable_device(pci_dev); - return ret; - } - - pci_set_drvdata(pci_dev, gasket_dev); - apex_reset(gasket_dev); - - while (retries < APEX_RESET_RETRY) { - page_table_ready = - gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE_INIT); - msix_table_ready = - gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_KERNEL_HIB_MSIX_TABLE_INIT); - if (page_table_ready && msix_table_ready) - break; - schedule_timeout(msecs_to_jiffies(APEX_RESET_DELAY)); - retries++; - } - - if (retries == APEX_RESET_RETRY) { - if (!page_table_ready) - dev_err(gasket_dev->dev, "Page table init timed out\n"); - if (!msix_table_ready) - dev_err(gasket_dev->dev, "MSI-X table init timed out\n"); - ret = -ETIMEDOUT; - goto remove_device; - } - - ret = gasket_sysfs_create_entries(gasket_dev->dev_info.device, - apex_sysfs_attrs); - if (ret) - dev_err(&pci_dev->dev, "error creating device sysfs entries\n"); - - ret = gasket_enable_device(gasket_dev); - if (ret) { - dev_err(&pci_dev->dev, "error enabling gasket device\n"); - goto remove_device; - } - - /* Place device in low power mode until opened */ - if (allow_power_save) - apex_enter_reset(gasket_dev); - - return 0; - -remove_device: - gasket_pci_remove_device(pci_dev); - pci_disable_device(pci_dev); - return ret; -} - -static void apex_pci_remove(struct pci_dev *pci_dev) -{ - struct gasket_dev *gasket_dev = pci_get_drvdata(pci_dev); - - gasket_disable_device(gasket_dev); - gasket_pci_remove_device(pci_dev); - pci_disable_device(pci_dev); -} - -static const struct gasket_driver_desc apex_desc = { - .name = "apex", - .driver_version = APEX_DRIVER_VERSION, - .major = 120, - .minor = 0, - .module = THIS_MODULE, - .pci_id_table = apex_pci_ids, - - .num_page_tables = NUM_NODES, - .page_table_bar_index = APEX_BAR_INDEX, - .page_table_configs = apex_page_table_configs, - .page_table_extended_bit = APEX_EXTENDED_SHIFT, - - .bar_descriptions = { - GASKET_UNUSED_BAR, - GASKET_UNUSED_BAR, - { APEX_BAR_BYTES, (VM_WRITE | VM_READ), APEX_BAR_OFFSET, - NUM_REGIONS, mappable_regions, PCI_BAR }, - GASKET_UNUSED_BAR, - GASKET_UNUSED_BAR, - GASKET_UNUSED_BAR, - }, - .coherent_buffer_description = { - APEX_CH_MEM_BYTES, - (VM_WRITE | VM_READ), - APEX_CM_OFFSET, - }, - .interrupt_type = PCI_MSIX, - .interrupt_bar_index = APEX_BAR_INDEX, - .num_interrupts = APEX_INTERRUPT_COUNT, - .interrupts = apex_interrupts, - .interrupt_pack_width = 7, - - .device_open_cb = apex_device_open_cb, - .device_close_cb = apex_device_cleanup, - - .ioctl_handler_cb = apex_ioctl, - .device_status_cb = apex_get_status, - .hardware_revision_cb = NULL, - .device_reset_cb = apex_reset, -}; - -static struct pci_driver apex_pci_driver = { - .name = "apex", - .probe = apex_pci_probe, - .remove = apex_pci_remove, - .id_table = apex_pci_ids, -}; - -static int __init apex_init(void) -{ - int ret; - - ret = gasket_register_device(&apex_desc); - if (ret) - return ret; - ret = pci_register_driver(&apex_pci_driver); - if (ret) - gasket_unregister_device(&apex_desc); - return ret; -} - -static void apex_exit(void) -{ - pci_unregister_driver(&apex_pci_driver); - gasket_unregister_device(&apex_desc); -} -MODULE_DESCRIPTION("Google Apex driver"); -MODULE_VERSION(APEX_DRIVER_VERSION); -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("John Joseph "); -MODULE_DEVICE_TABLE(pci, apex_pci_ids); -module_init(apex_init); -module_exit(apex_exit); diff --git a/drivers/staging/gasket/gasket.h b/drivers/staging/gasket/gasket.h deleted file mode 100644 index a0f065c517a5..000000000000 --- a/drivers/staging/gasket/gasket.h +++ /dev/null @@ -1,122 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Common Gasket device kernel and user space declarations. - * - * Copyright (C) 2018 Google, Inc. - */ -#ifndef __GASKET_H__ -#define __GASKET_H__ - -#include -#include - -/* ioctl structure declarations */ - -/* Ioctl structures are padded to a multiple of 64 bits */ -/* and padded to put 64 bit values on 64 bit boundaries. */ -/* Unsigned 64 bit integers are used to hold pointers. */ -/* This helps compatibility between 32 and 64 bits. */ - -/* - * Common structure for ioctls associating an eventfd with a device interrupt, - * when using the Gasket interrupt module. - */ -struct gasket_interrupt_eventfd { - u64 interrupt; - u64 event_fd; -}; - -/* - * Common structure for ioctls mapping and unmapping buffers when using the - * Gasket page_table module. - */ -struct gasket_page_table_ioctl { - u64 page_table_index; - u64 size; - u64 host_address; - u64 device_address; -}; - -/* - * Common structure for ioctls mapping and unmapping buffers when using the - * Gasket page_table module. - * dma_address: phys addr start of coherent memory, allocated by kernel - */ -struct gasket_coherent_alloc_config_ioctl { - u64 page_table_index; - u64 enable; - u64 size; - u64 dma_address; -}; - -/* Base number for all Gasket-common IOCTLs */ -#define GASKET_IOCTL_BASE 0xDC - -/* Reset the device. */ -#define GASKET_IOCTL_RESET _IO(GASKET_IOCTL_BASE, 0) - -/* Associate the specified [event]fd with the specified interrupt. */ -#define GASKET_IOCTL_SET_EVENTFD \ - _IOW(GASKET_IOCTL_BASE, 1, struct gasket_interrupt_eventfd) - -/* - * Clears any eventfd associated with the specified interrupt. The (ulong) - * argument is the interrupt number to clear. - */ -#define GASKET_IOCTL_CLEAR_EVENTFD _IOW(GASKET_IOCTL_BASE, 2, unsigned long) - -/* - * [Loopbacks only] Requests that the loopback device send the specified - * interrupt to the host. The (ulong) argument is the number of the interrupt to - * send. - */ -#define GASKET_IOCTL_LOOPBACK_INTERRUPT \ - _IOW(GASKET_IOCTL_BASE, 3, unsigned long) - -/* Queries the kernel for the number of page tables supported by the device. */ -#define GASKET_IOCTL_NUMBER_PAGE_TABLES _IOR(GASKET_IOCTL_BASE, 4, u64) - -/* - * Queries the kernel for the maximum size of the page table. Only the size and - * page_table_index fields are used from the struct gasket_page_table_ioctl. - */ -#define GASKET_IOCTL_PAGE_TABLE_SIZE \ - _IOWR(GASKET_IOCTL_BASE, 5, struct gasket_page_table_ioctl) - -/* - * Queries the kernel for the current simple page table size. Only the size and - * page_table_index fields are used from the struct gasket_page_table_ioctl. - */ -#define GASKET_IOCTL_SIMPLE_PAGE_TABLE_SIZE \ - _IOWR(GASKET_IOCTL_BASE, 6, struct gasket_page_table_ioctl) - -/* - * Tells the kernel to change the split between the number of simple and - * extended entries in the given page table. Only the size and page_table_index - * fields are used from the struct gasket_page_table_ioctl. - */ -#define GASKET_IOCTL_PARTITION_PAGE_TABLE \ - _IOW(GASKET_IOCTL_BASE, 7, struct gasket_page_table_ioctl) - -/* - * Tells the kernel to map size bytes at host_address to device_address in - * page_table_index page table. - */ -#define GASKET_IOCTL_MAP_BUFFER \ - _IOW(GASKET_IOCTL_BASE, 8, struct gasket_page_table_ioctl) - -/* - * Tells the kernel to unmap size bytes at host_address from device_address in - * page_table_index page table. - */ -#define GASKET_IOCTL_UNMAP_BUFFER \ - _IOW(GASKET_IOCTL_BASE, 9, struct gasket_page_table_ioctl) - -/* Clear the interrupt counts stored for this device. */ -#define GASKET_IOCTL_CLEAR_INTERRUPT_COUNTS _IO(GASKET_IOCTL_BASE, 10) - -/* Enable/Disable and configure the coherent allocator. */ -#define GASKET_IOCTL_CONFIG_COHERENT_ALLOCATOR \ - _IOWR(GASKET_IOCTL_BASE, 11, struct gasket_coherent_alloc_config_ioctl) - -#endif /* __GASKET_H__ */ diff --git a/drivers/staging/gasket/gasket_constants.h b/drivers/staging/gasket/gasket_constants.h deleted file mode 100644 index 9ea9c8833f27..000000000000 --- a/drivers/staging/gasket/gasket_constants.h +++ /dev/null @@ -1,44 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright (C) 2018 Google, Inc. */ -#ifndef __GASKET_CONSTANTS_H__ -#define __GASKET_CONSTANTS_H__ - -#define GASKET_FRAMEWORK_VERSION "1.1.2" - -/* - * The maximum number of simultaneous device types supported by the framework. - */ -#define GASKET_FRAMEWORK_DESC_MAX 2 - -/* The maximum devices per each type. */ -#define GASKET_DEV_MAX 256 - -/* The number of supported Gasket page tables per device. */ -#define GASKET_MAX_NUM_PAGE_TABLES 1 - -/* Maximum length of device names (driver name + minor number suffix + NULL). */ -#define GASKET_NAME_MAX 32 - -/* Device status enumeration. */ -enum gasket_status { - /* - * A device is DEAD if it has not been initialized or has had an error. - */ - GASKET_STATUS_DEAD = 0, - /* - * A device is LAMED if the hardware is healthy but the kernel was - * unable to enable some functionality (e.g. interrupts). - */ - GASKET_STATUS_LAMED, - - /* A device is ALIVE if it is ready for operation. */ - GASKET_STATUS_ALIVE, - - /* - * This status is set when the driver is exiting and waiting for all - * handles to be closed. - */ - GASKET_STATUS_DRIVER_EXIT, -}; - -#endif diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c deleted file mode 100644 index 28dab302183b..000000000000 --- a/drivers/staging/gasket/gasket_core.c +++ /dev/null @@ -1,1815 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Gasket generic driver framework. This file contains the implementation - * for the Gasket generic driver framework - the functionality that is common - * across Gasket devices. - * - * Copyright (C) 2018 Google, Inc. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include "gasket_core.h" - -#include "gasket_interrupt.h" -#include "gasket_ioctl.h" -#include "gasket_page_table.h" -#include "gasket_sysfs.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef GASKET_KERNEL_TRACE_SUPPORT -#define CREATE_TRACE_POINTS -#include -#else -#define trace_gasket_mmap_exit(x) -#define trace_gasket_mmap_entry(x, ...) -#endif - -/* - * "Private" members of gasket_driver_desc. - * - * Contains internal per-device type tracking data, i.e., data not appropriate - * as part of the public interface for the generic framework. - */ -struct gasket_internal_desc { - /* Device-specific-driver-provided configuration information. */ - const struct gasket_driver_desc *driver_desc; - - /* Protects access to per-driver data (i.e. this structure). */ - struct mutex mutex; - - /* Kernel-internal device class. */ - struct class *class; - - /* Instantiated / present devices of this type. */ - struct gasket_dev *devs[GASKET_DEV_MAX]; -}; - -/* do_map_region() needs be able to return more than just true/false. */ -enum do_map_region_status { - /* The region was successfully mapped. */ - DO_MAP_REGION_SUCCESS, - - /* Attempted to map region and failed. */ - DO_MAP_REGION_FAILURE, - - /* The requested region to map was not part of a mappable region. */ - DO_MAP_REGION_INVALID, -}; - -/* Global data definitions. */ -/* Mutex - only for framework-wide data. Other data should be protected by - * finer-grained locks. - */ -static DEFINE_MUTEX(g_mutex); - -/* List of all registered device descriptions & their supporting data. */ -static struct gasket_internal_desc g_descs[GASKET_FRAMEWORK_DESC_MAX]; - -/* Mapping of statuses to human-readable strings. Must end with {0,NULL}. */ -static const struct gasket_num_name gasket_status_name_table[] = { - { GASKET_STATUS_DEAD, "DEAD" }, - { GASKET_STATUS_ALIVE, "ALIVE" }, - { GASKET_STATUS_LAMED, "LAMED" }, - { GASKET_STATUS_DRIVER_EXIT, "DRIVER_EXITING" }, - { 0, NULL }, -}; - -/* Enumeration of the automatic Gasket framework sysfs nodes. */ -enum gasket_sysfs_attribute_type { - ATTR_BAR_OFFSETS, - ATTR_BAR_SIZES, - ATTR_DRIVER_VERSION, - ATTR_FRAMEWORK_VERSION, - ATTR_DEVICE_TYPE, - ATTR_HARDWARE_REVISION, - ATTR_PCI_ADDRESS, - ATTR_STATUS, - ATTR_IS_DEVICE_OWNED, - ATTR_DEVICE_OWNER, - ATTR_WRITE_OPEN_COUNT, - ATTR_RESET_COUNT, - ATTR_USER_MEM_RANGES -}; - -/* Perform a standard Gasket callback. */ -static inline int -check_and_invoke_callback(struct gasket_dev *gasket_dev, - int (*cb_function)(struct gasket_dev *)) -{ - int ret = 0; - - if (cb_function) { - mutex_lock(&gasket_dev->mutex); - ret = cb_function(gasket_dev); - mutex_unlock(&gasket_dev->mutex); - } - return ret; -} - -/* Perform a standard Gasket callback without grabbing gasket_dev->mutex. */ -static inline int -gasket_check_and_invoke_callback_nolock(struct gasket_dev *gasket_dev, - int (*cb_function)(struct gasket_dev *)) -{ - int ret = 0; - - if (cb_function) - ret = cb_function(gasket_dev); - return ret; -} - -/* - * Return nonzero if the gasket_cdev_info is owned by the current thread group - * ID. - */ -static int gasket_owned_by_current_tgid(struct gasket_cdev_info *info) -{ - return (info->ownership.is_owned && - (info->ownership.owner == current->tgid)); -} - -/* - * Find the next free gasket_internal_dev slot. - * - * Returns the located slot number on success or a negative number on failure. - */ -static int gasket_find_dev_slot(struct gasket_internal_desc *internal_desc, - const char *kobj_name) -{ - int i; - - mutex_lock(&internal_desc->mutex); - - /* Search for a previous instance of this device. */ - for (i = 0; i < GASKET_DEV_MAX; i++) { - if (internal_desc->devs[i] && - strcmp(internal_desc->devs[i]->kobj_name, kobj_name) == 0) { - pr_err("Duplicate device %s\n", kobj_name); - mutex_unlock(&internal_desc->mutex); - return -EBUSY; - } - } - - /* Find a free device slot. */ - for (i = 0; i < GASKET_DEV_MAX; i++) { - if (!internal_desc->devs[i]) - break; - } - - if (i == GASKET_DEV_MAX) { - pr_err("Too many registered devices; max %d\n", GASKET_DEV_MAX); - mutex_unlock(&internal_desc->mutex); - return -EBUSY; - } - - mutex_unlock(&internal_desc->mutex); - return i; -} - -/* - * Allocate and initialize a Gasket device structure, add the device to the - * device list. - * - * Returns 0 if successful, a negative error code otherwise. - */ -static int gasket_alloc_dev(struct gasket_internal_desc *internal_desc, - struct device *parent, struct gasket_dev **pdev) -{ - int dev_idx; - const struct gasket_driver_desc *driver_desc = - internal_desc->driver_desc; - struct gasket_dev *gasket_dev; - struct gasket_cdev_info *dev_info; - const char *parent_name = dev_name(parent); - - pr_debug("Allocating a Gasket device, parent %s.\n", parent_name); - - *pdev = NULL; - - dev_idx = gasket_find_dev_slot(internal_desc, parent_name); - if (dev_idx < 0) - return dev_idx; - - gasket_dev = *pdev = kzalloc(sizeof(*gasket_dev), GFP_KERNEL); - if (!gasket_dev) { - pr_err("no memory for device, parent %s\n", parent_name); - return -ENOMEM; - } - internal_desc->devs[dev_idx] = gasket_dev; - - mutex_init(&gasket_dev->mutex); - - gasket_dev->internal_desc = internal_desc; - gasket_dev->dev_idx = dev_idx; - snprintf(gasket_dev->kobj_name, GASKET_NAME_MAX, "%s", parent_name); - gasket_dev->dev = get_device(parent); - /* gasket_bar_data is uninitialized. */ - gasket_dev->num_page_tables = driver_desc->num_page_tables; - /* max_page_table_size and *page table are uninit'ed */ - /* interrupt_data is not initialized. */ - /* status is 0, or GASKET_STATUS_DEAD */ - - dev_info = &gasket_dev->dev_info; - snprintf(dev_info->name, GASKET_NAME_MAX, "%s_%u", driver_desc->name, - gasket_dev->dev_idx); - dev_info->devt = - MKDEV(driver_desc->major, driver_desc->minor + - gasket_dev->dev_idx); - dev_info->device = - device_create(internal_desc->class, parent, dev_info->devt, - gasket_dev, dev_info->name); - - /* cdev has not yet been added; cdev_added is 0 */ - dev_info->gasket_dev_ptr = gasket_dev; - /* ownership is all 0, indicating no owner or opens. */ - - return 0; -} - -/* Free a Gasket device. */ -static void gasket_free_dev(struct gasket_dev *gasket_dev) -{ - struct gasket_internal_desc *internal_desc = gasket_dev->internal_desc; - - mutex_lock(&internal_desc->mutex); - internal_desc->devs[gasket_dev->dev_idx] = NULL; - mutex_unlock(&internal_desc->mutex); - put_device(gasket_dev->dev); - kfree(gasket_dev); -} - -/* - * Maps the specified bar into kernel space. - * - * Returns 0 on success, a negative error code otherwise. - * A zero-sized BAR will not be mapped, but is not an error. - */ -static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num) -{ - struct gasket_internal_desc *internal_desc = gasket_dev->internal_desc; - const struct gasket_driver_desc *driver_desc = - internal_desc->driver_desc; - ulong desc_bytes = driver_desc->bar_descriptions[bar_num].size; - struct gasket_bar_data *data; - int ret; - - if (desc_bytes == 0) - return 0; - - if (driver_desc->bar_descriptions[bar_num].type != PCI_BAR) { - /* not PCI: skip this entry */ - return 0; - } - - data = &gasket_dev->bar_data[bar_num]; - - /* - * pci_resource_start and pci_resource_len return a "resource_size_t", - * which is safely castable to ulong (which itself is the arg to - * request_mem_region). - */ - data->phys_base = - (ulong)pci_resource_start(gasket_dev->pci_dev, bar_num); - if (!data->phys_base) { - dev_err(gasket_dev->dev, "Cannot get BAR%u base address\n", - bar_num); - return -EINVAL; - } - - data->length_bytes = - (ulong)pci_resource_len(gasket_dev->pci_dev, bar_num); - if (data->length_bytes < desc_bytes) { - dev_err(gasket_dev->dev, - "PCI BAR %u space is too small: %lu; expected >= %lu\n", - bar_num, data->length_bytes, desc_bytes); - return -ENOMEM; - } - - if (!request_mem_region(data->phys_base, data->length_bytes, - gasket_dev->dev_info.name)) { - dev_err(gasket_dev->dev, - "Cannot get BAR %d memory region %p\n", - bar_num, &gasket_dev->pci_dev->resource[bar_num]); - return -EINVAL; - } - - data->virt_base = ioremap(data->phys_base, data->length_bytes); - if (!data->virt_base) { - dev_err(gasket_dev->dev, - "Cannot remap BAR %d memory region %p\n", - bar_num, &gasket_dev->pci_dev->resource[bar_num]); - ret = -ENOMEM; - goto fail; - } - - dma_set_mask(&gasket_dev->pci_dev->dev, DMA_BIT_MASK(64)); - dma_set_coherent_mask(&gasket_dev->pci_dev->dev, DMA_BIT_MASK(64)); - - return 0; - -fail: - iounmap(data->virt_base); - release_mem_region(data->phys_base, data->length_bytes); - return ret; -} - -/* - * Releases PCI BAR mapping. - * - * A zero-sized or not-mapped BAR will not be unmapped, but is not an error. - */ -static void gasket_unmap_pci_bar(struct gasket_dev *dev, int bar_num) -{ - ulong base, bytes; - struct gasket_internal_desc *internal_desc = dev->internal_desc; - const struct gasket_driver_desc *driver_desc = - internal_desc->driver_desc; - - if (driver_desc->bar_descriptions[bar_num].size == 0 || - !dev->bar_data[bar_num].virt_base) - return; - - if (driver_desc->bar_descriptions[bar_num].type != PCI_BAR) - return; - - iounmap(dev->bar_data[bar_num].virt_base); - dev->bar_data[bar_num].virt_base = NULL; - - base = pci_resource_start(dev->pci_dev, bar_num); - if (!base) { - dev_err(dev->dev, "cannot get PCI BAR%u base address\n", - bar_num); - return; - } - - bytes = pci_resource_len(dev->pci_dev, bar_num); - release_mem_region(base, bytes); -} - -/* - * Setup PCI memory mapping for the specified device. - * - * Reads the BAR registers and sets up pointers to the device's memory mapped - * IO space. - * - * Returns 0 on success and a negative value otherwise. - */ -static int gasket_setup_pci(struct pci_dev *pci_dev, - struct gasket_dev *gasket_dev) -{ - int i, mapped_bars, ret; - - for (i = 0; i < PCI_STD_NUM_BARS; i++) { - ret = gasket_map_pci_bar(gasket_dev, i); - if (ret) { - mapped_bars = i; - goto fail; - } - } - - return 0; - -fail: - for (i = 0; i < mapped_bars; i++) - gasket_unmap_pci_bar(gasket_dev, i); - - return -ENOMEM; -} - -/* Unmaps memory for the specified device. */ -static void gasket_cleanup_pci(struct gasket_dev *gasket_dev) -{ - int i; - - for (i = 0; i < PCI_STD_NUM_BARS; i++) - gasket_unmap_pci_bar(gasket_dev, i); -} - -/* Determine the health of the Gasket device. */ -static int gasket_get_hw_status(struct gasket_dev *gasket_dev) -{ - int status; - int i; - const struct gasket_driver_desc *driver_desc = - gasket_dev->internal_desc->driver_desc; - - status = gasket_check_and_invoke_callback_nolock(gasket_dev, - driver_desc->device_status_cb); - if (status != GASKET_STATUS_ALIVE) { - dev_dbg(gasket_dev->dev, "Hardware reported status %d.\n", - status); - return status; - } - - status = gasket_interrupt_system_status(gasket_dev); - if (status != GASKET_STATUS_ALIVE) { - dev_dbg(gasket_dev->dev, - "Interrupt system reported status %d.\n", status); - return status; - } - - for (i = 0; i < driver_desc->num_page_tables; ++i) { - status = gasket_page_table_system_status(gasket_dev->page_table[i]); - if (status != GASKET_STATUS_ALIVE) { - dev_dbg(gasket_dev->dev, - "Page table %d reported status %d.\n", - i, status); - return status; - } - } - - return GASKET_STATUS_ALIVE; -} - -static ssize_t -gasket_write_mappable_regions(char *buf, - const struct gasket_driver_desc *driver_desc, - int bar_index) -{ - int i; - ssize_t written; - ssize_t total_written = 0; - ulong min_addr, max_addr; - struct gasket_bar_desc bar_desc = - driver_desc->bar_descriptions[bar_index]; - - if (bar_desc.permissions == GASKET_NOMAP) - return 0; - for (i = 0; - i < bar_desc.num_mappable_regions && total_written < PAGE_SIZE; - i++) { - min_addr = bar_desc.mappable_regions[i].start - - driver_desc->legacy_mmap_address_offset; - max_addr = bar_desc.mappable_regions[i].start - - driver_desc->legacy_mmap_address_offset + - bar_desc.mappable_regions[i].length_bytes; - written = scnprintf(buf, PAGE_SIZE - total_written, - "0x%08lx-0x%08lx\n", min_addr, max_addr); - total_written += written; - buf += written; - } - return total_written; -} - -static ssize_t gasket_sysfs_data_show(struct device *device, - struct device_attribute *attr, char *buf) -{ - int i, ret = 0; - ssize_t current_written = 0; - const struct gasket_driver_desc *driver_desc; - struct gasket_dev *gasket_dev; - struct gasket_sysfs_attribute *gasket_attr; - const struct gasket_bar_desc *bar_desc; - enum gasket_sysfs_attribute_type sysfs_type; - - gasket_dev = gasket_sysfs_get_device_data(device); - if (!gasket_dev) { - dev_err(device, "No sysfs mapping found for device\n"); - return 0; - } - - gasket_attr = gasket_sysfs_get_attr(device, attr); - if (!gasket_attr) { - dev_err(device, "No sysfs attr found for device\n"); - gasket_sysfs_put_device_data(device, gasket_dev); - return 0; - } - - driver_desc = gasket_dev->internal_desc->driver_desc; - - sysfs_type = - (enum gasket_sysfs_attribute_type)gasket_attr->data.attr_type; - switch (sysfs_type) { - case ATTR_BAR_OFFSETS: - for (i = 0; i < PCI_STD_NUM_BARS; i++) { - bar_desc = &driver_desc->bar_descriptions[i]; - if (bar_desc->size == 0) - continue; - current_written = - snprintf(buf, PAGE_SIZE - ret, "%d: 0x%lx\n", i, - (ulong)bar_desc->base); - buf += current_written; - ret += current_written; - } - break; - case ATTR_BAR_SIZES: - for (i = 0; i < PCI_STD_NUM_BARS; i++) { - bar_desc = &driver_desc->bar_descriptions[i]; - if (bar_desc->size == 0) - continue; - current_written = - snprintf(buf, PAGE_SIZE - ret, "%d: 0x%lx\n", i, - (ulong)bar_desc->size); - buf += current_written; - ret += current_written; - } - break; - case ATTR_DRIVER_VERSION: - ret = snprintf(buf, PAGE_SIZE, "%s\n", - gasket_dev->internal_desc->driver_desc->driver_version); - break; - case ATTR_FRAMEWORK_VERSION: - ret = snprintf(buf, PAGE_SIZE, "%s\n", - GASKET_FRAMEWORK_VERSION); - break; - case ATTR_DEVICE_TYPE: - ret = snprintf(buf, PAGE_SIZE, "%s\n", - gasket_dev->internal_desc->driver_desc->name); - break; - case ATTR_HARDWARE_REVISION: - ret = snprintf(buf, PAGE_SIZE, "%d\n", - gasket_dev->hardware_revision); - break; - case ATTR_PCI_ADDRESS: - ret = snprintf(buf, PAGE_SIZE, "%s\n", gasket_dev->kobj_name); - break; - case ATTR_STATUS: - ret = snprintf(buf, PAGE_SIZE, "%s\n", - gasket_num_name_lookup(gasket_dev->status, - gasket_status_name_table)); - break; - case ATTR_IS_DEVICE_OWNED: - ret = snprintf(buf, PAGE_SIZE, "%d\n", - gasket_dev->dev_info.ownership.is_owned); - break; - case ATTR_DEVICE_OWNER: - ret = snprintf(buf, PAGE_SIZE, "%d\n", - gasket_dev->dev_info.ownership.owner); - break; - case ATTR_WRITE_OPEN_COUNT: - ret = snprintf(buf, PAGE_SIZE, "%d\n", - gasket_dev->dev_info.ownership.write_open_count); - break; - case ATTR_RESET_COUNT: - ret = snprintf(buf, PAGE_SIZE, "%d\n", gasket_dev->reset_count); - break; - case ATTR_USER_MEM_RANGES: - for (i = 0; i < PCI_STD_NUM_BARS; ++i) { - current_written = - gasket_write_mappable_regions(buf, driver_desc, - i); - buf += current_written; - ret += current_written; - } - break; - default: - dev_dbg(gasket_dev->dev, "Unknown attribute: %s\n", - attr->attr.name); - ret = 0; - break; - } - - gasket_sysfs_put_attr(device, gasket_attr); - gasket_sysfs_put_device_data(device, gasket_dev); - return ret; -} - -/* These attributes apply to all Gasket driver instances. */ -static const struct gasket_sysfs_attribute gasket_sysfs_generic_attrs[] = { - GASKET_SYSFS_RO(bar_offsets, gasket_sysfs_data_show, ATTR_BAR_OFFSETS), - GASKET_SYSFS_RO(bar_sizes, gasket_sysfs_data_show, ATTR_BAR_SIZES), - GASKET_SYSFS_RO(driver_version, gasket_sysfs_data_show, - ATTR_DRIVER_VERSION), - GASKET_SYSFS_RO(framework_version, gasket_sysfs_data_show, - ATTR_FRAMEWORK_VERSION), - GASKET_SYSFS_RO(device_type, gasket_sysfs_data_show, ATTR_DEVICE_TYPE), - GASKET_SYSFS_RO(revision, gasket_sysfs_data_show, - ATTR_HARDWARE_REVISION), - GASKET_SYSFS_RO(pci_address, gasket_sysfs_data_show, ATTR_PCI_ADDRESS), - GASKET_SYSFS_RO(status, gasket_sysfs_data_show, ATTR_STATUS), - GASKET_SYSFS_RO(is_device_owned, gasket_sysfs_data_show, - ATTR_IS_DEVICE_OWNED), - GASKET_SYSFS_RO(device_owner, gasket_sysfs_data_show, - ATTR_DEVICE_OWNER), - GASKET_SYSFS_RO(write_open_count, gasket_sysfs_data_show, - ATTR_WRITE_OPEN_COUNT), - GASKET_SYSFS_RO(reset_count, gasket_sysfs_data_show, ATTR_RESET_COUNT), - GASKET_SYSFS_RO(user_mem_ranges, gasket_sysfs_data_show, - ATTR_USER_MEM_RANGES), - GASKET_END_OF_ATTR_ARRAY -}; - -/* Add a char device and related info. */ -static int gasket_add_cdev(struct gasket_cdev_info *dev_info, - const struct file_operations *file_ops, - struct module *owner) -{ - int ret; - - cdev_init(&dev_info->cdev, file_ops); - dev_info->cdev.owner = owner; - ret = cdev_add(&dev_info->cdev, dev_info->devt, 1); - if (ret) { - dev_err(dev_info->gasket_dev_ptr->dev, - "cannot add char device [ret=%d]\n", ret); - return ret; - } - dev_info->cdev_added = 1; - - return 0; -} - -/* Disable device operations. */ -void gasket_disable_device(struct gasket_dev *gasket_dev) -{ - const struct gasket_driver_desc *driver_desc = - gasket_dev->internal_desc->driver_desc; - int i; - - /* Only delete the device if it has been successfully added. */ - if (gasket_dev->dev_info.cdev_added) - cdev_del(&gasket_dev->dev_info.cdev); - - gasket_dev->status = GASKET_STATUS_DEAD; - - gasket_interrupt_cleanup(gasket_dev); - - for (i = 0; i < driver_desc->num_page_tables; ++i) { - if (gasket_dev->page_table[i]) { - gasket_page_table_reset(gasket_dev->page_table[i]); - gasket_page_table_cleanup(gasket_dev->page_table[i]); - } - } -} -EXPORT_SYMBOL(gasket_disable_device); - -/* - * Registered driver descriptor lookup for PCI devices. - * - * Precondition: Called with g_mutex held (to avoid a race on return). - * Returns NULL if no matching device was found. - */ -static struct gasket_internal_desc * -lookup_pci_internal_desc(struct pci_dev *pci_dev) -{ - int i; - - __must_hold(&g_mutex); - for (i = 0; i < GASKET_FRAMEWORK_DESC_MAX; i++) { - if (g_descs[i].driver_desc && - g_descs[i].driver_desc->pci_id_table && - pci_match_id(g_descs[i].driver_desc->pci_id_table, pci_dev)) - return &g_descs[i]; - } - - return NULL; -} - -/* - * Verifies that the user has permissions to perform the requested mapping and - * that the provided descriptor/range is of adequate size to hold the range to - * be mapped. - */ -static bool gasket_mmap_has_permissions(struct gasket_dev *gasket_dev, - struct vm_area_struct *vma, - int bar_permissions) -{ - int requested_permissions; - /* Always allow sysadmin to access. */ - if (capable(CAP_SYS_ADMIN)) - return true; - - /* Never allow non-sysadmins to access to a dead device. */ - if (gasket_dev->status != GASKET_STATUS_ALIVE) { - dev_dbg(gasket_dev->dev, "Device is dead.\n"); - return false; - } - - /* Make sure that no wrong flags are set. */ - requested_permissions = - (vma->vm_flags & VM_ACCESS_FLAGS); - if (requested_permissions & ~(bar_permissions)) { - dev_dbg(gasket_dev->dev, - "Attempting to map a region with requested permissions 0x%x, but region has permissions 0x%x.\n", - requested_permissions, bar_permissions); - return false; - } - - /* Do not allow a non-owner to write. */ - if ((vma->vm_flags & VM_WRITE) && - !gasket_owned_by_current_tgid(&gasket_dev->dev_info)) { - dev_dbg(gasket_dev->dev, - "Attempting to mmap a region for write without owning device.\n"); - return false; - } - - return true; -} - -/* - * Verifies that the input address is within the region allocated to coherent - * buffer. - */ -static bool -gasket_is_coherent_region(const struct gasket_driver_desc *driver_desc, - ulong address) -{ - struct gasket_coherent_buffer_desc coh_buff_desc = - driver_desc->coherent_buffer_description; - - if (coh_buff_desc.permissions != GASKET_NOMAP) { - if ((address >= coh_buff_desc.base) && - (address < coh_buff_desc.base + coh_buff_desc.size)) { - return true; - } - } - return false; -} - -static int gasket_get_bar_index(const struct gasket_dev *gasket_dev, - ulong phys_addr) -{ - int i; - const struct gasket_driver_desc *driver_desc; - - driver_desc = gasket_dev->internal_desc->driver_desc; - for (i = 0; i < PCI_STD_NUM_BARS; ++i) { - struct gasket_bar_desc bar_desc = - driver_desc->bar_descriptions[i]; - - if (bar_desc.permissions != GASKET_NOMAP) { - if (phys_addr >= bar_desc.base && - phys_addr < (bar_desc.base + bar_desc.size)) { - return i; - } - } - } - /* If we haven't found the address by now, it is invalid. */ - return -EINVAL; -} - -/* - * Sets the actual bounds to map, given the device's mappable region. - * - * Given the device's mappable region, along with the user-requested mapping - * start offset and length of the user region, determine how much of this - * mappable region can be mapped into the user's region (start/end offsets), - * and the physical offset (phys_offset) into the BAR where the mapping should - * begin (either the VMA's or region lower bound). - * - * In other words, this calculates the overlap between the VMA - * (bar_offset, requested_length) and the given gasket_mappable_region. - * - * Returns true if there's anything to map, and false otherwise. - */ -static bool -gasket_mm_get_mapping_addrs(const struct gasket_mappable_region *region, - ulong bar_offset, ulong requested_length, - struct gasket_mappable_region *mappable_region, - ulong *virt_offset) -{ - ulong range_start = region->start; - ulong range_length = region->length_bytes; - ulong range_end = range_start + range_length; - - *virt_offset = 0; - if (bar_offset + requested_length < range_start) { - /* - * If the requested region is completely below the range, - * there is nothing to map. - */ - return false; - } else if (bar_offset <= range_start) { - /* If the bar offset is below this range's start - * but the requested length continues into it: - * 1) Only map starting from the beginning of this - * range's phys. offset, so we don't map unmappable - * memory. - * 2) The length of the virtual memory to not map is the - * delta between the bar offset and the - * mappable start (and since the mappable start is - * bigger, start - req.) - * 3) The map length is the minimum of the mappable - * requested length (requested_length - virt_offset) - * and the actual mappable length of the range. - */ - mappable_region->start = range_start; - *virt_offset = range_start - bar_offset; - mappable_region->length_bytes = - min(requested_length - *virt_offset, range_length); - return true; - } else if (bar_offset > range_start && - bar_offset < range_end) { - /* - * If the bar offset is within this range: - * 1) Map starting from the bar offset. - * 2) Because there is no forbidden memory between the - * bar offset and the range start, - * virt_offset is 0. - * 3) The map length is the minimum of the requested - * length and the remaining length in the buffer - * (range_end - bar_offset) - */ - mappable_region->start = bar_offset; - *virt_offset = 0; - mappable_region->length_bytes = - min(requested_length, range_end - bar_offset); - return true; - } - - /* - * If the requested [start] offset is above range_end, - * there's nothing to map. - */ - return false; -} - -/* - * Calculates the offset where the VMA range begins in its containing BAR. - * The offset is written into bar_offset on success. - * Returns zero on success, anything else on error. - */ -static int gasket_mm_vma_bar_offset(const struct gasket_dev *gasket_dev, - const struct vm_area_struct *vma, - ulong *bar_offset) -{ - ulong raw_offset; - int bar_index; - const struct gasket_driver_desc *driver_desc = - gasket_dev->internal_desc->driver_desc; - - raw_offset = (vma->vm_pgoff << PAGE_SHIFT) + - driver_desc->legacy_mmap_address_offset; - bar_index = gasket_get_bar_index(gasket_dev, raw_offset); - if (bar_index < 0) { - dev_err(gasket_dev->dev, - "Unable to find matching bar for address 0x%lx\n", - raw_offset); - trace_gasket_mmap_exit(bar_index); - return bar_index; - } - *bar_offset = - raw_offset - driver_desc->bar_descriptions[bar_index].base; - - return 0; -} - -int gasket_mm_unmap_region(const struct gasket_dev *gasket_dev, - struct vm_area_struct *vma, - const struct gasket_mappable_region *map_region) -{ - ulong bar_offset; - ulong virt_offset; - struct gasket_mappable_region mappable_region; - int ret; - - if (map_region->length_bytes == 0) - return 0; - - ret = gasket_mm_vma_bar_offset(gasket_dev, vma, &bar_offset); - if (ret) - return ret; - - if (!gasket_mm_get_mapping_addrs(map_region, bar_offset, - vma->vm_end - vma->vm_start, - &mappable_region, &virt_offset)) - return 1; - - /* - * The length passed to zap_vma_ptes MUST BE A MULTIPLE OF - * PAGE_SIZE! Trust me. I have the scars. - * - * Next multiple of y: ceil_div(x, y) * y - */ - zap_vma_ptes(vma, vma->vm_start + virt_offset, - DIV_ROUND_UP(mappable_region.length_bytes, PAGE_SIZE) * - PAGE_SIZE); - return 0; -} -EXPORT_SYMBOL(gasket_mm_unmap_region); - -/* Maps a virtual address + range to a physical offset of a BAR. */ -static enum do_map_region_status -do_map_region(const struct gasket_dev *gasket_dev, struct vm_area_struct *vma, - struct gasket_mappable_region *mappable_region) -{ - /* Maximum size of a single call to io_remap_pfn_range. */ - /* I pulled this number out of thin air. */ - const ulong max_chunk_size = 64 * 1024 * 1024; - ulong chunk_size, mapped_bytes = 0; - - const struct gasket_driver_desc *driver_desc = - gasket_dev->internal_desc->driver_desc; - - ulong bar_offset, virt_offset; - struct gasket_mappable_region region_to_map; - ulong phys_offset, map_length; - ulong virt_base, phys_base; - int bar_index, ret; - - ret = gasket_mm_vma_bar_offset(gasket_dev, vma, &bar_offset); - if (ret) - return DO_MAP_REGION_INVALID; - - if (!gasket_mm_get_mapping_addrs(mappable_region, bar_offset, - vma->vm_end - vma->vm_start, - ®ion_to_map, &virt_offset)) - return DO_MAP_REGION_INVALID; - phys_offset = region_to_map.start; - map_length = region_to_map.length_bytes; - - virt_base = vma->vm_start + virt_offset; - bar_index = - gasket_get_bar_index(gasket_dev, - (vma->vm_pgoff << PAGE_SHIFT) + - driver_desc->legacy_mmap_address_offset); - - if (bar_index < 0) - return DO_MAP_REGION_INVALID; - - phys_base = gasket_dev->bar_data[bar_index].phys_base + phys_offset; - while (mapped_bytes < map_length) { - /* - * io_remap_pfn_range can take a while, so we chunk its - * calls and call cond_resched between each. - */ - chunk_size = min(max_chunk_size, map_length - mapped_bytes); - - cond_resched(); - ret = io_remap_pfn_range(vma, virt_base + mapped_bytes, - (phys_base + mapped_bytes) >> - PAGE_SHIFT, chunk_size, - vma->vm_page_prot); - if (ret) { - dev_err(gasket_dev->dev, - "Error remapping PFN range.\n"); - goto fail; - } - mapped_bytes += chunk_size; - } - - return DO_MAP_REGION_SUCCESS; - -fail: - /* Unmap the partial chunk we mapped. */ - mappable_region->length_bytes = mapped_bytes; - if (gasket_mm_unmap_region(gasket_dev, vma, mappable_region)) - dev_err(gasket_dev->dev, - "Error unmapping partial region 0x%lx (0x%lx bytes)\n", - (ulong)virt_offset, - (ulong)mapped_bytes); - - return DO_MAP_REGION_FAILURE; -} - -/* Map a region of coherent memory. */ -static int gasket_mmap_coherent(struct gasket_dev *gasket_dev, - struct vm_area_struct *vma) -{ - const struct gasket_driver_desc *driver_desc = - gasket_dev->internal_desc->driver_desc; - const ulong requested_length = vma->vm_end - vma->vm_start; - int ret; - ulong permissions; - - if (requested_length == 0 || requested_length > - gasket_dev->coherent_buffer.length_bytes) { - trace_gasket_mmap_exit(-EINVAL); - return -EINVAL; - } - - permissions = driver_desc->coherent_buffer_description.permissions; - if (!gasket_mmap_has_permissions(gasket_dev, vma, permissions)) { - dev_err(gasket_dev->dev, "Permission checking failed.\n"); - trace_gasket_mmap_exit(-EPERM); - return -EPERM; - } - - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); - - ret = remap_pfn_range(vma, vma->vm_start, - (gasket_dev->coherent_buffer.phys_base) >> - PAGE_SHIFT, requested_length, vma->vm_page_prot); - if (ret) { - dev_err(gasket_dev->dev, "Error remapping PFN range err=%d.\n", - ret); - trace_gasket_mmap_exit(ret); - return ret; - } - - /* Record the user virtual to dma_address mapping that was - * created by the kernel. - */ - gasket_set_user_virt(gasket_dev, requested_length, - gasket_dev->coherent_buffer.phys_base, - vma->vm_start); - return 0; -} - -/* Map a device's BARs into user space. */ -static int gasket_mmap(struct file *filp, struct vm_area_struct *vma) -{ - int i, ret; - int bar_index; - int has_mapped_anything = 0; - ulong permissions; - ulong raw_offset, vma_size; - bool is_coherent_region; - const struct gasket_driver_desc *driver_desc; - struct gasket_dev *gasket_dev = (struct gasket_dev *)filp->private_data; - const struct gasket_bar_desc *bar_desc; - struct gasket_mappable_region *map_regions = NULL; - int num_map_regions = 0; - enum do_map_region_status map_status; - - driver_desc = gasket_dev->internal_desc->driver_desc; - - if (vma->vm_start & ~PAGE_MASK) { - dev_err(gasket_dev->dev, - "Base address not page-aligned: 0x%lx\n", - vma->vm_start); - trace_gasket_mmap_exit(-EINVAL); - return -EINVAL; - } - - /* Calculate the offset of this range into physical mem. */ - raw_offset = (vma->vm_pgoff << PAGE_SHIFT) + - driver_desc->legacy_mmap_address_offset; - vma_size = vma->vm_end - vma->vm_start; - trace_gasket_mmap_entry(gasket_dev->dev_info.name, raw_offset, - vma_size); - - /* - * Check if the raw offset is within a bar region. If not, check if it - * is a coherent region. - */ - bar_index = gasket_get_bar_index(gasket_dev, raw_offset); - is_coherent_region = gasket_is_coherent_region(driver_desc, raw_offset); - if (bar_index < 0 && !is_coherent_region) { - dev_err(gasket_dev->dev, - "Unable to find matching bar for address 0x%lx\n", - raw_offset); - trace_gasket_mmap_exit(bar_index); - return bar_index; - } - if (bar_index > 0 && is_coherent_region) { - dev_err(gasket_dev->dev, - "double matching bar and coherent buffers for address 0x%lx\n", - raw_offset); - trace_gasket_mmap_exit(bar_index); - return -EINVAL; - } - - vma->vm_private_data = gasket_dev; - - if (is_coherent_region) - return gasket_mmap_coherent(gasket_dev, vma); - - /* Everything in the rest of this function is for normal BAR mapping. */ - - /* - * Subtract the base of the bar from the raw offset to get the - * memory location within the bar to map. - */ - bar_desc = &driver_desc->bar_descriptions[bar_index]; - permissions = bar_desc->permissions; - if (!gasket_mmap_has_permissions(gasket_dev, vma, permissions)) { - dev_err(gasket_dev->dev, "Permission checking failed.\n"); - trace_gasket_mmap_exit(-EPERM); - return -EPERM; - } - - if (driver_desc->get_mappable_regions_cb) { - ret = driver_desc->get_mappable_regions_cb(gasket_dev, - bar_index, - &map_regions, - &num_map_regions); - if (ret) - return ret; - } else { - if (!gasket_mmap_has_permissions(gasket_dev, vma, - bar_desc->permissions)) { - dev_err(gasket_dev->dev, - "Permission checking failed.\n"); - trace_gasket_mmap_exit(-EPERM); - return -EPERM; - } - num_map_regions = bar_desc->num_mappable_regions; - map_regions = kcalloc(num_map_regions, - sizeof(*bar_desc->mappable_regions), - GFP_KERNEL); - if (map_regions) { - memcpy(map_regions, bar_desc->mappable_regions, - num_map_regions * - sizeof(*bar_desc->mappable_regions)); - } - } - - if (!map_regions || num_map_regions == 0) { - dev_err(gasket_dev->dev, "No mappable regions returned!\n"); - return -EINVAL; - } - - /* Marks the VMA's pages as uncacheable. */ - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); - for (i = 0; i < num_map_regions; i++) { - map_status = do_map_region(gasket_dev, vma, &map_regions[i]); - /* Try the next region if this one was not mappable. */ - if (map_status == DO_MAP_REGION_INVALID) - continue; - if (map_status == DO_MAP_REGION_FAILURE) { - ret = -ENOMEM; - goto fail; - } - - has_mapped_anything = 1; - } - - kfree(map_regions); - - /* If we could not map any memory, the request was invalid. */ - if (!has_mapped_anything) { - dev_err(gasket_dev->dev, - "Map request did not contain a valid region.\n"); - trace_gasket_mmap_exit(-EINVAL); - return -EINVAL; - } - - trace_gasket_mmap_exit(0); - return 0; - -fail: - /* Need to unmap any mapped ranges. */ - num_map_regions = i; - for (i = 0; i < num_map_regions; i++) - if (gasket_mm_unmap_region(gasket_dev, vma, - &bar_desc->mappable_regions[i])) - dev_err(gasket_dev->dev, "Error unmapping range %d.\n", - i); - kfree(map_regions); - - return ret; -} - -/* - * Open the char device file. - * - * If the open is for writing, and the device is not owned, this process becomes - * the owner. If the open is for writing and the device is already owned by - * some other process, it is an error. If this process is the owner, increment - * the open count. - * - * Returns 0 if successful, a negative error number otherwise. - */ -static int gasket_open(struct inode *inode, struct file *filp) -{ - int ret; - struct gasket_dev *gasket_dev; - const struct gasket_driver_desc *driver_desc; - struct gasket_ownership *ownership; - char task_name[TASK_COMM_LEN]; - struct gasket_cdev_info *dev_info = - container_of(inode->i_cdev, struct gasket_cdev_info, cdev); - struct pid_namespace *pid_ns = task_active_pid_ns(current); - bool is_root = ns_capable(pid_ns->user_ns, CAP_SYS_ADMIN); - - gasket_dev = dev_info->gasket_dev_ptr; - driver_desc = gasket_dev->internal_desc->driver_desc; - ownership = &dev_info->ownership; - get_task_comm(task_name, current); - filp->private_data = gasket_dev; - inode->i_size = 0; - - dev_dbg(gasket_dev->dev, - "Attempting to open with tgid %u (%s) (f_mode: 0%03o, fmode_write: %d is_root: %u)\n", - current->tgid, task_name, filp->f_mode, - (filp->f_mode & FMODE_WRITE), is_root); - - /* Always allow non-writing accesses. */ - if (!(filp->f_mode & FMODE_WRITE)) { - dev_dbg(gasket_dev->dev, "Allowing read-only opening.\n"); - return 0; - } - - mutex_lock(&gasket_dev->mutex); - - dev_dbg(gasket_dev->dev, - "Current owner open count (owning tgid %u): %d.\n", - ownership->owner, ownership->write_open_count); - - /* Opening a node owned by another TGID is an error (unless root) */ - if (ownership->is_owned && ownership->owner != current->tgid && - !is_root) { - dev_err(gasket_dev->dev, - "Process %u is opening a node held by %u.\n", - current->tgid, ownership->owner); - mutex_unlock(&gasket_dev->mutex); - return -EPERM; - } - - /* If the node is not owned, assign it to the current TGID. */ - if (!ownership->is_owned) { - ret = gasket_check_and_invoke_callback_nolock(gasket_dev, - driver_desc->device_open_cb); - if (ret) { - dev_err(gasket_dev->dev, - "Error in device open cb: %d\n", ret); - mutex_unlock(&gasket_dev->mutex); - return ret; - } - ownership->is_owned = 1; - ownership->owner = current->tgid; - dev_dbg(gasket_dev->dev, "Device owner is now tgid %u\n", - ownership->owner); - } - - ownership->write_open_count++; - - dev_dbg(gasket_dev->dev, "New open count (owning tgid %u): %d\n", - ownership->owner, ownership->write_open_count); - - mutex_unlock(&gasket_dev->mutex); - return 0; -} - -/* - * Called on a close of the device file. If this process is the owner, - * decrement the open count. On last close by the owner, free up buffers and - * eventfd contexts, and release ownership. - * - * Returns 0 if successful, a negative error number otherwise. - */ -static int gasket_release(struct inode *inode, struct file *file) -{ - int i; - struct gasket_dev *gasket_dev; - struct gasket_ownership *ownership; - const struct gasket_driver_desc *driver_desc; - char task_name[TASK_COMM_LEN]; - struct gasket_cdev_info *dev_info = - container_of(inode->i_cdev, struct gasket_cdev_info, cdev); - struct pid_namespace *pid_ns = task_active_pid_ns(current); - bool is_root = ns_capable(pid_ns->user_ns, CAP_SYS_ADMIN); - - gasket_dev = dev_info->gasket_dev_ptr; - driver_desc = gasket_dev->internal_desc->driver_desc; - ownership = &dev_info->ownership; - get_task_comm(task_name, current); - mutex_lock(&gasket_dev->mutex); - - dev_dbg(gasket_dev->dev, - "Releasing device node. Call origin: tgid %u (%s) (f_mode: 0%03o, fmode_write: %d, is_root: %u)\n", - current->tgid, task_name, file->f_mode, - (file->f_mode & FMODE_WRITE), is_root); - dev_dbg(gasket_dev->dev, "Current open count (owning tgid %u): %d\n", - ownership->owner, ownership->write_open_count); - - if (file->f_mode & FMODE_WRITE) { - ownership->write_open_count--; - if (ownership->write_open_count == 0) { - dev_dbg(gasket_dev->dev, "Device is now free\n"); - ownership->is_owned = 0; - ownership->owner = 0; - - /* Forces chip reset before we unmap the page tables. */ - driver_desc->device_reset_cb(gasket_dev); - - for (i = 0; i < driver_desc->num_page_tables; ++i) { - gasket_page_table_unmap_all(gasket_dev->page_table[i]); - gasket_page_table_garbage_collect(gasket_dev->page_table[i]); - gasket_free_coherent_memory_all(gasket_dev, i); - } - - /* Closes device, enters power save. */ - gasket_check_and_invoke_callback_nolock(gasket_dev, - driver_desc->device_close_cb); - } - } - - dev_dbg(gasket_dev->dev, "New open count (owning tgid %u): %d\n", - ownership->owner, ownership->write_open_count); - mutex_unlock(&gasket_dev->mutex); - return 0; -} - -/* - * Gasket ioctl dispatch function. - * - * Check if the ioctl is a generic ioctl. If not, pass the ioctl to the - * ioctl_handler_cb registered in the driver description. - * If the ioctl is a generic ioctl, pass it to gasket_ioctl_handler. - */ -static long gasket_ioctl(struct file *filp, uint cmd, ulong arg) -{ - struct gasket_dev *gasket_dev; - const struct gasket_driver_desc *driver_desc; - void __user *argp = (void __user *)arg; - char path[256]; - - gasket_dev = (struct gasket_dev *)filp->private_data; - driver_desc = gasket_dev->internal_desc->driver_desc; - if (!driver_desc) { - dev_dbg(gasket_dev->dev, - "Unable to find device descriptor for file %s\n", - d_path(&filp->f_path, path, 256)); - return -ENODEV; - } - - if (!gasket_is_supported_ioctl(cmd)) { - /* - * The ioctl handler is not a standard Gasket callback, since - * it requires different arguments. This means we can't use - * check_and_invoke_callback. - */ - if (driver_desc->ioctl_handler_cb) - return driver_desc->ioctl_handler_cb(filp, cmd, argp); - - dev_dbg(gasket_dev->dev, "Received unknown ioctl 0x%x\n", cmd); - return -EINVAL; - } - - return gasket_handle_ioctl(filp, cmd, argp); -} - -/* File operations for all Gasket devices. */ -static const struct file_operations gasket_file_ops = { - .owner = THIS_MODULE, - .llseek = no_llseek, - .mmap = gasket_mmap, - .open = gasket_open, - .release = gasket_release, - .unlocked_ioctl = gasket_ioctl, -}; - -/* Perform final init and marks the device as active. */ -int gasket_enable_device(struct gasket_dev *gasket_dev) -{ - int tbl_idx; - int ret; - const struct gasket_driver_desc *driver_desc = - gasket_dev->internal_desc->driver_desc; - - ret = gasket_interrupt_init(gasket_dev); - if (ret) { - dev_err(gasket_dev->dev, - "Critical failure to allocate interrupts: %d\n", ret); - gasket_interrupt_cleanup(gasket_dev); - return ret; - } - - for (tbl_idx = 0; tbl_idx < driver_desc->num_page_tables; tbl_idx++) { - dev_dbg(gasket_dev->dev, "Initializing page table %d.\n", - tbl_idx); - ret = gasket_page_table_init(&gasket_dev->page_table[tbl_idx], - &gasket_dev->bar_data[driver_desc->page_table_bar_index], - &driver_desc->page_table_configs[tbl_idx], - gasket_dev->dev, - gasket_dev->pci_dev); - if (ret) { - dev_err(gasket_dev->dev, - "Couldn't init page table %d: %d\n", - tbl_idx, ret); - return ret; - } - /* - * Make sure that the page table is clear and set to simple - * addresses. - */ - gasket_page_table_reset(gasket_dev->page_table[tbl_idx]); - } - - /* - * hardware_revision_cb returns a positive integer (the rev) if - * successful.) - */ - ret = check_and_invoke_callback(gasket_dev, - driver_desc->hardware_revision_cb); - if (ret < 0) { - dev_err(gasket_dev->dev, - "Error getting hardware revision: %d\n", ret); - return ret; - } - gasket_dev->hardware_revision = ret; - - /* device_status_cb returns a device status, not an error code. */ - gasket_dev->status = gasket_get_hw_status(gasket_dev); - if (gasket_dev->status == GASKET_STATUS_DEAD) - dev_err(gasket_dev->dev, "Device reported as unhealthy.\n"); - - ret = gasket_add_cdev(&gasket_dev->dev_info, &gasket_file_ops, - driver_desc->module); - if (ret) - return ret; - - return 0; -} -EXPORT_SYMBOL(gasket_enable_device); - -static int __gasket_add_device(struct device *parent_dev, - struct gasket_internal_desc *internal_desc, - struct gasket_dev **gasket_devp) -{ - int ret; - struct gasket_dev *gasket_dev; - const struct gasket_driver_desc *driver_desc = - internal_desc->driver_desc; - - ret = gasket_alloc_dev(internal_desc, parent_dev, &gasket_dev); - if (ret) - return ret; - if (IS_ERR(gasket_dev->dev_info.device)) { - dev_err(parent_dev, "Cannot create %s device %s [ret = %ld]\n", - driver_desc->name, gasket_dev->dev_info.name, - PTR_ERR(gasket_dev->dev_info.device)); - ret = -ENODEV; - goto free_gasket_dev; - } - - ret = gasket_sysfs_create_mapping(gasket_dev->dev_info.device, - gasket_dev); - if (ret) - goto remove_device; - - ret = gasket_sysfs_create_entries(gasket_dev->dev_info.device, - gasket_sysfs_generic_attrs); - if (ret) - goto remove_sysfs_mapping; - - *gasket_devp = gasket_dev; - return 0; - -remove_sysfs_mapping: - gasket_sysfs_remove_mapping(gasket_dev->dev_info.device); -remove_device: - device_destroy(internal_desc->class, gasket_dev->dev_info.devt); -free_gasket_dev: - gasket_free_dev(gasket_dev); - return ret; -} - -static void __gasket_remove_device(struct gasket_internal_desc *internal_desc, - struct gasket_dev *gasket_dev) -{ - gasket_sysfs_remove_mapping(gasket_dev->dev_info.device); - device_destroy(internal_desc->class, gasket_dev->dev_info.devt); - gasket_free_dev(gasket_dev); -} - -/* - * Add PCI gasket device. - * - * Called by Gasket device probe function. - * Allocates device metadata and maps device memory. The device driver must - * call gasket_enable_device after driver init is complete to place the device - * in active use. - */ -int gasket_pci_add_device(struct pci_dev *pci_dev, - struct gasket_dev **gasket_devp) -{ - int ret; - struct gasket_internal_desc *internal_desc; - struct gasket_dev *gasket_dev; - struct device *parent; - - dev_dbg(&pci_dev->dev, "add PCI gasket device\n"); - - mutex_lock(&g_mutex); - internal_desc = lookup_pci_internal_desc(pci_dev); - mutex_unlock(&g_mutex); - if (!internal_desc) { - dev_err(&pci_dev->dev, - "PCI add device called for unknown driver type\n"); - return -ENODEV; - } - - parent = &pci_dev->dev; - ret = __gasket_add_device(parent, internal_desc, &gasket_dev); - if (ret) - return ret; - - gasket_dev->pci_dev = pci_dev; - ret = gasket_setup_pci(pci_dev, gasket_dev); - if (ret) - goto cleanup_pci; - - /* - * Once we've created the mapping structures successfully, attempt to - * create a symlink to the pci directory of this object. - */ - ret = sysfs_create_link(&gasket_dev->dev_info.device->kobj, - &pci_dev->dev.kobj, dev_name(&pci_dev->dev)); - if (ret) { - dev_err(gasket_dev->dev, - "Cannot create sysfs pci link: %d\n", ret); - goto cleanup_pci; - } - - *gasket_devp = gasket_dev; - return 0; - -cleanup_pci: - gasket_cleanup_pci(gasket_dev); - __gasket_remove_device(internal_desc, gasket_dev); - return ret; -} -EXPORT_SYMBOL(gasket_pci_add_device); - -/* Remove a PCI gasket device. */ -void gasket_pci_remove_device(struct pci_dev *pci_dev) -{ - int i; - struct gasket_internal_desc *internal_desc; - struct gasket_dev *gasket_dev = NULL; - /* Find the device desc. */ - mutex_lock(&g_mutex); - internal_desc = lookup_pci_internal_desc(pci_dev); - if (!internal_desc) { - mutex_unlock(&g_mutex); - return; - } - mutex_unlock(&g_mutex); - - /* Now find the specific device */ - mutex_lock(&internal_desc->mutex); - for (i = 0; i < GASKET_DEV_MAX; i++) { - if (internal_desc->devs[i] && - internal_desc->devs[i]->pci_dev == pci_dev) { - gasket_dev = internal_desc->devs[i]; - break; - } - } - mutex_unlock(&internal_desc->mutex); - - if (!gasket_dev) - return; - - dev_dbg(gasket_dev->dev, "remove %s PCI gasket device\n", - internal_desc->driver_desc->name); - - gasket_cleanup_pci(gasket_dev); - __gasket_remove_device(internal_desc, gasket_dev); -} -EXPORT_SYMBOL(gasket_pci_remove_device); - -/** - * Lookup a name by number in a num_name table. - * @num: Number to lookup. - * @table: Array of num_name structures, the table for the lookup. - * - * Description: Searches for num in the table. If found, the - * corresponding name is returned; otherwise NULL - * is returned. - * - * The table must have a NULL name pointer at the end. - */ -const char *gasket_num_name_lookup(uint num, - const struct gasket_num_name *table) -{ - uint i = 0; - - while (table[i].snn_name) { - if (num == table[i].snn_num) - break; - ++i; - } - - return table[i].snn_name; -} -EXPORT_SYMBOL(gasket_num_name_lookup); - -int gasket_reset(struct gasket_dev *gasket_dev) -{ - int ret; - - mutex_lock(&gasket_dev->mutex); - ret = gasket_reset_nolock(gasket_dev); - mutex_unlock(&gasket_dev->mutex); - return ret; -} -EXPORT_SYMBOL(gasket_reset); - -int gasket_reset_nolock(struct gasket_dev *gasket_dev) -{ - int ret; - int i; - const struct gasket_driver_desc *driver_desc; - - driver_desc = gasket_dev->internal_desc->driver_desc; - if (!driver_desc->device_reset_cb) - return 0; - - ret = driver_desc->device_reset_cb(gasket_dev); - if (ret) { - dev_dbg(gasket_dev->dev, "Device reset cb returned %d.\n", - ret); - return ret; - } - - /* Reinitialize the page tables and interrupt framework. */ - for (i = 0; i < driver_desc->num_page_tables; ++i) - gasket_page_table_reset(gasket_dev->page_table[i]); - - ret = gasket_interrupt_reinit(gasket_dev); - if (ret) { - dev_dbg(gasket_dev->dev, "Unable to reinit interrupts: %d.\n", - ret); - return ret; - } - - /* Get current device health. */ - gasket_dev->status = gasket_get_hw_status(gasket_dev); - if (gasket_dev->status == GASKET_STATUS_DEAD) { - dev_dbg(gasket_dev->dev, "Device reported as dead.\n"); - return -EINVAL; - } - - return 0; -} -EXPORT_SYMBOL(gasket_reset_nolock); - -gasket_ioctl_permissions_cb_t -gasket_get_ioctl_permissions_cb(struct gasket_dev *gasket_dev) -{ - return gasket_dev->internal_desc->driver_desc->ioctl_permissions_cb; -} -EXPORT_SYMBOL(gasket_get_ioctl_permissions_cb); - -/* Get the driver structure for a given gasket_dev. - * @dev: pointer to gasket_dev, implementing the requested driver. - */ -const struct gasket_driver_desc *gasket_get_driver_desc(struct gasket_dev *dev) -{ - return dev->internal_desc->driver_desc; -} - -/* Get the device structure for a given gasket_dev. - * @dev: pointer to gasket_dev, implementing the requested driver. - */ -struct device *gasket_get_device(struct gasket_dev *dev) -{ - return dev->dev; -} - -/** - * Asynchronously waits on device. - * @gasket_dev: Device struct. - * @bar: Bar - * @offset: Register offset - * @mask: Register mask - * @val: Expected value - * @max_retries: number of sleep periods - * @delay_ms: Timeout in milliseconds - * - * Description: Busy waits for a specific combination of bits to be set on a - * Gasket register. - **/ -int gasket_wait_with_reschedule(struct gasket_dev *gasket_dev, int bar, - u64 offset, u64 mask, u64 val, - uint max_retries, u64 delay_ms) -{ - uint retries = 0; - u64 tmp; - - while (retries < max_retries) { - tmp = gasket_dev_read_64(gasket_dev, bar, offset); - if ((tmp & mask) == val) - return 0; - msleep(delay_ms); - retries++; - } - dev_dbg(gasket_dev->dev, "%s timeout: reg %llx timeout (%llu ms)\n", - __func__, offset, max_retries * delay_ms); - return -ETIMEDOUT; -} -EXPORT_SYMBOL(gasket_wait_with_reschedule); - -/* See gasket_core.h for description. */ -int gasket_register_device(const struct gasket_driver_desc *driver_desc) -{ - int i, ret; - int desc_idx = -1; - struct gasket_internal_desc *internal; - - pr_debug("Loading %s driver version %s\n", driver_desc->name, - driver_desc->driver_version); - /* Check for duplicates and find a free slot. */ - mutex_lock(&g_mutex); - - for (i = 0; i < GASKET_FRAMEWORK_DESC_MAX; i++) { - if (g_descs[i].driver_desc == driver_desc) { - pr_err("%s driver already loaded/registered\n", - driver_desc->name); - mutex_unlock(&g_mutex); - return -EBUSY; - } - } - - /* This and the above loop could be combined, but this reads easier. */ - for (i = 0; i < GASKET_FRAMEWORK_DESC_MAX; i++) { - if (!g_descs[i].driver_desc) { - g_descs[i].driver_desc = driver_desc; - desc_idx = i; - break; - } - } - mutex_unlock(&g_mutex); - - if (desc_idx == -1) { - pr_err("too many drivers loaded, max %d\n", - GASKET_FRAMEWORK_DESC_MAX); - return -EBUSY; - } - - internal = &g_descs[desc_idx]; - mutex_init(&internal->mutex); - memset(internal->devs, 0, sizeof(struct gasket_dev *) * GASKET_DEV_MAX); - internal->class = - class_create(driver_desc->module, driver_desc->name); - - if (IS_ERR(internal->class)) { - pr_err("Cannot register %s class [ret=%ld]\n", - driver_desc->name, PTR_ERR(internal->class)); - ret = PTR_ERR(internal->class); - goto unregister_gasket_driver; - } - - ret = register_chrdev_region(MKDEV(driver_desc->major, - driver_desc->minor), GASKET_DEV_MAX, - driver_desc->name); - if (ret) { - pr_err("cannot register %s char driver [ret=%d]\n", - driver_desc->name, ret); - goto destroy_class; - } - - return 0; - -destroy_class: - class_destroy(internal->class); - -unregister_gasket_driver: - mutex_lock(&g_mutex); - g_descs[desc_idx].driver_desc = NULL; - mutex_unlock(&g_mutex); - return ret; -} -EXPORT_SYMBOL(gasket_register_device); - -/* See gasket_core.h for description. */ -void gasket_unregister_device(const struct gasket_driver_desc *driver_desc) -{ - int i, desc_idx; - struct gasket_internal_desc *internal_desc = NULL; - - mutex_lock(&g_mutex); - for (i = 0; i < GASKET_FRAMEWORK_DESC_MAX; i++) { - if (g_descs[i].driver_desc == driver_desc) { - internal_desc = &g_descs[i]; - desc_idx = i; - break; - } - } - - if (!internal_desc) { - mutex_unlock(&g_mutex); - pr_err("request to unregister unknown desc: %s, %d:%d\n", - driver_desc->name, driver_desc->major, - driver_desc->minor); - return; - } - - unregister_chrdev_region(MKDEV(driver_desc->major, driver_desc->minor), - GASKET_DEV_MAX); - - class_destroy(internal_desc->class); - - /* Finally, effectively "remove" the driver. */ - g_descs[desc_idx].driver_desc = NULL; - mutex_unlock(&g_mutex); - - pr_debug("removed %s driver\n", driver_desc->name); -} -EXPORT_SYMBOL(gasket_unregister_device); - -static int __init gasket_init(void) -{ - int i; - - mutex_lock(&g_mutex); - for (i = 0; i < GASKET_FRAMEWORK_DESC_MAX; i++) { - g_descs[i].driver_desc = NULL; - mutex_init(&g_descs[i].mutex); - } - - gasket_sysfs_init(); - - mutex_unlock(&g_mutex); - return 0; -} - -MODULE_DESCRIPTION("Google Gasket driver framework"); -MODULE_VERSION(GASKET_FRAMEWORK_VERSION); -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Rob Springer "); -module_init(gasket_init); diff --git a/drivers/staging/gasket/gasket_core.h b/drivers/staging/gasket/gasket_core.h deleted file mode 100644 index c417acadb0d5..000000000000 --- a/drivers/staging/gasket/gasket_core.h +++ /dev/null @@ -1,638 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Gasket generic driver. Defines the set of data types and functions necessary - * to define a driver using the Gasket generic driver framework. - * - * Copyright (C) 2018 Google, Inc. - */ -#ifndef __GASKET_CORE_H__ -#define __GASKET_CORE_H__ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "gasket_constants.h" - -/** - * struct gasket_num_name - Map numbers to names. - * @ein_num: Number. - * @ein_name: Name associated with the number, a char pointer. - * - * This structure maps numbers to names. It is used to provide printable enum - * names, e.g {0, "DEAD"} or {1, "ALIVE"}. - */ -struct gasket_num_name { - uint snn_num; - const char *snn_name; -}; - -/* - * Register location for packed interrupts. - * Each value indicates the location of an interrupt field (in units of - * gasket_driver_desc->interrupt_pack_width) within the containing register. - * In other words, this indicates the shift to use when creating a mask to - * extract/set bits within a register for a given interrupt. - */ -enum gasket_interrupt_packing { - PACK_0 = 0, - PACK_1 = 1, - PACK_2 = 2, - PACK_3 = 3, - UNPACKED = 4, -}; - -/* Type of the interrupt supported by the device. */ -enum gasket_interrupt_type { - PCI_MSIX = 0, -}; - -/* - * Used to describe a Gasket interrupt. Contains an interrupt index, a register, - * and packing data for that interrupt. The register and packing data - * fields are relevant only for PCI_MSIX interrupt type and can be - * set to 0 for everything else. - */ -struct gasket_interrupt_desc { - /* Device-wide interrupt index/number. */ - int index; - /* The register offset controlling this interrupt. */ - u64 reg; - /* The location of this interrupt inside register reg, if packed. */ - int packing; -}; - -/* - * This enum is used to identify memory regions being part of the physical - * memory that belongs to a device. - */ -enum mappable_area_type { - PCI_BAR = 0, /* Default */ - BUS_REGION, /* For SYSBUS devices, i.e. AXI etc... */ - COHERENT_MEMORY -}; - -/* - * Metadata for each BAR mapping. - * This struct is used so as to track PCI memory, I/O space, AXI and coherent - * memory area... i.e. memory objects which can be referenced in the device's - * mmap function. - */ -struct gasket_bar_data { - /* Virtual base address. */ - u8 __iomem *virt_base; - - /* Physical base address. */ - ulong phys_base; - - /* Length of the mapping. */ - ulong length_bytes; - - /* Type of mappable area */ - enum mappable_area_type type; -}; - -/* Maintains device open ownership data. */ -struct gasket_ownership { - /* 1 if the device is owned, 0 otherwise. */ - int is_owned; - - /* TGID of the owner. */ - pid_t owner; - - /* Count of current device opens in write mode. */ - int write_open_count; -}; - -/* Page table modes of operation. */ -enum gasket_page_table_mode { - /* The page table is partitionable as normal, all simple by default. */ - GASKET_PAGE_TABLE_MODE_NORMAL, - - /* All entries are always simple. */ - GASKET_PAGE_TABLE_MODE_SIMPLE, - - /* All entries are always extended. No extended bit is used. */ - GASKET_PAGE_TABLE_MODE_EXTENDED, -}; - -/* Page table configuration. One per table. */ -struct gasket_page_table_config { - /* The identifier/index of this page table. */ - int id; - - /* The operation mode of this page table. */ - enum gasket_page_table_mode mode; - - /* Total (first-level) entries in this page table. */ - ulong total_entries; - - /* Base register for the page table. */ - int base_reg; - - /* - * Register containing the extended page table. This value is unused in - * GASKET_PAGE_TABLE_MODE_SIMPLE and GASKET_PAGE_TABLE_MODE_EXTENDED - * modes. - */ - int extended_reg; - - /* The bit index indicating whether a PT entry is extended. */ - int extended_bit; -}; - -/* Maintains information about a device node. */ -struct gasket_cdev_info { - /* The internal name of this device. */ - char name[GASKET_NAME_MAX]; - - /* Device number. */ - dev_t devt; - - /* Kernel-internal device structure. */ - struct device *device; - - /* Character device for real. */ - struct cdev cdev; - - /* Flag indicating if cdev_add has been called for the devices. */ - int cdev_added; - - /* Pointer to the overall gasket_dev struct for this device. */ - struct gasket_dev *gasket_dev_ptr; - - /* Ownership data for the device in question. */ - struct gasket_ownership ownership; -}; - -/* Describes the offset and length of mmapable device BAR regions. */ -struct gasket_mappable_region { - u64 start; - u64 length_bytes; -}; - -/* Describe the offset, size, and permissions for a device bar. */ -struct gasket_bar_desc { - /* - * The size of each PCI BAR range, in bytes. If a value is 0, that BAR - * will not be mapped into kernel space at all. - * For devices with 64 bit BARs, only elements 0, 2, and 4 should be - * populated, and 1, 3, and 5 should be set to 0. - * For example, for a device mapping 1M in each of the first two 64-bit - * BARs, this field would be set as { 0x100000, 0, 0x100000, 0, 0, 0 } - * (one number per bar_desc struct.) - */ - u64 size; - /* The permissions for this bar. (Should be VM_WRITE/VM_READ/VM_EXEC, - * and can be or'd.) If set to GASKET_NOMAP, the bar will - * not be used for mmapping. - */ - ulong permissions; - /* The memory address corresponding to the base of this bar, if used. */ - u64 base; - /* The number of mappable regions in this bar. */ - int num_mappable_regions; - - /* The mappable subregions of this bar. */ - const struct gasket_mappable_region *mappable_regions; - - /* Type of mappable area */ - enum mappable_area_type type; -}; - -/* Describes the offset, size, and permissions for a coherent buffer. */ -struct gasket_coherent_buffer_desc { - /* The size of the coherent buffer. */ - u64 size; - - /* The permissions for this bar. (Should be VM_WRITE/VM_READ/VM_EXEC, - * and can be or'd.) If set to GASKET_NOMAP, the bar will - * not be used for mmaping. - */ - ulong permissions; - - /* device side address. */ - u64 base; -}; - -/* Coherent buffer structure. */ -struct gasket_coherent_buffer { - /* Virtual base address. */ - u8 *virt_base; - - /* Physical base address. */ - ulong phys_base; - - /* Length of the mapping. */ - ulong length_bytes; -}; - -/* Description of Gasket-specific permissions in the mmap field. */ -enum gasket_mapping_options { GASKET_NOMAP = 0 }; - -/* This struct represents an undefined bar that should never be mapped. */ -#define GASKET_UNUSED_BAR \ - { \ - 0, GASKET_NOMAP, 0, 0, NULL, 0 \ - } - -/* Internal data for a Gasket device. See gasket_core.c for more information. */ -struct gasket_internal_desc; - -#define MAX_NUM_COHERENT_PAGES 16 - -/* - * Device data for Gasket device instances. - * - * This structure contains the data required to manage a Gasket device. - */ -struct gasket_dev { - /* Pointer to the internal driver description for this device. */ - struct gasket_internal_desc *internal_desc; - - /* Device info */ - struct device *dev; - - /* PCI subsystem metadata. */ - struct pci_dev *pci_dev; - - /* This device's index into internal_desc->devs. */ - int dev_idx; - - /* The name of this device, as reported by the kernel. */ - char kobj_name[GASKET_NAME_MAX]; - - /* Virtual address of mapped BAR memory range. */ - struct gasket_bar_data bar_data[PCI_STD_NUM_BARS]; - - /* Coherent buffer. */ - struct gasket_coherent_buffer coherent_buffer; - - /* Number of page tables for this device. */ - int num_page_tables; - - /* Address translations. Page tables have a private implementation. */ - struct gasket_page_table *page_table[GASKET_MAX_NUM_PAGE_TABLES]; - - /* Interrupt data for this device. */ - struct gasket_interrupt_data *interrupt_data; - - /* Status for this device - GASKET_STATUS_ALIVE or _DEAD. */ - uint status; - - /* Number of times this device has been reset. */ - uint reset_count; - - /* Dev information for the cdev node. */ - struct gasket_cdev_info dev_info; - - /* Hardware revision value for this device. */ - int hardware_revision; - - /* Protects access to per-device data (i.e. this structure). */ - struct mutex mutex; - - /* cdev hash tracking/membership structure, Accel and legacy. */ - /* Unused until Accel is upstreamed. */ - struct hlist_node hlist_node; - struct hlist_node legacy_hlist_node; -}; - -/* Type of the ioctl handler callback. */ -typedef long (*gasket_ioctl_handler_cb_t)(struct file *file, uint cmd, - void __user *argp); -/* Type of the ioctl permissions check callback. See below. */ -typedef int (*gasket_ioctl_permissions_cb_t)(struct file *filp, uint cmd, - void __user *argp); - -/* - * Device type descriptor. - * - * This structure contains device-specific data needed to identify and address a - * type of device to be administered via the Gasket generic driver. - * - * Device IDs are per-driver. In other words, two drivers using the Gasket - * framework will each have a distinct device 0 (for example). - */ -struct gasket_driver_desc { - /* The name of this device type. */ - const char *name; - - /* The name of this specific device model. */ - const char *chip_model; - - /* The version of the chip specified in chip_model. */ - const char *chip_version; - - /* The version of this driver: "1.0.0", "2.1.3", etc. */ - const char *driver_version; - - /* - * Non-zero if we should create "legacy" (device and device-class- - * specific) character devices and sysfs nodes. - */ - /* Unused until Accel is upstreamed. */ - int legacy_support; - - /* Major and minor numbers identifying the device. */ - int major, minor; - - /* Module structure for this driver. */ - struct module *module; - - /* PCI ID table. */ - const struct pci_device_id *pci_id_table; - - /* The number of page tables handled by this driver. */ - int num_page_tables; - - /* The index of the bar containing the page tables. */ - int page_table_bar_index; - - /* Registers used to control each page table. */ - const struct gasket_page_table_config *page_table_configs; - - /* The bit index indicating whether a PT entry is extended. */ - int page_table_extended_bit; - - /* - * Legacy mmap address adjusment for legacy devices only. Should be 0 - * for any new device. - */ - ulong legacy_mmap_address_offset; - - /* Set of 6 bar descriptions that describe all PCIe bars. - * Note that BUS/AXI devices (i.e. non PCI devices) use those. - */ - struct gasket_bar_desc bar_descriptions[PCI_STD_NUM_BARS]; - - /* - * Coherent buffer description. - */ - struct gasket_coherent_buffer_desc coherent_buffer_description; - - /* Interrupt type. (One of gasket_interrupt_type). */ - int interrupt_type; - - /* Index of the bar containing the interrupt registers to program. */ - int interrupt_bar_index; - - /* Number of interrupts in the gasket_interrupt_desc array */ - int num_interrupts; - - /* Description of the interrupts for this device. */ - const struct gasket_interrupt_desc *interrupts; - - /* - * If this device packs multiple interrupt->MSI-X mappings into a - * single register (i.e., "uses packed interrupts"), only a single bit - * width is supported for each interrupt mapping (unpacked/"full-width" - * interrupts are always supported). This value specifies that width. If - * packed interrupts are not used, this value is ignored. - */ - int interrupt_pack_width; - - /* Driver callback functions - all may be NULL */ - /* - * device_open_cb: Callback for when a device node is opened in write - * mode. - * @dev: The gasket_dev struct for this driver instance. - * - * This callback should perform device-specific setup that needs to - * occur only once when a device is first opened. - */ - int (*device_open_cb)(struct gasket_dev *dev); - - /* - * device_release_cb: Callback when a device is closed. - * @gasket_dev: The gasket_dev struct for this driver instance. - * - * This callback is called whenever a device node fd is closed, as - * opposed to device_close_cb, which is called when the _last_ - * descriptor for an open file is closed. This call is intended to - * handle any per-user or per-fd cleanup. - */ - int (*device_release_cb)(struct gasket_dev *gasket_dev, - struct file *file); - - /* - * device_close_cb: Callback for when a device node is closed for the - * last time. - * @dev: The gasket_dev struct for this driver instance. - * - * This callback should perform device-specific cleanup that only - * needs to occur when the last reference to a device node is closed. - * - * This call is intended to handle and device-wide cleanup, as opposed - * to per-fd cleanup (which should be handled by device_release_cb). - */ - int (*device_close_cb)(struct gasket_dev *dev); - - /* - * get_mappable_regions_cb: Get descriptors of mappable device memory. - * @gasket_dev: Pointer to the struct gasket_dev for this device. - * @bar_index: BAR for which to retrieve memory ranges. - * @mappable_regions: Out-pointer to the list of mappable regions on the - * device/BAR for this process. - * @num_mappable_regions: Out-pointer for the size of mappable_regions. - * - * Called when handling mmap(), this callback is used to determine which - * regions of device memory may be mapped by the current process. This - * information is then compared to mmap request to determine which - * regions to actually map. - */ - int (*get_mappable_regions_cb)(struct gasket_dev *gasket_dev, - int bar_index, - struct gasket_mappable_region **mappable_regions, - int *num_mappable_regions); - - /* - * ioctl_permissions_cb: Check permissions for generic ioctls. - * @filp: File structure pointer describing this node usage session. - * @cmd: ioctl number to handle. - * @arg: ioctl-specific data pointer. - * - * Returns 1 if the ioctl may be executed, 0 otherwise. If this callback - * isn't specified a default routine will be used, that only allows the - * original device opener (i.e, the "owner") to execute state-affecting - * ioctls. - */ - gasket_ioctl_permissions_cb_t ioctl_permissions_cb; - - /* - * ioctl_handler_cb: Callback to handle device-specific ioctls. - * @filp: File structure pointer describing this node usage session. - * @cmd: ioctl number to handle. - * @arg: ioctl-specific data pointer. - * - * Invoked whenever an ioctl is called that the generic Gasket - * framework doesn't support. If no cb is registered, unknown ioctls - * return -EINVAL. Should return an error status (either -EINVAL or - * the error result of the ioctl being handled). - */ - gasket_ioctl_handler_cb_t ioctl_handler_cb; - - /* - * device_status_cb: Callback to determine device health. - * @dev: Pointer to the gasket_dev struct for this device. - * - * Called to determine if the device is healthy or not. Should return - * a member of the gasket_status_type enum. - * - */ - int (*device_status_cb)(struct gasket_dev *dev); - - /* - * hardware_revision_cb: Get the device's hardware revision. - * @dev: Pointer to the gasket_dev struct for this device. - * - * Called to determine the reported rev of the physical hardware. - * Revision should be >0. A negative return value is an error. - */ - int (*hardware_revision_cb)(struct gasket_dev *dev); - - /* - * device_reset_cb: Reset the hardware in question. - * @dev: Pointer to the gasket_dev structure for this device. - * - * Called by reset ioctls. This function should not - * lock the gasket_dev mutex. It should return 0 on success - * and an error on failure. - */ - int (*device_reset_cb)(struct gasket_dev *dev); -}; - -/* - * Register the specified device type with the framework. - * @desc: Populated/initialized device type descriptor. - * - * This function does _not_ take ownership of desc; the underlying struct must - * exist until the matching call to gasket_unregister_device. - * This function should be called from your driver's module_init function. - */ -int gasket_register_device(const struct gasket_driver_desc *desc); - -/* - * Remove the specified device type from the framework. - * @desc: Descriptor for the device type to unregister; it should have been - * passed to gasket_register_device in a previous call. - * - * This function should be called from your driver's module_exit function. - */ -void gasket_unregister_device(const struct gasket_driver_desc *desc); - -/* Add a PCI gasket device. */ -int gasket_pci_add_device(struct pci_dev *pci_dev, - struct gasket_dev **gasket_devp); -/* Remove a PCI gasket device. */ -void gasket_pci_remove_device(struct pci_dev *pci_dev); - -/* Enable a Gasket device. */ -int gasket_enable_device(struct gasket_dev *gasket_dev); - -/* Disable a Gasket device. */ -void gasket_disable_device(struct gasket_dev *gasket_dev); - -/* - * Reset the Gasket device. - * @gasket_dev: Gasket device struct. - * - * Calls device_reset_cb. Returns 0 on success and an error code othewrise. - * gasket_reset_nolock will not lock the mutex, gasket_reset will. - * - */ -int gasket_reset(struct gasket_dev *gasket_dev); -int gasket_reset_nolock(struct gasket_dev *gasket_dev); - -/* - * Memory management functions. These will likely be spun off into their own - * file in the future. - */ - -/* Unmaps the specified mappable region from a VMA. */ -int gasket_mm_unmap_region(const struct gasket_dev *gasket_dev, - struct vm_area_struct *vma, - const struct gasket_mappable_region *map_region); - -/* - * Get the ioctl permissions callback. - * @gasket_dev: Gasket device structure. - */ -gasket_ioctl_permissions_cb_t -gasket_get_ioctl_permissions_cb(struct gasket_dev *gasket_dev); - -/** - * Lookup a name by number in a num_name table. - * @num: Number to lookup. - * @table: Array of num_name structures, the table for the lookup. - * - */ -const char *gasket_num_name_lookup(uint num, - const struct gasket_num_name *table); - -/* Handy inlines */ -static inline ulong gasket_dev_read_64(struct gasket_dev *gasket_dev, int bar, - ulong location) -{ - return readq_relaxed(&gasket_dev->bar_data[bar].virt_base[location]); -} - -static inline void gasket_dev_write_64(struct gasket_dev *dev, u64 value, - int bar, ulong location) -{ - writeq_relaxed(value, &dev->bar_data[bar].virt_base[location]); -} - -static inline void gasket_dev_write_32(struct gasket_dev *dev, u32 value, - int bar, ulong location) -{ - writel_relaxed(value, &dev->bar_data[bar].virt_base[location]); -} - -static inline u32 gasket_dev_read_32(struct gasket_dev *dev, int bar, - ulong location) -{ - return readl_relaxed(&dev->bar_data[bar].virt_base[location]); -} - -static inline void gasket_read_modify_write_64(struct gasket_dev *dev, int bar, - ulong location, u64 value, - u64 mask_width, u64 mask_shift) -{ - u64 mask, tmp; - - tmp = gasket_dev_read_64(dev, bar, location); - mask = ((1ULL << mask_width) - 1) << mask_shift; - tmp = (tmp & ~mask) | (value << mask_shift); - gasket_dev_write_64(dev, tmp, bar, location); -} - -static inline void gasket_read_modify_write_32(struct gasket_dev *dev, int bar, - ulong location, u32 value, - u32 mask_width, u32 mask_shift) -{ - u32 mask, tmp; - - tmp = gasket_dev_read_32(dev, bar, location); - mask = ((1 << mask_width) - 1) << mask_shift; - tmp = (tmp & ~mask) | (value << mask_shift); - gasket_dev_write_32(dev, tmp, bar, location); -} - -/* Get the Gasket driver structure for a given device. */ -const struct gasket_driver_desc *gasket_get_driver_desc(struct gasket_dev *dev); - -/* Get the device structure for a given device. */ -struct device *gasket_get_device(struct gasket_dev *dev); - -/* Helper function, Asynchronous waits on a given set of bits. */ -int gasket_wait_with_reschedule(struct gasket_dev *gasket_dev, int bar, - u64 offset, u64 mask, u64 val, - uint max_retries, u64 delay_ms); - -#endif /* __GASKET_CORE_H__ */ diff --git a/drivers/staging/gasket/gasket_interrupt.c b/drivers/staging/gasket/gasket_interrupt.c deleted file mode 100644 index 864342acfd86..000000000000 --- a/drivers/staging/gasket/gasket_interrupt.c +++ /dev/null @@ -1,515 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* Copyright (C) 2018 Google, Inc. */ - -#include "gasket_interrupt.h" - -#include "gasket_constants.h" -#include "gasket_core.h" -#include "gasket_sysfs.h" -#include -#include -#include -#ifdef GASKET_KERNEL_TRACE_SUPPORT -#define CREATE_TRACE_POINTS -#include -#else -#define trace_gasket_interrupt_event(x, ...) -#endif -/* Retry attempts if the requested number of interrupts aren't available. */ -#define MSIX_RETRY_COUNT 3 - -/* Instance interrupt management data. */ -struct gasket_interrupt_data { - /* The name associated with this interrupt data. */ - const char *name; - - /* Interrupt type. See gasket_interrupt_type in gasket_core.h */ - int type; - - /* The PCI device [if any] associated with the owning device. */ - struct pci_dev *pci_dev; - - /* Set to 1 if MSI-X has successfully been configred, 0 otherwise. */ - int msix_configured; - - /* The number of interrupts requested by the owning device. */ - int num_interrupts; - - /* A pointer to the interrupt descriptor struct for this device. */ - const struct gasket_interrupt_desc *interrupts; - - /* The index of the bar into which interrupts should be mapped. */ - int interrupt_bar_index; - - /* The width of a single interrupt in a packed interrupt register. */ - int pack_width; - - /* - * Design-wise, these elements should be bundled together, but - * pci_enable_msix's interface requires that they be managed - * individually (requires array of struct msix_entry). - */ - - /* The number of successfully configured interrupts. */ - int num_configured; - - /* The MSI-X data for each requested/configured interrupt. */ - struct msix_entry *msix_entries; - - /* The eventfd "callback" data for each interrupt. */ - struct eventfd_ctx **eventfd_ctxs; - - /* The number of times each interrupt has been called. */ - ulong *interrupt_counts; - - /* Linux IRQ number. */ - int irq; -}; - -/* Structures to display interrupt counts in sysfs. */ -enum interrupt_sysfs_attribute_type { - ATTR_INTERRUPT_COUNTS, -}; - -/* Set up device registers for interrupt handling. */ -static void gasket_interrupt_setup(struct gasket_dev *gasket_dev) -{ - int i; - int pack_shift; - ulong mask; - ulong value; - struct gasket_interrupt_data *interrupt_data = - gasket_dev->interrupt_data; - - if (!interrupt_data) { - dev_dbg(gasket_dev->dev, "Interrupt data is not initialized\n"); - return; - } - - dev_dbg(gasket_dev->dev, "Running interrupt setup\n"); - - /* Setup the MSIX table. */ - - for (i = 0; i < interrupt_data->num_interrupts; i++) { - /* - * If the interrupt is not packed, we can write the index into - * the register directly. If not, we need to deal with a read- - * modify-write and shift based on the packing index. - */ - dev_dbg(gasket_dev->dev, - "Setting up interrupt index %d with index 0x%llx and packing %d\n", - interrupt_data->interrupts[i].index, - interrupt_data->interrupts[i].reg, - interrupt_data->interrupts[i].packing); - if (interrupt_data->interrupts[i].packing == UNPACKED) { - value = interrupt_data->interrupts[i].index; - } else { - switch (interrupt_data->interrupts[i].packing) { - case PACK_0: - pack_shift = 0; - break; - case PACK_1: - pack_shift = interrupt_data->pack_width; - break; - case PACK_2: - pack_shift = 2 * interrupt_data->pack_width; - break; - case PACK_3: - pack_shift = 3 * interrupt_data->pack_width; - break; - default: - dev_dbg(gasket_dev->dev, - "Found interrupt description with unknown enum %d\n", - interrupt_data->interrupts[i].packing); - return; - } - - mask = ~(0xFFFF << pack_shift); - value = gasket_dev_read_64(gasket_dev, - interrupt_data->interrupt_bar_index, - interrupt_data->interrupts[i].reg); - value &= mask; - value |= interrupt_data->interrupts[i].index - << pack_shift; - } - gasket_dev_write_64(gasket_dev, value, - interrupt_data->interrupt_bar_index, - interrupt_data->interrupts[i].reg); - } -} - -static void -gasket_handle_interrupt(struct gasket_interrupt_data *interrupt_data, - int interrupt_index) -{ - struct eventfd_ctx *ctx; - - trace_gasket_interrupt_event(interrupt_data->name, interrupt_index); - ctx = interrupt_data->eventfd_ctxs[interrupt_index]; - if (ctx) - eventfd_signal(ctx, 1); - - ++(interrupt_data->interrupt_counts[interrupt_index]); -} - -static irqreturn_t gasket_msix_interrupt_handler(int irq, void *dev_id) -{ - struct gasket_interrupt_data *interrupt_data = dev_id; - int interrupt = -1; - int i; - - /* If this linear lookup is a problem, we can maintain a map/hash. */ - for (i = 0; i < interrupt_data->num_interrupts; i++) { - if (interrupt_data->msix_entries[i].vector == irq) { - interrupt = interrupt_data->msix_entries[i].entry; - break; - } - } - if (interrupt == -1) { - pr_err("Received unknown irq %d\n", irq); - return IRQ_HANDLED; - } - gasket_handle_interrupt(interrupt_data, interrupt); - return IRQ_HANDLED; -} - -static int -gasket_interrupt_msix_init(struct gasket_interrupt_data *interrupt_data) -{ - int ret = 1; - int i; - - interrupt_data->msix_entries = - kcalloc(interrupt_data->num_interrupts, - sizeof(*interrupt_data->msix_entries), GFP_KERNEL); - if (!interrupt_data->msix_entries) - return -ENOMEM; - - for (i = 0; i < interrupt_data->num_interrupts; i++) { - interrupt_data->msix_entries[i].entry = i; - interrupt_data->msix_entries[i].vector = 0; - interrupt_data->eventfd_ctxs[i] = NULL; - } - - /* Retry MSIX_RETRY_COUNT times if not enough IRQs are available. */ - for (i = 0; i < MSIX_RETRY_COUNT && ret > 0; i++) - ret = pci_enable_msix_exact(interrupt_data->pci_dev, - interrupt_data->msix_entries, - interrupt_data->num_interrupts); - - if (ret) - return ret > 0 ? -EBUSY : ret; - interrupt_data->msix_configured = 1; - - for (i = 0; i < interrupt_data->num_interrupts; i++) { - ret = request_irq(interrupt_data->msix_entries[i].vector, - gasket_msix_interrupt_handler, 0, - interrupt_data->name, interrupt_data); - - if (ret) { - dev_err(&interrupt_data->pci_dev->dev, - "Cannot get IRQ for interrupt %d, vector %d; " - "%d\n", - i, interrupt_data->msix_entries[i].vector, ret); - return ret; - } - - interrupt_data->num_configured++; - } - - return 0; -} - -/* - * On QCM DragonBoard, we exit gasket_interrupt_msix_init() and kernel interrupt - * setup code with MSIX vectors masked. This is wrong because nothing else in - * the driver will normally touch the MSIX vectors. - * - * As a temporary hack, force unmasking there. - * - * TODO: Figure out why QCM kernel doesn't unmask the MSIX vectors, after - * gasket_interrupt_msix_init(), and remove this code. - */ -static void force_msix_interrupt_unmasking(struct gasket_dev *gasket_dev) -{ - int i; -#define MSIX_VECTOR_SIZE 16 -#define MSIX_MASK_BIT_OFFSET 12 -#define APEX_BAR2_REG_KERNEL_HIB_MSIX_TABLE 0x46800 - for (i = 0; i < gasket_dev->interrupt_data->num_configured; i++) { - /* Check if the MSIX vector is unmasked */ - ulong location = APEX_BAR2_REG_KERNEL_HIB_MSIX_TABLE + - MSIX_MASK_BIT_OFFSET + i * MSIX_VECTOR_SIZE; - u32 mask = - gasket_dev_read_32(gasket_dev, - gasket_dev->interrupt_data->interrupt_bar_index, - location); - if (!(mask & 1)) - continue; - /* Unmask the msix vector (clear 32 bits) */ - gasket_dev_write_32(gasket_dev, 0, - gasket_dev->interrupt_data->interrupt_bar_index, - location); - } -#undef MSIX_VECTOR_SIZE -#undef MSIX_MASK_BIT_OFFSET -#undef APEX_BAR2_REG_KERNEL_HIB_MSIX_TABLE -} - -static ssize_t interrupt_sysfs_show(struct device *device, - struct device_attribute *attr, char *buf) -{ - int i, ret; - ssize_t written = 0, total_written = 0; - struct gasket_interrupt_data *interrupt_data; - struct gasket_dev *gasket_dev; - struct gasket_sysfs_attribute *gasket_attr; - enum interrupt_sysfs_attribute_type sysfs_type; - - gasket_dev = gasket_sysfs_get_device_data(device); - if (!gasket_dev) { - dev_dbg(device, "No sysfs mapping found for device\n"); - return 0; - } - - gasket_attr = gasket_sysfs_get_attr(device, attr); - if (!gasket_attr) { - dev_dbg(device, "No sysfs attr data found for device\n"); - gasket_sysfs_put_device_data(device, gasket_dev); - return 0; - } - - sysfs_type = (enum interrupt_sysfs_attribute_type) - gasket_attr->data.attr_type; - interrupt_data = gasket_dev->interrupt_data; - switch (sysfs_type) { - case ATTR_INTERRUPT_COUNTS: - for (i = 0; i < interrupt_data->num_interrupts; ++i) { - written = - scnprintf(buf, PAGE_SIZE - total_written, - "0x%02x: %ld\n", i, - interrupt_data->interrupt_counts[i]); - total_written += written; - buf += written; - } - ret = total_written; - break; - default: - dev_dbg(gasket_dev->dev, "Unknown attribute: %s\n", - attr->attr.name); - ret = 0; - break; - } - - gasket_sysfs_put_attr(device, gasket_attr); - gasket_sysfs_put_device_data(device, gasket_dev); - return ret; -} - -static struct gasket_sysfs_attribute interrupt_sysfs_attrs[] = { - GASKET_SYSFS_RO(interrupt_counts, interrupt_sysfs_show, - ATTR_INTERRUPT_COUNTS), - GASKET_END_OF_ATTR_ARRAY, -}; - -int gasket_interrupt_init(struct gasket_dev *gasket_dev) -{ - int ret; - struct gasket_interrupt_data *interrupt_data; - const struct gasket_driver_desc *driver_desc = - gasket_get_driver_desc(gasket_dev); - - interrupt_data = kzalloc(sizeof(*interrupt_data), GFP_KERNEL); - if (!interrupt_data) - return -ENOMEM; - gasket_dev->interrupt_data = interrupt_data; - interrupt_data->name = driver_desc->name; - interrupt_data->type = driver_desc->interrupt_type; - interrupt_data->pci_dev = gasket_dev->pci_dev; - interrupt_data->num_interrupts = driver_desc->num_interrupts; - interrupt_data->interrupts = driver_desc->interrupts; - interrupt_data->interrupt_bar_index = driver_desc->interrupt_bar_index; - interrupt_data->pack_width = driver_desc->interrupt_pack_width; - interrupt_data->num_configured = 0; - - interrupt_data->eventfd_ctxs = - kcalloc(driver_desc->num_interrupts, - sizeof(*interrupt_data->eventfd_ctxs), GFP_KERNEL); - if (!interrupt_data->eventfd_ctxs) { - kfree(interrupt_data); - return -ENOMEM; - } - - interrupt_data->interrupt_counts = - kcalloc(driver_desc->num_interrupts, - sizeof(*interrupt_data->interrupt_counts), GFP_KERNEL); - if (!interrupt_data->interrupt_counts) { - kfree(interrupt_data->eventfd_ctxs); - kfree(interrupt_data); - return -ENOMEM; - } - - switch (interrupt_data->type) { - case PCI_MSIX: - ret = gasket_interrupt_msix_init(interrupt_data); - if (ret) - break; - force_msix_interrupt_unmasking(gasket_dev); - break; - - default: - ret = -EINVAL; - } - - if (ret) { - /* Failing to setup interrupts will cause the device to report - * GASKET_STATUS_LAMED. But it is not fatal. - */ - dev_warn(gasket_dev->dev, - "Couldn't initialize interrupts: %d\n", ret); - return 0; - } - - gasket_interrupt_setup(gasket_dev); - gasket_sysfs_create_entries(gasket_dev->dev_info.device, - interrupt_sysfs_attrs); - - return 0; -} - -static void -gasket_interrupt_msix_cleanup(struct gasket_interrupt_data *interrupt_data) -{ - int i; - - for (i = 0; i < interrupt_data->num_configured; i++) - free_irq(interrupt_data->msix_entries[i].vector, - interrupt_data); - interrupt_data->num_configured = 0; - - if (interrupt_data->msix_configured) - pci_disable_msix(interrupt_data->pci_dev); - interrupt_data->msix_configured = 0; - kfree(interrupt_data->msix_entries); -} - -int gasket_interrupt_reinit(struct gasket_dev *gasket_dev) -{ - int ret; - - if (!gasket_dev->interrupt_data) { - dev_dbg(gasket_dev->dev, - "Attempted to reinit uninitialized interrupt data\n"); - return -EINVAL; - } - - switch (gasket_dev->interrupt_data->type) { - case PCI_MSIX: - gasket_interrupt_msix_cleanup(gasket_dev->interrupt_data); - ret = gasket_interrupt_msix_init(gasket_dev->interrupt_data); - if (ret) - break; - force_msix_interrupt_unmasking(gasket_dev); - break; - - default: - ret = -EINVAL; - } - - if (ret) { - /* Failing to setup interrupts will cause the device - * to report GASKET_STATUS_LAMED, but is not fatal. - */ - dev_warn(gasket_dev->dev, "Couldn't reinit interrupts: %d\n", - ret); - return 0; - } - - gasket_interrupt_setup(gasket_dev); - - return 0; -} - -/* See gasket_interrupt.h for description. */ -int gasket_interrupt_reset_counts(struct gasket_dev *gasket_dev) -{ - dev_dbg(gasket_dev->dev, "Clearing interrupt counts\n"); - memset(gasket_dev->interrupt_data->interrupt_counts, 0, - gasket_dev->interrupt_data->num_interrupts * - sizeof(*gasket_dev->interrupt_data->interrupt_counts)); - return 0; -} - -/* See gasket_interrupt.h for description. */ -void gasket_interrupt_cleanup(struct gasket_dev *gasket_dev) -{ - struct gasket_interrupt_data *interrupt_data = - gasket_dev->interrupt_data; - /* - * It is possible to get an error code from gasket_interrupt_init - * before interrupt_data has been allocated, so check it. - */ - if (!interrupt_data) - return; - - switch (interrupt_data->type) { - case PCI_MSIX: - gasket_interrupt_msix_cleanup(interrupt_data); - break; - - default: - break; - } - - kfree(interrupt_data->interrupt_counts); - kfree(interrupt_data->eventfd_ctxs); - kfree(interrupt_data); - gasket_dev->interrupt_data = NULL; -} - -int gasket_interrupt_system_status(struct gasket_dev *gasket_dev) -{ - if (!gasket_dev->interrupt_data) { - dev_dbg(gasket_dev->dev, "Interrupt data is null\n"); - return GASKET_STATUS_DEAD; - } - - if (gasket_dev->interrupt_data->num_configured != - gasket_dev->interrupt_data->num_interrupts) { - dev_dbg(gasket_dev->dev, - "Not all interrupts were configured\n"); - return GASKET_STATUS_LAMED; - } - - return GASKET_STATUS_ALIVE; -} - -int gasket_interrupt_set_eventfd(struct gasket_interrupt_data *interrupt_data, - int interrupt, int event_fd) -{ - struct eventfd_ctx *ctx; - - if (interrupt < 0 || interrupt >= interrupt_data->num_interrupts) - return -EINVAL; - - ctx = eventfd_ctx_fdget(event_fd); - - if (IS_ERR(ctx)) - return PTR_ERR(ctx); - - interrupt_data->eventfd_ctxs[interrupt] = ctx; - return 0; -} - -int gasket_interrupt_clear_eventfd(struct gasket_interrupt_data *interrupt_data, - int interrupt) -{ - if (interrupt < 0 || interrupt >= interrupt_data->num_interrupts) - return -EINVAL; - - if (interrupt_data->eventfd_ctxs[interrupt]) { - eventfd_ctx_put(interrupt_data->eventfd_ctxs[interrupt]); - interrupt_data->eventfd_ctxs[interrupt] = NULL; - } - return 0; -} diff --git a/drivers/staging/gasket/gasket_interrupt.h b/drivers/staging/gasket/gasket_interrupt.h deleted file mode 100644 index 85526a1374a1..000000000000 --- a/drivers/staging/gasket/gasket_interrupt.h +++ /dev/null @@ -1,95 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Gasket common interrupt module. Defines functions for enabling - * eventfd-triggered interrupts between a Gasket device and a host process. - * - * Copyright (C) 2018 Google, Inc. - */ -#ifndef __GASKET_INTERRUPT_H__ -#define __GASKET_INTERRUPT_H__ - -#include -#include - -#include "gasket_core.h" - -/* Note that this currently assumes that device interrupts are a dense set, - * numbered from 0 - (num_interrupts - 1). Should this have to change, these - * APIs will have to be updated. - */ - -/* Opaque type used to hold interrupt subsystem data. */ -struct gasket_interrupt_data; - -/* - * Initialize the interrupt module. - * @gasket_dev: The Gasket device structure for the device to be initted. - */ -int gasket_interrupt_init(struct gasket_dev *gasket_dev); - -/* - * Clean up a device's interrupt structure. - * @gasket_dev: The Gasket information structure for this device. - * - * Cleans up the device's interrupts and deallocates data. - */ -void gasket_interrupt_cleanup(struct gasket_dev *gasket_dev); - -/* - * Clean up and re-initialize the MSI-x subsystem. - * @gasket_dev: The Gasket information structure for this device. - * - * Performs a teardown of the MSI-x subsystem and re-initializes it. Does not - * free the underlying data structures. Returns 0 on success and an error code - * on error. - */ -int gasket_interrupt_reinit(struct gasket_dev *gasket_dev); - -/* - * Reset the counts stored in the interrupt subsystem. - * @gasket_dev: The Gasket information structure for this device. - * - * Sets the counts of all interrupts in the subsystem to 0. - */ -int gasket_interrupt_reset_counts(struct gasket_dev *gasket_dev); - -/* - * Associates an eventfd with a device interrupt. - * @data: Pointer to device interrupt data. - * @interrupt: The device interrupt to configure. - * @event_fd: The eventfd to associate with the interrupt. - * - * Prepares the host to receive notification of device interrupts by associating - * event_fd with interrupt. Upon receipt of a device interrupt, event_fd will be - * signaled, after successful configuration. - * - * Returns 0 on success, a negative error code otherwise. - */ -int gasket_interrupt_set_eventfd(struct gasket_interrupt_data *interrupt_data, - int interrupt, int event_fd); - -/* - * Removes an interrupt-eventfd association. - * @data: Pointer to device interrupt data. - * @interrupt: The device interrupt to de-associate. - * - * Removes any eventfd associated with the specified interrupt, if any. - */ -int gasket_interrupt_clear_eventfd(struct gasket_interrupt_data *interrupt_data, - int interrupt); - -/* - * The below functions exist for backwards compatibility. - * No new uses should be written. - */ -/* - * Get the health of the interrupt subsystem. - * @gasket_dev: The Gasket device struct. - * - * Returns DEAD if not set up, LAMED if initialization failed, and ALIVE - * otherwise. - */ - -int gasket_interrupt_system_status(struct gasket_dev *gasket_dev); - -#endif diff --git a/drivers/staging/gasket/gasket_ioctl.c b/drivers/staging/gasket/gasket_ioctl.c deleted file mode 100644 index aa65f4fbf860..000000000000 --- a/drivers/staging/gasket/gasket_ioctl.c +++ /dev/null @@ -1,388 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* Copyright (C) 2018 Google, Inc. */ -#include "gasket.h" -#include "gasket_ioctl.h" -#include "gasket_constants.h" -#include "gasket_core.h" -#include "gasket_interrupt.h" -#include "gasket_page_table.h" -#include -#include -#include -#include - -#ifdef GASKET_KERNEL_TRACE_SUPPORT -#define CREATE_TRACE_POINTS -#include -#else -#define trace_gasket_ioctl_entry(x, ...) -#define trace_gasket_ioctl_exit(x) -#define trace_gasket_ioctl_integer_data(x) -#define trace_gasket_ioctl_eventfd_data(x, ...) -#define trace_gasket_ioctl_page_table_data(x, ...) -#define trace_gasket_ioctl_config_coherent_allocator(x, ...) -#endif - -/* Associate an eventfd with an interrupt. */ -static int gasket_set_event_fd(struct gasket_dev *gasket_dev, - struct gasket_interrupt_eventfd __user *argp) -{ - struct gasket_interrupt_eventfd die; - - if (copy_from_user(&die, argp, sizeof(struct gasket_interrupt_eventfd))) - return -EFAULT; - - trace_gasket_ioctl_eventfd_data(die.interrupt, die.event_fd); - - return gasket_interrupt_set_eventfd(gasket_dev->interrupt_data, - die.interrupt, die.event_fd); -} - -/* Read the size of the page table. */ -static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, - struct gasket_page_table_ioctl __user *argp) -{ - int ret = 0; - struct gasket_page_table_ioctl ibuf; - struct gasket_page_table *table; - - if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) - return -EFAULT; - - if (ibuf.page_table_index >= gasket_dev->num_page_tables) - return -EFAULT; - - table = gasket_dev->page_table[ibuf.page_table_index]; - ibuf.size = gasket_page_table_num_entries(table); - - trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, - ibuf.host_address, - ibuf.device_address); - - if (copy_to_user(argp, &ibuf, sizeof(ibuf))) - return -EFAULT; - - return ret; -} - -/* Read the size of the simple page table. */ -static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev, - struct gasket_page_table_ioctl __user *argp) -{ - int ret = 0; - struct gasket_page_table_ioctl ibuf; - struct gasket_page_table *table; - - if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) - return -EFAULT; - - if (ibuf.page_table_index >= gasket_dev->num_page_tables) - return -EFAULT; - - table = gasket_dev->page_table[ibuf.page_table_index]; - ibuf.size = gasket_page_table_num_simple_entries(table); - - trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, - ibuf.host_address, - ibuf.device_address); - - if (copy_to_user(argp, &ibuf, sizeof(ibuf))) - return -EFAULT; - - return ret; -} - -/* Set the boundary between the simple and extended page tables. */ -static int gasket_partition_page_table(struct gasket_dev *gasket_dev, - struct gasket_page_table_ioctl __user *argp) -{ - int ret; - struct gasket_page_table_ioctl ibuf; - uint max_page_table_size; - struct gasket_page_table *table; - - if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) - return -EFAULT; - - trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, - ibuf.host_address, - ibuf.device_address); - - if (ibuf.page_table_index >= gasket_dev->num_page_tables) - return -EFAULT; - table = gasket_dev->page_table[ibuf.page_table_index]; - max_page_table_size = gasket_page_table_max_size(table); - - if (ibuf.size > max_page_table_size) { - dev_dbg(gasket_dev->dev, - "Partition request 0x%llx too large, max is 0x%x\n", - ibuf.size, max_page_table_size); - return -EINVAL; - } - - mutex_lock(&gasket_dev->mutex); - - ret = gasket_page_table_partition(table, ibuf.size); - mutex_unlock(&gasket_dev->mutex); - - return ret; -} - -/* Map a userspace buffer to a device virtual address. */ -static int gasket_map_buffers(struct gasket_dev *gasket_dev, - struct gasket_page_table_ioctl __user *argp) -{ - struct gasket_page_table_ioctl ibuf; - struct gasket_page_table *table; - - if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) - return -EFAULT; - - trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, - ibuf.host_address, - ibuf.device_address); - - if (ibuf.page_table_index >= gasket_dev->num_page_tables) - return -EFAULT; - - table = gasket_dev->page_table[ibuf.page_table_index]; - if (gasket_page_table_are_addrs_bad(table, ibuf.host_address, - ibuf.device_address, ibuf.size)) - return -EINVAL; - - return gasket_page_table_map(table, ibuf.host_address, ibuf.device_address, - ibuf.size / PAGE_SIZE); -} - -/* Unmap a userspace buffer from a device virtual address. */ -static int gasket_unmap_buffers(struct gasket_dev *gasket_dev, - struct gasket_page_table_ioctl __user *argp) -{ - struct gasket_page_table_ioctl ibuf; - struct gasket_page_table *table; - - if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) - return -EFAULT; - - trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, - ibuf.host_address, - ibuf.device_address); - - if (ibuf.page_table_index >= gasket_dev->num_page_tables) - return -EFAULT; - - table = gasket_dev->page_table[ibuf.page_table_index]; - if (gasket_page_table_is_dev_addr_bad(table, ibuf.device_address, ibuf.size)) - return -EINVAL; - - gasket_page_table_unmap(table, ibuf.device_address, ibuf.size / PAGE_SIZE); - - return 0; -} - -/* - * Reserve structures for coherent allocation, and allocate or free the - * corresponding memory. - */ -static int gasket_config_coherent_allocator(struct gasket_dev *gasket_dev, - struct gasket_coherent_alloc_config_ioctl __user *argp) -{ - int ret; - struct gasket_coherent_alloc_config_ioctl ibuf; - - if (copy_from_user(&ibuf, argp, - sizeof(struct gasket_coherent_alloc_config_ioctl))) - return -EFAULT; - - trace_gasket_ioctl_config_coherent_allocator(ibuf.enable, ibuf.size, - ibuf.dma_address); - - if (ibuf.page_table_index >= gasket_dev->num_page_tables) - return -EFAULT; - - if (ibuf.size > PAGE_SIZE * MAX_NUM_COHERENT_PAGES) - return -ENOMEM; - - if (ibuf.enable == 0) { - ret = gasket_free_coherent_memory(gasket_dev, ibuf.size, - ibuf.dma_address, - ibuf.page_table_index); - } else { - ret = gasket_alloc_coherent_memory(gasket_dev, ibuf.size, - &ibuf.dma_address, - ibuf.page_table_index); - } - if (ret) - return ret; - if (copy_to_user(argp, &ibuf, sizeof(ibuf))) - return -EFAULT; - - return 0; -} - -/* Check permissions for Gasket ioctls. */ -static bool gasket_ioctl_check_permissions(struct file *filp, uint cmd) -{ - bool alive; - bool read, write; - struct gasket_dev *gasket_dev = (struct gasket_dev *)filp->private_data; - - alive = (gasket_dev->status == GASKET_STATUS_ALIVE); - if (!alive) - dev_dbg(gasket_dev->dev, "%s alive %d status %d\n", - __func__, alive, gasket_dev->status); - - read = !!(filp->f_mode & FMODE_READ); - write = !!(filp->f_mode & FMODE_WRITE); - - switch (cmd) { - case GASKET_IOCTL_RESET: - case GASKET_IOCTL_CLEAR_INTERRUPT_COUNTS: - return write; - - case GASKET_IOCTL_PAGE_TABLE_SIZE: - case GASKET_IOCTL_SIMPLE_PAGE_TABLE_SIZE: - case GASKET_IOCTL_NUMBER_PAGE_TABLES: - return read; - - case GASKET_IOCTL_PARTITION_PAGE_TABLE: - case GASKET_IOCTL_CONFIG_COHERENT_ALLOCATOR: - return alive && write; - - case GASKET_IOCTL_MAP_BUFFER: - case GASKET_IOCTL_UNMAP_BUFFER: - return alive && write; - - case GASKET_IOCTL_CLEAR_EVENTFD: - case GASKET_IOCTL_SET_EVENTFD: - return alive && write; - } - - return false; /* unknown permissions */ -} - -/* - * standard ioctl dispatch function. - * @filp: File structure pointer describing this node usage session. - * @cmd: ioctl number to handle. - * @argp: ioctl-specific data pointer. - * - * Standard ioctl dispatcher; forwards operations to individual handlers. - */ -long gasket_handle_ioctl(struct file *filp, uint cmd, void __user *argp) -{ - struct gasket_dev *gasket_dev; - unsigned long arg = (unsigned long)argp; - gasket_ioctl_permissions_cb_t ioctl_permissions_cb; - int retval; - - gasket_dev = (struct gasket_dev *)filp->private_data; - trace_gasket_ioctl_entry(gasket_dev->dev_info.name, cmd); - - ioctl_permissions_cb = gasket_get_ioctl_permissions_cb(gasket_dev); - if (ioctl_permissions_cb) { - retval = ioctl_permissions_cb(filp, cmd, argp); - if (retval < 0) { - trace_gasket_ioctl_exit(retval); - return retval; - } else if (retval == 0) { - trace_gasket_ioctl_exit(-EPERM); - return -EPERM; - } - } else if (!gasket_ioctl_check_permissions(filp, cmd)) { - trace_gasket_ioctl_exit(-EPERM); - dev_dbg(gasket_dev->dev, "ioctl cmd=%x noperm\n", cmd); - return -EPERM; - } - - /* Tracing happens in this switch statement for all ioctls with - * an integer argrument, but ioctls with a struct argument - * that needs copying and decoding, that tracing is done within - * the handler call. - */ - switch (cmd) { - case GASKET_IOCTL_RESET: - retval = gasket_reset(gasket_dev); - break; - case GASKET_IOCTL_SET_EVENTFD: - retval = gasket_set_event_fd(gasket_dev, argp); - break; - case GASKET_IOCTL_CLEAR_EVENTFD: - trace_gasket_ioctl_integer_data(arg); - retval = - gasket_interrupt_clear_eventfd(gasket_dev->interrupt_data, - (int)arg); - break; - case GASKET_IOCTL_PARTITION_PAGE_TABLE: - trace_gasket_ioctl_integer_data(arg); - retval = gasket_partition_page_table(gasket_dev, argp); - break; - case GASKET_IOCTL_NUMBER_PAGE_TABLES: - trace_gasket_ioctl_integer_data(gasket_dev->num_page_tables); - if (copy_to_user(argp, &gasket_dev->num_page_tables, - sizeof(uint64_t))) - retval = -EFAULT; - else - retval = 0; - break; - case GASKET_IOCTL_PAGE_TABLE_SIZE: - retval = gasket_read_page_table_size(gasket_dev, argp); - break; - case GASKET_IOCTL_SIMPLE_PAGE_TABLE_SIZE: - retval = gasket_read_simple_page_table_size(gasket_dev, argp); - break; - case GASKET_IOCTL_MAP_BUFFER: - retval = gasket_map_buffers(gasket_dev, argp); - break; - case GASKET_IOCTL_CONFIG_COHERENT_ALLOCATOR: - retval = gasket_config_coherent_allocator(gasket_dev, argp); - break; - case GASKET_IOCTL_UNMAP_BUFFER: - retval = gasket_unmap_buffers(gasket_dev, argp); - break; - case GASKET_IOCTL_CLEAR_INTERRUPT_COUNTS: - /* Clear interrupt counts doesn't take an arg, so use 0. */ - trace_gasket_ioctl_integer_data(0); - retval = gasket_interrupt_reset_counts(gasket_dev); - break; - default: - /* If we don't understand the ioctl, the best we can do is trace - * the arg. - */ - trace_gasket_ioctl_integer_data(arg); - dev_dbg(gasket_dev->dev, - "Unknown ioctl cmd=0x%x not caught by gasket_is_supported_ioctl\n", - cmd); - retval = -EINVAL; - break; - } - - trace_gasket_ioctl_exit(retval); - return retval; -} - -/* - * Determines if an ioctl is part of the standard Gasket framework. - * @cmd: The ioctl number to handle. - * - * Returns 1 if the ioctl is supported and 0 otherwise. - */ -long gasket_is_supported_ioctl(uint cmd) -{ - switch (cmd) { - case GASKET_IOCTL_RESET: - case GASKET_IOCTL_SET_EVENTFD: - case GASKET_IOCTL_CLEAR_EVENTFD: - case GASKET_IOCTL_PARTITION_PAGE_TABLE: - case GASKET_IOCTL_NUMBER_PAGE_TABLES: - case GASKET_IOCTL_PAGE_TABLE_SIZE: - case GASKET_IOCTL_SIMPLE_PAGE_TABLE_SIZE: - case GASKET_IOCTL_MAP_BUFFER: - case GASKET_IOCTL_UNMAP_BUFFER: - case GASKET_IOCTL_CLEAR_INTERRUPT_COUNTS: - case GASKET_IOCTL_CONFIG_COHERENT_ALLOCATOR: - return 1; - default: - return 0; - } -} diff --git a/drivers/staging/gasket/gasket_ioctl.h b/drivers/staging/gasket/gasket_ioctl.h deleted file mode 100644 index 51f468c77f04..000000000000 --- a/drivers/staging/gasket/gasket_ioctl.h +++ /dev/null @@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright (C) 2018 Google, Inc. */ -#ifndef __GASKET_IOCTL_H__ -#define __GASKET_IOCTL_H__ - -#include "gasket_core.h" - -#include - -/* - * Handle Gasket common ioctls. - * @filp: Pointer to the ioctl's file. - * @cmd: Ioctl command. - * @arg: Ioctl argument pointer. - * - * Returns 0 on success and nonzero on failure. - */ -long gasket_handle_ioctl(struct file *filp, uint cmd, void __user *argp); - -/* - * Determines if an ioctl is part of the standard Gasket framework. - * @cmd: The ioctl number to handle. - * - * Returns 1 if the ioctl is supported and 0 otherwise. - */ -long gasket_is_supported_ioctl(uint cmd); - -#endif diff --git a/drivers/staging/gasket/gasket_page_table.c b/drivers/staging/gasket/gasket_page_table.c deleted file mode 100644 index 2dbf3d9b8f34..000000000000 --- a/drivers/staging/gasket/gasket_page_table.c +++ /dev/null @@ -1,1357 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Implementation of Gasket page table support. - * - * Copyright (C) 2018 Google, Inc. - */ - -/* - * Implementation of Gasket page table support. - * - * This file assumes 4kB pages throughout; can be factored out when necessary. - * - * There is a configurable number of page table entries, as well as a - * configurable bit index for the extended address flag. Both of these are - * specified in gasket_page_table_init through the page_table_config parameter. - * - * The following example assumes: - * page_table_config->total_entries = 8192 - * page_table_config->extended_bit = 63 - * - * Address format: - * Simple addresses - those whose containing pages are directly placed in the - * device's address translation registers - are laid out as: - * [ 63 - 25: 0 | 24 - 12: page index | 11 - 0: page offset ] - * page index: The index of the containing page in the device's address - * translation registers. - * page offset: The index of the address into the containing page. - * - * Extended address - those whose containing pages are contained in a second- - * level page table whose address is present in the device's address translation - * registers - are laid out as: - * [ 63: flag | 62 - 34: 0 | 33 - 21: dev/level 0 index | - * 20 - 12: host/level 1 index | 11 - 0: page offset ] - * flag: Marker indicating that this is an extended address. Always 1. - * dev index: The index of the first-level page in the device's extended - * address translation registers. - * host index: The index of the containing page in the [host-resident] second- - * level page table. - * page offset: The index of the address into the containing [second-level] - * page. - */ -#include "gasket_page_table.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "gasket_constants.h" -#include "gasket_core.h" - -/* Constants & utility macros */ -/* The number of pages that can be mapped into each second-level page table. */ -#define GASKET_PAGES_PER_SUBTABLE 512 - -/* The starting position of the page index in a simple virtual address. */ -#define GASKET_SIMPLE_PAGE_SHIFT 12 - -/* Flag indicating that a [device] slot is valid for use. */ -#define GASKET_VALID_SLOT_FLAG 1 - -/* - * The starting position of the level 0 page index (i.e., the entry in the - * device's extended address registers) in an extended address. - * Also can be thought of as (log2(PAGE_SIZE) + log2(PAGES_PER_SUBTABLE)), - * or (12 + 9). - */ -#define GASKET_EXTENDED_LVL0_SHIFT 21 - -/* - * Number of first level pages that Gasket chips support. Equivalent to - * log2(NUM_LVL0_PAGE_TABLES) - * - * At a maximum, allowing for a 34 bits address space (or 16GB) - * = GASKET_EXTENDED_LVL0_WIDTH + (log2(PAGE_SIZE) + log2(PAGES_PER_SUBTABLE) - * or, = 13 + 9 + 12 - */ -#define GASKET_EXTENDED_LVL0_WIDTH 13 - -/* - * The starting position of the level 1 page index (i.e., the entry in the - * host second-level/sub- table) in an extended address. - */ -#define GASKET_EXTENDED_LVL1_SHIFT 12 - -/* Type declarations */ -/* Valid states for a struct gasket_page_table_entry. */ -enum pte_status { - PTE_FREE, - PTE_INUSE, -}; - -/* - * Mapping metadata for a single page. - * - * In this file, host-side page table entries are referred to as that (or PTEs). - * Where device vs. host entries are differentiated, device-side or -visible - * entries are called "slots". A slot may be either an entry in the device's - * address translation table registers or an entry in a second-level page - * table ("subtable"). - * - * The full data in this structure is visible on the host [of course]. Only - * the address contained in dma_addr is communicated to the device; that points - * to the actual page mapped and described by this structure. - */ -struct gasket_page_table_entry { - /* The status of this entry/slot: free or in use. */ - enum pte_status status; - - /* - * Index for alignment into host vaddrs. - * When a user specifies a host address for a mapping, that address may - * not be page-aligned. Offset is the index into the containing page of - * the host address (i.e., host_vaddr & (PAGE_SIZE - 1)). - * This is necessary for translating between user-specified addresses - * and page-aligned addresses. - */ - int offset; - - /* Address of the page in DMA space. */ - dma_addr_t dma_addr; - - /* Linux page descriptor for the page described by this structure. */ - struct page *page; - - /* - * If this is an extended and first-level entry, sublevel points - * to the second-level entries underneath this entry. - */ - struct gasket_page_table_entry *sublevel; -}; - -/* - * Maintains virtual to physical address mapping for a coherent page that is - * allocated by this module for a given device. - * Note that coherent pages mappings virt mapping cannot be tracked by the - * Linux kernel, and coherent pages don't have a struct page associated, - * hence Linux kernel cannot perform a get_user_page_xx() on a phys address - * that was allocated coherent. - * This structure trivially implements this mechanism. - */ -struct gasket_coherent_page_entry { - /* Phys address, dma'able by the owner device */ - dma_addr_t paddr; - - /* Kernel virtual address */ - u64 user_virt; - - /* User virtual address that was mapped by the mmap kernel subsystem */ - u64 kernel_virt; - - /* - * Whether this page has been mapped into a user land process virtual - * space - */ - u32 in_use; -}; - -/* - * [Host-side] page table descriptor. - * - * This structure tracks the metadata necessary to manage both simple and - * extended page tables. - */ -struct gasket_page_table { - /* The config used to create this page table. */ - struct gasket_page_table_config config; - - /* The number of simple (single-level) entries in the page table. */ - uint num_simple_entries; - - /* The number of extended (two-level) entries in the page table. */ - uint num_extended_entries; - - /* Array of [host-side] page table entries. */ - struct gasket_page_table_entry *entries; - - /* Number of actively mapped kernel pages in this table. */ - uint num_active_pages; - - /* Device register: base of/first slot in the page table. */ - u64 __iomem *base_slot; - - /* Device register: holds the offset indicating the start of the - * extended address region of the device's address translation table. - */ - u64 __iomem *extended_offset_reg; - - /* Device structure for the underlying device. Only used for logging. */ - struct device *device; - - /* PCI system descriptor for the underlying device. */ - struct pci_dev *pci_dev; - - /* Location of the extended address bit for this Gasket device. */ - u64 extended_flag; - - /* Mutex to protect page table internals. */ - struct mutex mutex; - - /* Number of coherent pages accessible thru by this page table */ - int num_coherent_pages; - - /* - * List of coherent memory (physical) allocated for a device. - * - * This structure also remembers the user virtual mapping, this is - * hacky, but we need to do this because the kernel doesn't keep track - * of the user coherent pages (pfn pages), and virt to coherent page - * mapping. - * TODO: use find_vma() APIs to convert host address to vm_area, to - * dma_addr_t instead of storing user virtu address in - * gasket_coherent_page_entry - * - * Note that the user virtual mapping is created by the driver, in - * gasket_mmap function, so user_virt belongs in the driver anyhow. - */ - struct gasket_coherent_page_entry *coherent_pages; -}; - -/* See gasket_page_table.h for description. */ -int gasket_page_table_init(struct gasket_page_table **ppg_tbl, - const struct gasket_bar_data *bar_data, - const struct gasket_page_table_config *page_table_config, - struct device *device, struct pci_dev *pci_dev) -{ - ulong bytes; - struct gasket_page_table *pg_tbl; - ulong total_entries = page_table_config->total_entries; - - /* - * TODO: Verify config->total_entries against value read from the - * hardware register that contains the page table size. - */ - if (total_entries == ULONG_MAX) { - dev_dbg(device, - "Error reading page table size. Initializing page table with size 0\n"); - total_entries = 0; - } - - dev_dbg(device, - "Attempting to initialize page table of size 0x%lx\n", - total_entries); - - dev_dbg(device, - "Table has base reg 0x%x, extended offset reg 0x%x\n", - page_table_config->base_reg, - page_table_config->extended_reg); - - *ppg_tbl = kzalloc(sizeof(**ppg_tbl), GFP_KERNEL); - if (!*ppg_tbl) { - dev_dbg(device, "No memory for page table\n"); - return -ENOMEM; - } - - pg_tbl = *ppg_tbl; - bytes = total_entries * sizeof(struct gasket_page_table_entry); - if (bytes != 0) { - pg_tbl->entries = vzalloc(bytes); - if (!pg_tbl->entries) { - kfree(pg_tbl); - *ppg_tbl = NULL; - return -ENOMEM; - } - } - - mutex_init(&pg_tbl->mutex); - memcpy(&pg_tbl->config, page_table_config, sizeof(*page_table_config)); - if (pg_tbl->config.mode == GASKET_PAGE_TABLE_MODE_NORMAL || - pg_tbl->config.mode == GASKET_PAGE_TABLE_MODE_SIMPLE) { - pg_tbl->num_simple_entries = total_entries; - pg_tbl->num_extended_entries = 0; - pg_tbl->extended_flag = 1ull << page_table_config->extended_bit; - } else { - pg_tbl->num_simple_entries = 0; - pg_tbl->num_extended_entries = total_entries; - pg_tbl->extended_flag = 0; - } - pg_tbl->num_active_pages = 0; - pg_tbl->base_slot = - (u64 __iomem *)&bar_data->virt_base[page_table_config->base_reg]; - pg_tbl->extended_offset_reg = - (u64 __iomem *)&bar_data->virt_base[page_table_config->extended_reg]; - pg_tbl->device = get_device(device); - pg_tbl->pci_dev = pci_dev; - - dev_dbg(device, "Page table initialized successfully\n"); - - return 0; -} - -/* - * Check if a range of PTEs is free. - * The page table mutex must be held by the caller. - */ -static bool gasket_is_pte_range_free(struct gasket_page_table_entry *ptes, - uint num_entries) -{ - int i; - - for (i = 0; i < num_entries; i++) { - if (ptes[i].status != PTE_FREE) - return false; - } - - return true; -} - -/* - * Free a second level page [sub]table. - * The page table mutex must be held before this call. - */ -static void gasket_free_extended_subtable(struct gasket_page_table *pg_tbl, - struct gasket_page_table_entry *pte, - u64 __iomem *slot) -{ - /* Release the page table from the driver */ - pte->status = PTE_FREE; - - /* Release the page table from the device */ - writeq(0, slot); - - if (pte->dma_addr) - dma_unmap_page(pg_tbl->device, pte->dma_addr, PAGE_SIZE, - DMA_TO_DEVICE); - - vfree(pte->sublevel); - - if (pte->page) - free_page((ulong)page_address(pte->page)); - - memset(pte, 0, sizeof(struct gasket_page_table_entry)); -} - -/* - * Actually perform collection. - * The page table mutex must be held by the caller. - */ -static void -gasket_page_table_garbage_collect_nolock(struct gasket_page_table *pg_tbl) -{ - struct gasket_page_table_entry *pte; - u64 __iomem *slot; - - /* XXX FIX ME XXX -- more efficient to keep a usage count */ - /* rather than scanning the second level page tables */ - - for (pte = pg_tbl->entries + pg_tbl->num_simple_entries, - slot = pg_tbl->base_slot + pg_tbl->num_simple_entries; - pte < pg_tbl->entries + pg_tbl->config.total_entries; - pte++, slot++) { - if (pte->status == PTE_INUSE) { - if (gasket_is_pte_range_free(pte->sublevel, - GASKET_PAGES_PER_SUBTABLE)) - gasket_free_extended_subtable(pg_tbl, pte, - slot); - } - } -} - -/* See gasket_page_table.h for description. */ -void gasket_page_table_garbage_collect(struct gasket_page_table *pg_tbl) -{ - mutex_lock(&pg_tbl->mutex); - gasket_page_table_garbage_collect_nolock(pg_tbl); - mutex_unlock(&pg_tbl->mutex); -} - -/* See gasket_page_table.h for description. */ -void gasket_page_table_cleanup(struct gasket_page_table *pg_tbl) -{ - /* Deallocate free second-level tables. */ - gasket_page_table_garbage_collect(pg_tbl); - - /* TODO: Check that all PTEs have been freed? */ - - vfree(pg_tbl->entries); - pg_tbl->entries = NULL; - - put_device(pg_tbl->device); - kfree(pg_tbl); -} - -/* See gasket_page_table.h for description. */ -int gasket_page_table_partition(struct gasket_page_table *pg_tbl, - uint num_simple_entries) -{ - int i, start; - - mutex_lock(&pg_tbl->mutex); - if (num_simple_entries > pg_tbl->config.total_entries) { - mutex_unlock(&pg_tbl->mutex); - return -EINVAL; - } - - gasket_page_table_garbage_collect_nolock(pg_tbl); - - start = min(pg_tbl->num_simple_entries, num_simple_entries); - - for (i = start; i < pg_tbl->config.total_entries; i++) { - if (pg_tbl->entries[i].status != PTE_FREE) { - dev_err(pg_tbl->device, "entry %d is not free\n", i); - mutex_unlock(&pg_tbl->mutex); - return -EBUSY; - } - } - - pg_tbl->num_simple_entries = num_simple_entries; - pg_tbl->num_extended_entries = - pg_tbl->config.total_entries - num_simple_entries; - writeq(num_simple_entries, pg_tbl->extended_offset_reg); - - mutex_unlock(&pg_tbl->mutex); - return 0; -} -EXPORT_SYMBOL(gasket_page_table_partition); - -/* - * Return whether a host buffer was mapped as coherent memory. - * - * A Gasket page_table currently support one contiguous dma range, mapped to one - * contiguous virtual memory range. Check if the host_addr is within that range. - */ -static int is_coherent(struct gasket_page_table *pg_tbl, ulong host_addr) -{ - u64 min, max; - - /* whether the host address is within user virt range */ - if (!pg_tbl->coherent_pages) - return 0; - - min = (u64)pg_tbl->coherent_pages[0].user_virt; - max = min + PAGE_SIZE * pg_tbl->num_coherent_pages; - - return min <= host_addr && host_addr < max; -} - -/* Safely return a page to the OS. */ -static bool gasket_release_page(struct page *page) -{ - if (!page) - return false; - - if (!PageReserved(page)) - SetPageDirty(page); - unpin_user_page(page); - - return true; -} - -/* - * Get and map last level page table buffers. - * - * slots is the location(s) to write device-mapped page address. If this is a - * simple mapping, these will be address translation registers. If this is - * an extended mapping, these will be within a second-level page table - * allocated by the host and so must have their __iomem attribute casted away. - */ -static int gasket_perform_mapping(struct gasket_page_table *pg_tbl, - struct gasket_page_table_entry *ptes, - u64 __iomem *slots, ulong host_addr, - uint num_pages, int is_simple_mapping) -{ - int ret; - ulong offset; - struct page *page; - dma_addr_t dma_addr; - ulong page_addr; - int i; - - for (i = 0; i < num_pages; i++) { - page_addr = host_addr + i * PAGE_SIZE; - offset = page_addr & (PAGE_SIZE - 1); - if (is_coherent(pg_tbl, host_addr)) { - u64 off = - (u64)host_addr - - (u64)pg_tbl->coherent_pages[0].user_virt; - ptes[i].page = NULL; - ptes[i].offset = offset; - ptes[i].dma_addr = pg_tbl->coherent_pages[0].paddr + - off + i * PAGE_SIZE; - } else { - ret = pin_user_pages_fast(page_addr - offset, 1, - FOLL_WRITE, &page); - - if (ret <= 0) { - dev_err(pg_tbl->device, - "pin user pages failed for addr=0x%lx, offset=0x%lx [ret=%d]\n", - page_addr, offset, ret); - return ret ? ret : -ENOMEM; - } - ++pg_tbl->num_active_pages; - - ptes[i].page = page; - ptes[i].offset = offset; - - /* Map the page into DMA space. */ - ptes[i].dma_addr = - dma_map_page(pg_tbl->device, page, 0, PAGE_SIZE, - DMA_BIDIRECTIONAL); - - if (dma_mapping_error(pg_tbl->device, - ptes[i].dma_addr)) { - if (gasket_release_page(ptes[i].page)) - --pg_tbl->num_active_pages; - - memset(&ptes[i], 0, - sizeof(struct gasket_page_table_entry)); - return -EINVAL; - } - } - - /* Make the DMA-space address available to the device. */ - dma_addr = (ptes[i].dma_addr + offset) | GASKET_VALID_SLOT_FLAG; - - if (is_simple_mapping) { - writeq(dma_addr, &slots[i]); - } else { - ((u64 __force *)slots)[i] = dma_addr; - /* Extended page table vectors are in DRAM, - * and so need to be synced each time they are updated. - */ - dma_map_single(pg_tbl->device, - (void *)&((u64 __force *)slots)[i], - sizeof(u64), DMA_TO_DEVICE); - } - ptes[i].status = PTE_INUSE; - } - return 0; -} - -/* - * Return the index of the page for the address in the simple table. - * Does not perform validity checking. - */ -static int gasket_simple_page_idx(struct gasket_page_table *pg_tbl, - ulong dev_addr) -{ - return (dev_addr >> GASKET_SIMPLE_PAGE_SHIFT) & - (pg_tbl->config.total_entries - 1); -} - -/* - * Return the level 0 page index for the given address. - * Does not perform validity checking. - */ -static ulong gasket_extended_lvl0_page_idx(struct gasket_page_table *pg_tbl, - ulong dev_addr) -{ - return (dev_addr >> GASKET_EXTENDED_LVL0_SHIFT) & - (pg_tbl->config.total_entries - 1); -} - -/* - * Return the level 1 page index for the given address. - * Does not perform validity checking. - */ -static ulong gasket_extended_lvl1_page_idx(struct gasket_page_table *pg_tbl, - ulong dev_addr) -{ - return (dev_addr >> GASKET_EXTENDED_LVL1_SHIFT) & - (GASKET_PAGES_PER_SUBTABLE - 1); -} - -/* - * Allocate page table entries in a simple table. - * The page table mutex must be held by the caller. - */ -static int gasket_alloc_simple_entries(struct gasket_page_table *pg_tbl, - ulong dev_addr, uint num_pages) -{ - if (!gasket_is_pte_range_free(pg_tbl->entries + - gasket_simple_page_idx(pg_tbl, dev_addr), - num_pages)) - return -EBUSY; - - return 0; -} - -/* - * Unmap and release mapped pages. - * The page table mutex must be held by the caller. - */ -static void gasket_perform_unmapping(struct gasket_page_table *pg_tbl, - struct gasket_page_table_entry *ptes, - u64 __iomem *slots, uint num_pages, - int is_simple_mapping) -{ - int i; - /* - * For each page table entry and corresponding entry in the device's - * address translation table: - */ - for (i = 0; i < num_pages; i++) { - /* release the address from the device, */ - if (is_simple_mapping || ptes[i].status == PTE_INUSE) { - writeq(0, &slots[i]); - } else { - ((u64 __force *)slots)[i] = 0; - /* sync above PTE update before updating mappings */ - wmb(); - } - - /* release the address from the driver, */ - if (ptes[i].status == PTE_INUSE) { - if (ptes[i].page && ptes[i].dma_addr) { - dma_unmap_page(pg_tbl->device, ptes[i].dma_addr, - PAGE_SIZE, DMA_BIDIRECTIONAL); - } - if (gasket_release_page(ptes[i].page)) - --pg_tbl->num_active_pages; - } - - /* and clear the PTE. */ - memset(&ptes[i], 0, sizeof(struct gasket_page_table_entry)); - } -} - -/* - * Unmap and release pages mapped to simple addresses. - * The page table mutex must be held by the caller. - */ -static void gasket_unmap_simple_pages(struct gasket_page_table *pg_tbl, - ulong dev_addr, uint num_pages) -{ - uint slot = gasket_simple_page_idx(pg_tbl, dev_addr); - - gasket_perform_unmapping(pg_tbl, pg_tbl->entries + slot, - pg_tbl->base_slot + slot, num_pages, 1); -} - -/* - * Unmap and release buffers to extended addresses. - * The page table mutex must be held by the caller. - */ -static void gasket_unmap_extended_pages(struct gasket_page_table *pg_tbl, - ulong dev_addr, uint num_pages) -{ - uint slot_idx, remain, len; - struct gasket_page_table_entry *pte; - u64 __iomem *slot_base; - - remain = num_pages; - slot_idx = gasket_extended_lvl1_page_idx(pg_tbl, dev_addr); - pte = pg_tbl->entries + pg_tbl->num_simple_entries + - gasket_extended_lvl0_page_idx(pg_tbl, dev_addr); - - while (remain > 0) { - /* TODO: Add check to ensure pte remains valid? */ - len = min(remain, GASKET_PAGES_PER_SUBTABLE - slot_idx); - - if (pte->status == PTE_INUSE) { - slot_base = (u64 __iomem *)(page_address(pte->page) + - pte->offset); - gasket_perform_unmapping(pg_tbl, - pte->sublevel + slot_idx, - slot_base + slot_idx, len, 0); - } - - remain -= len; - slot_idx = 0; - pte++; - } -} - -/* Evaluates to nonzero if the specified virtual address is simple. */ -static inline bool gasket_addr_is_simple(struct gasket_page_table *pg_tbl, - ulong addr) -{ - return !((addr) & (pg_tbl)->extended_flag); -} - -/* - * Convert (simple, page, offset) into a device address. - * Examples: - * Simple page 0, offset 32: - * Input (1, 0, 32), Output 0x20 - * Simple page 1000, offset 511: - * Input (1, 1000, 511), Output 0x3E81FF - * Extended page 0, offset 32: - * Input (0, 0, 32), Output 0x8000000020 - * Extended page 1000, offset 511: - * Input (0, 1000, 511), Output 0x8003E81FF - */ -static ulong gasket_components_to_dev_address(struct gasket_page_table *pg_tbl, - int is_simple, uint page_index, - uint offset) -{ - ulong dev_addr = (page_index << GASKET_SIMPLE_PAGE_SHIFT) | offset; - - return is_simple ? dev_addr : (pg_tbl->extended_flag | dev_addr); -} - -/* - * Validity checking for simple addresses. - * - * Verify that address translation commutes (from address to/from page + offset) - * and that the requested page range starts and ends within the set of - * currently-partitioned simple pages. - */ -static bool gasket_is_simple_dev_addr_bad(struct gasket_page_table *pg_tbl, - ulong dev_addr, uint num_pages) -{ - ulong page_offset = dev_addr & (PAGE_SIZE - 1); - ulong page_index = - (dev_addr / PAGE_SIZE) & (pg_tbl->config.total_entries - 1); - - if (gasket_components_to_dev_address(pg_tbl, 1, page_index, - page_offset) != dev_addr) { - dev_err(pg_tbl->device, "address is invalid, 0x%lX\n", - dev_addr); - return true; - } - - if (page_index >= pg_tbl->num_simple_entries) { - dev_err(pg_tbl->device, - "starting slot at %lu is too large, max is < %u\n", - page_index, pg_tbl->num_simple_entries); - return true; - } - - if (page_index + num_pages > pg_tbl->num_simple_entries) { - dev_err(pg_tbl->device, - "ending slot at %lu is too large, max is <= %u\n", - page_index + num_pages, pg_tbl->num_simple_entries); - return true; - } - - return false; -} - -/* - * Validity checking for extended addresses. - * - * Verify that address translation commutes (from address to/from page + - * offset) and that the requested page range starts and ends within the set of - * currently-partitioned extended pages. - */ -static bool gasket_is_extended_dev_addr_bad(struct gasket_page_table *pg_tbl, - ulong dev_addr, uint num_pages) -{ - /* Starting byte index of dev_addr into the first mapped page */ - ulong page_offset = dev_addr & (PAGE_SIZE - 1); - ulong page_global_idx, page_lvl0_idx; - ulong num_lvl0_pages; - ulong addr; - - /* check if the device address is out of bound */ - addr = dev_addr & ~((pg_tbl)->extended_flag); - if (addr >> (GASKET_EXTENDED_LVL0_WIDTH + GASKET_EXTENDED_LVL0_SHIFT)) { - dev_err(pg_tbl->device, "device address out of bounds: 0x%lx\n", - dev_addr); - return true; - } - - /* Find the starting sub-page index in the space of all sub-pages. */ - page_global_idx = (dev_addr / PAGE_SIZE) & - (pg_tbl->config.total_entries * GASKET_PAGES_PER_SUBTABLE - 1); - - /* Find the starting level 0 index. */ - page_lvl0_idx = gasket_extended_lvl0_page_idx(pg_tbl, dev_addr); - - /* Get the count of affected level 0 pages. */ - num_lvl0_pages = DIV_ROUND_UP(num_pages, GASKET_PAGES_PER_SUBTABLE); - - if (gasket_components_to_dev_address(pg_tbl, 0, page_global_idx, - page_offset) != dev_addr) { - dev_err(pg_tbl->device, "address is invalid: 0x%lx\n", - dev_addr); - return true; - } - - if (page_lvl0_idx >= pg_tbl->num_extended_entries) { - dev_err(pg_tbl->device, - "starting level 0 slot at %lu is too large, max is < %u\n", - page_lvl0_idx, pg_tbl->num_extended_entries); - return true; - } - - if (page_lvl0_idx + num_lvl0_pages > pg_tbl->num_extended_entries) { - dev_err(pg_tbl->device, - "ending level 0 slot at %lu is too large, max is <= %u\n", - page_lvl0_idx + num_lvl0_pages, - pg_tbl->num_extended_entries); - return true; - } - - return false; -} - -/* - * Non-locking entry to unmapping routines. - * The page table mutex must be held by the caller. - */ -static void gasket_page_table_unmap_nolock(struct gasket_page_table *pg_tbl, - ulong dev_addr, uint num_pages) -{ - if (!num_pages) - return; - - if (gasket_addr_is_simple(pg_tbl, dev_addr)) - gasket_unmap_simple_pages(pg_tbl, dev_addr, num_pages); - else - gasket_unmap_extended_pages(pg_tbl, dev_addr, num_pages); -} - -/* - * Allocate and map pages to simple addresses. - * If there is an error, no pages are mapped. - */ -static int gasket_map_simple_pages(struct gasket_page_table *pg_tbl, - ulong host_addr, ulong dev_addr, - uint num_pages) -{ - int ret; - uint slot_idx = gasket_simple_page_idx(pg_tbl, dev_addr); - - ret = gasket_alloc_simple_entries(pg_tbl, dev_addr, num_pages); - if (ret) { - dev_err(pg_tbl->device, - "page table slots %u (@ 0x%lx) to %u are not available\n", - slot_idx, dev_addr, slot_idx + num_pages - 1); - return ret; - } - - ret = gasket_perform_mapping(pg_tbl, pg_tbl->entries + slot_idx, - pg_tbl->base_slot + slot_idx, host_addr, - num_pages, 1); - - if (ret) { - gasket_page_table_unmap_nolock(pg_tbl, dev_addr, num_pages); - dev_err(pg_tbl->device, "gasket_perform_mapping %d\n", ret); - } - return ret; -} - -/* - * Allocate a second level page table. - * The page table mutex must be held by the caller. - */ -static int gasket_alloc_extended_subtable(struct gasket_page_table *pg_tbl, - struct gasket_page_table_entry *pte, - u64 __iomem *slot) -{ - ulong page_addr, subtable_bytes; - dma_addr_t dma_addr; - - /* XXX FIX ME XXX this is inefficient for non-4K page sizes */ - - /* GFP_DMA flag must be passed to architectures for which - * part of the memory range is not considered DMA'able. - * This seems to be the case for Juno board with 4.5.0 Linaro kernel - */ - page_addr = get_zeroed_page(GFP_KERNEL | GFP_DMA); - if (!page_addr) - return -ENOMEM; - pte->page = virt_to_page((void *)page_addr); - pte->offset = 0; - - subtable_bytes = sizeof(struct gasket_page_table_entry) * - GASKET_PAGES_PER_SUBTABLE; - pte->sublevel = vzalloc(subtable_bytes); - if (!pte->sublevel) { - free_page(page_addr); - memset(pte, 0, sizeof(struct gasket_page_table_entry)); - return -ENOMEM; - } - - /* Map the page into DMA space. */ - pte->dma_addr = dma_map_page(pg_tbl->device, pte->page, 0, PAGE_SIZE, - DMA_TO_DEVICE); - if (dma_mapping_error(pg_tbl->device, pte->dma_addr)) { - free_page(page_addr); - vfree(pte->sublevel); - memset(pte, 0, sizeof(struct gasket_page_table_entry)); - return -ENOMEM; - } - - /* make the addresses available to the device */ - dma_addr = (pte->dma_addr + pte->offset) | GASKET_VALID_SLOT_FLAG; - writeq(dma_addr, slot); - - pte->status = PTE_INUSE; - - return 0; -} - -/* - * Allocate slots in an extended page table. Check to see if a range of page - * table slots are available. If necessary, memory is allocated for second level - * page tables. - * - * Note that memory for second level page tables is allocated as needed, but - * that memory is only freed on the final close of the device file, when the - * page tables are repartitioned, or the device is removed. If there is an - * error or if the full range of slots is not available, any memory - * allocated for second level page tables remains allocated until final close, - * repartition, or device removal. - * - * The page table mutex must be held by the caller. - */ -static int gasket_alloc_extended_entries(struct gasket_page_table *pg_tbl, - ulong dev_addr, uint num_entries) -{ - int ret = 0; - uint remain, subtable_slot_idx, len; - struct gasket_page_table_entry *pte; - u64 __iomem *slot; - - remain = num_entries; - subtable_slot_idx = gasket_extended_lvl1_page_idx(pg_tbl, dev_addr); - pte = pg_tbl->entries + pg_tbl->num_simple_entries + - gasket_extended_lvl0_page_idx(pg_tbl, dev_addr); - slot = pg_tbl->base_slot + pg_tbl->num_simple_entries + - gasket_extended_lvl0_page_idx(pg_tbl, dev_addr); - - while (remain > 0) { - len = min(remain, - GASKET_PAGES_PER_SUBTABLE - subtable_slot_idx); - - if (pte->status == PTE_FREE) { - ret = gasket_alloc_extended_subtable(pg_tbl, pte, slot); - if (ret) { - dev_err(pg_tbl->device, - "no memory for extended addr subtable\n"); - return ret; - } - } else { - if (!gasket_is_pte_range_free(pte->sublevel + - subtable_slot_idx, len)) - return -EBUSY; - } - - remain -= len; - subtable_slot_idx = 0; - pte++; - slot++; - } - - return 0; -} - -/* - * gasket_map_extended_pages - Get and map buffers to extended addresses. - * If there is an error, no pages are mapped. - */ -static int gasket_map_extended_pages(struct gasket_page_table *pg_tbl, - ulong host_addr, ulong dev_addr, - uint num_pages) -{ - int ret; - ulong dev_addr_end; - uint slot_idx, remain, len; - struct gasket_page_table_entry *pte; - u64 __iomem *slot_base; - - ret = gasket_alloc_extended_entries(pg_tbl, dev_addr, num_pages); - if (ret) { - dev_addr_end = dev_addr + (num_pages / PAGE_SIZE) - 1; - dev_err(pg_tbl->device, - "page table slots (%lu,%lu) (@ 0x%lx) to (%lu,%lu) are not available\n", - gasket_extended_lvl0_page_idx(pg_tbl, dev_addr), - dev_addr, - gasket_extended_lvl1_page_idx(pg_tbl, dev_addr), - gasket_extended_lvl0_page_idx(pg_tbl, dev_addr_end), - gasket_extended_lvl1_page_idx(pg_tbl, dev_addr_end)); - return ret; - } - - remain = num_pages; - slot_idx = gasket_extended_lvl1_page_idx(pg_tbl, dev_addr); - pte = pg_tbl->entries + pg_tbl->num_simple_entries + - gasket_extended_lvl0_page_idx(pg_tbl, dev_addr); - - while (remain > 0) { - len = min(remain, GASKET_PAGES_PER_SUBTABLE - slot_idx); - - slot_base = - (u64 __iomem *)(page_address(pte->page) + pte->offset); - ret = gasket_perform_mapping(pg_tbl, pte->sublevel + slot_idx, - slot_base + slot_idx, host_addr, - len, 0); - if (ret) { - gasket_page_table_unmap_nolock(pg_tbl, dev_addr, - num_pages); - return ret; - } - - remain -= len; - slot_idx = 0; - pte++; - host_addr += len * PAGE_SIZE; - } - - return 0; -} - -/* - * See gasket_page_table.h for general description. - * - * gasket_page_table_map calls either gasket_map_simple_pages() or - * gasket_map_extended_pages() to actually perform the mapping. - * - * The page table mutex is held for the entire operation. - */ -int gasket_page_table_map(struct gasket_page_table *pg_tbl, ulong host_addr, - ulong dev_addr, uint num_pages) -{ - int ret; - - if (!num_pages) - return 0; - - mutex_lock(&pg_tbl->mutex); - - if (gasket_addr_is_simple(pg_tbl, dev_addr)) { - ret = gasket_map_simple_pages(pg_tbl, host_addr, dev_addr, - num_pages); - } else { - ret = gasket_map_extended_pages(pg_tbl, host_addr, dev_addr, - num_pages); - } - - mutex_unlock(&pg_tbl->mutex); - return ret; -} -EXPORT_SYMBOL(gasket_page_table_map); - -/* - * See gasket_page_table.h for general description. - * - * gasket_page_table_unmap takes the page table lock and calls either - * gasket_unmap_simple_pages() or gasket_unmap_extended_pages() to - * actually unmap the pages from device space. - * - * The page table mutex is held for the entire operation. - */ -void gasket_page_table_unmap(struct gasket_page_table *pg_tbl, ulong dev_addr, - uint num_pages) -{ - if (!num_pages) - return; - - mutex_lock(&pg_tbl->mutex); - gasket_page_table_unmap_nolock(pg_tbl, dev_addr, num_pages); - mutex_unlock(&pg_tbl->mutex); -} -EXPORT_SYMBOL(gasket_page_table_unmap); - -static void gasket_page_table_unmap_all_nolock(struct gasket_page_table *pg_tbl) -{ - gasket_unmap_simple_pages(pg_tbl, - gasket_components_to_dev_address(pg_tbl, 1, 0, - 0), - pg_tbl->num_simple_entries); - gasket_unmap_extended_pages(pg_tbl, - gasket_components_to_dev_address(pg_tbl, 0, - 0, 0), - pg_tbl->num_extended_entries * - GASKET_PAGES_PER_SUBTABLE); -} - -/* See gasket_page_table.h for description. */ -void gasket_page_table_unmap_all(struct gasket_page_table *pg_tbl) -{ - mutex_lock(&pg_tbl->mutex); - gasket_page_table_unmap_all_nolock(pg_tbl); - mutex_unlock(&pg_tbl->mutex); -} -EXPORT_SYMBOL(gasket_page_table_unmap_all); - -/* See gasket_page_table.h for description. */ -void gasket_page_table_reset(struct gasket_page_table *pg_tbl) -{ - mutex_lock(&pg_tbl->mutex); - gasket_page_table_unmap_all_nolock(pg_tbl); - writeq(pg_tbl->config.total_entries, pg_tbl->extended_offset_reg); - mutex_unlock(&pg_tbl->mutex); -} - -/* See gasket_page_table.h for description. */ -int gasket_page_table_lookup_page(struct gasket_page_table *pg_tbl, - ulong dev_addr, struct page **ppage, - ulong *poffset) -{ - uint page_num; - struct gasket_page_table_entry *pte; - - mutex_lock(&pg_tbl->mutex); - if (gasket_addr_is_simple(pg_tbl, dev_addr)) { - page_num = gasket_simple_page_idx(pg_tbl, dev_addr); - if (page_num >= pg_tbl->num_simple_entries) - goto fail; - - pte = pg_tbl->entries + page_num; - if (pte->status != PTE_INUSE) - goto fail; - } else { - /* Find the level 0 entry, */ - page_num = gasket_extended_lvl0_page_idx(pg_tbl, dev_addr); - if (page_num >= pg_tbl->num_extended_entries) - goto fail; - - pte = pg_tbl->entries + pg_tbl->num_simple_entries + page_num; - if (pte->status != PTE_INUSE) - goto fail; - - /* and its contained level 1 entry. */ - page_num = gasket_extended_lvl1_page_idx(pg_tbl, dev_addr); - pte = pte->sublevel + page_num; - if (pte->status != PTE_INUSE) - goto fail; - } - - *ppage = pte->page; - *poffset = pte->offset; - mutex_unlock(&pg_tbl->mutex); - return 0; - -fail: - *ppage = NULL; - *poffset = 0; - mutex_unlock(&pg_tbl->mutex); - return -EINVAL; -} - -/* See gasket_page_table.h for description. */ -bool gasket_page_table_are_addrs_bad(struct gasket_page_table *pg_tbl, - ulong host_addr, ulong dev_addr, - ulong bytes) -{ - if (host_addr & (PAGE_SIZE - 1)) { - dev_err(pg_tbl->device, - "host mapping address 0x%lx must be page aligned\n", - host_addr); - return true; - } - - return gasket_page_table_is_dev_addr_bad(pg_tbl, dev_addr, bytes); -} -EXPORT_SYMBOL(gasket_page_table_are_addrs_bad); - -/* See gasket_page_table.h for description. */ -bool gasket_page_table_is_dev_addr_bad(struct gasket_page_table *pg_tbl, - ulong dev_addr, ulong bytes) -{ - uint num_pages = bytes / PAGE_SIZE; - - if (bytes & (PAGE_SIZE - 1)) { - dev_err(pg_tbl->device, - "mapping size 0x%lX must be page aligned\n", bytes); - return true; - } - - if (num_pages == 0) { - dev_err(pg_tbl->device, - "requested mapping is less than one page: %lu / %lu\n", - bytes, PAGE_SIZE); - return true; - } - - if (gasket_addr_is_simple(pg_tbl, dev_addr)) - return gasket_is_simple_dev_addr_bad(pg_tbl, dev_addr, - num_pages); - return gasket_is_extended_dev_addr_bad(pg_tbl, dev_addr, num_pages); -} -EXPORT_SYMBOL(gasket_page_table_is_dev_addr_bad); - -/* See gasket_page_table.h for description. */ -uint gasket_page_table_max_size(struct gasket_page_table *page_table) -{ - if (!page_table) - return 0; - return page_table->config.total_entries; -} -EXPORT_SYMBOL(gasket_page_table_max_size); - -/* See gasket_page_table.h for description. */ -uint gasket_page_table_num_entries(struct gasket_page_table *pg_tbl) -{ - if (!pg_tbl) - return 0; - return pg_tbl->num_simple_entries + pg_tbl->num_extended_entries; -} -EXPORT_SYMBOL(gasket_page_table_num_entries); - -/* See gasket_page_table.h for description. */ -uint gasket_page_table_num_simple_entries(struct gasket_page_table *pg_tbl) -{ - if (!pg_tbl) - return 0; - return pg_tbl->num_simple_entries; -} -EXPORT_SYMBOL(gasket_page_table_num_simple_entries); - -/* See gasket_page_table.h for description. */ -uint gasket_page_table_num_active_pages(struct gasket_page_table *pg_tbl) -{ - if (!pg_tbl) - return 0; - return pg_tbl->num_active_pages; -} -EXPORT_SYMBOL(gasket_page_table_num_active_pages); - -/* See gasket_page_table.h */ -int gasket_page_table_system_status(struct gasket_page_table *page_table) -{ - if (!page_table) - return GASKET_STATUS_LAMED; - - if (gasket_page_table_num_entries(page_table) == 0) { - dev_dbg(page_table->device, "Page table size is 0\n"); - return GASKET_STATUS_LAMED; - } - - return GASKET_STATUS_ALIVE; -} - -/* Record the host_addr to coherent dma memory mapping. */ -int gasket_set_user_virt(struct gasket_dev *gasket_dev, u64 size, - dma_addr_t dma_address, ulong vma) -{ - int j; - struct gasket_page_table *pg_tbl; - - unsigned int num_pages = size / PAGE_SIZE; - - /* - * TODO: for future chipset, better handling of the case where multiple - * page tables are supported on a given device - */ - pg_tbl = gasket_dev->page_table[0]; - if (!pg_tbl) { - dev_dbg(gasket_dev->dev, "%s: invalid page table index\n", - __func__); - return 0; - } - for (j = 0; j < num_pages; j++) { - pg_tbl->coherent_pages[j].user_virt = - (u64)vma + j * PAGE_SIZE; - } - return 0; -} - -/* Allocate a block of coherent memory. */ -int gasket_alloc_coherent_memory(struct gasket_dev *gasket_dev, u64 size, - dma_addr_t *dma_address, u64 index) -{ - dma_addr_t handle; - void *mem; - int j; - unsigned int num_pages = DIV_ROUND_UP(size, PAGE_SIZE); - const struct gasket_driver_desc *driver_desc = - gasket_get_driver_desc(gasket_dev); - - if (!gasket_dev->page_table[index]) - return -EFAULT; - - if (num_pages == 0) - return -EINVAL; - - mem = dma_alloc_coherent(gasket_get_device(gasket_dev), - num_pages * PAGE_SIZE, &handle, GFP_KERNEL); - if (!mem) - goto nomem; - - gasket_dev->page_table[index]->num_coherent_pages = num_pages; - - /* allocate the physical memory block */ - gasket_dev->page_table[index]->coherent_pages = - kcalloc(num_pages, - sizeof(*gasket_dev->page_table[index]->coherent_pages), - GFP_KERNEL); - if (!gasket_dev->page_table[index]->coherent_pages) - goto nomem; - - gasket_dev->coherent_buffer.length_bytes = - PAGE_SIZE * (num_pages); - gasket_dev->coherent_buffer.phys_base = handle; - gasket_dev->coherent_buffer.virt_base = mem; - - *dma_address = driver_desc->coherent_buffer_description.base; - for (j = 0; j < num_pages; j++) { - gasket_dev->page_table[index]->coherent_pages[j].paddr = - handle + j * PAGE_SIZE; - gasket_dev->page_table[index]->coherent_pages[j].kernel_virt = - (u64)mem + j * PAGE_SIZE; - } - - return 0; - -nomem: - if (mem) { - dma_free_coherent(gasket_get_device(gasket_dev), - num_pages * PAGE_SIZE, mem, handle); - gasket_dev->coherent_buffer.length_bytes = 0; - gasket_dev->coherent_buffer.virt_base = NULL; - gasket_dev->coherent_buffer.phys_base = 0; - } - - kfree(gasket_dev->page_table[index]->coherent_pages); - gasket_dev->page_table[index]->coherent_pages = NULL; - gasket_dev->page_table[index]->num_coherent_pages = 0; - return -ENOMEM; -} - -/* Free a block of coherent memory. */ -int gasket_free_coherent_memory(struct gasket_dev *gasket_dev, u64 size, - dma_addr_t dma_address, u64 index) -{ - const struct gasket_driver_desc *driver_desc; - - if (!gasket_dev->page_table[index]) - return -EFAULT; - - driver_desc = gasket_get_driver_desc(gasket_dev); - - if (driver_desc->coherent_buffer_description.base != dma_address) - return -EADDRNOTAVAIL; - - if (gasket_dev->coherent_buffer.length_bytes) { - dma_free_coherent(gasket_get_device(gasket_dev), - gasket_dev->coherent_buffer.length_bytes, - gasket_dev->coherent_buffer.virt_base, - gasket_dev->coherent_buffer.phys_base); - gasket_dev->coherent_buffer.length_bytes = 0; - gasket_dev->coherent_buffer.virt_base = NULL; - gasket_dev->coherent_buffer.phys_base = 0; - } - - kfree(gasket_dev->page_table[index]->coherent_pages); - gasket_dev->page_table[index]->coherent_pages = NULL; - gasket_dev->page_table[index]->num_coherent_pages = 0; - - return 0; -} - -/* Release all coherent memory. */ -void gasket_free_coherent_memory_all(struct gasket_dev *gasket_dev, u64 index) -{ - if (!gasket_dev->page_table[index]) - return; - - if (gasket_dev->coherent_buffer.length_bytes) { - dma_free_coherent(gasket_get_device(gasket_dev), - gasket_dev->coherent_buffer.length_bytes, - gasket_dev->coherent_buffer.virt_base, - gasket_dev->coherent_buffer.phys_base); - gasket_dev->coherent_buffer.length_bytes = 0; - gasket_dev->coherent_buffer.virt_base = NULL; - gasket_dev->coherent_buffer.phys_base = 0; - } -} diff --git a/drivers/staging/gasket/gasket_page_table.h b/drivers/staging/gasket/gasket_page_table.h deleted file mode 100644 index 7b01b73ea3e7..000000000000 --- a/drivers/staging/gasket/gasket_page_table.h +++ /dev/null @@ -1,249 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Gasket Page Table functionality. This file describes the address - * translation/paging functionality supported by the Gasket driver framework. - * As much as possible, internal details are hidden to simplify use - - * all calls are thread-safe (protected by an internal mutex) except where - * indicated otherwise. - * - * Copyright (C) 2018 Google, Inc. - */ - -#ifndef __GASKET_PAGE_TABLE_H__ -#define __GASKET_PAGE_TABLE_H__ - -#include -#include - -#include "gasket_constants.h" -#include "gasket_core.h" - -/* - * Structure used for managing address translation on a device. All details are - * internal to the implementation. - */ -struct gasket_page_table; - -/* - * Allocate and init address translation data. - * @ppage_table: Pointer to Gasket page table pointer. Set by this call. - * @att_base_reg: [Mapped] pointer to the first entry in the device's address - * translation table. - * @extended_offset_reg: [Mapped] pointer to the device's register containing - * the starting index of the extended translation table. - * @extended_bit_location: The index of the bit indicating whether an address - * is extended. - * @total_entries: The total number of entries in the device's address - * translation table. - * @device: Device structure for the underlying device. Only used for logging. - * @pci_dev: PCI system descriptor for the underlying device. - * whether the driver will supply its own. - * - * Description: Allocates and initializes data to track address translation - - * simple and extended page table metadata. Initially, the page table is - * partitioned such that all addresses are "simple" (single-level lookup). - * gasket_partition_page_table can be called to change this paritioning. - * - * Returns 0 on success, a negative error code otherwise. - */ -int gasket_page_table_init(struct gasket_page_table **ppg_tbl, - const struct gasket_bar_data *bar_data, - const struct gasket_page_table_config *page_table_config, - struct device *device, struct pci_dev *pci_dev); - -/* - * Deallocate and cleanup page table data. - * @page_table: Gasket page table pointer. - * - * Description: The inverse of gasket_init; frees page_table and its contained - * elements. - * - * Because this call destroys the page table, it cannot be - * thread-safe (mutex-protected)! - */ -void gasket_page_table_cleanup(struct gasket_page_table *page_table); - -/* - * Sets the size of the simple page table. - * @page_table: Gasket page table pointer. - * @num_simple_entries: Desired size of the simple page table (in entries). - * - * Description: gasket_partition_page_table checks to see if the simple page - * size can be changed (i.e., if there are no active extended - * mappings in the new simple size range), and, if so, - * sets the new simple and extended page table sizes. - * - * Returns 0 if successful, or non-zero if the page table entries - * are not free. - */ -int gasket_page_table_partition(struct gasket_page_table *page_table, - uint num_simple_entries); - -/* - * Get and map [host] user space pages into device memory. - * @page_table: Gasket page table pointer. - * @host_addr: Starting host virtual memory address of the pages. - * @dev_addr: Starting device address of the pages. - * @num_pages: Number of [4kB] pages to map. - * - * Description: Maps the "num_pages" pages of host memory pointed to by - * host_addr to the address "dev_addr" in device memory. - * - * The caller is responsible for checking the addresses ranges. - * - * Returns 0 if successful or a non-zero error number otherwise. - * If there is an error, no pages are mapped. - */ -int gasket_page_table_map(struct gasket_page_table *page_table, ulong host_addr, - ulong dev_addr, uint num_pages); - -/* - * Un-map host pages from device memory. - * @page_table: Gasket page table pointer. - * @dev_addr: Starting device address of the pages to unmap. - * @num_pages: The number of [4kB] pages to unmap. - * - * Description: The inverse of gasket_map_pages. Unmaps pages from the device. - */ -void gasket_page_table_unmap(struct gasket_page_table *page_table, - ulong dev_addr, uint num_pages); - -/* - * Unmap ALL host pages from device memory. - * @page_table: Gasket page table pointer. - */ -void gasket_page_table_unmap_all(struct gasket_page_table *page_table); - -/* - * Unmap all host pages from device memory and reset the table to fully simple - * addressing. - * @page_table: Gasket page table pointer. - */ -void gasket_page_table_reset(struct gasket_page_table *page_table); - -/* - * Reclaims unused page table memory. - * @page_table: Gasket page table pointer. - * - * Description: Examines the page table and frees any currently-unused - * allocations. Called internally on gasket_cleanup(). - */ -void gasket_page_table_garbage_collect(struct gasket_page_table *page_table); - -/* - * Retrieve the backing page for a device address. - * @page_table: Gasket page table pointer. - * @dev_addr: Gasket device address. - * @ppage: Pointer to a page pointer for the returned page. - * @poffset: Pointer to an unsigned long for the returned offset. - * - * Description: Interprets the address and looks up the corresponding page - * in the page table and the offset in that page. (We need an - * offset because the host page may be larger than the Gasket chip - * page it contains.) - * - * Returns 0 if successful, -1 for an error. The page pointer - * and offset are returned through the pointers, if successful. - */ -int gasket_page_table_lookup_page(struct gasket_page_table *page_table, - ulong dev_addr, struct page **page, - ulong *poffset); - -/* - * Checks validity for input addrs and size. - * @page_table: Gasket page table pointer. - * @host_addr: Host address to check. - * @dev_addr: Gasket device address. - * @bytes: Size of the range to check (in bytes). - * - * Description: This call performs a number of checks to verify that the ranges - * specified by both addresses and the size are valid for mapping pages into - * device memory. - * - * Returns true if the mapping is bad, false otherwise. - */ -bool gasket_page_table_are_addrs_bad(struct gasket_page_table *page_table, - ulong host_addr, ulong dev_addr, - ulong bytes); - -/* - * Checks validity for input dev addr and size. - * @page_table: Gasket page table pointer. - * @dev_addr: Gasket device address. - * @bytes: Size of the range to check (in bytes). - * - * Description: This call performs a number of checks to verify that the range - * specified by the device address and the size is valid for mapping pages into - * device memory. - * - * Returns true if the address is bad, false otherwise. - */ -bool gasket_page_table_is_dev_addr_bad(struct gasket_page_table *page_table, - ulong dev_addr, ulong bytes); - -/* - * Gets maximum size for the given page table. - * @page_table: Gasket page table pointer. - */ -uint gasket_page_table_max_size(struct gasket_page_table *page_table); - -/* - * Gets the total number of entries in the arg. - * @page_table: Gasket page table pointer. - */ -uint gasket_page_table_num_entries(struct gasket_page_table *page_table); - -/* - * Gets the number of simple entries. - * @page_table: Gasket page table pointer. - */ -uint gasket_page_table_num_simple_entries(struct gasket_page_table *page_table); - -/* - * Gets the number of actively pinned pages. - * @page_table: Gasket page table pointer. - */ -uint gasket_page_table_num_active_pages(struct gasket_page_table *page_table); - -/* - * Get status of page table managed by @page_table. - * @page_table: Gasket page table pointer. - */ -int gasket_page_table_system_status(struct gasket_page_table *page_table); - -/* - * Allocate a block of coherent memory. - * @gasket_dev: Gasket Device. - * @size: Size of the memory block. - * @dma_address: Dma address allocated by the kernel. - * @index: Index of the gasket_page_table within this Gasket device - * - * Description: Allocate a contiguous coherent memory block, DMA'ble - * by this device. - */ -int gasket_alloc_coherent_memory(struct gasket_dev *gasket_dev, uint64_t size, - dma_addr_t *dma_address, uint64_t index); -/* Release a block of contiguous coherent memory, in use by a device. */ -int gasket_free_coherent_memory(struct gasket_dev *gasket_dev, uint64_t size, - dma_addr_t dma_address, uint64_t index); - -/* Release all coherent memory. */ -void gasket_free_coherent_memory_all(struct gasket_dev *gasket_dev, - uint64_t index); - -/* - * Records the host_addr to coherent dma memory mapping. - * @gasket_dev: Gasket Device. - * @size: Size of the virtual address range to map. - * @dma_address: Dma address within the coherent memory range. - * @vma: Virtual address we wish to map to coherent memory. - * - * Description: For each page in the virtual address range, record the - * coherent page mapping. - * - * Does not perform validity checking. - */ -int gasket_set_user_virt(struct gasket_dev *gasket_dev, uint64_t size, - dma_addr_t dma_address, ulong vma); - -#endif /* __GASKET_PAGE_TABLE_H__ */ diff --git a/drivers/staging/gasket/gasket_sysfs.c b/drivers/staging/gasket/gasket_sysfs.c deleted file mode 100644 index c5658fdf4d28..000000000000 --- a/drivers/staging/gasket/gasket_sysfs.c +++ /dev/null @@ -1,398 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* Copyright (C) 2018 Google, Inc. */ -#include "gasket_sysfs.h" - -#include "gasket_core.h" - -#include -#include - -/* - * Pair of kernel device and user-specified pointer. Used in lookups in sysfs - * "show" functions to return user data. - */ - -struct gasket_sysfs_mapping { - /* - * The device bound to this mapping. If this is NULL, then this mapping - * is free. - */ - struct device *device; - - /* The Gasket descriptor for this device. */ - struct gasket_dev *gasket_dev; - - /* This device's set of sysfs attributes/nodes. */ - struct gasket_sysfs_attribute *attributes; - - /* The number of live elements in "attributes". */ - int attribute_count; - - /* Protects structure from simultaneous access. */ - struct mutex mutex; - - /* Tracks active users of this mapping. */ - struct kref refcount; -}; - -/* - * Data needed to manage users of this sysfs utility. - * Currently has a fixed size; if space is a concern, this can be dynamically - * allocated. - */ -/* - * 'Global' (file-scoped) list of mappings between devices and gasket_data - * pointers. This removes the requirement to have a gasket_sysfs_data - * handle in all files. - */ -static struct gasket_sysfs_mapping dev_mappings[GASKET_SYSFS_NUM_MAPPINGS]; - -/* Callback when a mapping's refcount goes to zero. */ -static void release_entry(struct kref *ref) -{ - /* All work is done after the return from kref_put. */ -} - -/* Look up mapping information for the given device. */ -static struct gasket_sysfs_mapping *get_mapping(struct device *device) -{ - int i; - - for (i = 0; i < GASKET_SYSFS_NUM_MAPPINGS; i++) { - mutex_lock(&dev_mappings[i].mutex); - if (dev_mappings[i].device == device) { - kref_get(&dev_mappings[i].refcount); - mutex_unlock(&dev_mappings[i].mutex); - return &dev_mappings[i]; - } - mutex_unlock(&dev_mappings[i].mutex); - } - - dev_dbg(device, "%s: Mapping to device %s not found\n", - __func__, device->kobj.name); - return NULL; -} - -/* Put a reference to a mapping. */ -static void put_mapping(struct gasket_sysfs_mapping *mapping) -{ - int i; - int num_files_to_remove = 0; - struct device_attribute *files_to_remove; - struct device *device; - - if (!mapping) { - pr_debug("%s: Mapping should not be NULL\n", __func__); - return; - } - - mutex_lock(&mapping->mutex); - if (kref_put(&mapping->refcount, release_entry)) { - dev_dbg(mapping->device, "Removing Gasket sysfs mapping\n"); - /* - * We can't remove the sysfs nodes in the kref callback, since - * device_remove_file() blocks until the node is free. - * Readers/writers of sysfs nodes, though, will be blocked on - * the mapping mutex, resulting in deadlock. To fix this, the - * sysfs nodes are removed outside the lock. - */ - device = mapping->device; - num_files_to_remove = mapping->attribute_count; - files_to_remove = kcalloc(num_files_to_remove, - sizeof(*files_to_remove), - GFP_KERNEL); - if (files_to_remove) - for (i = 0; i < num_files_to_remove; i++) - files_to_remove[i] = - mapping->attributes[i].attr; - else - num_files_to_remove = 0; - - kfree(mapping->attributes); - mapping->attributes = NULL; - mapping->attribute_count = 0; - put_device(mapping->device); - mapping->device = NULL; - mapping->gasket_dev = NULL; - } - mutex_unlock(&mapping->mutex); - - if (num_files_to_remove != 0) { - for (i = 0; i < num_files_to_remove; ++i) - device_remove_file(device, &files_to_remove[i]); - kfree(files_to_remove); - } -} - -/* - * Put a reference to a mapping N times. - * - * In higher-level resource acquire/release function pairs, the release function - * will need to release a mapping 2x - once for the refcount taken in the - * release function itself, and once for the count taken in the acquire call. - */ -static void put_mapping_n(struct gasket_sysfs_mapping *mapping, int times) -{ - int i; - - for (i = 0; i < times; i++) - put_mapping(mapping); -} - -void gasket_sysfs_init(void) -{ - int i; - - for (i = 0; i < GASKET_SYSFS_NUM_MAPPINGS; i++) { - dev_mappings[i].device = NULL; - mutex_init(&dev_mappings[i].mutex); - } -} - -int gasket_sysfs_create_mapping(struct device *device, - struct gasket_dev *gasket_dev) -{ - struct gasket_sysfs_mapping *mapping; - int map_idx = -1; - - /* - * We need a function-level mutex to protect against the same device - * being added [multiple times] simultaneously. - */ - static DEFINE_MUTEX(function_mutex); - - mutex_lock(&function_mutex); - dev_dbg(device, "Creating sysfs entries for device\n"); - - /* Check that the device we're adding hasn't already been added. */ - mapping = get_mapping(device); - if (mapping) { - dev_err(device, - "Attempting to re-initialize sysfs mapping for device\n"); - put_mapping(mapping); - mutex_unlock(&function_mutex); - return -EBUSY; - } - - /* Find the first empty entry in the array. */ - for (map_idx = 0; map_idx < GASKET_SYSFS_NUM_MAPPINGS; ++map_idx) { - mutex_lock(&dev_mappings[map_idx].mutex); - if (!dev_mappings[map_idx].device) - /* Break with the mutex held! */ - break; - mutex_unlock(&dev_mappings[map_idx].mutex); - } - - if (map_idx == GASKET_SYSFS_NUM_MAPPINGS) { - dev_err(device, "All mappings have been exhausted\n"); - mutex_unlock(&function_mutex); - return -ENOMEM; - } - - dev_dbg(device, "Creating sysfs mapping for device %s\n", - device->kobj.name); - - mapping = &dev_mappings[map_idx]; - mapping->attributes = kcalloc(GASKET_SYSFS_MAX_NODES, - sizeof(*mapping->attributes), - GFP_KERNEL); - if (!mapping->attributes) { - dev_dbg(device, "Unable to allocate sysfs attribute array\n"); - mutex_unlock(&mapping->mutex); - mutex_unlock(&function_mutex); - return -ENOMEM; - } - - kref_init(&mapping->refcount); - mapping->device = get_device(device); - mapping->gasket_dev = gasket_dev; - mapping->attribute_count = 0; - mutex_unlock(&mapping->mutex); - mutex_unlock(&function_mutex); - - /* Don't decrement the refcount here! One open count keeps it alive! */ - return 0; -} - -int gasket_sysfs_create_entries(struct device *device, - const struct gasket_sysfs_attribute *attrs) -{ - int i; - int ret; - struct gasket_sysfs_mapping *mapping = get_mapping(device); - - if (!mapping) { - dev_dbg(device, - "Creating entries for device without first initializing mapping\n"); - return -EINVAL; - } - - mutex_lock(&mapping->mutex); - for (i = 0; attrs[i].attr.attr.name; i++) { - if (mapping->attribute_count == GASKET_SYSFS_MAX_NODES) { - dev_err(device, - "Maximum number of sysfs nodes reached for device\n"); - mutex_unlock(&mapping->mutex); - put_mapping(mapping); - return -ENOMEM; - } - - ret = device_create_file(device, &attrs[i].attr); - if (ret) { - dev_dbg(device, "Unable to create device entries\n"); - mutex_unlock(&mapping->mutex); - put_mapping(mapping); - return ret; - } - - mapping->attributes[mapping->attribute_count] = attrs[i]; - ++mapping->attribute_count; - } - - mutex_unlock(&mapping->mutex); - put_mapping(mapping); - return 0; -} -EXPORT_SYMBOL(gasket_sysfs_create_entries); - -void gasket_sysfs_remove_mapping(struct device *device) -{ - struct gasket_sysfs_mapping *mapping = get_mapping(device); - - if (!mapping) { - dev_err(device, - "Attempted to remove non-existent sysfs mapping to device\n"); - return; - } - - put_mapping_n(mapping, 2); -} - -struct gasket_dev *gasket_sysfs_get_device_data(struct device *device) -{ - struct gasket_sysfs_mapping *mapping = get_mapping(device); - - if (!mapping) { - dev_err(device, "device not registered\n"); - return NULL; - } - - return mapping->gasket_dev; -} -EXPORT_SYMBOL(gasket_sysfs_get_device_data); - -void gasket_sysfs_put_device_data(struct device *device, struct gasket_dev *dev) -{ - struct gasket_sysfs_mapping *mapping = get_mapping(device); - - if (!mapping) - return; - - /* See comment of put_mapping_n() for why the '2' is necessary. */ - put_mapping_n(mapping, 2); -} -EXPORT_SYMBOL(gasket_sysfs_put_device_data); - -struct gasket_sysfs_attribute * -gasket_sysfs_get_attr(struct device *device, struct device_attribute *attr) -{ - int i; - int num_attrs; - struct gasket_sysfs_mapping *mapping = get_mapping(device); - struct gasket_sysfs_attribute *attrs = NULL; - - if (!mapping) - return NULL; - - attrs = mapping->attributes; - num_attrs = mapping->attribute_count; - for (i = 0; i < num_attrs; ++i) { - if (!strcmp(attrs[i].attr.attr.name, attr->attr.name)) - return &attrs[i]; - } - - dev_err(device, "Unable to find match for device_attribute %s\n", - attr->attr.name); - return NULL; -} -EXPORT_SYMBOL(gasket_sysfs_get_attr); - -void gasket_sysfs_put_attr(struct device *device, - struct gasket_sysfs_attribute *attr) -{ - int i; - int num_attrs; - struct gasket_sysfs_mapping *mapping = get_mapping(device); - struct gasket_sysfs_attribute *attrs = NULL; - - if (!mapping) - return; - - attrs = mapping->attributes; - num_attrs = mapping->attribute_count; - for (i = 0; i < num_attrs; ++i) { - if (&attrs[i] == attr) { - put_mapping_n(mapping, 2); - return; - } - } - - dev_err(device, "Unable to put unknown attribute: %s\n", - attr->attr.attr.name); - put_mapping(mapping); -} -EXPORT_SYMBOL(gasket_sysfs_put_attr); - -ssize_t gasket_sysfs_register_store(struct device *device, - struct device_attribute *attr, - const char *buf, size_t count) -{ - ulong parsed_value = 0; - struct gasket_sysfs_mapping *mapping; - struct gasket_dev *gasket_dev; - struct gasket_sysfs_attribute *gasket_attr; - - if (count < 3 || buf[0] != '0' || buf[1] != 'x') { - dev_err(device, - "sysfs register write format: \"0x\"\n"); - return -EINVAL; - } - - if (kstrtoul(buf, 16, &parsed_value) != 0) { - dev_err(device, - "Unable to parse input as 64-bit hex value: %s\n", buf); - return -EINVAL; - } - - mapping = get_mapping(device); - if (!mapping) { - dev_err(device, "Device driver may have been removed\n"); - return 0; - } - - gasket_dev = mapping->gasket_dev; - if (!gasket_dev) { - dev_err(device, "Device driver may have been removed\n"); - put_mapping(mapping); - return 0; - } - - gasket_attr = gasket_sysfs_get_attr(device, attr); - if (!gasket_attr) { - put_mapping(mapping); - return count; - } - - gasket_dev_write_64(gasket_dev, parsed_value, - gasket_attr->data.bar_address.bar, - gasket_attr->data.bar_address.offset); - - if (gasket_attr->write_callback) - gasket_attr->write_callback(gasket_dev, gasket_attr, - parsed_value); - - gasket_sysfs_put_attr(device, gasket_attr); - put_mapping(mapping); - return count; -} -EXPORT_SYMBOL(gasket_sysfs_register_store); diff --git a/drivers/staging/gasket/gasket_sysfs.h b/drivers/staging/gasket/gasket_sysfs.h deleted file mode 100644 index d5e167dfbe76..000000000000 --- a/drivers/staging/gasket/gasket_sysfs.h +++ /dev/null @@ -1,175 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Set of common sysfs utilities. - * - * Copyright (C) 2018 Google, Inc. - */ - -/* The functions described here are a set of utilities to allow each file in the - * Gasket driver framework to manage their own set of sysfs entries, instead of - * centralizing all that work in one file. - * - * The goal of these utilities is to allow for sysfs entries to be easily - * created without causing a proliferation of sysfs "show" functions. This - * requires O(N) string lookups during show function execution, but as reading - * sysfs entries is rarely performance-critical, this is likely acceptible. - */ -#ifndef __GASKET_SYSFS_H__ -#define __GASKET_SYSFS_H__ - -#include "gasket_constants.h" -#include "gasket_core.h" -#include -#include -#include - -/* The maximum number of mappings/devices a driver needs to support. */ -#define GASKET_SYSFS_NUM_MAPPINGS (GASKET_FRAMEWORK_DESC_MAX * GASKET_DEV_MAX) - -/* The maximum number of sysfs nodes in a directory. - */ -#define GASKET_SYSFS_MAX_NODES 196 - -/* - * Terminator struct for a gasket_sysfs_attr array. Must be at the end of - * all gasket_sysfs_attribute arrays. - */ -#define GASKET_END_OF_ATTR_ARRAY \ - { \ - .attr = __ATTR_NULL, \ - .data.attr_type = 0, \ - } - -/* - * Pairing of sysfs attribute and user data. - * Used in lookups in sysfs "show" functions to return attribute metadata. - */ -struct gasket_sysfs_attribute { - /* The underlying sysfs device attribute associated with this data. */ - struct device_attribute attr; - - /* User-specified data to associate with the attribute. */ - union { - struct bar_address_ { - ulong bar; - ulong offset; - } bar_address; - uint attr_type; - } data; - - /* - * Function pointer to a callback to be invoked when this attribute is - * written (if so configured). The arguments are to the Gasket device - * pointer, the enclosing gasket_attr structure, and the value written. - * The callback should perform any logging necessary, as errors cannot - * be returned from the callback. - */ - void (*write_callback)(struct gasket_dev *dev, - struct gasket_sysfs_attribute *attr, - ulong value); -}; - -#define GASKET_SYSFS_RO(_name, _show_function, _attr_type) \ - { \ - .attr = __ATTR(_name, 0444, _show_function, NULL), \ - .data.attr_type = _attr_type \ - } - -/* Initializes the Gasket sysfs subsystem. - * - * Description: Performs one-time initialization. Must be called before usage - * at [Gasket] module load time. - */ -void gasket_sysfs_init(void); - -/* - * Create an entry in mapping_data between a device and a Gasket device. - * @device: Device struct to map to. - * @gasket_dev: The dev struct associated with the driver controlling @device. - * - * Description: This function maps a gasket_dev* to a device*. This mapping can - * be used in sysfs_show functions to get a handle to the gasket_dev struct - * controlling the device node. - * - * If this function is not called before gasket_sysfs_create_entries, a warning - * will be logged. - */ -int gasket_sysfs_create_mapping(struct device *device, - struct gasket_dev *gasket_dev); - -/* - * Creates bulk entries in sysfs. - * @device: Kernel device structure. - * @attrs: List of attributes/sysfs entries to create. - * - * Description: Creates each sysfs entry described in "attrs". Can be called - * multiple times for a given @device. If the gasket_dev specified in - * gasket_sysfs_create_mapping had a legacy device, the entries will be created - * for it, as well. - */ -int gasket_sysfs_create_entries(struct device *device, - const struct gasket_sysfs_attribute *attrs); - -/* - * Removes a device mapping from the global table. - * @device: Device to unmap. - * - * Description: Removes the device->Gasket device mapping from the internal - * table. - */ -void gasket_sysfs_remove_mapping(struct device *device); - -/* - * User data lookup based on kernel device structure. - * @device: Kernel device structure. - * - * Description: Returns the user data associated with "device" in a prior call - * to gasket_sysfs_create_entries. Returns NULL if no mapping can be found. - * Upon success, this call take a reference to internal sysfs data that must be - * released with gasket_sysfs_put_device_data. While this reference is held, the - * underlying device sysfs information/structure will remain valid/will not be - * deleted. - */ -struct gasket_dev *gasket_sysfs_get_device_data(struct device *device); - -/* - * Releases a references to internal data. - * @device: Kernel device structure. - * @dev: Gasket device descriptor (returned by gasket_sysfs_get_device_data). - */ -void gasket_sysfs_put_device_data(struct device *device, - struct gasket_dev *gasket_dev); - -/* - * Gasket-specific attribute lookup. - * @device: Kernel device structure. - * @attr: Device attribute to look up. - * - * Returns the Gasket sysfs attribute associated with the kernel device - * attribute and device structure itself. Upon success, this call will take a - * reference to internal sysfs data that must be released with a call to - * gasket_sysfs_put_attr. While this reference is held, the underlying device - * sysfs information/structure will remain valid/will not be deleted. - */ -struct gasket_sysfs_attribute * -gasket_sysfs_get_attr(struct device *device, struct device_attribute *attr); - -/* - * Releases a references to internal data. - * @device: Kernel device structure. - * @attr: Gasket sysfs attribute descriptor (returned by - * gasket_sysfs_get_attr). - */ -void gasket_sysfs_put_attr(struct device *device, - struct gasket_sysfs_attribute *attr); - -/* - * Write to a register sysfs node. - * @buf: NULL-terminated data being written. - * @count: number of bytes in the "buf" argument. - */ -ssize_t gasket_sysfs_register_store(struct device *device, - struct device_attribute *attr, - const char *buf, size_t count); - -#endif /* __GASKET_SYSFS_H__ */ -- 2.30.2 From gregkh at linuxfoundation.org Mon Mar 15 15:58:06 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Mon, 15 Mar 2021 16:58:06 +0100 Subject: driverdev mailing list is moving! Message-ID: Hi all, After almost 14 years of being hosted by OSUOSL, the driverdev mailing list is moving to lists.linux.dev. This should help out with the occasional mailman issues that driverdev had at times, and is one of the first lists to help stress-test the new linux.dev mailing lists infrastructure. As the scope of this list has changed a lot since it was first created in 2007, the new name of the list reflects what it has really been for the past decade or so, a place for patches and development of the drivers/staging/ subsystem in the Linux kernel. As such, the new list address is: linux-staging at lists.linux.dev To sign up for it, go to: https://subspace.kernel.org/lists.linux.dev.html and follow the instructions there. I'll send a patch to move the list address that is in the MAINTAINERS file to point to the new list, and this old list will probably be retired in a month or so after everyone realizes to use the new one. Thanks so much to OSUOSL for hosting this for so long, and for putting up with the odd requirements of a tiny mailing list that does not restrict postings from non-subscribers. They have done a great job with this over the years. If anyone has any questions about this, please let me know. thanks, greg k-h From rspringer at google.com Mon Mar 15 16:10:27 2021 From: rspringer at google.com (Rob Springer) Date: Mon, 15 Mar 2021 09:10:27 -0700 Subject: [PATCH] staging: gasket: remove it from the kernel In-Reply-To: <20210315154413.3084149-1-gregkh@linuxfoundation.org> References: <20210315154413.3084149-1-gregkh@linuxfoundation.org> Message-ID: Acked-by: Rob Springer On Mon, Mar 15, 2021 at 8:44 AM wrote: > > From: Greg Kroah-Hartman > > As none of the proposed things that need to be changed in the gasket > drivers have ever been done, and there has not been any forward progress > to get this out of staging, it seems totally abandonded so remove the > code entirely so that people do not spend their time doing tiny cleanups > for code that will never get out of staging. > > If this code is actually being used, it can be reverted simply and then > cleaned up properly, but as it is abandoned, let's just get rid of it. > > Cc: Rob Springer > Cc: Todd Poynor > Cc: Ben Chan > Cc: Richard Yeh > Signed-off-by: Greg Kroah-Hartman > --- > MAINTAINERS | 8 - > drivers/staging/Kconfig | 2 - > drivers/staging/Makefile | 1 - > drivers/staging/gasket/Kconfig | 25 - > drivers/staging/gasket/Makefile | 10 - > drivers/staging/gasket/TODO | 22 - > drivers/staging/gasket/apex.h | 30 - > drivers/staging/gasket/apex_driver.c | 726 -------- > drivers/staging/gasket/gasket.h | 122 -- > drivers/staging/gasket/gasket_constants.h | 44 - > drivers/staging/gasket/gasket_core.c | 1815 -------------------- > drivers/staging/gasket/gasket_core.h | 638 ------- > drivers/staging/gasket/gasket_interrupt.c | 515 ------ > drivers/staging/gasket/gasket_interrupt.h | 95 - > drivers/staging/gasket/gasket_ioctl.c | 388 ----- > drivers/staging/gasket/gasket_ioctl.h | 28 - > drivers/staging/gasket/gasket_page_table.c | 1357 --------------- > drivers/staging/gasket/gasket_page_table.h | 249 --- > drivers/staging/gasket/gasket_sysfs.c | 398 ----- > drivers/staging/gasket/gasket_sysfs.h | 175 -- > 20 files changed, 6648 deletions(-) > delete mode 100644 drivers/staging/gasket/Kconfig > delete mode 100644 drivers/staging/gasket/Makefile > delete mode 100644 drivers/staging/gasket/TODO > delete mode 100644 drivers/staging/gasket/apex.h > delete mode 100644 drivers/staging/gasket/apex_driver.c > delete mode 100644 drivers/staging/gasket/gasket.h > delete mode 100644 drivers/staging/gasket/gasket_constants.h > delete mode 100644 drivers/staging/gasket/gasket_core.c > delete mode 100644 drivers/staging/gasket/gasket_core.h > delete mode 100644 drivers/staging/gasket/gasket_interrupt.c > delete mode 100644 drivers/staging/gasket/gasket_interrupt.h > delete mode 100644 drivers/staging/gasket/gasket_ioctl.c > delete mode 100644 drivers/staging/gasket/gasket_ioctl.h > delete mode 100644 drivers/staging/gasket/gasket_page_table.c > delete mode 100644 drivers/staging/gasket/gasket_page_table.h > delete mode 100644 drivers/staging/gasket/gasket_sysfs.c > delete mode 100644 drivers/staging/gasket/gasket_sysfs.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index aa84121c5611..392647241626 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -7385,14 +7385,6 @@ F: Documentation/hwmon/gsc-hwmon.rst > F: drivers/hwmon/gsc-hwmon.c > F: include/linux/platform_data/gsc_hwmon.h > > -GASKET DRIVER FRAMEWORK > -M: Rob Springer > -M: Todd Poynor > -M: Ben Chan > -M: Richard Yeh > -S: Maintained > -F: drivers/staging/gasket/ > - > GCC PLUGINS > M: Kees Cook > L: linux-hardening at vger.kernel.org > diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig > index b22f73d7bfc4..efddc50c81f9 100644 > --- a/drivers/staging/Kconfig > +++ b/drivers/staging/Kconfig > @@ -98,8 +98,6 @@ source "drivers/staging/ralink-gdma/Kconfig" > > source "drivers/staging/mt7621-dts/Kconfig" > > -source "drivers/staging/gasket/Kconfig" > - > source "drivers/staging/axis-fifo/Kconfig" > > source "drivers/staging/fieldbus/Kconfig" > diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile > index 2245059e69c7..e2e95a20081a 100644 > --- a/drivers/staging/Makefile > +++ b/drivers/staging/Makefile > @@ -39,7 +39,6 @@ obj-$(CONFIG_PCI_MT7621) += mt7621-pci/ > obj-$(CONFIG_SOC_MT7621) += mt7621-dma/ > obj-$(CONFIG_DMA_RALINK) += ralink-gdma/ > obj-$(CONFIG_SOC_MT7621) += mt7621-dts/ > -obj-$(CONFIG_STAGING_GASKET_FRAMEWORK) += gasket/ > obj-$(CONFIG_XIL_AXIS_FIFO) += axis-fifo/ > obj-$(CONFIG_FIELDBUS_DEV) += fieldbus/ > obj-$(CONFIG_KPC2000) += kpc2000/ > diff --git a/drivers/staging/gasket/Kconfig b/drivers/staging/gasket/Kconfig > deleted file mode 100644 > index d9bef8ca41ef..000000000000 > --- a/drivers/staging/gasket/Kconfig > +++ /dev/null > @@ -1,25 +0,0 @@ > -# SPDX-License-Identifier: GPL-2.0 > -menu "Gasket devices" > - > -config STAGING_GASKET_FRAMEWORK > - tristate "Gasket framework" > - depends on PCI && (X86_64 || ARM64) > - help > - This framework supports Gasket-compatible devices, such as Apex. > - It is required for any of the following module(s). > - > - To compile this driver as a module, choose M here. The module > - will be called "gasket". > - > -config STAGING_APEX_DRIVER > - tristate "Apex Driver" > - depends on STAGING_GASKET_FRAMEWORK > - help > - This driver supports the Apex Edge TPU device. See > - https://cloud.google.com/edge-tpu/ for more information. > - Say Y if you want to include this driver in the kernel. > - > - To compile this driver as a module, choose M here. The module > - will be called "apex". > - > -endmenu > diff --git a/drivers/staging/gasket/Makefile b/drivers/staging/gasket/Makefile > deleted file mode 100644 > index ce03e256f501..000000000000 > --- a/drivers/staging/gasket/Makefile > +++ /dev/null > @@ -1,10 +0,0 @@ > -# SPDX-License-Identifier: GPL-2.0 > -# > -# Makefile for Gasket framework and dependent drivers. > -# > - > -obj-$(CONFIG_STAGING_GASKET_FRAMEWORK) += gasket.o > -obj-$(CONFIG_STAGING_APEX_DRIVER) += apex.o > - > -gasket-objs := gasket_core.o gasket_ioctl.o gasket_interrupt.o gasket_page_table.o gasket_sysfs.o > -apex-objs := apex_driver.o > diff --git a/drivers/staging/gasket/TODO b/drivers/staging/gasket/TODO > deleted file mode 100644 > index 5b1865f8af2d..000000000000 > --- a/drivers/staging/gasket/TODO > +++ /dev/null > @@ -1,22 +0,0 @@ > -This is a list of things that need to be done to get this driver out of the > -staging directory. > - > -- Implement the gasket framework's functionality through UIO instead of > - introducing a new user-space drivers framework that is quite similar. > - > - UIO provides the necessary bits to implement user-space drivers. Meanwhile > - the gasket APIs adds some extra conveniences like PCI BAR mapping, and > - MSI interrupts. Add these features to the UIO subsystem, then re-implement > - the Apex driver as a basic UIO driver instead (include/linux/uio_driver.h) > - > -- Document sysfs files with Documentation/ABI/ entries. > - > -- Use misc interface instead of major number for driver version description. > - > -- Add descriptions of module_param's > - > -- apex_get_status() should actually check status. > - > -- "drivers" should never be dealing with "raw" sysfs calls or mess around with > - kobjects at all. The driver core should handle all of this for you > - automaically. There should not be a need for raw attribute macros. > diff --git a/drivers/staging/gasket/apex.h b/drivers/staging/gasket/apex.h > deleted file mode 100644 > index 3bbceffff5e4..000000000000 > --- a/drivers/staging/gasket/apex.h > +++ /dev/null > @@ -1,30 +0,0 @@ > -/* SPDX-License-Identifier: GPL-2.0 */ > -/* > - * Apex kernel-userspace interface definitions. > - * > - * Copyright (C) 2018 Google, Inc. > - */ > -#ifndef __APEX_H__ > -#define __APEX_H__ > - > -#include > - > -/* Clock Gating ioctl. */ > -struct apex_gate_clock_ioctl { > - /* Enter or leave clock gated state. */ > - u64 enable; > - > - /* If set, enter clock gating state, regardless of custom block's > - * internal idle state > - */ > - u64 force_idle; > -}; > - > -/* Base number for all Apex-common IOCTLs */ > -#define APEX_IOCTL_BASE 0x7F > - > -/* Enable/Disable clock gating. */ > -#define APEX_IOCTL_GATE_CLOCK \ > - _IOW(APEX_IOCTL_BASE, 0, struct apex_gate_clock_ioctl) > - > -#endif /* __APEX_H__ */ > diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c > deleted file mode 100644 > index f12f81c8dd2f..000000000000 > --- a/drivers/staging/gasket/apex_driver.c > +++ /dev/null > @@ -1,726 +0,0 @@ > -// SPDX-License-Identifier: GPL-2.0 > -/* > - * Driver for the Apex chip. > - * > - * Copyright (C) 2018 Google, Inc. > - */ > - > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > - > -#include "apex.h" > - > -#include "gasket_core.h" > -#include "gasket_interrupt.h" > -#include "gasket_page_table.h" > -#include "gasket_sysfs.h" > - > -/* Constants */ > -#define APEX_DEVICE_NAME "Apex" > -#define APEX_DRIVER_VERSION "1.0" > - > -/* CSRs are in BAR 2. */ > -#define APEX_BAR_INDEX 2 > - > -#define APEX_PCI_VENDOR_ID 0x1ac1 > -#define APEX_PCI_DEVICE_ID 0x089a > - > -/* Bar Offsets. */ > -#define APEX_BAR_OFFSET 0 > -#define APEX_CM_OFFSET 0x1000000 > - > -/* The sizes of each Apex BAR 2. */ > -#define APEX_BAR_BYTES 0x100000 > -#define APEX_CH_MEM_BYTES (PAGE_SIZE * MAX_NUM_COHERENT_PAGES) > - > -/* The number of user-mappable memory ranges in BAR2 of a Apex chip. */ > -#define NUM_REGIONS 3 > - > -/* The number of nodes in a Apex chip. */ > -#define NUM_NODES 1 > - > -/* > - * The total number of entries in the page table. Should match the value read > - * from the register APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE_SIZE. > - */ > -#define APEX_PAGE_TABLE_TOTAL_ENTRIES 8192 > - > -#define APEX_EXTENDED_SHIFT 63 /* Extended address bit position. */ > - > -/* Check reset 120 times */ > -#define APEX_RESET_RETRY 120 > -/* Wait 100 ms between checks. Total 12 sec wait maximum. */ > -#define APEX_RESET_DELAY 100 > - > -/* Enumeration of the supported sysfs entries. */ > -enum sysfs_attribute_type { > - ATTR_KERNEL_HIB_PAGE_TABLE_SIZE, > - ATTR_KERNEL_HIB_SIMPLE_PAGE_TABLE_SIZE, > - ATTR_KERNEL_HIB_NUM_ACTIVE_PAGES, > -}; > - > -/* > - * Register offsets into BAR2 memory. > - * Only values necessary for driver implementation are defined. > - */ > -enum apex_bar2_regs { > - APEX_BAR2_REG_SCU_BASE = 0x1A300, > - APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE_SIZE = 0x46000, > - APEX_BAR2_REG_KERNEL_HIB_EXTENDED_TABLE = 0x46008, > - APEX_BAR2_REG_KERNEL_HIB_TRANSLATION_ENABLE = 0x46010, > - APEX_BAR2_REG_KERNEL_HIB_INSTR_QUEUE_INTVECCTL = 0x46018, > - APEX_BAR2_REG_KERNEL_HIB_INPUT_ACTV_QUEUE_INTVECCTL = 0x46020, > - APEX_BAR2_REG_KERNEL_HIB_PARAM_QUEUE_INTVECCTL = 0x46028, > - APEX_BAR2_REG_KERNEL_HIB_OUTPUT_ACTV_QUEUE_INTVECCTL = 0x46030, > - APEX_BAR2_REG_KERNEL_HIB_SC_HOST_INTVECCTL = 0x46038, > - APEX_BAR2_REG_KERNEL_HIB_TOP_LEVEL_INTVECCTL = 0x46040, > - APEX_BAR2_REG_KERNEL_HIB_FATAL_ERR_INTVECCTL = 0x46048, > - APEX_BAR2_REG_KERNEL_HIB_DMA_PAUSE = 0x46050, > - APEX_BAR2_REG_KERNEL_HIB_DMA_PAUSE_MASK = 0x46058, > - APEX_BAR2_REG_KERNEL_HIB_STATUS_BLOCK_DELAY = 0x46060, > - APEX_BAR2_REG_KERNEL_HIB_MSIX_PENDING_BIT_ARRAY0 = 0x46068, > - APEX_BAR2_REG_KERNEL_HIB_MSIX_PENDING_BIT_ARRAY1 = 0x46070, > - APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE_INIT = 0x46078, > - APEX_BAR2_REG_KERNEL_HIB_MSIX_TABLE_INIT = 0x46080, > - APEX_BAR2_REG_KERNEL_WIRE_INT_PENDING_BIT_ARRAY = 0x48778, > - APEX_BAR2_REG_KERNEL_WIRE_INT_MASK_ARRAY = 0x48780, > - APEX_BAR2_REG_USER_HIB_DMA_PAUSE = 0x486D8, > - APEX_BAR2_REG_USER_HIB_DMA_PAUSED = 0x486E0, > - APEX_BAR2_REG_IDLEGENERATOR_IDLEGEN_IDLEREGISTER = 0x4A000, > - APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE = 0x50000, > - > - /* Error registers - Used mostly for debug */ > - APEX_BAR2_REG_USER_HIB_ERROR_STATUS = 0x86f0, > - APEX_BAR2_REG_SCALAR_CORE_ERROR_STATUS = 0x41a0, > -}; > - > -/* Addresses for packed registers. */ > -#define APEX_BAR2_REG_AXI_QUIESCE (APEX_BAR2_REG_SCU_BASE + 0x2C) > -#define APEX_BAR2_REG_GCB_CLOCK_GATE (APEX_BAR2_REG_SCU_BASE + 0x14) > -#define APEX_BAR2_REG_SCU_0 (APEX_BAR2_REG_SCU_BASE + 0xc) > -#define APEX_BAR2_REG_SCU_1 (APEX_BAR2_REG_SCU_BASE + 0x10) > -#define APEX_BAR2_REG_SCU_2 (APEX_BAR2_REG_SCU_BASE + 0x14) > -#define APEX_BAR2_REG_SCU_3 (APEX_BAR2_REG_SCU_BASE + 0x18) > -#define APEX_BAR2_REG_SCU_4 (APEX_BAR2_REG_SCU_BASE + 0x1c) > -#define APEX_BAR2_REG_SCU_5 (APEX_BAR2_REG_SCU_BASE + 0x20) > - > -#define SCU3_RG_PWR_STATE_OVR_BIT_OFFSET 26 > -#define SCU3_RG_PWR_STATE_OVR_MASK_WIDTH 2 > -#define SCU3_CUR_RST_GCB_BIT_MASK 0x10 > -#define SCU2_RG_RST_GCB_BIT_MASK 0xc > - > -/* Configuration for page table. */ > -static struct gasket_page_table_config apex_page_table_configs[NUM_NODES] = { > - { > - .id = 0, > - .mode = GASKET_PAGE_TABLE_MODE_NORMAL, > - .total_entries = APEX_PAGE_TABLE_TOTAL_ENTRIES, > - .base_reg = APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE, > - .extended_reg = APEX_BAR2_REG_KERNEL_HIB_EXTENDED_TABLE, > - .extended_bit = APEX_EXTENDED_SHIFT, > - }, > -}; > - > -/* The regions in the BAR2 space that can be mapped into user space. */ > -static const struct gasket_mappable_region mappable_regions[NUM_REGIONS] = { > - { 0x40000, 0x1000 }, > - { 0x44000, 0x1000 }, > - { 0x48000, 0x1000 }, > -}; > - > -/* Gasket device interrupts enums must be dense (i.e., no empty slots). */ > -enum apex_interrupt { > - APEX_INTERRUPT_INSTR_QUEUE = 0, > - APEX_INTERRUPT_INPUT_ACTV_QUEUE = 1, > - APEX_INTERRUPT_PARAM_QUEUE = 2, > - APEX_INTERRUPT_OUTPUT_ACTV_QUEUE = 3, > - APEX_INTERRUPT_SC_HOST_0 = 4, > - APEX_INTERRUPT_SC_HOST_1 = 5, > - APEX_INTERRUPT_SC_HOST_2 = 6, > - APEX_INTERRUPT_SC_HOST_3 = 7, > - APEX_INTERRUPT_TOP_LEVEL_0 = 8, > - APEX_INTERRUPT_TOP_LEVEL_1 = 9, > - APEX_INTERRUPT_TOP_LEVEL_2 = 10, > - APEX_INTERRUPT_TOP_LEVEL_3 = 11, > - APEX_INTERRUPT_FATAL_ERR = 12, > - APEX_INTERRUPT_COUNT = 13, > -}; > - > -/* Interrupt descriptors for Apex */ > -static struct gasket_interrupt_desc apex_interrupts[] = { > - { > - APEX_INTERRUPT_INSTR_QUEUE, > - APEX_BAR2_REG_KERNEL_HIB_INSTR_QUEUE_INTVECCTL, > - UNPACKED, > - }, > - { > - APEX_INTERRUPT_INPUT_ACTV_QUEUE, > - APEX_BAR2_REG_KERNEL_HIB_INPUT_ACTV_QUEUE_INTVECCTL, > - UNPACKED > - }, > - { > - APEX_INTERRUPT_PARAM_QUEUE, > - APEX_BAR2_REG_KERNEL_HIB_PARAM_QUEUE_INTVECCTL, > - UNPACKED > - }, > - { > - APEX_INTERRUPT_OUTPUT_ACTV_QUEUE, > - APEX_BAR2_REG_KERNEL_HIB_OUTPUT_ACTV_QUEUE_INTVECCTL, > - UNPACKED > - }, > - { > - APEX_INTERRUPT_SC_HOST_0, > - APEX_BAR2_REG_KERNEL_HIB_SC_HOST_INTVECCTL, > - PACK_0 > - }, > - { > - APEX_INTERRUPT_SC_HOST_1, > - APEX_BAR2_REG_KERNEL_HIB_SC_HOST_INTVECCTL, > - PACK_1 > - }, > - { > - APEX_INTERRUPT_SC_HOST_2, > - APEX_BAR2_REG_KERNEL_HIB_SC_HOST_INTVECCTL, > - PACK_2 > - }, > - { > - APEX_INTERRUPT_SC_HOST_3, > - APEX_BAR2_REG_KERNEL_HIB_SC_HOST_INTVECCTL, > - PACK_3 > - }, > - { > - APEX_INTERRUPT_TOP_LEVEL_0, > - APEX_BAR2_REG_KERNEL_HIB_TOP_LEVEL_INTVECCTL, > - PACK_0 > - }, > - { > - APEX_INTERRUPT_TOP_LEVEL_1, > - APEX_BAR2_REG_KERNEL_HIB_TOP_LEVEL_INTVECCTL, > - PACK_1 > - }, > - { > - APEX_INTERRUPT_TOP_LEVEL_2, > - APEX_BAR2_REG_KERNEL_HIB_TOP_LEVEL_INTVECCTL, > - PACK_2 > - }, > - { > - APEX_INTERRUPT_TOP_LEVEL_3, > - APEX_BAR2_REG_KERNEL_HIB_TOP_LEVEL_INTVECCTL, > - PACK_3 > - }, > - { > - APEX_INTERRUPT_FATAL_ERR, > - APEX_BAR2_REG_KERNEL_HIB_FATAL_ERR_INTVECCTL, > - UNPACKED > - }, > -}; > - > -/* Allows device to enter power save upon driver close(). */ > -static int allow_power_save = 1; > - > -/* Allows SW based clock gating. */ > -static int allow_sw_clock_gating; > - > -/* Allows HW based clock gating. */ > -/* Note: this is not mutual exclusive with SW clock gating. */ > -static int allow_hw_clock_gating = 1; > - > -/* Act as if only GCB is instantiated. */ > -static int bypass_top_level; > - > -module_param(allow_power_save, int, 0644); > -module_param(allow_sw_clock_gating, int, 0644); > -module_param(allow_hw_clock_gating, int, 0644); > -module_param(bypass_top_level, int, 0644); > - > -/* Check the device status registers and return device status ALIVE or DEAD. */ > -static int apex_get_status(struct gasket_dev *gasket_dev) > -{ > - /* TODO: Check device status. */ > - return GASKET_STATUS_ALIVE; > -} > - > -/* Enter GCB reset state. */ > -static int apex_enter_reset(struct gasket_dev *gasket_dev) > -{ > - if (bypass_top_level) > - return 0; > - > - /* > - * Software reset: > - * Enable sleep mode > - * - Software force GCB idle > - * - Enable GCB idle > - */ > - gasket_read_modify_write_64(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_IDLEGENERATOR_IDLEGEN_IDLEREGISTER, > - 0x0, 1, 32); > - > - /* - Initiate DMA pause */ > - gasket_dev_write_64(gasket_dev, 1, APEX_BAR_INDEX, > - APEX_BAR2_REG_USER_HIB_DMA_PAUSE); > - > - /* - Wait for DMA pause complete. */ > - if (gasket_wait_with_reschedule(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_USER_HIB_DMA_PAUSED, 1, 1, > - APEX_RESET_DELAY, APEX_RESET_RETRY)) { > - dev_err(gasket_dev->dev, > - "DMAs did not quiesce within timeout (%d ms)\n", > - APEX_RESET_RETRY * APEX_RESET_DELAY); > - return -ETIMEDOUT; > - } > - > - /* - Enable GCB reset (0x1 to rg_rst_gcb) */ > - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_2, 0x1, 2, 2); > - > - /* - Enable GCB clock Gate (0x1 to rg_gated_gcb) */ > - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_2, 0x1, 2, 18); > - > - /* - Enable GCB memory shut down (0x3 to rg_force_ram_sd) */ > - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_3, 0x3, 2, 14); > - > - /* - Wait for RAM shutdown. */ > - if (gasket_wait_with_reschedule(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_3, BIT(6), BIT(6), > - APEX_RESET_DELAY, APEX_RESET_RETRY)) { > - dev_err(gasket_dev->dev, > - "RAM did not shut down within timeout (%d ms)\n", > - APEX_RESET_RETRY * APEX_RESET_DELAY); > - return -ETIMEDOUT; > - } > - > - return 0; > -} > - > -/* Quit GCB reset state. */ > -static int apex_quit_reset(struct gasket_dev *gasket_dev) > -{ > - u32 val0, val1; > - > - if (bypass_top_level) > - return 0; > - > - /* > - * Disable sleep mode: > - * - Disable GCB memory shut down: > - * - b00: Not forced (HW controlled) > - * - b1x: Force disable > - */ > - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_3, 0x0, 2, 14); > - > - /* > - * - Disable software clock gate: > - * - b00: Not forced (HW controlled) > - * - b1x: Force disable > - */ > - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_2, 0x0, 2, 18); > - > - /* > - * - Disable GCB reset (rg_rst_gcb): > - * - b00: Not forced (HW controlled) > - * - b1x: Force disable = Force not Reset > - */ > - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_2, 0x2, 2, 2); > - > - /* - Wait for RAM enable. */ > - if (gasket_wait_with_reschedule(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_3, BIT(6), 0, > - APEX_RESET_DELAY, APEX_RESET_RETRY)) { > - dev_err(gasket_dev->dev, > - "RAM did not enable within timeout (%d ms)\n", > - APEX_RESET_RETRY * APEX_RESET_DELAY); > - return -ETIMEDOUT; > - } > - > - /* - Wait for Reset complete. */ > - if (gasket_wait_with_reschedule(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_3, > - SCU3_CUR_RST_GCB_BIT_MASK, 0, > - APEX_RESET_DELAY, APEX_RESET_RETRY)) { > - dev_err(gasket_dev->dev, > - "GCB did not leave reset within timeout (%d ms)\n", > - APEX_RESET_RETRY * APEX_RESET_DELAY); > - return -ETIMEDOUT; > - } > - > - if (!allow_hw_clock_gating) { > - val0 = gasket_dev_read_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_3); > - /* Inactive and Sleep mode are disabled. */ > - gasket_read_modify_write_32(gasket_dev, > - APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_3, 0x3, > - SCU3_RG_PWR_STATE_OVR_MASK_WIDTH, > - SCU3_RG_PWR_STATE_OVR_BIT_OFFSET); > - val1 = gasket_dev_read_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_3); > - dev_dbg(gasket_dev->dev, > - "Disallow HW clock gating 0x%x -> 0x%x\n", val0, val1); > - } else { > - val0 = gasket_dev_read_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_3); > - /* Inactive mode enabled - Sleep mode disabled. */ > - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_3, 2, > - SCU3_RG_PWR_STATE_OVR_MASK_WIDTH, > - SCU3_RG_PWR_STATE_OVR_BIT_OFFSET); > - val1 = gasket_dev_read_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_3); > - dev_dbg(gasket_dev->dev, "Allow HW clock gating 0x%x -> 0x%x\n", > - val0, val1); > - } > - > - return 0; > -} > - > -/* Reset the Apex hardware. Called on final close via device_close_cb. */ > -static int apex_device_cleanup(struct gasket_dev *gasket_dev) > -{ > - u64 scalar_error; > - u64 hib_error; > - int ret = 0; > - > - hib_error = gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_USER_HIB_ERROR_STATUS); > - scalar_error = gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCALAR_CORE_ERROR_STATUS); > - > - dev_dbg(gasket_dev->dev, > - "%s 0x%p hib_error 0x%llx scalar_error 0x%llx\n", > - __func__, gasket_dev, hib_error, scalar_error); > - > - if (allow_power_save) > - ret = apex_enter_reset(gasket_dev); > - > - return ret; > -} > - > -/* Determine if GCB is in reset state. */ > -static bool is_gcb_in_reset(struct gasket_dev *gasket_dev) > -{ > - u32 val = gasket_dev_read_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_SCU_3); > - > - /* Masks rg_rst_gcb bit of SCU_CTRL_2 */ > - return (val & SCU3_CUR_RST_GCB_BIT_MASK); > -} > - > -/* Reset the hardware, then quit reset. Called on device open. */ > -static int apex_reset(struct gasket_dev *gasket_dev) > -{ > - int ret; > - > - if (bypass_top_level) > - return 0; > - > - if (!is_gcb_in_reset(gasket_dev)) { > - /* We are not in reset - toggle the reset bit so as to force > - * re-init of custom block > - */ > - dev_dbg(gasket_dev->dev, "%s: toggle reset\n", __func__); > - > - ret = apex_enter_reset(gasket_dev); > - if (ret) > - return ret; > - } > - return apex_quit_reset(gasket_dev); > -} > - > -/* > - * Check permissions for Apex ioctls. > - * Returns true if the current user may execute this ioctl, and false otherwise. > - */ > -static bool apex_ioctl_check_permissions(struct file *filp, uint cmd) > -{ > - return !!(filp->f_mode & FMODE_WRITE); > -} > - > -/* Gates or un-gates Apex clock. */ > -static long apex_clock_gating(struct gasket_dev *gasket_dev, > - struct apex_gate_clock_ioctl __user *argp) > -{ > - struct apex_gate_clock_ioctl ibuf; > - > - if (bypass_top_level || !allow_sw_clock_gating) > - return 0; > - > - if (copy_from_user(&ibuf, argp, sizeof(ibuf))) > - return -EFAULT; > - > - dev_dbg(gasket_dev->dev, "%s %llu\n", __func__, ibuf.enable); > - > - if (ibuf.enable) { > - /* Quiesce AXI, gate GCB clock. */ > - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_AXI_QUIESCE, 0x1, 1, > - 16); > - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_GCB_CLOCK_GATE, 0x1, > - 2, 18); > - } else { > - /* Un-gate GCB clock, un-quiesce AXI. */ > - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_GCB_CLOCK_GATE, 0x0, > - 2, 18); > - gasket_read_modify_write_32(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_AXI_QUIESCE, 0x0, 1, > - 16); > - } > - return 0; > -} > - > -/* Apex-specific ioctl handler. */ > -static long apex_ioctl(struct file *filp, uint cmd, void __user *argp) > -{ > - struct gasket_dev *gasket_dev = filp->private_data; > - > - if (!apex_ioctl_check_permissions(filp, cmd)) > - return -EPERM; > - > - switch (cmd) { > - case APEX_IOCTL_GATE_CLOCK: > - return apex_clock_gating(gasket_dev, argp); > - default: > - return -ENOTTY; /* unknown command */ > - } > -} > - > -/* Display driver sysfs entries. */ > -static ssize_t sysfs_show(struct device *device, struct device_attribute *attr, > - char *buf) > -{ > - int ret; > - struct gasket_dev *gasket_dev; > - struct gasket_sysfs_attribute *gasket_attr; > - enum sysfs_attribute_type type; > - struct gasket_page_table *gpt; > - uint val; > - > - gasket_dev = gasket_sysfs_get_device_data(device); > - if (!gasket_dev) { > - dev_err(device, "No Apex device sysfs mapping found\n"); > - return -ENODEV; > - } > - > - gasket_attr = gasket_sysfs_get_attr(device, attr); > - if (!gasket_attr) { > - dev_err(device, "No Apex device sysfs attr data found\n"); > - gasket_sysfs_put_device_data(device, gasket_dev); > - return -ENODEV; > - } > - > - type = (enum sysfs_attribute_type)gasket_attr->data.attr_type; > - gpt = gasket_dev->page_table[0]; > - switch (type) { > - case ATTR_KERNEL_HIB_PAGE_TABLE_SIZE: > - val = gasket_page_table_num_entries(gpt); > - break; > - case ATTR_KERNEL_HIB_SIMPLE_PAGE_TABLE_SIZE: > - val = gasket_page_table_num_simple_entries(gpt); > - break; > - case ATTR_KERNEL_HIB_NUM_ACTIVE_PAGES: > - val = gasket_page_table_num_active_pages(gpt); > - break; > - default: > - dev_dbg(gasket_dev->dev, "Unknown attribute: %s\n", > - attr->attr.name); > - ret = 0; > - goto exit; > - } > - ret = scnprintf(buf, PAGE_SIZE, "%u\n", val); > -exit: > - gasket_sysfs_put_attr(device, gasket_attr); > - gasket_sysfs_put_device_data(device, gasket_dev); > - return ret; > -} > - > -static struct gasket_sysfs_attribute apex_sysfs_attrs[] = { > - GASKET_SYSFS_RO(node_0_page_table_entries, sysfs_show, > - ATTR_KERNEL_HIB_PAGE_TABLE_SIZE), > - GASKET_SYSFS_RO(node_0_simple_page_table_entries, sysfs_show, > - ATTR_KERNEL_HIB_SIMPLE_PAGE_TABLE_SIZE), > - GASKET_SYSFS_RO(node_0_num_mapped_pages, sysfs_show, > - ATTR_KERNEL_HIB_NUM_ACTIVE_PAGES), > - GASKET_END_OF_ATTR_ARRAY > -}; > - > -/* On device open, perform a core reinit reset. */ > -static int apex_device_open_cb(struct gasket_dev *gasket_dev) > -{ > - return gasket_reset_nolock(gasket_dev); > -} > - > -static const struct pci_device_id apex_pci_ids[] = { > - { PCI_DEVICE(APEX_PCI_VENDOR_ID, APEX_PCI_DEVICE_ID) }, { 0 } > -}; > - > -static int apex_pci_probe(struct pci_dev *pci_dev, > - const struct pci_device_id *id) > -{ > - int ret; > - ulong page_table_ready, msix_table_ready; > - int retries = 0; > - struct gasket_dev *gasket_dev; > - > - ret = pci_enable_device(pci_dev); > - if (ret) { > - dev_err(&pci_dev->dev, "error enabling PCI device\n"); > - return ret; > - } > - > - pci_set_master(pci_dev); > - > - ret = gasket_pci_add_device(pci_dev, &gasket_dev); > - if (ret) { > - dev_err(&pci_dev->dev, "error adding gasket device\n"); > - pci_disable_device(pci_dev); > - return ret; > - } > - > - pci_set_drvdata(pci_dev, gasket_dev); > - apex_reset(gasket_dev); > - > - while (retries < APEX_RESET_RETRY) { > - page_table_ready = > - gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE_INIT); > - msix_table_ready = > - gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX, > - APEX_BAR2_REG_KERNEL_HIB_MSIX_TABLE_INIT); > - if (page_table_ready && msix_table_ready) > - break; > - schedule_timeout(msecs_to_jiffies(APEX_RESET_DELAY)); > - retries++; > - } > - > - if (retries == APEX_RESET_RETRY) { > - if (!page_table_ready) > - dev_err(gasket_dev->dev, "Page table init timed out\n"); > - if (!msix_table_ready) > - dev_err(gasket_dev->dev, "MSI-X table init timed out\n"); > - ret = -ETIMEDOUT; > - goto remove_device; > - } > - > - ret = gasket_sysfs_create_entries(gasket_dev->dev_info.device, > - apex_sysfs_attrs); > - if (ret) > - dev_err(&pci_dev->dev, "error creating device sysfs entries\n"); > - > - ret = gasket_enable_device(gasket_dev); > - if (ret) { > - dev_err(&pci_dev->dev, "error enabling gasket device\n"); > - goto remove_device; > - } > - > - /* Place device in low power mode until opened */ > - if (allow_power_save) > - apex_enter_reset(gasket_dev); > - > - return 0; > - > -remove_device: > - gasket_pci_remove_device(pci_dev); > - pci_disable_device(pci_dev); > - return ret; > -} > - > -static void apex_pci_remove(struct pci_dev *pci_dev) > -{ > - struct gasket_dev *gasket_dev = pci_get_drvdata(pci_dev); > - > - gasket_disable_device(gasket_dev); > - gasket_pci_remove_device(pci_dev); > - pci_disable_device(pci_dev); > -} > - > -static const struct gasket_driver_desc apex_desc = { > - .name = "apex", > - .driver_version = APEX_DRIVER_VERSION, > - .major = 120, > - .minor = 0, > - .module = THIS_MODULE, > - .pci_id_table = apex_pci_ids, > - > - .num_page_tables = NUM_NODES, > - .page_table_bar_index = APEX_BAR_INDEX, > - .page_table_configs = apex_page_table_configs, > - .page_table_extended_bit = APEX_EXTENDED_SHIFT, > - > - .bar_descriptions = { > - GASKET_UNUSED_BAR, > - GASKET_UNUSED_BAR, > - { APEX_BAR_BYTES, (VM_WRITE | VM_READ), APEX_BAR_OFFSET, > - NUM_REGIONS, mappable_regions, PCI_BAR }, > - GASKET_UNUSED_BAR, > - GASKET_UNUSED_BAR, > - GASKET_UNUSED_BAR, > - }, > - .coherent_buffer_description = { > - APEX_CH_MEM_BYTES, > - (VM_WRITE | VM_READ), > - APEX_CM_OFFSET, > - }, > - .interrupt_type = PCI_MSIX, > - .interrupt_bar_index = APEX_BAR_INDEX, > - .num_interrupts = APEX_INTERRUPT_COUNT, > - .interrupts = apex_interrupts, > - .interrupt_pack_width = 7, > - > - .device_open_cb = apex_device_open_cb, > - .device_close_cb = apex_device_cleanup, > - > - .ioctl_handler_cb = apex_ioctl, > - .device_status_cb = apex_get_status, > - .hardware_revision_cb = NULL, > - .device_reset_cb = apex_reset, > -}; > - > -static struct pci_driver apex_pci_driver = { > - .name = "apex", > - .probe = apex_pci_probe, > - .remove = apex_pci_remove, > - .id_table = apex_pci_ids, > -}; > - > -static int __init apex_init(void) > -{ > - int ret; > - > - ret = gasket_register_device(&apex_desc); > - if (ret) > - return ret; > - ret = pci_register_driver(&apex_pci_driver); > - if (ret) > - gasket_unregister_device(&apex_desc); > - return ret; > -} > - > -static void apex_exit(void) > -{ > - pci_unregister_driver(&apex_pci_driver); > - gasket_unregister_device(&apex_desc); > -} > -MODULE_DESCRIPTION("Google Apex driver"); > -MODULE_VERSION(APEX_DRIVER_VERSION); > -MODULE_LICENSE("GPL v2"); > -MODULE_AUTHOR("John Joseph "); > -MODULE_DEVICE_TABLE(pci, apex_pci_ids); > -module_init(apex_init); > -module_exit(apex_exit); > diff --git a/drivers/staging/gasket/gasket.h b/drivers/staging/gasket/gasket.h > deleted file mode 100644 > index a0f065c517a5..000000000000 > --- a/drivers/staging/gasket/gasket.h > +++ /dev/null > @@ -1,122 +0,0 @@ > -/* SPDX-License-Identifier: GPL-2.0 */ > -/* > - * Common Gasket device kernel and user space declarations. > - * > - * Copyright (C) 2018 Google, Inc. > - */ > -#ifndef __GASKET_H__ > -#define __GASKET_H__ > - > -#include > -#include > - > -/* ioctl structure declarations */ > - > -/* Ioctl structures are padded to a multiple of 64 bits */ > -/* and padded to put 64 bit values on 64 bit boundaries. */ > -/* Unsigned 64 bit integers are used to hold pointers. */ > -/* This helps compatibility between 32 and 64 bits. */ > - > -/* > - * Common structure for ioctls associating an eventfd with a device interrupt, > - * when using the Gasket interrupt module. > - */ > -struct gasket_interrupt_eventfd { > - u64 interrupt; > - u64 event_fd; > -}; > - > -/* > - * Common structure for ioctls mapping and unmapping buffers when using the > - * Gasket page_table module. > - */ > -struct gasket_page_table_ioctl { > - u64 page_table_index; > - u64 size; > - u64 host_address; > - u64 device_address; > -}; > - > -/* > - * Common structure for ioctls mapping and unmapping buffers when using the > - * Gasket page_table module. > - * dma_address: phys addr start of coherent memory, allocated by kernel > - */ > -struct gasket_coherent_alloc_config_ioctl { > - u64 page_table_index; > - u64 enable; > - u64 size; > - u64 dma_address; > -}; > - > -/* Base number for all Gasket-common IOCTLs */ > -#define GASKET_IOCTL_BASE 0xDC > - > -/* Reset the device. */ > -#define GASKET_IOCTL_RESET _IO(GASKET_IOCTL_BASE, 0) > - > -/* Associate the specified [event]fd with the specified interrupt. */ > -#define GASKET_IOCTL_SET_EVENTFD \ > - _IOW(GASKET_IOCTL_BASE, 1, struct gasket_interrupt_eventfd) > - > -/* > - * Clears any eventfd associated with the specified interrupt. The (ulong) > - * argument is the interrupt number to clear. > - */ > -#define GASKET_IOCTL_CLEAR_EVENTFD _IOW(GASKET_IOCTL_BASE, 2, unsigned long) > - > -/* > - * [Loopbacks only] Requests that the loopback device send the specified > - * interrupt to the host. The (ulong) argument is the number of the interrupt to > - * send. > - */ > -#define GASKET_IOCTL_LOOPBACK_INTERRUPT \ > - _IOW(GASKET_IOCTL_BASE, 3, unsigned long) > - > -/* Queries the kernel for the number of page tables supported by the device. */ > -#define GASKET_IOCTL_NUMBER_PAGE_TABLES _IOR(GASKET_IOCTL_BASE, 4, u64) > - > -/* > - * Queries the kernel for the maximum size of the page table. Only the size and > - * page_table_index fields are used from the struct gasket_page_table_ioctl. > - */ > -#define GASKET_IOCTL_PAGE_TABLE_SIZE \ > - _IOWR(GASKET_IOCTL_BASE, 5, struct gasket_page_table_ioctl) > - > -/* > - * Queries the kernel for the current simple page table size. Only the size and > - * page_table_index fields are used from the struct gasket_page_table_ioctl. > - */ > -#define GASKET_IOCTL_SIMPLE_PAGE_TABLE_SIZE \ > - _IOWR(GASKET_IOCTL_BASE, 6, struct gasket_page_table_ioctl) > - > -/* > - * Tells the kernel to change the split between the number of simple and > - * extended entries in the given page table. Only the size and page_table_index > - * fields are used from the struct gasket_page_table_ioctl. > - */ > -#define GASKET_IOCTL_PARTITION_PAGE_TABLE \ > - _IOW(GASKET_IOCTL_BASE, 7, struct gasket_page_table_ioctl) > - > -/* > - * Tells the kernel to map size bytes at host_address to device_address in > - * page_table_index page table. > - */ > -#define GASKET_IOCTL_MAP_BUFFER \ > - _IOW(GASKET_IOCTL_BASE, 8, struct gasket_page_table_ioctl) > - > -/* > - * Tells the kernel to unmap size bytes at host_address from device_address in > - * page_table_index page table. > - */ > -#define GASKET_IOCTL_UNMAP_BUFFER \ > - _IOW(GASKET_IOCTL_BASE, 9, struct gasket_page_table_ioctl) > - > -/* Clear the interrupt counts stored for this device. */ > -#define GASKET_IOCTL_CLEAR_INTERRUPT_COUNTS _IO(GASKET_IOCTL_BASE, 10) > - > -/* Enable/Disable and configure the coherent allocator. */ > -#define GASKET_IOCTL_CONFIG_COHERENT_ALLOCATOR \ > - _IOWR(GASKET_IOCTL_BASE, 11, struct gasket_coherent_alloc_config_ioctl) > - > -#endif /* __GASKET_H__ */ > diff --git a/drivers/staging/gasket/gasket_constants.h b/drivers/staging/gasket/gasket_constants.h > deleted file mode 100644 > index 9ea9c8833f27..000000000000 > --- a/drivers/staging/gasket/gasket_constants.h > +++ /dev/null > @@ -1,44 +0,0 @@ > -/* SPDX-License-Identifier: GPL-2.0 */ > -/* Copyright (C) 2018 Google, Inc. */ > -#ifndef __GASKET_CONSTANTS_H__ > -#define __GASKET_CONSTANTS_H__ > - > -#define GASKET_FRAMEWORK_VERSION "1.1.2" > - > -/* > - * The maximum number of simultaneous device types supported by the framework. > - */ > -#define GASKET_FRAMEWORK_DESC_MAX 2 > - > -/* The maximum devices per each type. */ > -#define GASKET_DEV_MAX 256 > - > -/* The number of supported Gasket page tables per device. */ > -#define GASKET_MAX_NUM_PAGE_TABLES 1 > - > -/* Maximum length of device names (driver name + minor number suffix + NULL). */ > -#define GASKET_NAME_MAX 32 > - > -/* Device status enumeration. */ > -enum gasket_status { > - /* > - * A device is DEAD if it has not been initialized or has had an error. > - */ > - GASKET_STATUS_DEAD = 0, > - /* > - * A device is LAMED if the hardware is healthy but the kernel was > - * unable to enable some functionality (e.g. interrupts). > - */ > - GASKET_STATUS_LAMED, > - > - /* A device is ALIVE if it is ready for operation. */ > - GASKET_STATUS_ALIVE, > - > - /* > - * This status is set when the driver is exiting and waiting for all > - * handles to be closed. > - */ > - GASKET_STATUS_DRIVER_EXIT, > -}; > - > -#endif > diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c > deleted file mode 100644 > index 28dab302183b..000000000000 > --- a/drivers/staging/gasket/gasket_core.c > +++ /dev/null > @@ -1,1815 +0,0 @@ > -// SPDX-License-Identifier: GPL-2.0 > -/* > - * Gasket generic driver framework. This file contains the implementation > - * for the Gasket generic driver framework - the functionality that is common > - * across Gasket devices. > - * > - * Copyright (C) 2018 Google, Inc. > - */ > - > -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > - > -#include "gasket_core.h" > - > -#include "gasket_interrupt.h" > -#include "gasket_ioctl.h" > -#include "gasket_page_table.h" > -#include "gasket_sysfs.h" > - > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > - > -#ifdef GASKET_KERNEL_TRACE_SUPPORT > -#define CREATE_TRACE_POINTS > -#include > -#else > -#define trace_gasket_mmap_exit(x) > -#define trace_gasket_mmap_entry(x, ...) > -#endif > - > -/* > - * "Private" members of gasket_driver_desc. > - * > - * Contains internal per-device type tracking data, i.e., data not appropriate > - * as part of the public interface for the generic framework. > - */ > -struct gasket_internal_desc { > - /* Device-specific-driver-provided configuration information. */ > - const struct gasket_driver_desc *driver_desc; > - > - /* Protects access to per-driver data (i.e. this structure). */ > - struct mutex mutex; > - > - /* Kernel-internal device class. */ > - struct class *class; > - > - /* Instantiated / present devices of this type. */ > - struct gasket_dev *devs[GASKET_DEV_MAX]; > -}; > - > -/* do_map_region() needs be able to return more than just true/false. */ > -enum do_map_region_status { > - /* The region was successfully mapped. */ > - DO_MAP_REGION_SUCCESS, > - > - /* Attempted to map region and failed. */ > - DO_MAP_REGION_FAILURE, > - > - /* The requested region to map was not part of a mappable region. */ > - DO_MAP_REGION_INVALID, > -}; > - > -/* Global data definitions. */ > -/* Mutex - only for framework-wide data. Other data should be protected by > - * finer-grained locks. > - */ > -static DEFINE_MUTEX(g_mutex); > - > -/* List of all registered device descriptions & their supporting data. */ > -static struct gasket_internal_desc g_descs[GASKET_FRAMEWORK_DESC_MAX]; > - > -/* Mapping of statuses to human-readable strings. Must end with {0,NULL}. */ > -static const struct gasket_num_name gasket_status_name_table[] = { > - { GASKET_STATUS_DEAD, "DEAD" }, > - { GASKET_STATUS_ALIVE, "ALIVE" }, > - { GASKET_STATUS_LAMED, "LAMED" }, > - { GASKET_STATUS_DRIVER_EXIT, "DRIVER_EXITING" }, > - { 0, NULL }, > -}; > - > -/* Enumeration of the automatic Gasket framework sysfs nodes. */ > -enum gasket_sysfs_attribute_type { > - ATTR_BAR_OFFSETS, > - ATTR_BAR_SIZES, > - ATTR_DRIVER_VERSION, > - ATTR_FRAMEWORK_VERSION, > - ATTR_DEVICE_TYPE, > - ATTR_HARDWARE_REVISION, > - ATTR_PCI_ADDRESS, > - ATTR_STATUS, > - ATTR_IS_DEVICE_OWNED, > - ATTR_DEVICE_OWNER, > - ATTR_WRITE_OPEN_COUNT, > - ATTR_RESET_COUNT, > - ATTR_USER_MEM_RANGES > -}; > - > -/* Perform a standard Gasket callback. */ > -static inline int > -check_and_invoke_callback(struct gasket_dev *gasket_dev, > - int (*cb_function)(struct gasket_dev *)) > -{ > - int ret = 0; > - > - if (cb_function) { > - mutex_lock(&gasket_dev->mutex); > - ret = cb_function(gasket_dev); > - mutex_unlock(&gasket_dev->mutex); > - } > - return ret; > -} > - > -/* Perform a standard Gasket callback without grabbing gasket_dev->mutex. */ > -static inline int > -gasket_check_and_invoke_callback_nolock(struct gasket_dev *gasket_dev, > - int (*cb_function)(struct gasket_dev *)) > -{ > - int ret = 0; > - > - if (cb_function) > - ret = cb_function(gasket_dev); > - return ret; > -} > - > -/* > - * Return nonzero if the gasket_cdev_info is owned by the current thread group > - * ID. > - */ > -static int gasket_owned_by_current_tgid(struct gasket_cdev_info *info) > -{ > - return (info->ownership.is_owned && > - (info->ownership.owner == current->tgid)); > -} > - > -/* > - * Find the next free gasket_internal_dev slot. > - * > - * Returns the located slot number on success or a negative number on failure. > - */ > -static int gasket_find_dev_slot(struct gasket_internal_desc *internal_desc, > - const char *kobj_name) > -{ > - int i; > - > - mutex_lock(&internal_desc->mutex); > - > - /* Search for a previous instance of this device. */ > - for (i = 0; i < GASKET_DEV_MAX; i++) { > - if (internal_desc->devs[i] && > - strcmp(internal_desc->devs[i]->kobj_name, kobj_name) == 0) { > - pr_err("Duplicate device %s\n", kobj_name); > - mutex_unlock(&internal_desc->mutex); > - return -EBUSY; > - } > - } > - > - /* Find a free device slot. */ > - for (i = 0; i < GASKET_DEV_MAX; i++) { > - if (!internal_desc->devs[i]) > - break; > - } > - > - if (i == GASKET_DEV_MAX) { > - pr_err("Too many registered devices; max %d\n", GASKET_DEV_MAX); > - mutex_unlock(&internal_desc->mutex); > - return -EBUSY; > - } > - > - mutex_unlock(&internal_desc->mutex); > - return i; > -} > - > -/* > - * Allocate and initialize a Gasket device structure, add the device to the > - * device list. > - * > - * Returns 0 if successful, a negative error code otherwise. > - */ > -static int gasket_alloc_dev(struct gasket_internal_desc *internal_desc, > - struct device *parent, struct gasket_dev **pdev) > -{ > - int dev_idx; > - const struct gasket_driver_desc *driver_desc = > - internal_desc->driver_desc; > - struct gasket_dev *gasket_dev; > - struct gasket_cdev_info *dev_info; > - const char *parent_name = dev_name(parent); > - > - pr_debug("Allocating a Gasket device, parent %s.\n", parent_name); > - > - *pdev = NULL; > - > - dev_idx = gasket_find_dev_slot(internal_desc, parent_name); > - if (dev_idx < 0) > - return dev_idx; > - > - gasket_dev = *pdev = kzalloc(sizeof(*gasket_dev), GFP_KERNEL); > - if (!gasket_dev) { > - pr_err("no memory for device, parent %s\n", parent_name); > - return -ENOMEM; > - } > - internal_desc->devs[dev_idx] = gasket_dev; > - > - mutex_init(&gasket_dev->mutex); > - > - gasket_dev->internal_desc = internal_desc; > - gasket_dev->dev_idx = dev_idx; > - snprintf(gasket_dev->kobj_name, GASKET_NAME_MAX, "%s", parent_name); > - gasket_dev->dev = get_device(parent); > - /* gasket_bar_data is uninitialized. */ > - gasket_dev->num_page_tables = driver_desc->num_page_tables; > - /* max_page_table_size and *page table are uninit'ed */ > - /* interrupt_data is not initialized. */ > - /* status is 0, or GASKET_STATUS_DEAD */ > - > - dev_info = &gasket_dev->dev_info; > - snprintf(dev_info->name, GASKET_NAME_MAX, "%s_%u", driver_desc->name, > - gasket_dev->dev_idx); > - dev_info->devt = > - MKDEV(driver_desc->major, driver_desc->minor + > - gasket_dev->dev_idx); > - dev_info->device = > - device_create(internal_desc->class, parent, dev_info->devt, > - gasket_dev, dev_info->name); > - > - /* cdev has not yet been added; cdev_added is 0 */ > - dev_info->gasket_dev_ptr = gasket_dev; > - /* ownership is all 0, indicating no owner or opens. */ > - > - return 0; > -} > - > -/* Free a Gasket device. */ > -static void gasket_free_dev(struct gasket_dev *gasket_dev) > -{ > - struct gasket_internal_desc *internal_desc = gasket_dev->internal_desc; > - > - mutex_lock(&internal_desc->mutex); > - internal_desc->devs[gasket_dev->dev_idx] = NULL; > - mutex_unlock(&internal_desc->mutex); > - put_device(gasket_dev->dev); > - kfree(gasket_dev); > -} > - > -/* > - * Maps the specified bar into kernel space. > - * > - * Returns 0 on success, a negative error code otherwise. > - * A zero-sized BAR will not be mapped, but is not an error. > - */ > -static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num) > -{ > - struct gasket_internal_desc *internal_desc = gasket_dev->internal_desc; > - const struct gasket_driver_desc *driver_desc = > - internal_desc->driver_desc; > - ulong desc_bytes = driver_desc->bar_descriptions[bar_num].size; > - struct gasket_bar_data *data; > - int ret; > - > - if (desc_bytes == 0) > - return 0; > - > - if (driver_desc->bar_descriptions[bar_num].type != PCI_BAR) { > - /* not PCI: skip this entry */ > - return 0; > - } > - > - data = &gasket_dev->bar_data[bar_num]; > - > - /* > - * pci_resource_start and pci_resource_len return a "resource_size_t", > - * which is safely castable to ulong (which itself is the arg to > - * request_mem_region). > - */ > - data->phys_base = > - (ulong)pci_resource_start(gasket_dev->pci_dev, bar_num); > - if (!data->phys_base) { > - dev_err(gasket_dev->dev, "Cannot get BAR%u base address\n", > - bar_num); > - return -EINVAL; > - } > - > - data->length_bytes = > - (ulong)pci_resource_len(gasket_dev->pci_dev, bar_num); > - if (data->length_bytes < desc_bytes) { > - dev_err(gasket_dev->dev, > - "PCI BAR %u space is too small: %lu; expected >= %lu\n", > - bar_num, data->length_bytes, desc_bytes); > - return -ENOMEM; > - } > - > - if (!request_mem_region(data->phys_base, data->length_bytes, > - gasket_dev->dev_info.name)) { > - dev_err(gasket_dev->dev, > - "Cannot get BAR %d memory region %p\n", > - bar_num, &gasket_dev->pci_dev->resource[bar_num]); > - return -EINVAL; > - } > - > - data->virt_base = ioremap(data->phys_base, data->length_bytes); > - if (!data->virt_base) { > - dev_err(gasket_dev->dev, > - "Cannot remap BAR %d memory region %p\n", > - bar_num, &gasket_dev->pci_dev->resource[bar_num]); > - ret = -ENOMEM; > - goto fail; > - } > - > - dma_set_mask(&gasket_dev->pci_dev->dev, DMA_BIT_MASK(64)); > - dma_set_coherent_mask(&gasket_dev->pci_dev->dev, DMA_BIT_MASK(64)); > - > - return 0; > - > -fail: > - iounmap(data->virt_base); > - release_mem_region(data->phys_base, data->length_bytes); > - return ret; > -} > - > -/* > - * Releases PCI BAR mapping. > - * > - * A zero-sized or not-mapped BAR will not be unmapped, but is not an error. > - */ > -static void gasket_unmap_pci_bar(struct gasket_dev *dev, int bar_num) > -{ > - ulong base, bytes; > - struct gasket_internal_desc *internal_desc = dev->internal_desc; > - const struct gasket_driver_desc *driver_desc = > - internal_desc->driver_desc; > - > - if (driver_desc->bar_descriptions[bar_num].size == 0 || > - !dev->bar_data[bar_num].virt_base) > - return; > - > - if (driver_desc->bar_descriptions[bar_num].type != PCI_BAR) > - return; > - > - iounmap(dev->bar_data[bar_num].virt_base); > - dev->bar_data[bar_num].virt_base = NULL; > - > - base = pci_resource_start(dev->pci_dev, bar_num); > - if (!base) { > - dev_err(dev->dev, "cannot get PCI BAR%u base address\n", > - bar_num); > - return; > - } > - > - bytes = pci_resource_len(dev->pci_dev, bar_num); > - release_mem_region(base, bytes); > -} > - > -/* > - * Setup PCI memory mapping for the specified device. > - * > - * Reads the BAR registers and sets up pointers to the device's memory mapped > - * IO space. > - * > - * Returns 0 on success and a negative value otherwise. > - */ > -static int gasket_setup_pci(struct pci_dev *pci_dev, > - struct gasket_dev *gasket_dev) > -{ > - int i, mapped_bars, ret; > - > - for (i = 0; i < PCI_STD_NUM_BARS; i++) { > - ret = gasket_map_pci_bar(gasket_dev, i); > - if (ret) { > - mapped_bars = i; > - goto fail; > - } > - } > - > - return 0; > - > -fail: > - for (i = 0; i < mapped_bars; i++) > - gasket_unmap_pci_bar(gasket_dev, i); > - > - return -ENOMEM; > -} > - > -/* Unmaps memory for the specified device. */ > -static void gasket_cleanup_pci(struct gasket_dev *gasket_dev) > -{ > - int i; > - > - for (i = 0; i < PCI_STD_NUM_BARS; i++) > - gasket_unmap_pci_bar(gasket_dev, i); > -} > - > -/* Determine the health of the Gasket device. */ > -static int gasket_get_hw_status(struct gasket_dev *gasket_dev) > -{ > - int status; > - int i; > - const struct gasket_driver_desc *driver_desc = > - gasket_dev->internal_desc->driver_desc; > - > - status = gasket_check_and_invoke_callback_nolock(gasket_dev, > - driver_desc->device_status_cb); > - if (status != GASKET_STATUS_ALIVE) { > - dev_dbg(gasket_dev->dev, "Hardware reported status %d.\n", > - status); > - return status; > - } > - > - status = gasket_interrupt_system_status(gasket_dev); > - if (status != GASKET_STATUS_ALIVE) { > - dev_dbg(gasket_dev->dev, > - "Interrupt system reported status %d.\n", status); > - return status; > - } > - > - for (i = 0; i < driver_desc->num_page_tables; ++i) { > - status = gasket_page_table_system_status(gasket_dev->page_table[i]); > - if (status != GASKET_STATUS_ALIVE) { > - dev_dbg(gasket_dev->dev, > - "Page table %d reported status %d.\n", > - i, status); > - return status; > - } > - } > - > - return GASKET_STATUS_ALIVE; > -} > - > -static ssize_t > -gasket_write_mappable_regions(char *buf, > - const struct gasket_driver_desc *driver_desc, > - int bar_index) > -{ > - int i; > - ssize_t written; > - ssize_t total_written = 0; > - ulong min_addr, max_addr; > - struct gasket_bar_desc bar_desc = > - driver_desc->bar_descriptions[bar_index]; > - > - if (bar_desc.permissions == GASKET_NOMAP) > - return 0; > - for (i = 0; > - i < bar_desc.num_mappable_regions && total_written < PAGE_SIZE; > - i++) { > - min_addr = bar_desc.mappable_regions[i].start - > - driver_desc->legacy_mmap_address_offset; > - max_addr = bar_desc.mappable_regions[i].start - > - driver_desc->legacy_mmap_address_offset + > - bar_desc.mappable_regions[i].length_bytes; > - written = scnprintf(buf, PAGE_SIZE - total_written, > - "0x%08lx-0x%08lx\n", min_addr, max_addr); > - total_written += written; > - buf += written; > - } > - return total_written; > -} > - > -static ssize_t gasket_sysfs_data_show(struct device *device, > - struct device_attribute *attr, char *buf) > -{ > - int i, ret = 0; > - ssize_t current_written = 0; > - const struct gasket_driver_desc *driver_desc; > - struct gasket_dev *gasket_dev; > - struct gasket_sysfs_attribute *gasket_attr; > - const struct gasket_bar_desc *bar_desc; > - enum gasket_sysfs_attribute_type sysfs_type; > - > - gasket_dev = gasket_sysfs_get_device_data(device); > - if (!gasket_dev) { > - dev_err(device, "No sysfs mapping found for device\n"); > - return 0; > - } > - > - gasket_attr = gasket_sysfs_get_attr(device, attr); > - if (!gasket_attr) { > - dev_err(device, "No sysfs attr found for device\n"); > - gasket_sysfs_put_device_data(device, gasket_dev); > - return 0; > - } > - > - driver_desc = gasket_dev->internal_desc->driver_desc; > - > - sysfs_type = > - (enum gasket_sysfs_attribute_type)gasket_attr->data.attr_type; > - switch (sysfs_type) { > - case ATTR_BAR_OFFSETS: > - for (i = 0; i < PCI_STD_NUM_BARS; i++) { > - bar_desc = &driver_desc->bar_descriptions[i]; > - if (bar_desc->size == 0) > - continue; > - current_written = > - snprintf(buf, PAGE_SIZE - ret, "%d: 0x%lx\n", i, > - (ulong)bar_desc->base); > - buf += current_written; > - ret += current_written; > - } > - break; > - case ATTR_BAR_SIZES: > - for (i = 0; i < PCI_STD_NUM_BARS; i++) { > - bar_desc = &driver_desc->bar_descriptions[i]; > - if (bar_desc->size == 0) > - continue; > - current_written = > - snprintf(buf, PAGE_SIZE - ret, "%d: 0x%lx\n", i, > - (ulong)bar_desc->size); > - buf += current_written; > - ret += current_written; > - } > - break; > - case ATTR_DRIVER_VERSION: > - ret = snprintf(buf, PAGE_SIZE, "%s\n", > - gasket_dev->internal_desc->driver_desc->driver_version); > - break; > - case ATTR_FRAMEWORK_VERSION: > - ret = snprintf(buf, PAGE_SIZE, "%s\n", > - GASKET_FRAMEWORK_VERSION); > - break; > - case ATTR_DEVICE_TYPE: > - ret = snprintf(buf, PAGE_SIZE, "%s\n", > - gasket_dev->internal_desc->driver_desc->name); > - break; > - case ATTR_HARDWARE_REVISION: > - ret = snprintf(buf, PAGE_SIZE, "%d\n", > - gasket_dev->hardware_revision); > - break; > - case ATTR_PCI_ADDRESS: > - ret = snprintf(buf, PAGE_SIZE, "%s\n", gasket_dev->kobj_name); > - break; > - case ATTR_STATUS: > - ret = snprintf(buf, PAGE_SIZE, "%s\n", > - gasket_num_name_lookup(gasket_dev->status, > - gasket_status_name_table)); > - break; > - case ATTR_IS_DEVICE_OWNED: > - ret = snprintf(buf, PAGE_SIZE, "%d\n", > - gasket_dev->dev_info.ownership.is_owned); > - break; > - case ATTR_DEVICE_OWNER: > - ret = snprintf(buf, PAGE_SIZE, "%d\n", > - gasket_dev->dev_info.ownership.owner); > - break; > - case ATTR_WRITE_OPEN_COUNT: > - ret = snprintf(buf, PAGE_SIZE, "%d\n", > - gasket_dev->dev_info.ownership.write_open_count); > - break; > - case ATTR_RESET_COUNT: > - ret = snprintf(buf, PAGE_SIZE, "%d\n", gasket_dev->reset_count); > - break; > - case ATTR_USER_MEM_RANGES: > - for (i = 0; i < PCI_STD_NUM_BARS; ++i) { > - current_written = > - gasket_write_mappable_regions(buf, driver_desc, > - i); > - buf += current_written; > - ret += current_written; > - } > - break; > - default: > - dev_dbg(gasket_dev->dev, "Unknown attribute: %s\n", > - attr->attr.name); > - ret = 0; > - break; > - } > - > - gasket_sysfs_put_attr(device, gasket_attr); > - gasket_sysfs_put_device_data(device, gasket_dev); > - return ret; > -} > - > -/* These attributes apply to all Gasket driver instances. */ > -static const struct gasket_sysfs_attribute gasket_sysfs_generic_attrs[] = { > - GASKET_SYSFS_RO(bar_offsets, gasket_sysfs_data_show, ATTR_BAR_OFFSETS), > - GASKET_SYSFS_RO(bar_sizes, gasket_sysfs_data_show, ATTR_BAR_SIZES), > - GASKET_SYSFS_RO(driver_version, gasket_sysfs_data_show, > - ATTR_DRIVER_VERSION), > - GASKET_SYSFS_RO(framework_version, gasket_sysfs_data_show, > - ATTR_FRAMEWORK_VERSION), > - GASKET_SYSFS_RO(device_type, gasket_sysfs_data_show, ATTR_DEVICE_TYPE), > - GASKET_SYSFS_RO(revision, gasket_sysfs_data_show, > - ATTR_HARDWARE_REVISION), > - GASKET_SYSFS_RO(pci_address, gasket_sysfs_data_show, ATTR_PCI_ADDRESS), > - GASKET_SYSFS_RO(status, gasket_sysfs_data_show, ATTR_STATUS), > - GASKET_SYSFS_RO(is_device_owned, gasket_sysfs_data_show, > - ATTR_IS_DEVICE_OWNED), > - GASKET_SYSFS_RO(device_owner, gasket_sysfs_data_show, > - ATTR_DEVICE_OWNER), > - GASKET_SYSFS_RO(write_open_count, gasket_sysfs_data_show, > - ATTR_WRITE_OPEN_COUNT), > - GASKET_SYSFS_RO(reset_count, gasket_sysfs_data_show, ATTR_RESET_COUNT), > - GASKET_SYSFS_RO(user_mem_ranges, gasket_sysfs_data_show, > - ATTR_USER_MEM_RANGES), > - GASKET_END_OF_ATTR_ARRAY > -}; > - > -/* Add a char device and related info. */ > -static int gasket_add_cdev(struct gasket_cdev_info *dev_info, > - const struct file_operations *file_ops, > - struct module *owner) > -{ > - int ret; > - > - cdev_init(&dev_info->cdev, file_ops); > - dev_info->cdev.owner = owner; > - ret = cdev_add(&dev_info->cdev, dev_info->devt, 1); > - if (ret) { > - dev_err(dev_info->gasket_dev_ptr->dev, > - "cannot add char device [ret=%d]\n", ret); > - return ret; > - } > - dev_info->cdev_added = 1; > - > - return 0; > -} > - > -/* Disable device operations. */ > -void gasket_disable_device(struct gasket_dev *gasket_dev) > -{ > - const struct gasket_driver_desc *driver_desc = > - gasket_dev->internal_desc->driver_desc; > - int i; > - > - /* Only delete the device if it has been successfully added. */ > - if (gasket_dev->dev_info.cdev_added) > - cdev_del(&gasket_dev->dev_info.cdev); > - > - gasket_dev->status = GASKET_STATUS_DEAD; > - > - gasket_interrupt_cleanup(gasket_dev); > - > - for (i = 0; i < driver_desc->num_page_tables; ++i) { > - if (gasket_dev->page_table[i]) { > - gasket_page_table_reset(gasket_dev->page_table[i]); > - gasket_page_table_cleanup(gasket_dev->page_table[i]); > - } > - } > -} > -EXPORT_SYMBOL(gasket_disable_device); > - > -/* > - * Registered driver descriptor lookup for PCI devices. > - * > - * Precondition: Called with g_mutex held (to avoid a race on return). > - * Returns NULL if no matching device was found. > - */ > -static struct gasket_internal_desc * > -lookup_pci_internal_desc(struct pci_dev *pci_dev) > -{ > - int i; > - > - __must_hold(&g_mutex); > - for (i = 0; i < GASKET_FRAMEWORK_DESC_MAX; i++) { > - if (g_descs[i].driver_desc && > - g_descs[i].driver_desc->pci_id_table && > - pci_match_id(g_descs[i].driver_desc->pci_id_table, pci_dev)) > - return &g_descs[i]; > - } > - > - return NULL; > -} > - > -/* > - * Verifies that the user has permissions to perform the requested mapping and > - * that the provided descriptor/range is of adequate size to hold the range to > - * be mapped. > - */ > -static bool gasket_mmap_has_permissions(struct gasket_dev *gasket_dev, > - struct vm_area_struct *vma, > - int bar_permissions) > -{ > - int requested_permissions; > - /* Always allow sysadmin to access. */ > - if (capable(CAP_SYS_ADMIN)) > - return true; > - > - /* Never allow non-sysadmins to access to a dead device. */ > - if (gasket_dev->status != GASKET_STATUS_ALIVE) { > - dev_dbg(gasket_dev->dev, "Device is dead.\n"); > - return false; > - } > - > - /* Make sure that no wrong flags are set. */ > - requested_permissions = > - (vma->vm_flags & VM_ACCESS_FLAGS); > - if (requested_permissions & ~(bar_permissions)) { > - dev_dbg(gasket_dev->dev, > - "Attempting to map a region with requested permissions 0x%x, but region has permissions 0x%x.\n", > - requested_permissions, bar_permissions); > - return false; > - } > - > - /* Do not allow a non-owner to write. */ > - if ((vma->vm_flags & VM_WRITE) && > - !gasket_owned_by_current_tgid(&gasket_dev->dev_info)) { > - dev_dbg(gasket_dev->dev, > - "Attempting to mmap a region for write without owning device.\n"); > - return false; > - } > - > - return true; > -} > - > -/* > - * Verifies that the input address is within the region allocated to coherent > - * buffer. > - */ > -static bool > -gasket_is_coherent_region(const struct gasket_driver_desc *driver_desc, > - ulong address) > -{ > - struct gasket_coherent_buffer_desc coh_buff_desc = > - driver_desc->coherent_buffer_description; > - > - if (coh_buff_desc.permissions != GASKET_NOMAP) { > - if ((address >= coh_buff_desc.base) && > - (address < coh_buff_desc.base + coh_buff_desc.size)) { > - return true; > - } > - } > - return false; > -} > - > -static int gasket_get_bar_index(const struct gasket_dev *gasket_dev, > - ulong phys_addr) > -{ > - int i; > - const struct gasket_driver_desc *driver_desc; > - > - driver_desc = gasket_dev->internal_desc->driver_desc; > - for (i = 0; i < PCI_STD_NUM_BARS; ++i) { > - struct gasket_bar_desc bar_desc = > - driver_desc->bar_descriptions[i]; > - > - if (bar_desc.permissions != GASKET_NOMAP) { > - if (phys_addr >= bar_desc.base && > - phys_addr < (bar_desc.base + bar_desc.size)) { > - return i; > - } > - } > - } > - /* If we haven't found the address by now, it is invalid. */ > - return -EINVAL; > -} > - > -/* > - * Sets the actual bounds to map, given the device's mappable region. > - * > - * Given the device's mappable region, along with the user-requested mapping > - * start offset and length of the user region, determine how much of this > - * mappable region can be mapped into the user's region (start/end offsets), > - * and the physical offset (phys_offset) into the BAR where the mapping should > - * begin (either the VMA's or region lower bound). > - * > - * In other words, this calculates the overlap between the VMA > - * (bar_offset, requested_length) and the given gasket_mappable_region. > - * > - * Returns true if there's anything to map, and false otherwise. > - */ > -static bool > -gasket_mm_get_mapping_addrs(const struct gasket_mappable_region *region, > - ulong bar_offset, ulong requested_length, > - struct gasket_mappable_region *mappable_region, > - ulong *virt_offset) > -{ > - ulong range_start = region->start; > - ulong range_length = region->length_bytes; > - ulong range_end = range_start + range_length; > - > - *virt_offset = 0; > - if (bar_offset + requested_length < range_start) { > - /* > - * If the requested region is completely below the range, > - * there is nothing to map. > - */ > - return false; > - } else if (bar_offset <= range_start) { > - /* If the bar offset is below this range's start > - * but the requested length continues into it: > - * 1) Only map starting from the beginning of this > - * range's phys. offset, so we don't map unmappable > - * memory. > - * 2) The length of the virtual memory to not map is the > - * delta between the bar offset and the > - * mappable start (and since the mappable start is > - * bigger, start - req.) > - * 3) The map length is the minimum of the mappable > - * requested length (requested_length - virt_offset) > - * and the actual mappable length of the range. > - */ > - mappable_region->start = range_start; > - *virt_offset = range_start - bar_offset; > - mappable_region->length_bytes = > - min(requested_length - *virt_offset, range_length); > - return true; > - } else if (bar_offset > range_start && > - bar_offset < range_end) { > - /* > - * If the bar offset is within this range: > - * 1) Map starting from the bar offset. > - * 2) Because there is no forbidden memory between the > - * bar offset and the range start, > - * virt_offset is 0. > - * 3) The map length is the minimum of the requested > - * length and the remaining length in the buffer > - * (range_end - bar_offset) > - */ > - mappable_region->start = bar_offset; > - *virt_offset = 0; > - mappable_region->length_bytes = > - min(requested_length, range_end - bar_offset); > - return true; > - } > - > - /* > - * If the requested [start] offset is above range_end, > - * there's nothing to map. > - */ > - return false; > -} > - > -/* > - * Calculates the offset where the VMA range begins in its containing BAR. > - * The offset is written into bar_offset on success. > - * Returns zero on success, anything else on error. > - */ > -static int gasket_mm_vma_bar_offset(const struct gasket_dev *gasket_dev, > - const struct vm_area_struct *vma, > - ulong *bar_offset) > -{ > - ulong raw_offset; > - int bar_index; > - const struct gasket_driver_desc *driver_desc = > - gasket_dev->internal_desc->driver_desc; > - > - raw_offset = (vma->vm_pgoff << PAGE_SHIFT) + > - driver_desc->legacy_mmap_address_offset; > - bar_index = gasket_get_bar_index(gasket_dev, raw_offset); > - if (bar_index < 0) { > - dev_err(gasket_dev->dev, > - "Unable to find matching bar for address 0x%lx\n", > - raw_offset); > - trace_gasket_mmap_exit(bar_index); > - return bar_index; > - } > - *bar_offset = > - raw_offset - driver_desc->bar_descriptions[bar_index].base; > - > - return 0; > -} > - > -int gasket_mm_unmap_region(const struct gasket_dev *gasket_dev, > - struct vm_area_struct *vma, > - const struct gasket_mappable_region *map_region) > -{ > - ulong bar_offset; > - ulong virt_offset; > - struct gasket_mappable_region mappable_region; > - int ret; > - > - if (map_region->length_bytes == 0) > - return 0; > - > - ret = gasket_mm_vma_bar_offset(gasket_dev, vma, &bar_offset); > - if (ret) > - return ret; > - > - if (!gasket_mm_get_mapping_addrs(map_region, bar_offset, > - vma->vm_end - vma->vm_start, > - &mappable_region, &virt_offset)) > - return 1; > - > - /* > - * The length passed to zap_vma_ptes MUST BE A MULTIPLE OF > - * PAGE_SIZE! Trust me. I have the scars. > - * > - * Next multiple of y: ceil_div(x, y) * y > - */ > - zap_vma_ptes(vma, vma->vm_start + virt_offset, > - DIV_ROUND_UP(mappable_region.length_bytes, PAGE_SIZE) * > - PAGE_SIZE); > - return 0; > -} > -EXPORT_SYMBOL(gasket_mm_unmap_region); > - > -/* Maps a virtual address + range to a physical offset of a BAR. */ > -static enum do_map_region_status > -do_map_region(const struct gasket_dev *gasket_dev, struct vm_area_struct *vma, > - struct gasket_mappable_region *mappable_region) > -{ > - /* Maximum size of a single call to io_remap_pfn_range. */ > - /* I pulled this number out of thin air. */ > - const ulong max_chunk_size = 64 * 1024 * 1024; > - ulong chunk_size, mapped_bytes = 0; > - > - const struct gasket_driver_desc *driver_desc = > - gasket_dev->internal_desc->driver_desc; > - > - ulong bar_offset, virt_offset; > - struct gasket_mappable_region region_to_map; > - ulong phys_offset, map_length; > - ulong virt_base, phys_base; > - int bar_index, ret; > - > - ret = gasket_mm_vma_bar_offset(gasket_dev, vma, &bar_offset); > - if (ret) > - return DO_MAP_REGION_INVALID; > - > - if (!gasket_mm_get_mapping_addrs(mappable_region, bar_offset, > - vma->vm_end - vma->vm_start, > - ®ion_to_map, &virt_offset)) > - return DO_MAP_REGION_INVALID; > - phys_offset = region_to_map.start; > - map_length = region_to_map.length_bytes; > - > - virt_base = vma->vm_start + virt_offset; > - bar_index = > - gasket_get_bar_index(gasket_dev, > - (vma->vm_pgoff << PAGE_SHIFT) + > - driver_desc->legacy_mmap_address_offset); > - > - if (bar_index < 0) > - return DO_MAP_REGION_INVALID; > - > - phys_base = gasket_dev->bar_data[bar_index].phys_base + phys_offset; > - while (mapped_bytes < map_length) { > - /* > - * io_remap_pfn_range can take a while, so we chunk its > - * calls and call cond_resched between each. > - */ > - chunk_size = min(max_chunk_size, map_length - mapped_bytes); > - > - cond_resched(); > - ret = io_remap_pfn_range(vma, virt_base + mapped_bytes, > - (phys_base + mapped_bytes) >> > - PAGE_SHIFT, chunk_size, > - vma->vm_page_prot); > - if (ret) { > - dev_err(gasket_dev->dev, > - "Error remapping PFN range.\n"); > - goto fail; > - } > - mapped_bytes += chunk_size; > - } > - > - return DO_MAP_REGION_SUCCESS; > - > -fail: > - /* Unmap the partial chunk we mapped. */ > - mappable_region->length_bytes = mapped_bytes; > - if (gasket_mm_unmap_region(gasket_dev, vma, mappable_region)) > - dev_err(gasket_dev->dev, > - "Error unmapping partial region 0x%lx (0x%lx bytes)\n", > - (ulong)virt_offset, > - (ulong)mapped_bytes); > - > - return DO_MAP_REGION_FAILURE; > -} > - > -/* Map a region of coherent memory. */ > -static int gasket_mmap_coherent(struct gasket_dev *gasket_dev, > - struct vm_area_struct *vma) > -{ > - const struct gasket_driver_desc *driver_desc = > - gasket_dev->internal_desc->driver_desc; > - const ulong requested_length = vma->vm_end - vma->vm_start; > - int ret; > - ulong permissions; > - > - if (requested_length == 0 || requested_length > > - gasket_dev->coherent_buffer.length_bytes) { > - trace_gasket_mmap_exit(-EINVAL); > - return -EINVAL; > - } > - > - permissions = driver_desc->coherent_buffer_description.permissions; > - if (!gasket_mmap_has_permissions(gasket_dev, vma, permissions)) { > - dev_err(gasket_dev->dev, "Permission checking failed.\n"); > - trace_gasket_mmap_exit(-EPERM); > - return -EPERM; > - } > - > - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); > - > - ret = remap_pfn_range(vma, vma->vm_start, > - (gasket_dev->coherent_buffer.phys_base) >> > - PAGE_SHIFT, requested_length, vma->vm_page_prot); > - if (ret) { > - dev_err(gasket_dev->dev, "Error remapping PFN range err=%d.\n", > - ret); > - trace_gasket_mmap_exit(ret); > - return ret; > - } > - > - /* Record the user virtual to dma_address mapping that was > - * created by the kernel. > - */ > - gasket_set_user_virt(gasket_dev, requested_length, > - gasket_dev->coherent_buffer.phys_base, > - vma->vm_start); > - return 0; > -} > - > -/* Map a device's BARs into user space. */ > -static int gasket_mmap(struct file *filp, struct vm_area_struct *vma) > -{ > - int i, ret; > - int bar_index; > - int has_mapped_anything = 0; > - ulong permissions; > - ulong raw_offset, vma_size; > - bool is_coherent_region; > - const struct gasket_driver_desc *driver_desc; > - struct gasket_dev *gasket_dev = (struct gasket_dev *)filp->private_data; > - const struct gasket_bar_desc *bar_desc; > - struct gasket_mappable_region *map_regions = NULL; > - int num_map_regions = 0; > - enum do_map_region_status map_status; > - > - driver_desc = gasket_dev->internal_desc->driver_desc; > - > - if (vma->vm_start & ~PAGE_MASK) { > - dev_err(gasket_dev->dev, > - "Base address not page-aligned: 0x%lx\n", > - vma->vm_start); > - trace_gasket_mmap_exit(-EINVAL); > - return -EINVAL; > - } > - > - /* Calculate the offset of this range into physical mem. */ > - raw_offset = (vma->vm_pgoff << PAGE_SHIFT) + > - driver_desc->legacy_mmap_address_offset; > - vma_size = vma->vm_end - vma->vm_start; > - trace_gasket_mmap_entry(gasket_dev->dev_info.name, raw_offset, > - vma_size); > - > - /* > - * Check if the raw offset is within a bar region. If not, check if it > - * is a coherent region. > - */ > - bar_index = gasket_get_bar_index(gasket_dev, raw_offset); > - is_coherent_region = gasket_is_coherent_region(driver_desc, raw_offset); > - if (bar_index < 0 && !is_coherent_region) { > - dev_err(gasket_dev->dev, > - "Unable to find matching bar for address 0x%lx\n", > - raw_offset); > - trace_gasket_mmap_exit(bar_index); > - return bar_index; > - } > - if (bar_index > 0 && is_coherent_region) { > - dev_err(gasket_dev->dev, > - "double matching bar and coherent buffers for address 0x%lx\n", > - raw_offset); > - trace_gasket_mmap_exit(bar_index); > - return -EINVAL; > - } > - > - vma->vm_private_data = gasket_dev; > - > - if (is_coherent_region) > - return gasket_mmap_coherent(gasket_dev, vma); > - > - /* Everything in the rest of this function is for normal BAR mapping. */ > - > - /* > - * Subtract the base of the bar from the raw offset to get the > - * memory location within the bar to map. > - */ > - bar_desc = &driver_desc->bar_descriptions[bar_index]; > - permissions = bar_desc->permissions; > - if (!gasket_mmap_has_permissions(gasket_dev, vma, permissions)) { > - dev_err(gasket_dev->dev, "Permission checking failed.\n"); > - trace_gasket_mmap_exit(-EPERM); > - return -EPERM; > - } > - > - if (driver_desc->get_mappable_regions_cb) { > - ret = driver_desc->get_mappable_regions_cb(gasket_dev, > - bar_index, > - &map_regions, > - &num_map_regions); > - if (ret) > - return ret; > - } else { > - if (!gasket_mmap_has_permissions(gasket_dev, vma, > - bar_desc->permissions)) { > - dev_err(gasket_dev->dev, > - "Permission checking failed.\n"); > - trace_gasket_mmap_exit(-EPERM); > - return -EPERM; > - } > - num_map_regions = bar_desc->num_mappable_regions; > - map_regions = kcalloc(num_map_regions, > - sizeof(*bar_desc->mappable_regions), > - GFP_KERNEL); > - if (map_regions) { > - memcpy(map_regions, bar_desc->mappable_regions, > - num_map_regions * > - sizeof(*bar_desc->mappable_regions)); > - } > - } > - > - if (!map_regions || num_map_regions == 0) { > - dev_err(gasket_dev->dev, "No mappable regions returned!\n"); > - return -EINVAL; > - } > - > - /* Marks the VMA's pages as uncacheable. */ > - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); > - for (i = 0; i < num_map_regions; i++) { > - map_status = do_map_region(gasket_dev, vma, &map_regions[i]); > - /* Try the next region if this one was not mappable. */ > - if (map_status == DO_MAP_REGION_INVALID) > - continue; > - if (map_status == DO_MAP_REGION_FAILURE) { > - ret = -ENOMEM; > - goto fail; > - } > - > - has_mapped_anything = 1; > - } > - > - kfree(map_regions); > - > - /* If we could not map any memory, the request was invalid. */ > - if (!has_mapped_anything) { > - dev_err(gasket_dev->dev, > - "Map request did not contain a valid region.\n"); > - trace_gasket_mmap_exit(-EINVAL); > - return -EINVAL; > - } > - > - trace_gasket_mmap_exit(0); > - return 0; > - > -fail: > - /* Need to unmap any mapped ranges. */ > - num_map_regions = i; > - for (i = 0; i < num_map_regions; i++) > - if (gasket_mm_unmap_region(gasket_dev, vma, > - &bar_desc->mappable_regions[i])) > - dev_err(gasket_dev->dev, "Error unmapping range %d.\n", > - i); > - kfree(map_regions); > - > - return ret; > -} > - > -/* > - * Open the char device file. > - * > - * If the open is for writing, and the device is not owned, this process becomes > - * the owner. If the open is for writing and the device is already owned by > - * some other process, it is an error. If this process is the owner, increment > - * the open count. > - * > - * Returns 0 if successful, a negative error number otherwise. > - */ > -static int gasket_open(struct inode *inode, struct file *filp) > -{ > - int ret; > - struct gasket_dev *gasket_dev; > - const struct gasket_driver_desc *driver_desc; > - struct gasket_ownership *ownership; > - char task_name[TASK_COMM_LEN]; > - struct gasket_cdev_info *dev_info = > - container_of(inode->i_cdev, struct gasket_cdev_info, cdev); > - struct pid_namespace *pid_ns = task_active_pid_ns(current); > - bool is_root = ns_capable(pid_ns->user_ns, CAP_SYS_ADMIN); > - > - gasket_dev = dev_info->gasket_dev_ptr; > - driver_desc = gasket_dev->internal_desc->driver_desc; > - ownership = &dev_info->ownership; > - get_task_comm(task_name, current); > - filp->private_data = gasket_dev; > - inode->i_size = 0; > - > - dev_dbg(gasket_dev->dev, > - "Attempting to open with tgid %u (%s) (f_mode: 0%03o, fmode_write: %d is_root: %u)\n", > - current->tgid, task_name, filp->f_mode, > - (filp->f_mode & FMODE_WRITE), is_root); > - > - /* Always allow non-writing accesses. */ > - if (!(filp->f_mode & FMODE_WRITE)) { > - dev_dbg(gasket_dev->dev, "Allowing read-only opening.\n"); > - return 0; > - } > - > - mutex_lock(&gasket_dev->mutex); > - > - dev_dbg(gasket_dev->dev, > - "Current owner open count (owning tgid %u): %d.\n", > - ownership->owner, ownership->write_open_count); > - > - /* Opening a node owned by another TGID is an error (unless root) */ > - if (ownership->is_owned && ownership->owner != current->tgid && > - !is_root) { > - dev_err(gasket_dev->dev, > - "Process %u is opening a node held by %u.\n", > - current->tgid, ownership->owner); > - mutex_unlock(&gasket_dev->mutex); > - return -EPERM; > - } > - > - /* If the node is not owned, assign it to the current TGID. */ > - if (!ownership->is_owned) { > - ret = gasket_check_and_invoke_callback_nolock(gasket_dev, > - driver_desc->device_open_cb); > - if (ret) { > - dev_err(gasket_dev->dev, > - "Error in device open cb: %d\n", ret); > - mutex_unlock(&gasket_dev->mutex); > - return ret; > - } > - ownership->is_owned = 1; > - ownership->owner = current->tgid; > - dev_dbg(gasket_dev->dev, "Device owner is now tgid %u\n", > - ownership->owner); > - } > - > - ownership->write_open_count++; > - > - dev_dbg(gasket_dev->dev, "New open count (owning tgid %u): %d\n", > - ownership->owner, ownership->write_open_count); > - > - mutex_unlock(&gasket_dev->mutex); > - return 0; > -} > - > -/* > - * Called on a close of the device file. If this process is the owner, > - * decrement the open count. On last close by the owner, free up buffers and > - * eventfd contexts, and release ownership. > - * > - * Returns 0 if successful, a negative error number otherwise. > - */ > -static int gasket_release(struct inode *inode, struct file *file) > -{ > - int i; > - struct gasket_dev *gasket_dev; > - struct gasket_ownership *ownership; > - const struct gasket_driver_desc *driver_desc; > - char task_name[TASK_COMM_LEN]; > - struct gasket_cdev_info *dev_info = > - container_of(inode->i_cdev, struct gasket_cdev_info, cdev); > - struct pid_namespace *pid_ns = task_active_pid_ns(current); > - bool is_root = ns_capable(pid_ns->user_ns, CAP_SYS_ADMIN); > - > - gasket_dev = dev_info->gasket_dev_ptr; > - driver_desc = gasket_dev->internal_desc->driver_desc; > - ownership = &dev_info->ownership; > - get_task_comm(task_name, current); > - mutex_lock(&gasket_dev->mutex); > - > - dev_dbg(gasket_dev->dev, > - "Releasing device node. Call origin: tgid %u (%s) (f_mode: 0%03o, fmode_write: %d, is_root: %u)\n", > - current->tgid, task_name, file->f_mode, > - (file->f_mode & FMODE_WRITE), is_root); > - dev_dbg(gasket_dev->dev, "Current open count (owning tgid %u): %d\n", > - ownership->owner, ownership->write_open_count); > - > - if (file->f_mode & FMODE_WRITE) { > - ownership->write_open_count--; > - if (ownership->write_open_count == 0) { > - dev_dbg(gasket_dev->dev, "Device is now free\n"); > - ownership->is_owned = 0; > - ownership->owner = 0; > - > - /* Forces chip reset before we unmap the page tables. */ > - driver_desc->device_reset_cb(gasket_dev); > - > - for (i = 0; i < driver_desc->num_page_tables; ++i) { > - gasket_page_table_unmap_all(gasket_dev->page_table[i]); > - gasket_page_table_garbage_collect(gasket_dev->page_table[i]); > - gasket_free_coherent_memory_all(gasket_dev, i); > - } > - > - /* Closes device, enters power save. */ > - gasket_check_and_invoke_callback_nolock(gasket_dev, > - driver_desc->device_close_cb); > - } > - } > - > - dev_dbg(gasket_dev->dev, "New open count (owning tgid %u): %d\n", > - ownership->owner, ownership->write_open_count); > - mutex_unlock(&gasket_dev->mutex); > - return 0; > -} > - > -/* > - * Gasket ioctl dispatch function. > - * > - * Check if the ioctl is a generic ioctl. If not, pass the ioctl to the > - * ioctl_handler_cb registered in the driver description. > - * If the ioctl is a generic ioctl, pass it to gasket_ioctl_handler. > - */ > -static long gasket_ioctl(struct file *filp, uint cmd, ulong arg) > -{ > - struct gasket_dev *gasket_dev; > - const struct gasket_driver_desc *driver_desc; > - void __user *argp = (void __user *)arg; > - char path[256]; > - > - gasket_dev = (struct gasket_dev *)filp->private_data; > - driver_desc = gasket_dev->internal_desc->driver_desc; > - if (!driver_desc) { > - dev_dbg(gasket_dev->dev, > - "Unable to find device descriptor for file %s\n", > - d_path(&filp->f_path, path, 256)); > - return -ENODEV; > - } > - > - if (!gasket_is_supported_ioctl(cmd)) { > - /* > - * The ioctl handler is not a standard Gasket callback, since > - * it requires different arguments. This means we can't use > - * check_and_invoke_callback. > - */ > - if (driver_desc->ioctl_handler_cb) > - return driver_desc->ioctl_handler_cb(filp, cmd, argp); > - > - dev_dbg(gasket_dev->dev, "Received unknown ioctl 0x%x\n", cmd); > - return -EINVAL; > - } > - > - return gasket_handle_ioctl(filp, cmd, argp); > -} > - > -/* File operations for all Gasket devices. */ > -static const struct file_operations gasket_file_ops = { > - .owner = THIS_MODULE, > - .llseek = no_llseek, > - .mmap = gasket_mmap, > - .open = gasket_open, > - .release = gasket_release, > - .unlocked_ioctl = gasket_ioctl, > -}; > - > -/* Perform final init and marks the device as active. */ > -int gasket_enable_device(struct gasket_dev *gasket_dev) > -{ > - int tbl_idx; > - int ret; > - const struct gasket_driver_desc *driver_desc = > - gasket_dev->internal_desc->driver_desc; > - > - ret = gasket_interrupt_init(gasket_dev); > - if (ret) { > - dev_err(gasket_dev->dev, > - "Critical failure to allocate interrupts: %d\n", ret); > - gasket_interrupt_cleanup(gasket_dev); > - return ret; > - } > - > - for (tbl_idx = 0; tbl_idx < driver_desc->num_page_tables; tbl_idx++) { > - dev_dbg(gasket_dev->dev, "Initializing page table %d.\n", > - tbl_idx); > - ret = gasket_page_table_init(&gasket_dev->page_table[tbl_idx], > - &gasket_dev->bar_data[driver_desc->page_table_bar_index], > - &driver_desc->page_table_configs[tbl_idx], > - gasket_dev->dev, > - gasket_dev->pci_dev); > - if (ret) { > - dev_err(gasket_dev->dev, > - "Couldn't init page table %d: %d\n", > - tbl_idx, ret); > - return ret; > - } > - /* > - * Make sure that the page table is clear and set to simple > - * addresses. > - */ > - gasket_page_table_reset(gasket_dev->page_table[tbl_idx]); > - } > - > - /* > - * hardware_revision_cb returns a positive integer (the rev) if > - * successful.) > - */ > - ret = check_and_invoke_callback(gasket_dev, > - driver_desc->hardware_revision_cb); > - if (ret < 0) { > - dev_err(gasket_dev->dev, > - "Error getting hardware revision: %d\n", ret); > - return ret; > - } > - gasket_dev->hardware_revision = ret; > - > - /* device_status_cb returns a device status, not an error code. */ > - gasket_dev->status = gasket_get_hw_status(gasket_dev); > - if (gasket_dev->status == GASKET_STATUS_DEAD) > - dev_err(gasket_dev->dev, "Device reported as unhealthy.\n"); > - > - ret = gasket_add_cdev(&gasket_dev->dev_info, &gasket_file_ops, > - driver_desc->module); > - if (ret) > - return ret; > - > - return 0; > -} > -EXPORT_SYMBOL(gasket_enable_device); > - > -static int __gasket_add_device(struct device *parent_dev, > - struct gasket_internal_desc *internal_desc, > - struct gasket_dev **gasket_devp) > -{ > - int ret; > - struct gasket_dev *gasket_dev; > - const struct gasket_driver_desc *driver_desc = > - internal_desc->driver_desc; > - > - ret = gasket_alloc_dev(internal_desc, parent_dev, &gasket_dev); > - if (ret) > - return ret; > - if (IS_ERR(gasket_dev->dev_info.device)) { > - dev_err(parent_dev, "Cannot create %s device %s [ret = %ld]\n", > - driver_desc->name, gasket_dev->dev_info.name, > - PTR_ERR(gasket_dev->dev_info.device)); > - ret = -ENODEV; > - goto free_gasket_dev; > - } > - > - ret = gasket_sysfs_create_mapping(gasket_dev->dev_info.device, > - gasket_dev); > - if (ret) > - goto remove_device; > - > - ret = gasket_sysfs_create_entries(gasket_dev->dev_info.device, > - gasket_sysfs_generic_attrs); > - if (ret) > - goto remove_sysfs_mapping; > - > - *gasket_devp = gasket_dev; > - return 0; > - > -remove_sysfs_mapping: > - gasket_sysfs_remove_mapping(gasket_dev->dev_info.device); > -remove_device: > - device_destroy(internal_desc->class, gasket_dev->dev_info.devt); > -free_gasket_dev: > - gasket_free_dev(gasket_dev); > - return ret; > -} > - > -static void __gasket_remove_device(struct gasket_internal_desc *internal_desc, > - struct gasket_dev *gasket_dev) > -{ > - gasket_sysfs_remove_mapping(gasket_dev->dev_info.device); > - device_destroy(internal_desc->class, gasket_dev->dev_info.devt); > - gasket_free_dev(gasket_dev); > -} > - > -/* > - * Add PCI gasket device. > - * > - * Called by Gasket device probe function. > - * Allocates device metadata and maps device memory. The device driver must > - * call gasket_enable_device after driver init is complete to place the device > - * in active use. > - */ > -int gasket_pci_add_device(struct pci_dev *pci_dev, > - struct gasket_dev **gasket_devp) > -{ > - int ret; > - struct gasket_internal_desc *internal_desc; > - struct gasket_dev *gasket_dev; > - struct device *parent; > - > - dev_dbg(&pci_dev->dev, "add PCI gasket device\n"); > - > - mutex_lock(&g_mutex); > - internal_desc = lookup_pci_internal_desc(pci_dev); > - mutex_unlock(&g_mutex); > - if (!internal_desc) { > - dev_err(&pci_dev->dev, > - "PCI add device called for unknown driver type\n"); > - return -ENODEV; > - } > - > - parent = &pci_dev->dev; > - ret = __gasket_add_device(parent, internal_desc, &gasket_dev); > - if (ret) > - return ret; > - > - gasket_dev->pci_dev = pci_dev; > - ret = gasket_setup_pci(pci_dev, gasket_dev); > - if (ret) > - goto cleanup_pci; > - > - /* > - * Once we've created the mapping structures successfully, attempt to > - * create a symlink to the pci directory of this object. > - */ > - ret = sysfs_create_link(&gasket_dev->dev_info.device->kobj, > - &pci_dev->dev.kobj, dev_name(&pci_dev->dev)); > - if (ret) { > - dev_err(gasket_dev->dev, > - "Cannot create sysfs pci link: %d\n", ret); > - goto cleanup_pci; > - } > - > - *gasket_devp = gasket_dev; > - return 0; > - > -cleanup_pci: > - gasket_cleanup_pci(gasket_dev); > - __gasket_remove_device(internal_desc, gasket_dev); > - return ret; > -} > -EXPORT_SYMBOL(gasket_pci_add_device); > - > -/* Remove a PCI gasket device. */ > -void gasket_pci_remove_device(struct pci_dev *pci_dev) > -{ > - int i; > - struct gasket_internal_desc *internal_desc; > - struct gasket_dev *gasket_dev = NULL; > - /* Find the device desc. */ > - mutex_lock(&g_mutex); > - internal_desc = lookup_pci_internal_desc(pci_dev); > - if (!internal_desc) { > - mutex_unlock(&g_mutex); > - return; > - } > - mutex_unlock(&g_mutex); > - > - /* Now find the specific device */ > - mutex_lock(&internal_desc->mutex); > - for (i = 0; i < GASKET_DEV_MAX; i++) { > - if (internal_desc->devs[i] && > - internal_desc->devs[i]->pci_dev == pci_dev) { > - gasket_dev = internal_desc->devs[i]; > - break; > - } > - } > - mutex_unlock(&internal_desc->mutex); > - > - if (!gasket_dev) > - return; > - > - dev_dbg(gasket_dev->dev, "remove %s PCI gasket device\n", > - internal_desc->driver_desc->name); > - > - gasket_cleanup_pci(gasket_dev); > - __gasket_remove_device(internal_desc, gasket_dev); > -} > -EXPORT_SYMBOL(gasket_pci_remove_device); > - > -/** > - * Lookup a name by number in a num_name table. > - * @num: Number to lookup. > - * @table: Array of num_name structures, the table for the lookup. > - * > - * Description: Searches for num in the table. If found, the > - * corresponding name is returned; otherwise NULL > - * is returned. > - * > - * The table must have a NULL name pointer at the end. > - */ > -const char *gasket_num_name_lookup(uint num, > - const struct gasket_num_name *table) > -{ > - uint i = 0; > - > - while (table[i].snn_name) { > - if (num == table[i].snn_num) > - break; > - ++i; > - } > - > - return table[i].snn_name; > -} > -EXPORT_SYMBOL(gasket_num_name_lookup); > - > -int gasket_reset(struct gasket_dev *gasket_dev) > -{ > - int ret; > - > - mutex_lock(&gasket_dev->mutex); > - ret = gasket_reset_nolock(gasket_dev); > - mutex_unlock(&gasket_dev->mutex); > - return ret; > -} > -EXPORT_SYMBOL(gasket_reset); > - > -int gasket_reset_nolock(struct gasket_dev *gasket_dev) > -{ > - int ret; > - int i; > - const struct gasket_driver_desc *driver_desc; > - > - driver_desc = gasket_dev->internal_desc->driver_desc; > - if (!driver_desc->device_reset_cb) > - return 0; > - > - ret = driver_desc->device_reset_cb(gasket_dev); > - if (ret) { > - dev_dbg(gasket_dev->dev, "Device reset cb returned %d.\n", > - ret); > - return ret; > - } > - > - /* Reinitialize the page tables and interrupt framework. */ > - for (i = 0; i < driver_desc->num_page_tables; ++i) > - gasket_page_table_reset(gasket_dev->page_table[i]); > - > - ret = gasket_interrupt_reinit(gasket_dev); > - if (ret) { > - dev_dbg(gasket_dev->dev, "Unable to reinit interrupts: %d.\n", > - ret); > - return ret; > - } > - > - /* Get current device health. */ > - gasket_dev->status = gasket_get_hw_status(gasket_dev); > - if (gasket_dev->status == GASKET_STATUS_DEAD) { > - dev_dbg(gasket_dev->dev, "Device reported as dead.\n"); > - return -EINVAL; > - } > - > - return 0; > -} > -EXPORT_SYMBOL(gasket_reset_nolock); > - > -gasket_ioctl_permissions_cb_t > -gasket_get_ioctl_permissions_cb(struct gasket_dev *gasket_dev) > -{ > - return gasket_dev->internal_desc->driver_desc->ioctl_permissions_cb; > -} > -EXPORT_SYMBOL(gasket_get_ioctl_permissions_cb); > - > -/* Get the driver structure for a given gasket_dev. > - * @dev: pointer to gasket_dev, implementing the requested driver. > - */ > -const struct gasket_driver_desc *gasket_get_driver_desc(struct gasket_dev *dev) > -{ > - return dev->internal_desc->driver_desc; > -} > - > -/* Get the device structure for a given gasket_dev. > - * @dev: pointer to gasket_dev, implementing the requested driver. > - */ > -struct device *gasket_get_device(struct gasket_dev *dev) > -{ > - return dev->dev; > -} > - > -/** > - * Asynchronously waits on device. > - * @gasket_dev: Device struct. > - * @bar: Bar > - * @offset: Register offset > - * @mask: Register mask > - * @val: Expected value > - * @max_retries: number of sleep periods > - * @delay_ms: Timeout in milliseconds > - * > - * Description: Busy waits for a specific combination of bits to be set on a > - * Gasket register. > - **/ > -int gasket_wait_with_reschedule(struct gasket_dev *gasket_dev, int bar, > - u64 offset, u64 mask, u64 val, > - uint max_retries, u64 delay_ms) > -{ > - uint retries = 0; > - u64 tmp; > - > - while (retries < max_retries) { > - tmp = gasket_dev_read_64(gasket_dev, bar, offset); > - if ((tmp & mask) == val) > - return 0; > - msleep(delay_ms); > - retries++; > - } > - dev_dbg(gasket_dev->dev, "%s timeout: reg %llx timeout (%llu ms)\n", > - __func__, offset, max_retries * delay_ms); > - return -ETIMEDOUT; > -} > -EXPORT_SYMBOL(gasket_wait_with_reschedule); > - > -/* See gasket_core.h for description. */ > -int gasket_register_device(const struct gasket_driver_desc *driver_desc) > -{ > - int i, ret; > - int desc_idx = -1; > - struct gasket_internal_desc *internal; > - > - pr_debug("Loading %s driver version %s\n", driver_desc->name, > - driver_desc->driver_version); > - /* Check for duplicates and find a free slot. */ > - mutex_lock(&g_mutex); > - > - for (i = 0; i < GASKET_FRAMEWORK_DESC_MAX; i++) { > - if (g_descs[i].driver_desc == driver_desc) { > - pr_err("%s driver already loaded/registered\n", > - driver_desc->name); > - mutex_unlock(&g_mutex); > - return -EBUSY; > - } > - } > - > - /* This and the above loop could be combined, but this reads easier. */ > - for (i = 0; i < GASKET_FRAMEWORK_DESC_MAX; i++) { > - if (!g_descs[i].driver_desc) { > - g_descs[i].driver_desc = driver_desc; > - desc_idx = i; > - break; > - } > - } > - mutex_unlock(&g_mutex); > - > - if (desc_idx == -1) { > - pr_err("too many drivers loaded, max %d\n", > - GASKET_FRAMEWORK_DESC_MAX); > - return -EBUSY; > - } > - > - internal = &g_descs[desc_idx]; > - mutex_init(&internal->mutex); > - memset(internal->devs, 0, sizeof(struct gasket_dev *) * GASKET_DEV_MAX); > - internal->class = > - class_create(driver_desc->module, driver_desc->name); > - > - if (IS_ERR(internal->class)) { > - pr_err("Cannot register %s class [ret=%ld]\n", > - driver_desc->name, PTR_ERR(internal->class)); > - ret = PTR_ERR(internal->class); > - goto unregister_gasket_driver; > - } > - > - ret = register_chrdev_region(MKDEV(driver_desc->major, > - driver_desc->minor), GASKET_DEV_MAX, > - driver_desc->name); > - if (ret) { > - pr_err("cannot register %s char driver [ret=%d]\n", > - driver_desc->name, ret); > - goto destroy_class; > - } > - > - return 0; > - > -destroy_class: > - class_destroy(internal->class); > - > -unregister_gasket_driver: > - mutex_lock(&g_mutex); > - g_descs[desc_idx].driver_desc = NULL; > - mutex_unlock(&g_mutex); > - return ret; > -} > -EXPORT_SYMBOL(gasket_register_device); > - > -/* See gasket_core.h for description. */ > -void gasket_unregister_device(const struct gasket_driver_desc *driver_desc) > -{ > - int i, desc_idx; > - struct gasket_internal_desc *internal_desc = NULL; > - > - mutex_lock(&g_mutex); > - for (i = 0; i < GASKET_FRAMEWORK_DESC_MAX; i++) { > - if (g_descs[i].driver_desc == driver_desc) { > - internal_desc = &g_descs[i]; > - desc_idx = i; > - break; > - } > - } > - > - if (!internal_desc) { > - mutex_unlock(&g_mutex); > - pr_err("request to unregister unknown desc: %s, %d:%d\n", > - driver_desc->name, driver_desc->major, > - driver_desc->minor); > - return; > - } > - > - unregister_chrdev_region(MKDEV(driver_desc->major, driver_desc->minor), > - GASKET_DEV_MAX); > - > - class_destroy(internal_desc->class); > - > - /* Finally, effectively "remove" the driver. */ > - g_descs[desc_idx].driver_desc = NULL; > - mutex_unlock(&g_mutex); > - > - pr_debug("removed %s driver\n", driver_desc->name); > -} > -EXPORT_SYMBOL(gasket_unregister_device); > - > -static int __init gasket_init(void) > -{ > - int i; > - > - mutex_lock(&g_mutex); > - for (i = 0; i < GASKET_FRAMEWORK_DESC_MAX; i++) { > - g_descs[i].driver_desc = NULL; > - mutex_init(&g_descs[i].mutex); > - } > - > - gasket_sysfs_init(); > - > - mutex_unlock(&g_mutex); > - return 0; > -} > - > -MODULE_DESCRIPTION("Google Gasket driver framework"); > -MODULE_VERSION(GASKET_FRAMEWORK_VERSION); > -MODULE_LICENSE("GPL v2"); > -MODULE_AUTHOR("Rob Springer "); > -module_init(gasket_init); > diff --git a/drivers/staging/gasket/gasket_core.h b/drivers/staging/gasket/gasket_core.h > deleted file mode 100644 > index c417acadb0d5..000000000000 > --- a/drivers/staging/gasket/gasket_core.h > +++ /dev/null > @@ -1,638 +0,0 @@ > -/* SPDX-License-Identifier: GPL-2.0 */ > -/* > - * Gasket generic driver. Defines the set of data types and functions necessary > - * to define a driver using the Gasket generic driver framework. > - * > - * Copyright (C) 2018 Google, Inc. > - */ > -#ifndef __GASKET_CORE_H__ > -#define __GASKET_CORE_H__ > - > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > - > -#include "gasket_constants.h" > - > -/** > - * struct gasket_num_name - Map numbers to names. > - * @ein_num: Number. > - * @ein_name: Name associated with the number, a char pointer. > - * > - * This structure maps numbers to names. It is used to provide printable enum > - * names, e.g {0, "DEAD"} or {1, "ALIVE"}. > - */ > -struct gasket_num_name { > - uint snn_num; > - const char *snn_name; > -}; > - > -/* > - * Register location for packed interrupts. > - * Each value indicates the location of an interrupt field (in units of > - * gasket_driver_desc->interrupt_pack_width) within the containing register. > - * In other words, this indicates the shift to use when creating a mask to > - * extract/set bits within a register for a given interrupt. > - */ > -enum gasket_interrupt_packing { > - PACK_0 = 0, > - PACK_1 = 1, > - PACK_2 = 2, > - PACK_3 = 3, > - UNPACKED = 4, > -}; > - > -/* Type of the interrupt supported by the device. */ > -enum gasket_interrupt_type { > - PCI_MSIX = 0, > -}; > - > -/* > - * Used to describe a Gasket interrupt. Contains an interrupt index, a register, > - * and packing data for that interrupt. The register and packing data > - * fields are relevant only for PCI_MSIX interrupt type and can be > - * set to 0 for everything else. > - */ > -struct gasket_interrupt_desc { > - /* Device-wide interrupt index/number. */ > - int index; > - /* The register offset controlling this interrupt. */ > - u64 reg; > - /* The location of this interrupt inside register reg, if packed. */ > - int packing; > -}; > - > -/* > - * This enum is used to identify memory regions being part of the physical > - * memory that belongs to a device. > - */ > -enum mappable_area_type { > - PCI_BAR = 0, /* Default */ > - BUS_REGION, /* For SYSBUS devices, i.e. AXI etc... */ > - COHERENT_MEMORY > -}; > - > -/* > - * Metadata for each BAR mapping. > - * This struct is used so as to track PCI memory, I/O space, AXI and coherent > - * memory area... i.e. memory objects which can be referenced in the device's > - * mmap function. > - */ > -struct gasket_bar_data { > - /* Virtual base address. */ > - u8 __iomem *virt_base; > - > - /* Physical base address. */ > - ulong phys_base; > - > - /* Length of the mapping. */ > - ulong length_bytes; > - > - /* Type of mappable area */ > - enum mappable_area_type type; > -}; > - > -/* Maintains device open ownership data. */ > -struct gasket_ownership { > - /* 1 if the device is owned, 0 otherwise. */ > - int is_owned; > - > - /* TGID of the owner. */ > - pid_t owner; > - > - /* Count of current device opens in write mode. */ > - int write_open_count; > -}; > - > -/* Page table modes of operation. */ > -enum gasket_page_table_mode { > - /* The page table is partitionable as normal, all simple by default. */ > - GASKET_PAGE_TABLE_MODE_NORMAL, > - > - /* All entries are always simple. */ > - GASKET_PAGE_TABLE_MODE_SIMPLE, > - > - /* All entries are always extended. No extended bit is used. */ > - GASKET_PAGE_TABLE_MODE_EXTENDED, > -}; > - > -/* Page table configuration. One per table. */ > -struct gasket_page_table_config { > - /* The identifier/index of this page table. */ > - int id; > - > - /* The operation mode of this page table. */ > - enum gasket_page_table_mode mode; > - > - /* Total (first-level) entries in this page table. */ > - ulong total_entries; > - > - /* Base register for the page table. */ > - int base_reg; > - > - /* > - * Register containing the extended page table. This value is unused in > - * GASKET_PAGE_TABLE_MODE_SIMPLE and GASKET_PAGE_TABLE_MODE_EXTENDED > - * modes. > - */ > - int extended_reg; > - > - /* The bit index indicating whether a PT entry is extended. */ > - int extended_bit; > -}; > - > -/* Maintains information about a device node. */ > -struct gasket_cdev_info { > - /* The internal name of this device. */ > - char name[GASKET_NAME_MAX]; > - > - /* Device number. */ > - dev_t devt; > - > - /* Kernel-internal device structure. */ > - struct device *device; > - > - /* Character device for real. */ > - struct cdev cdev; > - > - /* Flag indicating if cdev_add has been called for the devices. */ > - int cdev_added; > - > - /* Pointer to the overall gasket_dev struct for this device. */ > - struct gasket_dev *gasket_dev_ptr; > - > - /* Ownership data for the device in question. */ > - struct gasket_ownership ownership; > -}; > - > -/* Describes the offset and length of mmapable device BAR regions. */ > -struct gasket_mappable_region { > - u64 start; > - u64 length_bytes; > -}; > - > -/* Describe the offset, size, and permissions for a device bar. */ > -struct gasket_bar_desc { > - /* > - * The size of each PCI BAR range, in bytes. If a value is 0, that BAR > - * will not be mapped into kernel space at all. > - * For devices with 64 bit BARs, only elements 0, 2, and 4 should be > - * populated, and 1, 3, and 5 should be set to 0. > - * For example, for a device mapping 1M in each of the first two 64-bit > - * BARs, this field would be set as { 0x100000, 0, 0x100000, 0, 0, 0 } > - * (one number per bar_desc struct.) > - */ > - u64 size; > - /* The permissions for this bar. (Should be VM_WRITE/VM_READ/VM_EXEC, > - * and can be or'd.) If set to GASKET_NOMAP, the bar will > - * not be used for mmapping. > - */ > - ulong permissions; > - /* The memory address corresponding to the base of this bar, if used. */ > - u64 base; > - /* The number of mappable regions in this bar. */ > - int num_mappable_regions; > - > - /* The mappable subregions of this bar. */ > - const struct gasket_mappable_region *mappable_regions; > - > - /* Type of mappable area */ > - enum mappable_area_type type; > -}; > - > -/* Describes the offset, size, and permissions for a coherent buffer. */ > -struct gasket_coherent_buffer_desc { > - /* The size of the coherent buffer. */ > - u64 size; > - > - /* The permissions for this bar. (Should be VM_WRITE/VM_READ/VM_EXEC, > - * and can be or'd.) If set to GASKET_NOMAP, the bar will > - * not be used for mmaping. > - */ > - ulong permissions; > - > - /* device side address. */ > - u64 base; > -}; > - > -/* Coherent buffer structure. */ > -struct gasket_coherent_buffer { > - /* Virtual base address. */ > - u8 *virt_base; > - > - /* Physical base address. */ > - ulong phys_base; > - > - /* Length of the mapping. */ > - ulong length_bytes; > -}; > - > -/* Description of Gasket-specific permissions in the mmap field. */ > -enum gasket_mapping_options { GASKET_NOMAP = 0 }; > - > -/* This struct represents an undefined bar that should never be mapped. */ > -#define GASKET_UNUSED_BAR \ > - { \ > - 0, GASKET_NOMAP, 0, 0, NULL, 0 \ > - } > - > -/* Internal data for a Gasket device. See gasket_core.c for more information. */ > -struct gasket_internal_desc; > - > -#define MAX_NUM_COHERENT_PAGES 16 > - > -/* > - * Device data for Gasket device instances. > - * > - * This structure contains the data required to manage a Gasket device. > - */ > -struct gasket_dev { > - /* Pointer to the internal driver description for this device. */ > - struct gasket_internal_desc *internal_desc; > - > - /* Device info */ > - struct device *dev; > - > - /* PCI subsystem metadata. */ > - struct pci_dev *pci_dev; > - > - /* This device's index into internal_desc->devs. */ > - int dev_idx; > - > - /* The name of this device, as reported by the kernel. */ > - char kobj_name[GASKET_NAME_MAX]; > - > - /* Virtual address of mapped BAR memory range. */ > - struct gasket_bar_data bar_data[PCI_STD_NUM_BARS]; > - > - /* Coherent buffer. */ > - struct gasket_coherent_buffer coherent_buffer; > - > - /* Number of page tables for this device. */ > - int num_page_tables; > - > - /* Address translations. Page tables have a private implementation. */ > - struct gasket_page_table *page_table[GASKET_MAX_NUM_PAGE_TABLES]; > - > - /* Interrupt data for this device. */ > - struct gasket_interrupt_data *interrupt_data; > - > - /* Status for this device - GASKET_STATUS_ALIVE or _DEAD. */ > - uint status; > - > - /* Number of times this device has been reset. */ > - uint reset_count; > - > - /* Dev information for the cdev node. */ > - struct gasket_cdev_info dev_info; > - > - /* Hardware revision value for this device. */ > - int hardware_revision; > - > - /* Protects access to per-device data (i.e. this structure). */ > - struct mutex mutex; > - > - /* cdev hash tracking/membership structure, Accel and legacy. */ > - /* Unused until Accel is upstreamed. */ > - struct hlist_node hlist_node; > - struct hlist_node legacy_hlist_node; > -}; > - > -/* Type of the ioctl handler callback. */ > -typedef long (*gasket_ioctl_handler_cb_t)(struct file *file, uint cmd, > - void __user *argp); > -/* Type of the ioctl permissions check callback. See below. */ > -typedef int (*gasket_ioctl_permissions_cb_t)(struct file *filp, uint cmd, > - void __user *argp); > - > -/* > - * Device type descriptor. > - * > - * This structure contains device-specific data needed to identify and address a > - * type of device to be administered via the Gasket generic driver. > - * > - * Device IDs are per-driver. In other words, two drivers using the Gasket > - * framework will each have a distinct device 0 (for example). > - */ > -struct gasket_driver_desc { > - /* The name of this device type. */ > - const char *name; > - > - /* The name of this specific device model. */ > - const char *chip_model; > - > - /* The version of the chip specified in chip_model. */ > - const char *chip_version; > - > - /* The version of this driver: "1.0.0", "2.1.3", etc. */ > - const char *driver_version; > - > - /* > - * Non-zero if we should create "legacy" (device and device-class- > - * specific) character devices and sysfs nodes. > - */ > - /* Unused until Accel is upstreamed. */ > - int legacy_support; > - > - /* Major and minor numbers identifying the device. */ > - int major, minor; > - > - /* Module structure for this driver. */ > - struct module *module; > - > - /* PCI ID table. */ > - const struct pci_device_id *pci_id_table; > - > - /* The number of page tables handled by this driver. */ > - int num_page_tables; > - > - /* The index of the bar containing the page tables. */ > - int page_table_bar_index; > - > - /* Registers used to control each page table. */ > - const struct gasket_page_table_config *page_table_configs; > - > - /* The bit index indicating whether a PT entry is extended. */ > - int page_table_extended_bit; > - > - /* > - * Legacy mmap address adjusment for legacy devices only. Should be 0 > - * for any new device. > - */ > - ulong legacy_mmap_address_offset; > - > - /* Set of 6 bar descriptions that describe all PCIe bars. > - * Note that BUS/AXI devices (i.e. non PCI devices) use those. > - */ > - struct gasket_bar_desc bar_descriptions[PCI_STD_NUM_BARS]; > - > - /* > - * Coherent buffer description. > - */ > - struct gasket_coherent_buffer_desc coherent_buffer_description; > - > - /* Interrupt type. (One of gasket_interrupt_type). */ > - int interrupt_type; > - > - /* Index of the bar containing the interrupt registers to program. */ > - int interrupt_bar_index; > - > - /* Number of interrupts in the gasket_interrupt_desc array */ > - int num_interrupts; > - > - /* Description of the interrupts for this device. */ > - const struct gasket_interrupt_desc *interrupts; > - > - /* > - * If this device packs multiple interrupt->MSI-X mappings into a > - * single register (i.e., "uses packed interrupts"), only a single bit > - * width is supported for each interrupt mapping (unpacked/"full-width" > - * interrupts are always supported). This value specifies that width. If > - * packed interrupts are not used, this value is ignored. > - */ > - int interrupt_pack_width; > - > - /* Driver callback functions - all may be NULL */ > - /* > - * device_open_cb: Callback for when a device node is opened in write > - * mode. > - * @dev: The gasket_dev struct for this driver instance. > - * > - * This callback should perform device-specific setup that needs to > - * occur only once when a device is first opened. > - */ > - int (*device_open_cb)(struct gasket_dev *dev); > - > - /* > - * device_release_cb: Callback when a device is closed. > - * @gasket_dev: The gasket_dev struct for this driver instance. > - * > - * This callback is called whenever a device node fd is closed, as > - * opposed to device_close_cb, which is called when the _last_ > - * descriptor for an open file is closed. This call is intended to > - * handle any per-user or per-fd cleanup. > - */ > - int (*device_release_cb)(struct gasket_dev *gasket_dev, > - struct file *file); > - > - /* > - * device_close_cb: Callback for when a device node is closed for the > - * last time. > - * @dev: The gasket_dev struct for this driver instance. > - * > - * This callback should perform device-specific cleanup that only > - * needs to occur when the last reference to a device node is closed. > - * > - * This call is intended to handle and device-wide cleanup, as opposed > - * to per-fd cleanup (which should be handled by device_release_cb). > - */ > - int (*device_close_cb)(struct gasket_dev *dev); > - > - /* > - * get_mappable_regions_cb: Get descriptors of mappable device memory. > - * @gasket_dev: Pointer to the struct gasket_dev for this device. > - * @bar_index: BAR for which to retrieve memory ranges. > - * @mappable_regions: Out-pointer to the list of mappable regions on the > - * device/BAR for this process. > - * @num_mappable_regions: Out-pointer for the size of mappable_regions. > - * > - * Called when handling mmap(), this callback is used to determine which > - * regions of device memory may be mapped by the current process. This > - * information is then compared to mmap request to determine which > - * regions to actually map. > - */ > - int (*get_mappable_regions_cb)(struct gasket_dev *gasket_dev, > - int bar_index, > - struct gasket_mappable_region **mappable_regions, > - int *num_mappable_regions); > - > - /* > - * ioctl_permissions_cb: Check permissions for generic ioctls. > - * @filp: File structure pointer describing this node usage session. > - * @cmd: ioctl number to handle. > - * @arg: ioctl-specific data pointer. > - * > - * Returns 1 if the ioctl may be executed, 0 otherwise. If this callback > - * isn't specified a default routine will be used, that only allows the > - * original device opener (i.e, the "owner") to execute state-affecting > - * ioctls. > - */ > - gasket_ioctl_permissions_cb_t ioctl_permissions_cb; > - > - /* > - * ioctl_handler_cb: Callback to handle device-specific ioctls. > - * @filp: File structure pointer describing this node usage session. > - * @cmd: ioctl number to handle. > - * @arg: ioctl-specific data pointer. > - * > - * Invoked whenever an ioctl is called that the generic Gasket > - * framework doesn't support. If no cb is registered, unknown ioctls > - * return -EINVAL. Should return an error status (either -EINVAL or > - * the error result of the ioctl being handled). > - */ > - gasket_ioctl_handler_cb_t ioctl_handler_cb; > - > - /* > - * device_status_cb: Callback to determine device health. > - * @dev: Pointer to the gasket_dev struct for this device. > - * > - * Called to determine if the device is healthy or not. Should return > - * a member of the gasket_status_type enum. > - * > - */ > - int (*device_status_cb)(struct gasket_dev *dev); > - > - /* > - * hardware_revision_cb: Get the device's hardware revision. > - * @dev: Pointer to the gasket_dev struct for this device. > - * > - * Called to determine the reported rev of the physical hardware. > - * Revision should be >0. A negative return value is an error. > - */ > - int (*hardware_revision_cb)(struct gasket_dev *dev); > - > - /* > - * device_reset_cb: Reset the hardware in question. > - * @dev: Pointer to the gasket_dev structure for this device. > - * > - * Called by reset ioctls. This function should not > - * lock the gasket_dev mutex. It should return 0 on success > - * and an error on failure. > - */ > - int (*device_reset_cb)(struct gasket_dev *dev); > -}; > - > -/* > - * Register the specified device type with the framework. > - * @desc: Populated/initialized device type descriptor. > - * > - * This function does _not_ take ownership of desc; the underlying struct must > - * exist until the matching call to gasket_unregister_device. > - * This function should be called from your driver's module_init function. > - */ > -int gasket_register_device(const struct gasket_driver_desc *desc); > - > -/* > - * Remove the specified device type from the framework. > - * @desc: Descriptor for the device type to unregister; it should have been > - * passed to gasket_register_device in a previous call. > - * > - * This function should be called from your driver's module_exit function. > - */ > -void gasket_unregister_device(const struct gasket_driver_desc *desc); > - > -/* Add a PCI gasket device. */ > -int gasket_pci_add_device(struct pci_dev *pci_dev, > - struct gasket_dev **gasket_devp); > -/* Remove a PCI gasket device. */ > -void gasket_pci_remove_device(struct pci_dev *pci_dev); > - > -/* Enable a Gasket device. */ > -int gasket_enable_device(struct gasket_dev *gasket_dev); > - > -/* Disable a Gasket device. */ > -void gasket_disable_device(struct gasket_dev *gasket_dev); > - > -/* > - * Reset the Gasket device. > - * @gasket_dev: Gasket device struct. > - * > - * Calls device_reset_cb. Returns 0 on success and an error code othewrise. > - * gasket_reset_nolock will not lock the mutex, gasket_reset will. > - * > - */ > -int gasket_reset(struct gasket_dev *gasket_dev); > -int gasket_reset_nolock(struct gasket_dev *gasket_dev); > - > -/* > - * Memory management functions. These will likely be spun off into their own > - * file in the future. > - */ > - > -/* Unmaps the specified mappable region from a VMA. */ > -int gasket_mm_unmap_region(const struct gasket_dev *gasket_dev, > - struct vm_area_struct *vma, > - const struct gasket_mappable_region *map_region); > - > -/* > - * Get the ioctl permissions callback. > - * @gasket_dev: Gasket device structure. > - */ > -gasket_ioctl_permissions_cb_t > -gasket_get_ioctl_permissions_cb(struct gasket_dev *gasket_dev); > - > -/** > - * Lookup a name by number in a num_name table. > - * @num: Number to lookup. > - * @table: Array of num_name structures, the table for the lookup. > - * > - */ > -const char *gasket_num_name_lookup(uint num, > - const struct gasket_num_name *table); > - > -/* Handy inlines */ > -static inline ulong gasket_dev_read_64(struct gasket_dev *gasket_dev, int bar, > - ulong location) > -{ > - return readq_relaxed(&gasket_dev->bar_data[bar].virt_base[location]); > -} > - > -static inline void gasket_dev_write_64(struct gasket_dev *dev, u64 value, > - int bar, ulong location) > -{ > - writeq_relaxed(value, &dev->bar_data[bar].virt_base[location]); > -} > - > -static inline void gasket_dev_write_32(struct gasket_dev *dev, u32 value, > - int bar, ulong location) > -{ > - writel_relaxed(value, &dev->bar_data[bar].virt_base[location]); > -} > - > -static inline u32 gasket_dev_read_32(struct gasket_dev *dev, int bar, > - ulong location) > -{ > - return readl_relaxed(&dev->bar_data[bar].virt_base[location]); > -} > - > -static inline void gasket_read_modify_write_64(struct gasket_dev *dev, int bar, > - ulong location, u64 value, > - u64 mask_width, u64 mask_shift) > -{ > - u64 mask, tmp; > - > - tmp = gasket_dev_read_64(dev, bar, location); > - mask = ((1ULL << mask_width) - 1) << mask_shift; > - tmp = (tmp & ~mask) | (value << mask_shift); > - gasket_dev_write_64(dev, tmp, bar, location); > -} > - > -static inline void gasket_read_modify_write_32(struct gasket_dev *dev, int bar, > - ulong location, u32 value, > - u32 mask_width, u32 mask_shift) > -{ > - u32 mask, tmp; > - > - tmp = gasket_dev_read_32(dev, bar, location); > - mask = ((1 << mask_width) - 1) << mask_shift; > - tmp = (tmp & ~mask) | (value << mask_shift); > - gasket_dev_write_32(dev, tmp, bar, location); > -} > - > -/* Get the Gasket driver structure for a given device. */ > -const struct gasket_driver_desc *gasket_get_driver_desc(struct gasket_dev *dev); > - > -/* Get the device structure for a given device. */ > -struct device *gasket_get_device(struct gasket_dev *dev); > - > -/* Helper function, Asynchronous waits on a given set of bits. */ > -int gasket_wait_with_reschedule(struct gasket_dev *gasket_dev, int bar, > - u64 offset, u64 mask, u64 val, > - uint max_retries, u64 delay_ms); > - > -#endif /* __GASKET_CORE_H__ */ > diff --git a/drivers/staging/gasket/gasket_interrupt.c b/drivers/staging/gasket/gasket_interrupt.c > deleted file mode 100644 > index 864342acfd86..000000000000 > --- a/drivers/staging/gasket/gasket_interrupt.c > +++ /dev/null > @@ -1,515 +0,0 @@ > -// SPDX-License-Identifier: GPL-2.0 > -/* Copyright (C) 2018 Google, Inc. */ > - > -#include "gasket_interrupt.h" > - > -#include "gasket_constants.h" > -#include "gasket_core.h" > -#include "gasket_sysfs.h" > -#include > -#include > -#include > -#ifdef GASKET_KERNEL_TRACE_SUPPORT > -#define CREATE_TRACE_POINTS > -#include > -#else > -#define trace_gasket_interrupt_event(x, ...) > -#endif > -/* Retry attempts if the requested number of interrupts aren't available. */ > -#define MSIX_RETRY_COUNT 3 > - > -/* Instance interrupt management data. */ > -struct gasket_interrupt_data { > - /* The name associated with this interrupt data. */ > - const char *name; > - > - /* Interrupt type. See gasket_interrupt_type in gasket_core.h */ > - int type; > - > - /* The PCI device [if any] associated with the owning device. */ > - struct pci_dev *pci_dev; > - > - /* Set to 1 if MSI-X has successfully been configred, 0 otherwise. */ > - int msix_configured; > - > - /* The number of interrupts requested by the owning device. */ > - int num_interrupts; > - > - /* A pointer to the interrupt descriptor struct for this device. */ > - const struct gasket_interrupt_desc *interrupts; > - > - /* The index of the bar into which interrupts should be mapped. */ > - int interrupt_bar_index; > - > - /* The width of a single interrupt in a packed interrupt register. */ > - int pack_width; > - > - /* > - * Design-wise, these elements should be bundled together, but > - * pci_enable_msix's interface requires that they be managed > - * individually (requires array of struct msix_entry). > - */ > - > - /* The number of successfully configured interrupts. */ > - int num_configured; > - > - /* The MSI-X data for each requested/configured interrupt. */ > - struct msix_entry *msix_entries; > - > - /* The eventfd "callback" data for each interrupt. */ > - struct eventfd_ctx **eventfd_ctxs; > - > - /* The number of times each interrupt has been called. */ > - ulong *interrupt_counts; > - > - /* Linux IRQ number. */ > - int irq; > -}; > - > -/* Structures to display interrupt counts in sysfs. */ > -enum interrupt_sysfs_attribute_type { > - ATTR_INTERRUPT_COUNTS, > -}; > - > -/* Set up device registers for interrupt handling. */ > -static void gasket_interrupt_setup(struct gasket_dev *gasket_dev) > -{ > - int i; > - int pack_shift; > - ulong mask; > - ulong value; > - struct gasket_interrupt_data *interrupt_data = > - gasket_dev->interrupt_data; > - > - if (!interrupt_data) { > - dev_dbg(gasket_dev->dev, "Interrupt data is not initialized\n"); > - return; > - } > - > - dev_dbg(gasket_dev->dev, "Running interrupt setup\n"); > - > - /* Setup the MSIX table. */ > - > - for (i = 0; i < interrupt_data->num_interrupts; i++) { > - /* > - * If the interrupt is not packed, we can write the index into > - * the register directly. If not, we need to deal with a read- > - * modify-write and shift based on the packing index. > - */ > - dev_dbg(gasket_dev->dev, > - "Setting up interrupt index %d with index 0x%llx and packing %d\n", > - interrupt_data->interrupts[i].index, > - interrupt_data->interrupts[i].reg, > - interrupt_data->interrupts[i].packing); > - if (interrupt_data->interrupts[i].packing == UNPACKED) { > - value = interrupt_data->interrupts[i].index; > - } else { > - switch (interrupt_data->interrupts[i].packing) { > - case PACK_0: > - pack_shift = 0; > - break; > - case PACK_1: > - pack_shift = interrupt_data->pack_width; > - break; > - case PACK_2: > - pack_shift = 2 * interrupt_data->pack_width; > - break; > - case PACK_3: > - pack_shift = 3 * interrupt_data->pack_width; > - break; > - default: > - dev_dbg(gasket_dev->dev, > - "Found interrupt description with unknown enum %d\n", > - interrupt_data->interrupts[i].packing); > - return; > - } > - > - mask = ~(0xFFFF << pack_shift); > - value = gasket_dev_read_64(gasket_dev, > - interrupt_data->interrupt_bar_index, > - interrupt_data->interrupts[i].reg); > - value &= mask; > - value |= interrupt_data->interrupts[i].index > - << pack_shift; > - } > - gasket_dev_write_64(gasket_dev, value, > - interrupt_data->interrupt_bar_index, > - interrupt_data->interrupts[i].reg); > - } > -} > - > -static void > -gasket_handle_interrupt(struct gasket_interrupt_data *interrupt_data, > - int interrupt_index) > -{ > - struct eventfd_ctx *ctx; > - > - trace_gasket_interrupt_event(interrupt_data->name, interrupt_index); > - ctx = interrupt_data->eventfd_ctxs[interrupt_index]; > - if (ctx) > - eventfd_signal(ctx, 1); > - > - ++(interrupt_data->interrupt_counts[interrupt_index]); > -} > - > -static irqreturn_t gasket_msix_interrupt_handler(int irq, void *dev_id) > -{ > - struct gasket_interrupt_data *interrupt_data = dev_id; > - int interrupt = -1; > - int i; > - > - /* If this linear lookup is a problem, we can maintain a map/hash. */ > - for (i = 0; i < interrupt_data->num_interrupts; i++) { > - if (interrupt_data->msix_entries[i].vector == irq) { > - interrupt = interrupt_data->msix_entries[i].entry; > - break; > - } > - } > - if (interrupt == -1) { > - pr_err("Received unknown irq %d\n", irq); > - return IRQ_HANDLED; > - } > - gasket_handle_interrupt(interrupt_data, interrupt); > - return IRQ_HANDLED; > -} > - > -static int > -gasket_interrupt_msix_init(struct gasket_interrupt_data *interrupt_data) > -{ > - int ret = 1; > - int i; > - > - interrupt_data->msix_entries = > - kcalloc(interrupt_data->num_interrupts, > - sizeof(*interrupt_data->msix_entries), GFP_KERNEL); > - if (!interrupt_data->msix_entries) > - return -ENOMEM; > - > - for (i = 0; i < interrupt_data->num_interrupts; i++) { > - interrupt_data->msix_entries[i].entry = i; > - interrupt_data->msix_entries[i].vector = 0; > - interrupt_data->eventfd_ctxs[i] = NULL; > - } > - > - /* Retry MSIX_RETRY_COUNT times if not enough IRQs are available. */ > - for (i = 0; i < MSIX_RETRY_COUNT && ret > 0; i++) > - ret = pci_enable_msix_exact(interrupt_data->pci_dev, > - interrupt_data->msix_entries, > - interrupt_data->num_interrupts); > - > - if (ret) > - return ret > 0 ? -EBUSY : ret; > - interrupt_data->msix_configured = 1; > - > - for (i = 0; i < interrupt_data->num_interrupts; i++) { > - ret = request_irq(interrupt_data->msix_entries[i].vector, > - gasket_msix_interrupt_handler, 0, > - interrupt_data->name, interrupt_data); > - > - if (ret) { > - dev_err(&interrupt_data->pci_dev->dev, > - "Cannot get IRQ for interrupt %d, vector %d; " > - "%d\n", > - i, interrupt_data->msix_entries[i].vector, ret); > - return ret; > - } > - > - interrupt_data->num_configured++; > - } > - > - return 0; > -} > - > -/* > - * On QCM DragonBoard, we exit gasket_interrupt_msix_init() and kernel interrupt > - * setup code with MSIX vectors masked. This is wrong because nothing else in > - * the driver will normally touch the MSIX vectors. > - * > - * As a temporary hack, force unmasking there. > - * > - * TODO: Figure out why QCM kernel doesn't unmask the MSIX vectors, after > - * gasket_interrupt_msix_init(), and remove this code. > - */ > -static void force_msix_interrupt_unmasking(struct gasket_dev *gasket_dev) > -{ > - int i; > -#define MSIX_VECTOR_SIZE 16 > -#define MSIX_MASK_BIT_OFFSET 12 > -#define APEX_BAR2_REG_KERNEL_HIB_MSIX_TABLE 0x46800 > - for (i = 0; i < gasket_dev->interrupt_data->num_configured; i++) { > - /* Check if the MSIX vector is unmasked */ > - ulong location = APEX_BAR2_REG_KERNEL_HIB_MSIX_TABLE + > - MSIX_MASK_BIT_OFFSET + i * MSIX_VECTOR_SIZE; > - u32 mask = > - gasket_dev_read_32(gasket_dev, > - gasket_dev->interrupt_data->interrupt_bar_index, > - location); > - if (!(mask & 1)) > - continue; > - /* Unmask the msix vector (clear 32 bits) */ > - gasket_dev_write_32(gasket_dev, 0, > - gasket_dev->interrupt_data->interrupt_bar_index, > - location); > - } > -#undef MSIX_VECTOR_SIZE > -#undef MSIX_MASK_BIT_OFFSET > -#undef APEX_BAR2_REG_KERNEL_HIB_MSIX_TABLE > -} > - > -static ssize_t interrupt_sysfs_show(struct device *device, > - struct device_attribute *attr, char *buf) > -{ > - int i, ret; > - ssize_t written = 0, total_written = 0; > - struct gasket_interrupt_data *interrupt_data; > - struct gasket_dev *gasket_dev; > - struct gasket_sysfs_attribute *gasket_attr; > - enum interrupt_sysfs_attribute_type sysfs_type; > - > - gasket_dev = gasket_sysfs_get_device_data(device); > - if (!gasket_dev) { > - dev_dbg(device, "No sysfs mapping found for device\n"); > - return 0; > - } > - > - gasket_attr = gasket_sysfs_get_attr(device, attr); > - if (!gasket_attr) { > - dev_dbg(device, "No sysfs attr data found for device\n"); > - gasket_sysfs_put_device_data(device, gasket_dev); > - return 0; > - } > - > - sysfs_type = (enum interrupt_sysfs_attribute_type) > - gasket_attr->data.attr_type; > - interrupt_data = gasket_dev->interrupt_data; > - switch (sysfs_type) { > - case ATTR_INTERRUPT_COUNTS: > - for (i = 0; i < interrupt_data->num_interrupts; ++i) { > - written = > - scnprintf(buf, PAGE_SIZE - total_written, > - "0x%02x: %ld\n", i, > - interrupt_data->interrupt_counts[i]); > - total_written += written; > - buf += written; > - } > - ret = total_written; > - break; > - default: > - dev_dbg(gasket_dev->dev, "Unknown attribute: %s\n", > - attr->attr.name); > - ret = 0; > - break; > - } > - > - gasket_sysfs_put_attr(device, gasket_attr); > - gasket_sysfs_put_device_data(device, gasket_dev); > - return ret; > -} > - > -static struct gasket_sysfs_attribute interrupt_sysfs_attrs[] = { > - GASKET_SYSFS_RO(interrupt_counts, interrupt_sysfs_show, > - ATTR_INTERRUPT_COUNTS), > - GASKET_END_OF_ATTR_ARRAY, > -}; > - > -int gasket_interrupt_init(struct gasket_dev *gasket_dev) > -{ > - int ret; > - struct gasket_interrupt_data *interrupt_data; > - const struct gasket_driver_desc *driver_desc = > - gasket_get_driver_desc(gasket_dev); > - > - interrupt_data = kzalloc(sizeof(*interrupt_data), GFP_KERNEL); > - if (!interrupt_data) > - return -ENOMEM; > - gasket_dev->interrupt_data = interrupt_data; > - interrupt_data->name = driver_desc->name; > - interrupt_data->type = driver_desc->interrupt_type; > - interrupt_data->pci_dev = gasket_dev->pci_dev; > - interrupt_data->num_interrupts = driver_desc->num_interrupts; > - interrupt_data->interrupts = driver_desc->interrupts; > - interrupt_data->interrupt_bar_index = driver_desc->interrupt_bar_index; > - interrupt_data->pack_width = driver_desc->interrupt_pack_width; > - interrupt_data->num_configured = 0; > - > - interrupt_data->eventfd_ctxs = > - kcalloc(driver_desc->num_interrupts, > - sizeof(*interrupt_data->eventfd_ctxs), GFP_KERNEL); > - if (!interrupt_data->eventfd_ctxs) { > - kfree(interrupt_data); > - return -ENOMEM; > - } > - > - interrupt_data->interrupt_counts = > - kcalloc(driver_desc->num_interrupts, > - sizeof(*interrupt_data->interrupt_counts), GFP_KERNEL); > - if (!interrupt_data->interrupt_counts) { > - kfree(interrupt_data->eventfd_ctxs); > - kfree(interrupt_data); > - return -ENOMEM; > - } > - > - switch (interrupt_data->type) { > - case PCI_MSIX: > - ret = gasket_interrupt_msix_init(interrupt_data); > - if (ret) > - break; > - force_msix_interrupt_unmasking(gasket_dev); > - break; > - > - default: > - ret = -EINVAL; > - } > - > - if (ret) { > - /* Failing to setup interrupts will cause the device to report > - * GASKET_STATUS_LAMED. But it is not fatal. > - */ > - dev_warn(gasket_dev->dev, > - "Couldn't initialize interrupts: %d\n", ret); > - return 0; > - } > - > - gasket_interrupt_setup(gasket_dev); > - gasket_sysfs_create_entries(gasket_dev->dev_info.device, > - interrupt_sysfs_attrs); > - > - return 0; > -} > - > -static void > -gasket_interrupt_msix_cleanup(struct gasket_interrupt_data *interrupt_data) > -{ > - int i; > - > - for (i = 0; i < interrupt_data->num_configured; i++) > - free_irq(interrupt_data->msix_entries[i].vector, > - interrupt_data); > - interrupt_data->num_configured = 0; > - > - if (interrupt_data->msix_configured) > - pci_disable_msix(interrupt_data->pci_dev); > - interrupt_data->msix_configured = 0; > - kfree(interrupt_data->msix_entries); > -} > - > -int gasket_interrupt_reinit(struct gasket_dev *gasket_dev) > -{ > - int ret; > - > - if (!gasket_dev->interrupt_data) { > - dev_dbg(gasket_dev->dev, > - "Attempted to reinit uninitialized interrupt data\n"); > - return -EINVAL; > - } > - > - switch (gasket_dev->interrupt_data->type) { > - case PCI_MSIX: > - gasket_interrupt_msix_cleanup(gasket_dev->interrupt_data); > - ret = gasket_interrupt_msix_init(gasket_dev->interrupt_data); > - if (ret) > - break; > - force_msix_interrupt_unmasking(gasket_dev); > - break; > - > - default: > - ret = -EINVAL; > - } > - > - if (ret) { > - /* Failing to setup interrupts will cause the device > - * to report GASKET_STATUS_LAMED, but is not fatal. > - */ > - dev_warn(gasket_dev->dev, "Couldn't reinit interrupts: %d\n", > - ret); > - return 0; > - } > - > - gasket_interrupt_setup(gasket_dev); > - > - return 0; > -} > - > -/* See gasket_interrupt.h for description. */ > -int gasket_interrupt_reset_counts(struct gasket_dev *gasket_dev) > -{ > - dev_dbg(gasket_dev->dev, "Clearing interrupt counts\n"); > - memset(gasket_dev->interrupt_data->interrupt_counts, 0, > - gasket_dev->interrupt_data->num_interrupts * > - sizeof(*gasket_dev->interrupt_data->interrupt_counts)); > - return 0; > -} > - > -/* See gasket_interrupt.h for description. */ > -void gasket_interrupt_cleanup(struct gasket_dev *gasket_dev) > -{ > - struct gasket_interrupt_data *interrupt_data = > - gasket_dev->interrupt_data; > - /* > - * It is possible to get an error code from gasket_interrupt_init > - * before interrupt_data has been allocated, so check it. > - */ > - if (!interrupt_data) > - return; > - > - switch (interrupt_data->type) { > - case PCI_MSIX: > - gasket_interrupt_msix_cleanup(interrupt_data); > - break; > - > - default: > - break; > - } > - > - kfree(interrupt_data->interrupt_counts); > - kfree(interrupt_data->eventfd_ctxs); > - kfree(interrupt_data); > - gasket_dev->interrupt_data = NULL; > -} > - > -int gasket_interrupt_system_status(struct gasket_dev *gasket_dev) > -{ > - if (!gasket_dev->interrupt_data) { > - dev_dbg(gasket_dev->dev, "Interrupt data is null\n"); > - return GASKET_STATUS_DEAD; > - } > - > - if (gasket_dev->interrupt_data->num_configured != > - gasket_dev->interrupt_data->num_interrupts) { > - dev_dbg(gasket_dev->dev, > - "Not all interrupts were configured\n"); > - return GASKET_STATUS_LAMED; > - } > - > - return GASKET_STATUS_ALIVE; > -} > - > -int gasket_interrupt_set_eventfd(struct gasket_interrupt_data *interrupt_data, > - int interrupt, int event_fd) > -{ > - struct eventfd_ctx *ctx; > - > - if (interrupt < 0 || interrupt >= interrupt_data->num_interrupts) > - return -EINVAL; > - > - ctx = eventfd_ctx_fdget(event_fd); > - > - if (IS_ERR(ctx)) > - return PTR_ERR(ctx); > - > - interrupt_data->eventfd_ctxs[interrupt] = ctx; > - return 0; > -} > - > -int gasket_interrupt_clear_eventfd(struct gasket_interrupt_data *interrupt_data, > - int interrupt) > -{ > - if (interrupt < 0 || interrupt >= interrupt_data->num_interrupts) > - return -EINVAL; > - > - if (interrupt_data->eventfd_ctxs[interrupt]) { > - eventfd_ctx_put(interrupt_data->eventfd_ctxs[interrupt]); > - interrupt_data->eventfd_ctxs[interrupt] = NULL; > - } > - return 0; > -} > diff --git a/drivers/staging/gasket/gasket_interrupt.h b/drivers/staging/gasket/gasket_interrupt.h > deleted file mode 100644 > index 85526a1374a1..000000000000 > --- a/drivers/staging/gasket/gasket_interrupt.h > +++ /dev/null > @@ -1,95 +0,0 @@ > -/* SPDX-License-Identifier: GPL-2.0 */ > -/* > - * Gasket common interrupt module. Defines functions for enabling > - * eventfd-triggered interrupts between a Gasket device and a host process. > - * > - * Copyright (C) 2018 Google, Inc. > - */ > -#ifndef __GASKET_INTERRUPT_H__ > -#define __GASKET_INTERRUPT_H__ > - > -#include > -#include > - > -#include "gasket_core.h" > - > -/* Note that this currently assumes that device interrupts are a dense set, > - * numbered from 0 - (num_interrupts - 1). Should this have to change, these > - * APIs will have to be updated. > - */ > - > -/* Opaque type used to hold interrupt subsystem data. */ > -struct gasket_interrupt_data; > - > -/* > - * Initialize the interrupt module. > - * @gasket_dev: The Gasket device structure for the device to be initted. > - */ > -int gasket_interrupt_init(struct gasket_dev *gasket_dev); > - > -/* > - * Clean up a device's interrupt structure. > - * @gasket_dev: The Gasket information structure for this device. > - * > - * Cleans up the device's interrupts and deallocates data. > - */ > -void gasket_interrupt_cleanup(struct gasket_dev *gasket_dev); > - > -/* > - * Clean up and re-initialize the MSI-x subsystem. > - * @gasket_dev: The Gasket information structure for this device. > - * > - * Performs a teardown of the MSI-x subsystem and re-initializes it. Does not > - * free the underlying data structures. Returns 0 on success and an error code > - * on error. > - */ > -int gasket_interrupt_reinit(struct gasket_dev *gasket_dev); > - > -/* > - * Reset the counts stored in the interrupt subsystem. > - * @gasket_dev: The Gasket information structure for this device. > - * > - * Sets the counts of all interrupts in the subsystem to 0. > - */ > -int gasket_interrupt_reset_counts(struct gasket_dev *gasket_dev); > - > -/* > - * Associates an eventfd with a device interrupt. > - * @data: Pointer to device interrupt data. > - * @interrupt: The device interrupt to configure. > - * @event_fd: The eventfd to associate with the interrupt. > - * > - * Prepares the host to receive notification of device interrupts by associating > - * event_fd with interrupt. Upon receipt of a device interrupt, event_fd will be > - * signaled, after successful configuration. > - * > - * Returns 0 on success, a negative error code otherwise. > - */ > -int gasket_interrupt_set_eventfd(struct gasket_interrupt_data *interrupt_data, > - int interrupt, int event_fd); > - > -/* > - * Removes an interrupt-eventfd association. > - * @data: Pointer to device interrupt data. > - * @interrupt: The device interrupt to de-associate. > - * > - * Removes any eventfd associated with the specified interrupt, if any. > - */ > -int gasket_interrupt_clear_eventfd(struct gasket_interrupt_data *interrupt_data, > - int interrupt); > - > -/* > - * The below functions exist for backwards compatibility. > - * No new uses should be written. > - */ > -/* > - * Get the health of the interrupt subsystem. > - * @gasket_dev: The Gasket device struct. > - * > - * Returns DEAD if not set up, LAMED if initialization failed, and ALIVE > - * otherwise. > - */ > - > -int gasket_interrupt_system_status(struct gasket_dev *gasket_dev); > - > -#endif > diff --git a/drivers/staging/gasket/gasket_ioctl.c b/drivers/staging/gasket/gasket_ioctl.c > deleted file mode 100644 > index aa65f4fbf860..000000000000 > --- a/drivers/staging/gasket/gasket_ioctl.c > +++ /dev/null > @@ -1,388 +0,0 @@ > -// SPDX-License-Identifier: GPL-2.0 > -/* Copyright (C) 2018 Google, Inc. */ > -#include "gasket.h" > -#include "gasket_ioctl.h" > -#include "gasket_constants.h" > -#include "gasket_core.h" > -#include "gasket_interrupt.h" > -#include "gasket_page_table.h" > -#include > -#include > -#include > -#include > - > -#ifdef GASKET_KERNEL_TRACE_SUPPORT > -#define CREATE_TRACE_POINTS > -#include > -#else > -#define trace_gasket_ioctl_entry(x, ...) > -#define trace_gasket_ioctl_exit(x) > -#define trace_gasket_ioctl_integer_data(x) > -#define trace_gasket_ioctl_eventfd_data(x, ...) > -#define trace_gasket_ioctl_page_table_data(x, ...) > -#define trace_gasket_ioctl_config_coherent_allocator(x, ...) > -#endif > - > -/* Associate an eventfd with an interrupt. */ > -static int gasket_set_event_fd(struct gasket_dev *gasket_dev, > - struct gasket_interrupt_eventfd __user *argp) > -{ > - struct gasket_interrupt_eventfd die; > - > - if (copy_from_user(&die, argp, sizeof(struct gasket_interrupt_eventfd))) > - return -EFAULT; > - > - trace_gasket_ioctl_eventfd_data(die.interrupt, die.event_fd); > - > - return gasket_interrupt_set_eventfd(gasket_dev->interrupt_data, > - die.interrupt, die.event_fd); > -} > - > -/* Read the size of the page table. */ > -static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, > - struct gasket_page_table_ioctl __user *argp) > -{ > - int ret = 0; > - struct gasket_page_table_ioctl ibuf; > - struct gasket_page_table *table; > - > - if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) > - return -EFAULT; > - > - if (ibuf.page_table_index >= gasket_dev->num_page_tables) > - return -EFAULT; > - > - table = gasket_dev->page_table[ibuf.page_table_index]; > - ibuf.size = gasket_page_table_num_entries(table); > - > - trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, > - ibuf.host_address, > - ibuf.device_address); > - > - if (copy_to_user(argp, &ibuf, sizeof(ibuf))) > - return -EFAULT; > - > - return ret; > -} > - > -/* Read the size of the simple page table. */ > -static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev, > - struct gasket_page_table_ioctl __user *argp) > -{ > - int ret = 0; > - struct gasket_page_table_ioctl ibuf; > - struct gasket_page_table *table; > - > - if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) > - return -EFAULT; > - > - if (ibuf.page_table_index >= gasket_dev->num_page_tables) > - return -EFAULT; > - > - table = gasket_dev->page_table[ibuf.page_table_index]; > - ibuf.size = gasket_page_table_num_simple_entries(table); > - > - trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, > - ibuf.host_address, > - ibuf.device_address); > - > - if (copy_to_user(argp, &ibuf, sizeof(ibuf))) > - return -EFAULT; > - > - return ret; > -} > - > -/* Set the boundary between the simple and extended page tables. */ > -static int gasket_partition_page_table(struct gasket_dev *gasket_dev, > - struct gasket_page_table_ioctl __user *argp) > -{ > - int ret; > - struct gasket_page_table_ioctl ibuf; > - uint max_page_table_size; > - struct gasket_page_table *table; > - > - if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) > - return -EFAULT; > - > - trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, > - ibuf.host_address, > - ibuf.device_address); > - > - if (ibuf.page_table_index >= gasket_dev->num_page_tables) > - return -EFAULT; > - table = gasket_dev->page_table[ibuf.page_table_index]; > - max_page_table_size = gasket_page_table_max_size(table); > - > - if (ibuf.size > max_page_table_size) { > - dev_dbg(gasket_dev->dev, > - "Partition request 0x%llx too large, max is 0x%x\n", > - ibuf.size, max_page_table_size); > - return -EINVAL; > - } > - > - mutex_lock(&gasket_dev->mutex); > - > - ret = gasket_page_table_partition(table, ibuf.size); > - mutex_unlock(&gasket_dev->mutex); > - > - return ret; > -} > - > -/* Map a userspace buffer to a device virtual address. */ > -static int gasket_map_buffers(struct gasket_dev *gasket_dev, > - struct gasket_page_table_ioctl __user *argp) > -{ > - struct gasket_page_table_ioctl ibuf; > - struct gasket_page_table *table; > - > - if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) > - return -EFAULT; > - > - trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, > - ibuf.host_address, > - ibuf.device_address); > - > - if (ibuf.page_table_index >= gasket_dev->num_page_tables) > - return -EFAULT; > - > - table = gasket_dev->page_table[ibuf.page_table_index]; > - if (gasket_page_table_are_addrs_bad(table, ibuf.host_address, > - ibuf.device_address, ibuf.size)) > - return -EINVAL; > - > - return gasket_page_table_map(table, ibuf.host_address, ibuf.device_address, > - ibuf.size / PAGE_SIZE); > -} > - > -/* Unmap a userspace buffer from a device virtual address. */ > -static int gasket_unmap_buffers(struct gasket_dev *gasket_dev, > - struct gasket_page_table_ioctl __user *argp) > -{ > - struct gasket_page_table_ioctl ibuf; > - struct gasket_page_table *table; > - > - if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) > - return -EFAULT; > - > - trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, > - ibuf.host_address, > - ibuf.device_address); > - > - if (ibuf.page_table_index >= gasket_dev->num_page_tables) > - return -EFAULT; > - > - table = gasket_dev->page_table[ibuf.page_table_index]; > - if (gasket_page_table_is_dev_addr_bad(table, ibuf.device_address, ibuf.size)) > - return -EINVAL; > - > - gasket_page_table_unmap(table, ibuf.device_address, ibuf.size / PAGE_SIZE); > - > - return 0; > -} > - > -/* > - * Reserve structures for coherent allocation, and allocate or free the > - * corresponding memory. > - */ > -static int gasket_config_coherent_allocator(struct gasket_dev *gasket_dev, > - struct gasket_coherent_alloc_config_ioctl __user *argp) > -{ > - int ret; > - struct gasket_coherent_alloc_config_ioctl ibuf; > - > - if (copy_from_user(&ibuf, argp, > - sizeof(struct gasket_coherent_alloc_config_ioctl))) > - return -EFAULT; > - > - trace_gasket_ioctl_config_coherent_allocator(ibuf.enable, ibuf.size, > - ibuf.dma_address); > - > - if (ibuf.page_table_index >= gasket_dev->num_page_tables) > - return -EFAULT; > - > - if (ibuf.size > PAGE_SIZE * MAX_NUM_COHERENT_PAGES) > - return -ENOMEM; > - > - if (ibuf.enable == 0) { > - ret = gasket_free_coherent_memory(gasket_dev, ibuf.size, > - ibuf.dma_address, > - ibuf.page_table_index); > - } else { > - ret = gasket_alloc_coherent_memory(gasket_dev, ibuf.size, > - &ibuf.dma_address, > - ibuf.page_table_index); > - } > - if (ret) > - return ret; > - if (copy_to_user(argp, &ibuf, sizeof(ibuf))) > - return -EFAULT; > - > - return 0; > -} > - > -/* Check permissions for Gasket ioctls. */ > -static bool gasket_ioctl_check_permissions(struct file *filp, uint cmd) > -{ > - bool alive; > - bool read, write; > - struct gasket_dev *gasket_dev = (struct gasket_dev *)filp->private_data; > - > - alive = (gasket_dev->status == GASKET_STATUS_ALIVE); > - if (!alive) > - dev_dbg(gasket_dev->dev, "%s alive %d status %d\n", > - __func__, alive, gasket_dev->status); > - > - read = !!(filp->f_mode & FMODE_READ); > - write = !!(filp->f_mode & FMODE_WRITE); > - > - switch (cmd) { > - case GASKET_IOCTL_RESET: > - case GASKET_IOCTL_CLEAR_INTERRUPT_COUNTS: > - return write; > - > - case GASKET_IOCTL_PAGE_TABLE_SIZE: > - case GASKET_IOCTL_SIMPLE_PAGE_TABLE_SIZE: > - case GASKET_IOCTL_NUMBER_PAGE_TABLES: > - return read; > - > - case GASKET_IOCTL_PARTITION_PAGE_TABLE: > - case GASKET_IOCTL_CONFIG_COHERENT_ALLOCATOR: > - return alive && write; > - > - case GASKET_IOCTL_MAP_BUFFER: > - case GASKET_IOCTL_UNMAP_BUFFER: > - return alive && write; > - > - case GASKET_IOCTL_CLEAR_EVENTFD: > - case GASKET_IOCTL_SET_EVENTFD: > - return alive && write; > - } > - > - return false; /* unknown permissions */ > -} > - > -/* > - * standard ioctl dispatch function. > - * @filp: File structure pointer describing this node usage session. > - * @cmd: ioctl number to handle. > - * @argp: ioctl-specific data pointer. > - * > - * Standard ioctl dispatcher; forwards operations to individual handlers. > - */ > -long gasket_handle_ioctl(struct file *filp, uint cmd, void __user *argp) > -{ > - struct gasket_dev *gasket_dev; > - unsigned long arg = (unsigned long)argp; > - gasket_ioctl_permissions_cb_t ioctl_permissions_cb; > - int retval; > - > - gasket_dev = (struct gasket_dev *)filp->private_data; > - trace_gasket_ioctl_entry(gasket_dev->dev_info.name, cmd); > - > - ioctl_permissions_cb = gasket_get_ioctl_permissions_cb(gasket_dev); > - if (ioctl_permissions_cb) { > - retval = ioctl_permissions_cb(filp, cmd, argp); > - if (retval < 0) { > - trace_gasket_ioctl_exit(retval); > - return retval; > - } else if (retval == 0) { > - trace_gasket_ioctl_exit(-EPERM); > - return -EPERM; > - } > - } else if (!gasket_ioctl_check_permissions(filp, cmd)) { > - trace_gasket_ioctl_exit(-EPERM); > - dev_dbg(gasket_dev->dev, "ioctl cmd=%x noperm\n", cmd); > - return -EPERM; > - } > - > - /* Tracing happens in this switch statement for all ioctls with > - * an integer argrument, but ioctls with a struct argument > - * that needs copying and decoding, that tracing is done within > - * the handler call. > - */ > - switch (cmd) { > - case GASKET_IOCTL_RESET: > - retval = gasket_reset(gasket_dev); > - break; > - case GASKET_IOCTL_SET_EVENTFD: > - retval = gasket_set_event_fd(gasket_dev, argp); > - break; > - case GASKET_IOCTL_CLEAR_EVENTFD: > - trace_gasket_ioctl_integer_data(arg); > - retval = > - gasket_interrupt_clear_eventfd(gasket_dev->interrupt_data, > - (int)arg); > - break; > - case GASKET_IOCTL_PARTITION_PAGE_TABLE: > - trace_gasket_ioctl_integer_data(arg); > - retval = gasket_partition_page_table(gasket_dev, argp); > - break; > - case GASKET_IOCTL_NUMBER_PAGE_TABLES: > - trace_gasket_ioctl_integer_data(gasket_dev->num_page_tables); > - if (copy_to_user(argp, &gasket_dev->num_page_tables, > - sizeof(uint64_t))) > - retval = -EFAULT; > - else > - retval = 0; > - break; > - case GASKET_IOCTL_PAGE_TABLE_SIZE: > - retval = gasket_read_page_table_size(gasket_dev, argp); > - break; > - case GASKET_IOCTL_SIMPLE_PAGE_TABLE_SIZE: > - retval = gasket_read_simple_page_table_size(gasket_dev, argp); > - break; > - case GASKET_IOCTL_MAP_BUFFER: > - retval = gasket_map_buffers(gasket_dev, argp); > - break; > - case GASKET_IOCTL_CONFIG_COHERENT_ALLOCATOR: > - retval = gasket_config_coherent_allocator(gasket_dev, argp); > - break; > - case GASKET_IOCTL_UNMAP_BUFFER: > - retval = gasket_unmap_buffers(gasket_dev, argp); > - break; > - case GASKET_IOCTL_CLEAR_INTERRUPT_COUNTS: > - /* Clear interrupt counts doesn't take an arg, so use 0. */ > - trace_gasket_ioctl_integer_data(0); > - retval = gasket_interrupt_reset_counts(gasket_dev); > - break; > - default: > - /* If we don't understand the ioctl, the best we can do is trace > - * the arg. > - */ > - trace_gasket_ioctl_integer_data(arg); > - dev_dbg(gasket_dev->dev, > - "Unknown ioctl cmd=0x%x not caught by gasket_is_supported_ioctl\n", > - cmd); > - retval = -EINVAL; > - break; > - } > - > - trace_gasket_ioctl_exit(retval); > - return retval; > -} > - > -/* > - * Determines if an ioctl is part of the standard Gasket framework. > - * @cmd: The ioctl number to handle. > - * > - * Returns 1 if the ioctl is supported and 0 otherwise. > - */ > -long gasket_is_supported_ioctl(uint cmd) > -{ > - switch (cmd) { > - case GASKET_IOCTL_RESET: > - case GASKET_IOCTL_SET_EVENTFD: > - case GASKET_IOCTL_CLEAR_EVENTFD: > - case GASKET_IOCTL_PARTITION_PAGE_TABLE: > - case GASKET_IOCTL_NUMBER_PAGE_TABLES: > - case GASKET_IOCTL_PAGE_TABLE_SIZE: > - case GASKET_IOCTL_SIMPLE_PAGE_TABLE_SIZE: > - case GASKET_IOCTL_MAP_BUFFER: > - case GASKET_IOCTL_UNMAP_BUFFER: > - case GASKET_IOCTL_CLEAR_INTERRUPT_COUNTS: > - case GASKET_IOCTL_CONFIG_COHERENT_ALLOCATOR: > - return 1; > - default: > - return 0; > - } > -} > diff --git a/drivers/staging/gasket/gasket_ioctl.h b/drivers/staging/gasket/gasket_ioctl.h > deleted file mode 100644 > index 51f468c77f04..000000000000 > --- a/drivers/staging/gasket/gasket_ioctl.h > +++ /dev/null > @@ -1,28 +0,0 @@ > -/* SPDX-License-Identifier: GPL-2.0 */ > -/* Copyright (C) 2018 Google, Inc. */ > -#ifndef __GASKET_IOCTL_H__ > -#define __GASKET_IOCTL_H__ > - > -#include "gasket_core.h" > - > -#include > - > -/* > - * Handle Gasket common ioctls. > - * @filp: Pointer to the ioctl's file. > - * @cmd: Ioctl command. > - * @arg: Ioctl argument pointer. > - * > - * Returns 0 on success and nonzero on failure. > - */ > -long gasket_handle_ioctl(struct file *filp, uint cmd, void __user *argp); > - > -/* > - * Determines if an ioctl is part of the standard Gasket framework. > - * @cmd: The ioctl number to handle. > - * > - * Returns 1 if the ioctl is supported and 0 otherwise. > - */ > -long gasket_is_supported_ioctl(uint cmd); > - > -#endif > diff --git a/drivers/staging/gasket/gasket_page_table.c b/drivers/staging/gasket/gasket_page_table.c > deleted file mode 100644 > index 2dbf3d9b8f34..000000000000 > --- a/drivers/staging/gasket/gasket_page_table.c > +++ /dev/null > @@ -1,1357 +0,0 @@ > -// SPDX-License-Identifier: GPL-2.0 > -/* > - * Implementation of Gasket page table support. > - * > - * Copyright (C) 2018 Google, Inc. > - */ > - > -/* > - * Implementation of Gasket page table support. > - * > - * This file assumes 4kB pages throughout; can be factored out when necessary. > - * > - * There is a configurable number of page table entries, as well as a > - * configurable bit index for the extended address flag. Both of these are > - * specified in gasket_page_table_init through the page_table_config parameter. > - * > - * The following example assumes: > - * page_table_config->total_entries = 8192 > - * page_table_config->extended_bit = 63 > - * > - * Address format: > - * Simple addresses - those whose containing pages are directly placed in the > - * device's address translation registers - are laid out as: > - * [ 63 - 25: 0 | 24 - 12: page index | 11 - 0: page offset ] > - * page index: The index of the containing page in the device's address > - * translation registers. > - * page offset: The index of the address into the containing page. > - * > - * Extended address - those whose containing pages are contained in a second- > - * level page table whose address is present in the device's address translation > - * registers - are laid out as: > - * [ 63: flag | 62 - 34: 0 | 33 - 21: dev/level 0 index | > - * 20 - 12: host/level 1 index | 11 - 0: page offset ] > - * flag: Marker indicating that this is an extended address. Always 1. > - * dev index: The index of the first-level page in the device's extended > - * address translation registers. > - * host index: The index of the containing page in the [host-resident] second- > - * level page table. > - * page offset: The index of the address into the containing [second-level] > - * page. > - */ > -#include "gasket_page_table.h" > - > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > - > -#include "gasket_constants.h" > -#include "gasket_core.h" > - > -/* Constants & utility macros */ > -/* The number of pages that can be mapped into each second-level page table. */ > -#define GASKET_PAGES_PER_SUBTABLE 512 > - > -/* The starting position of the page index in a simple virtual address. */ > -#define GASKET_SIMPLE_PAGE_SHIFT 12 > - > -/* Flag indicating that a [device] slot is valid for use. */ > -#define GASKET_VALID_SLOT_FLAG 1 > - > -/* > - * The starting position of the level 0 page index (i.e., the entry in the > - * device's extended address registers) in an extended address. > - * Also can be thought of as (log2(PAGE_SIZE) + log2(PAGES_PER_SUBTABLE)), > - * or (12 + 9). > - */ > -#define GASKET_EXTENDED_LVL0_SHIFT 21 > - > -/* > - * Number of first level pages that Gasket chips support. Equivalent to > - * log2(NUM_LVL0_PAGE_TABLES) > - * > - * At a maximum, allowing for a 34 bits address space (or 16GB) > - * = GASKET_EXTENDED_LVL0_WIDTH + (log2(PAGE_SIZE) + log2(PAGES_PER_SUBTABLE) > - * or, = 13 + 9 + 12 > - */ > -#define GASKET_EXTENDED_LVL0_WIDTH 13 > - > -/* > - * The starting position of the level 1 page index (i.e., the entry in the > - * host second-level/sub- table) in an extended address. > - */ > -#define GASKET_EXTENDED_LVL1_SHIFT 12 > - > -/* Type declarations */ > -/* Valid states for a struct gasket_page_table_entry. */ > -enum pte_status { > - PTE_FREE, > - PTE_INUSE, > -}; > - > -/* > - * Mapping metadata for a single page. > - * > - * In this file, host-side page table entries are referred to as that (or PTEs). > - * Where device vs. host entries are differentiated, device-side or -visible > - * entries are called "slots". A slot may be either an entry in the device's > - * address translation table registers or an entry in a second-level page > - * table ("subtable"). > - * > - * The full data in this structure is visible on the host [of course]. Only > - * the address contained in dma_addr is communicated to the device; that points > - * to the actual page mapped and described by this structure. > - */ > -struct gasket_page_table_entry { > - /* The status of this entry/slot: free or in use. */ > - enum pte_status status; > - > - /* > - * Index for alignment into host vaddrs. > - * When a user specifies a host address for a mapping, that address may > - * not be page-aligned. Offset is the index into the containing page of > - * the host address (i.e., host_vaddr & (PAGE_SIZE - 1)). > - * This is necessary for translating between user-specified addresses > - * and page-aligned addresses. > - */ > - int offset; > - > - /* Address of the page in DMA space. */ > - dma_addr_t dma_addr; > - > - /* Linux page descriptor for the page described by this structure. */ > - struct page *page; > - > - /* > - * If this is an extended and first-level entry, sublevel points > - * to the second-level entries underneath this entry. > - */ > - struct gasket_page_table_entry *sublevel; > -}; > - > -/* > - * Maintains virtual to physical address mapping for a coherent page that is > - * allocated by this module for a given device. > - * Note that coherent pages mappings virt mapping cannot be tracked by the > - * Linux kernel, and coherent pages don't have a struct page associated, > - * hence Linux kernel cannot perform a get_user_page_xx() on a phys address > - * that was allocated coherent. > - * This structure trivially implements this mechanism. > - */ > -struct gasket_coherent_page_entry { > - /* Phys address, dma'able by the owner device */ > - dma_addr_t paddr; > - > - /* Kernel virtual address */ > - u64 user_virt; > - > - /* User virtual address that was mapped by the mmap kernel subsystem */ > - u64 kernel_virt; > - > - /* > - * Whether this page has been mapped into a user land process virtual > - * space > - */ > - u32 in_use; > -}; > - > -/* > - * [Host-side] page table descriptor. > - * > - * This structure tracks the metadata necessary to manage both simple and > - * extended page tables. > - */ > -struct gasket_page_table { > - /* The config used to create this page table. */ > - struct gasket_page_table_config config; > - > - /* The number of simple (single-level) entries in the page table. */ > - uint num_simple_entries; > - > - /* The number of extended (two-level) entries in the page table. */ > - uint num_extended_entries; > - > - /* Array of [host-side] page table entries. */ > - struct gasket_page_table_entry *entries; > - > - /* Number of actively mapped kernel pages in this table. */ > - uint num_active_pages; > - > - /* Device register: base of/first slot in the page table. */ > - u64 __iomem *base_slot; > - > - /* Device register: holds the offset indicating the start of the > - * extended address region of the device's address translation table. > - */ > - u64 __iomem *extended_offset_reg; > - > - /* Device structure for the underlying device. Only used for logging. */ > - struct device *device; > - > - /* PCI system descriptor for the underlying device. */ > - struct pci_dev *pci_dev; > - > - /* Location of the extended address bit for this Gasket device. */ > - u64 extended_flag; > - > - /* Mutex to protect page table internals. */ > - struct mutex mutex; > - > - /* Number of coherent pages accessible thru by this page table */ > - int num_coherent_pages; > - > - /* > - * List of coherent memory (physical) allocated for a device. > - * > - * This structure also remembers the user virtual mapping, this is > - * hacky, but we need to do this because the kernel doesn't keep track > - * of the user coherent pages (pfn pages), and virt to coherent page > - * mapping. > - * TODO: use find_vma() APIs to convert host address to vm_area, to > - * dma_addr_t instead of storing user virtu address in > - * gasket_coherent_page_entry > - * > - * Note that the user virtual mapping is created by the driver, in > - * gasket_mmap function, so user_virt belongs in the driver anyhow. > - */ > - struct gasket_coherent_page_entry *coherent_pages; > -}; > - > -/* See gasket_page_table.h for description. */ > -int gasket_page_table_init(struct gasket_page_table **ppg_tbl, > - const struct gasket_bar_data *bar_data, > - const struct gasket_page_table_config *page_table_config, > - struct device *device, struct pci_dev *pci_dev) > -{ > - ulong bytes; > - struct gasket_page_table *pg_tbl; > - ulong total_entries = page_table_config->total_entries; > - > - /* > - * TODO: Verify config->total_entries against value read from the > - * hardware register that contains the page table size. > - */ > - if (total_entries == ULONG_MAX) { > - dev_dbg(device, > - "Error reading page table size. Initializing page table with size 0\n"); > - total_entries = 0; > - } > - > - dev_dbg(device, > - "Attempting to initialize page table of size 0x%lx\n", > - total_entries); > - > - dev_dbg(device, > - "Table has base reg 0x%x, extended offset reg 0x%x\n", > - page_table_config->base_reg, > - page_table_config->extended_reg); > - > - *ppg_tbl = kzalloc(sizeof(**ppg_tbl), GFP_KERNEL); > - if (!*ppg_tbl) { > - dev_dbg(device, "No memory for page table\n"); > - return -ENOMEM; > - } > - > - pg_tbl = *ppg_tbl; > - bytes = total_entries * sizeof(struct gasket_page_table_entry); > - if (bytes != 0) { > - pg_tbl->entries = vzalloc(bytes); > - if (!pg_tbl->entries) { > - kfree(pg_tbl); > - *ppg_tbl = NULL; > - return -ENOMEM; > - } > - } > - > - mutex_init(&pg_tbl->mutex); > - memcpy(&pg_tbl->config, page_table_config, sizeof(*page_table_config)); > - if (pg_tbl->config.mode == GASKET_PAGE_TABLE_MODE_NORMAL || > - pg_tbl->config.mode == GASKET_PAGE_TABLE_MODE_SIMPLE) { > - pg_tbl->num_simple_entries = total_entries; > - pg_tbl->num_extended_entries = 0; > - pg_tbl->extended_flag = 1ull << page_table_config->extended_bit; > - } else { > - pg_tbl->num_simple_entries = 0; > - pg_tbl->num_extended_entries = total_entries; > - pg_tbl->extended_flag = 0; > - } > - pg_tbl->num_active_pages = 0; > - pg_tbl->base_slot = > - (u64 __iomem *)&bar_data->virt_base[page_table_config->base_reg]; > - pg_tbl->extended_offset_reg = > - (u64 __iomem *)&bar_data->virt_base[page_table_config->extended_reg]; > - pg_tbl->device = get_device(device); > - pg_tbl->pci_dev = pci_dev; > - > - dev_dbg(device, "Page table initialized successfully\n"); > - > - return 0; > -} > - > -/* > - * Check if a range of PTEs is free. > - * The page table mutex must be held by the caller. > - */ > -static bool gasket_is_pte_range_free(struct gasket_page_table_entry *ptes, > - uint num_entries) > -{ > - int i; > - > - for (i = 0; i < num_entries; i++) { > - if (ptes[i].status != PTE_FREE) > - return false; > - } > - > - return true; > -} > - > -/* > - * Free a second level page [sub]table. > - * The page table mutex must be held before this call. > - */ > -static void gasket_free_extended_subtable(struct gasket_page_table *pg_tbl, > - struct gasket_page_table_entry *pte, > - u64 __iomem *slot) > -{ > - /* Release the page table from the driver */ > - pte->status = PTE_FREE; > - > - /* Release the page table from the device */ > - writeq(0, slot); > - > - if (pte->dma_addr) > - dma_unmap_page(pg_tbl->device, pte->dma_addr, PAGE_SIZE, > - DMA_TO_DEVICE); > - > - vfree(pte->sublevel); > - > - if (pte->page) > - free_page((ulong)page_address(pte->page)); > - > - memset(pte, 0, sizeof(struct gasket_page_table_entry)); > -} > - > -/* > - * Actually perform collection. > - * The page table mutex must be held by the caller. > - */ > -static void > -gasket_page_table_garbage_collect_nolock(struct gasket_page_table *pg_tbl) > -{ > - struct gasket_page_table_entry *pte; > - u64 __iomem *slot; > - > - /* XXX FIX ME XXX -- more efficient to keep a usage count */ > - /* rather than scanning the second level page tables */ > - > - for (pte = pg_tbl->entries + pg_tbl->num_simple_entries, > - slot = pg_tbl->base_slot + pg_tbl->num_simple_entries; > - pte < pg_tbl->entries + pg_tbl->config.total_entries; > - pte++, slot++) { > - if (pte->status == PTE_INUSE) { > - if (gasket_is_pte_range_free(pte->sublevel, > - GASKET_PAGES_PER_SUBTABLE)) > - gasket_free_extended_subtable(pg_tbl, pte, > - slot); > - } > - } > -} > - > -/* See gasket_page_table.h for description. */ > -void gasket_page_table_garbage_collect(struct gasket_page_table *pg_tbl) > -{ > - mutex_lock(&pg_tbl->mutex); > - gasket_page_table_garbage_collect_nolock(pg_tbl); > - mutex_unlock(&pg_tbl->mutex); > -} > - > -/* See gasket_page_table.h for description. */ > -void gasket_page_table_cleanup(struct gasket_page_table *pg_tbl) > -{ > - /* Deallocate free second-level tables. */ > - gasket_page_table_garbage_collect(pg_tbl); > - > - /* TODO: Check that all PTEs have been freed? */ > - > - vfree(pg_tbl->entries); > - pg_tbl->entries = NULL; > - > - put_device(pg_tbl->device); > - kfree(pg_tbl); > -} > - > -/* See gasket_page_table.h for description. */ > -int gasket_page_table_partition(struct gasket_page_table *pg_tbl, > - uint num_simple_entries) > -{ > - int i, start; > - > - mutex_lock(&pg_tbl->mutex); > - if (num_simple_entries > pg_tbl->config.total_entries) { > - mutex_unlock(&pg_tbl->mutex); > - return -EINVAL; > - } > - > - gasket_page_table_garbage_collect_nolock(pg_tbl); > - > - start = min(pg_tbl->num_simple_entries, num_simple_entries); > - > - for (i = start; i < pg_tbl->config.total_entries; i++) { > - if (pg_tbl->entries[i].status != PTE_FREE) { > - dev_err(pg_tbl->device, "entry %d is not free\n", i); > - mutex_unlock(&pg_tbl->mutex); > - return -EBUSY; > - } > - } > - > - pg_tbl->num_simple_entries = num_simple_entries; > - pg_tbl->num_extended_entries = > - pg_tbl->config.total_entries - num_simple_entries; > - writeq(num_simple_entries, pg_tbl->extended_offset_reg); > - > - mutex_unlock(&pg_tbl->mutex); > - return 0; > -} > -EXPORT_SYMBOL(gasket_page_table_partition); > - > -/* > - * Return whether a host buffer was mapped as coherent memory. > - * > - * A Gasket page_table currently support one contiguous dma range, mapped to one > - * contiguous virtual memory range. Check if the host_addr is within that range. > - */ > -static int is_coherent(struct gasket_page_table *pg_tbl, ulong host_addr) > -{ > - u64 min, max; > - > - /* whether the host address is within user virt range */ > - if (!pg_tbl->coherent_pages) > - return 0; > - > - min = (u64)pg_tbl->coherent_pages[0].user_virt; > - max = min + PAGE_SIZE * pg_tbl->num_coherent_pages; > - > - return min <= host_addr && host_addr < max; > -} > - > -/* Safely return a page to the OS. */ > -static bool gasket_release_page(struct page *page) > -{ > - if (!page) > - return false; > - > - if (!PageReserved(page)) > - SetPageDirty(page); > - unpin_user_page(page); > - > - return true; > -} > - > -/* > - * Get and map last level page table buffers. > - * > - * slots is the location(s) to write device-mapped page address. If this is a > - * simple mapping, these will be address translation registers. If this is > - * an extended mapping, these will be within a second-level page table > - * allocated by the host and so must have their __iomem attribute casted away. > - */ > -static int gasket_perform_mapping(struct gasket_page_table *pg_tbl, > - struct gasket_page_table_entry *ptes, > - u64 __iomem *slots, ulong host_addr, > - uint num_pages, int is_simple_mapping) > -{ > - int ret; > - ulong offset; > - struct page *page; > - dma_addr_t dma_addr; > - ulong page_addr; > - int i; > - > - for (i = 0; i < num_pages; i++) { > - page_addr = host_addr + i * PAGE_SIZE; > - offset = page_addr & (PAGE_SIZE - 1); > - if (is_coherent(pg_tbl, host_addr)) { > - u64 off = > - (u64)host_addr - > - (u64)pg_tbl->coherent_pages[0].user_virt; > - ptes[i].page = NULL; > - ptes[i].offset = offset; > - ptes[i].dma_addr = pg_tbl->coherent_pages[0].paddr + > - off + i * PAGE_SIZE; > - } else { > - ret = pin_user_pages_fast(page_addr - offset, 1, > - FOLL_WRITE, &page); > - > - if (ret <= 0) { > - dev_err(pg_tbl->device, > - "pin user pages failed for addr=0x%lx, offset=0x%lx [ret=%d]\n", > - page_addr, offset, ret); > - return ret ? ret : -ENOMEM; > - } > - ++pg_tbl->num_active_pages; > - > - ptes[i].page = page; > - ptes[i].offset = offset; > - > - /* Map the page into DMA space. */ > - ptes[i].dma_addr = > - dma_map_page(pg_tbl->device, page, 0, PAGE_SIZE, > - DMA_BIDIRECTIONAL); > - > - if (dma_mapping_error(pg_tbl->device, > - ptes[i].dma_addr)) { > - if (gasket_release_page(ptes[i].page)) > - --pg_tbl->num_active_pages; > - > - memset(&ptes[i], 0, > - sizeof(struct gasket_page_table_entry)); > - return -EINVAL; > - } > - } > - > - /* Make the DMA-space address available to the device. */ > - dma_addr = (ptes[i].dma_addr + offset) | GASKET_VALID_SLOT_FLAG; > - > - if (is_simple_mapping) { > - writeq(dma_addr, &slots[i]); > - } else { > - ((u64 __force *)slots)[i] = dma_addr; > - /* Extended page table vectors are in DRAM, > - * and so need to be synced each time they are updated. > - */ > - dma_map_single(pg_tbl->device, > - (void *)&((u64 __force *)slots)[i], > - sizeof(u64), DMA_TO_DEVICE); > - } > - ptes[i].status = PTE_INUSE; > - } > - return 0; > -} > - > -/* > - * Return the index of the page for the address in the simple table. > - * Does not perform validity checking. > - */ > -static int gasket_simple_page_idx(struct gasket_page_table *pg_tbl, > - ulong dev_addr) > -{ > - return (dev_addr >> GASKET_SIMPLE_PAGE_SHIFT) & > - (pg_tbl->config.total_entries - 1); > -} > - > -/* > - * Return the level 0 page index for the given address. > - * Does not perform validity checking. > - */ > -static ulong gasket_extended_lvl0_page_idx(struct gasket_page_table *pg_tbl, > - ulong dev_addr) > -{ > - return (dev_addr >> GASKET_EXTENDED_LVL0_SHIFT) & > - (pg_tbl->config.total_entries - 1); > -} > - > -/* > - * Return the level 1 page index for the given address. > - * Does not perform validity checking. > - */ > -static ulong gasket_extended_lvl1_page_idx(struct gasket_page_table *pg_tbl, > - ulong dev_addr) > -{ > - return (dev_addr >> GASKET_EXTENDED_LVL1_SHIFT) & > - (GASKET_PAGES_PER_SUBTABLE - 1); > -} > - > -/* > - * Allocate page table entries in a simple table. > - * The page table mutex must be held by the caller. > - */ > -static int gasket_alloc_simple_entries(struct gasket_page_table *pg_tbl, > - ulong dev_addr, uint num_pages) > -{ > - if (!gasket_is_pte_range_free(pg_tbl->entries + > - gasket_simple_page_idx(pg_tbl, dev_addr), > - num_pages)) > - return -EBUSY; > - > - return 0; > -} > - > -/* > - * Unmap and release mapped pages. > - * The page table mutex must be held by the caller. > - */ > -static void gasket_perform_unmapping(struct gasket_page_table *pg_tbl, > - struct gasket_page_table_entry *ptes, > - u64 __iomem *slots, uint num_pages, > - int is_simple_mapping) > -{ > - int i; > - /* > - * For each page table entry and corresponding entry in the device's > - * address translation table: > - */ > - for (i = 0; i < num_pages; i++) { > - /* release the address from the device, */ > - if (is_simple_mapping || ptes[i].status == PTE_INUSE) { > - writeq(0, &slots[i]); > - } else { > - ((u64 __force *)slots)[i] = 0; > - /* sync above PTE update before updating mappings */ > - wmb(); > - } > - > - /* release the address from the driver, */ > - if (ptes[i].status == PTE_INUSE) { > - if (ptes[i].page && ptes[i].dma_addr) { > - dma_unmap_page(pg_tbl->device, ptes[i].dma_addr, > - PAGE_SIZE, DMA_BIDIRECTIONAL); > - } > - if (gasket_release_page(ptes[i].page)) > - --pg_tbl->num_active_pages; > - } > - > - /* and clear the PTE. */ > - memset(&ptes[i], 0, sizeof(struct gasket_page_table_entry)); > - } > -} > - > -/* > - * Unmap and release pages mapped to simple addresses. > - * The page table mutex must be held by the caller. > - */ > -static void gasket_unmap_simple_pages(struct gasket_page_table *pg_tbl, > - ulong dev_addr, uint num_pages) > -{ > - uint slot = gasket_simple_page_idx(pg_tbl, dev_addr); > - > - gasket_perform_unmapping(pg_tbl, pg_tbl->entries + slot, > - pg_tbl->base_slot + slot, num_pages, 1); > -} > - > -/* > - * Unmap and release buffers to extended addresses. > - * The page table mutex must be held by the caller. > - */ > -static void gasket_unmap_extended_pages(struct gasket_page_table *pg_tbl, > - ulong dev_addr, uint num_pages) > -{ > - uint slot_idx, remain, len; > - struct gasket_page_table_entry *pte; > - u64 __iomem *slot_base; > - > - remain = num_pages; > - slot_idx = gasket_extended_lvl1_page_idx(pg_tbl, dev_addr); > - pte = pg_tbl->entries + pg_tbl->num_simple_entries + > - gasket_extended_lvl0_page_idx(pg_tbl, dev_addr); > - > - while (remain > 0) { > - /* TODO: Add check to ensure pte remains valid? */ > - len = min(remain, GASKET_PAGES_PER_SUBTABLE - slot_idx); > - > - if (pte->status == PTE_INUSE) { > - slot_base = (u64 __iomem *)(page_address(pte->page) + > - pte->offset); > - gasket_perform_unmapping(pg_tbl, > - pte->sublevel + slot_idx, > - slot_base + slot_idx, len, 0); > - } > - > - remain -= len; > - slot_idx = 0; > - pte++; > - } > -} > - > -/* Evaluates to nonzero if the specified virtual address is simple. */ > -static inline bool gasket_addr_is_simple(struct gasket_page_table *pg_tbl, > - ulong addr) > -{ > - return !((addr) & (pg_tbl)->extended_flag); > -} > - > -/* > - * Convert (simple, page, offset) into a device address. > - * Examples: > - * Simple page 0, offset 32: > - * Input (1, 0, 32), Output 0x20 > - * Simple page 1000, offset 511: > - * Input (1, 1000, 511), Output 0x3E81FF > - * Extended page 0, offset 32: > - * Input (0, 0, 32), Output 0x8000000020 > - * Extended page 1000, offset 511: > - * Input (0, 1000, 511), Output 0x8003E81FF > - */ > -static ulong gasket_components_to_dev_address(struct gasket_page_table *pg_tbl, > - int is_simple, uint page_index, > - uint offset) > -{ > - ulong dev_addr = (page_index << GASKET_SIMPLE_PAGE_SHIFT) | offset; > - > - return is_simple ? dev_addr : (pg_tbl->extended_flag | dev_addr); > -} > - > -/* > - * Validity checking for simple addresses. > - * > - * Verify that address translation commutes (from address to/from page + offset) > - * and that the requested page range starts and ends within the set of > - * currently-partitioned simple pages. > - */ > -static bool gasket_is_simple_dev_addr_bad(struct gasket_page_table *pg_tbl, > - ulong dev_addr, uint num_pages) > -{ > - ulong page_offset = dev_addr & (PAGE_SIZE - 1); > - ulong page_index = > - (dev_addr / PAGE_SIZE) & (pg_tbl->config.total_entries - 1); > - > - if (gasket_components_to_dev_address(pg_tbl, 1, page_index, > - page_offset) != dev_addr) { > - dev_err(pg_tbl->device, "address is invalid, 0x%lX\n", > - dev_addr); > - return true; > - } > - > - if (page_index >= pg_tbl->num_simple_entries) { > - dev_err(pg_tbl->device, > - "starting slot at %lu is too large, max is < %u\n", > - page_index, pg_tbl->num_simple_entries); > - return true; > - } > - > - if (page_index + num_pages > pg_tbl->num_simple_entries) { > - dev_err(pg_tbl->device, > - "ending slot at %lu is too large, max is <= %u\n", > - page_index + num_pages, pg_tbl->num_simple_entries); > - return true; > - } > - > - return false; > -} > - > -/* > - * Validity checking for extended addresses. > - * > - * Verify that address translation commutes (from address to/from page + > - * offset) and that the requested page range starts and ends within the set of > - * currently-partitioned extended pages. > - */ > -static bool gasket_is_extended_dev_addr_bad(struct gasket_page_table *pg_tbl, > - ulong dev_addr, uint num_pages) > -{ > - /* Starting byte index of dev_addr into the first mapped page */ > - ulong page_offset = dev_addr & (PAGE_SIZE - 1); > - ulong page_global_idx, page_lvl0_idx; > - ulong num_lvl0_pages; > - ulong addr; > - > - /* check if the device address is out of bound */ > - addr = dev_addr & ~((pg_tbl)->extended_flag); > - if (addr >> (GASKET_EXTENDED_LVL0_WIDTH + GASKET_EXTENDED_LVL0_SHIFT)) { > - dev_err(pg_tbl->device, "device address out of bounds: 0x%lx\n", > - dev_addr); > - return true; > - } > - > - /* Find the starting sub-page index in the space of all sub-pages. */ > - page_global_idx = (dev_addr / PAGE_SIZE) & > - (pg_tbl->config.total_entries * GASKET_PAGES_PER_SUBTABLE - 1); > - > - /* Find the starting level 0 index. */ > - page_lvl0_idx = gasket_extended_lvl0_page_idx(pg_tbl, dev_addr); > - > - /* Get the count of affected level 0 pages. */ > - num_lvl0_pages = DIV_ROUND_UP(num_pages, GASKET_PAGES_PER_SUBTABLE); > - > - if (gasket_components_to_dev_address(pg_tbl, 0, page_global_idx, > - page_offset) != dev_addr) { > - dev_err(pg_tbl->device, "address is invalid: 0x%lx\n", > - dev_addr); > - return true; > - } > - > - if (page_lvl0_idx >= pg_tbl->num_extended_entries) { > - dev_err(pg_tbl->device, > - "starting level 0 slot at %lu is too large, max is < %u\n", > - page_lvl0_idx, pg_tbl->num_extended_entries); > - return true; > - } > - > - if (page_lvl0_idx + num_lvl0_pages > pg_tbl->num_extended_entries) { > - dev_err(pg_tbl->device, > - "ending level 0 slot at %lu is too large, max is <= %u\n", > - page_lvl0_idx + num_lvl0_pages, > - pg_tbl->num_extended_entries); > - return true; > - } > - > - return false; > -} > - > -/* > - * Non-locking entry to unmapping routines. > - * The page table mutex must be held by the caller. > - */ > -static void gasket_page_table_unmap_nolock(struct gasket_page_table *pg_tbl, > - ulong dev_addr, uint num_pages) > -{ > - if (!num_pages) > - return; > - > - if (gasket_addr_is_simple(pg_tbl, dev_addr)) > - gasket_unmap_simple_pages(pg_tbl, dev_addr, num_pages); > - else > - gasket_unmap_extended_pages(pg_tbl, dev_addr, num_pages); > -} > - > -/* > - * Allocate and map pages to simple addresses. > - * If there is an error, no pages are mapped. > - */ > -static int gasket_map_simple_pages(struct gasket_page_table *pg_tbl, > - ulong host_addr, ulong dev_addr, > - uint num_pages) > -{ > - int ret; > - uint slot_idx = gasket_simple_page_idx(pg_tbl, dev_addr); > - > - ret = gasket_alloc_simple_entries(pg_tbl, dev_addr, num_pages); > - if (ret) { > - dev_err(pg_tbl->device, > - "page table slots %u (@ 0x%lx) to %u are not available\n", > - slot_idx, dev_addr, slot_idx + num_pages - 1); > - return ret; > - } > - > - ret = gasket_perform_mapping(pg_tbl, pg_tbl->entries + slot_idx, > - pg_tbl->base_slot + slot_idx, host_addr, > - num_pages, 1); > - > - if (ret) { > - gasket_page_table_unmap_nolock(pg_tbl, dev_addr, num_pages); > - dev_err(pg_tbl->device, "gasket_perform_mapping %d\n", ret); > - } > - return ret; > -} > - > -/* > - * Allocate a second level page table. > - * The page table mutex must be held by the caller. > - */ > -static int gasket_alloc_extended_subtable(struct gasket_page_table *pg_tbl, > - struct gasket_page_table_entry *pte, > - u64 __iomem *slot) > -{ > - ulong page_addr, subtable_bytes; > - dma_addr_t dma_addr; > - > - /* XXX FIX ME XXX this is inefficient for non-4K page sizes */ > - > - /* GFP_DMA flag must be passed to architectures for which > - * part of the memory range is not considered DMA'able. > - * This seems to be the case for Juno board with 4.5.0 Linaro kernel > - */ > - page_addr = get_zeroed_page(GFP_KERNEL | GFP_DMA); > - if (!page_addr) > - return -ENOMEM; > - pte->page = virt_to_page((void *)page_addr); > - pte->offset = 0; > - > - subtable_bytes = sizeof(struct gasket_page_table_entry) * > - GASKET_PAGES_PER_SUBTABLE; > - pte->sublevel = vzalloc(subtable_bytes); > - if (!pte->sublevel) { > - free_page(page_addr); > - memset(pte, 0, sizeof(struct gasket_page_table_entry)); > - return -ENOMEM; > - } > - > - /* Map the page into DMA space. */ > - pte->dma_addr = dma_map_page(pg_tbl->device, pte->page, 0, PAGE_SIZE, > - DMA_TO_DEVICE); > - if (dma_mapping_error(pg_tbl->device, pte->dma_addr)) { > - free_page(page_addr); > - vfree(pte->sublevel); > - memset(pte, 0, sizeof(struct gasket_page_table_entry)); > - return -ENOMEM; > - } > - > - /* make the addresses available to the device */ > - dma_addr = (pte->dma_addr + pte->offset) | GASKET_VALID_SLOT_FLAG; > - writeq(dma_addr, slot); > - > - pte->status = PTE_INUSE; > - > - return 0; > -} > - > -/* > - * Allocate slots in an extended page table. Check to see if a range of page > - * table slots are available. If necessary, memory is allocated for second level > - * page tables. > - * > - * Note that memory for second level page tables is allocated as needed, but > - * that memory is only freed on the final close of the device file, when the > - * page tables are repartitioned, or the device is removed. If there is an > - * error or if the full range of slots is not available, any memory > - * allocated for second level page tables remains allocated until final close, > - * repartition, or device removal. > - * > - * The page table mutex must be held by the caller. > - */ > -static int gasket_alloc_extended_entries(struct gasket_page_table *pg_tbl, > - ulong dev_addr, uint num_entries) > -{ > - int ret = 0; > - uint remain, subtable_slot_idx, len; > - struct gasket_page_table_entry *pte; > - u64 __iomem *slot; > - > - remain = num_entries; > - subtable_slot_idx = gasket_extended_lvl1_page_idx(pg_tbl, dev_addr); > - pte = pg_tbl->entries + pg_tbl->num_simple_entries + > - gasket_extended_lvl0_page_idx(pg_tbl, dev_addr); > - slot = pg_tbl->base_slot + pg_tbl->num_simple_entries + > - gasket_extended_lvl0_page_idx(pg_tbl, dev_addr); > - > - while (remain > 0) { > - len = min(remain, > - GASKET_PAGES_PER_SUBTABLE - subtable_slot_idx); > - > - if (pte->status == PTE_FREE) { > - ret = gasket_alloc_extended_subtable(pg_tbl, pte, slot); > - if (ret) { > - dev_err(pg_tbl->device, > - "no memory for extended addr subtable\n"); > - return ret; > - } > - } else { > - if (!gasket_is_pte_range_free(pte->sublevel + > - subtable_slot_idx, len)) > - return -EBUSY; > - } > - > - remain -= len; > - subtable_slot_idx = 0; > - pte++; > - slot++; > - } > - > - return 0; > -} > - > -/* > - * gasket_map_extended_pages - Get and map buffers to extended addresses. > - * If there is an error, no pages are mapped. > - */ > -static int gasket_map_extended_pages(struct gasket_page_table *pg_tbl, > - ulong host_addr, ulong dev_addr, > - uint num_pages) > -{ > - int ret; > - ulong dev_addr_end; > - uint slot_idx, remain, len; > - struct gasket_page_table_entry *pte; > - u64 __iomem *slot_base; > - > - ret = gasket_alloc_extended_entries(pg_tbl, dev_addr, num_pages); > - if (ret) { > - dev_addr_end = dev_addr + (num_pages / PAGE_SIZE) - 1; > - dev_err(pg_tbl->device, > - "page table slots (%lu,%lu) (@ 0x%lx) to (%lu,%lu) are not available\n", > - gasket_extended_lvl0_page_idx(pg_tbl, dev_addr), > - dev_addr, > - gasket_extended_lvl1_page_idx(pg_tbl, dev_addr), > - gasket_extended_lvl0_page_idx(pg_tbl, dev_addr_end), > - gasket_extended_lvl1_page_idx(pg_tbl, dev_addr_end)); > - return ret; > - } > - > - remain = num_pages; > - slot_idx = gasket_extended_lvl1_page_idx(pg_tbl, dev_addr); > - pte = pg_tbl->entries + pg_tbl->num_simple_entries + > - gasket_extended_lvl0_page_idx(pg_tbl, dev_addr); > - > - while (remain > 0) { > - len = min(remain, GASKET_PAGES_PER_SUBTABLE - slot_idx); > - > - slot_base = > - (u64 __iomem *)(page_address(pte->page) + pte->offset); > - ret = gasket_perform_mapping(pg_tbl, pte->sublevel + slot_idx, > - slot_base + slot_idx, host_addr, > - len, 0); > - if (ret) { > - gasket_page_table_unmap_nolock(pg_tbl, dev_addr, > - num_pages); > - return ret; > - } > - > - remain -= len; > - slot_idx = 0; > - pte++; > - host_addr += len * PAGE_SIZE; > - } > - > - return 0; > -} > - > -/* > - * See gasket_page_table.h for general description. > - * > - * gasket_page_table_map calls either gasket_map_simple_pages() or > - * gasket_map_extended_pages() to actually perform the mapping. > - * > - * The page table mutex is held for the entire operation. > - */ > -int gasket_page_table_map(struct gasket_page_table *pg_tbl, ulong host_addr, > - ulong dev_addr, uint num_pages) > -{ > - int ret; > - > - if (!num_pages) > - return 0; > - > - mutex_lock(&pg_tbl->mutex); > - > - if (gasket_addr_is_simple(pg_tbl, dev_addr)) { > - ret = gasket_map_simple_pages(pg_tbl, host_addr, dev_addr, > - num_pages); > - } else { > - ret = gasket_map_extended_pages(pg_tbl, host_addr, dev_addr, > - num_pages); > - } > - > - mutex_unlock(&pg_tbl->mutex); > - return ret; > -} > -EXPORT_SYMBOL(gasket_page_table_map); > - > -/* > - * See gasket_page_table.h for general description. > - * > - * gasket_page_table_unmap takes the page table lock and calls either > - * gasket_unmap_simple_pages() or gasket_unmap_extended_pages() to > - * actually unmap the pages from device space. > - * > - * The page table mutex is held for the entire operation. > - */ > -void gasket_page_table_unmap(struct gasket_page_table *pg_tbl, ulong dev_addr, > - uint num_pages) > -{ > - if (!num_pages) > - return; > - > - mutex_lock(&pg_tbl->mutex); > - gasket_page_table_unmap_nolock(pg_tbl, dev_addr, num_pages); > - mutex_unlock(&pg_tbl->mutex); > -} > -EXPORT_SYMBOL(gasket_page_table_unmap); > - > -static void gasket_page_table_unmap_all_nolock(struct gasket_page_table *pg_tbl) > -{ > - gasket_unmap_simple_pages(pg_tbl, > - gasket_components_to_dev_address(pg_tbl, 1, 0, > - 0), > - pg_tbl->num_simple_entries); > - gasket_unmap_extended_pages(pg_tbl, > - gasket_components_to_dev_address(pg_tbl, 0, > - 0, 0), > - pg_tbl->num_extended_entries * > - GASKET_PAGES_PER_SUBTABLE); > -} > - > -/* See gasket_page_table.h for description. */ > -void gasket_page_table_unmap_all(struct gasket_page_table *pg_tbl) > -{ > - mutex_lock(&pg_tbl->mutex); > - gasket_page_table_unmap_all_nolock(pg_tbl); > - mutex_unlock(&pg_tbl->mutex); > -} > -EXPORT_SYMBOL(gasket_page_table_unmap_all); > - > -/* See gasket_page_table.h for description. */ > -void gasket_page_table_reset(struct gasket_page_table *pg_tbl) > -{ > - mutex_lock(&pg_tbl->mutex); > - gasket_page_table_unmap_all_nolock(pg_tbl); > - writeq(pg_tbl->config.total_entries, pg_tbl->extended_offset_reg); > - mutex_unlock(&pg_tbl->mutex); > -} > - > -/* See gasket_page_table.h for description. */ > -int gasket_page_table_lookup_page(struct gasket_page_table *pg_tbl, > - ulong dev_addr, struct page **ppage, > - ulong *poffset) > -{ > - uint page_num; > - struct gasket_page_table_entry *pte; > - > - mutex_lock(&pg_tbl->mutex); > - if (gasket_addr_is_simple(pg_tbl, dev_addr)) { > - page_num = gasket_simple_page_idx(pg_tbl, dev_addr); > - if (page_num >= pg_tbl->num_simple_entries) > - goto fail; > - > - pte = pg_tbl->entries + page_num; > - if (pte->status != PTE_INUSE) > - goto fail; > - } else { > - /* Find the level 0 entry, */ > - page_num = gasket_extended_lvl0_page_idx(pg_tbl, dev_addr); > - if (page_num >= pg_tbl->num_extended_entries) > - goto fail; > - > - pte = pg_tbl->entries + pg_tbl->num_simple_entries + page_num; > - if (pte->status != PTE_INUSE) > - goto fail; > - > - /* and its contained level 1 entry. */ > - page_num = gasket_extended_lvl1_page_idx(pg_tbl, dev_addr); > - pte = pte->sublevel + page_num; > - if (pte->status != PTE_INUSE) > - goto fail; > - } > - > - *ppage = pte->page; > - *poffset = pte->offset; > - mutex_unlock(&pg_tbl->mutex); > - return 0; > - > -fail: > - *ppage = NULL; > - *poffset = 0; > - mutex_unlock(&pg_tbl->mutex); > - return -EINVAL; > -} > - > -/* See gasket_page_table.h for description. */ > -bool gasket_page_table_are_addrs_bad(struct gasket_page_table *pg_tbl, > - ulong host_addr, ulong dev_addr, > - ulong bytes) > -{ > - if (host_addr & (PAGE_SIZE - 1)) { > - dev_err(pg_tbl->device, > - "host mapping address 0x%lx must be page aligned\n", > - host_addr); > - return true; > - } > - > - return gasket_page_table_is_dev_addr_bad(pg_tbl, dev_addr, bytes); > -} > -EXPORT_SYMBOL(gasket_page_table_are_addrs_bad); > - > -/* See gasket_page_table.h for description. */ > -bool gasket_page_table_is_dev_addr_bad(struct gasket_page_table *pg_tbl, > - ulong dev_addr, ulong bytes) > -{ > - uint num_pages = bytes / PAGE_SIZE; > - > - if (bytes & (PAGE_SIZE - 1)) { > - dev_err(pg_tbl->device, > - "mapping size 0x%lX must be page aligned\n", bytes); > - return true; > - } > - > - if (num_pages == 0) { > - dev_err(pg_tbl->device, > - "requested mapping is less than one page: %lu / %lu\n", > - bytes, PAGE_SIZE); > - return true; > - } > - > - if (gasket_addr_is_simple(pg_tbl, dev_addr)) > - return gasket_is_simple_dev_addr_bad(pg_tbl, dev_addr, > - num_pages); > - return gasket_is_extended_dev_addr_bad(pg_tbl, dev_addr, num_pages); > -} > -EXPORT_SYMBOL(gasket_page_table_is_dev_addr_bad); > - > -/* See gasket_page_table.h for description. */ > -uint gasket_page_table_max_size(struct gasket_page_table *page_table) > -{ > - if (!page_table) > - return 0; > - return page_table->config.total_entries; > -} > -EXPORT_SYMBOL(gasket_page_table_max_size); > - > -/* See gasket_page_table.h for description. */ > -uint gasket_page_table_num_entries(struct gasket_page_table *pg_tbl) > -{ > - if (!pg_tbl) > - return 0; > - return pg_tbl->num_simple_entries + pg_tbl->num_extended_entries; > -} > -EXPORT_SYMBOL(gasket_page_table_num_entries); > - > -/* See gasket_page_table.h for description. */ > -uint gasket_page_table_num_simple_entries(struct gasket_page_table *pg_tbl) > -{ > - if (!pg_tbl) > - return 0; > - return pg_tbl->num_simple_entries; > -} > -EXPORT_SYMBOL(gasket_page_table_num_simple_entries); > - > -/* See gasket_page_table.h for description. */ > -uint gasket_page_table_num_active_pages(struct gasket_page_table *pg_tbl) > -{ > - if (!pg_tbl) > - return 0; > - return pg_tbl->num_active_pages; > -} > -EXPORT_SYMBOL(gasket_page_table_num_active_pages); > - > -/* See gasket_page_table.h */ > -int gasket_page_table_system_status(struct gasket_page_table *page_table) > -{ > - if (!page_table) > - return GASKET_STATUS_LAMED; > - > - if (gasket_page_table_num_entries(page_table) == 0) { > - dev_dbg(page_table->device, "Page table size is 0\n"); > - return GASKET_STATUS_LAMED; > - } > - > - return GASKET_STATUS_ALIVE; > -} > - > -/* Record the host_addr to coherent dma memory mapping. */ > -int gasket_set_user_virt(struct gasket_dev *gasket_dev, u64 size, > - dma_addr_t dma_address, ulong vma) > -{ > - int j; > - struct gasket_page_table *pg_tbl; > - > - unsigned int num_pages = size / PAGE_SIZE; > - > - /* > - * TODO: for future chipset, better handling of the case where multiple > - * page tables are supported on a given device > - */ > - pg_tbl = gasket_dev->page_table[0]; > - if (!pg_tbl) { > - dev_dbg(gasket_dev->dev, "%s: invalid page table index\n", > - __func__); > - return 0; > - } > - for (j = 0; j < num_pages; j++) { > - pg_tbl->coherent_pages[j].user_virt = > - (u64)vma + j * PAGE_SIZE; > - } > - return 0; > -} > - > -/* Allocate a block of coherent memory. */ > -int gasket_alloc_coherent_memory(struct gasket_dev *gasket_dev, u64 size, > - dma_addr_t *dma_address, u64 index) > -{ > - dma_addr_t handle; > - void *mem; > - int j; > - unsigned int num_pages = DIV_ROUND_UP(size, PAGE_SIZE); > - const struct gasket_driver_desc *driver_desc = > - gasket_get_driver_desc(gasket_dev); > - > - if (!gasket_dev->page_table[index]) > - return -EFAULT; > - > - if (num_pages == 0) > - return -EINVAL; > - > - mem = dma_alloc_coherent(gasket_get_device(gasket_dev), > - num_pages * PAGE_SIZE, &handle, GFP_KERNEL); > - if (!mem) > - goto nomem; > - > - gasket_dev->page_table[index]->num_coherent_pages = num_pages; > - > - /* allocate the physical memory block */ > - gasket_dev->page_table[index]->coherent_pages = > - kcalloc(num_pages, > - sizeof(*gasket_dev->page_table[index]->coherent_pages), > - GFP_KERNEL); > - if (!gasket_dev->page_table[index]->coherent_pages) > - goto nomem; > - > - gasket_dev->coherent_buffer.length_bytes = > - PAGE_SIZE * (num_pages); > - gasket_dev->coherent_buffer.phys_base = handle; > - gasket_dev->coherent_buffer.virt_base = mem; > - > - *dma_address = driver_desc->coherent_buffer_description.base; > - for (j = 0; j < num_pages; j++) { > - gasket_dev->page_table[index]->coherent_pages[j].paddr = > - handle + j * PAGE_SIZE; > - gasket_dev->page_table[index]->coherent_pages[j].kernel_virt = > - (u64)mem + j * PAGE_SIZE; > - } > - > - return 0; > - > -nomem: > - if (mem) { > - dma_free_coherent(gasket_get_device(gasket_dev), > - num_pages * PAGE_SIZE, mem, handle); > - gasket_dev->coherent_buffer.length_bytes = 0; > - gasket_dev->coherent_buffer.virt_base = NULL; > - gasket_dev->coherent_buffer.phys_base = 0; > - } > - > - kfree(gasket_dev->page_table[index]->coherent_pages); > - gasket_dev->page_table[index]->coherent_pages = NULL; > - gasket_dev->page_table[index]->num_coherent_pages = 0; > - return -ENOMEM; > -} > - > -/* Free a block of coherent memory. */ > -int gasket_free_coherent_memory(struct gasket_dev *gasket_dev, u64 size, > - dma_addr_t dma_address, u64 index) > -{ > - const struct gasket_driver_desc *driver_desc; > - > - if (!gasket_dev->page_table[index]) > - return -EFAULT; > - > - driver_desc = gasket_get_driver_desc(gasket_dev); > - > - if (driver_desc->coherent_buffer_description.base != dma_address) > - return -EADDRNOTAVAIL; > - > - if (gasket_dev->coherent_buffer.length_bytes) { > - dma_free_coherent(gasket_get_device(gasket_dev), > - gasket_dev->coherent_buffer.length_bytes, > - gasket_dev->coherent_buffer.virt_base, > - gasket_dev->coherent_buffer.phys_base); > - gasket_dev->coherent_buffer.length_bytes = 0; > - gasket_dev->coherent_buffer.virt_base = NULL; > - gasket_dev->coherent_buffer.phys_base = 0; > - } > - > - kfree(gasket_dev->page_table[index]->coherent_pages); > - gasket_dev->page_table[index]->coherent_pages = NULL; > - gasket_dev->page_table[index]->num_coherent_pages = 0; > - > - return 0; > -} > - > -/* Release all coherent memory. */ > -void gasket_free_coherent_memory_all(struct gasket_dev *gasket_dev, u64 index) > -{ > - if (!gasket_dev->page_table[index]) > - return; > - > - if (gasket_dev->coherent_buffer.length_bytes) { > - dma_free_coherent(gasket_get_device(gasket_dev), > - gasket_dev->coherent_buffer.length_bytes, > - gasket_dev->coherent_buffer.virt_base, > - gasket_dev->coherent_buffer.phys_base); > - gasket_dev->coherent_buffer.length_bytes = 0; > - gasket_dev->coherent_buffer.virt_base = NULL; > - gasket_dev->coherent_buffer.phys_base = 0; > - } > -} > diff --git a/drivers/staging/gasket/gasket_page_table.h b/drivers/staging/gasket/gasket_page_table.h > deleted file mode 100644 > index 7b01b73ea3e7..000000000000 > --- a/drivers/staging/gasket/gasket_page_table.h > +++ /dev/null > @@ -1,249 +0,0 @@ > -/* SPDX-License-Identifier: GPL-2.0 */ > -/* > - * Gasket Page Table functionality. This file describes the address > - * translation/paging functionality supported by the Gasket driver framework. > - * As much as possible, internal details are hidden to simplify use - > - * all calls are thread-safe (protected by an internal mutex) except where > - * indicated otherwise. > - * > - * Copyright (C) 2018 Google, Inc. > - */ > - > -#ifndef __GASKET_PAGE_TABLE_H__ > -#define __GASKET_PAGE_TABLE_H__ > - > -#include > -#include > - > -#include "gasket_constants.h" > -#include "gasket_core.h" > - > -/* > - * Structure used for managing address translation on a device. All details are > - * internal to the implementation. > - */ > -struct gasket_page_table; > - > -/* > - * Allocate and init address translation data. > - * @ppage_table: Pointer to Gasket page table pointer. Set by this call. > - * @att_base_reg: [Mapped] pointer to the first entry in the device's address > - * translation table. > - * @extended_offset_reg: [Mapped] pointer to the device's register containing > - * the starting index of the extended translation table. > - * @extended_bit_location: The index of the bit indicating whether an address > - * is extended. > - * @total_entries: The total number of entries in the device's address > - * translation table. > - * @device: Device structure for the underlying device. Only used for logging. > - * @pci_dev: PCI system descriptor for the underlying device. > - * whether the driver will supply its own. > - * > - * Description: Allocates and initializes data to track address translation - > - * simple and extended page table metadata. Initially, the page table is > - * partitioned such that all addresses are "simple" (single-level lookup). > - * gasket_partition_page_table can be called to change this paritioning. > - * > - * Returns 0 on success, a negative error code otherwise. > - */ > -int gasket_page_table_init(struct gasket_page_table **ppg_tbl, > - const struct gasket_bar_data *bar_data, > - const struct gasket_page_table_config *page_table_config, > - struct device *device, struct pci_dev *pci_dev); > - > -/* > - * Deallocate and cleanup page table data. > - * @page_table: Gasket page table pointer. > - * > - * Description: The inverse of gasket_init; frees page_table and its contained > - * elements. > - * > - * Because this call destroys the page table, it cannot be > - * thread-safe (mutex-protected)! > - */ > -void gasket_page_table_cleanup(struct gasket_page_table *page_table); > - > -/* > - * Sets the size of the simple page table. > - * @page_table: Gasket page table pointer. > - * @num_simple_entries: Desired size of the simple page table (in entries). > - * > - * Description: gasket_partition_page_table checks to see if the simple page > - * size can be changed (i.e., if there are no active extended > - * mappings in the new simple size range), and, if so, > - * sets the new simple and extended page table sizes. > - * > - * Returns 0 if successful, or non-zero if the page table entries > - * are not free. > - */ > -int gasket_page_table_partition(struct gasket_page_table *page_table, > - uint num_simple_entries); > - > -/* > - * Get and map [host] user space pages into device memory. > - * @page_table: Gasket page table pointer. > - * @host_addr: Starting host virtual memory address of the pages. > - * @dev_addr: Starting device address of the pages. > - * @num_pages: Number of [4kB] pages to map. > - * > - * Description: Maps the "num_pages" pages of host memory pointed to by > - * host_addr to the address "dev_addr" in device memory. > - * > - * The caller is responsible for checking the addresses ranges. > - * > - * Returns 0 if successful or a non-zero error number otherwise. > - * If there is an error, no pages are mapped. > - */ > -int gasket_page_table_map(struct gasket_page_table *page_table, ulong host_addr, > - ulong dev_addr, uint num_pages); > - > -/* > - * Un-map host pages from device memory. > - * @page_table: Gasket page table pointer. > - * @dev_addr: Starting device address of the pages to unmap. > - * @num_pages: The number of [4kB] pages to unmap. > - * > - * Description: The inverse of gasket_map_pages. Unmaps pages from the device. > - */ > -void gasket_page_table_unmap(struct gasket_page_table *page_table, > - ulong dev_addr, uint num_pages); > - > -/* > - * Unmap ALL host pages from device memory. > - * @page_table: Gasket page table pointer. > - */ > -void gasket_page_table_unmap_all(struct gasket_page_table *page_table); > - > -/* > - * Unmap all host pages from device memory and reset the table to fully simple > - * addressing. > - * @page_table: Gasket page table pointer. > - */ > -void gasket_page_table_reset(struct gasket_page_table *page_table); > - > -/* > - * Reclaims unused page table memory. > - * @page_table: Gasket page table pointer. > - * > - * Description: Examines the page table and frees any currently-unused > - * allocations. Called internally on gasket_cleanup(). > - */ > -void gasket_page_table_garbage_collect(struct gasket_page_table *page_table); > - > -/* > - * Retrieve the backing page for a device address. > - * @page_table: Gasket page table pointer. > - * @dev_addr: Gasket device address. > - * @ppage: Pointer to a page pointer for the returned page. > - * @poffset: Pointer to an unsigned long for the returned offset. > - * > - * Description: Interprets the address and looks up the corresponding page > - * in the page table and the offset in that page. (We need an > - * offset because the host page may be larger than the Gasket chip > - * page it contains.) > - * > - * Returns 0 if successful, -1 for an error. The page pointer > - * and offset are returned through the pointers, if successful. > - */ > -int gasket_page_table_lookup_page(struct gasket_page_table *page_table, > - ulong dev_addr, struct page **page, > - ulong *poffset); > - > -/* > - * Checks validity for input addrs and size. > - * @page_table: Gasket page table pointer. > - * @host_addr: Host address to check. > - * @dev_addr: Gasket device address. > - * @bytes: Size of the range to check (in bytes). > - * > - * Description: This call performs a number of checks to verify that the ranges > - * specified by both addresses and the size are valid for mapping pages into > - * device memory. > - * > - * Returns true if the mapping is bad, false otherwise. > - */ > -bool gasket_page_table_are_addrs_bad(struct gasket_page_table *page_table, > - ulong host_addr, ulong dev_addr, > - ulong bytes); > - > -/* > - * Checks validity for input dev addr and size. > - * @page_table: Gasket page table pointer. > - * @dev_addr: Gasket device address. > - * @bytes: Size of the range to check (in bytes). > - * > - * Description: This call performs a number of checks to verify that the range > - * specified by the device address and the size is valid for mapping pages into > - * device memory. > - * > - * Returns true if the address is bad, false otherwise. > - */ > -bool gasket_page_table_is_dev_addr_bad(struct gasket_page_table *page_table, > - ulong dev_addr, ulong bytes); > - > -/* > - * Gets maximum size for the given page table. > - * @page_table: Gasket page table pointer. > - */ > -uint gasket_page_table_max_size(struct gasket_page_table *page_table); > - > -/* > - * Gets the total number of entries in the arg. > - * @page_table: Gasket page table pointer. > - */ > -uint gasket_page_table_num_entries(struct gasket_page_table *page_table); > - > -/* > - * Gets the number of simple entries. > - * @page_table: Gasket page table pointer. > - */ > -uint gasket_page_table_num_simple_entries(struct gasket_page_table *page_table); > - > -/* > - * Gets the number of actively pinned pages. > - * @page_table: Gasket page table pointer. > - */ > -uint gasket_page_table_num_active_pages(struct gasket_page_table *page_table); > - > -/* > - * Get status of page table managed by @page_table. > - * @page_table: Gasket page table pointer. > - */ > -int gasket_page_table_system_status(struct gasket_page_table *page_table); > - > -/* > - * Allocate a block of coherent memory. > - * @gasket_dev: Gasket Device. > - * @size: Size of the memory block. > - * @dma_address: Dma address allocated by the kernel. > - * @index: Index of the gasket_page_table within this Gasket device > - * > - * Description: Allocate a contiguous coherent memory block, DMA'ble > - * by this device. > - */ > -int gasket_alloc_coherent_memory(struct gasket_dev *gasket_dev, uint64_t size, > - dma_addr_t *dma_address, uint64_t index); > -/* Release a block of contiguous coherent memory, in use by a device. */ > -int gasket_free_coherent_memory(struct gasket_dev *gasket_dev, uint64_t size, > - dma_addr_t dma_address, uint64_t index); > - > -/* Release all coherent memory. */ > -void gasket_free_coherent_memory_all(struct gasket_dev *gasket_dev, > - uint64_t index); > - > -/* > - * Records the host_addr to coherent dma memory mapping. > - * @gasket_dev: Gasket Device. > - * @size: Size of the virtual address range to map. > - * @dma_address: Dma address within the coherent memory range. > - * @vma: Virtual address we wish to map to coherent memory. > - * > - * Description: For each page in the virtual address range, record the > - * coherent page mapping. > - * > - * Does not perform validity checking. > - */ > -int gasket_set_user_virt(struct gasket_dev *gasket_dev, uint64_t size, > - dma_addr_t dma_address, ulong vma); > - > -#endif /* __GASKET_PAGE_TABLE_H__ */ > diff --git a/drivers/staging/gasket/gasket_sysfs.c b/drivers/staging/gasket/gasket_sysfs.c > deleted file mode 100644 > index c5658fdf4d28..000000000000 > --- a/drivers/staging/gasket/gasket_sysfs.c > +++ /dev/null > @@ -1,398 +0,0 @@ > -// SPDX-License-Identifier: GPL-2.0 > -/* Copyright (C) 2018 Google, Inc. */ > -#include "gasket_sysfs.h" > - > -#include "gasket_core.h" > - > -#include > -#include > - > -/* > - * Pair of kernel device and user-specified pointer. Used in lookups in sysfs > - * "show" functions to return user data. > - */ > - > -struct gasket_sysfs_mapping { > - /* > - * The device bound to this mapping. If this is NULL, then this mapping > - * is free. > - */ > - struct device *device; > - > - /* The Gasket descriptor for this device. */ > - struct gasket_dev *gasket_dev; > - > - /* This device's set of sysfs attributes/nodes. */ > - struct gasket_sysfs_attribute *attributes; > - > - /* The number of live elements in "attributes". */ > - int attribute_count; > - > - /* Protects structure from simultaneous access. */ > - struct mutex mutex; > - > - /* Tracks active users of this mapping. */ > - struct kref refcount; > -}; > - > -/* > - * Data needed to manage users of this sysfs utility. > - * Currently has a fixed size; if space is a concern, this can be dynamically > - * allocated. > - */ > -/* > - * 'Global' (file-scoped) list of mappings between devices and gasket_data > - * pointers. This removes the requirement to have a gasket_sysfs_data > - * handle in all files. > - */ > -static struct gasket_sysfs_mapping dev_mappings[GASKET_SYSFS_NUM_MAPPINGS]; > - > -/* Callback when a mapping's refcount goes to zero. */ > -static void release_entry(struct kref *ref) > -{ > - /* All work is done after the return from kref_put. */ > -} > - > -/* Look up mapping information for the given device. */ > -static struct gasket_sysfs_mapping *get_mapping(struct device *device) > -{ > - int i; > - > - for (i = 0; i < GASKET_SYSFS_NUM_MAPPINGS; i++) { > - mutex_lock(&dev_mappings[i].mutex); > - if (dev_mappings[i].device == device) { > - kref_get(&dev_mappings[i].refcount); > - mutex_unlock(&dev_mappings[i].mutex); > - return &dev_mappings[i]; > - } > - mutex_unlock(&dev_mappings[i].mutex); > - } > - > - dev_dbg(device, "%s: Mapping to device %s not found\n", > - __func__, device->kobj.name); > - return NULL; > -} > - > -/* Put a reference to a mapping. */ > -static void put_mapping(struct gasket_sysfs_mapping *mapping) > -{ > - int i; > - int num_files_to_remove = 0; > - struct device_attribute *files_to_remove; > - struct device *device; > - > - if (!mapping) { > - pr_debug("%s: Mapping should not be NULL\n", __func__); > - return; > - } > - > - mutex_lock(&mapping->mutex); > - if (kref_put(&mapping->refcount, release_entry)) { > - dev_dbg(mapping->device, "Removing Gasket sysfs mapping\n"); > - /* > - * We can't remove the sysfs nodes in the kref callback, since > - * device_remove_file() blocks until the node is free. > - * Readers/writers of sysfs nodes, though, will be blocked on > - * the mapping mutex, resulting in deadlock. To fix this, the > - * sysfs nodes are removed outside the lock. > - */ > - device = mapping->device; > - num_files_to_remove = mapping->attribute_count; > - files_to_remove = kcalloc(num_files_to_remove, > - sizeof(*files_to_remove), > - GFP_KERNEL); > - if (files_to_remove) > - for (i = 0; i < num_files_to_remove; i++) > - files_to_remove[i] = > - mapping->attributes[i].attr; > - else > - num_files_to_remove = 0; > - > - kfree(mapping->attributes); > - mapping->attributes = NULL; > - mapping->attribute_count = 0; > - put_device(mapping->device); > - mapping->device = NULL; > - mapping->gasket_dev = NULL; > - } > - mutex_unlock(&mapping->mutex); > - > - if (num_files_to_remove != 0) { > - for (i = 0; i < num_files_to_remove; ++i) > - device_remove_file(device, &files_to_remove[i]); > - kfree(files_to_remove); > - } > -} > - > -/* > - * Put a reference to a mapping N times. > - * > - * In higher-level resource acquire/release function pairs, the release function > - * will need to release a mapping 2x - once for the refcount taken in the > - * release function itself, and once for the count taken in the acquire call. > - */ > -static void put_mapping_n(struct gasket_sysfs_mapping *mapping, int times) > -{ > - int i; > - > - for (i = 0; i < times; i++) > - put_mapping(mapping); > -} > - > -void gasket_sysfs_init(void) > -{ > - int i; > - > - for (i = 0; i < GASKET_SYSFS_NUM_MAPPINGS; i++) { > - dev_mappings[i].device = NULL; > - mutex_init(&dev_mappings[i].mutex); > - } > -} > - > -int gasket_sysfs_create_mapping(struct device *device, > - struct gasket_dev *gasket_dev) > -{ > - struct gasket_sysfs_mapping *mapping; > - int map_idx = -1; > - > - /* > - * We need a function-level mutex to protect against the same device > - * being added [multiple times] simultaneously. > - */ > - static DEFINE_MUTEX(function_mutex); > - > - mutex_lock(&function_mutex); > - dev_dbg(device, "Creating sysfs entries for device\n"); > - > - /* Check that the device we're adding hasn't already been added. */ > - mapping = get_mapping(device); > - if (mapping) { > - dev_err(device, > - "Attempting to re-initialize sysfs mapping for device\n"); > - put_mapping(mapping); > - mutex_unlock(&function_mutex); > - return -EBUSY; > - } > - > - /* Find the first empty entry in the array. */ > - for (map_idx = 0; map_idx < GASKET_SYSFS_NUM_MAPPINGS; ++map_idx) { > - mutex_lock(&dev_mappings[map_idx].mutex); > - if (!dev_mappings[map_idx].device) > - /* Break with the mutex held! */ > - break; > - mutex_unlock(&dev_mappings[map_idx].mutex); > - } > - > - if (map_idx == GASKET_SYSFS_NUM_MAPPINGS) { > - dev_err(device, "All mappings have been exhausted\n"); > - mutex_unlock(&function_mutex); > - return -ENOMEM; > - } > - > - dev_dbg(device, "Creating sysfs mapping for device %s\n", > - device->kobj.name); > - > - mapping = &dev_mappings[map_idx]; > - mapping->attributes = kcalloc(GASKET_SYSFS_MAX_NODES, > - sizeof(*mapping->attributes), > - GFP_KERNEL); > - if (!mapping->attributes) { > - dev_dbg(device, "Unable to allocate sysfs attribute array\n"); > - mutex_unlock(&mapping->mutex); > - mutex_unlock(&function_mutex); > - return -ENOMEM; > - } > - > - kref_init(&mapping->refcount); > - mapping->device = get_device(device); > - mapping->gasket_dev = gasket_dev; > - mapping->attribute_count = 0; > - mutex_unlock(&mapping->mutex); > - mutex_unlock(&function_mutex); > - > - /* Don't decrement the refcount here! One open count keeps it alive! */ > - return 0; > -} > - > -int gasket_sysfs_create_entries(struct device *device, > - const struct gasket_sysfs_attribute *attrs) > -{ > - int i; > - int ret; > - struct gasket_sysfs_mapping *mapping = get_mapping(device); > - > - if (!mapping) { > - dev_dbg(device, > - "Creating entries for device without first initializing mapping\n"); > - return -EINVAL; > - } > - > - mutex_lock(&mapping->mutex); > - for (i = 0; attrs[i].attr.attr.name; i++) { > - if (mapping->attribute_count == GASKET_SYSFS_MAX_NODES) { > - dev_err(device, > - "Maximum number of sysfs nodes reached for device\n"); > - mutex_unlock(&mapping->mutex); > - put_mapping(mapping); > - return -ENOMEM; > - } > - > - ret = device_create_file(device, &attrs[i].attr); > - if (ret) { > - dev_dbg(device, "Unable to create device entries\n"); > - mutex_unlock(&mapping->mutex); > - put_mapping(mapping); > - return ret; > - } > - > - mapping->attributes[mapping->attribute_count] = attrs[i]; > - ++mapping->attribute_count; > - } > - > - mutex_unlock(&mapping->mutex); > - put_mapping(mapping); > - return 0; > -} > -EXPORT_SYMBOL(gasket_sysfs_create_entries); > - > -void gasket_sysfs_remove_mapping(struct device *device) > -{ > - struct gasket_sysfs_mapping *mapping = get_mapping(device); > - > - if (!mapping) { > - dev_err(device, > - "Attempted to remove non-existent sysfs mapping to device\n"); > - return; > - } > - > - put_mapping_n(mapping, 2); > -} > - > -struct gasket_dev *gasket_sysfs_get_device_data(struct device *device) > -{ > - struct gasket_sysfs_mapping *mapping = get_mapping(device); > - > - if (!mapping) { > - dev_err(device, "device not registered\n"); > - return NULL; > - } > - > - return mapping->gasket_dev; > -} > -EXPORT_SYMBOL(gasket_sysfs_get_device_data); > - > -void gasket_sysfs_put_device_data(struct device *device, struct gasket_dev *dev) > -{ > - struct gasket_sysfs_mapping *mapping = get_mapping(device); > - > - if (!mapping) > - return; > - > - /* See comment of put_mapping_n() for why the '2' is necessary. */ > - put_mapping_n(mapping, 2); > -} > -EXPORT_SYMBOL(gasket_sysfs_put_device_data); > - > -struct gasket_sysfs_attribute * > -gasket_sysfs_get_attr(struct device *device, struct device_attribute *attr) > -{ > - int i; > - int num_attrs; > - struct gasket_sysfs_mapping *mapping = get_mapping(device); > - struct gasket_sysfs_attribute *attrs = NULL; > - > - if (!mapping) > - return NULL; > - > - attrs = mapping->attributes; > - num_attrs = mapping->attribute_count; > - for (i = 0; i < num_attrs; ++i) { > - if (!strcmp(attrs[i].attr.attr.name, attr->attr.name)) > - return &attrs[i]; > - } > - > - dev_err(device, "Unable to find match for device_attribute %s\n", > - attr->attr.name); > - return NULL; > -} > -EXPORT_SYMBOL(gasket_sysfs_get_attr); > - > -void gasket_sysfs_put_attr(struct device *device, > - struct gasket_sysfs_attribute *attr) > -{ > - int i; > - int num_attrs; > - struct gasket_sysfs_mapping *mapping = get_mapping(device); > - struct gasket_sysfs_attribute *attrs = NULL; > - > - if (!mapping) > - return; > - > - attrs = mapping->attributes; > - num_attrs = mapping->attribute_count; > - for (i = 0; i < num_attrs; ++i) { > - if (&attrs[i] == attr) { > - put_mapping_n(mapping, 2); > - return; > - } > - } > - > - dev_err(device, "Unable to put unknown attribute: %s\n", > - attr->attr.attr.name); > - put_mapping(mapping); > -} > -EXPORT_SYMBOL(gasket_sysfs_put_attr); > - > -ssize_t gasket_sysfs_register_store(struct device *device, > - struct device_attribute *attr, > - const char *buf, size_t count) > -{ > - ulong parsed_value = 0; > - struct gasket_sysfs_mapping *mapping; > - struct gasket_dev *gasket_dev; > - struct gasket_sysfs_attribute *gasket_attr; > - > - if (count < 3 || buf[0] != '0' || buf[1] != 'x') { > - dev_err(device, > - "sysfs register write format: \"0x\"\n"); > - return -EINVAL; > - } > - > - if (kstrtoul(buf, 16, &parsed_value) != 0) { > - dev_err(device, > - "Unable to parse input as 64-bit hex value: %s\n", buf); > - return -EINVAL; > - } > - > - mapping = get_mapping(device); > - if (!mapping) { > - dev_err(device, "Device driver may have been removed\n"); > - return 0; > - } > - > - gasket_dev = mapping->gasket_dev; > - if (!gasket_dev) { > - dev_err(device, "Device driver may have been removed\n"); > - put_mapping(mapping); > - return 0; > - } > - > - gasket_attr = gasket_sysfs_get_attr(device, attr); > - if (!gasket_attr) { > - put_mapping(mapping); > - return count; > - } > - > - gasket_dev_write_64(gasket_dev, parsed_value, > - gasket_attr->data.bar_address.bar, > - gasket_attr->data.bar_address.offset); > - > - if (gasket_attr->write_callback) > - gasket_attr->write_callback(gasket_dev, gasket_attr, > - parsed_value); > - > - gasket_sysfs_put_attr(device, gasket_attr); > - put_mapping(mapping); > - return count; > -} > -EXPORT_SYMBOL(gasket_sysfs_register_store); > diff --git a/drivers/staging/gasket/gasket_sysfs.h b/drivers/staging/gasket/gasket_sysfs.h > deleted file mode 100644 > index d5e167dfbe76..000000000000 > --- a/drivers/staging/gasket/gasket_sysfs.h > +++ /dev/null > @@ -1,175 +0,0 @@ > -/* SPDX-License-Identifier: GPL-2.0 */ > -/* > - * Set of common sysfs utilities. > - * > - * Copyright (C) 2018 Google, Inc. > - */ > - > -/* The functions described here are a set of utilities to allow each file in the > - * Gasket driver framework to manage their own set of sysfs entries, instead of > - * centralizing all that work in one file. > - * > - * The goal of these utilities is to allow for sysfs entries to be easily > - * created without causing a proliferation of sysfs "show" functions. This > - * requires O(N) string lookups during show function execution, but as reading > - * sysfs entries is rarely performance-critical, this is likely acceptible. > - */ > -#ifndef __GASKET_SYSFS_H__ > -#define __GASKET_SYSFS_H__ > - > -#include "gasket_constants.h" > -#include "gasket_core.h" > -#include > -#include > -#include > - > -/* The maximum number of mappings/devices a driver needs to support. */ > -#define GASKET_SYSFS_NUM_MAPPINGS (GASKET_FRAMEWORK_DESC_MAX * GASKET_DEV_MAX) > - > -/* The maximum number of sysfs nodes in a directory. > - */ > -#define GASKET_SYSFS_MAX_NODES 196 > - > -/* > - * Terminator struct for a gasket_sysfs_attr array. Must be at the end of > - * all gasket_sysfs_attribute arrays. > - */ > -#define GASKET_END_OF_ATTR_ARRAY \ > - { \ > - .attr = __ATTR_NULL, \ > - .data.attr_type = 0, \ > - } > - > -/* > - * Pairing of sysfs attribute and user data. > - * Used in lookups in sysfs "show" functions to return attribute metadata. > - */ > -struct gasket_sysfs_attribute { > - /* The underlying sysfs device attribute associated with this data. */ > - struct device_attribute attr; > - > - /* User-specified data to associate with the attribute. */ > - union { > - struct bar_address_ { > - ulong bar; > - ulong offset; > - } bar_address; > - uint attr_type; > - } data; > - > - /* > - * Function pointer to a callback to be invoked when this attribute is > - * written (if so configured). The arguments are to the Gasket device > - * pointer, the enclosing gasket_attr structure, and the value written. > - * The callback should perform any logging necessary, as errors cannot > - * be returned from the callback. > - */ > - void (*write_callback)(struct gasket_dev *dev, > - struct gasket_sysfs_attribute *attr, > - ulong value); > -}; > - > -#define GASKET_SYSFS_RO(_name, _show_function, _attr_type) \ > - { \ > - .attr = __ATTR(_name, 0444, _show_function, NULL), \ > - .data.attr_type = _attr_type \ > - } > - > -/* Initializes the Gasket sysfs subsystem. > - * > - * Description: Performs one-time initialization. Must be called before usage > - * at [Gasket] module load time. > - */ > -void gasket_sysfs_init(void); > - > -/* > - * Create an entry in mapping_data between a device and a Gasket device. > - * @device: Device struct to map to. > - * @gasket_dev: The dev struct associated with the driver controlling @device. > - * > - * Description: This function maps a gasket_dev* to a device*. This mapping can > - * be used in sysfs_show functions to get a handle to the gasket_dev struct > - * controlling the device node. > - * > - * If this function is not called before gasket_sysfs_create_entries, a warning > - * will be logged. > - */ > -int gasket_sysfs_create_mapping(struct device *device, > - struct gasket_dev *gasket_dev); > - > -/* > - * Creates bulk entries in sysfs. > - * @device: Kernel device structure. > - * @attrs: List of attributes/sysfs entries to create. > - * > - * Description: Creates each sysfs entry described in "attrs". Can be called > - * multiple times for a given @device. If the gasket_dev specified in > - * gasket_sysfs_create_mapping had a legacy device, the entries will be created > - * for it, as well. > - */ > -int gasket_sysfs_create_entries(struct device *device, > - const struct gasket_sysfs_attribute *attrs); > - > -/* > - * Removes a device mapping from the global table. > - * @device: Device to unmap. > - * > - * Description: Removes the device->Gasket device mapping from the internal > - * table. > - */ > -void gasket_sysfs_remove_mapping(struct device *device); > - > -/* > - * User data lookup based on kernel device structure. > - * @device: Kernel device structure. > - * > - * Description: Returns the user data associated with "device" in a prior call > - * to gasket_sysfs_create_entries. Returns NULL if no mapping can be found. > - * Upon success, this call take a reference to internal sysfs data that must be > - * released with gasket_sysfs_put_device_data. While this reference is held, the > - * underlying device sysfs information/structure will remain valid/will not be > - * deleted. > - */ > -struct gasket_dev *gasket_sysfs_get_device_data(struct device *device); > - > -/* > - * Releases a references to internal data. > - * @device: Kernel device structure. > - * @dev: Gasket device descriptor (returned by gasket_sysfs_get_device_data). > - */ > -void gasket_sysfs_put_device_data(struct device *device, > - struct gasket_dev *gasket_dev); > - > -/* > - * Gasket-specific attribute lookup. > - * @device: Kernel device structure. > - * @attr: Device attribute to look up. > - * > - * Returns the Gasket sysfs attribute associated with the kernel device > - * attribute and device structure itself. Upon success, this call will take a > - * reference to internal sysfs data that must be released with a call to > - * gasket_sysfs_put_attr. While this reference is held, the underlying device > - * sysfs information/structure will remain valid/will not be deleted. > - */ > -struct gasket_sysfs_attribute * > -gasket_sysfs_get_attr(struct device *device, struct device_attribute *attr); > - > -/* > - * Releases a references to internal data. > - * @device: Kernel device structure. > - * @attr: Gasket sysfs attribute descriptor (returned by > - * gasket_sysfs_get_attr). > - */ > -void gasket_sysfs_put_attr(struct device *device, > - struct gasket_sysfs_attribute *attr); > - > -/* > - * Write to a register sysfs node. > - * @buf: NULL-terminated data being written. > - * @count: number of bytes in the "buf" argument. > - */ > -ssize_t gasket_sysfs_register_store(struct device *device, > - struct device_attribute *attr, > - const char *buf, size_t count); > - > -#endif /* __GASKET_SYSFS_H__ */ > -- > 2.30.2 > From nsaenzjulienne at suse.de Mon Mar 15 16:12:44 2021 From: nsaenzjulienne at suse.de (Nicolas Saenz Julienne) Date: Mon, 15 Mar 2021 17:12:44 +0100 Subject: [PATCH v8 11/11] pwm: Add Raspberry Pi Firmware based PWM bus In-Reply-To: <20210312201217.n2sav23swy7ii4uo@pengutronix.de> References: <20210312122454.24480-1-nsaenzjulienne@suse.de> <20210312122454.24480-12-nsaenzjulienne@suse.de> <20210312201217.n2sav23swy7ii4uo@pengutronix.de> Message-ID: <1255e56c66c8704c93adad77f605357267de0231.camel@suse.de> Hi Uwe, On Fri, 2021-03-12 at 21:12 +0100, Uwe Kleine-K?nig wrote: > Hello Nicolas, > > +// SPDX-License-Identifier: GPL-2.0 > > +/* > > + * Copyright 2020 Nicolas Saenz Julienne > > 2021? Yes. > > + * For more information on Raspberry Pi's PoE hat see: > > + * https://www.raspberrypi.org/products/poe-hat/ > > Out of personal interest: Is this hat also able to power a RPi CM4? I haven't tested it, and can't at the moment (no PoE injector available). But the physical pin layout, and routing in CM4's IO board fits the hat. So I'd say yes. > > + * Limitations: > > + * - No disable bit, so a disabled PWM is simulated by duty_cycle 0 > > + * - Only normal polarity > > + * - Fixed 12.5 kHz period > > + * > > + * The current period is completed when HW is reconfigured. > > + */ > > Other than that as mentioned in the previous round: This looks good, > > Reviewed-by: Uwe Kleine-K?nig Thanks! > What is your thought about how to get this series merged? > At least input, staging, armsoc, clk, reset anf firmware are touched. Do you > prepare a branch for merging in the relevant trees (once you have all the > necessary Acks)? As per Linusw suggestion I'll send a pull request myself into the SoC tree and hope for the best. :) Regards, Nicolas -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: This is a digitally signed message part URL: From jerome.pouiller at silabs.com Mon Mar 15 16:21:35 2021 From: jerome.pouiller at silabs.com (=?ISO-8859-1?Q?J=E9r=F4me?= Pouiller) Date: Mon, 15 Mar 2021 17:21:35 +0100 Subject: [PATCH v5 03/24] wfx: add Makefile/Kconfig In-Reply-To: References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> <20210315132501.441681-4-Jerome.Pouiller@silabs.com> Message-ID: <1718324.Ee3sdLpQUQ@pc-42> Hi Leon, On Monday 15 March 2021 16:11:52 CET Leon Romanovsky wrote: > On Mon, Mar 15, 2021 at 02:24:40PM +0100, Jerome Pouiller wrote: > > From: J?r?me Pouiller > > > > Signed-off-by: J?r?me Pouiller > > --- > > drivers/net/wireless/silabs/wfx/Kconfig | 12 +++++++++++ > > drivers/net/wireless/silabs/wfx/Makefile | 26 ++++++++++++++++++++++++ > > 2 files changed, 38 insertions(+) > > create mode 100644 drivers/net/wireless/silabs/wfx/Kconfig > > create mode 100644 drivers/net/wireless/silabs/wfx/Makefile > > > > diff --git a/drivers/net/wireless/silabs/wfx/Kconfig b/drivers/net/wireless/silabs/wfx/Kconfig > > new file mode 100644 > > index 000000000000..3be4b1e735e1 > > --- /dev/null > > +++ b/drivers/net/wireless/silabs/wfx/Kconfig > > @@ -0,0 +1,12 @@ > > +config WFX > > + tristate "Silicon Labs wireless chips WF200 and further" > > + depends on MAC80211 > > + depends on MMC || !MMC # do not allow WFX=y if MMC=m > > + depends on (SPI || MMC) > > + help > > + This is a driver for Silicons Labs WFxxx series (WF200 and further) > > + chipsets. This chip can be found on SPI or SDIO buses. > > + > > + Silabs does not use a reliable SDIO vendor ID. So, to avoid conflicts, > > + the driver won't probe the device if it is not also declared in the > > + Device Tree. > > diff --git a/drivers/net/wireless/silabs/wfx/Makefile b/drivers/net/wireless/silabs/wfx/Makefile > > new file mode 100644 > > index 000000000000..f399962c8619 > > --- /dev/null > > +++ b/drivers/net/wireless/silabs/wfx/Makefile > > @@ -0,0 +1,26 @@ > > +# SPDX-License-Identifier: GPL-2.0 > > + > > +# Necessary for CREATE_TRACE_POINTS > > +CFLAGS_debug.o = -I$(src) > > I wonder if it is still relevant outside of the staging tree. It seems this pattern is common in the main tree. You suggest to relocate trace.h to include/trace/events? -- J?r?me Pouiller From marcocesati at gmail.com Mon Mar 15 17:05:21 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:21 +0100 Subject: [PATCH 00/57] Staging: rtl8723bs: fix POINTER_LOCATION whitespaces Message-ID: <20210315170618.2566-1-marcocesati@gmail.com> This set of patches fixes 522 checkpatch.pl errors of type POINTER_LOCATION in the staging/rtl8723bs souce code. Every patch is purely syntactical: it does not change the generated machine code. Furthermore, every single patch leaves the source code fully compilable, so that 'git bisect' will not be affected. The checkpatch.pl script emits many errors and warnings for these patches, however all of them are caused by the original code. They shall be fixed in different patchsets. [PATCH 01/57] Staging: rtl8723bs: fix spaces in rtw_cmd.c [PATCH 02/57] Staging: rtl8723bs: fix spaces in HalBtc8723b1Ant.c [PATCH 03/57] Staging: rtl8723bs: fix spaces in HalBtc8723b1Ant.h [PATCH 04/57] Staging: rtl8723bs: fix spaces in HalBtc8723b2Ant.c [PATCH 05/57] Staging: rtl8723bs: fix spaces in HalBtc8723b2Ant.h [PATCH 06/57] Staging: rtl8723bs: fix spaces in HalBtcOutSrc.h [PATCH 07/57] Staging: rtl8723bs: fix spaces in HalHWImg8723B_BB.c [PATCH 08/57] Staging: rtl8723bs: fix spaces in HalHWImg8723B_BB.h [PATCH 09/57] Staging: rtl8723bs: fix spaces in HalHWImg8723B_MAC.c [PATCH 10/57] Staging: rtl8723bs: fix spaces in HalHWImg8723B_MAC.h [PATCH 11/57] Staging: rtl8723bs: fix spaces in HalHWImg8723B_RF.c [PATCH 12/57] Staging: rtl8723bs: fix spaces in HalHWImg8723B_RF.h [PATCH 13/57] Staging: rtl8723bs: fix spaces in HalPhyRf.c [PATCH 14/57] Staging: rtl8723bs: fix spaces in HalPhyRf.h [PATCH 15/57] Staging: rtl8723bs: fix spaces in HalPhyRf_8723B.c [PATCH 16/57] Staging: rtl8723bs: fix spaces in HalPhyRf_8723B.h [PATCH 17/57] Staging: rtl8723bs: fix spaces in hal_btcoex.c [PATCH 18/57] Staging: rtl8723bs: fix spaces in hal_com.c [PATCH 19/57] Staging: rtl8723bs: fix spaces in hal_com_phycfg.c [PATCH 20/57] Staging: rtl8723bs: fix spaces in odm.c [PATCH 21/57] Staging: rtl8723bs: fix spaces in odm.h [PATCH 22/57] Staging: rtl8723bs: fix spaces in odm_CfoTracking.c [PATCH 23/57] Staging: rtl8723bs: fix spaces in odm_DIG.c [PATCH 24/57] Staging: rtl8723bs: fix in odm_DynamicBBPowerSaving.c [PATCH 25/57] Staging: rtl8723bs: fix spaces in odm_DynamicTxPower.c [PATCH 26/57] Staging: rtl8723bs: fix spaces in odm_EdcaTurboCheck.c [PATCH 27/57] Staging: rtl8723bs: fix spaces in odm_HWConfig.c [PATCH 28/57] Staging: rtl8723bs: fix spaces in odm_HWConfig.h [PATCH 29/57] Staging: rtl8723bs: fix spaces in odm_NoiseMonitor.c [PATCH 30/57] Staging: rtl8723bs: fix spaces in odm_PathDiv.c [PATCH 31/57] Staging: rtl8723bs: fix spaces in odm_RegConfig8723B.c [PATCH 32/57] Staging: rtl8723bs: fix spaces in odm_RegConfig8723B.h [PATCH 33/57] Staging: rtl8723bs: fix spaces in odm_debug.c [PATCH 34/57] Staging: rtl8723bs: fix spaces in odm_debug.h [PATCH 35/57] Staging: rtl8723bs: fix spaces in rtl8723b_dm.c [PATCH 36/57] Staging: rtl8723bs: fix spaces in rtl8723b_hal_init.c [PATCH 37/57] Staging: rtl8723bs: fix spaces in rtl8723b_phycfg.c [PATCH 38/57] Staging: rtl8723bs: fix spaces in HalPwrSeqCmd.h [PATCH 39/57] Staging: rtl8723bs: fix spaces in basic_types.h [PATCH 40/57] Staging: rtl8723bs: fix spaces in drv_types.h [PATCH 41/57] Staging: rtl8723bs: fix spaces in hal_com.h [PATCH 42/57] Staging: rtl8723bs: fix spaces in hal_com_h2c.h [PATCH 43/57] Staging: rtl8723bs: fix spaces in hal_com_phycfg.h [PATCH 44/57] Staging: rtl8723bs: fix spaces in ieee80211.h [PATCH 45/57] Staging: rtl8723bs: fix spaces in ioctl_cfg80211.h [PATCH 46/57] Staging: rtl8723bs: fix spaces in osdep_intf.h [PATCH 47/57] Staging: rtl8723bs: fix spaces in osdep_service.h [PATCH 48/57] Staging: rtl8723bs: fix spaces in osdep_service_linux.h [PATCH 49/57] Staging: rtl8723bs: fix spaces in recv_osdep.h [PATCH 50/57] Staging: rtl8723bs: fix spaces in rtl8723b_xmit.h [PATCH 51/57] Staging: rtl8723bs: fix spaces in rtw_cmd.h [PATCH 52/57] Staging: rtl8723bs: fix spaces in rtw_ioctl_set.h [PATCH 53/57] Staging: rtl8723bs: fix spaces in rtw_mlme_ext.h [PATCH 54/57] Staging: rtl8723bs: fix spaces in xmit_osdep.h [PATCH 55/57] Staging: rtl8723bs: fix spaces in os_intfs.c [PATCH 56/57] Staging: rtl8723bs: fix spaces in osdep_service.c [PATCH 57/57] Staging: rtl8723bs: fix spaces in xmit_linux.c drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +- .../staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 152 +++++++++--------- .../staging/rtl8723bs/hal/HalBtc8723b1Ant.h | 28 ++-- .../staging/rtl8723bs/hal/HalBtc8723b2Ant.c | 142 ++++++++-------- .../staging/rtl8723bs/hal/HalBtc8723b2Ant.h | 28 ++-- drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h | 28 ++-- .../staging/rtl8723bs/hal/HalHWImg8723B_BB.c | 10 +- .../staging/rtl8723bs/hal/HalHWImg8723B_BB.h | 6 +- .../staging/rtl8723bs/hal/HalHWImg8723B_MAC.c | 6 +- .../staging/rtl8723bs/hal/HalHWImg8723B_MAC.h | 2 +- .../staging/rtl8723bs/hal/HalHWImg8723B_RF.c | 12 +- .../staging/rtl8723bs/hal/HalHWImg8723B_RF.h | 6 +- drivers/staging/rtl8723bs/hal/HalPhyRf.c | 6 +- drivers/staging/rtl8723bs/hal/HalPhyRf.h | 4 +- .../staging/rtl8723bs/hal/HalPhyRf_8723B.c | 54 +++---- .../staging/rtl8723bs/hal/HalPhyRf_8723B.h | 10 +- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 89 +++++----- drivers/staging/rtl8723bs/hal/hal_com.c | 2 +- .../staging/rtl8723bs/hal/hal_com_phycfg.c | 6 +- drivers/staging/rtl8723bs/hal/odm.c | 92 +++++------ drivers/staging/rtl8723bs/hal/odm.h | 32 ++-- .../staging/rtl8723bs/hal/odm_CfoTracking.c | 28 ++-- drivers/staging/rtl8723bs/hal/odm_DIG.c | 60 +++---- .../rtl8723bs/hal/odm_DynamicBBPowerSaving.c | 4 +- .../rtl8723bs/hal/odm_DynamicTxPower.c | 2 +- .../rtl8723bs/hal/odm_EdcaTurboCheck.c | 6 +- drivers/staging/rtl8723bs/hal/odm_HWConfig.c | 18 +-- drivers/staging/rtl8723bs/hal/odm_HWConfig.h | 12 +- .../staging/rtl8723bs/hal/odm_NoiseMonitor.c | 2 +- drivers/staging/rtl8723bs/hal/odm_PathDiv.c | 4 +- .../rtl8723bs/hal/odm_RegConfig8723B.c | 14 +- .../rtl8723bs/hal/odm_RegConfig8723B.h | 14 +- drivers/staging/rtl8723bs/hal/odm_debug.c | 2 +- drivers/staging/rtl8723bs/hal/odm_debug.h | 2 +- drivers/staging/rtl8723bs/hal/rtl8723b_dm.c | 12 +- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 24 +-- .../staging/rtl8723bs/hal/rtl8723b_phycfg.c | 4 +- .../staging/rtl8723bs/include/HalPwrSeqCmd.h | 2 +- .../staging/rtl8723bs/include/basic_types.h | 2 +- drivers/staging/rtl8723bs/include/drv_types.h | 12 +- drivers/staging/rtl8723bs/include/hal_com.h | 16 +- .../staging/rtl8723bs/include/hal_com_h2c.h | 2 +- .../rtl8723bs/include/hal_com_phycfg.h | 26 +-- drivers/staging/rtl8723bs/include/ieee80211.h | 7 +- .../rtl8723bs/include/ioctl_cfg80211.h | 2 +- .../staging/rtl8723bs/include/osdep_intf.h | 2 +- .../staging/rtl8723bs/include/osdep_service.h | 4 +- .../rtl8723bs/include/osdep_service_linux.h | 2 +- .../staging/rtl8723bs/include/recv_osdep.h | 2 +- .../staging/rtl8723bs/include/rtl8723b_xmit.h | 4 +- drivers/staging/rtl8723bs/include/rtw_cmd.h | 4 +- .../staging/rtl8723bs/include/rtw_ioctl_set.h | 4 +- .../staging/rtl8723bs/include/rtw_mlme_ext.h | 18 +-- .../staging/rtl8723bs/include/xmit_osdep.h | 4 +- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 2 +- .../staging/rtl8723bs/os_dep/osdep_service.c | 2 +- drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 4 +- 57 files changed, 524 insertions(+), 522 deletions(-) -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:22 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:22 +0100 Subject: [PATCH 01/57] Staging: rtl8723bs: fix spaces in rtw_cmd.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-2-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #206: FILE: ./core/rtw_cmd.c:206: +static void c2h_wk_callback(struct work_struct * work); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c index bdb77bd46a20..cc10bd5ffb31 100644 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@ -203,7 +203,7 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) return res; } -static void c2h_wk_callback(struct work_struct * work); +static void c2h_wk_callback(struct work_struct *work); int rtw_init_evt_priv(struct evt_priv *pevtpriv) { /* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */ -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:24 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:24 +0100 Subject: [PATCH 03/57] Staging: rtl8723bs: fix spaces in HalBtc8723b1Ant.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-4-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #170: FILE: ./hal/HalBtc8723b1Ant.h:170: +void EXhalbtc8723b1ant_PowerOnSetting(struct BTC_COEXIST * pBtCoexist); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #171: FILE: ./hal/HalBtc8723b1Ant.h:171: +void EXhalbtc8723b1ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool bWifiOnly); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #172: FILE: ./hal/HalBtc8723b1Ant.h:172: +void EXhalbtc8723b1ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #173: FILE: ./hal/HalBtc8723b1Ant.h:173: +void EXhalbtc8723b1ant_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #174: FILE: ./hal/HalBtc8723b1Ant.h:174: +void EXhalbtc8723b1ant_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #175: FILE: ./hal/HalBtc8723b1Ant.h:175: +void EXhalbtc8723b1ant_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #176: FILE: ./hal/HalBtc8723b1Ant.h:176: +void EXhalbtc8723b1ant_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 type); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #177: FILE: ./hal/HalBtc8723b1Ant.h:177: +void EXhalbtc8723b1ant_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, u8 type); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #178: FILE: ./hal/HalBtc8723b1Ant.h:178: +void EXhalbtc8723b1ant_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 type); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #180: FILE: ./hal/HalBtc8723b1Ant.h:180: + struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #182: FILE: ./hal/HalBtc8723b1Ant.h:182: +void EXhalbtc8723b1ant_HaltNotify(struct BTC_COEXIST * pBtCoexist); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #183: FILE: ./hal/HalBtc8723b1Ant.h:183: +void EXhalbtc8723b1ant_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #184: FILE: ./hal/HalBtc8723b1Ant.h:184: +void EXhalbtc8723b1ant_Periodical(struct BTC_COEXIST * pBtCoexist); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #185: FILE: ./hal/HalBtc8723b1Ant.h:185: +void EXhalbtc8723b1ant_DisplayCoexInfo(struct BTC_COEXIST * pBtCoexist); Signed-off-by: Marco Cesati --- .../staging/rtl8723bs/hal/HalBtc8723b1Ant.h | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h index a104d138eb63..b26a169e5088 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h @@ -167,19 +167,19 @@ struct COEX_STA_8723B_1ANT { /* */ /* The following is interface which will notify coex module. */ /* */ -void EXhalbtc8723b1ant_PowerOnSetting(struct BTC_COEXIST * pBtCoexist); -void EXhalbtc8723b1ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool bWifiOnly); -void EXhalbtc8723b1ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist); -void EXhalbtc8723b1ant_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); -void EXhalbtc8723b1ant_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); -void EXhalbtc8723b1ant_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type); -void EXhalbtc8723b1ant_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 type); -void EXhalbtc8723b1ant_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, u8 type); -void EXhalbtc8723b1ant_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 type); +void EXhalbtc8723b1ant_PowerOnSetting(struct BTC_COEXIST *pBtCoexist); +void EXhalbtc8723b1ant_InitHwConfig(struct BTC_COEXIST *pBtCoexist, bool bWifiOnly); +void EXhalbtc8723b1ant_InitCoexDm(struct BTC_COEXIST *pBtCoexist); +void EXhalbtc8723b1ant_IpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type); +void EXhalbtc8723b1ant_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type); +void EXhalbtc8723b1ant_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type); +void EXhalbtc8723b1ant_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 type); +void EXhalbtc8723b1ant_MediaStatusNotify(struct BTC_COEXIST *pBtCoexist, u8 type); +void EXhalbtc8723b1ant_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 type); void EXhalbtc8723b1ant_BtInfoNotify( - struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length + struct BTC_COEXIST *pBtCoexist, u8 *tmpBuf, u8 length ); -void EXhalbtc8723b1ant_HaltNotify(struct BTC_COEXIST * pBtCoexist); -void EXhalbtc8723b1ant_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState); -void EXhalbtc8723b1ant_Periodical(struct BTC_COEXIST * pBtCoexist); -void EXhalbtc8723b1ant_DisplayCoexInfo(struct BTC_COEXIST * pBtCoexist); +void EXhalbtc8723b1ant_HaltNotify(struct BTC_COEXIST *pBtCoexist); +void EXhalbtc8723b1ant_PnpNotify(struct BTC_COEXIST *pBtCoexist, u8 pnpState); +void EXhalbtc8723b1ant_Periodical(struct BTC_COEXIST *pBtCoexist); +void EXhalbtc8723b1ant_DisplayCoexInfo(struct BTC_COEXIST *pBtCoexist); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:23 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:23 +0100 Subject: [PATCH 02/57] Staging: rtl8723bs: fix spaces in HalBtc8723b1Ant.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-3-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #12: FILE: ./hal/HalBtc8723b1Ant.c:12: +static struct COEX_DM_8723B_1ANT * pCoexDm = &GLCoexDm8723b1Ant; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #14: FILE: ./hal/HalBtc8723b1Ant.c:14: +static struct COEX_STA_8723B_1ANT * pCoexSta = &GLCoexSta8723b1Ant; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #154: FILE: ./hal/HalBtc8723b1Ant.c:154: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u32 disRateMask ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #169: FILE: ./hal/HalBtc8723b1Ant.c:169: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 type ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #207: FILE: ./hal/HalBtc8723b1Ant.c:207: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 type ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #234: FILE: ./hal/HalBtc8723b1Ant.c:234: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 type ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #260: FILE: ./hal/HalBtc8723b1Ant.c:260: + struct BTC_COEXIST * pBtCoexist, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #288: FILE: ./hal/HalBtc8723b1Ant.c:288: + struct BTC_COEXIST * pBtCoexist, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #317: FILE: ./hal/HalBtc8723b1Ant.c:317: +static void halbtc8723b1ant_QueryBtInfo(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #334: FILE: ./hal/HalBtc8723b1Ant.c:334: +static void halbtc8723b1ant_MonitorBtCtr(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #395: FILE: ./hal/HalBtc8723b1Ant.c:395: +static void halbtc8723b1ant_MonitorWiFiCtr(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #481: FILE: ./hal/HalBtc8723b1Ant.c:481: +static bool halbtc8723b1ant_IsWifiStatusChanged(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #516: FILE: ./hal/HalBtc8723b1Ant.c:516: +static void halbtc8723b1ant_UpdateBtLinkInfo(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #518: FILE: ./hal/HalBtc8723b1Ant.c:518: + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #580: FILE: ./hal/HalBtc8723b1Ant.c:580: +static u8 halbtc8723b1ant_ActionAlgorithm(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #582: FILE: ./hal/HalBtc8723b1Ant.c:582: + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #808: FILE: ./hal/HalBtc8723b1Ant.c:808: + struct BTC_COEXIST * pBtCoexist, bool bLowPenaltyRa ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #836: FILE: ./hal/HalBtc8723b1Ant.c:836: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bLowPenaltyRa ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #853: FILE: ./hal/HalBtc8723b1Ant.c:853: + struct BTC_COEXIST * pBtCoexist, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #890: FILE: ./hal/HalBtc8723b1Ant.c:890: + struct BTC_COEXIST * pBtCoexist, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #933: FILE: ./hal/HalBtc8723b1Ant.c:933: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 type ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #991: FILE: ./hal/HalBtc8723b1Ant.c:991: + struct BTC_COEXIST * pBtCoexist, bool bEnable ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1012: FILE: ./hal/HalBtc8723b1Ant.c:1012: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bEnable ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1046: FILE: ./hal/HalBtc8723b1Ant.c:1046: + struct BTC_COEXIST * pBtCoexist, u8 lpsVal, u8 rpwmVal ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1057: FILE: ./hal/HalBtc8723b1Ant.c:1057: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 lpsVal, u8 rpwmVal ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1108: FILE: ./hal/HalBtc8723b1Ant.c:1108: + struct BTC_COEXIST * pBtCoexist, bool bLowPenaltyRA ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1121: FILE: ./hal/HalBtc8723b1Ant.c:1121: + struct BTC_COEXIST * pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1124: FILE: ./hal/HalBtc8723b1Ant.c:1124: + struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1310: FILE: ./hal/HalBtc8723b1Ant.c:1310: + struct BTC_COEXIST * pBtCoexist, u8 byte1, u8 byte2, u8 byte3, u8 byte4, u8 byte5 ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1364: FILE: ./hal/HalBtc8723b1Ant.c:1364: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bTurnOn, u8 type ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1367: FILE: ./hal/HalBtc8723b1Ant.c:1367: + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1664: FILE: ./hal/HalBtc8723b1Ant.c:1664: +static bool halbtc8723b1ant_IsCommonAction(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1755: FILE: ./hal/HalBtc8723b1Ant.c:1755: + struct BTC_COEXIST * pBtCoexist, u8 wifiStatus ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1944: FILE: ./hal/HalBtc8723b1Ant.c:1944: + struct BTC_COEXIST * pBtCoexist, bool bNewPsState ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1966: FILE: ./hal/HalBtc8723b1Ant.c:1966: + struct BTC_COEXIST * pBtCoexist, u8 psType, u8 lpsVal, u8 rpwmVal ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2014: FILE: ./hal/HalBtc8723b1Ant.c:2014: +static void halbtc8723b1ant_ActionWifiMultiPort(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2022: FILE: ./hal/HalBtc8723b1Ant.c:2022: +static void halbtc8723b1ant_ActionHs(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2028: FILE: ./hal/HalBtc8723b1Ant.c:2028: +static void halbtc8723b1ant_ActionBtInquiry(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2030: FILE: ./hal/HalBtc8723b1Ant.c:2030: + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2070: FILE: ./hal/HalBtc8723b1Ant.c:2070: + struct BTC_COEXIST * pBtCoexist, u8 wifiStatus ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2073: FILE: ./hal/HalBtc8723b1Ant.c:2073: + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2090: FILE: ./hal/HalBtc8723b1Ant.c:2090: + struct BTC_COEXIST * pBtCoexist, u8 wifiStatus ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2095: FILE: ./hal/HalBtc8723b1Ant.c:2095: + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2144: FILE: ./hal/HalBtc8723b1Ant.c:2144: +static void halbtc8723b1ant_ActionWifiNotConnected(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2155: FILE: ./hal/HalBtc8723b1Ant.c:2155: + struct BTC_COEXIST * pBtCoexist ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2158: FILE: ./hal/HalBtc8723b1Ant.c:2158: + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2189: FILE: ./hal/HalBtc8723b1Ant.c:2189: + struct BTC_COEXIST * pBtCoexist ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2192: FILE: ./hal/HalBtc8723b1Ant.c:2192: + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2213: FILE: ./hal/HalBtc8723b1Ant.c:2213: +static void halbtc8723b1ant_ActionWifiConnectedScan(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2215: FILE: ./hal/HalBtc8723b1Ant.c:2215: + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2246: FILE: ./hal/HalBtc8723b1Ant.c:2246: + struct BTC_COEXIST * pBtCoexist ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2249: FILE: ./hal/HalBtc8723b1Ant.c:2249: + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2270: FILE: ./hal/HalBtc8723b1Ant.c:2270: +static void halbtc8723b1ant_ActionWifiConnected(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2390: FILE: ./hal/HalBtc8723b1Ant.c:2390: +static void halbtc8723b1ant_RunSwCoexistMechanism(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2449: FILE: ./hal/HalBtc8723b1Ant.c:2449: +static void halbtc8723b1ant_RunCoexistMechanism(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2451: FILE: ./hal/HalBtc8723b1Ant.c:2451: + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2582: FILE: ./hal/HalBtc8723b1Ant.c:2582: +static void halbtc8723b1ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2596: FILE: ./hal/HalBtc8723b1Ant.c:2596: + struct BTC_COEXIST * pBtCoexist, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2651: FILE: ./hal/HalBtc8723b1Ant.c:2651: +void EXhalbtc8723b1ant_PowerOnSetting(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2653: FILE: ./hal/HalBtc8723b1Ant.c:2653: + struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2703: FILE: ./hal/HalBtc8723b1Ant.c:2703: +void EXhalbtc8723b1ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool bWifiOnly) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2708: FILE: ./hal/HalBtc8723b1Ant.c:2708: +void EXhalbtc8723b1ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2723: FILE: ./hal/HalBtc8723b1Ant.c:2723: +void EXhalbtc8723b1ant_DisplayCoexInfo(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2725: FILE: ./hal/HalBtc8723b1Ant.c:2725: + struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2726: FILE: ./hal/HalBtc8723b1Ant.c:2726: + struct BTC_STACK_INFO * pStackInfo = &pBtCoexist->stackInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2727: FILE: ./hal/HalBtc8723b1Ant.c:2727: + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3186: FILE: ./hal/HalBtc8723b1Ant.c:3186: +void EXhalbtc8723b1ant_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3212: FILE: ./hal/HalBtc8723b1Ant.c:3212: +void EXhalbtc8723b1ant_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3230: FILE: ./hal/HalBtc8723b1Ant.c:3230: +void EXhalbtc8723b1ant_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3320: FILE: ./hal/HalBtc8723b1Ant.c:3320: +void EXhalbtc8723b1ant_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 type) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3377: FILE: ./hal/HalBtc8723b1Ant.c:3377: +void EXhalbtc8723b1ant_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, u8 type) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3447: FILE: ./hal/HalBtc8723b1Ant.c:3447: +void EXhalbtc8723b1ant_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 type) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3536: FILE: ./hal/HalBtc8723b1Ant.c:3536: + struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3701: FILE: ./hal/HalBtc8723b1Ant.c:3701: +void EXhalbtc8723b1ant_HaltNotify(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3716: FILE: ./hal/HalBtc8723b1Ant.c:3716: +void EXhalbtc8723b1ant_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3738: FILE: ./hal/HalBtc8723b1Ant.c:3738: +void EXhalbtc8723b1ant_Periodical(struct BTC_COEXIST * pBtCoexist) Signed-off-by: Marco Cesati --- .../staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 152 +++++++++--------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c index 87dc63408133..9e81dec49712 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c @@ -9,9 +9,9 @@ /* Global variables, these are static variables */ static struct COEX_DM_8723B_1ANT GLCoexDm8723b1Ant; -static struct COEX_DM_8723B_1ANT * pCoexDm = &GLCoexDm8723b1Ant; +static struct COEX_DM_8723B_1ANT *pCoexDm = &GLCoexDm8723b1Ant; static struct COEX_STA_8723B_1ANT GLCoexSta8723b1Ant; -static struct COEX_STA_8723B_1ANT * pCoexSta = &GLCoexSta8723b1Ant; +static struct COEX_STA_8723B_1ANT *pCoexSta = &GLCoexSta8723b1Ant; static const char *const GLBtInfoSrc8723b1Ant[] = { "BT Info[wifi fw]", @@ -151,7 +151,7 @@ static u8 halbtc8723b1ant_BtRssiState( } static void halbtc8723b1ant_UpdateRaMask( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, u32 disRateMask + struct BTC_COEXIST *pBtCoexist, bool bForceExec, u32 disRateMask ) { pCoexDm->curRaMask = disRateMask; @@ -166,7 +166,7 @@ static void halbtc8723b1ant_UpdateRaMask( } static void halbtc8723b1ant_AutoRateFallbackRetry( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 type + struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 type ) { bool bWifiUnderBMode = false; @@ -204,7 +204,7 @@ static void halbtc8723b1ant_AutoRateFallbackRetry( } static void halbtc8723b1ant_RetryLimit( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 type + struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 type ) { pCoexDm->curRetryLimitType = type; @@ -231,7 +231,7 @@ static void halbtc8723b1ant_RetryLimit( } static void halbtc8723b1ant_AmpduMaxTime( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 type + struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 type ) { pCoexDm->curAmpduTimeType = type; @@ -257,7 +257,7 @@ static void halbtc8723b1ant_AmpduMaxTime( } static void halbtc8723b1ant_LimitedTx( - struct BTC_COEXIST * pBtCoexist, + struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 raMaskType, u8 arfrType, @@ -285,7 +285,7 @@ static void halbtc8723b1ant_LimitedTx( } static void halbtc8723b1ant_LimitedRx( - struct BTC_COEXIST * pBtCoexist, + struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bRejApAggPkt, bool bBtCtrlAggBufSize, @@ -314,7 +314,7 @@ static void halbtc8723b1ant_LimitedRx( } -static void halbtc8723b1ant_QueryBtInfo(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b1ant_QueryBtInfo(struct BTC_COEXIST *pBtCoexist) { u8 H2C_Parameter[1] = {0}; @@ -331,7 +331,7 @@ static void halbtc8723b1ant_QueryBtInfo(struct BTC_COEXIST * pBtCoexist) pBtCoexist->fBtcFillH2c(pBtCoexist, 0x61, 1, H2C_Parameter); } -static void halbtc8723b1ant_MonitorBtCtr(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b1ant_MonitorBtCtr(struct BTC_COEXIST *pBtCoexist) { u32 regHPTxRx, regLPTxRx, u4Tmp; u32 regHPTx = 0, regHPRx = 0, regLPTx = 0, regLPRx = 0; @@ -392,7 +392,7 @@ static void halbtc8723b1ant_MonitorBtCtr(struct BTC_COEXIST * pBtCoexist) } -static void halbtc8723b1ant_MonitorWiFiCtr(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b1ant_MonitorWiFiCtr(struct BTC_COEXIST *pBtCoexist) { s32 wifiRssi = 0; bool bWifiBusy = false, bWifiUnderBMode = false; @@ -478,7 +478,7 @@ static void halbtc8723b1ant_MonitorWiFiCtr(struct BTC_COEXIST * pBtCoexist) } -static bool halbtc8723b1ant_IsWifiStatusChanged(struct BTC_COEXIST * pBtCoexist) +static bool halbtc8723b1ant_IsWifiStatusChanged(struct BTC_COEXIST *pBtCoexist) { static bool bPreWifiBusy, bPreUnder4way, bPreBtHsOn; bool bWifiBusy = false, bUnder4way = false, bBtHsOn = false; @@ -513,9 +513,9 @@ static bool halbtc8723b1ant_IsWifiStatusChanged(struct BTC_COEXIST * pBtCoexist) return false; } -static void halbtc8723b1ant_UpdateBtLinkInfo(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b1ant_UpdateBtLinkInfo(struct BTC_COEXIST *pBtCoexist) { - struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bBtHsOn = false; pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); @@ -577,9 +577,9 @@ static void halbtc8723b1ant_UpdateBtLinkInfo(struct BTC_COEXIST * pBtCoexist) pBtLinkInfo->bHidOnly = false; } -static u8 halbtc8723b1ant_ActionAlgorithm(struct BTC_COEXIST * pBtCoexist) +static u8 halbtc8723b1ant_ActionAlgorithm(struct BTC_COEXIST *pBtCoexist) { - struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bBtHsOn = false; u8 algorithm = BT_8723B_1ANT_COEX_ALGO_UNDEFINED; u8 numOfDiffProfile = 0; @@ -805,7 +805,7 @@ static u8 halbtc8723b1ant_ActionAlgorithm(struct BTC_COEXIST * pBtCoexist) } static void halbtc8723b1ant_SetSwPenaltyTxRateAdaptive( - struct BTC_COEXIST * pBtCoexist, bool bLowPenaltyRa + struct BTC_COEXIST *pBtCoexist, bool bLowPenaltyRa ) { u8 H2C_Parameter[6] = {0}; @@ -833,7 +833,7 @@ static void halbtc8723b1ant_SetSwPenaltyTxRateAdaptive( } static void halbtc8723b1ant_LowPenaltyRa( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bLowPenaltyRa + struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bLowPenaltyRa ) { pCoexDm->bCurLowPenaltyRa = bLowPenaltyRa; @@ -850,7 +850,7 @@ static void halbtc8723b1ant_LowPenaltyRa( } static void halbtc8723b1ant_SetCoexTable( - struct BTC_COEXIST * pBtCoexist, + struct BTC_COEXIST *pBtCoexist, u32 val0x6c0, u32 val0x6c4, u32 val0x6c8, @@ -887,7 +887,7 @@ static void halbtc8723b1ant_SetCoexTable( } static void halbtc8723b1ant_CoexTable( - struct BTC_COEXIST * pBtCoexist, + struct BTC_COEXIST *pBtCoexist, bool bForceExec, u32 val0x6c0, u32 val0x6c4, @@ -930,7 +930,7 @@ static void halbtc8723b1ant_CoexTable( } static void halbtc8723b1ant_CoexTableWithType( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 type + struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 type ) { BTC_PRINT( @@ -988,7 +988,7 @@ static void halbtc8723b1ant_CoexTableWithType( } static void halbtc8723b1ant_SetFwIgnoreWlanAct( - struct BTC_COEXIST * pBtCoexist, bool bEnable + struct BTC_COEXIST *pBtCoexist, bool bEnable ) { u8 H2C_Parameter[1] = {0}; @@ -1009,7 +1009,7 @@ static void halbtc8723b1ant_SetFwIgnoreWlanAct( } static void halbtc8723b1ant_IgnoreWlanAct( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bEnable + struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bEnable ) { BTC_PRINT( @@ -1043,7 +1043,7 @@ static void halbtc8723b1ant_IgnoreWlanAct( } static void halbtc8723b1ant_SetLpsRpwm( - struct BTC_COEXIST * pBtCoexist, u8 lpsVal, u8 rpwmVal + struct BTC_COEXIST *pBtCoexist, u8 lpsVal, u8 rpwmVal ) { u8 lps = lpsVal; @@ -1054,7 +1054,7 @@ static void halbtc8723b1ant_SetLpsRpwm( } static void halbtc8723b1ant_LpsRpwm( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 lpsVal, u8 rpwmVal + struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 lpsVal, u8 rpwmVal ) { BTC_PRINT( @@ -1105,7 +1105,7 @@ static void halbtc8723b1ant_LpsRpwm( } static void halbtc8723b1ant_SwMechanism( - struct BTC_COEXIST * pBtCoexist, bool bLowPenaltyRA + struct BTC_COEXIST *pBtCoexist, bool bLowPenaltyRA ) { BTC_PRINT( @@ -1118,10 +1118,10 @@ static void halbtc8723b1ant_SwMechanism( } static void halbtc8723b1ant_SetAntPath( - struct BTC_COEXIST * pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff + struct BTC_COEXIST *pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff ) { - struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; + struct BTC_BOARD_INFO *pBoardInfo = &pBtCoexist->boardInfo; u32 fwVer = 0, u4Tmp = 0, cntBtCalChk = 0; bool bPgExtSwitch = false; bool bUseExtSwitch = false; @@ -1307,7 +1307,7 @@ static void halbtc8723b1ant_SetAntPath( } static void halbtc8723b1ant_SetFwPstdma( - struct BTC_COEXIST * pBtCoexist, u8 byte1, u8 byte2, u8 byte3, u8 byte4, u8 byte5 + struct BTC_COEXIST *pBtCoexist, u8 byte1, u8 byte2, u8 byte3, u8 byte4, u8 byte5 ) { u8 H2C_Parameter[5] = {0}; @@ -1361,10 +1361,10 @@ static void halbtc8723b1ant_SetFwPstdma( static void halbtc8723b1ant_PsTdma( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bTurnOn, u8 type + struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bTurnOn, u8 type ) { - struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bWifiBusy = false; u8 rssiAdjustVal = 0; u8 psTdmaByte4Val = 0x50, psTdmaByte0Val = 0x51, psTdmaByte3Val = 0x10; @@ -1661,7 +1661,7 @@ static void halbtc8723b1ant_PsTdma( pCoexDm->prePsTdma = pCoexDm->curPsTdma; } -static bool halbtc8723b1ant_IsCommonAction(struct BTC_COEXIST * pBtCoexist) +static bool halbtc8723b1ant_IsCommonAction(struct BTC_COEXIST *pBtCoexist) { bool bCommon = false, bWifiConnected = false, bWifiBusy = false; @@ -1752,7 +1752,7 @@ static bool halbtc8723b1ant_IsCommonAction(struct BTC_COEXIST * pBtCoexist) static void halbtc8723b1ant_TdmaDurationAdjustForAcl( - struct BTC_COEXIST * pBtCoexist, u8 wifiStatus + struct BTC_COEXIST *pBtCoexist, u8 wifiStatus ) { static s32 up, dn, m, n, WaitCount; @@ -1941,7 +1941,7 @@ static void halbtc8723b1ant_TdmaDurationAdjustForAcl( } static void halbtc8723b1ant_PsTdmaCheckForPowerSaveState( - struct BTC_COEXIST * pBtCoexist, bool bNewPsState + struct BTC_COEXIST *pBtCoexist, bool bNewPsState ) { u8 lpsMode = 0x0; @@ -1963,7 +1963,7 @@ static void halbtc8723b1ant_PsTdmaCheckForPowerSaveState( } static void halbtc8723b1ant_PowerSaveState( - struct BTC_COEXIST * pBtCoexist, u8 psType, u8 lpsVal, u8 rpwmVal + struct BTC_COEXIST *pBtCoexist, u8 psType, u8 lpsVal, u8 rpwmVal ) { bool bLowPwrDisable = false; @@ -2011,7 +2011,7 @@ static void halbtc8723b1ant_PowerSaveState( /* Non-Software Coex Mechanism start */ /* */ /* */ -static void halbtc8723b1ant_ActionWifiMultiPort(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b1ant_ActionWifiMultiPort(struct BTC_COEXIST *pBtCoexist) { halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2019,15 +2019,15 @@ static void halbtc8723b1ant_ActionWifiMultiPort(struct BTC_COEXIST * pBtCoexist) halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); } -static void halbtc8723b1ant_ActionHs(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b1ant_ActionHs(struct BTC_COEXIST *pBtCoexist) { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 5); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); } -static void halbtc8723b1ant_ActionBtInquiry(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b1ant_ActionBtInquiry(struct BTC_COEXIST *pBtCoexist) { - struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bWifiConnected = false; bool bApEnable = false; bool bWifiBusy = false; @@ -2067,10 +2067,10 @@ static void halbtc8723b1ant_ActionBtInquiry(struct BTC_COEXIST * pBtCoexist) } static void halbtc8723b1ant_ActionBtScoHidOnlyBusy( - struct BTC_COEXIST * pBtCoexist, u8 wifiStatus + struct BTC_COEXIST *pBtCoexist, u8 wifiStatus ) { - struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bWifiConnected = false; pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); @@ -2087,12 +2087,12 @@ static void halbtc8723b1ant_ActionBtScoHidOnlyBusy( } static void halbtc8723b1ant_ActionWifiConnectedBtAclBusy( - struct BTC_COEXIST * pBtCoexist, u8 wifiStatus + struct BTC_COEXIST *pBtCoexist, u8 wifiStatus ) { u8 btRssiState; - struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; btRssiState = halbtc8723b1ant_BtRssiState(2, 28, 0); if ((pCoexSta->lowPriorityRx >= 1000) && (pCoexSta->lowPriorityRx != 65535)) @@ -2141,7 +2141,7 @@ static void halbtc8723b1ant_ActionWifiConnectedBtAclBusy( } } -static void halbtc8723b1ant_ActionWifiNotConnected(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b1ant_ActionWifiNotConnected(struct BTC_COEXIST *pBtCoexist) { /* power save state */ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2152,10 +2152,10 @@ static void halbtc8723b1ant_ActionWifiNotConnected(struct BTC_COEXIST * pBtCoexi } static void halbtc8723b1ant_ActionWifiNotConnectedScan( - struct BTC_COEXIST * pBtCoexist + struct BTC_COEXIST *pBtCoexist ) { - struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2186,10 +2186,10 @@ static void halbtc8723b1ant_ActionWifiNotConnectedScan( } static void halbtc8723b1ant_ActionWifiNotConnectedAssoAuth( - struct BTC_COEXIST * pBtCoexist + struct BTC_COEXIST *pBtCoexist ) { - struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2210,9 +2210,9 @@ static void halbtc8723b1ant_ActionWifiNotConnectedAssoAuth( } } -static void halbtc8723b1ant_ActionWifiConnectedScan(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b1ant_ActionWifiConnectedScan(struct BTC_COEXIST *pBtCoexist) { - struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2243,10 +2243,10 @@ static void halbtc8723b1ant_ActionWifiConnectedScan(struct BTC_COEXIST * pBtCoex } static void halbtc8723b1ant_ActionWifiConnectedSpecialPacket( - struct BTC_COEXIST * pBtCoexist + struct BTC_COEXIST *pBtCoexist ) { - struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2267,7 +2267,7 @@ static void halbtc8723b1ant_ActionWifiConnectedSpecialPacket( } } -static void halbtc8723b1ant_ActionWifiConnected(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b1ant_ActionWifiConnected(struct BTC_COEXIST *pBtCoexist) { bool bWifiBusy = false; bool bScan = false, bLink = false, bRoam = false; @@ -2387,7 +2387,7 @@ static void halbtc8723b1ant_ActionWifiConnected(struct BTC_COEXIST * pBtCoexist) } } -static void halbtc8723b1ant_RunSwCoexistMechanism(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b1ant_RunSwCoexistMechanism(struct BTC_COEXIST *pBtCoexist) { u8 algorithm = 0; @@ -2446,9 +2446,9 @@ static void halbtc8723b1ant_RunSwCoexistMechanism(struct BTC_COEXIST * pBtCoexis } } -static void halbtc8723b1ant_RunCoexistMechanism(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b1ant_RunCoexistMechanism(struct BTC_COEXIST *pBtCoexist) { - struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bWifiConnected = false, bBtHsOn = false; bool bIncreaseScanDevNum = false; bool bBtCtrlAggBufSize = false; @@ -2579,7 +2579,7 @@ static void halbtc8723b1ant_RunCoexistMechanism(struct BTC_COEXIST * pBtCoexist) halbtc8723b1ant_ActionWifiConnected(pBtCoexist); } -static void halbtc8723b1ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b1ant_InitCoexDm(struct BTC_COEXIST *pBtCoexist) { /* force to reset coex mechanism */ @@ -2593,7 +2593,7 @@ static void halbtc8723b1ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist) } static void halbtc8723b1ant_InitHwConfig( - struct BTC_COEXIST * pBtCoexist, + struct BTC_COEXIST *pBtCoexist, bool bBackUp, bool bWifiOnly ) @@ -2648,9 +2648,9 @@ static void halbtc8723b1ant_InitHwConfig( /* */ /* extern function start with EXhalbtc8723b1ant_ */ /* */ -void EXhalbtc8723b1ant_PowerOnSetting(struct BTC_COEXIST * pBtCoexist) +void EXhalbtc8723b1ant_PowerOnSetting(struct BTC_COEXIST *pBtCoexist) { - struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; + struct BTC_BOARD_INFO *pBoardInfo = &pBtCoexist->boardInfo; u8 u1Tmp = 0x0; u16 u2Tmp = 0x0; @@ -2700,12 +2700,12 @@ void EXhalbtc8723b1ant_PowerOnSetting(struct BTC_COEXIST * pBtCoexist) } } -void EXhalbtc8723b1ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool bWifiOnly) +void EXhalbtc8723b1ant_InitHwConfig(struct BTC_COEXIST *pBtCoexist, bool bWifiOnly) { halbtc8723b1ant_InitHwConfig(pBtCoexist, true, bWifiOnly); } -void EXhalbtc8723b1ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist) +void EXhalbtc8723b1ant_InitCoexDm(struct BTC_COEXIST *pBtCoexist) { BTC_PRINT( BTC_MSG_INTERFACE, @@ -2720,11 +2720,11 @@ void EXhalbtc8723b1ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist) halbtc8723b1ant_QueryBtInfo(pBtCoexist); } -void EXhalbtc8723b1ant_DisplayCoexInfo(struct BTC_COEXIST * pBtCoexist) +void EXhalbtc8723b1ant_DisplayCoexInfo(struct BTC_COEXIST *pBtCoexist) { - struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; - struct BTC_STACK_INFO * pStackInfo = &pBtCoexist->stackInfo; - struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BOARD_INFO *pBoardInfo = &pBtCoexist->boardInfo; + struct BTC_STACK_INFO *pStackInfo = &pBtCoexist->stackInfo; + struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; u8 *cliBuf = pBtCoexist->cliBuf; u8 u1Tmp[4], i, btInfoExt, psTdmaCase = 0; u16 u2Tmp[4]; @@ -3183,7 +3183,7 @@ void EXhalbtc8723b1ant_DisplayCoexInfo(struct BTC_COEXIST * pBtCoexist) } -void EXhalbtc8723b1ant_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) +void EXhalbtc8723b1ant_IpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) { if (pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm) return; @@ -3209,7 +3209,7 @@ void EXhalbtc8723b1ant_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) } } -void EXhalbtc8723b1ant_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) +void EXhalbtc8723b1ant_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) { if (pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm) return; @@ -3227,7 +3227,7 @@ void EXhalbtc8723b1ant_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) } } -void EXhalbtc8723b1ant_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type) +void EXhalbtc8723b1ant_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type) { bool bWifiConnected = false, bBtHsOn = false; u32 wifiLinkStatus = 0; @@ -3317,7 +3317,7 @@ void EXhalbtc8723b1ant_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type) } } -void EXhalbtc8723b1ant_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 type) +void EXhalbtc8723b1ant_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 type) { bool bWifiConnected = false, bBtHsOn = false; u32 wifiLinkStatus = 0; @@ -3374,7 +3374,7 @@ void EXhalbtc8723b1ant_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 type) } } -void EXhalbtc8723b1ant_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, u8 type) +void EXhalbtc8723b1ant_MediaStatusNotify(struct BTC_COEXIST *pBtCoexist, u8 type) { u8 H2C_Parameter[3] = {0}; u32 wifiBw; @@ -3444,7 +3444,7 @@ void EXhalbtc8723b1ant_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, u8 typ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter); } -void EXhalbtc8723b1ant_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 type) +void EXhalbtc8723b1ant_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 type) { bool bBtHsOn = false; u32 wifiLinkStatus = 0; @@ -3533,7 +3533,7 @@ void EXhalbtc8723b1ant_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 t } void EXhalbtc8723b1ant_BtInfoNotify( - struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length + struct BTC_COEXIST *pBtCoexist, u8 *tmpBuf, u8 length ) { u8 btInfo = 0; @@ -3698,7 +3698,7 @@ void EXhalbtc8723b1ant_BtInfoNotify( halbtc8723b1ant_RunCoexistMechanism(pBtCoexist); } -void EXhalbtc8723b1ant_HaltNotify(struct BTC_COEXIST * pBtCoexist) +void EXhalbtc8723b1ant_HaltNotify(struct BTC_COEXIST *pBtCoexist) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n")); @@ -3713,7 +3713,7 @@ void EXhalbtc8723b1ant_HaltNotify(struct BTC_COEXIST * pBtCoexist) pBtCoexist->bStopCoexDm = true; } -void EXhalbtc8723b1ant_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState) +void EXhalbtc8723b1ant_PnpNotify(struct BTC_COEXIST *pBtCoexist, u8 pnpState) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify\n")); @@ -3735,7 +3735,7 @@ void EXhalbtc8723b1ant_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState) } } -void EXhalbtc8723b1ant_Periodical(struct BTC_COEXIST * pBtCoexist) +void EXhalbtc8723b1ant_Periodical(struct BTC_COEXIST *pBtCoexist) { static u8 disVerInfoCnt; u32 fwVer = 0, btPatchVer = 0; -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:26 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:26 +0100 Subject: [PATCH 05/57] Staging: rtl8723bs: fix spaces in HalBtc8723b2Ant.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-6-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #132: FILE: ./hal/HalBtc8723b2Ant.h:132: +void EXhalbtc8723b2ant_PowerOnSetting(struct BTC_COEXIST * pBtCoexist); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #133: FILE: ./hal/HalBtc8723b2Ant.h:133: +void EXhalbtc8723b2ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool bWifiOnly); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #134: FILE: ./hal/HalBtc8723b2Ant.h:134: +void EXhalbtc8723b2ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #135: FILE: ./hal/HalBtc8723b2Ant.h:135: +void EXhalbtc8723b2ant_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #136: FILE: ./hal/HalBtc8723b2Ant.h:136: +void EXhalbtc8723b2ant_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #137: FILE: ./hal/HalBtc8723b2Ant.h:137: +void EXhalbtc8723b2ant_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #138: FILE: ./hal/HalBtc8723b2Ant.h:138: +void EXhalbtc8723b2ant_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 type); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #139: FILE: ./hal/HalBtc8723b2Ant.h:139: +void EXhalbtc8723b2ant_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, u8 type); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #140: FILE: ./hal/HalBtc8723b2Ant.h:140: +void EXhalbtc8723b2ant_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 type); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #142: FILE: ./hal/HalBtc8723b2Ant.h:142: + struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #144: FILE: ./hal/HalBtc8723b2Ant.h:144: +void EXhalbtc8723b2ant_HaltNotify(struct BTC_COEXIST * pBtCoexist); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #145: FILE: ./hal/HalBtc8723b2Ant.h:145: +void EXhalbtc8723b2ant_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #146: FILE: ./hal/HalBtc8723b2Ant.h:146: +void EXhalbtc8723b2ant_Periodical(struct BTC_COEXIST * pBtCoexist); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #147: FILE: ./hal/HalBtc8723b2Ant.h:147: +void EXhalbtc8723b2ant_DisplayCoexInfo(struct BTC_COEXIST * pBtCoexist); Signed-off-by: Marco Cesati --- .../staging/rtl8723bs/hal/HalBtc8723b2Ant.h | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h index 6375acede94c..f9a885f4ab89 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h @@ -129,19 +129,19 @@ struct COEX_STA_8723B_2ANT { /* */ /* The following is interface which will notify coex module. */ /* */ -void EXhalbtc8723b2ant_PowerOnSetting(struct BTC_COEXIST * pBtCoexist); -void EXhalbtc8723b2ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool bWifiOnly); -void EXhalbtc8723b2ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist); -void EXhalbtc8723b2ant_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); -void EXhalbtc8723b2ant_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); -void EXhalbtc8723b2ant_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type); -void EXhalbtc8723b2ant_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 type); -void EXhalbtc8723b2ant_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, u8 type); -void EXhalbtc8723b2ant_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 type); +void EXhalbtc8723b2ant_PowerOnSetting(struct BTC_COEXIST *pBtCoexist); +void EXhalbtc8723b2ant_InitHwConfig(struct BTC_COEXIST *pBtCoexist, bool bWifiOnly); +void EXhalbtc8723b2ant_InitCoexDm(struct BTC_COEXIST *pBtCoexist); +void EXhalbtc8723b2ant_IpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type); +void EXhalbtc8723b2ant_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type); +void EXhalbtc8723b2ant_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type); +void EXhalbtc8723b2ant_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 type); +void EXhalbtc8723b2ant_MediaStatusNotify(struct BTC_COEXIST *pBtCoexist, u8 type); +void EXhalbtc8723b2ant_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 type); void EXhalbtc8723b2ant_BtInfoNotify( - struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length + struct BTC_COEXIST *pBtCoexist, u8 *tmpBuf, u8 length ); -void EXhalbtc8723b2ant_HaltNotify(struct BTC_COEXIST * pBtCoexist); -void EXhalbtc8723b2ant_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState); -void EXhalbtc8723b2ant_Periodical(struct BTC_COEXIST * pBtCoexist); -void EXhalbtc8723b2ant_DisplayCoexInfo(struct BTC_COEXIST * pBtCoexist); +void EXhalbtc8723b2ant_HaltNotify(struct BTC_COEXIST *pBtCoexist); +void EXhalbtc8723b2ant_PnpNotify(struct BTC_COEXIST *pBtCoexist, u8 pnpState); +void EXhalbtc8723b2ant_Periodical(struct BTC_COEXIST *pBtCoexist); +void EXhalbtc8723b2ant_DisplayCoexInfo(struct BTC_COEXIST *pBtCoexist); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:27 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:27 +0100 Subject: [PATCH 06/57] Staging: rtl8723bs: fix spaces in HalBtcOutSrc.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-7-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #535: FILE: ./hal/HalBtcOutSrc.h:535: +void EXhalbtcoutsrc_PowerOnSetting(struct BTC_COEXIST * pBtCoexist); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #536: FILE: ./hal/HalBtcOutSrc.h:536: +void EXhalbtcoutsrc_InitHwConfig(struct BTC_COEXIST * pBtCoexist, u8 bWifiOnly); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #537: FILE: ./hal/HalBtcOutSrc.h:537: +void EXhalbtcoutsrc_InitCoexDm(struct BTC_COEXIST * pBtCoexist); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #538: FILE: ./hal/HalBtcOutSrc.h:538: +void EXhalbtcoutsrc_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #539: FILE: ./hal/HalBtcOutSrc.h:539: +void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #540: FILE: ./hal/HalBtcOutSrc.h:540: +void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #541: FILE: ./hal/HalBtcOutSrc.h:541: +void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 action); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #543: FILE: ./hal/HalBtcOutSrc.h:543: + struct BTC_COEXIST * pBtCoexist, enum RT_MEDIA_STATUS mediaStatus ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #545: FILE: ./hal/HalBtcOutSrc.h:545: +void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 pktType); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #547: FILE: ./hal/HalBtcOutSrc.h:547: + struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #549: FILE: ./hal/HalBtcOutSrc.h:549: +void EXhalbtcoutsrc_HaltNotify(struct BTC_COEXIST * pBtCoexist); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #550: FILE: ./hal/HalBtcOutSrc.h:550: +void EXhalbtcoutsrc_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #551: FILE: ./hal/HalBtcOutSrc.h:551: +void EXhalbtcoutsrc_Periodical(struct BTC_COEXIST * pBtCoexist); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #555: FILE: ./hal/HalBtcOutSrc.h:555: +void EXhalbtcoutsrc_DisplayBtCoexInfo(struct BTC_COEXIST * pBtCoexist); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h | 28 ++++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h index 6d60ad11588f..c38baf2bc412 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h +++ b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h @@ -532,26 +532,26 @@ struct BTC_COEXIST { extern struct BTC_COEXIST GLBtCoexist; -void EXhalbtcoutsrc_PowerOnSetting(struct BTC_COEXIST * pBtCoexist); -void EXhalbtcoutsrc_InitHwConfig(struct BTC_COEXIST * pBtCoexist, u8 bWifiOnly); -void EXhalbtcoutsrc_InitCoexDm(struct BTC_COEXIST * pBtCoexist); -void EXhalbtcoutsrc_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); -void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type); -void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type); -void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 action); +void EXhalbtcoutsrc_PowerOnSetting(struct BTC_COEXIST *pBtCoexist); +void EXhalbtcoutsrc_InitHwConfig(struct BTC_COEXIST *pBtCoexist, u8 bWifiOnly); +void EXhalbtcoutsrc_InitCoexDm(struct BTC_COEXIST *pBtCoexist); +void EXhalbtcoutsrc_IpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type); +void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type); +void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type); +void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 action); void EXhalbtcoutsrc_MediaStatusNotify( - struct BTC_COEXIST * pBtCoexist, enum RT_MEDIA_STATUS mediaStatus + struct BTC_COEXIST *pBtCoexist, enum RT_MEDIA_STATUS mediaStatus ); -void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 pktType); +void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 pktType); void EXhalbtcoutsrc_BtInfoNotify( - struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length + struct BTC_COEXIST *pBtCoexist, u8 *tmpBuf, u8 length ); -void EXhalbtcoutsrc_HaltNotify(struct BTC_COEXIST * pBtCoexist); -void EXhalbtcoutsrc_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState); -void EXhalbtcoutsrc_Periodical(struct BTC_COEXIST * pBtCoexist); +void EXhalbtcoutsrc_HaltNotify(struct BTC_COEXIST *pBtCoexist); +void EXhalbtcoutsrc_PnpNotify(struct BTC_COEXIST *pBtCoexist, u8 pnpState); +void EXhalbtcoutsrc_Periodical(struct BTC_COEXIST *pBtCoexist); void EXhalbtcoutsrc_SetChipType(u8 chipType); void EXhalbtcoutsrc_SetAntNum(u8 type, u8 antNum); void EXhalbtcoutsrc_SetSingleAntPath(u8 singleAntPath); -void EXhalbtcoutsrc_DisplayBtCoexInfo(struct BTC_COEXIST * pBtCoexist); +void EXhalbtcoutsrc_DisplayBtCoexInfo(struct BTC_COEXIST *pBtCoexist); #endif -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:25 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:25 +0100 Subject: [PATCH 04/57] Staging: rtl8723bs: fix spaces in HalBtc8723b2Ant.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-5-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #19: FILE: ./hal/HalBtc8723b2Ant.c:19: +static struct COEX_DM_8723B_2ANT * pCoexDm = &GLCoexDm8723b2Ant; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #21: FILE: ./hal/HalBtc8723b2Ant.c:21: +static struct COEX_STA_8723B_2ANT * pCoexSta = &GLCoexSta8723b2Ant; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #111: FILE: ./hal/HalBtc8723b2Ant.c:111: + struct BTC_COEXIST * pBtCoexist, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #192: FILE: ./hal/HalBtc8723b2Ant.c:192: + struct BTC_COEXIST * pBtCoexist, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #215: FILE: ./hal/HalBtc8723b2Ant.c:215: +static void halbtc8723b2ant_MonitorBtCtr(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #265: FILE: ./hal/HalBtc8723b2Ant.c:265: +static void halbtc8723b2ant_QueryBtInfo(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #282: FILE: ./hal/HalBtc8723b2Ant.c:282: +static bool halbtc8723b2ant_IsWifiStatusChanged(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #313: FILE: ./hal/HalBtc8723b2Ant.c:313: +static void halbtc8723b2ant_UpdateBtLinkInfo(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #315: FILE: ./hal/HalBtc8723b2Ant.c:315: + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #377: FILE: ./hal/HalBtc8723b2Ant.c:377: +static u8 halbtc8723b2ant_ActionAlgorithm(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #379: FILE: ./hal/HalBtc8723b2Ant.c:379: + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #552: FILE: ./hal/HalBtc8723b2Ant.c:552: + struct BTC_COEXIST * pBtCoexist, u8 dacSwingLvl ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #576: FILE: ./hal/HalBtc8723b2Ant.c:576: + struct BTC_COEXIST * pBtCoexist, u8 decBtPwrLvl ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #597: FILE: ./hal/HalBtc8723b2Ant.c:597: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 decBtPwrLvl ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #631: FILE: ./hal/HalBtc8723b2Ant.c:631: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 fwDacSwingLvl ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #666: FILE: ./hal/HalBtc8723b2Ant.c:666: + struct BTC_COEXIST * pBtCoexist, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #689: FILE: ./hal/HalBtc8723b2Ant.c:689: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bRxRfShrinkOn ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #723: FILE: ./hal/HalBtc8723b2Ant.c:723: + struct BTC_COEXIST * pBtCoexist, bool bLowPenaltyRa ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #751: FILE: ./hal/HalBtc8723b2Ant.c:751: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bLowPenaltyRa ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #785: FILE: ./hal/HalBtc8723b2Ant.c:785: +static void halbtc8723b2ant_SetDacSwingReg(struct BTC_COEXIST * pBtCoexist, u32 level) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #798: FILE: ./hal/HalBtc8723b2Ant.c:798: + struct BTC_COEXIST * pBtCoexist, bool bSwDacSwingOn, u32 swDacSwingLvl ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #809: FILE: ./hal/HalBtc8723b2Ant.c:809: + struct BTC_COEXIST * pBtCoexist, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #853: FILE: ./hal/HalBtc8723b2Ant.c:853: + struct BTC_COEXIST * pBtCoexist, bool bAgcTableEn ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #913: FILE: ./hal/HalBtc8723b2Ant.c:913: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bAgcTableEn ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #947: FILE: ./hal/HalBtc8723b2Ant.c:947: + struct BTC_COEXIST * pBtCoexist, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #984: FILE: ./hal/HalBtc8723b2Ant.c:984: + struct BTC_COEXIST * pBtCoexist, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1050: FILE: ./hal/HalBtc8723b2Ant.c:1050: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 type ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1099: FILE: ./hal/HalBtc8723b2Ant.c:1099: + struct BTC_COEXIST * pBtCoexist, bool bEnable ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1120: FILE: ./hal/HalBtc8723b2Ant.c:1120: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bEnable ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1148: FILE: ./hal/HalBtc8723b2Ant.c:1148: + struct BTC_COEXIST * pBtCoexist, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1187: FILE: ./hal/HalBtc8723b2Ant.c:1187: + struct BTC_COEXIST * pBtCoexist, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1199: FILE: ./hal/HalBtc8723b2Ant.c:1199: + struct BTC_COEXIST * pBtCoexist, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1211: FILE: ./hal/HalBtc8723b2Ant.c:1211: + struct BTC_COEXIST * pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1214: FILE: ./hal/HalBtc8723b2Ant.c:1214: + struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1305: FILE: ./hal/HalBtc8723b2Ant.c:1305: + struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bTurnOn, u8 type ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1437: FILE: ./hal/HalBtc8723b2Ant.c:1437: +static void halbtc8723b2ant_CoexAllOff(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1453: FILE: ./hal/HalBtc8723b2Ant.c:1453: +static void halbtc8723b2ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1465: FILE: ./hal/HalBtc8723b2Ant.c:1465: +static void halbtc8723b2ant_ActionBtInquiry(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1493: FILE: ./hal/HalBtc8723b2Ant.c:1493: +static bool halbtc8723b2ant_IsCommonAction(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1594: FILE: ./hal/HalBtc8723b2Ant.c:1594: + struct BTC_COEXIST * pBtCoexist, bool bScoHid, bool bTxPause, u8 maxInterval ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2044: FILE: ./hal/HalBtc8723b2Ant.c:2044: +static void halbtc8723b2ant_ActionSco(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2099: FILE: ./hal/HalBtc8723b2Ant.c:2099: +static void halbtc8723b2ant_ActionHid(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2160: FILE: ./hal/HalBtc8723b2Ant.c:2160: +static void halbtc8723b2ant_ActionA2dp(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2241: FILE: ./hal/HalBtc8723b2Ant.c:2241: +static void halbtc8723b2ant_ActionA2dpPanHs(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2291: FILE: ./hal/HalBtc8723b2Ant.c:2291: +static void halbtc8723b2ant_ActionPanEdr(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2349: FILE: ./hal/HalBtc8723b2Ant.c:2349: +static void halbtc8723b2ant_ActionPanHs(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2399: FILE: ./hal/HalBtc8723b2Ant.c:2399: +static void halbtc8723b2ant_ActionPanEdrA2dp(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2460: FILE: ./hal/HalBtc8723b2Ant.c:2460: +static void halbtc8723b2ant_ActionPanEdrHid(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2524: FILE: ./hal/HalBtc8723b2Ant.c:2524: +static void halbtc8723b2ant_ActionHidA2dpPanEdr(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2584: FILE: ./hal/HalBtc8723b2Ant.c:2584: +static void halbtc8723b2ant_ActionHidA2dp(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2659: FILE: ./hal/HalBtc8723b2Ant.c:2659: +static void halbtc8723b2ant_RunCoexistMechanism(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2758: FILE: ./hal/HalBtc8723b2Ant.c:2758: +static void halbtc8723b2ant_WifiOffHwCfg(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2783: FILE: ./hal/HalBtc8723b2Ant.c:2783: +static void halbtc8723b2ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool bBackUp) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2817: FILE: ./hal/HalBtc8723b2Ant.c:2817: +void EXhalbtc8723b2ant_PowerOnSetting(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2819: FILE: ./hal/HalBtc8723b2Ant.c:2819: + struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2869: FILE: ./hal/HalBtc8723b2Ant.c:2869: +void EXhalbtc8723b2ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool bWifiOnly) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2874: FILE: ./hal/HalBtc8723b2Ant.c:2874: +void EXhalbtc8723b2ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2881: FILE: ./hal/HalBtc8723b2Ant.c:2881: +void EXhalbtc8723b2ant_DisplayCoexInfo(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2883: FILE: ./hal/HalBtc8723b2Ant.c:2883: + struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2884: FILE: ./hal/HalBtc8723b2Ant.c:2884: + struct BTC_STACK_INFO * pStackInfo = &pBtCoexist->stackInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2885: FILE: ./hal/HalBtc8723b2Ant.c:2885: + struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3262: FILE: ./hal/HalBtc8723b2Ant.c:3262: +void EXhalbtc8723b2ant_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3279: FILE: ./hal/HalBtc8723b2Ant.c:3279: +void EXhalbtc8723b2ant_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3290: FILE: ./hal/HalBtc8723b2Ant.c:3290: +void EXhalbtc8723b2ant_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3299: FILE: ./hal/HalBtc8723b2Ant.c:3299: +void EXhalbtc8723b2ant_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 type) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3308: FILE: ./hal/HalBtc8723b2Ant.c:3308: +void EXhalbtc8723b2ant_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, u8 type) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3354: FILE: ./hal/HalBtc8723b2Ant.c:3354: +void EXhalbtc8723b2ant_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 type) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3362: FILE: ./hal/HalBtc8723b2Ant.c:3362: + struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3506: FILE: ./hal/HalBtc8723b2Ant.c:3506: +void EXhalbtc8723b2ant_HaltNotify(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3517: FILE: ./hal/HalBtc8723b2Ant.c:3517: +void EXhalbtc8723b2ant_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #3531: FILE: ./hal/HalBtc8723b2Ant.c:3531: +void EXhalbtc8723b2ant_Periodical(struct BTC_COEXIST * pBtCoexist) Signed-off-by: Marco Cesati --- .../staging/rtl8723bs/hal/HalBtc8723b2Ant.c | 142 +++++++++--------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c index cd09e6e288fc..8d5f666b2e23 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c @@ -16,9 +16,9 @@ do { \ /* Global variables, these are static variables */ static struct COEX_DM_8723B_2ANT GLCoexDm8723b2Ant; -static struct COEX_DM_8723B_2ANT * pCoexDm = &GLCoexDm8723b2Ant; +static struct COEX_DM_8723B_2ANT *pCoexDm = &GLCoexDm8723b2Ant; static struct COEX_STA_8723B_2ANT GLCoexSta8723b2Ant; -static struct COEX_STA_8723B_2ANT * pCoexSta = &GLCoexSta8723b2Ant; +static struct COEX_STA_8723B_2ANT *pCoexSta = &GLCoexSta8723b2Ant; static const char *const GLBtInfoSrc8723b2Ant[] = { "BT Info[wifi fw]", @@ -108,7 +108,7 @@ static u8 halbtc8723b2ant_BtRssiState( } static u8 halbtc8723b2ant_WifiRssiState( - struct BTC_COEXIST * pBtCoexist, + struct BTC_COEXIST *pBtCoexist, u8 index, u8 levelNum, u8 rssiThresh, @@ -189,7 +189,7 @@ static u8 halbtc8723b2ant_WifiRssiState( } static void halbtc8723b2ant_LimitedRx( - struct BTC_COEXIST * pBtCoexist, + struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bRejApAggPkt, bool bBtCtrlAggBufSize, @@ -212,7 +212,7 @@ static void halbtc8723b2ant_LimitedRx( pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL); } -static void halbtc8723b2ant_MonitorBtCtr(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_MonitorBtCtr(struct BTC_COEXIST *pBtCoexist) { u32 regHPTxRx, regLPTxRx, u4Tmp; u32 regHPTx = 0, regHPRx = 0, regLPTx = 0, regLPRx = 0; @@ -262,7 +262,7 @@ static void halbtc8723b2ant_MonitorBtCtr(struct BTC_COEXIST * pBtCoexist) pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); } -static void halbtc8723b2ant_QueryBtInfo(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_QueryBtInfo(struct BTC_COEXIST *pBtCoexist) { u8 H2C_Parameter[1] = {0}; @@ -279,7 +279,7 @@ static void halbtc8723b2ant_QueryBtInfo(struct BTC_COEXIST * pBtCoexist) pBtCoexist->fBtcFillH2c(pBtCoexist, 0x61, 1, H2C_Parameter); } -static bool halbtc8723b2ant_IsWifiStatusChanged(struct BTC_COEXIST * pBtCoexist) +static bool halbtc8723b2ant_IsWifiStatusChanged(struct BTC_COEXIST *pBtCoexist) { static bool bPreWifiBusy, bPreUnder4way, bPreBtHsOn; bool bWifiBusy = false, bUnder4way = false, bBtHsOn = false; @@ -310,9 +310,9 @@ static bool halbtc8723b2ant_IsWifiStatusChanged(struct BTC_COEXIST * pBtCoexist) return false; } -static void halbtc8723b2ant_UpdateBtLinkInfo(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_UpdateBtLinkInfo(struct BTC_COEXIST *pBtCoexist) { - struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bBtHsOn = false; pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); @@ -374,9 +374,9 @@ static void halbtc8723b2ant_UpdateBtLinkInfo(struct BTC_COEXIST * pBtCoexist) pBtLinkInfo->bHidOnly = false; } -static u8 halbtc8723b2ant_ActionAlgorithm(struct BTC_COEXIST * pBtCoexist) +static u8 halbtc8723b2ant_ActionAlgorithm(struct BTC_COEXIST *pBtCoexist) { - struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bBtHsOn = false; u8 algorithm = BT_8723B_2ANT_COEX_ALGO_UNDEFINED; u8 numOfDiffProfile = 0; @@ -549,7 +549,7 @@ static u8 halbtc8723b2ant_ActionAlgorithm(struct BTC_COEXIST * pBtCoexist) } static void halbtc8723b2ant_SetFwDacSwingLevel( - struct BTC_COEXIST * pBtCoexist, u8 dacSwingLvl + struct BTC_COEXIST *pBtCoexist, u8 dacSwingLvl ) { u8 H2C_Parameter[1] = {0}; @@ -573,7 +573,7 @@ static void halbtc8723b2ant_SetFwDacSwingLevel( } static void halbtc8723b2ant_SetFwDecBtPwr( - struct BTC_COEXIST * pBtCoexist, u8 decBtPwrLvl + struct BTC_COEXIST *pBtCoexist, u8 decBtPwrLvl ) { u8 H2C_Parameter[1] = {0}; @@ -594,7 +594,7 @@ static void halbtc8723b2ant_SetFwDecBtPwr( } static void halbtc8723b2ant_DecBtPwr( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 decBtPwrLvl + struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 decBtPwrLvl ) { BTC_PRINT( @@ -628,7 +628,7 @@ static void halbtc8723b2ant_DecBtPwr( } static void halbtc8723b2ant_FwDacSwingLvl( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 fwDacSwingLvl + struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 fwDacSwingLvl ) { BTC_PRINT( @@ -663,7 +663,7 @@ static void halbtc8723b2ant_FwDacSwingLvl( } static void halbtc8723b2ant_SetSwRfRxLpfCorner( - struct BTC_COEXIST * pBtCoexist, + struct BTC_COEXIST *pBtCoexist, bool bRxRfShrinkOn ) { @@ -686,7 +686,7 @@ static void halbtc8723b2ant_SetSwRfRxLpfCorner( } static void halbtc8723b2ant_RfShrink( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bRxRfShrinkOn + struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bRxRfShrinkOn ) { BTC_PRINT( @@ -720,7 +720,7 @@ static void halbtc8723b2ant_RfShrink( } static void halbtc8723b2ant_SetSwPenaltyTxRateAdaptive( - struct BTC_COEXIST * pBtCoexist, bool bLowPenaltyRa + struct BTC_COEXIST *pBtCoexist, bool bLowPenaltyRa ) { u8 H2C_Parameter[6] = {0}; @@ -748,7 +748,7 @@ static void halbtc8723b2ant_SetSwPenaltyTxRateAdaptive( } static void halbtc8723b2ant_LowPenaltyRa( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bLowPenaltyRa + struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bLowPenaltyRa ) { /* return; */ @@ -782,7 +782,7 @@ static void halbtc8723b2ant_LowPenaltyRa( pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa; } -static void halbtc8723b2ant_SetDacSwingReg(struct BTC_COEXIST * pBtCoexist, u32 level) +static void halbtc8723b2ant_SetDacSwingReg(struct BTC_COEXIST *pBtCoexist, u32 level) { u8 val = (u8)level; @@ -795,7 +795,7 @@ static void halbtc8723b2ant_SetDacSwingReg(struct BTC_COEXIST * pBtCoexist, u32 } static void halbtc8723b2ant_SetSwFullTimeDacSwing( - struct BTC_COEXIST * pBtCoexist, bool bSwDacSwingOn, u32 swDacSwingLvl + struct BTC_COEXIST *pBtCoexist, bool bSwDacSwingOn, u32 swDacSwingLvl ) { if (bSwDacSwingOn) @@ -806,7 +806,7 @@ static void halbtc8723b2ant_SetSwFullTimeDacSwing( static void halbtc8723b2ant_DacSwing( - struct BTC_COEXIST * pBtCoexist, + struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bDacSwingOn, u32 dacSwingLvl @@ -850,7 +850,7 @@ static void halbtc8723b2ant_DacSwing( } static void halbtc8723b2ant_SetAgcTable( - struct BTC_COEXIST * pBtCoexist, bool bAgcTableEn + struct BTC_COEXIST *pBtCoexist, bool bAgcTableEn ) { u8 rssiAdjustVal = 0; @@ -910,7 +910,7 @@ static void halbtc8723b2ant_SetAgcTable( } static void halbtc8723b2ant_AgcTable( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bAgcTableEn + struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bAgcTableEn ) { BTC_PRINT( @@ -944,7 +944,7 @@ static void halbtc8723b2ant_AgcTable( } static void halbtc8723b2ant_SetCoexTable( - struct BTC_COEXIST * pBtCoexist, + struct BTC_COEXIST *pBtCoexist, u32 val0x6c0, u32 val0x6c4, u32 val0x6c8, @@ -981,7 +981,7 @@ static void halbtc8723b2ant_SetCoexTable( } static void halbtc8723b2ant_CoexTable( - struct BTC_COEXIST * pBtCoexist, + struct BTC_COEXIST *pBtCoexist, bool bForceExec, u32 val0x6c0, u32 val0x6c4, @@ -1047,7 +1047,7 @@ static void halbtc8723b2ant_CoexTable( } static void halbtc8723b2ant_CoexTableWithType( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, u8 type + struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 type ) { switch (type) { @@ -1096,7 +1096,7 @@ static void halbtc8723b2ant_CoexTableWithType( } static void halbtc8723b2ant_SetFwIgnoreWlanAct( - struct BTC_COEXIST * pBtCoexist, bool bEnable + struct BTC_COEXIST *pBtCoexist, bool bEnable ) { u8 H2C_Parameter[1] = {0}; @@ -1117,7 +1117,7 @@ static void halbtc8723b2ant_SetFwIgnoreWlanAct( } static void halbtc8723b2ant_IgnoreWlanAct( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bEnable + struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bEnable ) { BTC_PRINT( @@ -1145,7 +1145,7 @@ static void halbtc8723b2ant_IgnoreWlanAct( } static void halbtc8723b2ant_SetFwPstdma( - struct BTC_COEXIST * pBtCoexist, + struct BTC_COEXIST *pBtCoexist, u8 byte1, u8 byte2, u8 byte3, @@ -1184,7 +1184,7 @@ static void halbtc8723b2ant_SetFwPstdma( } static void halbtc8723b2ant_SwMechanism1( - struct BTC_COEXIST * pBtCoexist, + struct BTC_COEXIST *pBtCoexist, bool bShrinkRxLPF, bool bLowPenaltyRA, bool bLimitedDIG, @@ -1196,7 +1196,7 @@ static void halbtc8723b2ant_SwMechanism1( } static void halbtc8723b2ant_SwMechanism2( - struct BTC_COEXIST * pBtCoexist, + struct BTC_COEXIST *pBtCoexist, bool bAGCTableShift, bool bADCBackOff, bool bSWDACSwing, @@ -1208,10 +1208,10 @@ static void halbtc8723b2ant_SwMechanism2( } static void halbtc8723b2ant_SetAntPath( - struct BTC_COEXIST * pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff + struct BTC_COEXIST *pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff ) { - struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; + struct BTC_BOARD_INFO *pBoardInfo = &pBtCoexist->boardInfo; u32 fwVer = 0, u4Tmp = 0; bool bPgExtSwitch = false; bool bUseExtSwitch = false; @@ -1302,7 +1302,7 @@ static void halbtc8723b2ant_SetAntPath( } static void halbtc8723b2ant_PsTdma( - struct BTC_COEXIST * pBtCoexist, bool bForceExec, bool bTurnOn, u8 type + struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bTurnOn, u8 type ) { BTC_PRINT( @@ -1434,7 +1434,7 @@ static void halbtc8723b2ant_PsTdma( pCoexDm->prePsTdma = pCoexDm->curPsTdma; } -static void halbtc8723b2ant_CoexAllOff(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_CoexAllOff(struct BTC_COEXIST *pBtCoexist) { /* fw all off */ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, false, 1); @@ -1450,7 +1450,7 @@ static void halbtc8723b2ant_CoexAllOff(struct BTC_COEXIST * pBtCoexist) halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0); } -static void halbtc8723b2ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_InitCoexDm(struct BTC_COEXIST *pBtCoexist) { /* force to reset coex mechanism */ @@ -1462,7 +1462,7 @@ static void halbtc8723b2ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist) halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); } -static void halbtc8723b2ant_ActionBtInquiry(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_ActionBtInquiry(struct BTC_COEXIST *pBtCoexist) { bool bWifiConnected = false; bool bLowPwrDisable = true; @@ -1490,7 +1490,7 @@ static void halbtc8723b2ant_ActionBtInquiry(struct BTC_COEXIST * pBtCoexist) halbtc8723b2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_AUX, false, false); } -static bool halbtc8723b2ant_IsCommonAction(struct BTC_COEXIST * pBtCoexist) +static bool halbtc8723b2ant_IsCommonAction(struct BTC_COEXIST *pBtCoexist) { u8 btRssiState = BTC_RSSI_STATE_HIGH; bool bCommon = false, bWifiConnected = false, bWifiBusy = false; @@ -1591,7 +1591,7 @@ static bool halbtc8723b2ant_IsCommonAction(struct BTC_COEXIST * pBtCoexist) } static void halbtc8723b2ant_TdmaDurationAdjust( - struct BTC_COEXIST * pBtCoexist, bool bScoHid, bool bTxPause, u8 maxInterval + struct BTC_COEXIST *pBtCoexist, bool bScoHid, bool bTxPause, u8 maxInterval ) { static s32 up, dn, m, n, WaitCount; @@ -2041,7 +2041,7 @@ static void halbtc8723b2ant_TdmaDurationAdjust( } /* SCO only or SCO+PAN(HS) */ -static void halbtc8723b2ant_ActionSco(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_ActionSco(struct BTC_COEXIST *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2096,7 +2096,7 @@ static void halbtc8723b2ant_ActionSco(struct BTC_COEXIST * pBtCoexist) } -static void halbtc8723b2ant_ActionHid(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_ActionHid(struct BTC_COEXIST *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2157,7 +2157,7 @@ static void halbtc8723b2ant_ActionHid(struct BTC_COEXIST * pBtCoexist) } /* A2DP only / PAN(EDR) only/ A2DP+PAN(HS) */ -static void halbtc8723b2ant_ActionA2dp(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_ActionA2dp(struct BTC_COEXIST *pBtCoexist) { u8 wifiRssiState, wifiRssiState1, btRssiState; u32 wifiBw; @@ -2238,7 +2238,7 @@ static void halbtc8723b2ant_ActionA2dp(struct BTC_COEXIST * pBtCoexist) } } -static void halbtc8723b2ant_ActionA2dpPanHs(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_ActionA2dpPanHs(struct BTC_COEXIST *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2288,7 +2288,7 @@ static void halbtc8723b2ant_ActionA2dpPanHs(struct BTC_COEXIST * pBtCoexist) } } -static void halbtc8723b2ant_ActionPanEdr(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_ActionPanEdr(struct BTC_COEXIST *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2346,7 +2346,7 @@ static void halbtc8723b2ant_ActionPanEdr(struct BTC_COEXIST * pBtCoexist) /* PAN(HS) only */ -static void halbtc8723b2ant_ActionPanHs(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_ActionPanHs(struct BTC_COEXIST *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2396,7 +2396,7 @@ static void halbtc8723b2ant_ActionPanHs(struct BTC_COEXIST * pBtCoexist) } /* PAN(EDR)+A2DP */ -static void halbtc8723b2ant_ActionPanEdrA2dp(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_ActionPanEdrA2dp(struct BTC_COEXIST *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2457,7 +2457,7 @@ static void halbtc8723b2ant_ActionPanEdrA2dp(struct BTC_COEXIST * pBtCoexist) } } -static void halbtc8723b2ant_ActionPanEdrHid(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_ActionPanEdrHid(struct BTC_COEXIST *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2521,7 +2521,7 @@ static void halbtc8723b2ant_ActionPanEdrHid(struct BTC_COEXIST * pBtCoexist) } /* HID+A2DP+PAN(EDR) */ -static void halbtc8723b2ant_ActionHidA2dpPanEdr(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_ActionHidA2dpPanEdr(struct BTC_COEXIST *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2581,7 +2581,7 @@ static void halbtc8723b2ant_ActionHidA2dpPanEdr(struct BTC_COEXIST * pBtCoexist) } } -static void halbtc8723b2ant_ActionHidA2dp(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_ActionHidA2dp(struct BTC_COEXIST *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2656,7 +2656,7 @@ static void halbtc8723b2ant_ActionHidA2dp(struct BTC_COEXIST * pBtCoexist) } } -static void halbtc8723b2ant_RunCoexistMechanism(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_RunCoexistMechanism(struct BTC_COEXIST *pBtCoexist) { u8 algorithm = 0; @@ -2755,7 +2755,7 @@ static void halbtc8723b2ant_RunCoexistMechanism(struct BTC_COEXIST * pBtCoexist) } } -static void halbtc8723b2ant_WifiOffHwCfg(struct BTC_COEXIST * pBtCoexist) +static void halbtc8723b2ant_WifiOffHwCfg(struct BTC_COEXIST *pBtCoexist) { bool bIsInMpMode = false; u8 H2C_Parameter[2] = {0}; @@ -2780,7 +2780,7 @@ static void halbtc8723b2ant_WifiOffHwCfg(struct BTC_COEXIST * pBtCoexist) pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1); /* BT select s0/s1 is controlled by WiFi */ } -static void halbtc8723b2ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool bBackUp) +static void halbtc8723b2ant_InitHwConfig(struct BTC_COEXIST *pBtCoexist, bool bBackUp) { u8 u1Tmp = 0; @@ -2814,9 +2814,9 @@ static void halbtc8723b2ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool b /* */ /* extern function start with EXhalbtc8723b2ant_ */ /* */ -void EXhalbtc8723b2ant_PowerOnSetting(struct BTC_COEXIST * pBtCoexist) +void EXhalbtc8723b2ant_PowerOnSetting(struct BTC_COEXIST *pBtCoexist) { - struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; + struct BTC_BOARD_INFO *pBoardInfo = &pBtCoexist->boardInfo; u8 u1Tmp = 0x4; /* Set BIT2 by default since it's 2ant case */ u16 u2Tmp = 0x0; @@ -2866,23 +2866,23 @@ void EXhalbtc8723b2ant_PowerOnSetting(struct BTC_COEXIST * pBtCoexist) } } -void EXhalbtc8723b2ant_InitHwConfig(struct BTC_COEXIST * pBtCoexist, bool bWifiOnly) +void EXhalbtc8723b2ant_InitHwConfig(struct BTC_COEXIST *pBtCoexist, bool bWifiOnly) { halbtc8723b2ant_InitHwConfig(pBtCoexist, true); } -void EXhalbtc8723b2ant_InitCoexDm(struct BTC_COEXIST * pBtCoexist) +void EXhalbtc8723b2ant_InitCoexDm(struct BTC_COEXIST *pBtCoexist) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n")); halbtc8723b2ant_InitCoexDm(pBtCoexist); } -void EXhalbtc8723b2ant_DisplayCoexInfo(struct BTC_COEXIST * pBtCoexist) +void EXhalbtc8723b2ant_DisplayCoexInfo(struct BTC_COEXIST *pBtCoexist) { - struct BTC_BOARD_INFO * pBoardInfo = &pBtCoexist->boardInfo; - struct BTC_STACK_INFO * pStackInfo = &pBtCoexist->stackInfo; - struct BTC_BT_LINK_INFO * pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct BTC_BOARD_INFO *pBoardInfo = &pBtCoexist->boardInfo; + struct BTC_STACK_INFO *pStackInfo = &pBtCoexist->stackInfo; + struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; u8 *cliBuf = pBtCoexist->cliBuf; u8 u1Tmp[4], i, btInfoExt, psTdmaCase = 0; u32 u4Tmp[4]; @@ -3259,7 +3259,7 @@ void EXhalbtc8723b2ant_DisplayCoexInfo(struct BTC_COEXIST * pBtCoexist) } -void EXhalbtc8723b2ant_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) +void EXhalbtc8723b2ant_IpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) { if (BTC_IPS_ENTER == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS ENTER notify\n")); @@ -3276,7 +3276,7 @@ void EXhalbtc8723b2ant_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) } } -void EXhalbtc8723b2ant_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) +void EXhalbtc8723b2ant_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) { if (BTC_LPS_ENABLE == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS ENABLE notify\n")); @@ -3287,7 +3287,7 @@ void EXhalbtc8723b2ant_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) } } -void EXhalbtc8723b2ant_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type) +void EXhalbtc8723b2ant_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type) { if (BTC_SCAN_START == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n")); @@ -3296,7 +3296,7 @@ void EXhalbtc8723b2ant_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type) } } -void EXhalbtc8723b2ant_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 type) +void EXhalbtc8723b2ant_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 type) { if (BTC_ASSOCIATE_START == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n")); @@ -3305,7 +3305,7 @@ void EXhalbtc8723b2ant_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 type) } } -void EXhalbtc8723b2ant_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, u8 type) +void EXhalbtc8723b2ant_MediaStatusNotify(struct BTC_COEXIST *pBtCoexist, u8 type) { u8 H2C_Parameter[3] = {0}; u32 wifiBw; @@ -3351,7 +3351,7 @@ void EXhalbtc8723b2ant_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, u8 typ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter); } -void EXhalbtc8723b2ant_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 type) +void EXhalbtc8723b2ant_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 type) { if (type == BTC_PACKET_DHCP) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], DHCP Packet notify\n")); @@ -3359,7 +3359,7 @@ void EXhalbtc8723b2ant_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 t } void EXhalbtc8723b2ant_BtInfoNotify( - struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length + struct BTC_COEXIST *pBtCoexist, u8 *tmpBuf, u8 length ) { u8 btInfo = 0; @@ -3503,7 +3503,7 @@ void EXhalbtc8723b2ant_BtInfoNotify( halbtc8723b2ant_RunCoexistMechanism(pBtCoexist); } -void EXhalbtc8723b2ant_HaltNotify(struct BTC_COEXIST * pBtCoexist) +void EXhalbtc8723b2ant_HaltNotify(struct BTC_COEXIST *pBtCoexist) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n")); @@ -3514,7 +3514,7 @@ void EXhalbtc8723b2ant_HaltNotify(struct BTC_COEXIST * pBtCoexist) EXhalbtc8723b2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT); } -void EXhalbtc8723b2ant_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState) +void EXhalbtc8723b2ant_PnpNotify(struct BTC_COEXIST *pBtCoexist, u8 pnpState) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify\n")); @@ -3528,7 +3528,7 @@ void EXhalbtc8723b2ant_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState) } } -void EXhalbtc8723b2ant_Periodical(struct BTC_COEXIST * pBtCoexist) +void EXhalbtc8723b2ant_Periodical(struct BTC_COEXIST *pBtCoexist) { static u8 disVerInfoCnt; u32 fwVer = 0, btPatchVer = 0; -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:28 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:28 +0100 Subject: [PATCH 07/57] Staging: rtl8723bs: fix spaces in HalHWImg8723B_BB.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-8-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #12: FILE: ./hal/HalHWImg8723B_BB.c:12: + struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #115: FILE: ./hal/HalHWImg8723B_BB.c:115: + struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #260: FILE: ./hal/HalHWImg8723B_BB.c:260: +void ODM_ReadAndConfig_MP_8723B_AGC_TAB(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #529: FILE: ./hal/HalHWImg8723B_BB.c:529: +void ODM_ReadAndConfig_MP_8723B_PHY_REG(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #609: FILE: ./hal/HalHWImg8723B_BB.c:609: +void ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(struct DM_ODM_T * pDM_Odm) Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c index a31ab66941ac..4faa9038417d 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c @@ -9,7 +9,7 @@ #include "odm_precomp.h" static bool CheckPositive( - struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 + struct DM_ODM_T *pDM_Odm, const u32 Condition1, const u32 Condition2 ) { u8 _BoardType = @@ -112,7 +112,7 @@ static bool CheckPositive( } static bool CheckNegative( - struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 + struct DM_ODM_T *pDM_Odm, const u32 Condition1, const u32 Condition2 ) { return true; @@ -257,7 +257,7 @@ static u32 Array_MP_8723B_AGC_TAB[] = { }; -void ODM_ReadAndConfig_MP_8723B_AGC_TAB(struct DM_ODM_T * pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_AGC_TAB(struct DM_ODM_T *pDM_Odm) { u32 i = 0; u32 ArrayLen = ARRAY_SIZE(Array_MP_8723B_AGC_TAB); @@ -526,7 +526,7 @@ static u32 Array_MP_8723B_PHY_REG[] = { }; -void ODM_ReadAndConfig_MP_8723B_PHY_REG(struct DM_ODM_T * pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_PHY_REG(struct DM_ODM_T *pDM_Odm) { u32 i = 0; u32 ArrayLen = ARRAY_SIZE(Array_MP_8723B_PHY_REG); @@ -606,7 +606,7 @@ static u32 Array_MP_8723B_PHY_REG_PG[] = { 0, 0, 0, 0x00000e14, 0xffffffff, 0x26303436 }; -void ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(struct DM_ODM_T * pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(struct DM_ODM_T *pDM_Odm) { u32 i = 0; u32 *Array = Array_MP_8723B_PHY_REG_PG; -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:29 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:29 +0100 Subject: [PATCH 08/57] Staging: rtl8723bs: fix spaces in HalHWImg8723B_BB.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-9-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #18: FILE: ./hal/HalHWImg8723B_BB.h:18: + struct DM_ODM_T * pDM_Odm ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #27: FILE: ./hal/HalHWImg8723B_BB.h:27: + struct DM_ODM_T * pDM_Odm ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #36: FILE: ./hal/HalHWImg8723B_BB.h:36: + struct DM_ODM_T * pDM_Odm Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.h b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.h index 69485ce3a408..1cb572604206 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.h +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.h @@ -15,7 +15,7 @@ void ODM_ReadAndConfig_MP_8723B_AGC_TAB(/* TC: Test Chip, MP: MP Chip */ - struct DM_ODM_T * pDM_Odm + struct DM_ODM_T *pDM_Odm ); /****************************************************************************** @@ -24,7 +24,7 @@ ODM_ReadAndConfig_MP_8723B_AGC_TAB(/* TC: Test Chip, MP: MP Chip */ void ODM_ReadAndConfig_MP_8723B_PHY_REG(/* TC: Test Chip, MP: MP Chip */ - struct DM_ODM_T * pDM_Odm + struct DM_ODM_T *pDM_Odm ); /****************************************************************************** @@ -33,7 +33,7 @@ ODM_ReadAndConfig_MP_8723B_PHY_REG(/* TC: Test Chip, MP: MP Chip */ void ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(/* TC: Test Chip, MP: MP Chip */ - struct DM_ODM_T * pDM_Odm + struct DM_ODM_T *pDM_Odm ); u32 ODM_GetVersion_MP_8723B_PHY_REG_PG(void); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:30 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:30 +0100 Subject: [PATCH 09/57] Staging: rtl8723bs: fix spaces in HalHWImg8723B_MAC.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-10-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #12: FILE: ./hal/HalHWImg8723B_MAC.c:12: + struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #114: FILE: ./hal/HalHWImg8723B_MAC.c:114: + struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #231: FILE: ./hal/HalHWImg8723B_MAC.c:231: +void ODM_ReadAndConfig_MP_8723B_MAC_REG(struct DM_ODM_T * pDM_Odm) Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c index 3408dee976a1..51d7bf3e6d83 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c @@ -9,7 +9,7 @@ #include "odm_precomp.h" static bool CheckPositive( - struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 + struct DM_ODM_T *pDM_Odm, const u32 Condition1, const u32 Condition2 ) { u8 _BoardType = @@ -111,7 +111,7 @@ static bool CheckPositive( } static bool CheckNegative( - struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 + struct DM_ODM_T *pDM_Odm, const u32 Condition1, const u32 Condition2 ) { return true; @@ -228,7 +228,7 @@ static u32 Array_MP_8723B_MAC_REG[] = { }; -void ODM_ReadAndConfig_MP_8723B_MAC_REG(struct DM_ODM_T * pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_MAC_REG(struct DM_ODM_T *pDM_Odm) { u32 i = 0; u32 ArrayLen = ARRAY_SIZE(Array_MP_8723B_MAC_REG); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:31 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:31 +0100 Subject: [PATCH 10/57] Staging: rtl8723bs: fix spaces in HalHWImg8723B_MAC.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-11-marcocesati@gmail.com> This commit fixes the following checkpatch.pl error: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #18: FILE: ./hal/HalHWImg8723B_MAC.h:18: + struct DM_ODM_T * pDM_Odm Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.h b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.h index de7502232b7a..4ff8b7c28999 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.h +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.h @@ -15,6 +15,6 @@ void ODM_ReadAndConfig_MP_8723B_MAC_REG(/* TC: Test Chip, MP: MP Chip */ - struct DM_ODM_T * pDM_Odm + struct DM_ODM_T *pDM_Odm ); #endif -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:32 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:32 +0100 Subject: [PATCH 11/57] Staging: rtl8723bs: fix spaces in HalHWImg8723B_RF.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-12-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #12: FILE: ./hal/HalHWImg8723B_RF.c:12: + struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #124: FILE: ./hal/HalHWImg8723B_RF.c:124: + struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #262: FILE: ./hal/HalHWImg8723B_RF.c:262: +void ODM_ReadAndConfig_MP_8723B_RadioA(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #423: FILE: ./hal/HalHWImg8723B_RF.c:423: +void ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #425: FILE: ./hal/HalHWImg8723B_RF.c:425: + struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #758: FILE: ./hal/HalHWImg8723B_RF.c:758: +void ODM_ReadAndConfig_MP_8723B_TXPWR_LMT(struct DM_ODM_T * pDM_Odm) Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c index 963a08fc9032..5f78a64ca737 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c @@ -9,7 +9,7 @@ #include "odm_precomp.h" static bool CheckPositive( - struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 + struct DM_ODM_T *pDM_Odm, const u32 Condition1, const u32 Condition2 ) { u8 _BoardType = @@ -121,7 +121,7 @@ static bool CheckPositive( } static bool CheckNegative( - struct DM_ODM_T * pDM_Odm, const u32 Condition1, const u32 Condition2 + struct DM_ODM_T *pDM_Odm, const u32 Condition1, const u32 Condition2 ) { return true; @@ -259,7 +259,7 @@ static u32 Array_MP_8723B_RadioA[] = { }; -void ODM_ReadAndConfig_MP_8723B_RadioA(struct DM_ODM_T * pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_RadioA(struct DM_ODM_T *pDM_Odm) { u32 i = 0; u32 ArrayLen = ARRAY_SIZE(Array_MP_8723B_RadioA); @@ -420,9 +420,9 @@ static u8 gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_SDIO_8723B[] = { 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15 }; -void ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO(struct DM_ODM_T * pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO(struct DM_ODM_T *pDM_Odm) { - struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + struct ODM_RF_CAL_T *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; ODM_RT_TRACE( pDM_Odm, @@ -755,7 +755,7 @@ static u8 *Array_MP_8723B_TXPWR_LMT[] = { "MKK", "2.4G", "40M", "HT", "2T", "14", "63" }; -void ODM_ReadAndConfig_MP_8723B_TXPWR_LMT(struct DM_ODM_T * pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_TXPWR_LMT(struct DM_ODM_T *pDM_Odm) { u32 i = 0; u8 **Array = Array_MP_8723B_TXPWR_LMT; -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:33 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:33 +0100 Subject: [PATCH 12/57] Staging: rtl8723bs: fix spaces in HalHWImg8723B_RF.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-13-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #18: FILE: ./hal/HalHWImg8723B_RF.h:18: + struct DM_ODM_T * pDM_Odm ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #27: FILE: ./hal/HalHWImg8723B_RF.h:27: + struct DM_ODM_T * pDM_Odm ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #37: FILE: ./hal/HalHWImg8723B_RF.h:37: + struct DM_ODM_T * pDM_Odm Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.h b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.h index 9f86f199d4fd..1bb266f34e7d 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.h +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.h @@ -15,7 +15,7 @@ void ODM_ReadAndConfig_MP_8723B_RadioA(/* TC: Test Chip, MP: MP Chip */ - struct DM_ODM_T * pDM_Odm + struct DM_ODM_T *pDM_Odm ); /****************************************************************************** @@ -24,7 +24,7 @@ ODM_ReadAndConfig_MP_8723B_RadioA(/* TC: Test Chip, MP: MP Chip */ void ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO(/* TC: Test Chip, MP: MP Chip */ - struct DM_ODM_T * pDM_Odm + struct DM_ODM_T *pDM_Odm ); u32 ODM_GetVersion_MP_8723B_TxPowerTrack_SDIO(void); @@ -34,7 +34,7 @@ u32 ODM_GetVersion_MP_8723B_TxPowerTrack_SDIO(void); void ODM_ReadAndConfig_MP_8723B_TXPWR_LMT(/* TC: Test Chip, MP: MP Chip */ - struct DM_ODM_T * pDM_Odm + struct DM_ODM_T *pDM_Odm ); u32 ODM_GetVersion_MP_8723B_TXPWR_LMT(void); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:34 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:34 +0100 Subject: [PATCH 13/57] Staging: rtl8723bs: fix spaces in HalPhyRf.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-14-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #26: FILE: ./hal/HalPhyRf.c:26: +void ConfigureTxpowerTrack(struct DM_ODM_T * pDM_Odm, struct TXPWRTRACK_CFG * pConfig) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #26: FILE: ./hal/HalPhyRf.c:26: +void ConfigureTxpowerTrack(struct DM_ODM_T * pDM_Odm, struct TXPWRTRACK_CFG * pConfig) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #39: FILE: ./hal/HalPhyRf.c:39: +void ODM_ClearTxPowerTrackingState(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #77: FILE: ./hal/HalPhyRf.c:77: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalPhyRf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf.c b/drivers/staging/rtl8723bs/hal/HalPhyRf.c index 80ae4d0933f4..08064fd1d941 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf.c +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf.c @@ -23,7 +23,7 @@ } while (0) -void ConfigureTxpowerTrack(struct DM_ODM_T * pDM_Odm, struct TXPWRTRACK_CFG * pConfig) +void ConfigureTxpowerTrack(struct DM_ODM_T *pDM_Odm, struct TXPWRTRACK_CFG *pConfig) { ConfigureTxpowerTrack_8723B(pConfig); } @@ -36,7 +36,7 @@ void ConfigureTxpowerTrack(struct DM_ODM_T * pDM_Odm, struct TXPWRTRACK_CFG * pC /* NOTE: If Tx BB swing or Tx scaling is varified during run-time, still */ /* need to call this function. */ /* */ -void ODM_ClearTxPowerTrackingState(struct DM_ODM_T * pDM_Odm) +void ODM_ClearTxPowerTrackingState(struct DM_ODM_T *pDM_Odm) { struct hal_com_data *pHalData = GET_HAL_DATA(pDM_Odm->Adapter); u8 p = 0; @@ -74,7 +74,7 @@ void ODM_TXPowerTrackingCallback_ThermalMeter(struct adapter *Adapter) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; u8 ThermalValue = 0, delta, delta_LCK, delta_IQK, p = 0, i = 0; u8 ThermalValue_AVG_count = 0; -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:35 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:35 +0100 Subject: [PATCH 14/57] Staging: rtl8723bs: fix spaces in HalPhyRf.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-15-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #40: FILE: ./hal/HalPhyRf.h:40: +void ConfigureTxpowerTrack(struct DM_ODM_T * pDM_Odm, struct TXPWRTRACK_CFG * pConfig); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #40: FILE: ./hal/HalPhyRf.h:40: +void ConfigureTxpowerTrack(struct DM_ODM_T * pDM_Odm, struct TXPWRTRACK_CFG * pConfig); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #43: FILE: ./hal/HalPhyRf.h:43: +void ODM_ClearTxPowerTrackingState(struct DM_ODM_T * pDM_Odm); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalPhyRf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf.h b/drivers/staging/rtl8723bs/hal/HalPhyRf.h index 93659222d678..eaa5bd2811a1 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf.h +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf.h @@ -37,10 +37,10 @@ struct TXPWRTRACK_CFG { FuncSwing GetDeltaSwingTable; }; -void ConfigureTxpowerTrack(struct DM_ODM_T * pDM_Odm, struct TXPWRTRACK_CFG * pConfig); +void ConfigureTxpowerTrack(struct DM_ODM_T *pDM_Odm, struct TXPWRTRACK_CFG *pConfig); -void ODM_ClearTxPowerTrackingState(struct DM_ODM_T * pDM_Odm); +void ODM_ClearTxPowerTrackingState(struct DM_ODM_T *pDM_Odm); void ODM_TXPowerTrackingCallback_ThermalMeter(struct adapter *Adapter); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:37 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:37 +0100 Subject: [PATCH 16/57] Staging: rtl8723bs: fix spaces in HalPhyRf_8723B.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-17-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #19: FILE: ./hal/HalPhyRf_8723B.h:19: +void ConfigureTxpowerTrack_8723B(struct TXPWRTRACK_CFG * pConfig); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #22: FILE: ./hal/HalPhyRf_8723B.h:22: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #29: FILE: ./hal/HalPhyRf_8723B.h:29: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #44: FILE: ./hal/HalPhyRf_8723B.h:44: +void ODM_SetIQCbyRFpath(struct DM_ODM_T * pDM_Odm, u32 RFpath); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #49: FILE: ./hal/HalPhyRf_8723B.h:49: +void PHY_LCCalibrate_8723B(struct DM_ODM_T * pDM_Odm); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h index 80cb446db5fa..5cd65a7cfebc 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h @@ -16,17 +16,17 @@ #define RF_T_METER_8723B 0x42 /* */ -void ConfigureTxpowerTrack_8723B(struct TXPWRTRACK_CFG * pConfig); +void ConfigureTxpowerTrack_8723B(struct TXPWRTRACK_CFG *pConfig); void DoIQK_8723B( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, u8 DeltaThermalIndex, u8 ThermalValue, u8 Threshold ); void ODM_TxPwrTrackSetPwr_8723B( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, enum PWRTRACK_METHOD Method, u8 RFPath, u8 ChannelMappedIndex @@ -41,12 +41,12 @@ void PHY_IQCalibrate_8723B( u8 RF_Path ); -void ODM_SetIQCbyRFpath(struct DM_ODM_T * pDM_Odm, u32 RFpath); +void ODM_SetIQCbyRFpath(struct DM_ODM_T *pDM_Odm, u32 RFpath); /* */ /* LC calibrate */ /* */ -void PHY_LCCalibrate_8723B(struct DM_ODM_T * pDM_Odm); +void PHY_LCCalibrate_8723B(struct DM_ODM_T *pDM_Odm); /* */ /* AP calibrate */ -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:36 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:36 +0100 Subject: [PATCH 15/57] Staging: rtl8723bs: fix spaces in HalPhyRf_8723B.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-16-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #57: FILE: ./hal/HalPhyRf_8723B.c:57: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #138: FILE: ./hal/HalPhyRf_8723B.c:138: +static void setCCKFilterCoefficient(struct DM_ODM_T * pDM_Odm, u8 CCKSwingIndex) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #162: FILE: ./hal/HalPhyRf_8723B.c:162: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #188: FILE: ./hal/HalPhyRf_8723B.c:188: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #363: FILE: ./hal/HalPhyRf_8723B.c:363: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #371: FILE: ./hal/HalPhyRf_8723B.c:371: + struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #412: FILE: ./hal/HalPhyRf_8723B.c:412: +void ConfigureTxpowerTrack_8723B(struct TXPWRTRACK_CFG * pConfig) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #440: FILE: ./hal/HalPhyRf_8723B.c:440: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #551: FILE: ./hal/HalPhyRf_8723B.c:551: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #765: FILE: ./hal/HalPhyRf_8723B.c:765: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #872: FILE: ./hal/HalPhyRf_8723B.c:872: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1095: FILE: ./hal/HalPhyRf_8723B.c:1095: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1097: FILE: ./hal/HalPhyRf_8723B.c:1097: + struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1175: FILE: ./hal/HalPhyRf_8723B.c:1175: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1177: FILE: ./hal/HalPhyRf_8723B.c:1177: + struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1250: FILE: ./hal/HalPhyRf_8723B.c:1250: +void ODM_SetIQCbyRFpath(struct DM_ODM_T * pDM_Odm, u32 RFpath) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1253: FILE: ./hal/HalPhyRf_8723B.c:1253: + struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1295: FILE: ./hal/HalPhyRf_8723B.c:1295: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1313: FILE: ./hal/HalPhyRf_8723B.c:1313: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1333: FILE: ./hal/HalPhyRf_8723B.c:1333: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1363: FILE: ./hal/HalPhyRf_8723B.c:1363: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1387: FILE: ./hal/HalPhyRf_8723B.c:1387: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1492: FILE: ./hal/HalPhyRf_8723B.c:1492: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1700: FILE: ./hal/HalPhyRf_8723B.c:1700: +static void phy_LCCalibrate_8723B(struct DM_ODM_T * pDM_Odm, bool is2T) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1787: FILE: ./hal/HalPhyRf_8723B.c:1787: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1833: FILE: ./hal/HalPhyRf_8723B.c:1833: + struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #2041: FILE: ./hal/HalPhyRf_8723B.c:2041: +void PHY_LCCalibrate_8723B(struct DM_ODM_T * pDM_Odm) Signed-off-by: Marco Cesati --- .../staging/rtl8723bs/hal/HalPhyRf_8723B.c | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c index dfff2bb56b63..50aabed8ace6 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c @@ -54,7 +54,7 @@ static u8 DeltaSwingTableIdx_2GA_P_8188E[] = { static void setIqkMatrix_8723B( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, u8 OFDM_index, u8 RFPath, s32 IqkResult_X, @@ -135,7 +135,7 @@ static void setIqkMatrix_8723B( } -static void setCCKFilterCoefficient(struct DM_ODM_T * pDM_Odm, u8 CCKSwingIndex) +static void setCCKFilterCoefficient(struct DM_ODM_T *pDM_Odm, u8 CCKSwingIndex) { if (!pDM_Odm->RFCalibrateInfo.bCCKinCH14) { rtw_write8(pDM_Odm->Adapter, 0xa22, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][0]); @@ -159,7 +159,7 @@ static void setCCKFilterCoefficient(struct DM_ODM_T * pDM_Odm, u8 CCKSwingIndex) } void DoIQK_8723B( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, u8 DeltaThermalIndex, u8 ThermalValue, u8 Threshold @@ -185,7 +185,7 @@ void DoIQK_8723B( * *---------------------------------------------------------------------------*/ void ODM_TxPwrTrackSetPwr_8723B( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, enum PWRTRACK_METHOD Method, u8 RFPath, u8 ChannelMappedIndex @@ -360,7 +360,7 @@ void ODM_TxPwrTrackSetPwr_8723B( } static void GetDeltaSwingTable_8723B( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, u8 **TemperatureUP_A, u8 **TemperatureDOWN_A, u8 **TemperatureUP_B, @@ -368,7 +368,7 @@ static void GetDeltaSwingTable_8723B( ) { struct adapter *Adapter = pDM_Odm->Adapter; - struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + struct ODM_RF_CAL_T *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); u16 rate = *(pDM_Odm->pForcedDataRate); u8 channel = pHalData->CurrentChannel; @@ -409,7 +409,7 @@ static void GetDeltaSwingTable_8723B( } -void ConfigureTxpowerTrack_8723B(struct TXPWRTRACK_CFG * pConfig) +void ConfigureTxpowerTrack_8723B(struct TXPWRTRACK_CFG *pConfig) { pConfig->SwingTableSize_CCK = CCK_TABLE_SIZE; pConfig->SwingTableSize_OFDM = OFDM_TABLE_SIZE; @@ -437,7 +437,7 @@ static u8 phy_PathA_IQK_8723B( u8 result = 0x00; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; /* Save RF Path */ Path_SEL_BB = PHY_QueryBBReg(pDM_Odm->Adapter, 0x948, bMaskDWord); @@ -548,7 +548,7 @@ static u8 phy_PathA_RxIQK8723B( u32 regEAC, regE94, regE9C, regEA4, u4tmp, tmp, Path_SEL_BB; u8 result = 0x00; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; /* ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK!\n")); */ @@ -762,7 +762,7 @@ static u8 phy_PathB_IQK_8723B(struct adapter *padapter) u32 regEAC, regE94, regE9C, tmp, Path_SEL_BB/*, regEC4, regECC, Path_SEL_BB*/; u8 result = 0x00; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK!\n")); @@ -869,7 +869,7 @@ static u8 phy_PathB_RxIQK8723B(struct adapter *padapter, bool configPathB) u32 regE94, regE9C, regEA4, regEAC, u4tmp, tmp, Path_SEL_BB; u8 result = 0x00; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; /* ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B Rx IQK!\n")); */ @@ -1092,9 +1092,9 @@ static void _PHY_PathAFillIQKMatrix8723B( u32 Oldval_0, X, TX0_A, reg; s32 Y, TX0_C; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; - struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + struct ODM_RF_CAL_T *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQ Calibration %s !\n", (bIQKOK)?"Success":"Failed")); @@ -1172,9 +1172,9 @@ static void _PHY_PathBFillIQKMatrix8723B( u32 Oldval_1, X, TX1_A, reg; s32 Y, TX1_C; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; - struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + struct ODM_RF_CAL_T *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQ Calibration %s !\n", (bIQKOK)?"Success":"Failed")); @@ -1247,10 +1247,10 @@ static void _PHY_PathBFillIQKMatrix8723B( /* */ /* MP Already declare in odm.c */ -void ODM_SetIQCbyRFpath(struct DM_ODM_T * pDM_Odm, u32 RFpath) +void ODM_SetIQCbyRFpath(struct DM_ODM_T *pDM_Odm, u32 RFpath) { - struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + struct ODM_RF_CAL_T *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; if ( (pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC80][VAL] != 0x0) && @@ -1292,7 +1292,7 @@ static void _PHY_SaveADDARegisters8723B( { u32 i; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; if (!ODM_CheckPowerStatus(padapter)) return; @@ -1310,7 +1310,7 @@ static void _PHY_SaveMACRegisters8723B( { u32 i; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Save MAC parameters.\n")); for (i = 0 ; i < (IQK_MAC_REG_NUM - 1); i++) { @@ -1330,7 +1330,7 @@ static void _PHY_ReloadADDARegisters8723B( { u32 i; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Reload ADDA power saving parameters !\n")); for (i = 0 ; i < RegiesterNum; i++) { @@ -1360,7 +1360,7 @@ static void _PHY_PathADDAOn8723B( u32 pathOn; u32 i; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("ADDA ON.\n")); @@ -1384,7 +1384,7 @@ static void _PHY_MACSettingCalibration8723B( { u32 i = 0; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("MAC settings for Calibration.\n")); @@ -1489,7 +1489,7 @@ static void phy_IQCalibrate_8723B( ) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; u32 i; u8 PathAOK, PathBOK; @@ -1697,7 +1697,7 @@ static void phy_IQCalibrate_8723B( } -static void phy_LCCalibrate_8723B(struct DM_ODM_T * pDM_Odm, bool is2T) +static void phy_LCCalibrate_8723B(struct DM_ODM_T *pDM_Odm, bool is2T) { u8 tmpReg; u32 RF_Amode = 0, RF_Bmode = 0, LC_Cal; @@ -1784,7 +1784,7 @@ void PHY_IQCalibrate_8723B( { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; s32 result[4][8]; /* last is final result */ u8 i, final_candidate; @@ -1830,7 +1830,7 @@ void PHY_IQCalibrate_8723B( if (bRestore) { u32 offset, data; u8 path, bResult = SUCCESS; - struct ODM_RF_CAL_T * pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + struct ODM_RF_CAL_T *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; path = (PHY_QueryBBReg(pDM_Odm->Adapter, rS0S1_PathSwitch, bMaskByte0) == 0x00) ? ODM_RF_PATH_A : ODM_RF_PATH_B; @@ -2038,7 +2038,7 @@ void PHY_IQCalibrate_8723B( } -void PHY_LCCalibrate_8723B(struct DM_ODM_T * pDM_Odm) +void PHY_LCCalibrate_8723B(struct DM_ODM_T *pDM_Odm) { bool bSingleTone = false, bCarrierSuppression = false; u32 timeout = 2000, timecount = 0; -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:40 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:40 +0100 Subject: [PATCH 19/57] Staging: rtl8723bs: fix spaces in hal_com_phycfg.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-20-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #273: FILE: ./hal/hal_com_phycfg.c:273: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #798: FILE: ./hal/hal_com_phycfg.c:798: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1191: FILE: ./hal/hal_com_phycfg.c:1191: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 2bf4689dc08e..7405f9229117 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -270,7 +270,7 @@ u8 PHY_GetRateSectionIndexOfTxPowerByRate( ) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; u8 index = 0; if (pDM_Odm->PhyRegPgVersion == 0) { @@ -795,7 +795,7 @@ void PHY_StoreTxPowerByRate( ) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; if (pDM_Odm->PhyRegPgVersion > 0) PHY_StoreTxPowerByRateNew(padapter, Band, RfPath, TxNum, RegAddr, BitMask, Data); @@ -1188,7 +1188,7 @@ u8 PHY_GetTxPowerIndexBase( s8 PHY_GetTxPowerTrackingOffset(struct adapter *padapter, u8 RFPath, u8 Rate) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; s8 offset = 0; if (pDM_Odm->RFCalibrateInfo.TxPowerTrackControl == false) -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:39 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:39 +0100 Subject: [PATCH 18/57] Staging: rtl8723bs: fix spaces in hal_com.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-19-marcocesati@gmail.com> This commit fixes the following checkpatch.pl error: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1292: FILE: ./hal/hal_com.c:1292: + struct DM_ODM_T * podmpriv = &pHalData->odmpriv; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/hal_com.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 4a1ca57c2e15..29f5cf22f07e 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -1289,7 +1289,7 @@ void SetHalODMVar( ) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - struct DM_ODM_T * podmpriv = &pHalData->odmpriv; + struct DM_ODM_T *podmpriv = &pHalData->odmpriv; /* _irqL irqL; */ switch (eVariable) { case HAL_ODM_STA_INFO: -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:38 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:38 +0100 Subject: [PATCH 17/57] Staging: rtl8723bs: fix spaces in hal_btcoex.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-18-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #70: FILE: ./hal/hal_btcoex.c:70: +static u8 halbtcoutsrc_IsBtCoexistAvailable(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #104: FILE: ./hal/hal_btcoex.c:104: +static void halbtcoutsrc_LeaveLps(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #117: FILE: ./hal/hal_btcoex.c:117: +static void halbtcoutsrc_EnterLps(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #130: FILE: ./hal/hal_btcoex.c:130: +static void halbtcoutsrc_NormalLps(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #152: FILE: ./hal/hal_btcoex.c:152: +static void halbtcoutsrc_LeaveLowPower(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #187: FILE: ./hal/hal_btcoex.c:187: +static void halbtcoutsrc_NormalLowPower(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #196: FILE: ./hal/hal_btcoex.c:196: +static void halbtcoutsrc_DisableLowPower(struct BTC_COEXIST * pBtCoexist, u8 bLowPwrDisable) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #205: FILE: ./hal/hal_btcoex.c:205: +static void halbtcoutsrc_AggregationCheck(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #283: FILE: ./hal/hal_btcoex.c:283: +static u32 halbtcoutsrc_GetWifiLinkStatus(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #311: FILE: ./hal/hal_btcoex.c:311: +static u32 halbtcoutsrc_GetBtPatchVer(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #342: FILE: ./hal/hal_btcoex.c:342: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #448: FILE: ./hal/hal_btcoex.c:448: + struct RT_LINK_DETECT_T * plinkinfo; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #510: FILE: ./hal/hal_btcoex.c:510: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #645: FILE: ./hal/hal_btcoex.c:645: +static void halbtcoutsrc_DisplayFwPwrModeCmd(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #661: FILE: ./hal/hal_btcoex.c:661: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #673: FILE: ./hal/hal_btcoex.c:673: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #685: FILE: ./hal/hal_btcoex.c:685: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #697: FILE: ./hal/hal_btcoex.c:697: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #709: FILE: ./hal/hal_btcoex.c:709: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #749: FILE: ./hal/hal_btcoex.c:749: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #761: FILE: ./hal/hal_btcoex.c:761: + struct BTC_COEXIST * pBtCoexist = (struct BTC_COEXIST *)pBtcContext; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #772: FILE: ./hal/hal_btcoex.c:772: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #785: FILE: ./hal/hal_btcoex.c:785: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #797: FILE: ./hal/hal_btcoex.c:797: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #809: FILE: ./hal/hal_btcoex.c:809: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #821: FILE: ./hal/hal_btcoex.c:821: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #857: FILE: ./hal/hal_btcoex.c:857: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #869: FILE: ./hal/hal_btcoex.c:869: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #891: FILE: ./hal/hal_btcoex.c:891: + struct BTC_COEXIST * pBtCoexist = &GLBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #917: FILE: ./hal/hal_btcoex.c:917: + struct BTC_COEXIST * pBtCoexist; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #963: FILE: ./hal/hal_btcoex.c:963: +void EXhalbtcoutsrc_PowerOnSetting(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #975: FILE: ./hal/hal_btcoex.c:975: +void EXhalbtcoutsrc_InitHwConfig(struct BTC_COEXIST * pBtCoexist, u8 bWifiOnly) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #988: FILE: ./hal/hal_btcoex.c:988: +void EXhalbtcoutsrc_InitCoexDm(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1003: FILE: ./hal/hal_btcoex.c:1003: +void EXhalbtcoutsrc_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1030: FILE: ./hal/hal_btcoex.c:1030: +void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1053: FILE: ./hal/hal_btcoex.c:1053: +void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1082: FILE: ./hal/hal_btcoex.c:1082: +void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 action) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1108: FILE: ./hal/hal_btcoex.c:1108: +void EXhalbtcoutsrc_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, enum RT_MEDIA_STATUS mediaStatus) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1135: FILE: ./hal/hal_btcoex.c:1135: +void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 pktType) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1166: FILE: ./hal/hal_btcoex.c:1166: +void EXhalbtcoutsrc_BtInfoNotify(struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1184: FILE: ./hal/hal_btcoex.c:1184: +void EXhalbtcoutsrc_HaltNotify(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1197: FILE: ./hal/hal_btcoex.c:1197: +void EXhalbtcoutsrc_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1213: FILE: ./hal/hal_btcoex.c:1213: +void EXhalbtcoutsrc_Periodical(struct BTC_COEXIST * pBtCoexist) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1258: FILE: ./hal/hal_btcoex.c:1258: +void EXhalbtcoutsrc_DisplayBtCoexInfo(struct BTC_COEXIST * pBtCoexist) Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 89 +++++++++++----------- 1 file changed, 45 insertions(+), 44 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c index 267b93765fe8..fb279b662122 100644 --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c @@ -67,7 +67,7 @@ void DBG_BT_INFO(u8 *dbgmsg) /* */ /* Debug related function */ /* */ -static u8 halbtcoutsrc_IsBtCoexistAvailable(struct BTC_COEXIST * pBtCoexist) +static u8 halbtcoutsrc_IsBtCoexistAvailable(struct BTC_COEXIST *pBtCoexist) { if (!pBtCoexist->bBinded || !pBtCoexist->Adapter) return false; @@ -101,7 +101,7 @@ static void halbtcoutsrc_DbgInit(void) 0; } -static void halbtcoutsrc_LeaveLps(struct BTC_COEXIST * pBtCoexist) +static void halbtcoutsrc_LeaveLps(struct BTC_COEXIST *pBtCoexist) { struct adapter *padapter; @@ -114,7 +114,7 @@ static void halbtcoutsrc_LeaveLps(struct BTC_COEXIST * pBtCoexist) rtw_btcoex_LPS_Leave(padapter); } -static void halbtcoutsrc_EnterLps(struct BTC_COEXIST * pBtCoexist) +static void halbtcoutsrc_EnterLps(struct BTC_COEXIST *pBtCoexist) { struct adapter *padapter; @@ -127,7 +127,7 @@ static void halbtcoutsrc_EnterLps(struct BTC_COEXIST * pBtCoexist) rtw_btcoex_LPS_Enter(padapter); } -static void halbtcoutsrc_NormalLps(struct BTC_COEXIST * pBtCoexist) +static void halbtcoutsrc_NormalLps(struct BTC_COEXIST *pBtCoexist) { struct adapter *padapter; @@ -149,7 +149,7 @@ static void halbtcoutsrc_NormalLps(struct BTC_COEXIST * pBtCoexist) * Constraint: * 1. this function will request pwrctrl->lock */ -static void halbtcoutsrc_LeaveLowPower(struct BTC_COEXIST * pBtCoexist) +static void halbtcoutsrc_LeaveLowPower(struct BTC_COEXIST *pBtCoexist) { struct adapter *padapter; s32 ready; @@ -184,7 +184,7 @@ static void halbtcoutsrc_LeaveLowPower(struct BTC_COEXIST * pBtCoexist) * Constraint: * 1. this function will request pwrctrl->lock */ -static void halbtcoutsrc_NormalLowPower(struct BTC_COEXIST * pBtCoexist) +static void halbtcoutsrc_NormalLowPower(struct BTC_COEXIST *pBtCoexist) { struct adapter *padapter; @@ -193,7 +193,7 @@ static void halbtcoutsrc_NormalLowPower(struct BTC_COEXIST * pBtCoexist) rtw_unregister_task_alive(padapter, BTCOEX_ALIVE); } -static void halbtcoutsrc_DisableLowPower(struct BTC_COEXIST * pBtCoexist, u8 bLowPwrDisable) +static void halbtcoutsrc_DisableLowPower(struct BTC_COEXIST *pBtCoexist, u8 bLowPwrDisable) { pBtCoexist->btInfo.bBtDisableLowPwr = bLowPwrDisable; if (bLowPwrDisable) @@ -202,7 +202,7 @@ static void halbtcoutsrc_DisableLowPower(struct BTC_COEXIST * pBtCoexist, u8 bLo halbtcoutsrc_NormalLowPower(pBtCoexist); /* original 32k low power behavior. */ } -static void halbtcoutsrc_AggregationCheck(struct BTC_COEXIST * pBtCoexist) +static void halbtcoutsrc_AggregationCheck(struct BTC_COEXIST *pBtCoexist) { struct adapter *padapter; bool bNeedToAct; @@ -280,7 +280,7 @@ static u32 _halbtcoutsrc_GetWifiLinkStatus(struct adapter *padapter) return portConnectedStatus; } -static u32 halbtcoutsrc_GetWifiLinkStatus(struct BTC_COEXIST * pBtCoexist) +static u32 halbtcoutsrc_GetWifiLinkStatus(struct BTC_COEXIST *pBtCoexist) { /* */ /* return value: */ @@ -308,7 +308,7 @@ static u32 halbtcoutsrc_GetWifiLinkStatus(struct BTC_COEXIST * pBtCoexist) return retVal; } -static u32 halbtcoutsrc_GetBtPatchVer(struct BTC_COEXIST * pBtCoexist) +static u32 halbtcoutsrc_GetBtPatchVer(struct BTC_COEXIST *pBtCoexist) { return pBtCoexist->btInfo.btRealFwVer; } @@ -339,7 +339,7 @@ static u8 halbtcoutsrc_GetWifiScanAPNum(struct adapter *padapter) static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; struct adapter *padapter; struct hal_com_data *pHalData; struct mlme_ext_priv *mlmeext; @@ -445,7 +445,7 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf) case BTC_GET_U4_WIFI_TRAFFIC_DIRECTION: { - struct RT_LINK_DETECT_T * plinkinfo; + struct RT_LINK_DETECT_T *plinkinfo; plinkinfo = &padapter->mlmepriv.LinkDetectInfo; if (plinkinfo->NumTxOkInPeriod > plinkinfo->NumRxOkInPeriod) @@ -507,7 +507,7 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf) static u8 halbtcoutsrc_Set(void *pBtcContext, u8 setType, void *pInBuf) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; struct adapter *padapter; u8 *pu8; u32 *pU4Tmp; @@ -642,7 +642,7 @@ static u8 halbtcoutsrc_Set(void *pBtcContext, u8 setType, void *pInBuf) return ret; } -static void halbtcoutsrc_DisplayFwPwrModeCmd(struct BTC_COEXIST * pBtCoexist) +static void halbtcoutsrc_DisplayFwPwrModeCmd(struct BTC_COEXIST *pBtCoexist) { u8 *cliBuf = pBtCoexist->cliBuf; @@ -658,7 +658,7 @@ static void halbtcoutsrc_DisplayFwPwrModeCmd(struct BTC_COEXIST * pBtCoexist) /* */ static u8 halbtcoutsrc_Read1Byte(void *pBtcContext, u32 RegAddr) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; struct adapter *padapter; @@ -670,7 +670,7 @@ static u8 halbtcoutsrc_Read1Byte(void *pBtcContext, u32 RegAddr) static u16 halbtcoutsrc_Read2Byte(void *pBtcContext, u32 RegAddr) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; struct adapter *padapter; @@ -682,7 +682,7 @@ static u16 halbtcoutsrc_Read2Byte(void *pBtcContext, u32 RegAddr) static u32 halbtcoutsrc_Read4Byte(void *pBtcContext, u32 RegAddr) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; struct adapter *padapter; @@ -694,7 +694,7 @@ static u32 halbtcoutsrc_Read4Byte(void *pBtcContext, u32 RegAddr) static void halbtcoutsrc_Write1Byte(void *pBtcContext, u32 RegAddr, u8 Data) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; struct adapter *padapter; @@ -706,7 +706,7 @@ static void halbtcoutsrc_Write1Byte(void *pBtcContext, u32 RegAddr, u8 Data) static void halbtcoutsrc_BitMaskWrite1Byte(void *pBtcContext, u32 regAddr, u8 bitMask, u8 data1b) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; struct adapter *padapter; u8 originalValue, bitShift; u8 i; @@ -746,7 +746,7 @@ static void halbtcoutsrc_Write2Byte(void *pBtcContext, u32 RegAddr, u16 Data) static void halbtcoutsrc_Write4Byte(void *pBtcContext, u32 RegAddr, u32 Data) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; struct adapter *padapter; @@ -758,7 +758,7 @@ static void halbtcoutsrc_Write4Byte(void *pBtcContext, u32 RegAddr, u32 Data) static void halbtcoutsrc_WriteLocalReg1Byte(void *pBtcContext, u32 RegAddr, u8 Data) { - struct BTC_COEXIST * pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + struct BTC_COEXIST *pBtCoexist = (struct BTC_COEXIST *)pBtcContext; struct adapter *Adapter = pBtCoexist->Adapter; if (BTC_INTF_SDIO == pBtCoexist->chipInterface) @@ -769,7 +769,7 @@ static void halbtcoutsrc_WriteLocalReg1Byte(void *pBtcContext, u32 RegAddr, u8 D static void halbtcoutsrc_SetBbReg(void *pBtcContext, u32 RegAddr, u32 BitMask, u32 Data) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; struct adapter *padapter; @@ -782,7 +782,7 @@ static void halbtcoutsrc_SetBbReg(void *pBtcContext, u32 RegAddr, u32 BitMask, u static u32 halbtcoutsrc_GetBbReg(void *pBtcContext, u32 RegAddr, u32 BitMask) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; struct adapter *padapter; @@ -794,7 +794,7 @@ static u32 halbtcoutsrc_GetBbReg(void *pBtcContext, u32 RegAddr, u32 BitMask) static void halbtcoutsrc_SetRfReg(void *pBtcContext, u8 eRFPath, u32 RegAddr, u32 BitMask, u32 Data) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; struct adapter *padapter; @@ -806,7 +806,7 @@ static void halbtcoutsrc_SetRfReg(void *pBtcContext, u8 eRFPath, u32 RegAddr, u3 static u32 halbtcoutsrc_GetRfReg(void *pBtcContext, u8 eRFPath, u32 RegAddr, u32 BitMask) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; struct adapter *padapter; @@ -818,7 +818,7 @@ static u32 halbtcoutsrc_GetRfReg(void *pBtcContext, u8 eRFPath, u32 RegAddr, u32 static void halbtcoutsrc_SetBtReg(void *pBtcContext, u8 RegType, u32 RegAddr, u32 Data) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; struct adapter *padapter; u8 CmdBuffer1[4] = {0}; u8 CmdBuffer2[4] = {0}; @@ -854,7 +854,7 @@ static u32 halbtcoutsrc_GetBtReg(void *pBtcContext, u8 RegType, u32 RegAddr) static void halbtcoutsrc_FillH2cCmd(void *pBtcContext, u8 elementId, u32 cmdLen, u8 *pCmdBuffer) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; struct adapter *padapter; @@ -866,7 +866,7 @@ static void halbtcoutsrc_FillH2cCmd(void *pBtcContext, u8 elementId, u32 cmdLen, static void halbtcoutsrc_DisplayDbgMsg(void *pBtcContext, u8 dispType) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; pBtCoexist = (struct BTC_COEXIST *)pBtcContext; @@ -888,7 +888,7 @@ static void halbtcoutsrc_DisplayDbgMsg(void *pBtcContext, u8 dispType) /* */ static u8 EXhalbtcoutsrc_BindBtCoexWithAdapter(void *padapter) { - struct BTC_COEXIST * pBtCoexist = &GLBtCoexist; + struct BTC_COEXIST *pBtCoexist = &GLBtCoexist; if (pBtCoexist->bBinded) return false; @@ -914,7 +914,7 @@ static u8 EXhalbtcoutsrc_BindBtCoexWithAdapter(void *padapter) void hal_btcoex_Initialize(void *padapter) { - struct BTC_COEXIST * pBtCoexist; + struct BTC_COEXIST *pBtCoexist; memset(&GLBtCoexist, 0, sizeof(GLBtCoexist)); @@ -960,7 +960,7 @@ void hal_btcoex_Initialize(void *padapter) GLBtcWiFiInIQKState = false; } -void EXhalbtcoutsrc_PowerOnSetting(struct BTC_COEXIST * pBtCoexist) +void EXhalbtcoutsrc_PowerOnSetting(struct BTC_COEXIST *pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -972,7 +972,7 @@ void EXhalbtcoutsrc_PowerOnSetting(struct BTC_COEXIST * pBtCoexist) EXhalbtc8723b1ant_PowerOnSetting(pBtCoexist); } -void EXhalbtcoutsrc_InitHwConfig(struct BTC_COEXIST * pBtCoexist, u8 bWifiOnly) +void EXhalbtcoutsrc_InitHwConfig(struct BTC_COEXIST *pBtCoexist, u8 bWifiOnly) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -985,7 +985,7 @@ void EXhalbtcoutsrc_InitHwConfig(struct BTC_COEXIST * pBtCoexist, u8 bWifiOnly) EXhalbtc8723b1ant_InitHwConfig(pBtCoexist, bWifiOnly); } -void EXhalbtcoutsrc_InitCoexDm(struct BTC_COEXIST * pBtCoexist) +void EXhalbtcoutsrc_InitCoexDm(struct BTC_COEXIST *pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -1000,7 +1000,7 @@ void EXhalbtcoutsrc_InitCoexDm(struct BTC_COEXIST * pBtCoexist) pBtCoexist->bInitilized = true; } -void EXhalbtcoutsrc_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) +void EXhalbtcoutsrc_IpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) { u8 ipsType; @@ -1027,7 +1027,7 @@ void EXhalbtcoutsrc_IpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) +void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) { u8 lpsType; @@ -1050,7 +1050,7 @@ void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST * pBtCoexist, u8 type) EXhalbtc8723b1ant_LpsNotify(pBtCoexist, lpsType); } -void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type) +void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type) { u8 scanType; @@ -1079,7 +1079,7 @@ void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST * pBtCoexist, u8 type) /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 action) +void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 action) { u8 assoType; @@ -1105,7 +1105,8 @@ void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST * pBtCoexist, u8 action) /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, enum RT_MEDIA_STATUS mediaStatus) +void EXhalbtcoutsrc_MediaStatusNotify(struct BTC_COEXIST *pBtCoexist, enum + RT_MEDIA_STATUS mediaStatus) { u8 mStatus; @@ -1132,7 +1133,7 @@ void EXhalbtcoutsrc_MediaStatusNotify(struct BTC_COEXIST * pBtCoexist, enum RT_M /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 pktType) +void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 pktType) { u8 packetType; @@ -1163,7 +1164,7 @@ void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST * pBtCoexist, u8 pktT /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_BtInfoNotify(struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 length) +void EXhalbtcoutsrc_BtInfoNotify(struct BTC_COEXIST *pBtCoexist, u8 *tmpBuf, u8 length) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -1181,7 +1182,7 @@ void EXhalbtcoutsrc_BtInfoNotify(struct BTC_COEXIST * pBtCoexist, u8 *tmpBuf, u8 /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_HaltNotify(struct BTC_COEXIST * pBtCoexist) +void EXhalbtcoutsrc_HaltNotify(struct BTC_COEXIST *pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -1194,7 +1195,7 @@ void EXhalbtcoutsrc_HaltNotify(struct BTC_COEXIST * pBtCoexist) pBtCoexist->bBinded = false; } -void EXhalbtcoutsrc_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState) +void EXhalbtcoutsrc_PnpNotify(struct BTC_COEXIST *pBtCoexist, u8 pnpState) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -1210,7 +1211,7 @@ void EXhalbtcoutsrc_PnpNotify(struct BTC_COEXIST * pBtCoexist, u8 pnpState) EXhalbtc8723b2ant_PnpNotify(pBtCoexist, pnpState); } -void EXhalbtcoutsrc_Periodical(struct BTC_COEXIST * pBtCoexist) +void EXhalbtcoutsrc_Periodical(struct BTC_COEXIST *pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -1255,7 +1256,7 @@ void EXhalbtcoutsrc_SetSingleAntPath(u8 singleAntPath) GLBtCoexist.boardInfo.singleAntPath = singleAntPath; } -void EXhalbtcoutsrc_DisplayBtCoexInfo(struct BTC_COEXIST * pBtCoexist) +void EXhalbtcoutsrc_DisplayBtCoexInfo(struct BTC_COEXIST *pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:41 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:41 +0100 Subject: [PATCH 20/57] Staging: rtl8723bs: fix spaces in odm.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-21-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #285: FILE: ./hal/odm.c:285: +void odm_CommonInfoSelfInit(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #287: FILE: ./hal/odm.c:287: +void odm_CommonInfoSelfUpdate(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #289: FILE: ./hal/odm.c:289: +void odm_CmnInfoInit_Debug(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #291: FILE: ./hal/odm.c:291: +void odm_BasicDbgMessage(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #305: FILE: ./hal/odm.c:305: +void odm_RefreshRateAdaptiveMaskCE(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #309: FILE: ./hal/odm.c:309: +void odm_RSSIMonitorInit(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #311: FILE: ./hal/odm.c:311: +void odm_RSSIMonitorCheckCE(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #313: FILE: ./hal/odm.c:313: +void odm_RSSIMonitorCheck(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #315: FILE: ./hal/odm.c:315: +void odm_SwAntDetectInit(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #323: FILE: ./hal/odm.c:323: +void odm_RefreshRateAdaptiveMask(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #325: FILE: ./hal/odm.c:325: +void ODM_TXPowerTrackingCheck(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #327: FILE: ./hal/odm.c:327: +void odm_RateAdaptiveMaskInit(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #330: FILE: ./hal/odm.c:330: +void odm_TXPowerTrackingInit(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #338: FILE: ./hal/odm.c:338: +void odm_InitHybridAntDiv(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #341: FILE: ./hal/odm.c:341: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #349: FILE: ./hal/odm.c:349: +void odm_SetRxIdleAnt(struct DM_ODM_T * pDM_Odm, u8 Ant, bool bDualPath); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #353: FILE: ./hal/odm.c:353: +void odm_HwAntDiv(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #363: FILE: ./hal/odm.c:363: +void ODM_DMInit(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #393: FILE: ./hal/odm.c:393: +void ODM_DMWatchdog(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #420: FILE: ./hal/odm.c:420: + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #448: FILE: ./hal/odm.c:448: +void ODM_CmnInfoInit(struct DM_ODM_T * pDM_Odm, enum ODM_CMNINFO_E CmnInfo, u32 Value) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #560: FILE: ./hal/odm.c:560: +void ODM_CmnInfoHook(struct DM_ODM_T * pDM_Odm, enum ODM_CMNINFO_E CmnInfo, void *pValue) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #689: FILE: ./hal/odm.c:689: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #717: FILE: ./hal/odm.c:717: +void ODM_CmnInfoUpdate(struct DM_ODM_T * pDM_Odm, u32 CmnInfo, u64 Value) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #831: FILE: ./hal/odm.c:831: +void odm_CommonInfoSelfInit(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #841: FILE: ./hal/odm.c:841: +void odm_CommonInfoSelfUpdate(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #867: FILE: ./hal/odm.c:867: +void odm_CmnInfoInit_Debug(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #888: FILE: ./hal/odm.c:888: +void odm_BasicDbgMessage(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #935: FILE: ./hal/odm.c:935: +void odm_RateAdaptiveMaskInit(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #937: FILE: ./hal/odm.c:937: + struct ODM_RATE_ADAPTIVE * pOdmRA = &pDM_Odm->RateAdaptive; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #953: FILE: ./hal/odm.c:953: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1083: FILE: ./hal/odm.c:1083: +void odm_RefreshRateAdaptiveMask(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1094: FILE: ./hal/odm.c:1094: +void odm_RefreshRateAdaptiveMaskCE(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1131: FILE: ./hal/odm.c:1131: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1137: FILE: ./hal/odm.c:1137: + struct ODM_RATE_ADAPTIVE * pRA = &pDM_Odm->RateAdaptive; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1196: FILE: ./hal/odm.c:1196: +void odm_RSSIMonitorInit(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1198: FILE: ./hal/odm.c:1198: + struct RA_T * pRA_Table = &pDM_Odm->DM_RA_Table; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1204: FILE: ./hal/odm.c:1204: +void odm_RSSIMonitorCheck(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1217: FILE: ./hal/odm.c:1217: + struct DM_ODM_T * pDM_Odm = &(pHalData->odmpriv); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1234: FILE: ./hal/odm.c:1234: +void odm_RSSIMonitorCheckCE(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1243: FILE: ./hal/odm.c:1243: + struct RA_T * pRA_Table = &pDM_Odm->DM_RA_Table; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1306: FILE: ./hal/odm.c:1306: +static u8 getSwingIndex(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1330: FILE: ./hal/odm.c:1330: +void odm_TXPowerTrackingInit(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1374: FILE: ./hal/odm.c:1374: +void ODM_TXPowerTrackingCheck(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1398: FILE: ./hal/odm.c:1398: +void odm_SwAntDetectInit(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1400: FILE: ./hal/odm.c:1400: + struct SWAT_T * pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm.c | 92 ++++++++++++++--------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm.c b/drivers/staging/rtl8723bs/hal/odm.c index 4337f3b614f9..c7607e7d26c5 100644 --- a/drivers/staging/rtl8723bs/hal/odm.c +++ b/drivers/staging/rtl8723bs/hal/odm.c @@ -282,13 +282,13 @@ u32 TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE] = { /* Local Function predefine. */ /* START------------COMMON INFO RELATED--------------- */ -void odm_CommonInfoSelfInit(struct DM_ODM_T * pDM_Odm); +void odm_CommonInfoSelfInit(struct DM_ODM_T *pDM_Odm); -void odm_CommonInfoSelfUpdate(struct DM_ODM_T * pDM_Odm); +void odm_CommonInfoSelfUpdate(struct DM_ODM_T *pDM_Odm); -void odm_CmnInfoInit_Debug(struct DM_ODM_T * pDM_Odm); +void odm_CmnInfoInit_Debug(struct DM_ODM_T *pDM_Odm); -void odm_BasicDbgMessage(struct DM_ODM_T * pDM_Odm); +void odm_BasicDbgMessage(struct DM_ODM_T *pDM_Odm); /* END------------COMMON INFO RELATED--------------- */ @@ -302,17 +302,17 @@ void odm_BasicDbgMessage(struct DM_ODM_T * pDM_Odm); /* Remove BB power Saving by YuChen */ /* END---------BB POWER SAVE----------------------- */ -void odm_RefreshRateAdaptiveMaskCE(struct DM_ODM_T * pDM_Odm); +void odm_RefreshRateAdaptiveMaskCE(struct DM_ODM_T *pDM_Odm); /* Remove by YuChen */ -void odm_RSSIMonitorInit(struct DM_ODM_T * pDM_Odm); +void odm_RSSIMonitorInit(struct DM_ODM_T *pDM_Odm); -void odm_RSSIMonitorCheckCE(struct DM_ODM_T * pDM_Odm); +void odm_RSSIMonitorCheckCE(struct DM_ODM_T *pDM_Odm); -void odm_RSSIMonitorCheck(struct DM_ODM_T * pDM_Odm); +void odm_RSSIMonitorCheck(struct DM_ODM_T *pDM_Odm); -void odm_SwAntDetectInit(struct DM_ODM_T * pDM_Odm); +void odm_SwAntDetectInit(struct DM_ODM_T *pDM_Odm); void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext); @@ -320,14 +320,14 @@ void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext); void odm_GlobalAdapterCheck(void); -void odm_RefreshRateAdaptiveMask(struct DM_ODM_T * pDM_Odm); +void odm_RefreshRateAdaptiveMask(struct DM_ODM_T *pDM_Odm); -void ODM_TXPowerTrackingCheck(struct DM_ODM_T * pDM_Odm); +void ODM_TXPowerTrackingCheck(struct DM_ODM_T *pDM_Odm); -void odm_RateAdaptiveMaskInit(struct DM_ODM_T * pDM_Odm); +void odm_RateAdaptiveMaskInit(struct DM_ODM_T *pDM_Odm); -void odm_TXPowerTrackingInit(struct DM_ODM_T * pDM_Odm); +void odm_TXPowerTrackingInit(struct DM_ODM_T *pDM_Odm); /* Remove Edca by Yu Chen */ @@ -335,10 +335,10 @@ void odm_TXPowerTrackingInit(struct DM_ODM_T * pDM_Odm); #define RxDefaultAnt1 0x65a9 #define RxDefaultAnt2 0x569a -void odm_InitHybridAntDiv(struct DM_ODM_T * pDM_Odm); +void odm_InitHybridAntDiv(struct DM_ODM_T *pDM_Odm); bool odm_StaDefAntSel( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, u32 OFDM_Ant1_Cnt, u32 OFDM_Ant2_Cnt, u32 CCK_Ant1_Cnt, @@ -346,11 +346,11 @@ bool odm_StaDefAntSel( u8 *pDefAnt ); -void odm_SetRxIdleAnt(struct DM_ODM_T * pDM_Odm, u8 Ant, bool bDualPath); +void odm_SetRxIdleAnt(struct DM_ODM_T *pDM_Odm, u8 Ant, bool bDualPath); -void odm_HwAntDiv(struct DM_ODM_T * pDM_Odm); +void odm_HwAntDiv(struct DM_ODM_T *pDM_Odm); /* */ @@ -360,7 +360,7 @@ void odm_HwAntDiv(struct DM_ODM_T * pDM_Odm); /* */ /* 2011/09/21 MH Add to describe different team necessary resource allocate?? */ /* */ -void ODM_DMInit(struct DM_ODM_T * pDM_Odm) +void ODM_DMInit(struct DM_ODM_T *pDM_Odm) { odm_CommonInfoSelfInit(pDM_Odm); @@ -390,7 +390,7 @@ void ODM_DMInit(struct DM_ODM_T * pDM_Odm) /* You can not add any dummy function here, be care, you can only use DM structure */ /* to perform any new ODM_DM. */ /* */ -void ODM_DMWatchdog(struct DM_ODM_T * pDM_Odm) +void ODM_DMWatchdog(struct DM_ODM_T *pDM_Odm) { odm_CommonInfoSelfUpdate(pDM_Odm); odm_BasicDbgMessage(pDM_Odm); @@ -417,7 +417,7 @@ void ODM_DMWatchdog(struct DM_ODM_T * pDM_Odm) odm_DIG(pDM_Odm); { - struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; + struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; odm_Adaptivity(pDM_Odm, pDM_DigTable->CurIGValue); } @@ -445,7 +445,7 @@ void ODM_DMWatchdog(struct DM_ODM_T * pDM_Odm) /* */ /* Init /.. Fixed HW value. Only init time. */ /* */ -void ODM_CmnInfoInit(struct DM_ODM_T * pDM_Odm, enum ODM_CMNINFO_E CmnInfo, u32 Value) +void ODM_CmnInfoInit(struct DM_ODM_T *pDM_Odm, enum ODM_CMNINFO_E CmnInfo, u32 Value) { /* */ /* This section is used for init value */ @@ -557,7 +557,7 @@ void ODM_CmnInfoInit(struct DM_ODM_T * pDM_Odm, enum ODM_CMNINFO_E CmnInfo, u32 } -void ODM_CmnInfoHook(struct DM_ODM_T * pDM_Odm, enum ODM_CMNINFO_E CmnInfo, void *pValue) +void ODM_CmnInfoHook(struct DM_ODM_T *pDM_Odm, enum ODM_CMNINFO_E CmnInfo, void *pValue) { /* */ /* Hook call by reference pointer. */ @@ -686,7 +686,7 @@ void ODM_CmnInfoHook(struct DM_ODM_T * pDM_Odm, enum ODM_CMNINFO_E CmnInfo, void void ODM_CmnInfoPtrArrayHook( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, enum ODM_CMNINFO_E CmnInfo, u16 Index, void *pValue @@ -714,7 +714,7 @@ void ODM_CmnInfoPtrArrayHook( /* */ /* Update Band/CHannel/.. The values are dynamic but non-per-packet. */ /* */ -void ODM_CmnInfoUpdate(struct DM_ODM_T * pDM_Odm, u32 CmnInfo, u64 Value) +void ODM_CmnInfoUpdate(struct DM_ODM_T *pDM_Odm, u32 CmnInfo, u64 Value) { /* */ /* This init variable may be changed in run time. */ @@ -828,7 +828,7 @@ void ODM_CmnInfoUpdate(struct DM_ODM_T * pDM_Odm, u32 CmnInfo, u64 Value) } -void odm_CommonInfoSelfInit(struct DM_ODM_T * pDM_Odm) +void odm_CommonInfoSelfInit(struct DM_ODM_T *pDM_Odm) { pDM_Odm->bCckHighPower = (bool) PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG(CCK_RPT_FORMAT, pDM_Odm), ODM_BIT(CCK_RPT_FORMAT, pDM_Odm)); pDM_Odm->RFPathRxEnable = (u8) PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG(BB_RX_PATH, pDM_Odm), ODM_BIT(BB_RX_PATH, pDM_Odm)); @@ -838,7 +838,7 @@ void odm_CommonInfoSelfInit(struct DM_ODM_T * pDM_Odm) pDM_Odm->TxRate = 0xFF; } -void odm_CommonInfoSelfUpdate(struct DM_ODM_T * pDM_Odm) +void odm_CommonInfoSelfUpdate(struct DM_ODM_T *pDM_Odm) { u8 EntryCnt = 0; u8 i; @@ -864,7 +864,7 @@ void odm_CommonInfoSelfUpdate(struct DM_ODM_T * pDM_Odm) pDM_Odm->bOneEntryOnly = false; } -void odm_CmnInfoInit_Debug(struct DM_ODM_T * pDM_Odm) +void odm_CmnInfoInit_Debug(struct DM_ODM_T *pDM_Odm) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_CmnInfoInit_Debug ==>\n")); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("SupportPlatform =%d\n", pDM_Odm->SupportPlatform)); @@ -885,7 +885,7 @@ void odm_CmnInfoInit_Debug(struct DM_ODM_T * pDM_Odm) } -void odm_BasicDbgMessage(struct DM_ODM_T * pDM_Odm) +void odm_BasicDbgMessage(struct DM_ODM_T *pDM_Odm) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_BasicDbgMsg ==>\n")); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("bLinked = %d, RSSI_Min = %d,\n", @@ -932,9 +932,9 @@ void odm_BasicDbgMessage(struct DM_ODM_T * pDM_Odm) /* 3 Rate Adaptive */ /* 3 ============================================================ */ -void odm_RateAdaptiveMaskInit(struct DM_ODM_T * pDM_Odm) +void odm_RateAdaptiveMaskInit(struct DM_ODM_T *pDM_Odm) { - struct ODM_RATE_ADAPTIVE * pOdmRA = &pDM_Odm->RateAdaptive; + struct ODM_RATE_ADAPTIVE *pOdmRA = &pDM_Odm->RateAdaptive; pOdmRA->Type = DM_Type_ByDriver; if (pOdmRA->Type == DM_Type_ByDriver) @@ -950,7 +950,7 @@ void odm_RateAdaptiveMaskInit(struct DM_ODM_T * pDM_Odm) } u32 ODM_Get_Rate_Bitmap( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, u32 macid, u32 ra_mask, u8 rssi_level @@ -1080,7 +1080,7 @@ u32 ODM_Get_Rate_Bitmap( * * -------------------------------------------------------------------------- */ -void odm_RefreshRateAdaptiveMask(struct DM_ODM_T * pDM_Odm) +void odm_RefreshRateAdaptiveMask(struct DM_ODM_T *pDM_Odm) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, ("odm_RefreshRateAdaptiveMask()---------->\n")); @@ -1091,7 +1091,7 @@ void odm_RefreshRateAdaptiveMask(struct DM_ODM_T * pDM_Odm) odm_RefreshRateAdaptiveMaskCE(pDM_Odm); } -void odm_RefreshRateAdaptiveMaskCE(struct DM_ODM_T * pDM_Odm) +void odm_RefreshRateAdaptiveMaskCE(struct DM_ODM_T *pDM_Odm) { u8 i; struct adapter *padapter = pDM_Odm->Adapter; @@ -1128,13 +1128,13 @@ void odm_RefreshRateAdaptiveMaskCE(struct DM_ODM_T * pDM_Odm) /* Return Value: bool */ /* - true: RATRState is changed. */ bool ODM_RAStateCheck( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, s32 RSSI, bool bForceUpdate, u8 *pRATRState ) { - struct ODM_RATE_ADAPTIVE * pRA = &pDM_Odm->RateAdaptive; + struct ODM_RATE_ADAPTIVE *pRA = &pDM_Odm->RateAdaptive; const u8 GoUpGap = 5; u8 HighRSSIThreshForRA = pRA->HighRSSIThresh; u8 LowRSSIThreshForRA = pRA->LowRSSIThresh; @@ -1193,15 +1193,15 @@ bool ODM_RAStateCheck( /* 3 RSSI Monitor */ /* 3 ============================================================ */ -void odm_RSSIMonitorInit(struct DM_ODM_T * pDM_Odm) +void odm_RSSIMonitorInit(struct DM_ODM_T *pDM_Odm) { - struct RA_T * pRA_Table = &pDM_Odm->DM_RA_Table; + struct RA_T *pRA_Table = &pDM_Odm->DM_RA_Table; pRA_Table->firstconnect = false; } -void odm_RSSIMonitorCheck(struct DM_ODM_T * pDM_Odm) +void odm_RSSIMonitorCheck(struct DM_ODM_T *pDM_Odm) { if (!(pDM_Odm->SupportAbility & ODM_BB_RSSI_MONITOR)) return; @@ -1214,7 +1214,7 @@ static void FindMinimumRSSI(struct adapter *padapter) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; - struct DM_ODM_T * pDM_Odm = &(pHalData->odmpriv); + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; /* 1 1.Determine the minimum RSSI */ @@ -1231,7 +1231,7 @@ static void FindMinimumRSSI(struct adapter *padapter) /* ODM_RT_TRACE(pDM_Odm, COMP_DIG, DBG_LOUD, ("MinUndecoratedPWDBForDM =%d\n", pHalData->MinUndecoratedPWDBForDM)); */ } -void odm_RSSIMonitorCheckCE(struct DM_ODM_T * pDM_Odm) +void odm_RSSIMonitorCheckCE(struct DM_ODM_T *pDM_Odm) { struct adapter *Adapter = pDM_Odm->Adapter; struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); @@ -1240,7 +1240,7 @@ void odm_RSSIMonitorCheckCE(struct DM_ODM_T * pDM_Odm) int tmpEntryMaxPWDB = 0, tmpEntryMinPWDB = 0xff; u8 sta_cnt = 0; u32 PWDB_rssi[NUM_STA] = {0};/* 0~15]:MACID, [16~31]:PWDB_rssi */ - struct RA_T * pRA_Table = &pDM_Odm->DM_RA_Table; + struct RA_T *pRA_Table = &pDM_Odm->DM_RA_Table; if (pDM_Odm->bLinked != true) return; @@ -1303,7 +1303,7 @@ void odm_RSSIMonitorCheckCE(struct DM_ODM_T * pDM_Odm) /* 3 Tx Power Tracking */ /* 3 ============================================================ */ -static u8 getSwingIndex(struct DM_ODM_T * pDM_Odm) +static u8 getSwingIndex(struct DM_ODM_T *pDM_Odm) { struct adapter *Adapter = pDM_Odm->Adapter; u8 i = 0; @@ -1327,7 +1327,7 @@ static u8 getSwingIndex(struct DM_ODM_T * pDM_Odm) return i; } -void odm_TXPowerTrackingInit(struct DM_ODM_T * pDM_Odm) +void odm_TXPowerTrackingInit(struct DM_ODM_T *pDM_Odm) { u8 defaultSwingIndex = getSwingIndex(pDM_Odm); u8 p = 0; @@ -1371,7 +1371,7 @@ void odm_TXPowerTrackingInit(struct DM_ODM_T * pDM_Odm) } -void ODM_TXPowerTrackingCheck(struct DM_ODM_T * pDM_Odm) +void ODM_TXPowerTrackingCheck(struct DM_ODM_T *pDM_Odm) { struct adapter *Adapter = pDM_Odm->Adapter; @@ -1395,9 +1395,9 @@ void ODM_TXPowerTrackingCheck(struct DM_ODM_T * pDM_Odm) /* 3 ============================================================ */ /* 3 SW Antenna Diversity */ /* 3 ============================================================ */ -void odm_SwAntDetectInit(struct DM_ODM_T * pDM_Odm) +void odm_SwAntDetectInit(struct DM_ODM_T *pDM_Odm) { - struct SWAT_T * pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; + struct SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; pDM_SWAT_Table->SWAS_NoLink_BK_Reg92c = rtw_read32(pDM_Odm->Adapter, rDPDT_control); pDM_SWAT_Table->PreAntenna = MAIN_ANT; -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:42 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:42 +0100 Subject: [PATCH 21/57] Staging: rtl8723bs: fix spaces in odm.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-22-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1371: FILE: ./hal/odm.h:1371: +void ODM_TXPowerTrackingCheck(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1374: FILE: ./hal/odm.h:1374: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1382: FILE: ./hal/odm.h:1382: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1388: FILE: ./hal/odm.h:1388: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1398: FILE: ./hal/odm.h:1398: +void odm_TXPowerTrackingInit(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1400: FILE: ./hal/odm.h:1400: +void ODM_DMInit(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1402: FILE: ./hal/odm.h:1402: +void ODM_DMWatchdog(struct DM_ODM_T * pDM_Odm); /* For common use in the future */ ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1404: FILE: ./hal/odm.h:1404: +void ODM_CmnInfoInit(struct DM_ODM_T * pDM_Odm, enum ODM_CMNINFO_E CmnInfo, u32 Value); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1406: FILE: ./hal/odm.h:1406: +void ODM_CmnInfoHook(struct DM_ODM_T * pDM_Odm, enum ODM_CMNINFO_E CmnInfo, void *pValue); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1409: FILE: ./hal/odm.h:1409: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1415: FILE: ./hal/odm.h:1415: +void ODM_CmnInfoUpdate(struct DM_ODM_T * pDM_Odm, u32 CmnInfo, u64 Value); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1417: FILE: ./hal/odm.h:1417: +void ODM_InitAllTimers(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1419: FILE: ./hal/odm.h:1419: +void ODM_CancelAllTimers(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1421: FILE: ./hal/odm.h:1421: +void ODM_ReleaseAllTimers(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1424: FILE: ./hal/odm.h:1424: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1430: FILE: ./hal/odm.h:1430: +void ODM_DynamicARFBSelect(struct DM_ODM_T * pDM_Odm, u8 rate, bool Collision_State); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm.h | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h index 8b8fe2c406f5..8f457b0ea70d 100644 --- a/drivers/staging/rtl8723bs/hal/odm.h +++ b/drivers/staging/rtl8723bs/hal/odm.h @@ -1368,10 +1368,10 @@ extern u32 TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE]; /* Remove BB power saving by Yuchen */ #define dm_CheckTXPowerTracking ODM_TXPowerTrackingCheck -void ODM_TXPowerTrackingCheck(struct DM_ODM_T * pDM_Odm); +void ODM_TXPowerTrackingCheck(struct DM_ODM_T *pDM_Odm); bool ODM_RAStateCheck( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, s32 RSSI, bool bForceUpdate, u8 *pRATRState @@ -1379,13 +1379,13 @@ bool ODM_RAStateCheck( #define dm_SWAW_RSSI_Check ODM_SwAntDivChkPerPktRssi void ODM_SwAntDivChkPerPktRssi( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, u8 StationID, struct odm_phy_info *pPhyInfo ); u32 ODM_Get_Rate_Bitmap( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, u32 macid, u32 ra_mask, u8 rssi_level @@ -1395,38 +1395,38 @@ u32 ODM_Get_Rate_Bitmap( BEAMFORMING_CAP Beamforming_GetEntryBeamCapByMacId(PMGNT_INFO pMgntInfo, u8 MacId); #endif -void odm_TXPowerTrackingInit(struct DM_ODM_T * pDM_Odm); +void odm_TXPowerTrackingInit(struct DM_ODM_T *pDM_Odm); -void ODM_DMInit(struct DM_ODM_T * pDM_Odm); +void ODM_DMInit(struct DM_ODM_T *pDM_Odm); -void ODM_DMWatchdog(struct DM_ODM_T * pDM_Odm); /* For common use in the future */ +void ODM_DMWatchdog(struct DM_ODM_T *pDM_Odm); /* For common use in the future */ -void ODM_CmnInfoInit(struct DM_ODM_T * pDM_Odm, enum ODM_CMNINFO_E CmnInfo, u32 Value); +void ODM_CmnInfoInit(struct DM_ODM_T *pDM_Odm, enum ODM_CMNINFO_E CmnInfo, u32 Value); -void ODM_CmnInfoHook(struct DM_ODM_T * pDM_Odm, enum ODM_CMNINFO_E CmnInfo, void *pValue); +void ODM_CmnInfoHook(struct DM_ODM_T *pDM_Odm, enum ODM_CMNINFO_E CmnInfo, void *pValue); void ODM_CmnInfoPtrArrayHook( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, enum ODM_CMNINFO_E CmnInfo, u16 Index, void *pValue ); -void ODM_CmnInfoUpdate(struct DM_ODM_T * pDM_Odm, u32 CmnInfo, u64 Value); +void ODM_CmnInfoUpdate(struct DM_ODM_T *pDM_Odm, u32 CmnInfo, u64 Value); -void ODM_InitAllTimers(struct DM_ODM_T * pDM_Odm); +void ODM_InitAllTimers(struct DM_ODM_T *pDM_Odm); -void ODM_CancelAllTimers(struct DM_ODM_T * pDM_Odm); +void ODM_CancelAllTimers(struct DM_ODM_T *pDM_Odm); -void ODM_ReleaseAllTimers(struct DM_ODM_T * pDM_Odm); +void ODM_ReleaseAllTimers(struct DM_ODM_T *pDM_Odm); void ODM_AntselStatistics_88C( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, u8 MacId, u32 PWDBAll, bool isCCKrate ); -void ODM_DynamicARFBSelect(struct DM_ODM_T * pDM_Odm, u8 rate, bool Collision_State); +void ODM_DynamicARFBSelect(struct DM_ODM_T *pDM_Odm, u8 rate, bool Collision_State); #endif -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:43 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:43 +0100 Subject: [PATCH 22/57] Staging: rtl8723bs: fix spaces in odm_CfoTracking.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-23-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #12: FILE: ./hal/odm_CfoTracking.c:12: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #13: FILE: ./hal/odm_CfoTracking.c:13: + struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #42: FILE: ./hal/odm_CfoTracking.c:42: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #52: FILE: ./hal/odm_CfoTracking.c:52: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #53: FILE: ./hal/odm_CfoTracking.c:53: + struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #70: FILE: ./hal/odm_CfoTracking.c:70: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #82: FILE: ./hal/odm_CfoTracking.c:82: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #83: FILE: ./hal/odm_CfoTracking.c:83: + struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #94: FILE: ./hal/odm_CfoTracking.c:94: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #95: FILE: ./hal/odm_CfoTracking.c:95: + struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #121: FILE: ./hal/odm_CfoTracking.c:121: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #122: FILE: ./hal/odm_CfoTracking.c:122: + struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #300: FILE: ./hal/odm_CfoTracking.c:300: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #302: FILE: ./hal/odm_CfoTracking.c:302: + struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; Signed-off-by: Marco Cesati --- .../staging/rtl8723bs/hal/odm_CfoTracking.c | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c index a70b673bb4be..fc059822edd9 100644 --- a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c +++ b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c @@ -9,8 +9,8 @@ static void odm_SetCrystalCap(void *pDM_VOID, u8 CrystalCap) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct CFO_TRACKING *pCfoTrack = &pDM_Odm->DM_CfoTrack; if (pCfoTrack->CrystalCap == CrystalCap) return; @@ -39,7 +39,7 @@ static void odm_SetCrystalCap(void *pDM_VOID, u8 CrystalCap) static u8 odm_GetDefaultCrytaltalCap(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; struct adapter *Adapter = pDM_Odm->Adapter; struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); @@ -49,8 +49,8 @@ static u8 odm_GetDefaultCrytaltalCap(void *pDM_VOID) static void odm_SetATCStatus(void *pDM_VOID, bool ATCStatus) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct CFO_TRACKING *pCfoTrack = &pDM_Odm->DM_CfoTrack; if (pCfoTrack->bATCStatus == ATCStatus) return; @@ -67,7 +67,7 @@ static void odm_SetATCStatus(void *pDM_VOID, bool ATCStatus) static bool odm_GetATCStatus(void *pDM_VOID) { bool ATCStatus; - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ATCStatus = (bool)PHY_QueryBBReg( pDM_Odm->Adapter, @@ -79,8 +79,8 @@ static bool odm_GetATCStatus(void *pDM_VOID) void ODM_CfoTrackingReset(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct CFO_TRACKING *pCfoTrack = &pDM_Odm->DM_CfoTrack; pCfoTrack->DefXCap = odm_GetDefaultCrytaltalCap(pDM_Odm); pCfoTrack->bAdjust = true; @@ -91,8 +91,8 @@ void ODM_CfoTrackingReset(void *pDM_VOID) void ODM_CfoTrackingInit(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct CFO_TRACKING *pCfoTrack = &pDM_Odm->DM_CfoTrack; pCfoTrack->DefXCap = pCfoTrack->CrystalCap = odm_GetDefaultCrytaltalCap(pDM_Odm); @@ -118,8 +118,8 @@ void ODM_CfoTrackingInit(void *pDM_VOID) void ODM_CfoTracking(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct CFO_TRACKING *pCfoTrack = &pDM_Odm->DM_CfoTrack; int CFO_kHz_A, CFO_kHz_B, CFO_ave = 0; int CFO_ave_diff; int CrystalCap = (int)pCfoTrack->CrystalCap; @@ -297,9 +297,9 @@ void ODM_CfoTracking(void *pDM_VOID) void ODM_ParsingCFO(void *pDM_VOID, void *pPktinfo_VOID, s8 *pcfotail) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; struct odm_packet_info *pPktinfo = pPktinfo_VOID; - struct CFO_TRACKING * pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct CFO_TRACKING *pCfoTrack = &pDM_Odm->DM_CfoTrack; u8 i; if (!(pDM_Odm->SupportAbility & ODM_BB_CFO_TRACKING)) -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:44 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:44 +0100 Subject: [PATCH 23/57] Staging: rtl8723bs: fix spaces in odm_DIG.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-24-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #14: FILE: ./hal/odm_DIG.c:14: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #30: FILE: ./hal/odm_DIG.c:30: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #41: FILE: ./hal/odm_DIG.c:41: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #51: FILE: ./hal/odm_DIG.c:51: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #59: FILE: ./hal/odm_DIG.c:59: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #72: FILE: ./hal/odm_DIG.c:72: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #136: FILE: ./hal/odm_DIG.c:136: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #208: FILE: ./hal/odm_DIG.c:208: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #236: FILE: ./hal/odm_DIG.c:236: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #325: FILE: ./hal/odm_DIG.c:325: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #326: FILE: ./hal/odm_DIG.c:326: + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #365: FILE: ./hal/odm_DIG.c:365: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #366: FILE: ./hal/odm_DIG.c:366: + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #438: FILE: ./hal/odm_DIG.c:438: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #469: FILE: ./hal/odm_DIG.c:469: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #470: FILE: ./hal/odm_DIG.c:470: + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #507: FILE: ./hal/odm_DIG.c:507: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #510: FILE: ./hal/odm_DIG.c:510: + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #826: FILE: ./hal/odm_DIG.c:826: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #895: FILE: ./hal/odm_DIG.c:895: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #896: FILE: ./hal/odm_DIG.c:896: + struct false_ALARM_STATISTICS * FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1065: FILE: ./hal/odm_DIG.c:1065: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1081: FILE: ./hal/odm_DIG.c:1081: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1082: FILE: ./hal/odm_DIG.c:1082: + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1083: FILE: ./hal/odm_DIG.c:1083: + struct false_ALARM_STATISTICS * pFalseAlmCnt = &(pDM_Odm->FalseAlmCnt); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1137: FILE: ./hal/odm_DIG.c:1137: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1138: FILE: ./hal/odm_DIG.c:1138: + struct false_ALARM_STATISTICS * FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1198: FILE: ./hal/odm_DIG.c:1198: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1199: FILE: ./hal/odm_DIG.c:1199: + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_DIG.c | 60 ++++++++++++------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_DIG.c b/drivers/staging/rtl8723bs/hal/odm_DIG.c index 8179a963d2da..eca34f45aaa3 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DIG.c +++ b/drivers/staging/rtl8723bs/hal/odm_DIG.c @@ -11,7 +11,7 @@ void odm_NHMCounterStatisticsInit(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; /* PHY parameters initialize for n series */ rtw_write16(pDM_Odm->Adapter, ODM_REG_NHM_TIMER_11N+2, 0x2710); /* 0x894[31:16]= 0x2710 Time duration for NHM unit: 4us, 0x2710 =40ms */ @@ -27,7 +27,7 @@ void odm_NHMCounterStatisticsInit(void *pDM_VOID) void odm_NHMCounterStatistics(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; /* Get NHM report */ odm_GetNHMCounterStatistics(pDM_Odm); @@ -38,7 +38,7 @@ void odm_NHMCounterStatistics(void *pDM_VOID) void odm_GetNHMCounterStatistics(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; u32 value32 = 0; value32 = PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG_NHM_CNT_11N, bMaskDWord); @@ -48,7 +48,7 @@ void odm_GetNHMCounterStatistics(void *pDM_VOID) void odm_NHMCounterStatisticsReset(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_NHM_TH9_TH10_11N, BIT1, 0); PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_NHM_TH9_TH10_11N, BIT1, 1); @@ -56,7 +56,7 @@ void odm_NHMCounterStatisticsReset(void *pDM_VOID) void odm_NHMBBInit(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; pDM_Odm->adaptivity_flag = 0; pDM_Odm->tolerance_cnt = 3; @@ -69,9 +69,9 @@ void odm_NHMBBInit(void *pDM_VOID) /* */ void odm_NHMBB(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; /* u8 test_status; */ - /* struct false_ALARM_STATISTICS *pFalseAlmCnt = &(pDM_Odm->FalseAlmCnt); */ + /* struct false_ALARM_STATISTICS *pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; */ pDM_Odm->NHMCurTxOkcnt = *(pDM_Odm->pNumTxBytesUnicast)-pDM_Odm->NHMLastTxOkcnt; @@ -133,7 +133,7 @@ void odm_NHMBB(void *pDM_VOID) void odm_SearchPwdBLowerBound(void *pDM_VOID, u8 IGI_target) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; u32 value32 = 0; u8 cnt, IGI; bool bAdjust = true; @@ -205,7 +205,7 @@ void odm_SearchPwdBLowerBound(void *pDM_VOID, u8 IGI_target) void odm_AdaptivityInit(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; if (pDM_Odm->Carrier_Sense_enable == false) pDM_Odm->TH_L2H_ini = 0xf7; /* -7 */ @@ -233,7 +233,7 @@ void odm_AdaptivityInit(void *pDM_VOID) void odm_Adaptivity(void *pDM_VOID, u8 IGI) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; s8 TH_L2H_dmc, TH_H2L_dmc; s8 Diff, IGI_target; bool EDCCA_State = false; @@ -322,8 +322,8 @@ void odm_Adaptivity(void *pDM_VOID, u8 IGI) void ODM_Write_DIG(void *pDM_VOID, u8 CurrentIGI) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; if (pDM_DigTable->bStopDIG) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("Stop Writing IGI\n")); @@ -362,8 +362,8 @@ void odm_PauseDIG( u8 IGIValue ) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; static bool bPaused; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG() =========>\n")); @@ -435,7 +435,7 @@ void odm_PauseDIG( bool odm_DigAbort(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; /* SupportAbility */ if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) { @@ -466,8 +466,8 @@ bool odm_DigAbort(void *pDM_VOID) void odm_DIGInit(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; pDM_DigTable->bStopDIG = false; pDM_DigTable->bPSDInProgress = false; @@ -504,10 +504,10 @@ void odm_DIGInit(void *pDM_VOID) void odm_DIG(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; /* Common parameters */ - struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; + struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; struct false_ALARM_STATISTICS *pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; bool FirstConnect, FirstDisConnect; u8 DIG_MaxOfMin, DIG_Dynamic_MIN; @@ -823,7 +823,7 @@ void odm_DIG(void *pDM_VOID) void odm_DIGbyRSSI_LPS(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; struct false_ALARM_STATISTICS *pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; u8 RSSI_Lower = DM_DIG_MIN_NIC; /* 0x1E or 0x1C */ @@ -892,8 +892,8 @@ void odm_DIGbyRSSI_LPS(void *pDM_VOID) void odm_FalseAlarmCounterStatistics(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct false_ALARM_STATISTICS * FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct false_ALARM_STATISTICS *FalseAlmCnt = &pDM_Odm->FalseAlmCnt; u32 ret_value; if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) @@ -1062,7 +1062,7 @@ void odm_FAThresholdCheck( u32 *dm_FA_thres ) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; if (pDM_Odm->bLinked && (bPerformance || bDFSBand)) { /* For NIC */ @@ -1078,9 +1078,9 @@ void odm_FAThresholdCheck( u8 odm_ForbiddenIGICheck(void *pDM_VOID, u8 DIG_Dynamic_MIN, u8 CurrentIGI) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; - struct false_ALARM_STATISTICS * pFalseAlmCnt = &(pDM_Odm->FalseAlmCnt); + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; + struct false_ALARM_STATISTICS *pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; u8 rx_gain_range_min = pDM_DigTable->rx_gain_range_min; if (pFalseAlmCnt->Cnt_all > 10000) { @@ -1134,8 +1134,8 @@ u8 odm_ForbiddenIGICheck(void *pDM_VOID, u8 DIG_Dynamic_MIN, u8 CurrentIGI) void odm_CCKPacketDetectionThresh(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct false_ALARM_STATISTICS * FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct false_ALARM_STATISTICS *FalseAlmCnt = &pDM_Odm->FalseAlmCnt; u8 CurCCK_CCAThres; @@ -1195,8 +1195,8 @@ void odm_CCKPacketDetectionThresh(void *pDM_VOID) void ODM_Write_CCK_CCA_Thres(void *pDM_VOID, u8 CurCCK_CCAThres) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; /* modify by Guo.Mingzhi 2012-01-03 */ if (pDM_DigTable->CurCCK_CCAThres != CurCCK_CCAThres) -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:45 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:45 +0100 Subject: [PATCH 24/57] Staging: rtl8723bs: fix in odm_DynamicBBPowerSaving.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-25-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #12: FILE: ./hal/odm_DynamicBBPowerSaving.c:12: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #25: FILE: ./hal/odm_DynamicBBPowerSaving.c:25: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c b/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c index 2cc9518c4ae8..522f87fe69b2 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c +++ b/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c @@ -9,7 +9,7 @@ void odm_DynamicBBPowerSavingInit(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; struct PS_T *pDM_PSTable = &pDM_Odm->DM_PSTable; pDM_PSTable->PreCCAState = CCA_MAX; @@ -22,7 +22,7 @@ void odm_DynamicBBPowerSavingInit(void *pDM_VOID) void ODM_RF_Saving(void *pDM_VOID, u8 bForceInNormal) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; struct PS_T *pDM_PSTable = &pDM_Odm->DM_PSTable; u8 Rssi_Up_bound = 30; u8 Rssi_Low_bound = 25; -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:46 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:46 +0100 Subject: [PATCH 25/57] Staging: rtl8723bs: fix spaces in odm_DynamicTxPower.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-26-marcocesati@gmail.com> This commit fixes the following checkpatch.pl error: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #12: FILE: ./hal/odm_DynamicTxPower.c:12: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_DynamicTxPower.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_DynamicTxPower.c b/drivers/staging/rtl8723bs/hal/odm_DynamicTxPower.c index adb57e9af408..ca8246c1a2cd 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DynamicTxPower.c +++ b/drivers/staging/rtl8723bs/hal/odm_DynamicTxPower.c @@ -9,7 +9,7 @@ void odm_DynamicTxPowerInit(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; struct adapter *Adapter = pDM_Odm->Adapter; struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:47 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:47 +0100 Subject: [PATCH 26/57] Staging: rtl8723bs: fix spaces in odm_EdcaTurboCheck.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-27-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #34: FILE: ./hal/odm_EdcaTurboCheck.c:34: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #61: FILE: ./hal/odm_EdcaTurboCheck.c:61: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #76: FILE: ./hal/odm_EdcaTurboCheck.c:76: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.c b/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.c index 61c447b00ff7..95fbb91aeb7d 100644 --- a/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.c +++ b/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.c @@ -31,7 +31,7 @@ static u32 edca_setting_DL[HT_IOT_PEER_MAX] = { void ODM_EdcaTurboInit(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; struct adapter *Adapter = pDM_Odm->Adapter; pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = false; @@ -58,7 +58,7 @@ void odm_EdcaTurboCheck(void *pDM_VOID) * operate at the same time. In stage2/3, we need to prove universal * interface and merge all HW dynamic mechanism. */ - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("odm_EdcaTurboCheck ========================>\n")); @@ -73,7 +73,7 @@ void odm_EdcaTurboCheck(void *pDM_VOID) void odm_EdcaTurboCheckCE(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; struct adapter *Adapter = pDM_Odm->Adapter; struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(Adapter); struct recv_priv *precvpriv = &(Adapter->recvpriv); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:48 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:48 +0100 Subject: [PATCH 27/57] Staging: rtl8723bs: fix spaces in odm_HWConfig.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-28-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #26: FILE: ./hal/odm_HWConfig.c:26: +s32 odm_SignalScaleMapping(struct DM_ODM_T * pDM_Odm, s32 CurrSig) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #80: FILE: ./hal/odm_HWConfig.c:80: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #93: FILE: ./hal/odm_HWConfig.c:93: + struct PHY_STATUS_RPT_8192CD_T * pPhyStaRpt = (struct PHY_STATUS_RPT_8192CD_T *)pPhyStatus; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #250: FILE: ./hal/odm_HWConfig.c:250: + struct DM_ODM_T * pDM_Odm, struct odm_phy_info *pPhyInfo, struct odm_packet_info *pPktinfo ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #404: FILE: ./hal/odm_HWConfig.c:404: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #418: FILE: ./hal/odm_HWConfig.c:418: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #434: FILE: ./hal/odm_HWConfig.c:434: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #453: FILE: ./hal/odm_HWConfig.c:453: +enum HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T * pDM_Odm) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #468: FILE: ./hal/odm_HWConfig.c:468: + struct DM_ODM_T * pDM_Odm, enum ODM_BB_Config_Type ConfigType Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_HWConfig.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c index de63e4a2932e..13f1d1cbd6b5 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c @@ -23,7 +23,7 @@ static u8 odm_QueryRxPwrPercentage(s8 AntPower) } -s32 odm_SignalScaleMapping(struct DM_ODM_T * pDM_Odm, s32 CurrSig) +s32 odm_SignalScaleMapping(struct DM_ODM_T *pDM_Odm, s32 CurrSig) { s32 RetSig = 0; @@ -77,7 +77,7 @@ static u8 odm_EVMdbToPercentage(s8 Value) } static void odm_RxPhyStatus92CSeries_Parsing( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, struct odm_phy_info *pPhyInfo, u8 *pPhyStatus, struct odm_packet_info *pPktinfo @@ -90,7 +90,7 @@ static void odm_RxPhyStatus92CSeries_Parsing( bool isCCKrate = false; u8 rf_rx_num = 0; u8 LNA_idx, VGA_idx; - struct PHY_STATUS_RPT_8192CD_T * pPhyStaRpt = (struct PHY_STATUS_RPT_8192CD_T *)pPhyStatus; + struct PHY_STATUS_RPT_8192CD_T *pPhyStaRpt = (struct PHY_STATUS_RPT_8192CD_T *)pPhyStatus; isCCKrate = pPktinfo->data_rate <= DESC_RATE11M; pPhyInfo->rx_mimo_signal_quality[ODM_RF_PATH_A] = -1; @@ -247,7 +247,7 @@ static void odm_RxPhyStatus92CSeries_Parsing( } static void odm_Process_RSSIForDM( - struct DM_ODM_T * pDM_Odm, struct odm_phy_info *pPhyInfo, struct odm_packet_info *pPktinfo + struct DM_ODM_T *pDM_Odm, struct odm_phy_info *pPhyInfo, struct odm_packet_info *pPktinfo ) { @@ -401,7 +401,7 @@ static void odm_Process_RSSIForDM( /* Endianness before calling this API */ /* */ static void ODM_PhyStatusQuery_92CSeries( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, struct odm_phy_info *pPhyInfo, u8 *pPhyStatus, struct odm_packet_info *pPktinfo @@ -415,7 +415,7 @@ static void ODM_PhyStatusQuery_92CSeries( } void ODM_PhyStatusQuery( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, struct odm_phy_info *pPhyInfo, u8 *pPhyStatus, struct odm_packet_info *pPktinfo @@ -431,7 +431,7 @@ void ODM_PhyStatusQuery( /* */ enum HAL_STATUS ODM_ConfigRFWithHeaderFile( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, enum ODM_RF_Config_Type ConfigType, enum ODM_RF_RADIO_PATH_E eRFPath ) @@ -450,7 +450,7 @@ enum HAL_STATUS ODM_ConfigRFWithHeaderFile( return HAL_STATUS_SUCCESS; } -enum HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T * pDM_Odm) +enum HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T *pDM_Odm) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===>ODM_ConfigRFWithTxPwrTrackHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip")); @@ -465,7 +465,7 @@ enum HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T * pDM_Odm) } enum HAL_STATUS ODM_ConfigBBWithHeaderFile( - struct DM_ODM_T * pDM_Odm, enum ODM_BB_Config_Type ConfigType + struct DM_ODM_T *pDM_Odm, enum ODM_BB_Config_Type ConfigType ) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:50 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:50 +0100 Subject: [PATCH 29/57] Staging: rtl8723bs: fix spaces in odm_NoiseMonitor.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-30-marcocesati@gmail.com> This commit fixes the following checkpatch.pl error: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #22: FILE: ./hal/odm_NoiseMonitor.c:22: + struct DM_ODM_T * pDM_Odm, Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c index 7743540b7817..54b9a70a7060 100644 --- a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c +++ b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c @@ -19,7 +19,7 @@ #define ValidCnt 5 static s16 odm_InbandNoise_Monitor_NSeries( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, u8 bPauseDIG, u8 IGIValue, u32 max_time -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:49 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:49 +0100 Subject: [PATCH 28/57] Staging: rtl8723bs: fix spaces in odm_HWConfig.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-29-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #125: FILE: ./hal/odm_HWConfig.h:125: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #131: FILE: ./hal/odm_HWConfig.h:131: +enum HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T * pDM_Odm); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #134: FILE: ./hal/odm_HWConfig.h:134: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #140: FILE: ./hal/odm_HWConfig.h:140: + struct DM_ODM_T * pDM_Odm, enum ODM_BB_Config_Type ConfigType ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #144: FILE: ./hal/odm_HWConfig.h:144: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #150: FILE: ./hal/odm_HWConfig.h:150: +s32 odm_SignalScaleMapping(struct DM_ODM_T * pDM_Odm, s32 CurrSig); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_HWConfig.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.h b/drivers/staging/rtl8723bs/hal/odm_HWConfig.h index d4d53839a3f9..deec2e71bd49 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.h +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.h @@ -122,31 +122,31 @@ struct PHY_STATUS_RPT_8812_T { void ODM_PhyStatusQuery( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, struct odm_phy_info *pPhyInfo, u8 *pPhyStatus, struct odm_packet_info *pPktinfo ); -enum HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T * pDM_Odm); +enum HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T *pDM_Odm); enum HAL_STATUS ODM_ConfigRFWithHeaderFile( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, enum ODM_RF_Config_Type ConfigType, enum ODM_RF_RADIO_PATH_E eRFPath ); enum HAL_STATUS ODM_ConfigBBWithHeaderFile( - struct DM_ODM_T * pDM_Odm, enum ODM_BB_Config_Type ConfigType + struct DM_ODM_T *pDM_Odm, enum ODM_BB_Config_Type ConfigType ); enum HAL_STATUS ODM_ConfigFWWithHeaderFile( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, enum ODM_FW_Config_Type ConfigType, u8 *pFirmware, u32 *pSize ); -s32 odm_SignalScaleMapping(struct DM_ODM_T * pDM_Odm, s32 CurrSig); +s32 odm_SignalScaleMapping(struct DM_ODM_T *pDM_Odm, s32 CurrSig); #endif -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:51 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:51 +0100 Subject: [PATCH 30/57] Staging: rtl8723bs: fix spaces in odm_PathDiv.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-31-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #12: FILE: ./hal/odm_PathDiv.c:12: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #25: FILE: ./hal/odm_PathDiv.c:25: + struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_PathDiv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_PathDiv.c b/drivers/staging/rtl8723bs/hal/odm_PathDiv.c index e04676533815..eeb8c87f2612 100644 --- a/drivers/staging/rtl8723bs/hal/odm_PathDiv.c +++ b/drivers/staging/rtl8723bs/hal/odm_PathDiv.c @@ -9,7 +9,7 @@ void odm_PathDiversityInit(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; if (!(pDM_Odm->SupportAbility & ODM_BB_PATH_DIV)) ODM_RT_TRACE( @@ -22,7 +22,7 @@ void odm_PathDiversityInit(void *pDM_VOID) void odm_PathDiversity(void *pDM_VOID) { - struct DM_ODM_T * pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; if (!(pDM_Odm->SupportAbility & ODM_BB_PATH_DIV)) ODM_RT_TRACE( -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:52 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:52 +0100 Subject: [PATCH 31/57] Staging: rtl8723bs: fix spaces in odm_RegConfig8723B.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-32-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #11: FILE: ./hal/odm_RegConfig8723B.c:11: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #109: FILE: ./hal/odm_RegConfig8723B.c:109: +void odm_ConfigRF_RadioA_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u32 Data) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #134: FILE: ./hal/odm_RegConfig8723B.c:134: +void odm_ConfigMAC_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u8 Data) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #150: FILE: ./hal/odm_RegConfig8723B.c:150: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #173: FILE: ./hal/odm_RegConfig8723B.c:173: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #201: FILE: ./hal/odm_RegConfig8723B.c:201: + struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #229: FILE: ./hal/odm_RegConfig8723B.c:229: + struct DM_ODM_T * pDM_Odm, Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.c b/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.c index 84b77a5c2a44..0fc5abe6ae23 100644 --- a/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.c +++ b/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.c @@ -8,7 +8,7 @@ #include "odm_precomp.h" void odm_ConfigRFReg_8723B( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, u32 Addr, u32 Data, enum ODM_RF_RADIO_PATH_E RF_PATH, @@ -106,7 +106,7 @@ void odm_ConfigRFReg_8723B( } -void odm_ConfigRF_RadioA_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u32 Data) +void odm_ConfigRF_RadioA_8723B(struct DM_ODM_T *pDM_Odm, u32 Addr, u32 Data) { u32 content = 0x1000; /* RF_Content: radioa_txt */ u32 maskforPhySet = (u32)(content&0xE000); @@ -131,7 +131,7 @@ void odm_ConfigRF_RadioA_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u32 Data) ); } -void odm_ConfigMAC_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u8 Data) +void odm_ConfigMAC_8723B(struct DM_ODM_T *pDM_Odm, u32 Addr, u8 Data) { rtw_write8(pDM_Odm->Adapter, Addr, Data); ODM_RT_TRACE( @@ -147,7 +147,7 @@ void odm_ConfigMAC_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u8 Data) } void odm_ConfigBB_AGC_8723B( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data @@ -170,7 +170,7 @@ void odm_ConfigBB_AGC_8723B( } void odm_ConfigBB_PHY_REG_PG_8723B( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, u32 Band, u32 RfPath, u32 TxNum, @@ -198,7 +198,7 @@ void odm_ConfigBB_PHY_REG_PG_8723B( } void odm_ConfigBB_PHY_8723B( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data @@ -226,7 +226,7 @@ void odm_ConfigBB_PHY_8723B( } void odm_ConfigBB_TXPWR_LMT_8723B( - struct DM_ODM_T * pDM_Odm, + struct DM_ODM_T *pDM_Odm, u8 *Regulation, u8 *Band, u8 *Bandwidth, -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:53 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:53 +0100 Subject: [PATCH 32/57] Staging: rtl8723bs: fix spaces in odm_RegConfig8723B.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-33-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #10: FILE: ./hal/odm_RegConfig8723B.h:10: +void odm_ConfigRFReg_8723B(struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #17: FILE: ./hal/odm_RegConfig8723B.h:17: +void odm_ConfigRF_RadioA_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u32 Data); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #19: FILE: ./hal/odm_RegConfig8723B.h:19: +void odm_ConfigMAC_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u8 Data); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #21: FILE: ./hal/odm_RegConfig8723B.h:21: +void odm_ConfigBB_AGC_8723B(struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #27: FILE: ./hal/odm_RegConfig8723B.h:27: +void odm_ConfigBB_PHY_REG_PG_8723B(struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #36: FILE: ./hal/odm_RegConfig8723B.h:36: +void odm_ConfigBB_PHY_8723B(struct DM_ODM_T * pDM_Odm, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #42: FILE: ./hal/odm_RegConfig8723B.h:42: +void odm_ConfigBB_TXPWR_LMT_8723B(struct DM_ODM_T * pDM_Odm, Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h b/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h index d7747100a917..e863f0c6d27a 100644 --- a/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h +++ b/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h @@ -7,24 +7,24 @@ #ifndef __INC_ODM_REGCONFIG_H_8723B #define __INC_ODM_REGCONFIG_H_8723B -void odm_ConfigRFReg_8723B(struct DM_ODM_T * pDM_Odm, +void odm_ConfigRFReg_8723B(struct DM_ODM_T *pDM_Odm, u32 Addr, u32 Data, enum ODM_RF_RADIO_PATH_E RF_PATH, u32 RegAddr ); -void odm_ConfigRF_RadioA_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u32 Data); +void odm_ConfigRF_RadioA_8723B(struct DM_ODM_T *pDM_Odm, u32 Addr, u32 Data); -void odm_ConfigMAC_8723B(struct DM_ODM_T * pDM_Odm, u32 Addr, u8 Data); +void odm_ConfigMAC_8723B(struct DM_ODM_T *pDM_Odm, u32 Addr, u8 Data); -void odm_ConfigBB_AGC_8723B(struct DM_ODM_T * pDM_Odm, +void odm_ConfigBB_AGC_8723B(struct DM_ODM_T *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data ); -void odm_ConfigBB_PHY_REG_PG_8723B(struct DM_ODM_T * pDM_Odm, +void odm_ConfigBB_PHY_REG_PG_8723B(struct DM_ODM_T *pDM_Odm, u32 Band, u32 RfPath, u32 TxNum, @@ -33,13 +33,13 @@ void odm_ConfigBB_PHY_REG_PG_8723B(struct DM_ODM_T * pDM_Odm, u32 Data ); -void odm_ConfigBB_PHY_8723B(struct DM_ODM_T * pDM_Odm, +void odm_ConfigBB_PHY_8723B(struct DM_ODM_T *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data ); -void odm_ConfigBB_TXPWR_LMT_8723B(struct DM_ODM_T * pDM_Odm, +void odm_ConfigBB_TXPWR_LMT_8723B(struct DM_ODM_T *pDM_Odm, u8 *Regulation, u8 *Band, u8 *Bandwidth, -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:54 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:54 +0100 Subject: [PATCH 33/57] Staging: rtl8723bs: fix spaces in odm_debug.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-34-marcocesati@gmail.com> This commit fixes the following checkpatch.pl error: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #10: FILE: ./hal/odm_debug.c:10: +void ODM_InitDebugSetting(struct DM_ODM_T * pDM_Odm) Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_debug.c b/drivers/staging/rtl8723bs/hal/odm_debug.c index 050aae37494e..8e0fb04bc3d6 100644 --- a/drivers/staging/rtl8723bs/hal/odm_debug.c +++ b/drivers/staging/rtl8723bs/hal/odm_debug.c @@ -7,7 +7,7 @@ #include "odm_precomp.h" -void ODM_InitDebugSetting(struct DM_ODM_T * pDM_Odm) +void ODM_InitDebugSetting(struct DM_ODM_T *pDM_Odm) { pDM_Odm->DebugLevel = ODM_DBG_LOUD; -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:55 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:55 +0100 Subject: [PATCH 34/57] Staging: rtl8723bs: fix spaces in odm_debug.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-35-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #165: FILE: ./hal/odm_debug.h:165: +void ODM_InitDebugSetting(struct DM_ODM_T * pDM_Odm); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_debug.h b/drivers/staging/rtl8723bs/hal/odm_debug.h index adb63ecc0b3e..22f0e37456e2 100644 --- a/drivers/staging/rtl8723bs/hal/odm_debug.h +++ b/drivers/staging/rtl8723bs/hal/odm_debug.h @@ -162,6 +162,6 @@ no_printk("%s %p", title_str, ptr) #endif -void ODM_InitDebugSetting(struct DM_ODM_T * pDM_Odm); +void ODM_InitDebugSetting(struct DM_ODM_T *pDM_Odm); #endif /* __ODM_DBG_H__ */ -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:56 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:56 +0100 Subject: [PATCH 35/57] Staging: rtl8723bs: fix spaces in rtl8723b_dm.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-36-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #28: FILE: ./hal/rtl8723b_dm.c:28: + struct DM_ODM_T * pDM_Odm = &(pHalData->odmpriv); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #77: FILE: ./hal/rtl8723b_dm.c:77: + struct DM_ODM_T * pDM_Odm = &(pHalData->odmpriv); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #132: FILE: ./hal/rtl8723b_dm.c:132: + struct DM_ODM_T * pDM_Odm = &(pHalData->odmpriv); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #206: FILE: ./hal/rtl8723b_dm.c:206: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #232: FILE: ./hal/rtl8723b_dm.c:232: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #233: FILE: ./hal/rtl8723b_dm.c:233: + struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/rtl8723b_dm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c index dce70fff0fae..cf146f506155 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c @@ -25,7 +25,7 @@ static void Init_ODM_ComInfo_8723b(struct adapter *Adapter) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - struct DM_ODM_T * pDM_Odm = &(pHalData->odmpriv); + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; u8 cut_ver, fab_ver; @@ -74,7 +74,7 @@ static void Update_ODM_ComInfo_8723b(struct adapter *Adapter) struct dvobj_priv *dvobj = adapter_to_dvobj(Adapter); struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(Adapter); struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - struct DM_ODM_T * pDM_Odm = &(pHalData->odmpriv); + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; int i; u8 zero = 0; @@ -129,7 +129,7 @@ void rtl8723b_InitHalDm(struct adapter *Adapter) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; - struct DM_ODM_T * pDM_Odm = &(pHalData->odmpriv); + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; pdmpriv->DM_Type = DM_Type_ByDriver; pdmpriv->DMFlag = DYNAMIC_FUNC_DISABLE; @@ -203,7 +203,7 @@ void rtl8723b_hal_dm_in_lps(struct adapter *padapter) u32 PWDB_rssi = 0; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info *psta = NULL; @@ -229,8 +229,8 @@ void rtl8723b_HalDmWatchDog_in_LPS(struct adapter *Adapter) struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; - struct DIG_T * pDM_DigTable = &pDM_Odm->DM_DigTable; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; struct sta_priv *pstapriv = &Adapter->stapriv; struct sta_info *psta = NULL; -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:57 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:57 +0100 Subject: [PATCH 36/57] Staging: rtl8723bs: fix spaces in rtl8723b_hal_init.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-37-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #586: FILE: ./hal/rtl8723b_hal_init.c:586: + struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #867: FILE: ./hal/rtl8723b_hal_init.c:867: + struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1006: FILE: ./hal/rtl8723b_hal_init.c:1006: + struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1149: FILE: ./hal/rtl8723b_hal_init.c:1149: + struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1247: FILE: ./hal/rtl8723b_hal_init.c:1247: + struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1552: FILE: ./hal/rtl8723b_hal_init.c:1552: + struct PGPKT_STRUCT * pTargetPkt ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1566: FILE: ./hal/rtl8723b_hal_init.c:1566: + struct PGPKT_STRUCT * pTargetPkt, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1571: FILE: ./hal/rtl8723b_hal_init.c:1571: + struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1684: FILE: ./hal/rtl8723b_hal_init.c:1684: + struct PGPKT_STRUCT * pTargetPkt, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1721: FILE: ./hal/rtl8723b_hal_init.c:1721: + struct PGPKT_STRUCT * pTargetPkt, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1788: FILE: ./hal/rtl8723b_hal_init.c:1788: + struct PGPKT_STRUCT * pTargetPkt, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1806: FILE: ./hal/rtl8723b_hal_init.c:1806: + struct PGPKT_STRUCT * pTargetPkt, Signed-off-by: Marco Cesati --- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 0eac9cb11cef..189c4a796b33 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -583,7 +583,7 @@ static u8 hal_EfuseSwitchToBank( u32 value32 = 0; #ifdef HAL_EFUSE_MEMORY struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; + struct EFUSE_HAL *pEfuseHal = &pHalData->EfuseHal; #endif @@ -864,7 +864,7 @@ static void hal_ReadEFuse_WiFi( { #ifdef HAL_EFUSE_MEMORY struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; + struct EFUSE_HAL *pEfuseHal = &pHalData->EfuseHal; #endif u8 *efuseTbl = NULL; u16 eFuse_Addr = 0; @@ -1003,7 +1003,7 @@ static void hal_ReadEFuse_BT( { #ifdef HAL_EFUSE_MEMORY struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; + struct EFUSE_HAL *pEfuseHal = &pHalData->EfuseHal; #endif u8 *efuseTbl; u8 bank; @@ -1146,7 +1146,7 @@ static u16 hal_EfuseGetCurrentSize_WiFi( { #ifdef HAL_EFUSE_MEMORY struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; + struct EFUSE_HAL *pEfuseHal = &pHalData->EfuseHal; #endif u16 efuse_addr = 0; u16 start_addr = 0; /* for debug */ @@ -1244,7 +1244,7 @@ static u16 hal_EfuseGetCurrentSize_BT(struct adapter *padapter, u8 bPseudoTest) { #ifdef HAL_EFUSE_MEMORY struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; + struct EFUSE_HAL *pEfuseHal = &pHalData->EfuseHal; #endif u16 btusedbytes; u16 efuse_addr; @@ -1549,7 +1549,7 @@ static void hal_EfuseConstructPGPkt( u8 offset, u8 word_en, u8 *pData, - struct PGPKT_STRUCT * pTargetPkt + struct PGPKT_STRUCT *pTargetPkt ) { memset(pTargetPkt->data, 0xFF, PGPKT_DATA_SIZE); @@ -1563,12 +1563,12 @@ static u8 hal_EfusePartialWriteCheck( struct adapter *padapter, u8 efuseType, u16 *pAddr, - struct PGPKT_STRUCT * pTargetPkt, + struct PGPKT_STRUCT *pTargetPkt, u8 bPseudoTest ) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct EFUSE_HAL * pEfuseHal = &pHalData->EfuseHal; + struct EFUSE_HAL *pEfuseHal = &pHalData->EfuseHal; u8 bRet = false; u16 startAddr = 0, efuse_max_available_len = 0, efuse_max = 0; u8 efuse_data = 0; @@ -1681,7 +1681,7 @@ static u8 hal_EfusePgPacketWrite1ByteHeader( struct adapter *padapter, u8 efuseType, u16 *pAddr, - struct PGPKT_STRUCT * pTargetPkt, + struct PGPKT_STRUCT *pTargetPkt, u8 bPseudoTest ) { @@ -1718,7 +1718,7 @@ static u8 hal_EfusePgPacketWrite2ByteHeader( struct adapter *padapter, u8 efuseType, u16 *pAddr, - struct PGPKT_STRUCT * pTargetPkt, + struct PGPKT_STRUCT *pTargetPkt, u8 bPseudoTest ) { @@ -1785,7 +1785,7 @@ static u8 hal_EfusePgPacketWriteHeader( struct adapter *padapter, u8 efuseType, u16 *pAddr, - struct PGPKT_STRUCT * pTargetPkt, + struct PGPKT_STRUCT *pTargetPkt, u8 bPseudoTest ) { @@ -1803,7 +1803,7 @@ static u8 hal_EfusePgPacketWriteData( struct adapter *padapter, u8 efuseType, u16 *pAddr, - struct PGPKT_STRUCT * pTargetPkt, + struct PGPKT_STRUCT *pTargetPkt, u8 bPseudoTest ) { -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:58 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:58 +0100 Subject: [PATCH 37/57] Staging: rtl8723bs: fix spaces in rtl8723b_phycfg.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-38-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #597: FILE: ./hal/rtl8723b_phycfg.c:597: + struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #598: FILE: ./hal/rtl8723b_phycfg.c:598: + struct FAT_T * pDM_FatTable = &pDM_Odm->DM_FatTable; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c index d67eb83e4011..9868d9f2b4df 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c @@ -594,8 +594,8 @@ u8 PHY_GetTxPowerIndex( void PHY_SetTxPowerLevel8723B(struct adapter *Adapter, u8 Channel) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - struct DM_ODM_T * pDM_Odm = &pHalData->odmpriv; - struct FAT_T * pDM_FatTable = &pDM_Odm->DM_FatTable; + struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct FAT_T *pDM_FatTable = &pDM_Odm->DM_FatTable; u8 RFPath = ODM_RF_PATH_A; if (pHalData->AntDivCfg) {/* antenna diversity Enable */ -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:05:59 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:05:59 +0100 Subject: [PATCH 38/57] Staging: rtl8723bs: fix spaces in HalPwrSeqCmd.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-39-marcocesati@gmail.com> This commit fixes the following checkpatch.pl error: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #116: FILE: ./include/HalPwrSeqCmd.h:116: + struct adapter * padapter, Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/HalPwrSeqCmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/include/HalPwrSeqCmd.h b/drivers/staging/rtl8723bs/include/HalPwrSeqCmd.h index 56c87ed17e48..7e8c2e511d0b 100644 --- a/drivers/staging/rtl8723bs/include/HalPwrSeqCmd.h +++ b/drivers/staging/rtl8723bs/include/HalPwrSeqCmd.h @@ -113,7 +113,7 @@ struct WLAN_PWR_CFG { /* Prototype of protected function. */ /* */ u8 HalPwrSeqCmdParsing( - struct adapter * padapter, + struct adapter *padapter, u8 CutVersion, u8 FabVersion, u8 InterfaceType, -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:00 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:00 +0100 Subject: [PATCH 39/57] Staging: rtl8723bs: fix spaces in basic_types.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-40-marcocesati@gmail.com> This commit fixes the following checkpatch.pl error: ERROR:POINTER_LOCATION: "(foo*)" should be "(foo *)" #16: FILE: ./include/basic_types.h:16: +#define FIELD_OFFSET(s, field) ((__kernel_ssize_t)&((s*)(0))->field) Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/basic_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/include/basic_types.h b/drivers/staging/rtl8723bs/include/basic_types.h index d0b2ec25327a..76304086107a 100644 --- a/drivers/staging/rtl8723bs/include/basic_types.h +++ b/drivers/staging/rtl8723bs/include/basic_types.h @@ -13,7 +13,7 @@ #include -#define FIELD_OFFSET(s, field) ((__kernel_ssize_t)&((s*)(0))->field) +#define FIELD_OFFSET(s, field) ((__kernel_ssize_t)&((s *)(0))->field) #define SIZE_PTR __kernel_size_t #define SSIZE_PTR __kernel_ssize_t -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:01 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:01 +0100 Subject: [PATCH 40/57] Staging: rtl8723bs: fix spaces in drv_types.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-41-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "(foo*)" should be "(foo *)" #210: FILE: ./include/drv_types.h:210: +#define RGTRY_SZ(field) sizeof(((struct registry_priv*) 0)->field) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #404: FILE: ./include/drv_types.h:404: + void * HalData; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #432: FILE: ./include/drv_types.h:432: + void (*intf_start)(struct adapter * adapter); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #433: FILE: ./include/drv_types.h:433: + void (*intf_stop)(struct adapter * adapter); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #435: FILE: ./include/drv_types.h:435: + struct net_device * pnetdev; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #440: FILE: ./include/drv_types.h:440: + struct net_device * old_pnetdev; Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/drv_types.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h index 97e8e462d718..649b2fd62abe 100644 --- a/drivers/staging/rtl8723bs/include/drv_types.h +++ b/drivers/staging/rtl8723bs/include/drv_types.h @@ -207,7 +207,7 @@ struct registry_priv { /* For registry parameters */ #define RGTRY_OFT(field) ((u32)FIELD_OFFSET(struct registry_priv, field)) -#define RGTRY_SZ(field) sizeof(((struct registry_priv*) 0)->field) +#define RGTRY_SZ(field) sizeof(((struct registry_priv *)0)->field) #define BSSID_OFT(field) ((u32)FIELD_OFFSET(struct wlan_bssid_ex, field)) #define BSSID_SZ(field) sizeof(((struct wlan_bssid_ex *) 0)->field) @@ -401,7 +401,7 @@ struct adapter { u32 setband; - void * HalData; + void *HalData; u32 hal_data_sz; struct hal_ops HalFunc; @@ -429,15 +429,15 @@ struct adapter { void (*intf_free_irq)(struct dvobj_priv *dvobj); - void (*intf_start)(struct adapter * adapter); - void (*intf_stop)(struct adapter * adapter); + void (*intf_start)(struct adapter *adapter); + void (*intf_stop)(struct adapter *adapter); - struct net_device * pnetdev; + struct net_device *pnetdev; char old_ifname[IFNAMSIZ]; /* used by rtw_rereg_nd_name related function */ struct rereg_nd_name_data { - struct net_device * old_pnetdev; + struct net_device *old_pnetdev; char old_ifname[IFNAMSIZ]; u8 old_ips_mode; u8 old_bRegUseLed; -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:02 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:02 +0100 Subject: [PATCH 41/57] Staging: rtl8723bs: fix spaces in hal_com.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-42-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #218: FILE: ./include/hal_com.h:218: + struct adapter * Adapter, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #230: FILE: ./include/hal_com.h:230: +void rtw_init_hal_com_default_value(struct adapter * Adapter); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #282: FILE: ./include/hal_com.h:282: + void * pValue1, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #283: FILE: ./include/hal_com.h:283: + void * pValue2); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #285: FILE: ./include/hal_com.h:285: + struct adapter * Adapter, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #287: FILE: ./include/hal_com.h:287: + void * pValue1, Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/hal_com.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h index c4b83eb16326..272d7ec4e15d 100644 --- a/drivers/staging/rtl8723bs/include/hal_com.h +++ b/drivers/staging/rtl8723bs/include/hal_com.h @@ -215,9 +215,9 @@ u8 MRateToHwRate(u8 rate); u8 HwRateToMRate(u8 rate); void HalSetBrateCfg( - struct adapter * Adapter, - u8 *mBratesOS, - u16 *pBrateCfg); + struct adapter *Adapter, + u8 *mBratesOS, + u16 *pBrateCfg); bool Hal_MappingOutPipe( @@ -227,7 +227,7 @@ u8 NumOutPipe void hal_init_macaddr(struct adapter *adapter); -void rtw_init_hal_com_default_value(struct adapter * Adapter); +void rtw_init_hal_com_default_value(struct adapter *Adapter); void c2h_evt_clear(struct adapter *adapter); s32 c2h_evt_read_88xx(struct adapter *adapter, u8 *buf); @@ -279,12 +279,12 @@ void rtw_bb_rf_gain_offset(struct adapter *padapter); void GetHalODMVar(struct adapter *Adapter, enum HAL_ODM_VARIABLE eVariable, - void * pValue1, - void * pValue2); + void *pValue1, + void *pValue2); void SetHalODMVar( - struct adapter * Adapter, + struct adapter *Adapter, enum HAL_ODM_VARIABLE eVariable, - void * pValue1, + void *pValue1, bool bSet); #ifdef CONFIG_BACKGROUND_NOISE_MONITOR -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:04 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:04 +0100 Subject: [PATCH 43/57] Staging: rtl8723bs: fix spaces in hal_com_phycfg.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-44-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #75: FILE: ./include/hal_com_phycfg.h:75: +struct adapter * Adapter, ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar" #95: FILE: ./include/hal_com_phycfg.h:95: + u8* RateIndex, ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar" #96: FILE: ./include/hal_com_phycfg.h:96: + s8* PwrByRateVal, ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar" #97: FILE: ./include/hal_com_phycfg.h:97: + u8* RateNum ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #107: FILE: ./include/hal_com_phycfg.h:107: +struct adapter * padapter, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #141: FILE: ./include/hal_com_phycfg.h:141: +struct adapter * padapter, ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar" #145: FILE: ./include/hal_com_phycfg.h:145: +u8* Rates, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #167: FILE: ./include/hal_com_phycfg.h:167: + struct adapter * padapter ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #172: FILE: ./include/hal_com_phycfg.h:172: +struct adapter * padapter, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #189: FILE: ./include/hal_com_phycfg.h:189: +struct adapter * Adapter, ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #201: FILE: ./include/hal_com_phycfg.h:201: +struct adapter * Adapter ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #206: FILE: ./include/hal_com_phycfg.h:206: +struct adapter * Adapter ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #218: FILE: ./include/hal_com_phycfg.h:218: +struct adapter * Adapter, Signed-off-by: Marco Cesati --- .../rtl8723bs/include/hal_com_phycfg.h | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/hal_com_phycfg.h b/drivers/staging/rtl8723bs/include/hal_com_phycfg.h index 9fff4aa36546..580b85324ae7 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_phycfg.h +++ b/drivers/staging/rtl8723bs/include/hal_com_phycfg.h @@ -72,7 +72,7 @@ struct bb_register_def { u8 PHY_GetTxPowerByRateBase( -struct adapter * Adapter, +struct adapter *Adapter, u8 Band, u8 RfPath, u8 TxNum, @@ -92,9 +92,9 @@ struct adapter *padapter, u32 RegAddr, u32 BitMask, u32 Value, - u8* RateIndex, - s8* PwrByRateVal, - u8* RateNum +u8 *RateIndex, +s8 *PwrByRateVal, +u8 *RateNum ); u8 @@ -104,7 +104,7 @@ u8 Rate void PHY_SetTxPowerIndexByRateSection( -struct adapter * padapter, +struct adapter *padapter, u8 RFPath, u8 Channel, u8 RateSection @@ -138,11 +138,11 @@ u8 path void PHY_SetTxPowerIndexByRateArray( -struct adapter * padapter, +struct adapter *padapter, u8 RFPath, enum CHANNEL_WIDTH BandWidth, u8 Channel, -u8* Rates, +u8 *Rates, u8 RateArraySize ); @@ -164,12 +164,12 @@ u32 Data void PHY_TxPowerByRateConfiguration( - struct adapter * padapter + struct adapter *padapter ); u8 PHY_GetTxPowerIndexBase( -struct adapter * padapter, +struct adapter *padapter, u8 RFPath, u8 Rate, enum CHANNEL_WIDTH BandWidth, @@ -186,7 +186,7 @@ u8 Channel void PHY_SetTxPowerLimit( -struct adapter * Adapter, +struct adapter *Adapter, u8 *Regulation, u8 *Band, u8 *Bandwidth, @@ -198,12 +198,12 @@ u8 *PowerLimit void PHY_ConvertTxPowerLimitToPowerIndex( -struct adapter * Adapter +struct adapter *Adapter ); void PHY_InitTxPowerLimit( -struct adapter * Adapter +struct adapter *Adapter ); s8 @@ -215,7 +215,7 @@ PHY_GetTxPowerTrackingOffset( void Hal_ChannelPlanToRegulation( -struct adapter * Adapter, +struct adapter *Adapter, u16 ChannelPlan ); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:03 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:03 +0100 Subject: [PATCH 42/57] Staging: rtl8723bs: fix spaces in hal_com_h2c.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-43-marcocesati@gmail.com> This commit fixes the following checkpatch.pl error: ERROR:POINTER_LOCATION: "foo*bar" should be "foo *bar" #283: FILE: ./include/hal_com_h2c.h:283: +void rtw_get_sec_iv(struct adapter *padapter, u8*pcur_dot11txpn, u8 *StaAddr); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/hal_com_h2c.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/include/hal_com_h2c.h b/drivers/staging/rtl8723bs/include/hal_com_h2c.h index 8970c59388bb..a6eab87f1745 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_h2c.h +++ b/drivers/staging/rtl8723bs/include/hal_com_h2c.h @@ -280,6 +280,6 @@ struct RSVDPAGE_LOC { #endif #if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip); -void rtw_get_sec_iv(struct adapter *padapter, u8*pcur_dot11txpn, u8 *StaAddr); +void rtw_get_sec_iv(struct adapter *padapter, u8 *pcur_dot11txpn, u8 *StaAddr); void rtw_set_sec_pn(struct adapter *padapter); #endif -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:05 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:05 +0100 Subject: [PATCH 44/57] Staging: rtl8723bs: fix spaces in ieee80211.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-45-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo*bar" should be "foo *bar" #1001: FILE: ./include/ieee80211.h:1001: +u8 *rtw_get_ie(u8*pbuf, signed int index, signed int *len, signed int limit); ERROR:POINTER_LOCATION: "(foo*)" should be "(foo *)" #1029: FILE: ./include/ieee80211.h:1029: + for (ie = (void*)buf; (((u8 *)ie) - ((u8 *)buf) + 1) < buf_len; ie = (void*)(((u8 *)ie) + *(((u8 *)ie)+1) + 2)) ERROR:POINTER_LOCATION: "(foo*)" should be "(foo *)" #1029: FILE: ./include/ieee80211.h:1029: + for (ie = (void*)buf; (((u8 *)ie) - ((u8 *)buf) + 1) < buf_len; ie = (void*)(((u8 *)ie) + *(((u8 *)ie)+1) + 2)) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #1049: FILE: ./include/ieee80211.h:1049: +u16 rtw_mcs_rate(u8 rf_type, u8 bw_40MHz, u8 short_GI, unsigned char * MCS_rate); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/ieee80211.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h index bda5712aac62..1c671b778c57 100644 --- a/drivers/staging/rtl8723bs/include/ieee80211.h +++ b/drivers/staging/rtl8723bs/include/ieee80211.h @@ -998,7 +998,7 @@ enum secondary_ch_offset { SCB = 3, /* secondary channel below */ }; -u8 *rtw_get_ie(u8*pbuf, signed int index, signed int *len, signed int limit); +u8 *rtw_get_ie(u8 *pbuf, signed int index, signed int *len, signed int limit); u8 *rtw_get_ie_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, u8 oui_len, u8 *ie, uint *ielen); int rtw_ies_remove_ie(u8 *ies, uint *ies_len, uint offset, u8 eid, u8 *oui, u8 oui_len); @@ -1026,7 +1026,8 @@ u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, u16 target_attr_id, u8 * @buf_len: */ #define for_each_ie(ie, buf, buf_len) \ - for (ie = (void*)buf; (((u8 *)ie) - ((u8 *)buf) + 1) < buf_len; ie = (void*)(((u8 *)ie) + *(((u8 *)ie)+1) + 2)) + for (ie = (void *)buf; (((u8 *)ie) - ((u8 *)buf) + 1) < buf_len; \ + ie = (void *)(((u8 *)ie) + *(((u8 *)ie) + 1) + 2)) uint rtw_get_rateset_len(u8 *rateset); @@ -1046,7 +1047,7 @@ void rtw_get_bcn_info(struct wlan_network *pnetwork); void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr); -u16 rtw_mcs_rate(u8 rf_type, u8 bw_40MHz, u8 short_GI, unsigned char * MCS_rate); +u16 rtw_mcs_rate(u8 rf_type, u8 bw_40MHz, u8 short_GI, unsigned char *MCS_rate); int rtw_action_frame_parse(const u8 *frame, u32 frame_len, u8 *category, u8 *action); const char *action_public_str(u8 action); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:06 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:06 +0100 Subject: [PATCH 45/57] Staging: rtl8723bs: fix spaces in ioctl_cfg80211.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-46-marcocesati@gmail.com> This commit fixes the following checkpatch.pl error: ERROR:POINTER_LOCATION: "foo*bar" should be "foo *bar" #109: FILE: ./include/ioctl_cfg80211.h:109: +void rtw_cfg80211_rx_action(struct adapter *adapter, u8 *frame, uint frame_len, const char*msg); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/ioctl_cfg80211.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/include/ioctl_cfg80211.h b/drivers/staging/rtl8723bs/include/ioctl_cfg80211.h index 2907a6fce7a9..7c86d05084d8 100644 --- a/drivers/staging/rtl8723bs/include/ioctl_cfg80211.h +++ b/drivers/staging/rtl8723bs/include/ioctl_cfg80211.h @@ -106,7 +106,7 @@ void rtw_cfg80211_indicate_scan_done(struct adapter *adapter, bool aborted); void rtw_cfg80211_indicate_sta_assoc(struct adapter *padapter, u8 *pmgmt_frame, uint frame_len); void rtw_cfg80211_indicate_sta_disassoc(struct adapter *padapter, unsigned char *da, unsigned short reason); -void rtw_cfg80211_rx_action(struct adapter *adapter, u8 *frame, uint frame_len, const char*msg); +void rtw_cfg80211_rx_action(struct adapter *adapter, u8 *frame, uint frame_len, const char *msg); bool rtw_cfg80211_pwr_mgmt(struct adapter *adapter); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:07 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:07 +0100 Subject: [PATCH 46/57] Staging: rtl8723bs: fix spaces in osdep_intf.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-47-marcocesati@gmail.com> This commit fixes the following checkpatch.pl error: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #73: FILE: ./include/osdep_intf.h:73: +void rtw_ndev_destructor(struct net_device * ndev); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/osdep_intf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/include/osdep_intf.h b/drivers/staging/rtl8723bs/include/osdep_intf.h index e9fee6bf8d43..aa4337686183 100644 --- a/drivers/staging/rtl8723bs/include/osdep_intf.h +++ b/drivers/staging/rtl8723bs/include/osdep_intf.h @@ -70,7 +70,7 @@ int rtw_ips_pwr_up(struct adapter *padapter); void rtw_ips_pwr_down(struct adapter *padapter); int rtw_drv_register_netdev(struct adapter *padapter); -void rtw_ndev_destructor(struct net_device * ndev); +void rtw_ndev_destructor(struct net_device *ndev); int rtw_suspend_common(struct adapter *padapter); int rtw_resume_common(struct adapter *padapter); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:08 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:08 +0100 Subject: [PATCH 47/57] Staging: rtl8723bs: fix spaces in osdep_service.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-48-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #97: FILE: ./include/osdep_service.h:97: +int _rtw_netif_rx(struct net_device * ndev, struct sk_buff *skb); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #145: FILE: ./include/osdep_service.h:145: +extern void rtw_free_netdev(struct net_device * netdev); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/osdep_service.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/osdep_service.h b/drivers/staging/rtl8723bs/include/osdep_service.h index 63971fd691ed..07f846efa0d1 100644 --- a/drivers/staging/rtl8723bs/include/osdep_service.h +++ b/drivers/staging/rtl8723bs/include/osdep_service.h @@ -94,7 +94,7 @@ void _kfree(u8 *pbuf, u32 sz); struct sk_buff *_rtw_skb_alloc(u32 sz); struct sk_buff *_rtw_skb_copy(const struct sk_buff *skb); -int _rtw_netif_rx(struct net_device * ndev, struct sk_buff *skb); +int _rtw_netif_rx(struct net_device *ndev, struct sk_buff *skb); #define rtw_malloc(sz) _rtw_malloc((sz)) #define rtw_zmalloc(sz) _rtw_zmalloc((sz)) @@ -142,7 +142,7 @@ extern void rtw_softap_lock_suspend(void); extern void rtw_softap_unlock_suspend(void); #endif -extern void rtw_free_netdev(struct net_device * netdev); +extern void rtw_free_netdev(struct net_device *netdev); /* Macros for handling unaligned memory accesses */ -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:09 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:09 +0100 Subject: [PATCH 48/57] Staging: rtl8723bs: fix spaces in osdep_service_linux.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-49-marcocesati@gmail.com> This commit fixes the following checkpatch.pl error: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #123: FILE: ./include/osdep_service_linux.h:123: +extern struct net_device * rtw_alloc_etherdev(int sizeof_priv); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/osdep_service_linux.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/include/osdep_service_linux.h b/drivers/staging/rtl8723bs/include/osdep_service_linux.h index 6454625d6bcf..3492ec1efd1e 100644 --- a/drivers/staging/rtl8723bs/include/osdep_service_linux.h +++ b/drivers/staging/rtl8723bs/include/osdep_service_linux.h @@ -120,6 +120,6 @@ static inline struct adapter *rtw_netdev_priv(struct net_device *netdev) } struct net_device *rtw_alloc_etherdev_with_old_priv(int sizeof_priv, void *old_priv); -extern struct net_device * rtw_alloc_etherdev(int sizeof_priv); +extern struct net_device *rtw_alloc_etherdev(int sizeof_priv); #endif -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:10 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:10 +0100 Subject: [PATCH 49/57] Staging: rtl8723bs: fix spaces in recv_osdep.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-50-marcocesati@gmail.com> This commit fixes the following checkpatch.pl error: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #17: FILE: ./include/recv_osdep.h:17: +extern void rtw_recv_returnpacket(struct net_device * cnxt, struct sk_buff *preturnedpkt); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/recv_osdep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/include/recv_osdep.h b/drivers/staging/rtl8723bs/include/recv_osdep.h index 82830ffc530a..83330ea98fbf 100644 --- a/drivers/staging/rtl8723bs/include/recv_osdep.h +++ b/drivers/staging/rtl8723bs/include/recv_osdep.h @@ -14,7 +14,7 @@ extern void _rtw_free_recv_priv(struct recv_priv *precvpriv); extern s32 rtw_recv_entry(union recv_frame *precv_frame); extern int rtw_recv_indicatepkt(struct adapter *adapter, union recv_frame *precv_frame); -extern void rtw_recv_returnpacket(struct net_device * cnxt, struct sk_buff *preturnedpkt); +extern void rtw_recv_returnpacket(struct net_device *cnxt, struct sk_buff *preturnedpkt); extern void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:11 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:11 +0100 Subject: [PATCH 50/57] Staging: rtl8723bs: fix spaces in rtl8723b_xmit.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-51-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #446: FILE: ./include/rtl8723b_xmit.h:446: +u8 BWMapping_8723B(struct adapter * Adapter, struct pkt_attrib *pattrib); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #447: FILE: ./include/rtl8723b_xmit.h:447: +u8 SCMapping_8723B(struct adapter * Adapter, struct pkt_attrib *pattrib); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtl8723b_xmit.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h b/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h index 45573336ead2..ccadc3d11644 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h @@ -443,7 +443,7 @@ s32 rtl8723bs_xmit_buf_handler(struct adapter *padapter); int rtl8723bs_xmit_thread(void *context); #define hal_xmit_handler rtl8723bs_xmit_buf_handler -u8 BWMapping_8723B(struct adapter * Adapter, struct pkt_attrib *pattrib); -u8 SCMapping_8723B(struct adapter * Adapter, struct pkt_attrib *pattrib); +u8 BWMapping_8723B(struct adapter *Adapter, struct pkt_attrib *pattrib); +u8 SCMapping_8723B(struct adapter *Adapter, struct pkt_attrib *pattrib); #endif -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:12 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:12 +0100 Subject: [PATCH 51/57] Staging: rtl8723bs: fix spaces in rtw_cmd.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-52-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "(foo*)" should be "(foo *)" #789: FILE: ./include/rtw_cmd.h:789: + void (*func)(void*); ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar" #827: FILE: ./include/rtw_cmd.h:827: +extern u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtw_cmd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_cmd.h b/drivers/staging/rtl8723bs/include/rtw_cmd.h index 9e42731f8fa3..b15a5abca17c 100644 --- a/drivers/staging/rtl8723bs/include/rtw_cmd.h +++ b/drivers/staging/rtl8723bs/include/rtw_cmd.h @@ -786,7 +786,7 @@ struct TDLSoption_param { /*H2C Handler index: 64 */ struct RunInThread_param { - void (*func)(void*); + void (*func)(void *); void *context; }; @@ -824,7 +824,7 @@ struct sta_info; extern u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_key, bool enqueue); extern u8 rtw_clearstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 enqueue); -extern u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork); +extern u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork); u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueue); extern u8 rtw_setopmode_cmd(struct adapter *padapter, enum NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, bool enqueue); extern u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:13 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:13 +0100 Subject: [PATCH 52/57] Staging: rtl8723bs: fix spaces in rtw_ioctl_set.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-53-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #21: FILE: ./include/rtw_ioctl_set.h:21: +u8 rtw_set_802_11_add_wep(struct adapter *padapter, struct ndis_802_11_wep * wep); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #25: FILE: ./include/rtw_ioctl_set.h:25: +u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid * ssid); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtw_ioctl_set.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h index b0cdee2df638..4db23b1c2d47 100644 --- a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h +++ b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h @@ -18,11 +18,11 @@ struct BSSIDInfo { u8 rtw_set_802_11_authentication_mode(struct adapter *pdapter, enum NDIS_802_11_AUTHENTICATION_MODE authmode); u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid); -u8 rtw_set_802_11_add_wep(struct adapter *padapter, struct ndis_802_11_wep * wep); +u8 rtw_set_802_11_add_wep(struct adapter *padapter, struct ndis_802_11_wep *wep); u8 rtw_set_802_11_disassociate(struct adapter *padapter); u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_ssid *pssid, int ssid_max_num); u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter, enum NDIS_802_11_NETWORK_INFRASTRUCTURE networktype); -u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid * ssid); +u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid); u8 rtw_set_802_11_connect(struct adapter *padapter, u8 *bssid, struct ndis_802_11_ssid *ssid); u8 rtw_validate_bssid(u8 *bssid); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:14 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:14 +0100 Subject: [PATCH 53/57] Staging: rtl8723bs: fix spaces in rtw_mlme_ext.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-54-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar" #307: FILE: ./include/rtw_mlme_ext.h:307: + char* str; ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar" #313: FILE: ./include/rtw_mlme_ext.h:313: + char* str; ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #592: FILE: ./include/rtw_mlme_ext.h:592: +int WMM_param_handler(struct adapter *padapter, struct ndis_80211_var_ie * pIE); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #595: FILE: ./include/rtw_mlme_ext.h:595: +void HT_caps_handler(struct adapter *padapter, struct ndis_80211_var_ie * pIE); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #596: FILE: ./include/rtw_mlme_ext.h:596: +void HT_info_handler(struct adapter *padapter, struct ndis_80211_var_ie * pIE); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #599: FILE: ./include/rtw_mlme_ext.h:599: +void ERP_IE_handler(struct adapter *padapter, struct ndis_80211_var_ie * pIE); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #606: FILE: ./include/rtw_mlme_ext.h:606: +void update_capinfo(struct adapter * Adapter, u16 updateCap); ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar" #633: FILE: ./include/rtw_mlme_ext.h:633: +void report_del_sta_event(struct adapter *padapter, unsigned char* MacAddr, unsigned short reason); ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar" #634: FILE: ./include/rtw_mlme_ext.h:634: +void report_add_sta_event(struct adapter *padapter, unsigned char* MacAddr, int cam_idx); Signed-off-by: Marco Cesati --- .../staging/rtl8723bs/include/rtw_mlme_ext.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h index b7bf92d1328f..e593293bb9c4 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h @@ -304,13 +304,13 @@ enum SCAN_STATE { struct mlme_handler { unsigned int num; - char* str; + char *str; unsigned int (*func)(struct adapter *padapter, union recv_frame *precv_frame); }; struct action_handler { unsigned int num; - char* str; + char *str; unsigned int (*func)(struct adapter *padapter, union recv_frame *precv_frame); }; @@ -589,21 +589,21 @@ int is_IBSS_empty(struct adapter *padapter); unsigned char check_assoc_AP(u8 *pframe, uint len); -int WMM_param_handler(struct adapter *padapter, struct ndis_80211_var_ie * pIE); +int WMM_param_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE); void WMMOnAssocRsp(struct adapter *padapter); -void HT_caps_handler(struct adapter *padapter, struct ndis_80211_var_ie * pIE); -void HT_info_handler(struct adapter *padapter, struct ndis_80211_var_ie * pIE); +void HT_caps_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE); +void HT_info_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE); void HTOnAssocRsp(struct adapter *padapter); -void ERP_IE_handler(struct adapter *padapter, struct ndis_80211_var_ie * pIE); +void ERP_IE_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE); void VCS_update(struct adapter *padapter, struct sta_info *psta); void update_ldpc_stbc_cap(struct sta_info *psta); void update_beacon_info(struct adapter *padapter, u8 *pframe, uint len, struct sta_info *psta); int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len); void update_IOT_info(struct adapter *padapter); -void update_capinfo(struct adapter * Adapter, u16 updateCap); +void update_capinfo(struct adapter *Adapter, u16 updateCap); void update_wireless_mode(struct adapter *padapter); void update_sta_basic_rate(struct sta_info *psta, u8 wireless_mode); int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie, uint var_ie_len, int cam_idx); @@ -630,8 +630,8 @@ extern u8 rtw_search_max_mac_id(struct adapter *padapter); void report_join_res(struct adapter *padapter, int res); void report_survey_event(struct adapter *padapter, union recv_frame *precv_frame); void report_surveydone_event(struct adapter *padapter); -void report_del_sta_event(struct adapter *padapter, unsigned char* MacAddr, unsigned short reason); -void report_add_sta_event(struct adapter *padapter, unsigned char* MacAddr, int cam_idx); +void report_del_sta_event(struct adapter *padapter, unsigned char *MacAddr, unsigned short reason); +void report_add_sta_event(struct adapter *padapter, unsigned char *MacAddr, int cam_idx); void report_wmm_edca_update(struct adapter *padapter); u8 chk_bmc_sleepq_cmd(struct adapter *padapter); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:15 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:15 +0100 Subject: [PATCH 54/57] Staging: rtl8723bs: fix spaces in xmit_osdep.h In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-55-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #28: FILE: ./include/xmit_osdep.h:28: +extern int _rtw_xmit_entry(struct sk_buff *pkt, struct net_device * pnetdev); ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #29: FILE: ./include/xmit_osdep.h:29: +extern int rtw_xmit_entry(struct sk_buff *pkt, struct net_device * pnetdev); Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/xmit_osdep.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/xmit_osdep.h b/drivers/staging/rtl8723bs/include/xmit_osdep.h index 0e0d8d150f78..e781cd5dfd01 100644 --- a/drivers/staging/rtl8723bs/include/xmit_osdep.h +++ b/drivers/staging/rtl8723bs/include/xmit_osdep.h @@ -25,8 +25,8 @@ struct sta_xmit_priv; struct xmit_frame; struct xmit_buf; -extern int _rtw_xmit_entry(struct sk_buff *pkt, struct net_device * pnetdev); -extern int rtw_xmit_entry(struct sk_buff *pkt, struct net_device * pnetdev); +extern int _rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev); +extern int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev); void rtw_os_xmit_schedule(struct adapter *padapter); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:16 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:16 +0100 Subject: [PATCH 55/57] Staging: rtl8723bs: fix spaces in os_intfs.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-56-marcocesati@gmail.com> This commit fixes the following checkpatch.pl error: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #208: FILE: ./os_dep/os_intfs.c:208: +static void loadparam(struct adapter *padapter, struct net_device * pnetdev) Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index 4ece23737712..2ccade46efb8 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -205,7 +205,7 @@ int _netdev_open(struct net_device *pnetdev); int netdev_open(struct net_device *pnetdev); static int netdev_close(struct net_device *pnetdev); -static void loadparam(struct adapter *padapter, struct net_device * pnetdev) +static void loadparam(struct adapter *padapter, struct net_device *pnetdev) { struct registry_priv *registry_par = &padapter->registrypriv; -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:17 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:17 +0100 Subject: [PATCH 56/57] Staging: rtl8723bs: fix spaces in osdep_service.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-57-marcocesati@gmail.com> This commit fixes the following checkpatch.pl error: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #50: FILE: ./os_dep/osdep_service.c:50: +inline int _rtw_netif_rx(struct net_device * ndev, struct sk_buff *skb) Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/os_dep/osdep_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/os_dep/osdep_service.c b/drivers/staging/rtl8723bs/os_dep/osdep_service.c index e2b8923df129..843003b91ea2 100644 --- a/drivers/staging/rtl8723bs/os_dep/osdep_service.c +++ b/drivers/staging/rtl8723bs/os_dep/osdep_service.c @@ -47,7 +47,7 @@ inline struct sk_buff *_rtw_skb_copy(const struct sk_buff *skb) return skb_copy(skb, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); } -inline int _rtw_netif_rx(struct net_device * ndev, struct sk_buff *skb) +inline int _rtw_netif_rx(struct net_device *ndev, struct sk_buff *skb) { skb->dev = ndev; return netif_rx(skb); -- 2.30.2 From marcocesati at gmail.com Mon Mar 15 17:06:18 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Mon, 15 Mar 2021 18:06:18 +0100 Subject: [PATCH 57/57] Staging: rtl8723bs: fix spaces in xmit_linux.c In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210315170618.2566-58-marcocesati@gmail.com> This commit fixes the following checkpatch.pl errors: ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #192: FILE: ./os_dep/xmit_linux.c:192: +int _rtw_xmit_entry(struct sk_buff *pkt, struct net_device * pnetdev) ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar" #247: FILE: ./os_dep/xmit_linux.c:247: +int rtw_xmit_entry(struct sk_buff *pkt, struct net_device * pnetdev) Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c index 83d7cbbcdf93..a3b6584ca0d0 100644 --- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c @@ -189,7 +189,7 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb) return true; } -int _rtw_xmit_entry(struct sk_buff *pkt, struct net_device * pnetdev) +int _rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev) { struct adapter *padapter = rtw_netdev_priv(pnetdev); struct xmit_priv *pxmitpriv = &padapter->xmitpriv; @@ -244,7 +244,7 @@ int _rtw_xmit_entry(struct sk_buff *pkt, struct net_device * pnetdev) return 0; } -int rtw_xmit_entry(struct sk_buff *pkt, struct net_device * pnetdev) +int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev) { int ret = 0; -- 2.30.2 From mrganuserge654 at gmail.com Mon Mar 15 17:06:57 2021 From: mrganuserge654 at gmail.com (Mrs.E.Glenn) Date: Mon, 15 Mar 2021 10:06:57 -0700 Subject: From Mrs.Glenn Message-ID: -- Dear Beloved, I am Mrs Elizabet Glenn from Israel. I am a missionary but right now in a hospital bed in Israel. I am 59 years and childless; my husband is dead. I was diagnosed with terminal cancer. And my doctor just predicted that I have but very limited time to live due to damages in my system and as a result of that I decided to dispose my 10.5 million US dollars to a God-fearing one for the continuation of charitable work. This is why I located you. My guess about you may not be accurate because I came across your contact at the humanitarian calendar event of the year but I believe in God who divinely directed me to you for this solemn proposal of charitable work. Therefore I wholeheartedly wish to bequeath my fortune to you as a God-fearing person for the continuation of charitable work anywhere around the world. I shall be going in for a surgery operations soonest and desire this money to be transferred to you as I do not wish to leave this money in the bank because bankers might misuse it for their own interest after my death. As soon as I receive your quick reply assuring me that you will utilize the money as I instructed you for the benefit of the less privilege, I shall give you more details and also instruct my bank to release the money to you for the charity project. I hope you receive this mail in good health. Please contact me on this E-mail (ezbtg22 at gmail.com) because I don t know what will be my situation in next minute, I am waiting for your reply. Yours sincerely, Mrs Elizabet Glenn. From lkp at intel.com Mon Mar 15 18:59:31 2021 From: lkp at intel.com (kernel test robot) Date: Tue, 16 Mar 2021 02:59:31 +0800 Subject: [staging:staging-next] BUILD SUCCESS b828324bba8f575fde487a91fec07303789dda8a Message-ID: <604fae93.yJ8dKuGxXQ/4PNSM%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-next branch HEAD: b828324bba8f575fde487a91fec07303789dda8a Merge 5.12-rc3 into staging-next elapsed time: 722m configs tested: 101 configs skipped: 3 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig openrisc alldefconfig sparc64 defconfig m68k mac_defconfig arm orion5x_defconfig mips bcm63xx_defconfig arc axs103_smp_defconfig m68k m5208evb_defconfig arm h3600_defconfig arc nsimosci_hs_smp_defconfig sparc sparc32_defconfig mips sb1250_swarm_defconfig powerpc tqm8541_defconfig sh polaris_defconfig sh espt_defconfig arm stm32_defconfig arm s5pv210_defconfig powerpc tqm8xx_defconfig xtensa virt_defconfig sh se7722_defconfig arm eseries_pxa_defconfig m68k bvme6000_defconfig arm versatile_defconfig powerpc mpc5200_defconfig mips fuloong2e_defconfig parisc generic-64bit_defconfig arm hisi_defconfig powerpc mpc836x_mds_defconfig mips cavium_octeon_defconfig powerpc redwood_defconfig powerpc socrates_defconfig arm lart_defconfig powerpc mpc83xx_defconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig arc allyesconfig nds32 allnoconfig nios2 allyesconfig alpha allyesconfig nds32 defconfig csky defconfig alpha defconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig sparc allyesconfig sparc defconfig i386 allyesconfig i386 tinyconfig i386 defconfig nios2 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a013-20210315 i386 randconfig-a016-20210315 i386 randconfig-a011-20210315 i386 randconfig-a012-20210315 i386 randconfig-a014-20210315 i386 randconfig-a015-20210315 x86_64 randconfig-a006-20210315 x86_64 randconfig-a001-20210315 x86_64 randconfig-a005-20210315 x86_64 randconfig-a004-20210315 x86_64 randconfig-a002-20210315 x86_64 randconfig-a003-20210315 riscv nommu_k210_defconfig riscv nommu_virt_defconfig riscv rv32_defconfig riscv allyesconfig riscv allnoconfig riscv defconfig riscv allmodconfig x86_64 allyesconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a011-20210315 x86_64 randconfig-a016-20210315 x86_64 randconfig-a013-20210315 x86_64 randconfig-a015-20210315 x86_64 randconfig-a014-20210315 x86_64 randconfig-a012-20210315 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From ztong0001 at gmail.com Mon Mar 15 19:58:12 2021 From: ztong0001 at gmail.com (Tong Zhang) Date: Mon, 15 Mar 2021 15:58:12 -0400 Subject: [PATCH v2] staging: comedi: cb_pcidas64: fix request_irq() warn In-Reply-To: <858341a6-c105-1440-aa4d-ea0217f2ec89@mev.co.uk> References: <858341a6-c105-1440-aa4d-ea0217f2ec89@mev.co.uk> Message-ID: <20210315195814.4692-1-ztong0001@gmail.com> request_irq() wont accept a name which contains slash so we need to repalce it with something else -- otherwise it will trigger a warning and the entry in /proc/irq/ will not be created since the .name might be used by userspace and we don't want to break userspace, so we are changing the parameters passed to request_irq() [ 1.565966] name 'pci-das6402/16' [ 1.566149] WARNING: CPU: 0 PID: 184 at fs/proc/generic.c:180 __xlate_proc_name+0x93/0xb0 [ 1.568923] RIP: 0010:__xlate_proc_name+0x93/0xb0 [ 1.574200] Call Trace: [ 1.574722] proc_mkdir+0x18/0x20 [ 1.576629] request_threaded_irq+0xfe/0x160 [ 1.576859] auto_attach+0x60a/0xc40 [cb_pcidas64] Suggested-by: Ian Abbott Signed-off-by: Tong Zhang --- v2: revert changes to .name field so that we dont break userspace drivers/staging/comedi/drivers/cb_pcidas64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index fa987bb0e7cd..6d3ba399a7f0 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -4035,7 +4035,7 @@ static int auto_attach(struct comedi_device *dev, init_stc_registers(dev); retval = request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED, - dev->board_name, dev); + "cb_pcidas64", dev); if (retval) { dev_dbg(dev->class_dev, "unable to allocate irq %u\n", pcidev->irq); -- 2.25.1 From ztong0001 at gmail.com Mon Mar 15 19:59:14 2021 From: ztong0001 at gmail.com (Tong Zhang) Date: Mon, 15 Mar 2021 15:59:14 -0400 Subject: [PATCH v2] staging: comedi: cb_pcidas: fix request_irq() warn In-Reply-To: <393f3925-9dbf-72e5-4d9b-2e213a6a71cb@mev.co.uk> References: <393f3925-9dbf-72e5-4d9b-2e213a6a71cb@mev.co.uk> Message-ID: <20210315195914.4801-1-ztong0001@gmail.com> request_irq() wont accept a name which contains slash so we need to repalce it with something else -- otherwise it will trigger a warning and the entry in /proc/irq/ will not be created since the .name might be used by userspace and we don't want to break userspace, so we are changing the parameters passed to request_irq() [ 1.630764] name 'pci-das1602/16' [ 1.630950] WARNING: CPU: 0 PID: 181 at fs/proc/generic.c:180 __xlate_proc_name+0x93/0xb0 [ 1.634009] RIP: 0010:__xlate_proc_name+0x93/0xb0 [ 1.639441] Call Trace: [ 1.639976] proc_mkdir+0x18/0x20 [ 1.641946] request_threaded_irq+0xfe/0x160 [ 1.642186] cb_pcidas_auto_attach+0xf4/0x610 [cb_pcidas] Suggested-by: Ian Abbott Signed-off-by: Tong Zhang --- v2: revert changes to .name field so that we dont break userspace drivers/staging/comedi/drivers/cb_pcidas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index d740c4782775..2f20bd56ec6c 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -1281,7 +1281,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, devpriv->amcc + AMCC_OP_REG_INTCSR); ret = request_irq(pcidev->irq, cb_pcidas_interrupt, IRQF_SHARED, - dev->board_name, dev); + "cb_pcidas", dev); if (ret) { dev_dbg(dev->class_dev, "unable to allocate irq %d\n", pcidev->irq); -- 2.25.1 From ztong0001 at gmail.com Mon Mar 15 20:00:16 2021 From: ztong0001 at gmail.com (Tong Zhang) Date: Mon, 15 Mar 2021 16:00:16 -0400 Subject: [PATCH] staging: comedi: replace slash in name In-Reply-To: <858341a6-c105-1440-aa4d-ea0217f2ec89@mev.co.uk> References: <20210314035757.2740146-1-ztong0001@gmail.com> <5d7a5e1c-35ab-58cb-ebcd-da5b280c802e@mev.co.uk> <858341a6-c105-1440-aa4d-ea0217f2ec89@mev.co.uk> Message-ID: Thanks Ian, I have submitted a v2 patch based on your suggestions. Thanks, - Tong On Mon, Mar 15, 2021 at 6:48 AM Ian Abbott wrote: > > On 15/03/2021 10:44, Ian Abbott wrote: > > On 14/03/2021 03:57, Tong Zhang wrote: > >> request_irq() wont accept a name which contains slash so we need to > >> repalce it with something else -- otherwise it will trigger a warning > >> and the entry in /proc/irq/ will not be created > >> > >> [ 1.565966] name 'pci-das6402/16' > >> [ 1.566149] WARNING: CPU: 0 PID: 184 at fs/proc/generic.c:180 __xlate_proc_name+0x93/0xb0 > >> [ 1.568923] RIP: 0010:__xlate_proc_name+0x93/0xb0 > >> [ 1.574200] Call Trace: > >> [ 1.574722] proc_mkdir+0x18/0x20 > >> [ 1.576629] request_threaded_irq+0xfe/0x160 > >> [ 1.576859] auto_attach+0x60a/0xc40 [cb_pcidas64] > >> > >> Signed-off-by: Tong Zhang > [snip] > > Userspace applications can use these strings to determine the board > > type, so changing the strings would break those applications. > > > > I suggest passing the comedi driver name "cb_pcidas" to request_irq() > > for now. > > Oops, I meant "cb_pcidas64". But you could reach that via > dev->driver->driver_name if you want (where dev is the struct > comedi_device * parameter). > > -- > -=( Ian Abbott || MEV Ltd. is a company )=- > -=( registered in England & Wales. Regd. number: 02862268. )=- > -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=- > -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=- From lkp at intel.com Mon Mar 15 20:31:04 2021 From: lkp at intel.com (kernel test robot) Date: Tue, 16 Mar 2021 04:31:04 +0800 Subject: [driver-core:debugfs_remove_return_value] BUILD SUCCESS b927f68718ad932968b335981efa03f9960bf542 Message-ID: <604fc408.2fkwdMbZhIICsJ2l%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git debugfs_remove_return_value branch HEAD: b927f68718ad932968b335981efa03f9960bf542 x86/tools/relocs: add __printf attribute to die() elapsed time: 721m configs tested: 122 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm allyesconfig arm allmodconfig arm64 allyesconfig arm64 defconfig x86_64 allyesconfig riscv allmodconfig sh defconfig sh alldefconfig powerpc taishan_defconfig riscv nommu_k210_sdcard_defconfig mips loongson3_defconfig m68k hp300_defconfig mips cu1830-neo_defconfig mips jmr3927_defconfig arm h5000_defconfig arm exynos_defconfig arc axs103_smp_defconfig m68k m5208evb_defconfig arm h3600_defconfig arc nsimosci_hs_smp_defconfig sparc sparc32_defconfig mips sb1250_swarm_defconfig arm mainstone_defconfig nios2 allyesconfig arm omap1_defconfig arm spitz_defconfig arm omap2plus_defconfig powerpc socrates_defconfig powerpc ebony_defconfig sparc sparc64_defconfig arm vf610m4_defconfig m68k m5272c3_defconfig mips xway_defconfig arc vdk_hs38_smp_defconfig sparc64 alldefconfig alpha defconfig sh se7780_defconfig sh urquell_defconfig xtensa alldefconfig sh sh7757lcr_defconfig s390 defconfig sh se7206_defconfig mips mpc30x_defconfig mips decstation_64_defconfig sh migor_defconfig microblaze mmu_defconfig xtensa cadence_csp_defconfig xtensa generic_kc705_defconfig parisc alldefconfig sh titan_defconfig arm assabet_defconfig mips ip32_defconfig arm multi_v7_defconfig h8300 h8s-sim_defconfig sh r7785rp_defconfig mips maltaup_defconfig sh apsh4ad0a_defconfig sh se7721_defconfig powerpc mpc5200_defconfig powerpc chrp32_defconfig powerpc ppc40x_defconfig sh lboxre2_defconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig nds32 defconfig csky defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig i386 allyesconfig sparc allyesconfig sparc defconfig i386 tinyconfig i386 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a001-20210315 i386 randconfig-a005-20210315 i386 randconfig-a003-20210315 i386 randconfig-a002-20210315 i386 randconfig-a004-20210315 i386 randconfig-a006-20210315 x86_64 randconfig-a006-20210315 x86_64 randconfig-a001-20210315 x86_64 randconfig-a005-20210315 x86_64 randconfig-a004-20210315 x86_64 randconfig-a002-20210315 x86_64 randconfig-a003-20210315 riscv nommu_k210_defconfig riscv allyesconfig riscv nommu_virt_defconfig riscv allnoconfig riscv defconfig riscv rv32_defconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a011-20210315 x86_64 randconfig-a016-20210315 x86_64 randconfig-a013-20210315 x86_64 randconfig-a015-20210315 x86_64 randconfig-a014-20210315 x86_64 randconfig-a012-20210315 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From lkp at intel.com Mon Mar 15 21:09:20 2021 From: lkp at intel.com (kernel test robot) Date: Tue, 16 Mar 2021 05:09:20 +0800 Subject: [PATCH] wfx: fix irqf_oneshot.cocci warnings In-Reply-To: <20210315132501.441681-25-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-25-Jerome.Pouiller@silabs.com> Message-ID: <20210315210920.GA43634@d108da9836c5> From: kernel test robot drivers/net/wireless/silabs/wfx/bus_sdio.c:134:8-33: ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT Since commit 1c6c69525b40 ("genirq: Reject bogus threaded irq requests") threaded IRQs without a primary handler need to be requested with IRQF_ONESHOT, otherwise the request will fail. So pass the IRQF_ONESHOT flag in this case. Generated by: scripts/coccinelle/misc/irqf_oneshot.cocci CC: J?r?me Pouiller Reported-by: kernel test robot Signed-off-by: kernel test robot --- url: https://github.com/0day-ci/linux/commits/Jerome-Pouiller/wfx-get-out-from-the-staging-area/20210315-212855 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git b828324bba8f575fde487a91fec07303789dda8a bus_sdio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/wireless/silabs/wfx/bus_sdio.c +++ b/drivers/net/wireless/silabs/wfx/bus_sdio.c @@ -132,7 +132,8 @@ static int wfx_sdio_irq_subscribe(void * flags = IRQF_TRIGGER_HIGH; flags |= IRQF_ONESHOT; return devm_request_threaded_irq(&bus->func->dev, bus->of_irq, NULL, - wfx_sdio_irq_handler_ext, flags, + wfx_sdio_irq_handler_ext, + flags | IRQF_ONESHOT, "wfx", bus); } From lkp at intel.com Mon Mar 15 21:09:17 2021 From: lkp at intel.com (kernel test robot) Date: Tue, 16 Mar 2021 05:09:17 +0800 Subject: [PATCH v5 24/24] wfx: get out from the staging area In-Reply-To: <20210315132501.441681-25-Jerome.Pouiller@silabs.com> References: <20210315132501.441681-25-Jerome.Pouiller@silabs.com> Message-ID: <202103160444.VUIQCdNL-lkp@intel.com> Hi Jerome, I love your patch! Perhaps something to improve: [auto build test WARNING on staging/staging-testing] [also build test WARNING on next-20210315] [cannot apply to wireless-drivers-next/master wireless-drivers/master v5.12-rc3] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Jerome-Pouiller/wfx-get-out-from-the-staging-area/20210315-212855 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git b828324bba8f575fde487a91fec07303789dda8a config: x86_64-allyesconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot "coccinelle warnings: (new ones prefixed by >>)" >> drivers/net/wireless/silabs/wfx/bus_sdio.c:134:8-33: ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT Please review and possibly fold the followup patch. --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/gzip Size: 65461 bytes Desc: not available URL: From dualli at chromium.org Tue Mar 16 01:01:58 2021 From: dualli at chromium.org (Li Li) Date: Mon, 15 Mar 2021 18:01:58 -0700 Subject: [PATCH v2 1/3] binder: BINDER_FREEZE ioctl In-Reply-To: References: <20210311184629.589725-1-dualli@chromium.org> <20210311184629.589725-2-dualli@chromium.org> Message-ID: On Fri, Mar 12, 2021 at 4:00 PM Todd Kjos wrote: > > On Thu, Mar 11, 2021 at 10:46 AM Li Li wrote: > > > > From: Marco Ballesio > > > > Frozen tasks can't process binder transactions, so a way is required to > > inform transmitting ends of communication failures due to the frozen > > state of their receiving counterparts. Additionally, races are possible > > between transitions to frozen state and binder transactions enqueued to > > a specific process. > > > > Implement BINDER_FREEZE ioctl for user space to inform the binder driver > > about the intention to freeze or unfreeze a process. When the ioctl is > > called, block the caller until any pending binder transactions toward > > the target process are flushed. Return an error to transactions to > > processes marked as frozen. > > > > Signed-off-by: Marco Ballesio > > Co-developed-by: Todd Kjos > > Signed-off-by: Todd Kjos > > Signed-off-by: Li Li > > --- > > drivers/android/binder.c | 141 ++++++++++++++++++++++++++-- > > drivers/android/binder_internal.h | 12 +++ > > include/uapi/linux/android/binder.h | 13 +++ > > 3 files changed, 156 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/android/binder.c b/drivers/android/binder.c > > index c119736ca56a..76ea558df03e 100644 > > --- a/drivers/android/binder.c > > +++ b/drivers/android/binder.c > > @@ -1506,6 +1506,12 @@ static void binder_free_transaction(struct binder_transaction *t) > > > > if (target_proc) { > > binder_inner_proc_lock(target_proc); > > + target_proc->outstanding_txns--; > > + if (target_proc->outstanding_txns < 0) > > + pr_warn("%s: Unexpected outstanding_txns %d\n", > > + __func__, target_proc->outstanding_txns); > > Shouldn't this be something like "outstanding_txns is negative"? If we > ever see one of these, is this enough information to be useful? Should > we at least print the target proc's pid so someone can figure out what > process had the messed up count? > The negative case should never happen. But if it really happens, that means we found a fundamental logic error within the binder driver. In such a case, more DEBUG enums are required to debug the issue, especially BINDER_DEBUG_TRANSACTION. So it's not necessary to print the pid again. > > > + if (!target_proc->outstanding_txns && target_proc->is_frozen) > > + wake_up_interruptible_all(&target_proc->freeze_wait); > > if (t->buffer) > > t->buffer->transaction = NULL; > > binder_inner_proc_unlock(target_proc); > > @@ -2331,10 +2337,11 @@ static int binder_fixup_parent(struct binder_transaction *t, > > * If the @thread parameter is not NULL, the transaction is always queued > > * to the waitlist of that specific thread. > > * > > - * Return: true if the transactions was successfully queued > > - * false if the target process or thread is dead > > + * Return: 0 if the transaction was successfully queued > > + * BR_DEAD_REPLY if the target process or thread is dead > > + * BR_FROZEN_REPLY if the target process or thread is frozen > > */ > > -static bool binder_proc_transaction(struct binder_transaction *t, > > +static int binder_proc_transaction(struct binder_transaction *t, > > struct binder_proc *proc, > > struct binder_thread *thread) > > { > > @@ -2354,10 +2361,13 @@ static bool binder_proc_transaction(struct binder_transaction *t, > > > > binder_inner_proc_lock(proc); > > > > - if (proc->is_dead || (thread && thread->is_dead)) { > > + if ((proc->is_frozen && !oneway) || proc->is_dead || > > + (thread && thread->is_dead)) { > > + bool proc_is_dead = proc->is_dead > > + || (thread && thread->is_dead); > > binder_inner_proc_unlock(proc); > > binder_node_unlock(node); > > - return false; > > + return proc_is_dead ? BR_DEAD_REPLY : BR_FROZEN_REPLY; > > Do we need the proc_is_dead local? This could be: > return proc->is_frozen ? BR_FROZEN_REPLY : BR_DEAD_REPLY You're right. The improved code is already in v3, which will be sent in a couple minutes. Thanks! > > > } > > > > if (!thread && !pending_async) > > @@ -2373,10 +2383,11 @@ static bool binder_proc_transaction(struct binder_transaction *t, > > if (!pending_async) > > binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); > > > > + proc->outstanding_txns++; > > binder_inner_proc_unlock(proc); > > binder_node_unlock(node); > > > > - return true; > > + return 0; > > } > > > > /** > > @@ -3013,13 +3024,16 @@ static void binder_transaction(struct binder_proc *proc, > > if (reply) { > > binder_enqueue_thread_work(thread, tcomplete); > > binder_inner_proc_lock(target_proc); > > - if (target_thread->is_dead) { > > + if (target_thread->is_dead || target_proc->is_frozen) { > > + return_error = target_thread->is_dead ? > > + BR_DEAD_REPLY : BR_FROZEN_REPLY; > > binder_inner_proc_unlock(target_proc); > > goto err_dead_proc_or_thread; > > } > > BUG_ON(t->buffer->async_transaction != 0); > > binder_pop_transaction_ilocked(target_thread, in_reply_to); > > binder_enqueue_thread_work_ilocked(target_thread, &t->work); > > + target_proc->outstanding_txns++; > > binder_inner_proc_unlock(target_proc); > > wake_up_interruptible_sync(&target_thread->wait); > > binder_free_transaction(in_reply_to); > > @@ -3038,7 +3052,9 @@ static void binder_transaction(struct binder_proc *proc, > > t->from_parent = thread->transaction_stack; > > thread->transaction_stack = t; > > binder_inner_proc_unlock(proc); > > - if (!binder_proc_transaction(t, target_proc, target_thread)) { > > + return_error = binder_proc_transaction(t, > > + target_proc, target_thread); > > + if (return_error) { > > binder_inner_proc_lock(proc); > > binder_pop_transaction_ilocked(thread, t); > > binder_inner_proc_unlock(proc); > > @@ -3048,7 +3064,8 @@ static void binder_transaction(struct binder_proc *proc, > > BUG_ON(target_node == NULL); > > BUG_ON(t->buffer->async_transaction != 1); > > binder_enqueue_thread_work(thread, tcomplete); > > - if (!binder_proc_transaction(t, target_proc, NULL)) > > + return_error = binder_proc_transaction(t, target_proc, NULL); > > + if (return_error) > > goto err_dead_proc_or_thread; > > } > > if (target_thread) > > @@ -3065,7 +3082,6 @@ static void binder_transaction(struct binder_proc *proc, > > return; > > > > err_dead_proc_or_thread: > > - return_error = BR_DEAD_REPLY; > > return_error_line = __LINE__; > > binder_dequeue_work(proc, tcomplete); > > err_translate_failed: > > @@ -4298,6 +4314,9 @@ static void binder_free_proc(struct binder_proc *proc) > > > > BUG_ON(!list_empty(&proc->todo)); > > BUG_ON(!list_empty(&proc->delivered_death)); > > + if (proc->outstanding_txns) > > + pr_warn("%s: Unexpected outstanding_txns %d\n", > > + __func__, proc->outstanding_txns); > > device = container_of(proc->context, struct binder_device, context); > > if (refcount_dec_and_test(&device->ref)) { > > kfree(proc->context->name); > > @@ -4359,6 +4378,7 @@ static int binder_thread_release(struct binder_proc *proc, > > (t->to_thread == thread) ? "in" : "out"); > > > > if (t->to_thread == thread) { > > + thread->proc->outstanding_txns--; > > t->to_proc = NULL; > > t->to_thread = NULL; > > if (t->buffer) { > > @@ -4609,6 +4629,45 @@ static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, > > return 0; > > } > > > > +static int binder_ioctl_freeze(struct binder_freeze_info *info, > > + struct binder_proc *target_proc) > > +{ > > + int ret = 0; > > + > > + if (!info->enable) { > > + binder_inner_proc_lock(target_proc); > > + target_proc->is_frozen = false; > > + binder_inner_proc_unlock(target_proc); > > + return 0; > > + } > > + > > + /* > > + * Freezing the target. Prevent new transactions by > > + * setting frozen state. If timeout specified, wait > > + * for transactions to drain. > > + */ > > + binder_inner_proc_lock(target_proc); > > + target_proc->is_frozen = true; > > + binder_inner_proc_unlock(target_proc); > > + > > + if (info->timeout_ms > 0) > > + ret = wait_event_interruptible_timeout( > > + target_proc->freeze_wait, > > + (!target_proc->outstanding_txns), > > + msecs_to_jiffies(info->timeout_ms)); > > + > > + if (!ret && target_proc->outstanding_txns) > > + ret = -EAGAIN; > > + > > + if (ret < 0) { > > + binder_inner_proc_lock(target_proc); > > + target_proc->is_frozen = false; > > + binder_inner_proc_unlock(target_proc); > > + } > > + > > + return ret; > > +} > > + > > static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > > { > > int ret; > > @@ -4727,6 +4786,66 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > > } > > break; > > } > > + case BINDER_FREEZE: { > > + struct binder_freeze_info info; > > + struct binder_proc **target_procs = NULL, *target_proc; > > + int target_procs_count = 0, i = 0; > > + > > + ret = 0; > > + > > + if (copy_from_user(&info, ubuf, sizeof(info))) { > > + ret = -EFAULT; > > + goto err; > > + } > > + > > + mutex_lock(&binder_procs_lock); > > + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { > > + if (target_proc->pid == info.pid) > > + target_procs_count++; > > + } > > + > > + if (target_procs_count == 0) { > > + mutex_unlock(&binder_procs_lock); > > + ret = -EINVAL; > > + goto err; > > + } > > + > > + target_procs = kcalloc(target_procs_count, > > + sizeof(struct binder_proc *), > > + GFP_KERNEL); > > + > > + if (!target_procs) { > > + mutex_unlock(&binder_procs_lock); > > + ret = -ENOMEM; > > + goto err; > > + } > > + > > + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { > > + if (target_proc->pid != info.pid) > > + continue; > > + > > + binder_inner_proc_lock(target_proc); > > + target_proc->tmp_ref++; > > + binder_inner_proc_unlock(target_proc); > > + > > + target_procs[i++] = target_proc; > > + } > > + mutex_unlock(&binder_procs_lock); > > + > > + for (i = 0; i < target_procs_count; i++) { > > + if (ret >= 0) > > + ret = binder_ioctl_freeze(&info, > > + target_procs[i]); > > + > > + binder_proc_dec_tmpref(target_procs[i]); > > + } > > + > > + kfree(target_procs); > > + > > + if (ret < 0) > > + goto err; > > + break; > > + } > > default: > > ret = -EINVAL; > > goto err; > > @@ -4823,6 +4942,7 @@ static int binder_open(struct inode *nodp, struct file *filp) > > get_task_struct(current->group_leader); > > proc->tsk = current->group_leader; > > INIT_LIST_HEAD(&proc->todo); > > + init_waitqueue_head(&proc->freeze_wait); > > proc->default_priority = task_nice(current); > > /* binderfs stashes devices in i_private */ > > if (is_binderfs_device(nodp)) { > > @@ -5035,6 +5155,7 @@ static void binder_deferred_release(struct binder_proc *proc) > > proc->tmp_ref++; > > > > proc->is_dead = true; > > + proc->is_frozen = false; > > threads = 0; > > active_transactions = 0; > > while ((n = rb_first(&proc->threads))) { > > diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h > > index 6cd79011e35d..e6a53e98c6da 100644 > > --- a/drivers/android/binder_internal.h > > +++ b/drivers/android/binder_internal.h > > @@ -367,9 +367,18 @@ struct binder_ref { > > * (protected by binder_deferred_lock) > > * @deferred_work: bitmap of deferred work to perform > > * (protected by binder_deferred_lock) > > + * @outstanding_txns: number of transactions to be transmitted before > > + * processes in freeze_wait are woken up > > + * (protected by @inner_lock) > > * @is_dead: process is dead and awaiting free > > * when outstanding transactions are cleaned up > > * (protected by @inner_lock) > > + * @is_frozen: process is frozen and unable to service > > + * binder transactions > > + * (protected by @inner_lock) > > + * @freeze_wait: waitqueue of processes waiting for all outstanding > > + * transactions to be processed > > + * (protected by @inner_lock) > > * @todo: list of work for this process > > * (protected by @inner_lock) > > * @stats: per-process binder statistics > > @@ -410,7 +419,10 @@ struct binder_proc { > > struct task_struct *tsk; > > struct hlist_node deferred_work_node; > > int deferred_work; > > + int outstanding_txns; > > bool is_dead; > > + bool is_frozen; > > + wait_queue_head_t freeze_wait; > > > > struct list_head todo; > > struct binder_stats stats; > > diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h > > index ec84ad106568..7eb5b818b3c1 100644 > > --- a/include/uapi/linux/android/binder.h > > +++ b/include/uapi/linux/android/binder.h > > @@ -217,6 +217,12 @@ struct binder_node_info_for_ref { > > __u32 reserved3; > > }; > > > > +struct binder_freeze_info { > > + __u32 pid; > > + __u32 enable; > > + __u32 timeout_ms; > > +}; > > + > > #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) > > #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) > > #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) > > @@ -227,6 +233,7 @@ struct binder_node_info_for_ref { > > #define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info) > > #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref) > > #define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object) > > +#define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info) > > > > /* > > * NOTE: Two special error codes you should check for when calling > > @@ -408,6 +415,12 @@ enum binder_driver_return_protocol { > > * The last transaction (either a bcTRANSACTION or > > * a bcATTEMPT_ACQUIRE) failed (e.g. out of memory). No parameters. > > */ > > + > > + BR_FROZEN_REPLY = _IO('r', 18), > > + /* > > + * The target of the last transaction (either a bcTRANSACTION or > > + * a bcATTEMPT_ACQUIRE) is frozen. No parameters. > > + */ > > }; > > > > enum binder_driver_command_protocol { > > -- > > 2.31.0.rc2.261.g7f71774620-goog > > From dualli at chromium.org Tue Mar 16 01:16:27 2021 From: dualli at chromium.org (Li Li) Date: Mon, 15 Mar 2021 18:16:27 -0700 Subject: [PATCH v3 0/3] Binder: Enable App Freezing Capability Message-ID: <20210316011630.1121213-1-dualli@chromium.org> From: Li Li To improve the user experience when switching between recently used applications, the background applications which are not currently needed are cached in the memory. Normally, a well designed application will not consume valuable CPU resources in the background. However, it's possible some applications are not able or willing to behave as expected, wasting energy even after being cached. It is a good idea to freeze those applications when they're only being kept alive for the sake of faster startup and energy saving. These kernel patches will provide the necessary infrastructure for user space framework to freeze and thaw a cached process, check the current freezing status and correctly deal with outstanding binder transactions to frozen processes. Changes in v2: avoid panic by using pr_warn for unexpected cases. Changes in v3: improved errcode logic in binder_proc_transaction(). Marco Ballesio (3): binder: BINDER_FREEZE ioctl binder: use EINTR for interrupted wait for work binder: BINDER_GET_FROZEN_INFO ioctl drivers/android/binder.c | 198 ++++++++++++++++++++++++++-- drivers/android/binder_internal.h | 18 +++ include/uapi/linux/android/binder.h | 20 +++ 3 files changed, 224 insertions(+), 12 deletions(-) -- 2.31.0.rc2.261.g7f71774620-goog From dualli at chromium.org Tue Mar 16 01:16:28 2021 From: dualli at chromium.org (Li Li) Date: Mon, 15 Mar 2021 18:16:28 -0700 Subject: [PATCH v3 1/3] binder: BINDER_FREEZE ioctl In-Reply-To: <20210316011630.1121213-1-dualli@chromium.org> References: <20210316011630.1121213-1-dualli@chromium.org> Message-ID: <20210316011630.1121213-2-dualli@chromium.org> From: Marco Ballesio Frozen tasks can't process binder transactions, so a way is required to inform transmitting ends of communication failures due to the frozen state of their receiving counterparts. Additionally, races are possible between transitions to frozen state and binder transactions enqueued to a specific process. Implement BINDER_FREEZE ioctl for user space to inform the binder driver about the intention to freeze or unfreeze a process. When the ioctl is called, block the caller until any pending binder transactions toward the target process are flushed. Return an error to transactions to processes marked as frozen. Signed-off-by: Marco Ballesio Co-developed-by: Todd Kjos Signed-off-by: Todd Kjos Signed-off-by: Li Li --- drivers/android/binder.c | 139 ++++++++++++++++++++++++++-- drivers/android/binder_internal.h | 12 +++ include/uapi/linux/android/binder.h | 13 +++ 3 files changed, 154 insertions(+), 10 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index c119736ca56a..b93ca53bb90f 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -1506,6 +1506,12 @@ static void binder_free_transaction(struct binder_transaction *t) if (target_proc) { binder_inner_proc_lock(target_proc); + target_proc->outstanding_txns--; + if (target_proc->outstanding_txns < 0) + pr_warn("%s: Unexpected outstanding_txns %d\n", + __func__, target_proc->outstanding_txns); + if (!target_proc->outstanding_txns && target_proc->is_frozen) + wake_up_interruptible_all(&target_proc->freeze_wait); if (t->buffer) t->buffer->transaction = NULL; binder_inner_proc_unlock(target_proc); @@ -2331,10 +2337,11 @@ static int binder_fixup_parent(struct binder_transaction *t, * If the @thread parameter is not NULL, the transaction is always queued * to the waitlist of that specific thread. * - * Return: true if the transactions was successfully queued - * false if the target process or thread is dead + * Return: 0 if the transaction was successfully queued + * BR_DEAD_REPLY if the target process or thread is dead + * BR_FROZEN_REPLY if the target process or thread is frozen */ -static bool binder_proc_transaction(struct binder_transaction *t, +static int binder_proc_transaction(struct binder_transaction *t, struct binder_proc *proc, struct binder_thread *thread) { @@ -2354,10 +2361,11 @@ static bool binder_proc_transaction(struct binder_transaction *t, binder_inner_proc_lock(proc); - if (proc->is_dead || (thread && thread->is_dead)) { + if ((proc->is_frozen && !oneway) || proc->is_dead || + (thread && thread->is_dead)) { binder_inner_proc_unlock(proc); binder_node_unlock(node); - return false; + return proc->is_frozen ? BR_FROZEN_REPLY : BR_DEAD_REPLY; } if (!thread && !pending_async) @@ -2373,10 +2381,11 @@ static bool binder_proc_transaction(struct binder_transaction *t, if (!pending_async) binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); + proc->outstanding_txns++; binder_inner_proc_unlock(proc); binder_node_unlock(node); - return true; + return 0; } /** @@ -3013,13 +3022,16 @@ static void binder_transaction(struct binder_proc *proc, if (reply) { binder_enqueue_thread_work(thread, tcomplete); binder_inner_proc_lock(target_proc); - if (target_thread->is_dead) { + if (target_thread->is_dead || target_proc->is_frozen) { + return_error = target_thread->is_dead ? + BR_DEAD_REPLY : BR_FROZEN_REPLY; binder_inner_proc_unlock(target_proc); goto err_dead_proc_or_thread; } BUG_ON(t->buffer->async_transaction != 0); binder_pop_transaction_ilocked(target_thread, in_reply_to); binder_enqueue_thread_work_ilocked(target_thread, &t->work); + target_proc->outstanding_txns++; binder_inner_proc_unlock(target_proc); wake_up_interruptible_sync(&target_thread->wait); binder_free_transaction(in_reply_to); @@ -3038,7 +3050,9 @@ static void binder_transaction(struct binder_proc *proc, t->from_parent = thread->transaction_stack; thread->transaction_stack = t; binder_inner_proc_unlock(proc); - if (!binder_proc_transaction(t, target_proc, target_thread)) { + return_error = binder_proc_transaction(t, + target_proc, target_thread); + if (return_error) { binder_inner_proc_lock(proc); binder_pop_transaction_ilocked(thread, t); binder_inner_proc_unlock(proc); @@ -3048,7 +3062,8 @@ static void binder_transaction(struct binder_proc *proc, BUG_ON(target_node == NULL); BUG_ON(t->buffer->async_transaction != 1); binder_enqueue_thread_work(thread, tcomplete); - if (!binder_proc_transaction(t, target_proc, NULL)) + return_error = binder_proc_transaction(t, target_proc, NULL); + if (return_error) goto err_dead_proc_or_thread; } if (target_thread) @@ -3065,7 +3080,6 @@ static void binder_transaction(struct binder_proc *proc, return; err_dead_proc_or_thread: - return_error = BR_DEAD_REPLY; return_error_line = __LINE__; binder_dequeue_work(proc, tcomplete); err_translate_failed: @@ -4298,6 +4312,9 @@ static void binder_free_proc(struct binder_proc *proc) BUG_ON(!list_empty(&proc->todo)); BUG_ON(!list_empty(&proc->delivered_death)); + if (proc->outstanding_txns) + pr_warn("%s: Unexpected outstanding_txns %d\n", + __func__, proc->outstanding_txns); device = container_of(proc->context, struct binder_device, context); if (refcount_dec_and_test(&device->ref)) { kfree(proc->context->name); @@ -4359,6 +4376,7 @@ static int binder_thread_release(struct binder_proc *proc, (t->to_thread == thread) ? "in" : "out"); if (t->to_thread == thread) { + thread->proc->outstanding_txns--; t->to_proc = NULL; t->to_thread = NULL; if (t->buffer) { @@ -4609,6 +4627,45 @@ static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, return 0; } +static int binder_ioctl_freeze(struct binder_freeze_info *info, + struct binder_proc *target_proc) +{ + int ret = 0; + + if (!info->enable) { + binder_inner_proc_lock(target_proc); + target_proc->is_frozen = false; + binder_inner_proc_unlock(target_proc); + return 0; + } + + /* + * Freezing the target. Prevent new transactions by + * setting frozen state. If timeout specified, wait + * for transactions to drain. + */ + binder_inner_proc_lock(target_proc); + target_proc->is_frozen = true; + binder_inner_proc_unlock(target_proc); + + if (info->timeout_ms > 0) + ret = wait_event_interruptible_timeout( + target_proc->freeze_wait, + (!target_proc->outstanding_txns), + msecs_to_jiffies(info->timeout_ms)); + + if (!ret && target_proc->outstanding_txns) + ret = -EAGAIN; + + if (ret < 0) { + binder_inner_proc_lock(target_proc); + target_proc->is_frozen = false; + binder_inner_proc_unlock(target_proc); + } + + return ret; +} + static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { int ret; @@ -4727,6 +4784,66 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) } break; } + case BINDER_FREEZE: { + struct binder_freeze_info info; + struct binder_proc **target_procs = NULL, *target_proc; + int target_procs_count = 0, i = 0; + + ret = 0; + + if (copy_from_user(&info, ubuf, sizeof(info))) { + ret = -EFAULT; + goto err; + } + + mutex_lock(&binder_procs_lock); + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { + if (target_proc->pid == info.pid) + target_procs_count++; + } + + if (target_procs_count == 0) { + mutex_unlock(&binder_procs_lock); + ret = -EINVAL; + goto err; + } + + target_procs = kcalloc(target_procs_count, + sizeof(struct binder_proc *), + GFP_KERNEL); + + if (!target_procs) { + mutex_unlock(&binder_procs_lock); + ret = -ENOMEM; + goto err; + } + + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { + if (target_proc->pid != info.pid) + continue; + + binder_inner_proc_lock(target_proc); + target_proc->tmp_ref++; + binder_inner_proc_unlock(target_proc); + + target_procs[i++] = target_proc; + } + mutex_unlock(&binder_procs_lock); + + for (i = 0; i < target_procs_count; i++) { + if (ret >= 0) + ret = binder_ioctl_freeze(&info, + target_procs[i]); + + binder_proc_dec_tmpref(target_procs[i]); + } + + kfree(target_procs); + + if (ret < 0) + goto err; + break; + } default: ret = -EINVAL; goto err; @@ -4823,6 +4940,7 @@ static int binder_open(struct inode *nodp, struct file *filp) get_task_struct(current->group_leader); proc->tsk = current->group_leader; INIT_LIST_HEAD(&proc->todo); + init_waitqueue_head(&proc->freeze_wait); proc->default_priority = task_nice(current); /* binderfs stashes devices in i_private */ if (is_binderfs_device(nodp)) { @@ -5035,6 +5153,7 @@ static void binder_deferred_release(struct binder_proc *proc) proc->tmp_ref++; proc->is_dead = true; + proc->is_frozen = false; threads = 0; active_transactions = 0; while ((n = rb_first(&proc->threads))) { diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h index 6cd79011e35d..e6a53e98c6da 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -367,9 +367,18 @@ struct binder_ref { * (protected by binder_deferred_lock) * @deferred_work: bitmap of deferred work to perform * (protected by binder_deferred_lock) + * @outstanding_txns: number of transactions to be transmitted before + * processes in freeze_wait are woken up + * (protected by @inner_lock) * @is_dead: process is dead and awaiting free * when outstanding transactions are cleaned up * (protected by @inner_lock) + * @is_frozen: process is frozen and unable to service + * binder transactions + * (protected by @inner_lock) + * @freeze_wait: waitqueue of processes waiting for all outstanding + * transactions to be processed + * (protected by @inner_lock) * @todo: list of work for this process * (protected by @inner_lock) * @stats: per-process binder statistics @@ -410,7 +419,10 @@ struct binder_proc { struct task_struct *tsk; struct hlist_node deferred_work_node; int deferred_work; + int outstanding_txns; bool is_dead; + bool is_frozen; + wait_queue_head_t freeze_wait; struct list_head todo; struct binder_stats stats; diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h index ec84ad106568..7eb5b818b3c1 100644 --- a/include/uapi/linux/android/binder.h +++ b/include/uapi/linux/android/binder.h @@ -217,6 +217,12 @@ struct binder_node_info_for_ref { __u32 reserved3; }; +struct binder_freeze_info { + __u32 pid; + __u32 enable; + __u32 timeout_ms; +}; + #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) @@ -227,6 +233,7 @@ struct binder_node_info_for_ref { #define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info) #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref) #define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object) +#define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info) /* * NOTE: Two special error codes you should check for when calling @@ -408,6 +415,12 @@ enum binder_driver_return_protocol { * The last transaction (either a bcTRANSACTION or * a bcATTEMPT_ACQUIRE) failed (e.g. out of memory). No parameters. */ + + BR_FROZEN_REPLY = _IO('r', 18), + /* + * The target of the last transaction (either a bcTRANSACTION or + * a bcATTEMPT_ACQUIRE) is frozen. No parameters. + */ }; enum binder_driver_command_protocol { -- 2.31.0.rc2.261.g7f71774620-goog From dualli at chromium.org Tue Mar 16 01:16:29 2021 From: dualli at chromium.org (Li Li) Date: Mon, 15 Mar 2021 18:16:29 -0700 Subject: [PATCH v3 2/3] binder: use EINTR for interrupted wait for work In-Reply-To: <20210316011630.1121213-1-dualli@chromium.org> References: <20210316011630.1121213-1-dualli@chromium.org> Message-ID: <20210316011630.1121213-3-dualli@chromium.org> From: Marco Ballesio when interrupted by a signal, binder_wait_for_work currently returns -ERESTARTSYS. This error code isn't propagated to user space, but a way to handle interruption due to signals must be provided to code using this API. Replace this instance of -ERESTARTSYS with -EINTR, which is propagated to user space. Test: built, booted, interrupted a worker thread within binder_wait_for_work Signed-off-by: Marco Ballesio Signed-off-by: Li Li --- drivers/android/binder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index b93ca53bb90f..fe16c455a76e 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -3710,7 +3710,7 @@ static int binder_wait_for_work(struct binder_thread *thread, binder_inner_proc_lock(proc); list_del_init(&thread->waiting_thread_node); if (signal_pending(current)) { - ret = -ERESTARTSYS; + ret = -EINTR; break; } } @@ -4853,7 +4853,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) if (thread) thread->looper_need_return = false; wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2); - if (ret && ret != -ERESTARTSYS) + if (ret && ret != -EINTR) pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); err_unlocked: trace_binder_ioctl_done(ret); -- 2.31.0.rc2.261.g7f71774620-goog From dualli at chromium.org Tue Mar 16 01:16:30 2021 From: dualli at chromium.org (Li Li) Date: Mon, 15 Mar 2021 18:16:30 -0700 Subject: [PATCH v3 3/3] binder: BINDER_GET_FROZEN_INFO ioctl In-Reply-To: <20210316011630.1121213-1-dualli@chromium.org> References: <20210316011630.1121213-1-dualli@chromium.org> Message-ID: <20210316011630.1121213-4-dualli@chromium.org> From: Marco Ballesio User space needs to know if binder transactions occurred to frozen processes. Introduce a new BINDER_GET_FROZEN ioctl and keep track of transactions occurring to frozen proceses. Signed-off-by: Marco Ballesio Signed-off-by: Li Li --- drivers/android/binder.c | 55 +++++++++++++++++++++++++++++ drivers/android/binder_internal.h | 6 ++++ include/uapi/linux/android/binder.h | 7 ++++ 3 files changed, 68 insertions(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index fe16c455a76e..e1a484ab0366 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2360,6 +2360,10 @@ static int binder_proc_transaction(struct binder_transaction *t, } binder_inner_proc_lock(proc); + if (proc->is_frozen) { + proc->sync_recv |= !oneway; + proc->async_recv |= oneway; + } if ((proc->is_frozen && !oneway) || proc->is_dead || (thread && thread->is_dead)) { @@ -4634,6 +4638,8 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, if (!info->enable) { binder_inner_proc_lock(target_proc); + target_proc->sync_recv = false; + target_proc->async_recv = false; target_proc->is_frozen = false; binder_inner_proc_unlock(target_proc); return 0; @@ -4645,6 +4651,8 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, * for transactions to drain. */ binder_inner_proc_lock(target_proc); + target_proc->sync_recv = false; + target_proc->async_recv = false; target_proc->is_frozen = true; binder_inner_proc_unlock(target_proc); @@ -4666,6 +4674,33 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, return ret; } +static int binder_ioctl_get_freezer_info( + struct binder_frozen_status_info *info) +{ + struct binder_proc *target_proc; + bool found = false; + + info->sync_recv = 0; + info->async_recv = 0; + + mutex_lock(&binder_procs_lock); + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { + if (target_proc->pid == info->pid) { + found = true; + binder_inner_proc_lock(target_proc); + info->sync_recv |= target_proc->sync_recv; + info->async_recv |= target_proc->async_recv; + binder_inner_proc_unlock(target_proc); + } + } + mutex_unlock(&binder_procs_lock); + + if (!found) + return -EINVAL; + + return 0; +} + static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { int ret; @@ -4844,6 +4879,24 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) goto err; break; } + case BINDER_GET_FROZEN_INFO: { + struct binder_frozen_status_info info; + + if (copy_from_user(&info, ubuf, sizeof(info))) { + ret = -EFAULT; + goto err; + } + + ret = binder_ioctl_get_freezer_info(&info); + if (ret < 0) + goto err; + + if (copy_to_user(ubuf, &info, sizeof(info))) { + ret = -EFAULT; + goto err; + } + break; + } default: ret = -EINVAL; goto err; @@ -5154,6 +5207,8 @@ static void binder_deferred_release(struct binder_proc *proc) proc->is_dead = true; proc->is_frozen = false; + proc->sync_recv = false; + proc->async_recv = false; threads = 0; active_transactions = 0; while ((n = rb_first(&proc->threads))) { diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h index e6a53e98c6da..2872a7de68e1 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -376,6 +376,10 @@ struct binder_ref { * @is_frozen: process is frozen and unable to service * binder transactions * (protected by @inner_lock) + * @sync_recv: process received sync transactions since last frozen + * (protected by @inner_lock) + * @async_recv: process received async transactions since last frozen + * (protected by @inner_lock) * @freeze_wait: waitqueue of processes waiting for all outstanding * transactions to be processed * (protected by @inner_lock) @@ -422,6 +426,8 @@ struct binder_proc { int outstanding_txns; bool is_dead; bool is_frozen; + bool sync_recv; + bool async_recv; wait_queue_head_t freeze_wait; struct list_head todo; diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h index 7eb5b818b3c1..156070d18c4f 100644 --- a/include/uapi/linux/android/binder.h +++ b/include/uapi/linux/android/binder.h @@ -223,6 +223,12 @@ struct binder_freeze_info { __u32 timeout_ms; }; +struct binder_frozen_status_info { + __u32 pid; + __u32 sync_recv; + __u32 async_recv; +}; + #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) @@ -234,6 +240,7 @@ struct binder_freeze_info { #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref) #define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object) #define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info) +#define BINDER_GET_FROZEN_INFO _IOWR('b', 15, struct binder_frozen_status_info) /* * NOTE: Two special error codes you should check for when calling -- 2.31.0.rc2.261.g7f71774620-goog From zhaoxiao at uniontech.com Tue Mar 16 02:44:10 2021 From: zhaoxiao at uniontech.com (zhaoxiao) Date: Tue, 16 Mar 2021 10:44:10 +0800 Subject: [PATCH v2] staging: rtl8192u: remove extra lines Message-ID: <20210316024410.24609-1-zhaoxiao@uniontech.com> Remove extra lines in many functions in r8192U_wx.c. Signed-off-by: zhaoxiao --- drivers/staging/rtl8192u/r8192U_wx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index 6ead461e3279..e68d37914456 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -879,7 +879,6 @@ static iw_handler r8192_wx_handlers[] = { static const struct iw_priv_args r8192_private_args[] = { - { SIOCIWFIRSTPRIV + 0x0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc" @@ -890,14 +889,15 @@ static const struct iw_priv_args r8192_private_args[] = { IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan" }, + { SIOCIWFIRSTPRIV + 0x2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx" }, + { SIOCIWFIRSTPRIV + 0x3, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset" - } }; -- 2.20.1 From lkp at intel.com Tue Mar 16 04:04:34 2021 From: lkp at intel.com (kernel test robot) Date: Tue, 16 Mar 2021 12:04:34 +0800 Subject: [staging:staging-linus] BUILD SUCCESS 12ec5408d2135bfcdec14ff7e4248f1be8597f31 Message-ID: <60502e52.mtRBqrM7jtG9VGPx%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-linus branch HEAD: 12ec5408d2135bfcdec14ff7e4248f1be8597f31 Merge tag 'iio-fixes-for-5.12a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus elapsed time: 722m configs tested: 121 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig x86_64 allyesconfig riscv allmodconfig h8300 edosk2674_defconfig powerpc amigaone_defconfig powerpc linkstation_defconfig m68k m5407c3_defconfig arc nsimosci_hs_smp_defconfig openrisc simple_smp_defconfig mips malta_kvm_defconfig arm exynos_defconfig ia64 bigsur_defconfig arm dove_defconfig ia64 gensparse_defconfig arm spear13xx_defconfig powerpc skiroot_defconfig sh ecovec24_defconfig powerpc iss476-smp_defconfig powerpc chrp32_defconfig openrisc alldefconfig arm am200epdkit_defconfig arm palmz72_defconfig arm versatile_defconfig mips xway_defconfig arm lpc32xx_defconfig sh shmin_defconfig mips ip32_defconfig parisc alldefconfig arm lubbock_defconfig x86_64 defconfig sh rts7751r2dplus_defconfig powerpc rainier_defconfig parisc generic-32bit_defconfig arm mini2440_defconfig mips rt305x_defconfig arc haps_hs_smp_defconfig sh se7712_defconfig csky defconfig powerpc mpc512x_defconfig ia64 alldefconfig powerpc motionpro_defconfig arm h3600_defconfig powerpc mpc8313_rdb_defconfig powerpc g5_defconfig arm orion5x_defconfig powerpc mpc837x_rdb_defconfig powerpc arches_defconfig arm pcm027_defconfig xtensa alldefconfig mips ath79_defconfig mips lemote2f_defconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig nds32 defconfig nios2 allyesconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig i386 allyesconfig sparc allyesconfig sparc defconfig i386 tinyconfig i386 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig x86_64 randconfig-a006-20210315 x86_64 randconfig-a001-20210315 x86_64 randconfig-a005-20210315 x86_64 randconfig-a004-20210315 x86_64 randconfig-a002-20210315 x86_64 randconfig-a003-20210315 i386 randconfig-a001-20210315 i386 randconfig-a005-20210315 i386 randconfig-a003-20210315 i386 randconfig-a002-20210315 i386 randconfig-a004-20210315 i386 randconfig-a006-20210315 i386 randconfig-a013-20210315 i386 randconfig-a016-20210315 i386 randconfig-a011-20210315 i386 randconfig-a012-20210315 i386 randconfig-a014-20210315 i386 randconfig-a015-20210315 riscv nommu_k210_defconfig riscv allyesconfig riscv nommu_virt_defconfig riscv allnoconfig riscv defconfig riscv rv32_defconfig x86_64 rhel-7.6-kselftests x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a011-20210315 x86_64 randconfig-a016-20210315 x86_64 randconfig-a013-20210315 x86_64 randconfig-a015-20210315 x86_64 randconfig-a014-20210315 x86_64 randconfig-a012-20210315 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From dan.carpenter at oracle.com Tue Mar 16 06:47:56 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Tue, 16 Mar 2021 09:47:56 +0300 Subject: [PATCH v2] staging: rtl8192u: remove extra lines In-Reply-To: <20210316024410.24609-1-zhaoxiao@uniontech.com> References: <20210316024410.24609-1-zhaoxiao@uniontech.com> Message-ID: <20210316064756.GQ21246@kadam> On Tue, Mar 16, 2021 at 10:44:10AM +0800, zhaoxiao wrote: > Remove extra lines in many functions in r8192U_wx.c. > > Signed-off-by: zhaoxiao > --- > drivers/staging/rtl8192u/r8192U_wx.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) ^^^^^^^^^^^^ The commit message says you're removing lines but you're also adding them. :P regards, dan carpenter From jerome.pouiller at silabs.com Tue Mar 16 07:53:03 2021 From: jerome.pouiller at silabs.com (=?ISO-8859-1?Q?J=E9r=F4me?= Pouiller) Date: Tue, 16 Mar 2021 08:53:03 +0100 Subject: [PATCH] wfx: fix irqf_oneshot.cocci warnings In-Reply-To: <20210315210920.GA43634@d108da9836c5> References: <20210315132501.441681-25-Jerome.Pouiller@silabs.com> <20210315210920.GA43634@d108da9836c5> Message-ID: <3096745.nmkoU2l6Xm@pc-42> Hello, On Monday 15 March 2021 22:09:20 CET kernel test robot wrote: > > From: kernel test robot > > drivers/net/wireless/silabs/wfx/bus_sdio.c:134:8-33: ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT > > Since commit 1c6c69525b40 ("genirq: Reject bogus threaded irq requests") > threaded IRQs without a primary handler need to be requested with > IRQF_ONESHOT, otherwise the request will fail. > > So pass the IRQF_ONESHOT flag in this case. > > Generated by: scripts/coccinelle/misc/irqf_oneshot.cocci > > CC: J?r?me Pouiller > Reported-by: kernel test robot > Signed-off-by: kernel test robot > --- > > url: https://github.com/0day-ci/linux/commits/Jerome-Pouiller/wfx-get-out-from-the-staging-area/20210315-212855 > base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git b828324bba8f575fde487a91fec07303789dda8a > > bus_sdio.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > --- a/drivers/net/wireless/silabs/wfx/bus_sdio.c > +++ b/drivers/net/wireless/silabs/wfx/bus_sdio.c > @@ -132,7 +132,8 @@ static int wfx_sdio_irq_subscribe(void * > flags = IRQF_TRIGGER_HIGH; > flags |= IRQF_ONESHOT; > return devm_request_threaded_irq(&bus->func->dev, bus->of_irq, NULL, > - wfx_sdio_irq_handler_ext, flags, > + wfx_sdio_irq_handler_ext, > + flags | IRQF_ONESHOT, > "wfx", bus); > } > > Obviously, "flags" always contains IRQF_ONESHOT. So, it is a false positive. -- J?r?me Pouiller From krzysztof.kozlowski at canonical.com Tue Mar 16 07:56:25 2021 From: krzysztof.kozlowski at canonical.com (Krzysztof Kozlowski) Date: Tue, 16 Mar 2021 08:56:25 +0100 Subject: [PATCH RESEND] media: atomisp: do not select COMMON_CLK to fix builds Message-ID: <20210316075625.10382-1-krzysztof.kozlowski@canonical.com> From: Krzysztof Kozlowski COMMON_CLK is a user-selectable option with its own dependencies. The most important dependency is !HAVE_LEGACY_CLK. User-selectable drivers should not select COMMON_CLK because they will create a dependency cycle and build failures. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Stephen Boyd --- drivers/staging/media/atomisp/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/Kconfig b/drivers/staging/media/atomisp/Kconfig index 37577bb72998..742edb261d85 100644 --- a/drivers/staging/media/atomisp/Kconfig +++ b/drivers/staging/media/atomisp/Kconfig @@ -2,9 +2,9 @@ menuconfig INTEL_ATOMISP bool "Enable support to Intel Atom ISP camera drivers" depends on X86 && EFI && PCI && ACPI + depends on COMMON_CLK select IOSF_MBI select MEDIA_CONTROLLER - select COMMON_CLK help Enable support for the Intel ISP2 camera interfaces and MIPI sensor drivers. -- 2.25.1 From philip.li at intel.com Tue Mar 16 08:03:00 2021 From: philip.li at intel.com (Li, Philip) Date: Tue, 16 Mar 2021 08:03:00 +0000 Subject: [kbuild-all] Re: [PATCH] wfx: fix irqf_oneshot.cocci warnings In-Reply-To: <3096745.nmkoU2l6Xm@pc-42> References: <20210315132501.441681-25-Jerome.Pouiller@silabs.com> <20210315210920.GA43634@d108da9836c5> <3096745.nmkoU2l6Xm@pc-42> Message-ID: > Subject: [kbuild-all] Re: [PATCH] wfx: fix irqf_oneshot.cocci warnings > > Hello, > > On Monday 15 March 2021 22:09:20 CET kernel test robot wrote: > > > > From: kernel test robot > > > > drivers/net/wireless/silabs/wfx/bus_sdio.c:134:8-33: ERROR: Threaded IRQ with no primary handler requested without > IRQF_ONESHOT > > > > Since commit 1c6c69525b40 ("genirq: Reject bogus threaded irq requests") > > threaded IRQs without a primary handler need to be requested with > > IRQF_ONESHOT, otherwise the request will fail. > > > > So pass the IRQF_ONESHOT flag in this case. > > > > Generated by: scripts/coccinelle/misc/irqf_oneshot.cocci > > > > CC: J?r?me Pouiller > > Reported-by: kernel test robot > > Signed-off-by: kernel test robot > > --- > > > > url: https://github.com/0day-ci/linux/commits/Jerome-Pouiller/wfx-get-out-from-the-staging-area/20210315-212855 > > base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git b828324bba8f575fde487a91fec07303789dda8a > > > > bus_sdio.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > --- a/drivers/net/wireless/silabs/wfx/bus_sdio.c > > +++ b/drivers/net/wireless/silabs/wfx/bus_sdio.c > > @@ -132,7 +132,8 @@ static int wfx_sdio_irq_subscribe(void * > > flags = IRQF_TRIGGER_HIGH; > > flags |= IRQF_ONESHOT; > > return devm_request_threaded_irq(&bus->func->dev, bus->of_irq, NULL, > > - wfx_sdio_irq_handler_ext, flags, > > + wfx_sdio_irq_handler_ext, > > + flags | IRQF_ONESHOT, > > "wfx", bus); > > } > > > > > > Obviously, "flags" always contains IRQF_ONESHOT. So, it is a false positive. Thanks for the feedback. Sorry about this false positive, this had been disabled for auto report now. > > > -- > J?r?me Pouiller > > _______________________________________________ > kbuild-all mailing list -- kbuild-all at lists.01.org > To unsubscribe send an email to kbuild-all-leave at lists.01.org From dan.carpenter at oracle.com Tue Mar 16 08:21:46 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Tue, 16 Mar 2021 11:21:46 +0300 Subject: [PATCH 00/57] Staging: rtl8723bs: fix POINTER_LOCATION whitespaces In-Reply-To: <20210315170618.2566-1-marcocesati@gmail.com> References: <20210315170618.2566-1-marcocesati@gmail.com> Message-ID: <20210316082146.GQ2087@kadam> On Mon, Mar 15, 2021 at 06:05:21PM +0100, Marco Cesati wrote: > This set of patches fixes 522 checkpatch.pl errors of type > POINTER_LOCATION in the staging/rtl8723bs souce code. Every patch is > purely syntactical: it does not change the generated machine code. > Furthermore, every single patch leaves the source code fully compilable, > so that 'git bisect' will not be affected. Hopefully that part can be assumed. :P > > The checkpatch.pl script emits many errors and warnings for these > patches, however all of them are caused by the original code. They shall > be fixed in different patchsets. Yep. You maybe went a tad too aggressive in fixing the checkpatch warnings about parentheses... If you didn't introduce the warning, then you can just leave it as-is. Anyway, looks good. Reviewed-by: Dan Carpenter regards, dan carpenter From zhaoxiao at uniontech.com Tue Mar 16 09:59:22 2021 From: zhaoxiao at uniontech.com (zhaoxiao) Date: Tue, 16 Mar 2021 17:59:22 +0800 Subject: [PATCH] staging: rtl8192u: remove extra lines Message-ID: <20210316095922.21123-1-zhaoxiao@uniontech.com> Remove extra lines in the struct r8192_private_args. Signed-off-by: zhaoxiao --- drivers/staging/rtl8192u/r8192U_wx.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index 6ead461e3279..e9de7dc8f049 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -879,12 +879,10 @@ static iw_handler r8192_wx_handlers[] = { static const struct iw_priv_args r8192_private_args[] = { - { SIOCIWFIRSTPRIV + 0x0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc" }, - { SIOCIWFIRSTPRIV + 0x1, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan" @@ -897,7 +895,6 @@ static const struct iw_priv_args r8192_private_args[] = { { SIOCIWFIRSTPRIV + 0x3, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset" - } }; -- 2.20.1 From chiatatwah at camv.vn Tue Mar 16 10:21:50 2021 From: chiatatwah at camv.vn (Fred Grenville) Date: Tue, 16 Mar 2021 03:21:50 -0700 Subject: Reply Asap!! Message-ID: Good day How are you today, did you receive the email I sent you three days ago? For important discussion on ( Investment ) If not please reply me back so that I will resend it again. Please confirm if you did ( u.abdulghani at yahoo.com.co ). Best Regards, Mr. Fred Grenville From chiatatwah at camv.vn Tue Mar 16 10:21:51 2021 From: chiatatwah at camv.vn (Fred Grenville) Date: Tue, 16 Mar 2021 03:21:51 -0700 Subject: Reply Asap!! Message-ID: Good day How are you today, did you receive the email I sent you three days ago? For important discussion on ( Investment ) If not please reply me back so that I will resend it again. Please confirm if you did ( u.abdulghani at yahoo.com.co ). Best Regards, Mr. Fred Grenville From gregkh at linuxfoundation.org Tue Mar 16 10:23:11 2021 From: gregkh at linuxfoundation.org (gregkh at linuxfoundation.org) Date: Tue, 16 Mar 2021 11:23:11 +0100 Subject: [PATCH] MAINTAINERS: move the staging subsystem to lists.linux.dev Message-ID: <20210316102311.182375-1-gregkh@linuxfoundation.org> From: Greg Kroah-Hartman The drivers/staging/ tree has a new mailing list, linux-staging at lists.linux.dev, so move the MAINTAINER entry to point to it so that we get patches sent to the proper place. There was no need to specify a list for the hikey9xx driver, the tools pick up the "base" list for drivers/staging/* so remove that line to make the file simpler. Signed-off-by: Greg Kroah-Hartman --- MAINTAINERS | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index d7c25c0fc08a..9e876927c60d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8116,7 +8116,6 @@ F: drivers/crypto/hisilicon/sec2/sec_main.c HISILICON STAGING DRIVERS FOR HIKEY 960/970 M: Mauro Carvalho Chehab -L: devel at driverdev.osuosl.org S: Maintained F: drivers/staging/hikey9xx/ @@ -17040,7 +17039,7 @@ F: drivers/staging/vt665?/ STAGING SUBSYSTEM M: Greg Kroah-Hartman -L: devel at driverdev.osuosl.org +L: linux-staging at lists.linux.dev S: Supported T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git F: drivers/staging/ -- 2.30.2 From abbotti at mev.co.uk Tue Mar 16 10:30:43 2021 From: abbotti at mev.co.uk (Ian Abbott) Date: Tue, 16 Mar 2021 10:30:43 +0000 Subject: [PATCH v2] staging: comedi: cb_pcidas: fix request_irq() warn In-Reply-To: <20210315195914.4801-1-ztong0001@gmail.com> References: <393f3925-9dbf-72e5-4d9b-2e213a6a71cb@mev.co.uk> <20210315195914.4801-1-ztong0001@gmail.com> Message-ID: On 15/03/2021 19:59, Tong Zhang wrote: > request_irq() wont accept a name which contains slash so we need to > repalce it with something else -- otherwise it will trigger a warning > and the entry in /proc/irq/ will not be created > since the .name might be used by userspace and we don't want to break > userspace, so we are changing the parameters passed to request_irq() > > [ 1.630764] name 'pci-das1602/16' > [ 1.630950] WARNING: CPU: 0 PID: 181 at fs/proc/generic.c:180 __xlate_proc_name+0x93/0xb0 > [ 1.634009] RIP: 0010:__xlate_proc_name+0x93/0xb0 > [ 1.639441] Call Trace: > [ 1.639976] proc_mkdir+0x18/0x20 > [ 1.641946] request_threaded_irq+0xfe/0x160 > [ 1.642186] cb_pcidas_auto_attach+0xf4/0x610 [cb_pcidas] > > Suggested-by: Ian Abbott > Signed-off-by: Tong Zhang > --- > v2: revert changes to .name field so that we dont break userspace > > drivers/staging/comedi/drivers/cb_pcidas.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c > index d740c4782775..2f20bd56ec6c 100644 > --- a/drivers/staging/comedi/drivers/cb_pcidas.c > +++ b/drivers/staging/comedi/drivers/cb_pcidas.c > @@ -1281,7 +1281,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, > devpriv->amcc + AMCC_OP_REG_INTCSR); > > ret = request_irq(pcidev->irq, cb_pcidas_interrupt, IRQF_SHARED, > - dev->board_name, dev); > + "cb_pcidas", dev); > if (ret) { > dev_dbg(dev->class_dev, "unable to allocate irq %d\n", > pcidev->irq); > Looks good. Reviewed-by: Ian Abbott -- -=( Ian Abbott || MEV Ltd. is a company )=- -=( registered in England & Wales. Regd. number: 02862268. )=- -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=- -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=- From abbotti at mev.co.uk Tue Mar 16 10:31:29 2021 From: abbotti at mev.co.uk (Ian Abbott) Date: Tue, 16 Mar 2021 10:31:29 +0000 Subject: [PATCH v2] staging: comedi: cb_pcidas64: fix request_irq() warn In-Reply-To: <20210315195814.4692-1-ztong0001@gmail.com> References: <858341a6-c105-1440-aa4d-ea0217f2ec89@mev.co.uk> <20210315195814.4692-1-ztong0001@gmail.com> Message-ID: On 15/03/2021 19:58, Tong Zhang wrote: > request_irq() wont accept a name which contains slash so we need to > repalce it with something else -- otherwise it will trigger a warning > and the entry in /proc/irq/ will not be created > since the .name might be used by userspace and we don't want to break > userspace, so we are changing the parameters passed to request_irq() > > [ 1.565966] name 'pci-das6402/16' > [ 1.566149] WARNING: CPU: 0 PID: 184 at fs/proc/generic.c:180 __xlate_proc_name+0x93/0xb0 > [ 1.568923] RIP: 0010:__xlate_proc_name+0x93/0xb0 > [ 1.574200] Call Trace: > [ 1.574722] proc_mkdir+0x18/0x20 > [ 1.576629] request_threaded_irq+0xfe/0x160 > [ 1.576859] auto_attach+0x60a/0xc40 [cb_pcidas64] > > Suggested-by: Ian Abbott > Signed-off-by: Tong Zhang > --- > v2: revert changes to .name field so that we dont break userspace > > drivers/staging/comedi/drivers/cb_pcidas64.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c > index fa987bb0e7cd..6d3ba399a7f0 100644 > --- a/drivers/staging/comedi/drivers/cb_pcidas64.c > +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c > @@ -4035,7 +4035,7 @@ static int auto_attach(struct comedi_device *dev, > init_stc_registers(dev); > > retval = request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED, > - dev->board_name, dev); > + "cb_pcidas64", dev); > if (retval) { > dev_dbg(dev->class_dev, "unable to allocate irq %u\n", > pcidev->irq); > Looks good. Reviewed-by: Ian Abbott -- -=( Ian Abbott || MEV Ltd. is a company )=- -=( registered in England & Wales. Regd. number: 02862268. )=- -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=- -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=- From abbotti at mev.co.uk Tue Mar 16 10:37:47 2021 From: abbotti at mev.co.uk (Ian Abbott) Date: Tue, 16 Mar 2021 10:37:47 +0000 Subject: [PATCH] staging: comedi: replace slash in name In-Reply-To: References: <20210314035757.2740146-1-ztong0001@gmail.com> <5d7a5e1c-35ab-58cb-ebcd-da5b280c802e@mev.co.uk> <858341a6-c105-1440-aa4d-ea0217f2ec89@mev.co.uk> Message-ID: <92b7c57b-b645-9965-8157-4ca76a803cba@mev.co.uk> On 15/03/2021 20:00, Tong Zhang wrote: > Thanks Ian, > I have submitted a v2 patch based on your suggestions. > Thanks, > - Tong Thanks. I think the only other Comedi driver with the same problem is "drivers/staging/comedi/drivers/das800.c". It passes dev->board_name as the name argument of request_irq(), but that is "cio-das802/16" for one of the boards supported by the driver. > On Mon, Mar 15, 2021 at 6:48 AM Ian Abbott wrote: >> >> On 15/03/2021 10:44, Ian Abbott wrote: >>> On 14/03/2021 03:57, Tong Zhang wrote: >>>> request_irq() wont accept a name which contains slash so we need to >>>> repalce it with something else -- otherwise it will trigger a warning >>>> and the entry in /proc/irq/ will not be created >>>> >>>> [ 1.565966] name 'pci-das6402/16' >>>> [ 1.566149] WARNING: CPU: 0 PID: 184 at fs/proc/generic.c:180 __xlate_proc_name+0x93/0xb0 >>>> [ 1.568923] RIP: 0010:__xlate_proc_name+0x93/0xb0 >>>> [ 1.574200] Call Trace: >>>> [ 1.574722] proc_mkdir+0x18/0x20 >>>> [ 1.576629] request_threaded_irq+0xfe/0x160 >>>> [ 1.576859] auto_attach+0x60a/0xc40 [cb_pcidas64] >>>> >>>> Signed-off-by: Tong Zhang >> [snip] >>> Userspace applications can use these strings to determine the board >>> type, so changing the strings would break those applications. >>> >>> I suggest passing the comedi driver name "cb_pcidas" to request_irq() >>> for now. >> >> Oops, I meant "cb_pcidas64". But you could reach that via >> dev->driver->driver_name if you want (where dev is the struct >> comedi_device * parameter). -- -=( Ian Abbott || MEV Ltd. is a company )=- -=( registered in England & Wales. Regd. number: 02862268. )=- -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=- -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=- From gregkh at linuxfoundation.org Tue Mar 16 11:19:06 2021 From: gregkh at linuxfoundation.org (gregkh) Date: Tue, 16 Mar 2021 12:19:06 +0100 Subject: [PATCH v2] staging: rtl8192u: remove extra lines In-Reply-To: <1263213049.277443.1615888997726.JavaMail.xmail@bj-wm-cp-10> References: <20210316024410.24609-1-zhaoxiao@uniontech.com> <20210316064756.GQ21246@kadam> <1263213049.277443.1615888997726.JavaMail.xmail@bj-wm-cp-10> Message-ID: On Tue, Mar 16, 2021 at 06:03:17PM +0800, ?? wrote: > This email message is intended only for the use of the individual or entity who > /which is the intended recipient and may contain information that is privileged > or confidential. If you are not the intended recipient, you are hereby notified > that any use, dissemination, distribution or copying of, or taking any action > in reliance on, this e-mail is strictly prohibited. If you have received this > email in error, please notify UnionTech Software Technology immediately by > replying to this e-mail and immediately delete and discard all copies of the > e-mail and the attachment thereto (if any). Thank you. This text is not compatible with Linux development sorry, email is now deleted. From gregkh at linuxfoundation.org Tue Mar 16 11:20:21 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 16 Mar 2021 12:20:21 +0100 Subject: [PATCH] staging: rtl8192u: remove extra lines In-Reply-To: <20210316095922.21123-1-zhaoxiao@uniontech.com> References: <20210316095922.21123-1-zhaoxiao@uniontech.com> Message-ID: On Tue, Mar 16, 2021 at 05:59:22PM +0800, zhaoxiao wrote: > Remove extra lines in the struct r8192_private_args. > > Signed-off-by: zhaoxiao > --- > drivers/staging/rtl8192u/r8192U_wx.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c > index 6ead461e3279..e9de7dc8f049 100644 > --- a/drivers/staging/rtl8192u/r8192U_wx.c > +++ b/drivers/staging/rtl8192u/r8192U_wx.c > @@ -879,12 +879,10 @@ static iw_handler r8192_wx_handlers[] = { > > > static const struct iw_priv_args r8192_private_args[] = { > - > { > SIOCIWFIRSTPRIV + 0x0, > IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc" > }, > - > { > SIOCIWFIRSTPRIV + 0x1, > IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan" > @@ -897,7 +895,6 @@ static const struct iw_priv_args r8192_private_args[] = { > { > SIOCIWFIRSTPRIV + 0x3, > IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset" > - > } > > }; > -- > 2.20.1 Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - You did not specify a description of why the patch is needed, or possibly, any description at all, in the email body. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what is needed in order to properly describe the change. - You did not write a descriptive Subject: for the patch, allowing Greg, and everyone else, to know what this patch is all about. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what a proper Subject: line should look like. - This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what needs to be done here to properly describe this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot From gregkh at linuxfoundation.org Tue Mar 16 11:26:02 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 16 Mar 2021 12:26:02 +0100 Subject: [PATCH v2] staging:rtl8723bs:core:rtw_wlan_util:fixed indentation coding style issue In-Reply-To: <20210314162855.GA2002@shreya-VirtualBox> References: <20210314162855.GA2002@shreya-VirtualBox> Message-ID: On Sun, Mar 14, 2021 at 09:58:55PM +0530, Shreya wrote: > Fixed the indentation of the else part of the conditional statement. > > Signed-off-by: Shreya > --- > v1 -> v2: > Changed name in signed-off-by to match name in From No, change it the other way around, you had your "real" name in the signed-off-by line, fix your email client to also have that :) Please try this again with a v3 patch. thanks, greg k-h From bingbu.cao at linux.intel.com Tue Mar 16 11:27:56 2021 From: bingbu.cao at linux.intel.com (Bingbu Cao) Date: Tue, 16 Mar 2021 19:27:56 +0800 Subject: [PATCH v2 1/2] media: staging/intel-ipu3: Fix memory leak in imu_fmt In-Reply-To: <20210315123406.1523607-1-ribalda@chromium.org> References: <20210315123406.1523607-1-ribalda@chromium.org> Message-ID: <34c90095-bcbf-5530-786a-e709cc493fa9@linux.intel.com> Hi, Ricardo Thanks for your patch. It looks fine for me, do you mind squash 2 patchsets into 1 commit? On 3/15/21 8:34 PM, Ricardo Ribalda wrote: > We are losing the reference to an allocated memory if try. Change the > order of the check to avoid that. > > Cc: stable at vger.kernel.org > Fixes: 6d5f26f2e045 ("media: staging/intel-ipu3-v4l: reduce kernel stack usage") > Signed-off-by: Ricardo Ribalda > --- > drivers/staging/media/ipu3/ipu3-v4l2.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c > index 60aa02eb7d2a..35a74d99322f 100644 > --- a/drivers/staging/media/ipu3/ipu3-v4l2.c > +++ b/drivers/staging/media/ipu3/ipu3-v4l2.c > @@ -693,6 +693,13 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, > if (inode == IMGU_NODE_STAT_3A || inode == IMGU_NODE_PARAMS) > continue; > > + /* CSS expects some format on OUT queue */ > + if (i != IPU3_CSS_QUEUE_OUT && > + !imgu_pipe->nodes[inode].enabled) { > + fmts[i] = NULL; > + continue; > + } > + > if (try) { > fmts[i] = kmemdup(&imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp, > sizeof(struct v4l2_pix_format_mplane), > @@ -705,10 +712,6 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, > fmts[i] = &imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp; > } > > - /* CSS expects some format on OUT queue */ > - if (i != IPU3_CSS_QUEUE_OUT && > - !imgu_pipe->nodes[inode].enabled) > - fmts[i] = NULL; > } > > if (!try) { > -- Best regards, Bingbu Cao From gregkh at linuxfoundation.org Tue Mar 16 11:37:39 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 16 Mar 2021 12:37:39 +0100 Subject: [PATCH] staging: rtl8192e: remove extra space in rtl819x_BAProc.c In-Reply-To: <20210315103320.18536-1-penghaob@uniontech.com> References: <20210315103320.18536-1-penghaob@uniontech.com> Message-ID: On Mon, Mar 15, 2021 at 06:33:20PM +0800, Hao Peng wrote: > Remove extra spaces in rtl819x_BAProc.c. That says what you did, but not _why_ you are doing this. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what is needed in order to properly describe the change. thanks, greg k-h From gregkh at linuxfoundation.org Tue Mar 16 11:37:50 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 16 Mar 2021 12:37:50 +0100 Subject: [PATCH] staging: rtl8192e: remove extra lines in rtl819x_BAProc.c In-Reply-To: <20210315110418.25117-1-penghaob@uniontech.com> References: <20210315110418.25117-1-penghaob@uniontech.com> Message-ID: On Mon, Mar 15, 2021 at 07:04:18PM +0800, Hao Peng wrote: > Remove extra lines in rtl819x_BAProc.c. > > Signed-off-by: Hao Peng Same issue here, please fix up the changelog text. From gregkh at linuxfoundation.org Tue Mar 16 11:38:05 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 16 Mar 2021 12:38:05 +0100 Subject: [PATCH] staging: rts5208: add empty line in general.c In-Reply-To: <20210315111220.27090-1-penghaob@uniontech.com> References: <20210315111220.27090-1-penghaob@uniontech.com> Message-ID: On Mon, Mar 15, 2021 at 07:12:20PM +0800, Hao Peng wrote: > Add one empty line upon return for easy reading. Why? Is this really needed? From gregkh at linuxfoundation.org Tue Mar 16 11:39:19 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 16 Mar 2021 12:39:19 +0100 Subject: [PATCH 05/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_PM In-Reply-To: <77ea39e63246fa4756afcf2bdea573f43fefc74c.1615801721.git.fabioaiuto83@gmail.com> References: <77ea39e63246fa4756afcf2bdea573f43fefc74c.1615801721.git.fabioaiuto83@gmail.com> Message-ID: On Mon, Mar 15, 2021 at 11:15:02AM +0100, Fabio Aiuto wrote: > remove conditional code blocks checked by unused CONFIG_PM > > cleaning required in TODO file: > > find and remove code blocks guarded by never set CONFIG_FOO defines > > Signed-off-by: Fabio Aiuto > --- > drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 8 -------- > 1 file changed, 8 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c > index 2ff71d001c07..5748e1c1a25c 100644 > --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c > +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c > @@ -3198,14 +3198,6 @@ static void rtw_cfg80211_preinit_wiphy(struct adapter *padapter, struct wiphy *w > wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; > wiphy->flags |= WIPHY_FLAG_OFFCHAN_TX | WIPHY_FLAG_HAVE_AP_SME; > > -#if defined(CONFIG_PM) > - wiphy->max_sched_scan_reqs = 1; > -#endif > - > -#if defined(CONFIG_PM) > - wiphy->wowlan = &wowlan_stub; > -#endif How this is "unused"? This is a real config option, did you just change the logic here? thanks, greg k-h From shreya.ajithchb at gmail.com Tue Mar 16 11:54:58 2021 From: shreya.ajithchb at gmail.com (Shreya AJith) Date: Tue, 16 Mar 2021 17:24:58 +0530 Subject: [PATCH v3] staging:rtl8723bs:core:rtw_wlan_util:fixed indentation coding style issue Message-ID: <20210316115458.GA2302@shreya-VirtualBox> Fixed the indentation of the else part of the conditional statement. Signed-off-by: Shreya Ajith --- v1-> v2: Changed name in signed-off-by to match name in From. v2-> v3: Reversed the change and made change in From instead. drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index 975f2830e29e..4b5afaeac916 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -1760,7 +1760,7 @@ void update_wireless_mode(struct adapter *padapter) if (pmlmeext->cur_wireless_mode & WIRELESS_11B) update_mgnt_tx_rate(padapter, IEEE80211_CCK_RATE_1MB); - else + else update_mgnt_tx_rate(padapter, IEEE80211_OFDM_RATE_6MB); } -- 2.25.1 From maqianga at uniontech.com Tue Mar 16 12:05:00 2021 From: maqianga at uniontech.com (Qiang Ma) Date: Tue, 16 Mar 2021 20:05:00 +0800 Subject: [PATCH] staging: rtl8723bs/core: add spaces between operators Message-ID: <20210316120500.351-1-maqianga@uniontech.com> Add spaces between operators for a better readability in function 'rtw_seccalctkipmic'. Signed-off-by: Qiang Ma --- drivers/staging/rtl8723bs/core/rtw_security.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c index 3e576cbe4712..469e4d563da1 100644 --- a/drivers/staging/rtl8723bs/core/rtw_security.c +++ b/drivers/staging/rtl8723bs/core/rtw_security.c @@ -413,15 +413,15 @@ void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_cod priority[0] = pri; /* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */ - if (header[1]&1) { /* ToDS == 1 */ + if (header[1] & 1) { /* ToDS == 1 */ rtw_secmicappend(&micdata, &header[16], 6); /* DA */ - if (header[1]&2) /* From Ds == 1 */ + if (header[1] & 2) /* From Ds == 1 */ rtw_secmicappend(&micdata, &header[24], 6); else rtw_secmicappend(&micdata, &header[10], 6); } else { /* ToDS == 0 */ rtw_secmicappend(&micdata, &header[4], 6); /* DA */ - if (header[1]&2) /* From Ds == 1 */ + if (header[1] & 2) /* From Ds == 1 */ rtw_secmicappend(&micdata, &header[16], 6); else rtw_secmicappend(&micdata, &header[10], 6); -- 2.20.1 From gregkh at linuxfoundation.org Tue Mar 16 11:43:15 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 16 Mar 2021 12:43:15 +0100 Subject: [PATCH 00/15] staging: rtl8723bs: remove unused code blocks In-Reply-To: References: Message-ID: On Mon, Mar 15, 2021 at 11:13:49AM +0100, Fabio Aiuto wrote: > Remove unused code blocks as required in TODO file > > Fabio Aiuto (15): > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_AUTO_AP_MODE > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_HW_PWRP_DETECTION > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_QOS_OPTIMIZATION > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_AP_WOWLAN > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_PM > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_SIGNAL_DISPLAY_DBM > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_BACKGROUND_NOISE_MONITOR > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_SKIP_SIGNAL_SCALE_MAPPING > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_GPIO_API > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_EXT_CLK > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_CHECK_BT_HANG > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_SDIO_TX_TASKLET > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_SW_CHANNEL_PLAN > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_C2H_PACKET_EN > staging: rtl8723bs: remove unused code blocks conditioned by never set > CONFIG_ODM_ADAPTIVITY Not all of these would apply, please rebase and resend the remaining ones. thanks, greg k-h From fabioaiuto83 at gmail.com Tue Mar 16 13:36:39 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 14:36:39 +0100 Subject: [PATCH 05/15] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_PM In-Reply-To: References: <77ea39e63246fa4756afcf2bdea573f43fefc74c.1615801721.git.fabioaiuto83@gmail.com> Message-ID: <20210316133638.GA1465@agape.jhs> On Tue, Mar 16, 2021 at 12:39:19PM +0100, Greg KH wrote: > On Mon, Mar 15, 2021 at 11:15:02AM +0100, Fabio Aiuto wrote: > > remove conditional code blocks checked by unused CONFIG_PM > > > > cleaning required in TODO file: > > > > find and remove code blocks guarded by never set CONFIG_FOO defines > > > > Signed-off-by: Fabio Aiuto > > --- > > drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 8 -------- > > 1 file changed, 8 deletions(-) > > > > diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c > > index 2ff71d001c07..5748e1c1a25c 100644 > > --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c > > +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c > > @@ -3198,14 +3198,6 @@ static void rtw_cfg80211_preinit_wiphy(struct adapter *padapter, struct wiphy *w > > wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; > > wiphy->flags |= WIPHY_FLAG_OFFCHAN_TX | WIPHY_FLAG_HAVE_AP_SME; > > > > -#if defined(CONFIG_PM) > > - wiphy->max_sched_scan_reqs = 1; > > -#endif > > - > > -#if defined(CONFIG_PM) > > - wiphy->wowlan = &wowlan_stub; > > -#endif > > How this is "unused"? This is a real config option, did you just change > the logic here? > > thanks, > > greg k-h Hi Greg, ignore this patch. I missed that definition of PM config option. I dropped it off my own local repo. Thank you, fabio From fabioaiuto83 at gmail.com Tue Mar 16 14:04:11 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 15:04:11 +0100 Subject: [PATCH v2] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_AP_WOWLAN Message-ID: <20210316140359.GA2858@agape.jhs> remove conditional code blocks checked by unused CONFIG_AP_WOWLAN cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Changes in v2: rebase of conflicting code with public tree Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 35 -- .../staging/rtl8723bs/core/rtw_wlan_util.c | 31 -- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 339 ------------------ .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 33 -- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 105 ------ drivers/staging/rtl8723bs/hal/sdio_ops.c | 35 -- .../rtl8723bs/include/drv_types_sdio.h | 5 - .../staging/rtl8723bs/include/hal_com_h2c.h | 30 -- drivers/staging/rtl8723bs/include/hal_intf.h | 3 - .../staging/rtl8723bs/include/osdep_service.h | 9 +- .../staging/rtl8723bs/include/rtl8723b_cmd.h | 6 - .../staging/rtl8723bs/include/rtl8723b_hal.h | 4 - drivers/staging/rtl8723bs/include/rtw_mp.h | 3 - drivers/staging/rtl8723bs/include/sdio_ops.h | 7 - .../staging/rtl8723bs/os_dep/ioctl_linux.c | 4 - drivers/staging/rtl8723bs/os_dep/os_intfs.c | 134 ------- 16 files changed, 1 insertion(+), 782 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index 2e6c522b74e3..b942cf49cd27 100644 --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c @@ -350,17 +350,8 @@ static u8 PS_RDY_CHECK(struct adapter *padapter) struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); -#ifdef CONFIG_AP_WOWLAN - if (pwrpriv->bInSuspend && pwrpriv->wowlan_mode) - return true; - else if (pwrpriv->bInSuspend && pwrpriv->wowlan_ap_mode) - return true; - else if (pwrpriv->bInSuspend) - return false; -#else if (pwrpriv->bInSuspend) return false; -#endif curr_time = jiffies; @@ -391,9 +382,6 @@ static u8 PS_RDY_CHECK(struct adapter *padapter) void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode, const char *msg) { struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); -#ifdef CONFIG_AP_WOWLAN - struct debug_priv *pdbgpriv = &padapter->dvobj->drv_dbg; -#endif RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_notice_, ("%s: PowerMode =%d Smart_PS =%d\n", @@ -422,29 +410,6 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a pwrpriv->pwr_mode = ps_mode; rtw_set_rpwm(padapter, PS_STATE_S4); -#ifdef CONFIG_AP_WOWLAN - if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode) { - unsigned long start_time; - u32 delay_ms; - u8 val8; - delay_ms = 20; - start_time = jiffies; - do { - rtw_hal_get_hwreg(padapter, HW_VAR_SYS_CLKR, &val8); - if (!(val8 & BIT(4))) { /* 0x08 bit4 = 1 --> in 32k, bit4 = 0 --> leave 32k */ - pwrpriv->cpwm = PS_STATE_S4; - break; - } - if (jiffies_to_msecs(jiffies - start_time) > delay_ms) { - DBG_871X("%s: Wait for FW 32K leave more than %u ms!!!\n", - __func__, delay_ms); - pdbgpriv->dbg_wow_leave_ps_fail_cnt++; - break; - } - msleep(1); - } while (1); - } -#endif rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&ps_mode)); pwrpriv->bFwCurrentInPSMode = false; diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index 355e43c4cf9a..d04514d36b49 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -10,10 +10,6 @@ #include #include -#ifdef CONFIG_AP_WOWLAN -#include -#endif - static unsigned char ARTHEROS_OUI1[] = {0x00, 0x03, 0x7f}; static unsigned char ARTHEROS_OUI2[] = {0x00, 0x13, 0x74}; @@ -2113,30 +2109,3 @@ int rtw_config_gpio(struct net_device *netdev, int gpio_num, bool isOutput) EXPORT_SYMBOL(rtw_config_gpio); #endif -#ifdef CONFIG_AP_WOWLAN -void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip) -{ - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct in_device *my_ip_ptr = padapter->pnetdev->ip_ptr; - u8 ipaddress[4]; - - if ((pmlmeinfo->state & WIFI_FW_LINKING_STATE) || - pmlmeinfo->state & WIFI_FW_AP_STATE) { - if (my_ip_ptr) { - struct in_ifaddr *my_ifa_list = my_ip_ptr->ifa_list; - - if (my_ifa_list) { - ipaddress[0] = my_ifa_list->ifa_address & 0xFF; - ipaddress[1] = (my_ifa_list->ifa_address >> 8) & 0xFF; - ipaddress[2] = (my_ifa_list->ifa_address >> 16) & 0xFF; - ipaddress[3] = my_ifa_list->ifa_address >> 24; - DBG_871X("%s: %d.%d.%d.%d ==========\n", __func__, - ipaddress[0], ipaddress[1], ipaddress[2], ipaddress[3]); - memcpy(pcurrentip, ipaddress, 4); - } - } - } -} -#endif - diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index 61fd643c244f..11e7a7121f30 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -312,119 +312,6 @@ static void ConstructNullFunctionData( *pLength = pktlen; } -#ifdef CONFIG_AP_WOWLAN -static void ConstructProbeRsp(struct adapter *padapter, u8 *pframe, u32 *pLength, u8 *StaAddr, bool bHideSSID) -{ - struct ieee80211_hdr *pwlanhdr; - u16 *fctrl; - u8 *mac, *bssid; - u32 pktlen; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); - u8 *pwps_ie; - uint wps_ielen; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - - /* DBG_871X("%s\n", __func__); */ - - pwlanhdr = (struct ieee80211_hdr *)pframe; - - mac = myid(&(padapter->eeprompriv)); - bssid = cur_network->MacAddress; - - fctrl = &(pwlanhdr->frame_control); - *(fctrl) = 0; - memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); - memcpy(pwlanhdr->addr2, mac, ETH_ALEN); - memcpy(pwlanhdr->addr3, bssid, ETH_ALEN); - - DBG_871X("%s FW Mac Addr:%pM\n", __func__, MAC_ARG(mac)); - DBG_871X("%s FW IP Addr:%pI4\n", __func__, IP_ARG(StaAddr)); - - SetSeqNum(pwlanhdr, 0); - SetFrameSubType(fctrl, WIFI_PROBERSP); - - pktlen = sizeof(struct ieee80211_hdr_3addr); - pframe += pktlen; - - if (cur_network->IELength > MAX_IE_SZ) - return; - - pwps_ie = rtw_get_wps_ie(cur_network->IEs+_FIXED_IE_LENGTH_, - cur_network->IELength-_FIXED_IE_LENGTH_, NULL, &wps_ielen); - - /* inerset & update wps_probe_resp_ie */ - if (pmlmepriv->wps_probe_resp_ie && pwps_ie && (wps_ielen > 0)) { - uint wps_offset, remainder_ielen; - u8 *premainder_ie; - - wps_offset = (uint)(pwps_ie - cur_network->IEs); - - premainder_ie = pwps_ie + wps_ielen; - - remainder_ielen = cur_network->IELength - wps_offset - wps_ielen; - - memcpy(pframe, cur_network->IEs, wps_offset); - pframe += wps_offset; - pktlen += wps_offset; - - wps_ielen = (uint)pmlmepriv->wps_probe_resp_ie[1];/* to get ie data len */ - if ((wps_offset+wps_ielen+2) <= MAX_IE_SZ) { - memcpy(pframe, pmlmepriv->wps_probe_resp_ie, wps_ielen+2); - pframe += wps_ielen+2; - pktlen += wps_ielen+2; - } - - if ((wps_offset+wps_ielen+2+remainder_ielen) <= MAX_IE_SZ) { - memcpy(pframe, premainder_ie, remainder_ielen); - pframe += remainder_ielen; - pktlen += remainder_ielen; - } - } else { - memcpy(pframe, cur_network->IEs, cur_network->IELength); - pframe += cur_network->IELength; - pktlen += cur_network->IELength; - } - - /* retrieve SSID IE from cur_network->Ssid */ - { - u8 *ssid_ie; - signed int ssid_ielen; - signed int ssid_ielen_diff; - u8 buf[MAX_IE_SZ]; - u8 *ies = pframe + sizeof(struct ieee80211_hdr_3addr); - - ssid_ie = rtw_get_ie(ies+_FIXED_IE_LENGTH_, WLAN_EID_SSID, &ssid_ielen, - (pframe-ies)-_FIXED_IE_LENGTH_); - - ssid_ielen_diff = cur_network->Ssid.SsidLength - ssid_ielen; - - if (ssid_ie && cur_network->Ssid.SsidLength) { - uint remainder_ielen; - u8 *remainder_ie; - remainder_ie = ssid_ie+2; - remainder_ielen = (pframe-remainder_ie); - - if (remainder_ielen > MAX_IE_SZ) { - DBG_871X_LEVEL(_drv_warning_, FUNC_ADPT_FMT" remainder_ielen > MAX_IE_SZ\n", FUNC_ADPT_ARG(padapter)); - remainder_ielen = MAX_IE_SZ; - } - - memcpy(buf, remainder_ie, remainder_ielen); - memcpy(remainder_ie+ssid_ielen_diff, buf, remainder_ielen); - *(ssid_ie+1) = cur_network->Ssid.SsidLength; - memcpy(ssid_ie+2, cur_network->Ssid.Ssid, cur_network->Ssid.SsidLength); - pframe += ssid_ielen_diff; - pktlen += ssid_ielen_diff; - } - } - - *pLength = pktlen; - -} -#endif /* CONFIG_AP_WOWLAN */ - /* * To check if reserved page content is destroyed by beacon because beacon * is too large. @@ -457,42 +344,6 @@ static void rtl8723b_set_FwAoacRsvdPage_cmd(struct adapter *padapter, struct RSV { } -#ifdef CONFIG_AP_WOWLAN -static void rtl8723b_set_ap_wow_rsvdpage_cmd( - struct adapter *padapter, struct RSVDPAGE_LOC *rsvdpageloc -) -{ - u8 header; - u8 rsvdparm[H2C_AOAC_RSVDPAGE_LOC_LEN] = {0}; - - header = rtw_read8(padapter, REG_BCNQ_BDNY); - - DBG_871X("%s: beacon: %d, probeRsp: %d, header:0x%02x\n", __func__, - rsvdpageloc->LocApOffloadBCN, - rsvdpageloc->LocProbeRsp, - header); - - SET_H2CCMD_AP_WOWLAN_RSVDPAGE_LOC_BCN(rsvdparm, - rsvdpageloc->LocApOffloadBCN + header); - - FillH2CCmd8723B(padapter, H2C_8723B_BCN_RSVDPAGE, - H2C_BCN_RSVDPAGE_LEN, rsvdparm); - - msleep(10); - - memset(&rsvdparm, 0, sizeof(rsvdparm)); - - SET_H2CCMD_AP_WOWLAN_RSVDPAGE_LOC_ProbeRsp( - rsvdparm, - rsvdpageloc->LocProbeRsp + header); - - FillH2CCmd8723B(padapter, H2C_8723B_PROBERSP_RSVDPAGE, - H2C_PROBERSP_RSVDPAGE_LEN, rsvdparm); - - msleep(10); -} -#endif /* CONFIG_AP_WOWLAN */ - void rtl8723b_set_FwMediaStatusRpt_cmd(struct adapter *padapter, u8 mstatus, u8 macid) { u8 u1H2CMediaStatusRptParm[H2C_MEDIA_STATUS_RPT_LEN] = {0}; @@ -698,64 +549,6 @@ void rtl8723b_set_FwPwrModeInIPS_cmd(struct adapter *padapter, u8 cmd_param) FillH2CCmd8723B(padapter, H2C_8723B_FWLPS_IN_IPS_, 1, &cmd_param); } -#ifdef CONFIG_AP_WOWLAN -static void rtl8723b_set_FwAPWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) -{ - u8 u1H2CAPWoWlanCtrlParm[H2C_WOWLAN_LEN] = {0}; - u8 gpionum = 0, gpio_dur = 0; - u8 gpio_high_active = 1; /* 0: low active, 1: high active */ - u8 gpio_pulse = bFuncEn; - - DBG_871X("%s(): bFuncEn =%d\n", __func__, bFuncEn); - - if (bFuncEn) - gpio_dur = 16; - else - gpio_dur = 0; - - SET_H2CCMD_AP_WOW_GPIO_CTRL_INDEX(u1H2CAPWoWlanCtrlParm, - gpionum); - SET_H2CCMD_AP_WOW_GPIO_CTRL_PLUS(u1H2CAPWoWlanCtrlParm, - gpio_pulse); - SET_H2CCMD_AP_WOW_GPIO_CTRL_HIGH_ACTIVE(u1H2CAPWoWlanCtrlParm, - gpio_high_active); - SET_H2CCMD_AP_WOW_GPIO_CTRL_EN(u1H2CAPWoWlanCtrlParm, - bFuncEn); - SET_H2CCMD_AP_WOW_GPIO_CTRL_DURATION(u1H2CAPWoWlanCtrlParm, - gpio_dur); - - FillH2CCmd8723B(padapter, H2C_8723B_AP_WOW_GPIO_CTRL, - H2C_AP_WOW_GPIO_CTRL_LEN, u1H2CAPWoWlanCtrlParm); -} - -static void rtl8723b_set_Fw_AP_Offload_Cmd(struct adapter *padapter, u8 bFuncEn) -{ - u8 u1H2CAPOffloadCtrlParm[H2C_WOWLAN_LEN] = {0}; - - DBG_871X("%s(): bFuncEn =%d\n", __func__, bFuncEn); - - SET_H2CCMD_AP_WOWLAN_EN(u1H2CAPOffloadCtrlParm, bFuncEn); - - FillH2CCmd8723B(padapter, H2C_8723B_AP_OFFLOAD, - H2C_AP_OFFLOAD_LEN, u1H2CAPOffloadCtrlParm); -} - -void rtl8723b_set_ap_wowlan_cmd(struct adapter *padapter, u8 enable) -{ - DBG_871X_LEVEL(_drv_always_, "+%s()+: enable =%d\n", __func__, enable); - if (enable) { - rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); - issue_beacon(padapter, 0); - } - - rtl8723b_set_FwAPWoWlanCtrl_Cmd(padapter, enable); - msleep(10); - rtl8723b_set_Fw_AP_Offload_Cmd(padapter, enable); - msleep(10); - DBG_871X_LEVEL(_drv_always_, "-%s()-\n", __func__); -} -#endif /* CONFIG_AP_WOWLAN */ - /* * Description: Fill the reserved packets that FW will use to RSVD page. * Now we just send 4 types packet to rsvd page. @@ -928,134 +721,9 @@ static void rtl8723b_set_FwRsvdPagePkt( rtw_free_xmitframe(pxmitpriv, pcmdframe); } -#ifdef CONFIG_AP_WOWLAN -/* - * Description: Fill the reserved packets that FW will use to RSVD page. - * Now we just send 2 types packet to rsvd page. (1)Beacon, (2)ProbeRsp. - * - * Input: bDLFinished - * - * false: At the first time we will send all the packets as a large packet to - * Hw, so we need to set the packet length to total length. - * - * true: At the second time, we should send the first packet (default:beacon) - * to Hw again and set the length in descriptor to the real beacon length. - */ -/* 2009.10.15 by tynli. */ -static void rtl8723b_set_AP_FwRsvdPagePkt( - struct adapter *padapter, bool bDLFinished -) -{ - struct hal_com_data *pHalData; - struct xmit_frame *pcmdframe; - struct pkt_attrib *pattrib; - struct xmit_priv *pxmitpriv; - struct mlme_ext_priv *pmlmeext; - struct mlme_ext_info *pmlmeinfo; - struct pwrctrl_priv *pwrctl; - u32 BeaconLength = 0, ProbeRspLength = 0; - u8 *ReservedPagePacket; - u8 TxDescLen = TXDESC_SIZE, TxDescOffset = TXDESC_OFFSET; - u8 TotalPageNum = 0, CurtPktPageNum = 0, RsvdPageNum = 0; - u8 currentip[4]; - u16 BufIndex, PageSize = 128; - u32 TotalPacketLen = 0, MaxRsvdPageBufSize = 0; - struct RSVDPAGE_LOC RsvdPageLoc; - - /* DBG_871X("%s---->\n", __func__); */ - DBG_8192C("+" FUNC_ADPT_FMT ": iface_type =%d\n", - FUNC_ADPT_ARG(padapter), get_iface_type(padapter)); - - pHalData = GET_HAL_DATA(padapter); - pxmitpriv = &padapter->xmitpriv; - pmlmeext = &padapter->mlmeextpriv; - pmlmeinfo = &pmlmeext->mlmext_info; - pwrctl = adapter_to_pwrctl(padapter); - - RsvdPageNum = BCNQ_PAGE_NUM_8723B + AP_WOWLAN_PAGE_NUM_8723B; - MaxRsvdPageBufSize = RsvdPageNum*PageSize; - - pcmdframe = rtw_alloc_cmdxmitframe(pxmitpriv); - if (!pcmdframe) { - DBG_871X("%s: alloc ReservedPagePacket fail!\n", __func__); - return; - } - - ReservedPagePacket = pcmdframe->buf_addr; - memset(&RsvdPageLoc, 0, sizeof(struct RSVDPAGE_LOC)); - - /* 3 (1) beacon */ - BufIndex = TxDescOffset; - ConstructBeacon(padapter, &ReservedPagePacket[BufIndex], &BeaconLength); - - /* When we count the first page size, we need to reserve description size for the RSVD */ - /* packet, it will be filled in front of the packet in TXPKTBUF. */ - CurtPktPageNum = (u8)PageNum_128(TxDescLen + BeaconLength); - /* If we don't add 1 more page, the WOWLAN function has a problem. Baron thinks it's a bug of firmware */ - if (CurtPktPageNum == 1) - CurtPktPageNum += 1; - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - /* 2 (4) probe response */ - RsvdPageLoc.LocProbeRsp = TotalPageNum; - - rtw_get_current_ip_address(padapter, currentip); - - ConstructProbeRsp( - padapter, - &ReservedPagePacket[BufIndex], - &ProbeRspLength, - currentip, - false); - rtl8723b_fill_fake_txdesc(padapter, - &ReservedPagePacket[BufIndex-TxDescLen], - ProbeRspLength, - false, false, false); - - DBG_871X("%s(): HW_VAR_SET_TX_CMD: PROBE RSP %p %d\n", - __func__, &ReservedPagePacket[BufIndex-TxDescLen], - (ProbeRspLength+TxDescLen)); - - CurtPktPageNum = (u8)PageNum_128(TxDescLen + ProbeRspLength); - - TotalPageNum += CurtPktPageNum; - - BufIndex += (CurtPktPageNum*PageSize); - - TotalPacketLen = BufIndex + ProbeRspLength; - - if (TotalPacketLen > MaxRsvdPageBufSize) { - DBG_871X("%s(): ERROR: The rsvd page size is not enough \ - !!TotalPacketLen %d, MaxRsvdPageBufSize %d\n", - __func__, TotalPacketLen, MaxRsvdPageBufSize); - goto error; - } else { - /* update attribute */ - pattrib = &pcmdframe->attrib; - update_mgntframe_attrib(padapter, pattrib); - pattrib->qsel = 0x10; - pattrib->pktlen = TotalPacketLen - TxDescOffset; - pattrib->last_txcmdsz = TotalPacketLen - TxDescOffset; - dump_mgntframe_and_wait(padapter, pcmdframe, 100); - } - - DBG_871X("%s: Set RSVD page location to Fw , TotalPacketLen(%d), TotalPageNum(%d)\n", __func__, TotalPacketLen, TotalPageNum); - rtl8723b_set_ap_wow_rsvdpage_cmd(padapter, &RsvdPageLoc); - - return; -error: - rtw_free_xmitframe(pxmitpriv, pcmdframe); -} -#endif /* CONFIG_AP_WOWLAN */ - void rtl8723b_download_rsvd_page(struct adapter *padapter, u8 mstatus) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -#ifdef CONFIG_AP_WOWLAN - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); -#endif struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); bool bcn_valid = false; @@ -1102,15 +770,8 @@ void rtl8723b_download_rsvd_page(struct adapter *padapter, u8 mstatus) DLBcnCount = 0; poll = 0; do { -#ifdef CONFIG_AP_WOWLAN - if (pwrpriv->wowlan_ap_mode) - rtl8723b_set_AP_FwRsvdPagePkt(padapter, 0); - else - rtl8723b_set_FwRsvdPagePkt(padapter, 0); -#else /* download rsvd page. */ rtl8723b_set_FwRsvdPagePkt(padapter, 0); -#endif DLBcnCount++; do { yield(); diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 9bcceb13ca2d..6f08af686f9d 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -527,39 +527,6 @@ void rtl8723b_InitializeFirmwareVars(struct adapter *padapter) /* pHalData->H2CStopInsertQueue = false; */ } -#ifdef CONFIG_AP_WOWLAN -/* */ - -/* */ -/* Description: Prepare some information to Fw for WoWLAN. */ -/* (1) Download wowlan Fw. */ -/* (2) Download RSVD page packets. */ -/* (3) Enable AP offload if needed. */ -/* */ -/* 2011.04.12 by tynli. */ -/* */ -void SetFwRelatedForWoWLAN8723b( - struct adapter *padapter, u8 bHostIsGoingtoSleep -) -{ - int status = _FAIL; - /* */ - /* 1. Before WoWLAN we need to re-download WoWLAN Fw. */ - /* */ - status = rtl8723b_FirmwareDownload(padapter, bHostIsGoingtoSleep); - if (status != _SUCCESS) { - DBG_871X("SetFwRelatedForWoWLAN8723b(): Re-Download Firmware failed!!\n"); - return; - } else { - DBG_871X("SetFwRelatedForWoWLAN8723b(): Re-Download Firmware Success !!\n"); - } - /* */ - /* 2. Re-Init the variables about Fw related setting. */ - /* */ - rtl8723b_InitializeFirmwareVars(padapter); -} -#endif /* CONFIG_AP_WOWLAN */ - static void rtl8723b_free_hal_data(struct adapter *padapter) { } diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index 5ceb3b635915..82b54131c9ec 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -1280,16 +1280,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) { u8 val8; -#ifdef CONFIG_AP_WOWLAN - struct wowlan_ioctl_param *poidparam; - struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); - int res; - u32 tmp; - u16 len = 0; - u8 trycnt = 100; - u32 himr = 0; -#endif - switch (variable) { case HW_VAR_SET_RPWM: /* rpwm value only use BIT0(clock bit) , BIT6(Ack bit), and BIT7(Toggle bit) */ @@ -1314,101 +1304,6 @@ static void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val) val8 = *val; break; -#ifdef CONFIG_AP_WOWLAN - case HW_VAR_AP_WOWLAN: - { - poidparam = (struct wowlan_ioctl_param *)val; - switch (poidparam->subcode) { - case WOWLAN_AP_ENABLE: - DBG_871X("%s, WOWLAN_AP_ENABLE\n", __func__); - /* 1. Download WOWLAN FW */ - DBG_871X_LEVEL(_drv_always_, "Re-download WoWlan FW!\n"); - SetFwRelatedForWoWLAN8723b(padapter, true); - - /* 2. RX DMA stop */ - DBG_871X_LEVEL(_drv_always_, "Pause DMA\n"); - rtw_write32(padapter, REG_RXPKT_NUM, - (rtw_read32(padapter, REG_RXPKT_NUM) | RW_RELEASE_EN)); - do { - if ((rtw_read32(padapter, REG_RXPKT_NUM) & RXDMA_IDLE)) { - DBG_871X_LEVEL(_drv_always_, "RX_DMA_IDLE is true\n"); - break; - } else { - /* If RX_DMA is not idle, receive one pkt from DMA */ - res = sdio_local_read(padapter, SDIO_REG_RX0_REQ_LEN, 4, (u8 *)&tmp); - len = le16_to_cpu(tmp); - - DBG_871X_LEVEL(_drv_always_, "RX len:%d\n", len); - if (len > 0) - res = RecvOnePkt(padapter, len); - else - DBG_871X_LEVEL(_drv_always_, "read length fail %d\n", len); - - DBG_871X_LEVEL(_drv_always_, "RecvOnePkt Result: %d\n", res); - } - } while (trycnt--); - - if (trycnt == 0) - DBG_871X_LEVEL(_drv_always_, "Stop RX DMA failed......\n"); - - /* 3. Clear IMR and ISR */ - DBG_871X_LEVEL(_drv_always_, "Clear IMR and ISR\n"); - tmp = 0; - sdio_local_write(padapter, SDIO_REG_HIMR_ON, 4, (u8 *)&tmp); - sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - sdio_local_read(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); - sdio_local_write(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); - - /* 4. Enable CPWM2 only */ - DBG_871X_LEVEL(_drv_always_, "Enable only CPWM2\n"); - sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - DBG_871X("DisableInterruptButCpwm28723BSdio(): Read SDIO_REG_HIMR: 0x%08x\n", tmp); - - himr = cpu_to_le32(SDIO_HIMR_DISABLED) | SDIO_HIMR_CPWM2_MSK; - sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&himr); - - sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); - DBG_871X("DisableInterruptButCpwm28723BSdio(): Read again SDIO_REG_HIMR: 0x%08x\n", tmp); - - /* 5. Set Enable WOWLAN H2C command. */ - DBG_871X_LEVEL(_drv_always_, "Set Enable AP WOWLan cmd\n"); - rtl8723b_set_ap_wowlan_cmd(padapter, 1); - /* 6. add some delay for H2C cmd ready */ - msleep(10); - - rtw_write8(padapter, REG_WOWLAN_WAKE_REASON, 0); - break; - case WOWLAN_AP_DISABLE: - DBG_871X("%s, WOWLAN_AP_DISABLE\n", __func__); - /* 1. Read wakeup reason */ - pwrctl->wowlan_wake_reason = - rtw_read8(padapter, REG_WOWLAN_WAKE_REASON); - - DBG_871X_LEVEL(_drv_always_, "wakeup_reason: 0x%02x\n", - pwrctl->wowlan_wake_reason); - - /* 2. Set Disable WOWLAN H2C command. */ - DBG_871X_LEVEL(_drv_always_, "Set Disable WOWLan cmd\n"); - rtl8723b_set_ap_wowlan_cmd(padapter, 0); - /* 6. add some delay for H2C cmd ready */ - msleep(2); - - DBG_871X_LEVEL(_drv_always_, "Release RXDMA\n"); - - rtw_write32(padapter, REG_RXPKT_NUM, - (rtw_read32(padapter, REG_RXPKT_NUM) & (~RW_RELEASE_EN))); - - SetFwRelatedForWoWLAN8723b(padapter, false); - - rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); - issue_beacon(padapter, 0); - break; - default: - break; - } -} - break; -#endif /* CONFIG_AP_WOWLAN */ case HW_VAR_DM_IN_LPS: rtl8723b_hal_dm_in_lps(padapter); break; diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c index 0efb23cac909..170a28f4b191 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_ops.c +++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c @@ -1112,39 +1112,4 @@ void HalQueryTxOQTBufferStatus8723BSdio(struct adapter *adapter) haldata->SdioTxOQTFreeSpace = SdioLocalCmd52Read1Byte(adapter, SDIO_REG_OQT_FREE_PG); } -#ifdef CONFIG_AP_WOWLAN -u8 RecvOnePkt(struct adapter *adapter, u32 size) -{ - struct recv_buf *recvbuf; - struct dvobj_priv *sddev; - struct sdio_func *func; - - u8 res = false; - - DBG_871X("+%s: size: %d+\n", __func__, size); - - if (!adapter) { - DBG_871X(KERN_ERR "%s: adapter is NULL!\n", __func__); - return false; - } - sddev = adapter_to_dvobj(adapter); - psdio_data = &sddev->intf_data; - func = psdio_data->func; - - if (size) { - sdio_claim_host(func); - recvbuf = sd_recv_rxfifo(adapter, size); - - if (recvbuf) { - sd_rxhandler(adapter, recvbuf); - res = true; - } else { - res = false; - } - sdio_release_host(func); - } - DBG_871X("-%s-\n", __func__); - return res; -} -#endif /* CONFIG_AP_WOWLAN */ diff --git a/drivers/staging/rtl8723bs/include/drv_types_sdio.h b/drivers/staging/rtl8723bs/include/drv_types_sdio.h index 83f5e912baa7..25b3c3a39ee4 100644 --- a/drivers/staging/rtl8723bs/include/drv_types_sdio.h +++ b/drivers/staging/rtl8723bs/include/drv_types_sdio.h @@ -11,11 +11,6 @@ #include #include -#ifdef CONFIG_AP_WOWLAN - #include - #include -#endif - struct sdio_data { u8 func_number; diff --git a/drivers/staging/rtl8723bs/include/hal_com_h2c.h b/drivers/staging/rtl8723bs/include/hal_com_h2c.h index 1e1982621e2c..dedbd0a1efb4 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_h2c.h +++ b/drivers/staging/rtl8723bs/include/hal_com_h2c.h @@ -120,28 +120,6 @@ enum h2c_cmd { #define SET_H2CCMD_DISCONDECISION_PARM_CHECK_PERIOD(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd+1, 0, 8, __Value) #define SET_H2CCMD_DISCONDECISION_PARM_TRY_PKT_NUM(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd+2, 0, 8, __Value) -#ifdef CONFIG_AP_WOWLAN -/* _AP_Offload 0x08 */ -#define SET_H2CCMD_AP_WOWLAN_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd, 0, 8, __Value) -/* _BCN_RsvdPage 0x09 */ -#define SET_H2CCMD_AP_WOWLAN_RSVDPAGE_LOC_BCN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd, 0, 8, __Value) -/* _Probersp_RsvdPage 0x0a */ -#define SET_H2CCMD_AP_WOWLAN_RSVDPAGE_LOC_ProbeRsp(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd, 0, 8, __Value) -/* _Probersp_RsvdPage 0x13 */ -#define SET_H2CCMD_AP_WOW_GPIO_CTRL_INDEX(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 4, __Value) -#define SET_H2CCMD_AP_WOW_GPIO_CTRL_C2H_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 4, 1, __Value) -#define SET_H2CCMD_AP_WOW_GPIO_CTRL_PLUS(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 5, 1, __Value) -#define SET_H2CCMD_AP_WOW_GPIO_CTRL_HIGH_ACTIVE(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 6, 1, __Value) -#define SET_H2CCMD_AP_WOW_GPIO_CTRL_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 7, 1, __Value) -#define SET_H2CCMD_AP_WOW_GPIO_CTRL_DURATION(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+1, 0, 8, __Value) -#define SET_H2CCMD_AP_WOW_GPIO_CTRL_C2H_DURATION(__pH2CCmd, __Value)SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+2, 0, 8, __Value) -/* _AP_PS 0x26 */ -#define SET_H2CCMD_AP_WOW_PS_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 1, __Value) -#define SET_H2CCMD_AP_WOW_PS_32K_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 1, 1, __Value) -#define SET_H2CCMD_AP_WOW_PS_RF(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 2, 1, __Value) -#define SET_H2CCMD_AP_WOW_PS_DURATION(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+1, 0, 8, __Value) -#endif - /* _WoWLAN PARAM_CMD_0x80 */ #define SET_H2CCMD_WOWLAN_FUNC_ENABLE(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 1, __Value) #define SET_H2CCMD_WOWLAN_PATTERN_MATCH_ENABLE(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 1, 1, __Value) @@ -186,14 +164,6 @@ struct RSVDPAGE_LOC { u8 LocNullData; u8 LocQosNull; u8 LocBTQosNull; -#ifdef CONFIG_AP_WOWLAN - u8 LocApOffloadBCN; -#endif /* CONFIG_AP_WOWLAN */ }; #endif -#ifdef CONFIG_AP_WOWLAN -void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip); -void rtw_get_sec_iv(struct adapter *padapter, u8 *pcur_dot11txpn, u8 *StaAddr); -void rtw_set_sec_pn(struct adapter *padapter); -#endif diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h index 093e00b9349b..02cad39be5c9 100644 --- a/drivers/staging/rtl8723bs/include/hal_intf.h +++ b/drivers/staging/rtl8723bs/include/hal_intf.h @@ -85,9 +85,6 @@ enum HW_VARIABLES { HW_VAR_APFM_ON_MAC, /* Auto FSM to Turn On, include clock, isolation, power control for MAC only */ /* The valid upper nav range for the HW updating, if the true value is larger than the upper range, the HW won't update it. */ /* Unit in microsecond. 0 means disable this function. */ -#ifdef CONFIG_AP_WOWLAN - HW_VAR_AP_WOWLAN, -#endif HW_VAR_SYS_CLKR, HW_VAR_NAV_UPPER, HW_VAR_C2H_HANDLE, diff --git a/drivers/staging/rtl8723bs/include/osdep_service.h b/drivers/staging/rtl8723bs/include/osdep_service.h index 07f846efa0d1..57270f46c415 100644 --- a/drivers/staging/rtl8723bs/include/osdep_service.h +++ b/drivers/staging/rtl8723bs/include/osdep_service.h @@ -136,14 +136,7 @@ static inline int rtw_bug_check(void *parg1, void *parg2, void *parg3, void *par #define MAC_ARG(x) (x) #endif - -#ifdef CONFIG_AP_WOWLAN -extern void rtw_softap_lock_suspend(void); -extern void rtw_softap_unlock_suspend(void); -#endif - -extern void rtw_free_netdev(struct net_device *netdev); - +extern void rtw_free_netdev(struct net_device * netdev); /* Macros for handling unaligned memory accesses */ diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h b/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h index b85e67ccc7db..9629a8844c2d 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h @@ -177,12 +177,6 @@ void rtl8723b_download_BTCoex_AP_mode_rsvd_page(struct adapter *padapter); void CheckFwRsvdPageContent(struct adapter *padapter); -#ifdef CONFIG_AP_WOWLAN -void rtl8723b_set_wowlan_cmd(struct adapter *padapter, u8 enable); -void rtl8723b_set_ap_wowlan_cmd(struct adapter *padapter, u8 enable); -void SetFwRelatedForWoWLAN8723b(struct adapter *padapter, u8 bHostIsGoingtoSleep); -#endif - void rtl8723b_set_FwPwrModeInIPS_cmd(struct adapter *padapter, u8 cmd_param); s32 FillH2CCmd8723B(struct adapter *padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer); diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index f9a4661997c4..6449238fb2a5 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -98,10 +98,6 @@ struct rt_firmware_hdr { /* ARP Rsp:1, RWC:1, GTK Info:1, GTK RSP:2, GTK EXT MEM:2, PNO: 6 */ #define WOWLAN_PAGE_NUM_8723B 0x00 -#ifdef CONFIG_AP_WOWLAN -#define AP_WOWLAN_PAGE_NUM_8723B 0x02 -#endif - #define TX_TOTAL_PAGE_NUMBER_8723B \ (0xFF - BCNQ_PAGE_NUM_8723B - \ BCNQ1_PAGE_NUM_8723B - \ diff --git a/drivers/staging/rtl8723bs/include/rtw_mp.h b/drivers/staging/rtl8723bs/include/rtw_mp.h index 8b6e4e9578f9..fb254d88f503 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mp.h +++ b/drivers/staging/rtl8723bs/include/rtw_mp.h @@ -189,9 +189,6 @@ enum { CTA_TEST, MP_DISABLE_BT_COEXIST, MP_PwrCtlDM, -#ifdef CONFIG_AP_WOWLAN - MP_AP_WOW_ENABLE, -#endif MP_NULL, MP_GET_TXPOWER_INX, }; diff --git a/drivers/staging/rtl8723bs/include/sdio_ops.h b/drivers/staging/rtl8723bs/include/sdio_ops.h index 1f1f368cded4..c7559a884608 100644 --- a/drivers/staging/rtl8723bs/include/sdio_ops.h +++ b/drivers/staging/rtl8723bs/include/sdio_ops.h @@ -25,17 +25,10 @@ s32 _sdio_write32(struct adapter *padapter, u32 addr, u32 val); extern void sd_int_hdl(struct adapter *padapter); extern u8 CheckIPSStatus(struct adapter *padapter); -#ifdef CONFIG_AP_WOWLAN -extern u8 RecvOnePkt(struct adapter *padapter, u32 size); -#endif extern void InitInterrupt8723BSdio(struct adapter *padapter); extern void InitSysInterrupt8723BSdio(struct adapter *padapter); extern void EnableInterrupt8723BSdio(struct adapter *padapter); extern void DisableInterrupt8723BSdio(struct adapter *padapter); extern u8 HalQueryTxBufferStatus8723BSdio(struct adapter *padapter); extern void HalQueryTxOQTBufferStatus8723BSdio(struct adapter *padapter); -#ifdef CONFIG_AP_WOWLAN -extern void ClearInterrupt8723BSdio(struct adapter *padapter); -#endif - #endif /* !__SDIO_OPS_H__ */ diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index aac1391bdbf1..d0e77465ad9a 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -4621,10 +4621,6 @@ static const struct iw_priv_args rtw_private_args[] = { SIOCIWFIRSTPRIV + 0x1D, IW_PRIV_TYPE_CHAR | 40, IW_PRIV_TYPE_CHAR | 0x7FF, "test" }, - -#ifdef CONFIG_AP_WOWLAN - { MP_AP_WOW_ENABLE, IW_PRIV_TYPE_CHAR | 1024, 0, "ap_wow_mode" }, /* set */ -#endif }; static iw_handler rtw_private_handler[] = { diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index 3909f149de47..3177ea43f396 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -1227,58 +1227,6 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) return _SUCCESS; } -#ifdef CONFIG_AP_WOWLAN -void rtw_suspend_ap_wow(struct adapter *padapter) -{ - u8 ch, bw, offset; - struct net_device *pnetdev = padapter->pnetdev; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct wowlan_ioctl_param poidparam; - - DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); - - pwrpriv->wowlan_ap_mode = true; - - DBG_871X("wowlan_ap_mode: %d\n", pwrpriv->wowlan_ap_mode); - - if (pnetdev) - rtw_netif_stop_queue(pnetdev); - /* 1. stop thread */ - padapter->bDriverStopped = true; /* for stop thread */ - rtw_stop_drv_threads(padapter); - padapter->bDriverStopped = false; /* for 32k command */ - - /* 2. disable interrupt */ - rtw_hal_disable_interrupt(padapter); /* It need wait for leaving 32K. */ - - /* 2.1 clean interrupt */ - if (padapter->HalFunc.clear_interrupt) - padapter->HalFunc.clear_interrupt(padapter); - - /* 2.2 free irq */ - /* sdio_free_irq(adapter_to_dvobj(padapter)); */ - if (padapter->intf_free_irq) - padapter->intf_free_irq(adapter_to_dvobj(padapter)); - - poidparam.subcode = WOWLAN_AP_ENABLE; - padapter->HalFunc.SetHwRegHandler(padapter, - HW_VAR_AP_WOWLAN, (u8 *)&poidparam); - - DBG_871X_LEVEL(_drv_always_, "%s: wowmode suspending\n", __func__); - - if (rtw_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) { - DBG_871X(FUNC_ADPT_FMT " back to linked/linking union - ch:%u, bw:%u, offset:%u\n", - FUNC_ADPT_ARG(padapter), ch, bw, offset); - set_channel_bwmode(padapter, ch, offset, bw); - } - - rtw_set_ps_mode(padapter, PS_MODE_MIN, 0, 0, "AP-WOWLAN"); - - DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); -} -#endif /* ifdef CONFIG_AP_WOWLAN */ - - static void rtw_suspend_normal(struct adapter *padapter) { struct net_device *pnetdev = padapter->pnetdev; @@ -1350,11 +1298,7 @@ int rtw_suspend_common(struct adapter *padapter) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { rtw_suspend_normal(padapter); } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - #ifdef CONFIG_AP_WOWLAN - rtw_suspend_ap_wow(padapter); - #else rtw_suspend_normal(padapter); - #endif /* CONFIG_AP_WOWLAN */ } else { rtw_suspend_normal(padapter); } @@ -1369,80 +1313,6 @@ int rtw_suspend_common(struct adapter *padapter) return ret; } -#ifdef CONFIG_AP_WOWLAN -int rtw_resume_process_ap_wow(struct adapter *padapter) -{ - struct net_device *pnetdev = padapter->pnetdev; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct dvobj_priv *psdpriv = padapter->dvobj; - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; - struct wowlan_ioctl_param poidparam; - int ret = _SUCCESS; - - DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); - - if (padapter) { - pnetdev = padapter->pnetdev; - pwrpriv = adapter_to_pwrctl(padapter); - } else { - pdbgpriv->dbg_resume_error_cnt++; - ret = -1; - goto exit; - } - - rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "AP-WOWLAN"); - - pwrpriv->bFwCurrentInPSMode = false; - - rtw_hal_disable_interrupt(padapter); - - if (padapter->HalFunc.clear_interrupt) - padapter->HalFunc.clear_interrupt(padapter); - - /* if (sdio_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS) { */ - if ((padapter->intf_alloc_irq) && (padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS)) { - ret = -1; - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("%s: sdio_alloc_irq Failed!!\n", __func__)); - goto exit; - } - - /* Disable WOW, set H2C command */ - poidparam.subcode = WOWLAN_AP_DISABLE; - padapter->HalFunc.SetHwRegHandler(padapter, - HW_VAR_AP_WOWLAN, (u8 *)&poidparam); - pwrpriv->wowlan_ap_mode = false; - - padapter->bDriverStopped = false; - DBG_871X("%s: wowmode resuming, DriverStopped:%d\n", __func__, padapter->bDriverStopped); - rtw_start_drv_threads(padapter); - - if (padapter->intf_start) - padapter->intf_start(padapter); - - /* start netif queue */ - if (pnetdev) { - if (!rtw_netif_queue_stopped(pnetdev)) - rtw_netif_start_queue(pnetdev); - else - rtw_netif_wake_queue(pnetdev); - } - - if (padapter->pid[1] != 0) { - DBG_871X("pid[1]:%d\n", padapter->pid[1]); - rtw_signal_process(padapter->pid[1], SIGUSR2); - } - - pwrpriv->bips_processing = false; - _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); - - /* clean driver side wake up reason. */ - pwrpriv->wowlan_wake_reason = 0; -exit: - DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); - return ret; -} -#endif /* ifdef CONFIG_APWOWLAN */ - static int rtw_resume_process_normal(struct adapter *padapter) { struct net_device *pnetdev; @@ -1532,11 +1402,7 @@ int rtw_resume_common(struct adapter *padapter) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { rtw_resume_process_normal(padapter); } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - #ifdef CONFIG_AP_WOWLAN - rtw_resume_process_ap_wow(padapter); - #else rtw_resume_process_normal(padapter); - #endif /* CONFIG_AP_WOWLAN */ } else { rtw_resume_process_normal(padapter); } -- 2.20.1 From fabioaiuto83 at gmail.com Tue Mar 16 14:27:21 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 15:27:21 +0100 Subject: [PATCH v2] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_GPIO_API Message-ID: <20210316142714.GA3368@agape.jhs> remove conditional code blocks checked by unused CONFIG_GPIO_API cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Changes in v2: rebase of conflicting code in public staging-testing Signed-off-by: Fabio Aiuto --- .../staging/rtl8723bs/core/rtw_wlan_util.c | 95 ------------------- drivers/staging/rtl8723bs/include/drv_types.h | 6 -- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 40 -------- 3 files changed, 141 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index d04514d36b49..3e211780cde4 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -2014,98 +2014,3 @@ struct adapter *dvobj_get_port0_adapter(struct dvobj_priv *dvobj) return dvobj->padapters; } - -#ifdef CONFIG_GPIO_API -int rtw_get_gpio(struct net_device *netdev, int gpio_num) -{ - u8 value; - u8 direction; - struct adapter *adapter = rtw_netdev_priv(netdev); - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(adapter); - - rtw_ps_deny(adapter, PS_DENY_IOCTL); - - DBG_871X("rf_pwrstate = 0x%02x\n", pwrpriv->rf_pwrstate); - LeaveAllPowerSaveModeDirect(adapter); - - /* Read GPIO Direction */ - direction = (rtw_read8(adapter, REG_GPIO_PIN_CTRL + 2) & BIT(gpio_num)) >> gpio_num; - - /* According the direction to read register value */ - if (direction) - value = (rtw_read8(adapter, REG_GPIO_PIN_CTRL + 1) & BIT(gpio_num)) >> gpio_num; - else - value = (rtw_read8(adapter, REG_GPIO_PIN_CTRL) & BIT(gpio_num)) >> gpio_num; - - rtw_ps_deny_cancel(adapter, PS_DENY_IOCTL); - DBG_871X("%s direction =%d value =%d\n", __func__, direction, value); - - return value; -} -EXPORT_SYMBOL(rtw_get_gpio); - -int rtw_set_gpio_output_value(struct net_device *netdev, int gpio_num, bool isHigh) -{ - u8 direction = 0; - u8 res = -1; - struct adapter *adapter = rtw_netdev_priv(netdev); - - /* Check GPIO is 4~7 */ - if (gpio_num > 7 || gpio_num < 4) { - DBG_871X("%s The gpio number does not included 4~7.\n", __func__); - return -1; - } - - rtw_ps_deny(adapter, PS_DENY_IOCTL); - - LeaveAllPowerSaveModeDirect(adapter); - - /* Read GPIO direction */ - direction = (rtw_read8(adapter, REG_GPIO_PIN_CTRL + 2) & BIT(gpio_num)) >> gpio_num; - - /* If GPIO is output direction, setting value. */ - if (direction) { - if (isHigh) - rtw_write8(adapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(adapter, REG_GPIO_PIN_CTRL + 1) | BIT(gpio_num)); - else - rtw_write8(adapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(adapter, REG_GPIO_PIN_CTRL + 1) & ~BIT(gpio_num)); - - DBG_871X("%s Set gpio %x[%d]=%d\n", __func__, REG_GPIO_PIN_CTRL+1, gpio_num, isHigh); - res = 0; - } else { - DBG_871X("%s The gpio is input, not be set!\n", __func__); - res = -1; - } - - rtw_ps_deny_cancel(adapter, PS_DENY_IOCTL); - return res; -} -EXPORT_SYMBOL(rtw_set_gpio_output_value); - -int rtw_config_gpio(struct net_device *netdev, int gpio_num, bool isOutput) -{ - struct adapter *adapter = rtw_netdev_priv(netdev); - - if (gpio_num > 7 || gpio_num < 4) { - DBG_871X("%s The gpio number does not included 4~7.\n", __func__); - return -1; - } - - DBG_871X("%s gpio_num =%d direction =%d\n", __func__, gpio_num, isOutput); - - rtw_ps_deny(adapter, PS_DENY_IOCTL); - - LeaveAllPowerSaveModeDirect(adapter); - - if (isOutput) - rtw_write8(adapter, REG_GPIO_PIN_CTRL + 2, rtw_read8(adapter, REG_GPIO_PIN_CTRL + 2) | BIT(gpio_num)); - else - rtw_write8(adapter, REG_GPIO_PIN_CTRL + 2, rtw_read8(adapter, REG_GPIO_PIN_CTRL + 2) & ~BIT(gpio_num)); - - rtw_ps_deny_cancel(adapter, PS_DENY_IOCTL); - - return 0; -} -EXPORT_SYMBOL(rtw_config_gpio); -#endif - diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h index 9d482a6115ab..9c0e7b6946f8 100644 --- a/drivers/staging/rtl8723bs/include/drv_types.h +++ b/drivers/staging/rtl8723bs/include/drv_types.h @@ -528,12 +528,6 @@ static inline void RTW_ENABLE_FUNC(struct adapter *padapter, int func_bit) (padapter)->bSurpriseRemoved || \ RTW_IS_FUNC_DISABLED((padapter), DF_TX_BIT)) -#ifdef CONFIG_GPIO_API -int rtw_get_gpio(struct net_device *netdev, int gpio_num); -int rtw_set_gpio_output_value(struct net_device *netdev, int gpio_num, bool isHigh); -int rtw_config_gpio(struct net_device *netdev, int gpio_num, bool isOutput); -#endif - static inline u8 *myid(struct eeprom_priv *peepriv) { return peepriv->mac_addr; diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index d0e77465ad9a..f5cd3639f571 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -3063,46 +3063,6 @@ static int rtw_dbg_port(struct net_device *dev, { break; } -#ifdef CONFIG_GPIO_API - case 0x25: /* Get GPIO register */ - { - /* - * dbg 0x7f250000 [gpio_num], Get gpio value, gpio_num:0~7 - */ - - int value; - DBG_871X("Read GPIO Value extra_arg = %d\n", extra_arg); - value = rtw_get_gpio(dev, extra_arg); - DBG_871X("Read GPIO Value = %d\n", value); - break; - } - case 0x26: /* Set GPIO direction */ - { - - /* dbg 0x7f26000x [y], Set gpio direction, - * x: gpio_num, 4~7 y: indicate direction, 0~1 - */ - - int value; - DBG_871X("Set GPIO Direction! arg = %d , extra_arg =%d\n", arg, extra_arg); - value = rtw_config_gpio(dev, arg, extra_arg); - DBG_871X("Set GPIO Direction %s\n", (value == -1) ? "Fail!!!" : "Success"); - break; - } - case 0x27: /* Set GPIO output direction value */ - { - /* - * dbg 0x7f27000x [y], Set gpio output direction value, - * x: gpio_num, 4~7 y: indicate direction, 0~1 - */ - - int value; - DBG_871X("Set GPIO Value! arg = %d , extra_arg =%d\n", arg, extra_arg); - value = rtw_set_gpio_output_value(dev, arg, extra_arg); - DBG_871X("Set GPIO Value %s\n", (value == -1) ? "Fail!!!" : "Success"); - break; - } -#endif case 0xaa: { if ((extra_arg & 0x7F) > 0x3F) -- 2.20.1 From tkjos at google.com Tue Mar 16 15:28:14 2021 From: tkjos at google.com (Todd Kjos) Date: Tue, 16 Mar 2021 08:28:14 -0700 Subject: [PATCH v3 1/3] binder: BINDER_FREEZE ioctl In-Reply-To: <20210316011630.1121213-2-dualli@chromium.org> References: <20210316011630.1121213-1-dualli@chromium.org> <20210316011630.1121213-2-dualli@chromium.org> Message-ID: On Mon, Mar 15, 2021 at 6:16 PM Li Li wrote: > > From: Marco Ballesio > > Frozen tasks can't process binder transactions, so a way is required to > inform transmitting ends of communication failures due to the frozen > state of their receiving counterparts. Additionally, races are possible > between transitions to frozen state and binder transactions enqueued to > a specific process. > > Implement BINDER_FREEZE ioctl for user space to inform the binder driver > about the intention to freeze or unfreeze a process. When the ioctl is > called, block the caller until any pending binder transactions toward > the target process are flushed. Return an error to transactions to > processes marked as frozen. > > Signed-off-by: Marco Ballesio > Co-developed-by: Todd Kjos > Signed-off-by: Todd Kjos > Signed-off-by: Li Li For the series, you can add Acked-by: Todd Kjos > --- > drivers/android/binder.c | 139 ++++++++++++++++++++++++++-- > drivers/android/binder_internal.h | 12 +++ > include/uapi/linux/android/binder.h | 13 +++ > 3 files changed, 154 insertions(+), 10 deletions(-) > > diff --git a/drivers/android/binder.c b/drivers/android/binder.c > index c119736ca56a..b93ca53bb90f 100644 > --- a/drivers/android/binder.c > +++ b/drivers/android/binder.c > @@ -1506,6 +1506,12 @@ static void binder_free_transaction(struct binder_transaction *t) > > if (target_proc) { > binder_inner_proc_lock(target_proc); > + target_proc->outstanding_txns--; > + if (target_proc->outstanding_txns < 0) > + pr_warn("%s: Unexpected outstanding_txns %d\n", > + __func__, target_proc->outstanding_txns); > + if (!target_proc->outstanding_txns && target_proc->is_frozen) > + wake_up_interruptible_all(&target_proc->freeze_wait); > if (t->buffer) > t->buffer->transaction = NULL; > binder_inner_proc_unlock(target_proc); > @@ -2331,10 +2337,11 @@ static int binder_fixup_parent(struct binder_transaction *t, > * If the @thread parameter is not NULL, the transaction is always queued > * to the waitlist of that specific thread. > * > - * Return: true if the transactions was successfully queued > - * false if the target process or thread is dead > + * Return: 0 if the transaction was successfully queued > + * BR_DEAD_REPLY if the target process or thread is dead > + * BR_FROZEN_REPLY if the target process or thread is frozen > */ > -static bool binder_proc_transaction(struct binder_transaction *t, > +static int binder_proc_transaction(struct binder_transaction *t, > struct binder_proc *proc, > struct binder_thread *thread) > { > @@ -2354,10 +2361,11 @@ static bool binder_proc_transaction(struct binder_transaction *t, > > binder_inner_proc_lock(proc); > > - if (proc->is_dead || (thread && thread->is_dead)) { > + if ((proc->is_frozen && !oneway) || proc->is_dead || > + (thread && thread->is_dead)) { > binder_inner_proc_unlock(proc); > binder_node_unlock(node); > - return false; > + return proc->is_frozen ? BR_FROZEN_REPLY : BR_DEAD_REPLY; > } > > if (!thread && !pending_async) > @@ -2373,10 +2381,11 @@ static bool binder_proc_transaction(struct binder_transaction *t, > if (!pending_async) > binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); > > + proc->outstanding_txns++; > binder_inner_proc_unlock(proc); > binder_node_unlock(node); > > - return true; > + return 0; > } > > /** > @@ -3013,13 +3022,16 @@ static void binder_transaction(struct binder_proc *proc, > if (reply) { > binder_enqueue_thread_work(thread, tcomplete); > binder_inner_proc_lock(target_proc); > - if (target_thread->is_dead) { > + if (target_thread->is_dead || target_proc->is_frozen) { > + return_error = target_thread->is_dead ? > + BR_DEAD_REPLY : BR_FROZEN_REPLY; > binder_inner_proc_unlock(target_proc); > goto err_dead_proc_or_thread; > } > BUG_ON(t->buffer->async_transaction != 0); > binder_pop_transaction_ilocked(target_thread, in_reply_to); > binder_enqueue_thread_work_ilocked(target_thread, &t->work); > + target_proc->outstanding_txns++; > binder_inner_proc_unlock(target_proc); > wake_up_interruptible_sync(&target_thread->wait); > binder_free_transaction(in_reply_to); > @@ -3038,7 +3050,9 @@ static void binder_transaction(struct binder_proc *proc, > t->from_parent = thread->transaction_stack; > thread->transaction_stack = t; > binder_inner_proc_unlock(proc); > - if (!binder_proc_transaction(t, target_proc, target_thread)) { > + return_error = binder_proc_transaction(t, > + target_proc, target_thread); > + if (return_error) { > binder_inner_proc_lock(proc); > binder_pop_transaction_ilocked(thread, t); > binder_inner_proc_unlock(proc); > @@ -3048,7 +3062,8 @@ static void binder_transaction(struct binder_proc *proc, > BUG_ON(target_node == NULL); > BUG_ON(t->buffer->async_transaction != 1); > binder_enqueue_thread_work(thread, tcomplete); > - if (!binder_proc_transaction(t, target_proc, NULL)) > + return_error = binder_proc_transaction(t, target_proc, NULL); > + if (return_error) > goto err_dead_proc_or_thread; > } > if (target_thread) > @@ -3065,7 +3080,6 @@ static void binder_transaction(struct binder_proc *proc, > return; > > err_dead_proc_or_thread: > - return_error = BR_DEAD_REPLY; > return_error_line = __LINE__; > binder_dequeue_work(proc, tcomplete); > err_translate_failed: > @@ -4298,6 +4312,9 @@ static void binder_free_proc(struct binder_proc *proc) > > BUG_ON(!list_empty(&proc->todo)); > BUG_ON(!list_empty(&proc->delivered_death)); > + if (proc->outstanding_txns) > + pr_warn("%s: Unexpected outstanding_txns %d\n", > + __func__, proc->outstanding_txns); > device = container_of(proc->context, struct binder_device, context); > if (refcount_dec_and_test(&device->ref)) { > kfree(proc->context->name); > @@ -4359,6 +4376,7 @@ static int binder_thread_release(struct binder_proc *proc, > (t->to_thread == thread) ? "in" : "out"); > > if (t->to_thread == thread) { > + thread->proc->outstanding_txns--; > t->to_proc = NULL; > t->to_thread = NULL; > if (t->buffer) { > @@ -4609,6 +4627,45 @@ static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, > return 0; > } > > +static int binder_ioctl_freeze(struct binder_freeze_info *info, > + struct binder_proc *target_proc) > +{ > + int ret = 0; > + > + if (!info->enable) { > + binder_inner_proc_lock(target_proc); > + target_proc->is_frozen = false; > + binder_inner_proc_unlock(target_proc); > + return 0; > + } > + > + /* > + * Freezing the target. Prevent new transactions by > + * setting frozen state. If timeout specified, wait > + * for transactions to drain. > + */ > + binder_inner_proc_lock(target_proc); > + target_proc->is_frozen = true; > + binder_inner_proc_unlock(target_proc); > + > + if (info->timeout_ms > 0) > + ret = wait_event_interruptible_timeout( > + target_proc->freeze_wait, > + (!target_proc->outstanding_txns), > + msecs_to_jiffies(info->timeout_ms)); > + > + if (!ret && target_proc->outstanding_txns) > + ret = -EAGAIN; > + > + if (ret < 0) { > + binder_inner_proc_lock(target_proc); > + target_proc->is_frozen = false; > + binder_inner_proc_unlock(target_proc); > + } > + > + return ret; > +} > + > static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > { > int ret; > @@ -4727,6 +4784,66 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > } > break; > } > + case BINDER_FREEZE: { > + struct binder_freeze_info info; > + struct binder_proc **target_procs = NULL, *target_proc; > + int target_procs_count = 0, i = 0; > + > + ret = 0; > + > + if (copy_from_user(&info, ubuf, sizeof(info))) { > + ret = -EFAULT; > + goto err; > + } > + > + mutex_lock(&binder_procs_lock); > + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { > + if (target_proc->pid == info.pid) > + target_procs_count++; > + } > + > + if (target_procs_count == 0) { > + mutex_unlock(&binder_procs_lock); > + ret = -EINVAL; > + goto err; > + } > + > + target_procs = kcalloc(target_procs_count, > + sizeof(struct binder_proc *), > + GFP_KERNEL); > + > + if (!target_procs) { > + mutex_unlock(&binder_procs_lock); > + ret = -ENOMEM; > + goto err; > + } > + > + hlist_for_each_entry(target_proc, &binder_procs, proc_node) { > + if (target_proc->pid != info.pid) > + continue; > + > + binder_inner_proc_lock(target_proc); > + target_proc->tmp_ref++; > + binder_inner_proc_unlock(target_proc); > + > + target_procs[i++] = target_proc; > + } > + mutex_unlock(&binder_procs_lock); > + > + for (i = 0; i < target_procs_count; i++) { > + if (ret >= 0) > + ret = binder_ioctl_freeze(&info, > + target_procs[i]); > + > + binder_proc_dec_tmpref(target_procs[i]); > + } > + > + kfree(target_procs); > + > + if (ret < 0) > + goto err; > + break; > + } > default: > ret = -EINVAL; > goto err; > @@ -4823,6 +4940,7 @@ static int binder_open(struct inode *nodp, struct file *filp) > get_task_struct(current->group_leader); > proc->tsk = current->group_leader; > INIT_LIST_HEAD(&proc->todo); > + init_waitqueue_head(&proc->freeze_wait); > proc->default_priority = task_nice(current); > /* binderfs stashes devices in i_private */ > if (is_binderfs_device(nodp)) { > @@ -5035,6 +5153,7 @@ static void binder_deferred_release(struct binder_proc *proc) > proc->tmp_ref++; > > proc->is_dead = true; > + proc->is_frozen = false; > threads = 0; > active_transactions = 0; > while ((n = rb_first(&proc->threads))) { > diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h > index 6cd79011e35d..e6a53e98c6da 100644 > --- a/drivers/android/binder_internal.h > +++ b/drivers/android/binder_internal.h > @@ -367,9 +367,18 @@ struct binder_ref { > * (protected by binder_deferred_lock) > * @deferred_work: bitmap of deferred work to perform > * (protected by binder_deferred_lock) > + * @outstanding_txns: number of transactions to be transmitted before > + * processes in freeze_wait are woken up > + * (protected by @inner_lock) > * @is_dead: process is dead and awaiting free > * when outstanding transactions are cleaned up > * (protected by @inner_lock) > + * @is_frozen: process is frozen and unable to service > + * binder transactions > + * (protected by @inner_lock) > + * @freeze_wait: waitqueue of processes waiting for all outstanding > + * transactions to be processed > + * (protected by @inner_lock) > * @todo: list of work for this process > * (protected by @inner_lock) > * @stats: per-process binder statistics > @@ -410,7 +419,10 @@ struct binder_proc { > struct task_struct *tsk; > struct hlist_node deferred_work_node; > int deferred_work; > + int outstanding_txns; > bool is_dead; > + bool is_frozen; > + wait_queue_head_t freeze_wait; > > struct list_head todo; > struct binder_stats stats; > diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h > index ec84ad106568..7eb5b818b3c1 100644 > --- a/include/uapi/linux/android/binder.h > +++ b/include/uapi/linux/android/binder.h > @@ -217,6 +217,12 @@ struct binder_node_info_for_ref { > __u32 reserved3; > }; > > +struct binder_freeze_info { > + __u32 pid; > + __u32 enable; > + __u32 timeout_ms; > +}; > + > #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) > #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) > #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) > @@ -227,6 +233,7 @@ struct binder_node_info_for_ref { > #define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info) > #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref) > #define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object) > +#define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info) > > /* > * NOTE: Two special error codes you should check for when calling > @@ -408,6 +415,12 @@ enum binder_driver_return_protocol { > * The last transaction (either a bcTRANSACTION or > * a bcATTEMPT_ACQUIRE) failed (e.g. out of memory). No parameters. > */ > + > + BR_FROZEN_REPLY = _IO('r', 18), > + /* > + * The target of the last transaction (either a bcTRANSACTION or > + * a bcATTEMPT_ACQUIRE) is frozen. No parameters. > + */ > }; > > enum binder_driver_command_protocol { > -- > 2.31.0.rc2.261.g7f71774620-goog > From fabioaiuto83 at gmail.com Tue Mar 16 15:29:40 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 16:29:40 +0100 Subject: [PATCH 00/12] Remove more unused code blocks Message-ID: Remove unused code clocks, as required in TODO list: find and remove code blocks guarded by never set CONFIG_FOO defines Fabio Aiuto (12): staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_CMCC_TEST staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_INTERRUPT_BASED_TXBCN* staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_DISABLE_MCS13TO15 staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_UPDATE_INDICATE_SEQ_WHILE_PROCESS_ADDBA_REQ staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_VALIDATE_SSID staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_LAYER2_ROAMING_ACTIVE staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_USB_VENDOR* staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_SINGLE_RECV_BUF staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_RX_INDICATE_QUEUE staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_BSD_RX_USE_MBUF staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_R871X_TEST staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_MULTI_VIR_IFACES drivers/staging/rtl8723bs/core/rtw_ap.c | 30 ++------------ .../staging/rtl8723bs/core/rtw_ioctl_set.c | 11 ----- drivers/staging/rtl8723bs/core/rtw_mlme.c | 19 +-------- .../staging/rtl8723bs/core/rtw_wlan_util.c | 15 ------- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 40 ------------------- drivers/staging/rtl8723bs/include/drv_conf.h | 10 ----- drivers/staging/rtl8723bs/include/drv_types.h | 3 -- .../staging/rtl8723bs/include/osdep_intf.h | 6 --- drivers/staging/rtl8723bs/include/rtw_recv.h | 17 +------- 9 files changed, 6 insertions(+), 145 deletions(-) -- 2.20.1 From fabioaiuto83 at gmail.com Tue Mar 16 15:30:19 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 16:30:19 +0100 Subject: [PATCH 01/12] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_CMCC_TEST In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_CMCC_TEST cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 6f08af686f9d..5904b7f9f134 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -2115,16 +2115,6 @@ static void UpdateHalRAMask8723B(struct adapter *padapter, u32 mac_id, u8 rssi_l rate_bitmap = hal_btcoex_GetRaMask(padapter); mask &= ~rate_bitmap; -#ifdef CONFIG_CMCC_TEST - if (pmlmeext->cur_wireless_mode & WIRELESS_11G) { - if (mac_id == 0) { - DBG_871X("CMCC_BT update raid entry, mask = 0x%x\n", mask); - mask &= 0xffffff00; /* disable CCK & <24M OFDM rate for 11G mode for CMCC */ - DBG_871X("CMCC_BT update raid entry, mask = 0x%x\n", mask); - } - } -#endif - if (pHalData->fw_ractrl) { rtl8723b_set_FwMacIdConfig_cmd(padapter, mac_id, psta->raid, psta->bw_mode, shortGIrate, mask); } @@ -3082,10 +3072,6 @@ static void rtl8723b_fill_default_txdesc( ptxdesc->data_ldpc = 1; if (pattrib->stbc) ptxdesc->data_stbc = 1; - -#ifdef CONFIG_CMCC_TEST - ptxdesc->data_short = 1; /* use cck short premble */ -#endif } else { /* EAP data packet and ARP packet. */ /* Use the 1M data rate to send the EAP/ARP packet. */ @@ -3767,11 +3753,6 @@ void SetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val) BrateCfg &= rrsr_2g_allow_mask; masked = BrateCfg; - #ifdef CONFIG_CMCC_TEST - BrateCfg |= (RRSR_11M|RRSR_5_5M|RRSR_1M); /* use 11M to send ACK */ - BrateCfg |= (RRSR_24M|RRSR_18M|RRSR_12M); /* CMCC_OFDM_ACK 12/18/24M */ - #endif - /* IOT consideration */ if (mlmext_info->assoc_AP_vendor == HT_IOT_PEER_CISCO) { /* if peer is cisco and didn't use ofdm rate, we enable 6M ack */ -- 2.20.1 From fabioaiuto83 at gmail.com Tue Mar 16 15:30:33 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 16:30:33 +0100 Subject: [PATCH 02/12] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_INTERRUPT_BASED_TXBCN* In-Reply-To: References: Message-ID: <9157000821fd6febf25566b8c712fad1995c7c78.1615907632.git.fabioaiuto83@gmail.com> remove conditional code blocks checked by unused CONFIG_INTERRUPT_BASED_TXBCN family defines cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_ap.c | 30 ++----------------- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 21 ------------- 2 files changed, 3 insertions(+), 48 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c index 63b339484289..74f0f4d5a0b3 100644 --- a/drivers/staging/rtl8723bs/core/rtw_ap.c +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c @@ -920,12 +920,10 @@ void start_bss_network(struct adapter *padapter, u8 *pbuf) if (pmlmeext->bstart_bss) { update_beacon(padapter, WLAN_EID_TIM, NULL, true); -#ifndef CONFIG_INTERRUPT_BASED_TXBCN /* other case will tx beacon when bcn interrupt coming in. */ - /* issue beacon frame */ - if (send_beacon(padapter) == _FAIL) - DBG_871X("issue_beacon, fail!\n"); + /* issue beacon frame */ + if (send_beacon(padapter) == _FAIL) + DBG_871X("issue_beacon, fail!\n"); -#endif /* CONFIG_INTERRUPT_BASED_TXBCN */ } /* update bc/mc sta_info */ @@ -1685,26 +1683,6 @@ static void update_bcn_wps_ie(struct adapter *padapter) } kfree(pbackup_remainder_ie); - - /* deal with the case without set_tx_beacon_cmd() in update_beacon() */ -#if defined(CONFIG_INTERRUPT_BASED_TXBCN) - if ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE) { - u8 sr = 0; - - rtw_get_wps_attr_content( - pwps_ie_src, - wps_ielen, - WPS_ATTR_SELECTED_REGISTRAR, - (u8 *)(&sr), - NULL - ); - - if (sr) { - set_fwstate(pmlmepriv, WIFI_UNDER_WPS); - DBG_871X("%s, set WIFI_UNDER_WPS\n", __func__); - } - } -#endif } static void update_bcn_p2p_ie(struct adapter *padapter) @@ -1802,12 +1780,10 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) spin_unlock_bh(&pmlmepriv->bcn_update_lock); -#ifndef CONFIG_INTERRUPT_BASED_TXBCN if (tx) { /* send_beacon(padapter);//send_beacon must execute on TSR level */ set_tx_beacon_cmd(padapter); } -#endif /* CONFIG_INTERRUPT_BASED_TXBCN */ } /* diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 5904b7f9f134..2b81be6f1b32 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -3272,17 +3272,6 @@ static void hw_var_set_opmode(struct adapter *padapter, u8 variable, u8 *val) if ((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_)) { { StopTxBeacon(padapter); -#ifdef CONFIG_INTERRUPT_BASED_TXBCN -#ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT - rtw_write8(padapter, REG_DRVERLYINT, 0x05); /* restore early int time to 5ms */ - UpdateInterruptMask8812AU(padapter, true, 0, IMR_BCNDMAINT0_8723B); -#endif /* CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT */ - -#ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR - UpdateInterruptMask8812AU(padapter, true, 0, (IMR_TXBCN0ERR_8723B|IMR_TXBCN0OK_8723B)); -#endif /* CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR */ - -#endif /* CONFIG_INTERRUPT_BASED_TXBCN */ } /* disable atim wnd */ @@ -3292,16 +3281,6 @@ static void hw_var_set_opmode(struct adapter *padapter, u8 variable, u8 *val) ResumeTxBeacon(padapter); rtw_write8(padapter, REG_BCN_CTRL, DIS_TSF_UDT|EN_BCN_FUNCTION|DIS_BCNQ_SUB); } else if (mode == _HW_STATE_AP_) { -#ifdef CONFIG_INTERRUPT_BASED_TXBCN -#ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT - UpdateInterruptMask8723BU(padapter, true, IMR_BCNDMAINT0_8723B, 0); -#endif /* CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT */ - -#ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR - UpdateInterruptMask8723BU(padapter, true, (IMR_TXBCN0ERR_8723B|IMR_TXBCN0OK_8723B), 0); -#endif /* CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR */ - -#endif /* CONFIG_INTERRUPT_BASED_TXBCN */ ResumeTxBeacon(padapter); -- 2.20.1 From fabioaiuto83 at gmail.com Tue Mar 16 15:30:43 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 16:30:43 +0100 Subject: [PATCH 03/12] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_DISABLE_MCS13TO15 In-Reply-To: References: Message-ID: <54e5805534f920d8c443874b759560a6127c8db8.1615907632.git.fabioaiuto83@gmail.com> remove conditional code blocks checked by unused CONFIG_DISABLE_MCS13TO15 cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 16 +--------------- drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 7 ------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index 725f699abda9..a9e5c27a42f7 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -2679,14 +2679,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ if (stbc_rx_enable) ht_capie.cap_info |= cpu_to_le16(IEEE80211_HT_CAP_RX_STBC_2R);/* RX STBC two spatial stream */ - #ifdef CONFIG_DISABLE_MCS13TO15 - if (((cbw40_enable == 1) && (operation_bw == CHANNEL_WIDTH_40)) && (pregistrypriv->wifi_spec != 1)) - set_mcs_rate_by_mask(ht_capie.mcs.rx_mask, MCS_RATE_2R_13TO15_OFF); - else - set_mcs_rate_by_mask(ht_capie.mcs.rx_mask, MCS_RATE_2R); - #else /* CONFIG_DISABLE_MCS13TO15 */ - set_mcs_rate_by_mask(ht_capie.mcs.rx_mask, MCS_RATE_2R); - #endif /* CONFIG_DISABLE_MCS13TO15 */ + set_mcs_rate_by_mask(ht_capie.mcs.rx_mask, MCS_RATE_2R); break; } @@ -2809,14 +2802,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len, u8 channe break; case RF_2T2R: default: -#ifdef CONFIG_DISABLE_MCS13TO15 - if (pmlmeext->cur_bwmode == CHANNEL_WIDTH_40 && pregistrypriv->wifi_spec != 1) - set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_2R_13TO15_OFF); - else - set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_2R); -#else /* CONFIG_DISABLE_MCS13TO15 */ set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_2R); -#endif /* CONFIG_DISABLE_MCS13TO15 */ } /* switch to the 40M Hz mode according to the AP */ diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index 3e211780cde4..2dd902b04509 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -1071,14 +1071,7 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE) break; case RF_2T2R: default: -#ifdef CONFIG_DISABLE_MCS13TO15 - if (pmlmeext->cur_bwmode == CHANNEL_WIDTH_40 && pregistrypriv->wifi_spec != 1) - set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_2R_13TO15_OFF); - else - set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_2R); -#else /* CONFIG_DISABLE_MCS13TO15 */ set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_2R); -#endif /* CONFIG_DISABLE_MCS13TO15 */ } if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { -- 2.20.1 From fabioaiuto83 at gmail.com Tue Mar 16 15:30:56 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 16:30:56 +0100 Subject: [PATCH 04/12] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_UPDATE_INDICATE_SEQ_WHILE_PROCESS_ADDBA_REQ In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_UPDATE_INDICATE_SEQ_WHILE_PROCESS_ADDBA_REQ cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index 2dd902b04509..ea690dbbfebb 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -1809,15 +1809,7 @@ void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr) preorder_ctrl = &psta->recvreorder_ctrl[tid]; - #ifdef CONFIG_UPDATE_INDICATE_SEQ_WHILE_PROCESS_ADDBA_REQ - preorder_ctrl->indicate_seq = start_seq; - #ifdef DBG_RX_SEQ - DBG_871X("DBG_RX_SEQ %s:%d IndicateSeq: %d, start_seq: %d\n", __func__, __LINE__, - preorder_ctrl->indicate_seq, start_seq); - #endif - #else preorder_ctrl->indicate_seq = 0xffff; - #endif preorder_ctrl->enable = pmlmeinfo->accept_addba_req; } -- 2.20.1 From fabioaiuto83 at gmail.com Tue Mar 16 15:31:25 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 16:31:25 +0100 Subject: [PATCH 05/12] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_VALIDATE_SSID In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_VALIDATE_SSID cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_ioctl_set.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c index c9418bfb2a00..5929a7bf7db6 100644 --- a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c +++ b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c @@ -33,17 +33,6 @@ u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid) goto exit; } -#ifdef CONFIG_VALIDATE_SSID - for (i = 0; i < ssid->SsidLength; i++) { - /* wifi, printable ascii code must be supported */ - if (!((ssid->Ssid[i] >= 0x20) && (ssid->Ssid[i] <= 0x7e))) { - RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("ssid has non-printable ascii\n")); - ret = false; - break; - } - } -#endif /* CONFIG_VALIDATE_SSID */ - exit: return ret; } -- 2.20.1 From fabioaiuto83 at gmail.com Tue Mar 16 15:31:42 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 16:31:42 +0100 Subject: [PATCH 06/12] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_LAYER2_ROAMING_ACTIVE In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_LAYER2_ROAMING_ACTIVE cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index a9e5c27a42f7..149093c710ae 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -67,9 +67,6 @@ int rtw_init_mlme_priv(struct adapter *padapter) pmlmepriv->roam_flags = 0 | RTW_ROAM_ON_EXPIRED | RTW_ROAM_ON_RESUME - #ifdef CONFIG_LAYER2_ROAMING_ACTIVE /* FIXME */ - | RTW_ROAM_ACTIVE - #endif ; pmlmepriv->roam_scanr_exp_ms = RTW_ROAM_SCAN_RESULT_EXP_MS; -- 2.20.1 From fabioaiuto83 at gmail.com Tue Mar 16 15:32:01 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 16:32:01 +0100 Subject: [PATCH 07/12] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_USB_VENDOR* In-Reply-To: References: Message-ID: <037983b85ccc2747284c9002a51c28a7290321ea.1615907632.git.fabioaiuto83@gmail.com> remove conditional code blocks checked by unused CONFIG_USB_VENDOR family defines cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/include/drv_conf.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/drv_conf.h b/drivers/staging/rtl8723bs/include/drv_conf.h index 7fc88b07a25e..9cef9ce589a1 100644 --- a/drivers/staging/rtl8723bs/include/drv_conf.h +++ b/drivers/staging/rtl8723bs/include/drv_conf.h @@ -8,16 +8,6 @@ #define __DRV_CONF_H__ #include "autoconf.h" -//About USB VENDOR REQ -#if defined(CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC) && !defined(CONFIG_USB_VENDOR_REQ_MUTEX) - #warning "define CONFIG_USB_VENDOR_REQ_MUTEX for CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC automatically" - #define CONFIG_USB_VENDOR_REQ_MUTEX -#endif -#if defined(CONFIG_VENDOR_REQ_RETRY) && !defined(CONFIG_USB_VENDOR_REQ_MUTEX) - #warning "define CONFIG_USB_VENDOR_REQ_MUTEX for CONFIG_VENDOR_REQ_RETRY automatically" - #define CONFIG_USB_VENDOR_REQ_MUTEX -#endif - #define DYNAMIC_CAMID_ALLOC #ifndef CONFIG_RTW_HIQ_FILTER -- 2.20.1 From fabioaiuto83 at gmail.com Tue Mar 16 15:32:15 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 16:32:15 +0100 Subject: [PATCH 08/12] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_SINGLE_RECV_BUF In-Reply-To: References: Message-ID: <8e86b8adb1dcec67a7d437a362105bb96f370686.1615907632.git.fabioaiuto83@gmail.com> remove conditional code blocks checked by unused CONFIG_SINGLE_RECV_BUF cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/include/rtw_recv.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h index 0a56c3a66ee8..acd7a7714740 100644 --- a/drivers/staging/rtl8723bs/include/rtw_recv.h +++ b/drivers/staging/rtl8723bs/include/rtw_recv.h @@ -7,13 +7,9 @@ #ifndef _RTW_RECV_H_ #define _RTW_RECV_H_ - #ifdef CONFIG_SINGLE_RECV_BUF - #define NR_RECVBUFF (1) - #else - #define NR_RECVBUFF (8) - #endif /* CONFIG_SINGLE_RECV_BUF */ +#define NR_RECVBUFF (8) - #define NR_PREALLOC_RECV_SKB (8) +#define NR_PREALLOC_RECV_SKB (8) #define NR_RECVFRAME 256 -- 2.20.1 From fabioaiuto83 at gmail.com Tue Mar 16 15:32:30 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 16:32:30 +0100 Subject: [PATCH 09/12] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_RX_INDICATE_QUEUE In-Reply-To: References: Message-ID: <0f677a975f92b38f6ad1ff21c1006855a075692b.1615907632.git.fabioaiuto83@gmail.com> remove conditional code blocks checked by unused CONFIG_RX_INDICATE_QUEUE cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/include/rtw_recv.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h index acd7a7714740..3443cb7d0467 100644 --- a/drivers/staging/rtl8723bs/include/rtw_recv.h +++ b/drivers/staging/rtl8723bs/include/rtw_recv.h @@ -226,10 +226,6 @@ struct recv_priv { struct tasklet_struct recv_tasklet; struct sk_buff_head free_recv_skb_queue; struct sk_buff_head rx_skb_queue; -#ifdef CONFIG_RX_INDICATE_QUEUE - struct task rx_indicate_tasklet; - struct ifqueue rx_indicate_queue; -#endif /* CONFIG_RX_INDICATE_QUEUE */ u8 *pallocated_recv_buf; u8 *precv_buf; /* 4 alignment */ -- 2.20.1 From fabioaiuto83 at gmail.com Tue Mar 16 15:32:47 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 16:32:47 +0100 Subject: [PATCH 10/12] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_BSD_RX_USE_MBUF In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_BSD_RX_USE_MBUF cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/include/rtw_recv.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h index 3443cb7d0467..b298ec121ee9 100644 --- a/drivers/staging/rtl8723bs/include/rtw_recv.h +++ b/drivers/staging/rtl8723bs/include/rtw_recv.h @@ -317,13 +317,8 @@ struct recv_buf { */ struct recv_frame_hdr { struct list_head list; -#ifndef CONFIG_BSD_RX_USE_MBUF struct sk_buff *pkt; struct sk_buff *pkt_newalloc; -#else /* CONFIG_BSD_RX_USE_MBUF */ - struct sk_buff *pkt; - struct sk_buff *pkt_newalloc; -#endif /* CONFIG_BSD_RX_USE_MBUF */ struct adapter *adapter; -- 2.20.1 From fabioaiuto83 at gmail.com Tue Mar 16 15:33:00 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 16:33:00 +0100 Subject: [PATCH 11/12] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_R871X_TEST In-Reply-To: References: Message-ID: <108837d49bfc158ba9ffa21a06c31a9a0e7fba97.1615907632.git.fabioaiuto83@gmail.com> remove conditional code blocks checked by unused CONFIG_R871X_TEST cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/include/osdep_intf.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/osdep_intf.h b/drivers/staging/rtl8723bs/include/osdep_intf.h index aa4337686183..5ad85416c598 100644 --- a/drivers/staging/rtl8723bs/include/osdep_intf.h +++ b/drivers/staging/rtl8723bs/include/osdep_intf.h @@ -35,12 +35,6 @@ The protection mechanism is through the pending queue. struct mutex ioctl_mutex; }; - -#ifdef CONFIG_R871X_TEST -int rtw_start_pseudo_adhoc(struct adapter *padapter); -int rtw_stop_pseudo_adhoc(struct adapter *padapter); -#endif - struct dvobj_priv *devobj_init(void); void devobj_deinit(struct dvobj_priv *pdvobj); -- 2.20.1 From fabioaiuto83 at gmail.com Tue Mar 16 15:33:18 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Tue, 16 Mar 2021 16:33:18 +0100 Subject: [PATCH 12/12] staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_MULTI_VIR_IFACES In-Reply-To: References: Message-ID: remove conditional code blocks checked by unused CONFIG_MULTI_VIR_IFACES cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/include/drv_types.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h index 9c0e7b6946f8..30bf7fc0994d 100644 --- a/drivers/staging/rtl8723bs/include/drv_types.h +++ b/drivers/staging/rtl8723bs/include/drv_types.h @@ -196,9 +196,6 @@ struct registry_priv { u8 RFE_Type; u8 check_fw_ps; -#ifdef CONFIG_MULTI_VIR_IFACES - u8 ext_iface_num;/* primary/secondary iface is excluded */ -#endif u8 qos_opt_enable; u8 hiq_filter; -- 2.20.1 From udupa.anish at gmail.com Tue Mar 16 15:56:34 2021 From: udupa.anish at gmail.com (Anish Udupa) Date: Tue, 16 Mar 2021 21:26:34 +0530 Subject: [PATCH] drivers: staging: qlge: Fixed an alignment issue. Message-ID: The * of the comment was not aligned properly. Ran checkpatch and found the warning. Resolved it in this patch. Signed-off-by: Anish Udupa --- drivers/staging/qlge/qlge_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 5516be3af898..bfd7217f3953 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -3816,7 +3816,7 @@ static int qlge_adapter_down(struct qlge_adapter *qdev) qlge_tx_ring_clean(qdev); /* Call netif_napi_del() from common point. - */ + */ for (i = 0; i < qdev->rss_ring_count; i++) netif_napi_del(&qdev->rx_ring[i].napi); -- 2.17.1 From ribalda at chromium.org Tue Mar 16 17:50:20 2021 From: ribalda at chromium.org (Ricardo Ribalda) Date: Tue, 16 Mar 2021 18:50:20 +0100 Subject: [PATCH v2 1/2] media: staging/intel-ipu3: Fix memory leak in imu_fmt In-Reply-To: <34c90095-bcbf-5530-786a-e709cc493fa9@linux.intel.com> References: <20210315123406.1523607-1-ribalda@chromium.org> <34c90095-bcbf-5530-786a-e709cc493fa9@linux.intel.com> Message-ID: Hi Bingbu Thanks for your review On Tue, Mar 16, 2021 at 12:29 PM Bingbu Cao wrote: > > Hi, Ricardo > > Thanks for your patch. > It looks fine for me, do you mind squash 2 patchsets into 1 commit? Are you sure? There are two different issues that we are solving. Best regards! > > On 3/15/21 8:34 PM, Ricardo Ribalda wrote: > > We are losing the reference to an allocated memory if try. Change the > > order of the check to avoid that. > > > > Cc: stable at vger.kernel.org > > Fixes: 6d5f26f2e045 ("media: staging/intel-ipu3-v4l: reduce kernel stack usage") > > Signed-off-by: Ricardo Ribalda > > --- > > drivers/staging/media/ipu3/ipu3-v4l2.c | 11 +++++++---- > > 1 file changed, 7 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c > > index 60aa02eb7d2a..35a74d99322f 100644 > > --- a/drivers/staging/media/ipu3/ipu3-v4l2.c > > +++ b/drivers/staging/media/ipu3/ipu3-v4l2.c > > @@ -693,6 +693,13 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, > > if (inode == IMGU_NODE_STAT_3A || inode == IMGU_NODE_PARAMS) > > continue; > > > > + /* CSS expects some format on OUT queue */ > > + if (i != IPU3_CSS_QUEUE_OUT && > > + !imgu_pipe->nodes[inode].enabled) { > > + fmts[i] = NULL; > > + continue; > > + } > > + > > if (try) { > > fmts[i] = kmemdup(&imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp, > > sizeof(struct v4l2_pix_format_mplane), > > @@ -705,10 +712,6 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, > > fmts[i] = &imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp; > > } > > > > - /* CSS expects some format on OUT queue */ > > - if (i != IPU3_CSS_QUEUE_OUT && > > - !imgu_pipe->nodes[inode].enabled) > > - fmts[i] = NULL; > > } > > > > if (!try) { > > > > -- > Best regards, > Bingbu Cao -- Ricardo Ribalda From eantoranz at gmail.com Tue Mar 16 18:17:35 2021 From: eantoranz at gmail.com (Edmundo Carmona Antoranz) Date: Tue, 16 Mar 2021 12:17:35 -0600 Subject: [PATCH] staging: vt665x: fix alignment constraints Message-ID: <20210316181736.2553318-1-eantoranz@gmail.com> Removing 2 instances of alignment warnings drivers/staging/vt6655/rxtx.h:153:1: warning: alignment 1 of ?struct vnt_cts? is less than 2 [-Wpacked-not-aligned] drivers/staging/vt6655/rxtx.h:163:1: warning: alignment 1 of ?struct vnt_cts_fb? is less than 2 [-Wpacked-not-aligned] The root cause seems to be that _because_ struct ieee80211_cts is marked as __aligned(2), this requires any encapsulating struct to also have an alignment of 2. Fixes: 2faf12c57efe ("staging: vt665x: fix alignment constraints") Signed-off-by: Edmundo Carmona Antoranz --- drivers/staging/vt6655/rxtx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h index e7061d383306..c3c2c1566882 100644 --- a/drivers/staging/vt6655/rxtx.h +++ b/drivers/staging/vt6655/rxtx.h @@ -150,7 +150,7 @@ struct vnt_cts { u16 reserved; struct ieee80211_cts data; u16 reserved2; -} __packed; +} __packed __aligned(2); struct vnt_cts_fb { struct vnt_phy_field b; @@ -160,7 +160,7 @@ struct vnt_cts_fb { __le16 cts_duration_ba_f1; struct ieee80211_cts data; u16 reserved2; -} __packed; +} __packed __aligned(2); struct vnt_tx_fifo_head { u8 tx_key[WLAN_KEY_LEN_CCMP]; -- 2.30.2 From arnd at arndb.de Tue Mar 16 18:30:34 2021 From: arnd at arndb.de (Arnd Bergmann) Date: Tue, 16 Mar 2021 19:30:34 +0100 Subject: [PATCH] staging: vt665x: fix alignment constraints In-Reply-To: <20210316181736.2553318-1-eantoranz@gmail.com> References: <20210316181736.2553318-1-eantoranz@gmail.com> Message-ID: On Tue, Mar 16, 2021 at 7:17 PM Edmundo Carmona Antoranz wrote: > > Removing 2 instances of alignment warnings > > drivers/staging/vt6655/rxtx.h:153:1: warning: alignment 1 of ?struct vnt_cts? is less than 2 [-Wpacked-not-aligned] > drivers/staging/vt6655/rxtx.h:163:1: warning: alignment 1 of ?struct vnt_cts_fb? is less than 2 [-Wpacked-not-aligned] > > The root cause seems to be that _because_ struct ieee80211_cts is marked as __aligned(2), > this requires any encapsulating struct to also have an alignment of 2. > > Fixes: 2faf12c57efe ("staging: vt665x: fix alignment constraints") > Signed-off-by: Edmundo Carmona Antoranz Reviewed-by: Arnd Bergmann From ztong0001 at gmail.com Tue Mar 16 22:42:26 2021 From: ztong0001 at gmail.com (Tong Zhang) Date: Tue, 16 Mar 2021 18:42:26 -0400 Subject: [PATCH] staging: comedi: das800: fix request_irq() warn In-Reply-To: <92b7c57b-b645-9965-8157-4ca76a803cba@mev.co.uk> References: <92b7c57b-b645-9965-8157-4ca76a803cba@mev.co.uk> Message-ID: <20210316224227.348310-1-ztong0001@gmail.com> request_irq() wont accept a name which contains slash so we need to repalce it with something else -- otherwise it will trigger a warning and the entry in /proc/irq/ will not be created since the .name might be used by userspace and we don't want to break userspace, so we are changing the parameters passed to request_irq() Suggested-by: Ian Abbott Signed-off-by: Tong Zhang --- drivers/staging/comedi/drivers/das800.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c index 2881808d6606..bc08324f422f 100644 --- a/drivers/staging/comedi/drivers/das800.c +++ b/drivers/staging/comedi/drivers/das800.c @@ -668,7 +668,7 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = board->name; if (irq > 1 && irq <= 7) { - ret = request_irq(irq, das800_interrupt, 0, dev->board_name, + ret = request_irq(irq, das800_interrupt, 0, "das800", dev); if (ret == 0) dev->irq = irq; -- 2.25.1 From ztong0001 at gmail.com Tue Mar 16 22:42:48 2021 From: ztong0001 at gmail.com (Tong Zhang) Date: Tue, 16 Mar 2021 18:42:48 -0400 Subject: [PATCH] staging: comedi: replace slash in name In-Reply-To: <92b7c57b-b645-9965-8157-4ca76a803cba@mev.co.uk> References: <20210314035757.2740146-1-ztong0001@gmail.com> <5d7a5e1c-35ab-58cb-ebcd-da5b280c802e@mev.co.uk> <858341a6-c105-1440-aa4d-ea0217f2ec89@mev.co.uk> <92b7c57b-b645-9965-8157-4ca76a803cba@mev.co.uk> Message-ID: On Tue, Mar 16, 2021 at 6:37 AM Ian Abbott wrote: > > Thanks. I think the only other Comedi driver with the same problem is > "drivers/staging/comedi/drivers/das800.c". It passes dev->board_name as > the name argument of request_irq(), but that is "cio-das802/16" for one > of the boards supported by the driver. > Thanks Ian, I think you are right, das800.c also shares the same issue. I have sent a patch for das800.c as well according to your comments. Best, - Tong From lkp at intel.com Wed Mar 17 00:41:44 2021 From: lkp at intel.com (kernel test robot) Date: Wed, 17 Mar 2021 08:41:44 +0800 Subject: [staging:staging-linus] BUILD SUCCESS d2d106fe3badfc3bf0dd3899d1c3f210c7203eab Message-ID: <60515048.CUf7IX7eZwWGrqOK%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-linus branch HEAD: d2d106fe3badfc3bf0dd3899d1c3f210c7203eab staging: comedi: cb_pcidas64: fix request_irq() warn elapsed time: 723m configs tested: 140 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig x86_64 allyesconfig riscv allmodconfig i386 allyesconfig riscv allyesconfig arm socfpga_defconfig m68k mvme16x_defconfig sparc alldefconfig powerpc currituck_defconfig arm multi_v5_defconfig sh se7780_defconfig powerpc tqm8541_defconfig arm eseries_pxa_defconfig m68k q40_defconfig m68k m5407c3_defconfig mips allmodconfig arm vt8500_v6_v7_defconfig sh se7722_defconfig m68k apollo_defconfig sh espt_defconfig arm footbridge_defconfig powerpc taishan_defconfig arm hackkit_defconfig arc allyesconfig arm gemini_defconfig sh j2_defconfig arm vf610m4_defconfig powerpc pmac32_defconfig sh se7750_defconfig h8300 edosk2674_defconfig openrisc or1ksim_defconfig sh se7705_defconfig h8300 h8s-sim_defconfig mips bcm47xx_defconfig ia64 alldefconfig nios2 3c120_defconfig parisc generic-32bit_defconfig powerpc ppc6xx_defconfig microblaze mmu_defconfig mips gcw0_defconfig mips decstation_defconfig arm omap1_defconfig powerpc ppc64_defconfig powerpc mpc834x_mds_defconfig arm mps2_defconfig powerpc pcm030_defconfig arm bcm2835_defconfig mips rm200_defconfig ia64 tiger_defconfig arm keystone_defconfig sh rsk7201_defconfig sh sdk7786_defconfig sh se7712_defconfig powerpc storcenter_defconfig powerpc mpc8315_rdb_defconfig xtensa generic_kc705_defconfig sh edosk7760_defconfig openrisc defconfig powerpc bamboo_defconfig powerpc mpc85xx_cds_defconfig powerpc mpc832x_mds_defconfig powerpc mpc7448_hpc2_defconfig riscv rv32_defconfig arm aspeed_g4_defconfig i386 alldefconfig powerpc mpc8540_ads_defconfig um i386_defconfig s390 zfcpdump_defconfig arc axs103_smp_defconfig powerpc g5_defconfig mips maltaup_xpa_defconfig mips decstation_r4k_defconfig powerpc makalu_defconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig nds32 allnoconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig sparc allyesconfig sparc defconfig i386 tinyconfig i386 defconfig mips allyesconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a001-20210316 i386 randconfig-a005-20210316 i386 randconfig-a002-20210316 i386 randconfig-a003-20210316 i386 randconfig-a004-20210316 i386 randconfig-a006-20210316 x86_64 randconfig-a011-20210316 x86_64 randconfig-a016-20210316 x86_64 randconfig-a013-20210316 x86_64 randconfig-a014-20210316 x86_64 randconfig-a015-20210316 x86_64 randconfig-a012-20210316 i386 randconfig-a013-20210316 i386 randconfig-a016-20210316 i386 randconfig-a011-20210316 i386 randconfig-a012-20210316 i386 randconfig-a015-20210316 i386 randconfig-a014-20210316 riscv nommu_k210_defconfig riscv nommu_virt_defconfig riscv allnoconfig riscv defconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a006-20210316 x86_64 randconfig-a001-20210316 x86_64 randconfig-a005-20210316 x86_64 randconfig-a004-20210316 x86_64 randconfig-a003-20210316 x86_64 randconfig-a002-20210316 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From sashal at kernel.org Wed Mar 17 00:55:11 2021 From: sashal at kernel.org (Sasha Levin) Date: Tue, 16 Mar 2021 20:55:11 -0400 Subject: [PATCH AUTOSEL 5.11 37/61] staging: rtl8192e: fix kconfig dependency on CRYPTO In-Reply-To: <20210317005536.724046-1-sashal@kernel.org> References: <20210317005536.724046-1-sashal@kernel.org> Message-ID: <20210317005536.724046-37-sashal@kernel.org> From: Julian Braha [ Upstream commit 7c36194558cf49a86a53b5f60db8046c5e3013ae ] When RTLLIB_CRYPTO_TKIP is enabled and CRYPTO is disabled, Kbuild gives the following warning: WARNING: unmet direct dependencies detected for CRYPTO_MICHAEL_MIC Depends on [n]: CRYPTO [=n] Selected by [m]: - RTLLIB_CRYPTO_TKIP [=m] && STAGING [=y] && RTLLIB [=m] WARNING: unmet direct dependencies detected for CRYPTO_LIB_ARC4 Depends on [n]: CRYPTO [=n] Selected by [m]: - RTLLIB_CRYPTO_TKIP [=m] && STAGING [=y] && RTLLIB [=m] - RTLLIB_CRYPTO_WEP [=m] && STAGING [=y] && RTLLIB [=m] This is because RTLLIB_CRYPTO_TKIP selects CRYPTO_MICHAEL_MIC and CRYPTO_LIB_ARC4, without depending on or selecting CRYPTO, despite those config options being subordinate to CRYPTO. Acked-by: Randy Dunlap Signed-off-by: Julian Braha Link: https://lore.kernel.org/r/20210222180607.399753-1-julianbraha at gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/rtl8192e/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/rtl8192e/Kconfig b/drivers/staging/rtl8192e/Kconfig index 03fcc23516fd..6e7d84ac06f5 100644 --- a/drivers/staging/rtl8192e/Kconfig +++ b/drivers/staging/rtl8192e/Kconfig @@ -26,6 +26,7 @@ config RTLLIB_CRYPTO_CCMP config RTLLIB_CRYPTO_TKIP tristate "Support for rtllib TKIP crypto" depends on RTLLIB + select CRYPTO select CRYPTO_LIB_ARC4 select CRYPTO_MICHAEL_MIC default y -- 2.30.1 From sashal at kernel.org Wed Mar 17 00:56:34 2021 From: sashal at kernel.org (Sasha Levin) Date: Tue, 16 Mar 2021 20:56:34 -0400 Subject: [PATCH AUTOSEL 5.10 35/54] staging: rtl8192e: fix kconfig dependency on CRYPTO In-Reply-To: <20210317005654.724862-1-sashal@kernel.org> References: <20210317005654.724862-1-sashal@kernel.org> Message-ID: <20210317005654.724862-35-sashal@kernel.org> From: Julian Braha [ Upstream commit 7c36194558cf49a86a53b5f60db8046c5e3013ae ] When RTLLIB_CRYPTO_TKIP is enabled and CRYPTO is disabled, Kbuild gives the following warning: WARNING: unmet direct dependencies detected for CRYPTO_MICHAEL_MIC Depends on [n]: CRYPTO [=n] Selected by [m]: - RTLLIB_CRYPTO_TKIP [=m] && STAGING [=y] && RTLLIB [=m] WARNING: unmet direct dependencies detected for CRYPTO_LIB_ARC4 Depends on [n]: CRYPTO [=n] Selected by [m]: - RTLLIB_CRYPTO_TKIP [=m] && STAGING [=y] && RTLLIB [=m] - RTLLIB_CRYPTO_WEP [=m] && STAGING [=y] && RTLLIB [=m] This is because RTLLIB_CRYPTO_TKIP selects CRYPTO_MICHAEL_MIC and CRYPTO_LIB_ARC4, without depending on or selecting CRYPTO, despite those config options being subordinate to CRYPTO. Acked-by: Randy Dunlap Signed-off-by: Julian Braha Link: https://lore.kernel.org/r/20210222180607.399753-1-julianbraha at gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/rtl8192e/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/rtl8192e/Kconfig b/drivers/staging/rtl8192e/Kconfig index 03fcc23516fd..6e7d84ac06f5 100644 --- a/drivers/staging/rtl8192e/Kconfig +++ b/drivers/staging/rtl8192e/Kconfig @@ -26,6 +26,7 @@ config RTLLIB_CRYPTO_CCMP config RTLLIB_CRYPTO_TKIP tristate "Support for rtllib TKIP crypto" depends on RTLLIB + select CRYPTO select CRYPTO_LIB_ARC4 select CRYPTO_MICHAEL_MIC default y -- 2.30.1 From lkp at intel.com Wed Mar 17 01:07:33 2021 From: lkp at intel.com (kernel test robot) Date: Wed, 17 Mar 2021 09:07:33 +0800 Subject: [staging:staging-testing] BUILD SUCCESS 918ce05bbe52df43849a803010b4d2bcd31ea69c Message-ID: <60515655.sQz9YtD3qfxoAwN3%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-testing branch HEAD: 918ce05bbe52df43849a803010b4d2bcd31ea69c staging: gasket: remove it from the kernel elapsed time: 721m configs tested: 160 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig x86_64 allyesconfig riscv allmodconfig i386 allyesconfig riscv allyesconfig arm socfpga_defconfig m68k mvme16x_defconfig sparc alldefconfig powerpc currituck_defconfig arm multi_v5_defconfig sh se7780_defconfig powerpc tqm8541_defconfig arm eseries_pxa_defconfig m68k q40_defconfig m68k m5407c3_defconfig mips allmodconfig arm vt8500_v6_v7_defconfig sh se7722_defconfig m68k apollo_defconfig sh espt_defconfig arm footbridge_defconfig powerpc taishan_defconfig arm hackkit_defconfig arc allyesconfig arm gemini_defconfig sh j2_defconfig arm vf610m4_defconfig powerpc pmac32_defconfig powerpc akebono_defconfig mips loongson1b_defconfig arc haps_hs_defconfig arm u8500_defconfig sh se7705_defconfig h8300 h8s-sim_defconfig mips bcm47xx_defconfig ia64 alldefconfig nios2 3c120_defconfig parisc generic-32bit_defconfig powerpc ppc6xx_defconfig microblaze mmu_defconfig mips gcw0_defconfig mips decstation_defconfig arm omap1_defconfig powerpc ppc64_defconfig powerpc mpc834x_mds_defconfig arm mps2_defconfig csky alldefconfig powerpc storcenter_defconfig powerpc pcm030_defconfig arm bcm2835_defconfig mips rm200_defconfig ia64 tiger_defconfig arm keystone_defconfig sh rsk7201_defconfig mips ip27_defconfig sh r7785rp_defconfig arm lubbock_defconfig mips maltaup_xpa_defconfig arm spear13xx_defconfig sh sdk7786_defconfig sh se7712_defconfig powerpc mpc8315_rdb_defconfig xtensa generic_kc705_defconfig sh edosk7760_defconfig openrisc defconfig powerpc bamboo_defconfig powerpc mpc85xx_cds_defconfig powerpc bluestone_defconfig mips tb0219_defconfig arm assabet_defconfig mips pistachio_defconfig mips decstation_64_defconfig powerpc mpc832x_mds_defconfig powerpc mpc7448_hpc2_defconfig riscv rv32_defconfig arm aspeed_g4_defconfig i386 alldefconfig powerpc mpc8540_ads_defconfig um i386_defconfig mips bigsur_defconfig powerpc ep8248e_defconfig powerpc cm5200_defconfig mips loongson1c_defconfig sparc64 defconfig s390 zfcpdump_defconfig arc axs103_smp_defconfig powerpc g5_defconfig mips decstation_r4k_defconfig powerpc makalu_defconfig powerpc pseries_defconfig arm neponset_defconfig arm trizeps4_defconfig sh edosk7705_defconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig nds32 allnoconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig sparc allyesconfig sparc defconfig i386 tinyconfig i386 defconfig mips allyesconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a001-20210316 i386 randconfig-a005-20210316 i386 randconfig-a002-20210316 i386 randconfig-a003-20210316 i386 randconfig-a004-20210316 i386 randconfig-a006-20210316 x86_64 randconfig-a011-20210316 x86_64 randconfig-a016-20210316 x86_64 randconfig-a013-20210316 x86_64 randconfig-a014-20210316 x86_64 randconfig-a015-20210316 x86_64 randconfig-a012-20210316 i386 randconfig-a013-20210316 i386 randconfig-a016-20210316 i386 randconfig-a011-20210316 i386 randconfig-a012-20210316 i386 randconfig-a015-20210316 i386 randconfig-a014-20210316 riscv nommu_k210_defconfig riscv nommu_virt_defconfig riscv allnoconfig riscv defconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a006-20210316 x86_64 randconfig-a001-20210316 x86_64 randconfig-a005-20210316 x86_64 randconfig-a004-20210316 x86_64 randconfig-a003-20210316 x86_64 randconfig-a002-20210316 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From zhaoxiao at uniontech.com Wed Mar 17 03:32:19 2021 From: zhaoxiao at uniontech.com (zhaoxiao) Date: Wed, 17 Mar 2021 11:32:19 +0800 Subject: [PATCH v3] Staging: rtl8192u: fixed a whitespace coding style issue Message-ID: <20210317033219.621-1-zhaoxiao@uniontech.com> Removed additional whitespaces in the r8192U_wx.c file. Signed-off-by: zhaoxiao --- v3: add the specify a description of why the patch is needed. drivers/staging/rtl8192u/r8192U_wx.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index 5211b2005763..e916cf3ea74c 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -879,12 +879,10 @@ static iw_handler r8192_wx_handlers[] = { static const struct iw_priv_args r8192_private_args[] = { - { SIOCIWFIRSTPRIV + 0x0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc" }, - { SIOCIWFIRSTPRIV + 0x1, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan" @@ -897,9 +895,7 @@ static const struct iw_priv_args r8192_private_args[] = { { SIOCIWFIRSTPRIV + 0x3, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset" - } - }; static iw_handler r8192_private_handler[] = { -- 2.20.1 From leon at kernel.org Wed Mar 17 04:25:54 2021 From: leon at kernel.org (Leon Romanovsky) Date: Wed, 17 Mar 2021 06:25:54 +0200 Subject: [PATCH v5 03/24] wfx: add Makefile/Kconfig In-Reply-To: <1718324.Ee3sdLpQUQ@pc-42> References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> <20210315132501.441681-4-Jerome.Pouiller@silabs.com> <1718324.Ee3sdLpQUQ@pc-42> Message-ID: On Mon, Mar 15, 2021 at 05:21:35PM +0100, J?r?me Pouiller wrote: > Hi Leon, > > On Monday 15 March 2021 16:11:52 CET Leon Romanovsky wrote: > > On Mon, Mar 15, 2021 at 02:24:40PM +0100, Jerome Pouiller wrote: > > > From: J?r?me Pouiller > > > > > > Signed-off-by: J?r?me Pouiller > > > --- > > > drivers/net/wireless/silabs/wfx/Kconfig | 12 +++++++++++ > > > drivers/net/wireless/silabs/wfx/Makefile | 26 ++++++++++++++++++++++++ > > > 2 files changed, 38 insertions(+) > > > create mode 100644 drivers/net/wireless/silabs/wfx/Kconfig > > > create mode 100644 drivers/net/wireless/silabs/wfx/Makefile > > > > > > diff --git a/drivers/net/wireless/silabs/wfx/Kconfig b/drivers/net/wireless/silabs/wfx/Kconfig > > > new file mode 100644 > > > index 000000000000..3be4b1e735e1 > > > --- /dev/null > > > +++ b/drivers/net/wireless/silabs/wfx/Kconfig > > > @@ -0,0 +1,12 @@ > > > +config WFX > > > + tristate "Silicon Labs wireless chips WF200 and further" > > > + depends on MAC80211 > > > + depends on MMC || !MMC # do not allow WFX=y if MMC=m > > > + depends on (SPI || MMC) > > > + help > > > + This is a driver for Silicons Labs WFxxx series (WF200 and further) > > > + chipsets. This chip can be found on SPI or SDIO buses. > > > + > > > + Silabs does not use a reliable SDIO vendor ID. So, to avoid conflicts, > > > + the driver won't probe the device if it is not also declared in the > > > + Device Tree. > > > diff --git a/drivers/net/wireless/silabs/wfx/Makefile b/drivers/net/wireless/silabs/wfx/Makefile > > > new file mode 100644 > > > index 000000000000..f399962c8619 > > > --- /dev/null > > > +++ b/drivers/net/wireless/silabs/wfx/Makefile > > > @@ -0,0 +1,26 @@ > > > +# SPDX-License-Identifier: GPL-2.0 > > > + > > > +# Necessary for CREATE_TRACE_POINTS > > > +CFLAGS_debug.o = -I$(src) > > > > I wonder if it is still relevant outside of the staging tree. > > It seems this pattern is common in the main tree. You suggest to relocate > trace.h to include/trace/events? No, leave it as it. Sorry for the noise. Thanks > > -- > J?r?me Pouiller > > From dan.carpenter at oracle.com Wed Mar 17 05:14:26 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Wed, 17 Mar 2021 08:14:26 +0300 Subject: [PATCH] staging: comedi: das800: fix request_irq() warn In-Reply-To: <20210316224227.348310-1-ztong0001@gmail.com> References: <92b7c57b-b645-9965-8157-4ca76a803cba@mev.co.uk> <20210316224227.348310-1-ztong0001@gmail.com> Message-ID: <20210317051426.GX2087@kadam> On Tue, Mar 16, 2021 at 06:42:26PM -0400, Tong Zhang wrote: > request_irq() wont accept a name which contains slash so we need to > repalce it with something else -- otherwise it will trigger a warning ^^^^^^^ I don't normally comment on spelling mistakes in the commit message but you're copy and pasting "repalce" over and over... > and the entry in /proc/irq/ will not be created > since the .name might be used by userspace and we don't want to break > userspace, so we are changing the parameters passed to request_irq() regards, dan carpenter From joe at perches.com Wed Mar 17 03:47:53 2021 From: joe at perches.com (Joe Perches) Date: Tue, 16 Mar 2021 20:47:53 -0700 Subject: [PATCH] staging: rtl8723bs/core: add spaces between operators In-Reply-To: <20210316120500.351-1-maqianga@uniontech.com> References: <20210316120500.351-1-maqianga@uniontech.com> Message-ID: On Tue, 2021-03-16 at 20:05 +0800, Qiang Ma wrote: > Add spaces between operators for a better readability > in function 'rtw_seccalctkipmic'. Perhaps better would be to refactor it a bit to follow the comments. Something like: --- drivers/staging/rtl8723bs/core/rtw_security.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c index a311595deafb..a30e1fa717af 100644 --- a/drivers/staging/rtl8723bs/core/rtw_security.c +++ b/drivers/staging/rtl8723bs/core/rtw_security.c @@ -405,30 +405,26 @@ void rtw_secgetmic(struct mic_data *pmicdata, u8 *dst) void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_code, u8 pri) { - struct mic_data micdata; u8 priority[4] = {0x0, 0x0, 0x0, 0x0}; + int da_offset; + int sa_offset; rtw_secmicsetkey(&micdata, key); priority[0] = pri; /* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */ - if (header[1]&1) { /* ToDS == 1 */ - rtw_secmicappend(&micdata, &header[16], 6); /* DA */ - if (header[1]&2) /* From Ds == 1 */ - rtw_secmicappend(&micdata, &header[24], 6); - else - rtw_secmicappend(&micdata, &header[10], 6); - } else { /* ToDS == 0 */ - rtw_secmicappend(&micdata, &header[4], 6); /* DA */ - if (header[1]&2) /* From Ds == 1 */ - rtw_secmicappend(&micdata, &header[16], 6); - else - rtw_secmicappend(&micdata, &header[10], 6); + if (header[1] & 1) { /* ToDS == 1 */ + da_offset = 16; + sa_offset = (header[1] & 2) ? 24 : 10; + } else { /* ToDS == 0 */ + da_offset = 4; + sa_offset = (header[1] & 2) ? 16 : 10; } + rtw_secmicappend(&micdata, &header[da_offset], 6); /* DA */ + rtw_secmicappend(&micdata, &header[sa_offset], 6); /* SA */ rtw_secmicappend(&micdata, &priority[0], 4); - rtw_secmicappend(&micdata, data, data_len); rtw_secgetmic(&micdata, mic_code); From bingbu.cao at linux.intel.com Wed Mar 17 06:47:48 2021 From: bingbu.cao at linux.intel.com (Bingbu Cao) Date: Wed, 17 Mar 2021 14:47:48 +0800 Subject: [PATCH v2 1/2] media: staging/intel-ipu3: Fix memory leak in imu_fmt In-Reply-To: References: <20210315123406.1523607-1-ribalda@chromium.org> <34c90095-bcbf-5530-786a-e709cc493fa9@linux.intel.com> Message-ID: On 3/17/21 1:50 AM, Ricardo Ribalda wrote: > Hi Bingbu > > Thanks for your review > > On Tue, Mar 16, 2021 at 12:29 PM Bingbu Cao wrote: >> >> Hi, Ricardo >> >> Thanks for your patch. >> It looks fine for me, do you mind squash 2 patchsets into 1 commit? > > Are you sure? There are two different issues that we are solving. Oh, I see. I thought you were fixing 1 issue here. Thanks! > > Best regards! > >> >> On 3/15/21 8:34 PM, Ricardo Ribalda wrote: >>> We are losing the reference to an allocated memory if try. Change the >>> order of the check to avoid that. >>> >>> Cc: stable at vger.kernel.org >>> Fixes: 6d5f26f2e045 ("media: staging/intel-ipu3-v4l: reduce kernel stack usage") >>> Signed-off-by: Ricardo Ribalda >>> --- >>> drivers/staging/media/ipu3/ipu3-v4l2.c | 11 +++++++---- >>> 1 file changed, 7 insertions(+), 4 deletions(-) >>> >>> diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c >>> index 60aa02eb7d2a..35a74d99322f 100644 >>> --- a/drivers/staging/media/ipu3/ipu3-v4l2.c >>> +++ b/drivers/staging/media/ipu3/ipu3-v4l2.c >>> @@ -693,6 +693,13 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, >>> if (inode == IMGU_NODE_STAT_3A || inode == IMGU_NODE_PARAMS) >>> continue; >>> >>> + /* CSS expects some format on OUT queue */ >>> + if (i != IPU3_CSS_QUEUE_OUT && >>> + !imgu_pipe->nodes[inode].enabled) { >>> + fmts[i] = NULL; >>> + continue; >>> + } >>> + >>> if (try) { >>> fmts[i] = kmemdup(&imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp, >>> sizeof(struct v4l2_pix_format_mplane), >>> @@ -705,10 +712,6 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, >>> fmts[i] = &imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp; >>> } >>> >>> - /* CSS expects some format on OUT queue */ >>> - if (i != IPU3_CSS_QUEUE_OUT && >>> - !imgu_pipe->nodes[inode].enabled) >>> - fmts[i] = NULL; >>> } >>> >>> if (!try) { >>> >> >> -- >> Best regards, >> Bingbu Cao > > > -- Best regards, Bingbu Cao From dan.carpenter at oracle.com Wed Mar 17 06:52:48 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Wed, 17 Mar 2021 09:52:48 +0300 Subject: [PATCH] staging: comedi: das800: fix request_irq() warn In-Reply-To: References: <92b7c57b-b645-9965-8157-4ca76a803cba@mev.co.uk> <20210316224227.348310-1-ztong0001@gmail.com> <20210317051426.GX2087@kadam> Message-ID: <20210317065248.GW21246@kadam> On Wed, Mar 17, 2021 at 01:55:40AM -0400, Tong Zhang wrote: > Thanks for pointing that out. > Yes you are right there is a mistake. > I am a human. Human make mistakes. Therefore I make mistakes. > Yep. We all make mistakes. One thing to do is if you make a mistake then check to see if anyone else has made a similar mistake. git grep repalce If enough people make that specific mistake then consider adding it to the list of commonly mispelled words: scripts/spelling.txt I looked through the logs and it looks like someone mispells it once a year so it's probably not common enough to worry about. regards, dan carpenter From dan.carpenter at oracle.com Wed Mar 17 08:25:14 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Wed, 17 Mar 2021 11:25:14 +0300 Subject: [PATCH] drivers: staging: qlge: Fixed an alignment issue. In-Reply-To: References: Message-ID: <20210317082514.GY2087@kadam> On Tue, Mar 16, 2021 at 09:26:34PM +0530, Anish Udupa wrote: > The * of the comment was not aligned properly. Ran checkpatch and > found the warning. Resolved it in this patch. > > Signed-off-by: Anish Udupa > --- > drivers/staging/qlge/qlge_main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c > index 5516be3af898..bfd7217f3953 100644 > --- a/drivers/staging/qlge/qlge_main.c > +++ b/drivers/staging/qlge/qlge_main.c > @@ -3816,7 +3816,7 @@ static int qlge_adapter_down(struct qlge_adapter *qdev) > qlge_tx_ring_clean(qdev); > > /* Call netif_napi_del() from common point. > - */ > + */ This has already been fixed upstream. You should be working against linux-next or staging-next. https://lore.kernel.org/driverdev-devel/20210216101945.187474-1-ducheng2 at gmail.com/ regards, dan carpenter From unixbhaskar at gmail.com Wed Mar 17 09:26:24 2021 From: unixbhaskar at gmail.com (Bhaskar Chowdhury) Date: Wed, 17 Mar 2021 14:56:24 +0530 Subject: [PATCH] staging: wimax: i2400m: Mundane typo fix in the file driver.c Message-ID: <20210317092624.1138207-1-unixbhaskar@gmail.com> s/procesing/processing/ Signed-off-by: Bhaskar Chowdhury --- drivers/staging/wimax/i2400m/driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wimax/i2400m/driver.c b/drivers/staging/wimax/i2400m/driver.c index f5186458bb3d..8091106212f9 100644 --- a/drivers/staging/wimax/i2400m/driver.c +++ b/drivers/staging/wimax/i2400m/driver.c @@ -96,7 +96,7 @@ MODULE_PARM_DESC(barkers, * * This function just verifies that the header declaration and the * payload are consistent and then deals with it, either forwarding it - * to the device or procesing it locally. + * to the device or processing it locally. * * In the i2400m, messages are basically commands that will carry an * ack, so we use i2400m_msg_to_dev() and then deliver the ack back to -- 2.30.2 From fabioaiuto83 at gmail.com Wed Mar 17 09:58:12 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Wed, 17 Mar 2021 10:58:12 +0100 Subject: staging: rtl8723bs: remove unused code blocks completed? Message-ID: <20210317095812.GA2270@agape.jhs> Hi, I'm trying to search other unused code blocks: grep -r '^\(#ifdef \|#if defined(\|#ifndef \)CONFIG_' drivers/staging/rtl8723bs/ drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:#if defined(CONFIG_PM) drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:#if defined(CONFIG_PM) drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:#if defined(CONFIG_WEXT_PRIV) drivers/staging/rtl8723bs/include/drv_conf.h:#ifndef CONFIG_RTW_HIQ_FILTER drivers/staging/rtl8723bs/include/autoconf.h:#ifndef CONFIG_WIRELESS_EXT all blocks left are checked by existing defines. Could we apply this? thank you, fabio diff --git a/drivers/staging/rtl8723bs/TODO b/drivers/staging/rtl8723bs/TODO index 45065fd3fd5d..afa620ceb2d8 100644 --- a/drivers/staging/rtl8723bs/TODO +++ b/drivers/staging/rtl8723bs/TODO @@ -1,5 +1,4 @@ TODO: -- find and remove code blocks guarded by never set CONFIG_FOO defines - find and remove remaining code valid only for 5 GHz. Most of the obvious ones have been removed, but things like channel > 14 still exist. - find and remove any code for other chips that is left over From fabioaiuto83 at gmail.com Wed Mar 17 09:59:32 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Wed, 17 Mar 2021 10:59:32 +0100 Subject: staging: rtl8723bs: remove unused code blocks completed? Message-ID: <20210317095932.GA2308@agape.jhs> Hi, I'm trying to search other unused code blocks: grep -r '^\(#ifdef \|#if defined(\|#ifndef \)CONFIG_' drivers/staging/rtl8723bs/ drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:#if defined(CONFIG_PM) drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:#if defined(CONFIG_PM) drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:#if defined(CONFIG_WEXT_PRIV) drivers/staging/rtl8723bs/include/drv_conf.h:#ifndef CONFIG_RTW_HIQ_FILTER drivers/staging/rtl8723bs/include/autoconf.h:#ifndef CONFIG_WIRELESS_EXT all blocks left are checked by existing defines. Could we apply this? thank you, fabio diff --git a/drivers/staging/rtl8723bs/TODO b/drivers/staging/rtl8723bs/TODO index 45065fd3fd5d..afa620ceb2d8 100644 --- a/drivers/staging/rtl8723bs/TODO +++ b/drivers/staging/rtl8723bs/TODO @@ -1,5 +1,4 @@ TODO: -- find and remove code blocks guarded by never set CONFIG_FOO defines - find and remove remaining code valid only for 5 GHz. Most of the obvious ones have been removed, but things like channel > 14 still exist. - find and remove any code for other chips that is left over From gregkh at linuxfoundation.org Wed Mar 17 10:02:13 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Wed, 17 Mar 2021 11:02:13 +0100 Subject: staging: rtl8723bs: remove unused code blocks completed? In-Reply-To: <20210317095932.GA2308@agape.jhs> References: <20210317095932.GA2308@agape.jhs> Message-ID: On Wed, Mar 17, 2021 at 10:59:32AM +0100, Fabio Aiuto wrote: > Hi, > > I'm trying to search other unused code blocks: > > grep -r '^\(#ifdef \|#if defined(\|#ifndef \)CONFIG_' drivers/staging/rtl8723bs/ > > drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:#if defined(CONFIG_PM) > drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:#if defined(CONFIG_PM) > drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:#if defined(CONFIG_WEXT_PRIV) > drivers/staging/rtl8723bs/include/drv_conf.h:#ifndef CONFIG_RTW_HIQ_FILTER > drivers/staging/rtl8723bs/include/autoconf.h:#ifndef CONFIG_WIRELESS_EXT > > all blocks left are checked by existing defines. > Could we apply this? Sure, looks good, submit this as a real patch with this information in the changelog and I"ll be glad to take it. thanks, greg k-h From fabioaiuto83 at gmail.com Wed Mar 17 10:51:44 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Wed, 17 Mar 2021 11:51:44 +0100 Subject: [PATCH] staging: rtl8723bs: remove unused code blocks completed In-Reply-To: References: Message-ID: <20210317105144.3732-1-fabioaiuto83@gmail.com> Remove related item in TODO list ------------------------------------------------------- searched for other unused code blocks: grep -r '^\(#ifdef \|#if defined(\|#ifndef \)CONFIG_' \ drivers/staging/rtl8723bs/ drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:#if defined(CONFIG_PM) drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:#if defined(CONFIG_PM) drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:#if defined(CONFIG_WEXT_PRIV) drivers/staging/rtl8723bs/include/drv_conf.h:#ifndef CONFIG_RTW_HIQ_FILTER drivers/staging/rtl8723bs/include/autoconf.h:#ifndef CONFIG_WIRELESS_EXT all blocks left are checked by existing defines. Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/TODO | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/TODO b/drivers/staging/rtl8723bs/TODO index 45065fd3fd5d..afa620ceb2d8 100644 --- a/drivers/staging/rtl8723bs/TODO +++ b/drivers/staging/rtl8723bs/TODO @@ -1,5 +1,4 @@ TODO: -- find and remove code blocks guarded by never set CONFIG_FOO defines - find and remove remaining code valid only for 5 GHz. Most of the obvious ones have been removed, but things like channel > 14 still exist. - find and remove any code for other chips that is left over -- 2.20.1 From abbotti at mev.co.uk Wed Mar 17 12:48:50 2021 From: abbotti at mev.co.uk (Ian Abbott) Date: Wed, 17 Mar 2021 12:48:50 +0000 Subject: [PATCH] staging: comedi: das800: fix request_irq() warn In-Reply-To: <20210316224227.348310-1-ztong0001@gmail.com> References: <92b7c57b-b645-9965-8157-4ca76a803cba@mev.co.uk> <20210316224227.348310-1-ztong0001@gmail.com> Message-ID: <8c65b02e-4315-153f-de2c-153862f195be@mev.co.uk> On 16/03/2021 22:42, Tong Zhang wrote: > request_irq() wont accept a name which contains slash so we need to > repalce it with something else -- otherwise it will trigger a warning > and the entry in /proc/irq/ will not be created > since the .name might be used by userspace and we don't want to break > userspace, so we are changing the parameters passed to request_irq() > > Suggested-by: Ian Abbott > Signed-off-by: Tong Zhang > --- > drivers/staging/comedi/drivers/das800.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c > index 2881808d6606..bc08324f422f 100644 > --- a/drivers/staging/comedi/drivers/das800.c > +++ b/drivers/staging/comedi/drivers/das800.c > @@ -668,7 +668,7 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it) > dev->board_name = board->name; > > if (irq > 1 && irq <= 7) { > - ret = request_irq(irq, das800_interrupt, 0, dev->board_name, > + ret = request_irq(irq, das800_interrupt, 0, "das800", > dev); > if (ret == 0) > dev->irq = irq; > Looks good (apart from the minor spelling niggle spotted by Dan Carpenter), thanks! Reviewed-by: Ian Abbott -- -=( Ian Abbott || MEV Ltd. is a company )=- -=( registered in England & Wales. Regd. number: 02862268. )=- -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=- -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=- From benjamin.gaignard at collabora.com Wed Mar 17 17:31:49 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 17 Mar 2021 18:31:49 +0100 Subject: [PATCH v5 00/13] Add HANTRO G2/HEVC decoder support for IMX8MQ Message-ID: <20210317173202.107519-1-benjamin.gaignard@collabora.com> The IMX8MQ got two VPUs but until now only G1 has been enabled. This series aim to add the second VPU (aka G2) and provide basic HEVC decoding support. To be able to decode HEVC it is needed to add/update some of the structures in the uapi. In addition of them one HANTRO dedicated control is required to inform the driver of the numbre of bits to skip at the beginning of the slice header. The hardware require to allocate few auxiliary buffers to store the references frame or tile size data. The driver has been tested with fluster test suite stream. For example with this command: ./fluster.py run -ts JCT-VC-HEVC_V1 -d GStreamer-H.265-V4L2SL-Gst1.0 This series depends of the reset rework posted here: https://www.spinics.net/lists/arm-kernel/msg878440.html Finally the both VPUs will have a node the device-tree and be independent from v4l2 point of view. A branch with all the dev is available here: https://gitlab.collabora.com/benjamin.gaignard/for-upstream/-/commits/upstream_g2_v5 version 5: - use syscon instead of VPU reset driver. - Do not break kernel/DT backward compatibility. - Add documentation for dedicated Hantro control. - Fix the remarks done by Ezequeil (typo, comments, unused function) - Run v4l2-compliance without errors (see below). - Do not add field to distinguish version, check postproc reg instead version 4: - Split the changes in hevc controls in 2 commits to make them easier to review. - Change hantro_codec_ops run() prototype to return errors - Hantro v4l2 dedicated control is now only an integer - rebase on top of VPU reset changes posted here: https://www.spinics.net/lists/arm-kernel/msg878440.html - Various fix from previous remarks - Limit the modifications in API to what the driver needs version 3: - Fix typo in Hantro v4l2 dedicated control - Add documentation for the new structures and fields - Rebased on top of media_tree for-linus-5.12-rc1 tag version 2: - remove all change related to scaling - squash commits to a coherent split - be more verbose about the added fields - fix the comments done by Ezequiel about dma_alloc_coherent usage - fix Dan's comments about control copy, reverse the test logic in tile_buffer_reallocate, rework some goto and return cases. - be more verbose about why I change the bindings - remove all sign-off expect mime since it is confusing - remove useless clocks in VPUs nodes ./v4l2-compliance -m 1 v4l2-compliance 1.21.0-4705, 64 bits, 64-bit time_t v4l2-compliance SHA: 733f7a54f79d 2021-02-03 08:25:49 Compliance test for hantro-vpu device /dev/media1: Media Driver Info: Driver name : hantro-vpu Model : hantro-vpu Serial : Bus info : platform: hantro-vpu Media version : 5.11.0 Hardware revision: 0x00000000 (0) Driver version : 5.11.0 Required ioctls: test MEDIA_IOC_DEVICE_INFO: OK test invalid ioctls: OK Allow for multiple opens: test second /dev/media1 open: OK test MEDIA_IOC_DEVICE_INFO: OK test for unlimited opens: OK Media Controller ioctls: test MEDIA_IOC_G_TOPOLOGY: OK Entities: 3 Interfaces: 1 Pads: 4 Links: 4 test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK test MEDIA_IOC_SETUP_LINK: OK Total for hantro-vpu device /dev/media1: 8, Succeeded: 8, Failed: 0, Warnings: 0 -------------------------------------------------------------------------------- Compliance test for hantro-vpu device /dev/video1: Driver Info: Driver name : hantro-vpu Card type : nxp,imx8mq-vpu-g2-dec Bus info : platform: hantro-vpu Driver version : 5.11.0 Capabilities : 0x84204000 Video Memory-to-Memory Multiplanar Streaming Extended Pix Format Device Capabilities Device Caps : 0x04204000 Video Memory-to-Memory Multiplanar Streaming Extended Pix Format Media Driver Info: Driver name : hantro-vpu Model : hantro-vpu Serial : Bus info : platform: hantro-vpu Media version : 5.11.0 Hardware revision: 0x00000000 (0) Driver version : 5.11.0 Interface Info: ID : 0x0300000c Type : V4L Video Entity Info: ID : 0x00000001 (1) Name : nxp,imx8mq-vpu-g2-dec-source Function : V4L2 I/O Pad 0x01000002 : 0: Source Link 0x02000008: to remote pad 0x1000004 of entity 'nxp,imx8mq-vpu-g2-dec-proc': Data, Enabled, Immutable Required ioctls: test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK test invalid ioctls: OK Allow for multiple opens: test second /dev/video1 open: OK test VIDIOC_QUERYCAP: OK test VIDIOC_G/S_PRIORITY: OK test for unlimited opens: OK Debug ioctls: test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported) Input ioctls: test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported) test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported) Inputs: 0 Audio Inputs: 0 Tuners: 0 Output ioctls: test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported) Outputs: 0 Audio Outputs: 0 Modulators: 0 Input/Output configuration ioctls: test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported) Control ioctls: test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK test VIDIOC_G/S_CTRL: OK test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 8 Private Controls: 1 Format ioctls: test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK test VIDIOC_TRY_FMT: OK test VIDIOC_S_FMT: OK test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported) test Composing: OK (Not Supported) test Scaling: OK (Not Supported) Codec ioctls: test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) Buffer ioctls: test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK test Requests: OK Total for hantro-vpu device /dev/video1: 46, Succeeded: 46, Failed: 0, Warnings: 0 Grand Total for hantro-vpu device /dev/media1: 54, Succeeded: 54, Failed: 0, Warnings: 0 Benjamin Benjamin Gaignard (13): dt-bindings: mfd: Add 'nxp,imx8mq-vpu-ctrl' to syscon list dt-bindings: media: nxp,imx8mq-vpu: Update the bindings for G2 support media: hantro: Use syscon instead of 'ctrl' register media: hevc: Add fields and flags for hevc PPS media: hevc: Add decode params control media: hantro: change hantro_codec_ops run prototype to return errors media: hantro: Define HEVC codec profiles and supported features media: hantro: Only use postproc when post processed formats are defined media: uapi: Add a control for HANTRO driver media: hantro: handle V4L2_PIX_FMT_HEVC_SLICE control media: hantro: Introduce G2/HEVC decoder media: hantro: IMX8M: add variant for G2/HEVC codec arm64: dts: imx8mq: Add node to G2 hardware .../bindings/media/nxp,imx8mq-vpu.yaml | 53 +- .../devicetree/bindings/mfd/syscon.yaml | 1 + .../userspace-api/media/drivers/hantro.rst | 14 + .../userspace-api/media/drivers/index.rst | 1 + .../media/v4l/ext-ctrls-codec.rst | 108 +++- .../media/v4l/vidioc-queryctrl.rst | 6 + arch/arm64/boot/dts/freescale/imx8mq.dtsi | 43 +- drivers/media/v4l2-core/v4l2-ctrls.c | 26 +- drivers/staging/media/hantro/Makefile | 2 + drivers/staging/media/hantro/hantro.h | 18 +- drivers/staging/media/hantro/hantro_drv.c | 99 ++- .../staging/media/hantro/hantro_g1_h264_dec.c | 10 +- .../media/hantro/hantro_g1_mpeg2_dec.c | 4 +- .../staging/media/hantro/hantro_g1_vp8_dec.c | 6 +- .../staging/media/hantro/hantro_g2_hevc_dec.c | 587 ++++++++++++++++++ drivers/staging/media/hantro/hantro_g2_regs.h | 198 ++++++ .../staging/media/hantro/hantro_h1_jpeg_enc.c | 4 +- drivers/staging/media/hantro/hantro_hevc.c | 324 ++++++++++ drivers/staging/media/hantro/hantro_hw.h | 69 +- .../staging/media/hantro/hantro_postproc.c | 14 + drivers/staging/media/hantro/hantro_v4l2.c | 5 +- drivers/staging/media/hantro/imx8m_vpu_hw.c | 128 +++- .../media/hantro/rk3399_vpu_hw_jpeg_enc.c | 4 +- .../media/hantro/rk3399_vpu_hw_mpeg2_dec.c | 4 +- .../media/hantro/rk3399_vpu_hw_vp8_dec.c | 6 +- drivers/staging/media/sunxi/cedrus/cedrus.c | 6 + drivers/staging/media/sunxi/cedrus/cedrus.h | 1 + .../staging/media/sunxi/cedrus/cedrus_dec.c | 2 + .../staging/media/sunxi/cedrus/cedrus_h265.c | 6 +- include/media/hevc-ctrls.h | 33 +- include/uapi/linux/v4l2-controls.h | 13 + 31 files changed, 1678 insertions(+), 117 deletions(-) create mode 100644 Documentation/userspace-api/media/drivers/hantro.rst create mode 100644 drivers/staging/media/hantro/hantro_g2_hevc_dec.c create mode 100644 drivers/staging/media/hantro/hantro_g2_regs.h create mode 100644 drivers/staging/media/hantro/hantro_hevc.c -- 2.25.1 From benjamin.gaignard at collabora.com Wed Mar 17 17:31:50 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 17 Mar 2021 18:31:50 +0100 Subject: [PATCH v5 01/13] dt-bindings: mfd: Add 'nxp, imx8mq-vpu-ctrl' to syscon list In-Reply-To: <20210317173202.107519-1-benjamin.gaignard@collabora.com> References: <20210317173202.107519-1-benjamin.gaignard@collabora.com> Message-ID: <20210317173202.107519-2-benjamin.gaignard@collabora.com> Add 'nxp,imx8mq-vpu-ctrl' in the list of possible syscon. It will used to access to the VPU control registers. Signed-off-by: Benjamin Gaignard --- Documentation/devicetree/bindings/mfd/syscon.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/mfd/syscon.yaml b/Documentation/devicetree/bindings/mfd/syscon.yaml index f14ae6da0068..ae22c4730613 100644 --- a/Documentation/devicetree/bindings/mfd/syscon.yaml +++ b/Documentation/devicetree/bindings/mfd/syscon.yaml @@ -44,6 +44,7 @@ properties: - hisilicon,peri-subctrl - microchip,sparx5-cpu-syscon - mstar,msc313-pmsleep + - nxp,imx8mq-vpu-ctrl - rockchip,px30-qos - rockchip,rk3066-qos - rockchip,rk3288-qos -- 2.25.1 From benjamin.gaignard at collabora.com Wed Mar 17 17:31:51 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 17 Mar 2021 18:31:51 +0100 Subject: [PATCH v5 02/13] dt-bindings: media: nxp, imx8mq-vpu: Update the bindings for G2 support In-Reply-To: <20210317173202.107519-1-benjamin.gaignard@collabora.com> References: <20210317173202.107519-1-benjamin.gaignard@collabora.com> Message-ID: <20210317173202.107519-3-benjamin.gaignard@collabora.com> Introducing G2 hevc video decoder lead to modify the bindings to allow to get one node per VPUs. VPUs share one hardware control block which is provided as a phandle on an syscon. Each node got now one reg and one interrupt. Add a compatible for G2 hardware block: nxp,imx8mq-vpu-g2. To be compatible with older DT the driver is still capable to use 'ctrl' reg-name even if it is deprecated now. Signed-off-by: Benjamin Gaignard --- version 5: - This version doesn't break the backward compatibilty between kernel and DT. .../bindings/media/nxp,imx8mq-vpu.yaml | 53 ++++++++++++------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.yaml b/Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.yaml index 762be3f96ce9..79502fc8bde5 100644 --- a/Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.yaml +++ b/Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.yaml @@ -15,22 +15,18 @@ description: properties: compatible: - const: nxp,imx8mq-vpu + oneOf: + - const: nxp,imx8mq-vpu + - const: nxp,imx8mq-vpu-g2 reg: - maxItems: 3 - - reg-names: - items: - - const: g1 - - const: g2 - - const: ctrl + maxItems: 1 interrupts: - maxItems: 2 + maxItems: 1 interrupt-names: - items: + oneOf: - const: g1 - const: g2 @@ -46,14 +42,18 @@ properties: power-domains: maxItems: 1 + nxp,imx8mq-vpu-ctrl: + description: Specifies a phandle to syscon VPU hardware control block + $ref: "/schemas/types.yaml#/definitions/phandle" + required: - compatible - reg - - reg-names - interrupts - interrupt-names - clocks - clock-names + - nxp,imx8mq-vpu-ctrl additionalProperties: false @@ -62,18 +62,33 @@ examples: #include #include - vpu: video-codec at 38300000 { + vpu_ctrl: syscon at 38320000 { + compatible = "nxp,imx8mq-vpu-ctrl", "syscon"; + reg = <0x38320000 0x10000>; + }; + + vpu_g1: video-codec at 38300000 { compatible = "nxp,imx8mq-vpu"; - reg = <0x38300000 0x10000>, - <0x38310000 0x10000>, - <0x38320000 0x10000>; - reg-names = "g1", "g2", "ctrl"; - interrupts = , - ; - interrupt-names = "g1", "g2"; + reg = <0x38300000 0x10000>; + interrupts = ; + interrupt-names = "g1"; + clocks = <&clk IMX8MQ_CLK_VPU_G1_ROOT>, + <&clk IMX8MQ_CLK_VPU_G2_ROOT>, + <&clk IMX8MQ_CLK_VPU_DEC_ROOT>; + clock-names = "g1", "g2", "bus"; + power-domains = <&pgc_vpu>; + nxp,imx8mq-vpu-ctrl = <&vpu_ctrl>; + }; + + vpu_g2: video-codec at 38310000 { + compatible = "nxp,imx8mq-vpu-g2"; + reg = <0x38300000 0x10000>; + interrupts = ; + interrupt-names = "g2"; clocks = <&clk IMX8MQ_CLK_VPU_G1_ROOT>, <&clk IMX8MQ_CLK_VPU_G2_ROOT>, <&clk IMX8MQ_CLK_VPU_DEC_ROOT>; clock-names = "g1", "g2", "bus"; power-domains = <&pgc_vpu>; + nxp,imx8mq-vpu-ctrl = <&vpu_ctrl>; }; -- 2.25.1 From benjamin.gaignard at collabora.com Wed Mar 17 17:31:52 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 17 Mar 2021 18:31:52 +0100 Subject: [PATCH v5 03/13] media: hantro: Use syscon instead of 'ctrl' register In-Reply-To: <20210317173202.107519-1-benjamin.gaignard@collabora.com> References: <20210317173202.107519-1-benjamin.gaignard@collabora.com> Message-ID: <20210317173202.107519-4-benjamin.gaignard@collabora.com> In order to be able to share the control hardware block between VPUs use a syscon instead a ioremap it in the driver. To keep the compatibility with older DT if 'nxp,imx8mq-vpu-ctrl' phandle is not found look at 'ctrl' reg-name. With the method it becomes useless to provide a list of register names so remove it. Signed-off-by: Benjamin Gaignard --- version 5: - use syscon instead of VPU reset driver. - if DT doesn't provide syscon keep backward compatibilty by using 'ctrl' reg-name. drivers/staging/media/hantro/hantro.h | 5 +- drivers/staging/media/hantro/imx8m_vpu_hw.c | 52 ++++++++++++--------- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h index 65f9f7ea7dcf..a99a96b84b5e 100644 --- a/drivers/staging/media/hantro/hantro.h +++ b/drivers/staging/media/hantro/hantro.h @@ -13,6 +13,7 @@ #define HANTRO_H_ #include +#include #include #include #include @@ -167,7 +168,7 @@ hantro_vdev_to_func(struct video_device *vdev) * @reg_bases: Mapped addresses of VPU registers. * @enc_base: Mapped address of VPU encoder register for convenience. * @dec_base: Mapped address of VPU decoder register for convenience. - * @ctrl_base: Mapped address of VPU control block. + * @ctrl_base: Regmap of VPU control block. * @vpu_mutex: Mutex to synchronize V4L2 calls. * @irqlock: Spinlock to synchronize access to data structures * shared with interrupt handlers. @@ -186,7 +187,7 @@ struct hantro_dev { void __iomem **reg_bases; void __iomem *enc_base; void __iomem *dec_base; - void __iomem *ctrl_base; + struct regmap *ctrl_base; struct mutex vpu_mutex; /* video_device lock */ spinlock_t irqlock; diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c index c222de075ef4..bd9d135dd440 100644 --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c @@ -7,6 +7,7 @@ #include #include +#include #include "hantro.h" #include "hantro_jpeg.h" @@ -24,30 +25,28 @@ #define CTRL_G1_PP_FUSE 0x0c #define CTRL_G2_DEC_FUSE 0x10 +static const struct regmap_config ctrl_regmap_ctrl = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 0x14, +}; + static void imx8m_soft_reset(struct hantro_dev *vpu, u32 reset_bits) { - u32 val; - /* Assert */ - val = readl(vpu->ctrl_base + CTRL_SOFT_RESET); - val &= ~reset_bits; - writel(val, vpu->ctrl_base + CTRL_SOFT_RESET); + regmap_update_bits(vpu->ctrl_base, CTRL_SOFT_RESET, reset_bits, 0); udelay(2); /* Release */ - val = readl(vpu->ctrl_base + CTRL_SOFT_RESET); - val |= reset_bits; - writel(val, vpu->ctrl_base + CTRL_SOFT_RESET); + regmap_update_bits(vpu->ctrl_base, CTRL_SOFT_RESET, + reset_bits, reset_bits); } static void imx8m_clk_enable(struct hantro_dev *vpu, u32 clock_bits) { - u32 val; - - val = readl(vpu->ctrl_base + CTRL_CLOCK_ENABLE); - val |= clock_bits; - writel(val, vpu->ctrl_base + CTRL_CLOCK_ENABLE); + regmap_update_bits(vpu->ctrl_base, CTRL_CLOCK_ENABLE, + clock_bits, clock_bits); } static int imx8mq_runtime_resume(struct hantro_dev *vpu) @@ -64,9 +63,9 @@ static int imx8mq_runtime_resume(struct hantro_dev *vpu) imx8m_clk_enable(vpu, CLOCK_G1 | CLOCK_G2); /* Set values of the fuse registers */ - writel(0xffffffff, vpu->ctrl_base + CTRL_G1_DEC_FUSE); - writel(0xffffffff, vpu->ctrl_base + CTRL_G1_PP_FUSE); - writel(0xffffffff, vpu->ctrl_base + CTRL_G2_DEC_FUSE); + regmap_write(vpu->ctrl_base, CTRL_G1_DEC_FUSE, 0xffffffff); + regmap_write(vpu->ctrl_base, CTRL_G1_PP_FUSE, 0xffffffff); + regmap_write(vpu->ctrl_base, CTRL_G2_DEC_FUSE, 0xffffffff); clk_bulk_disable_unprepare(vpu->variant->num_clocks, vpu->clocks); @@ -150,8 +149,22 @@ static irqreturn_t imx8m_vpu_g1_irq(int irq, void *dev_id) static int imx8mq_vpu_hw_init(struct hantro_dev *vpu) { - vpu->dec_base = vpu->reg_bases[0]; - vpu->ctrl_base = vpu->reg_bases[vpu->variant->num_regs - 1]; + struct device_node *np = vpu->dev->of_node; + + vpu->ctrl_base = syscon_regmap_lookup_by_phandle(np, "nxp,imx8mq-vpu-ctrl"); + if (IS_ERR(vpu->ctrl_base)) { + struct resource *res; + void __iomem *ctrl; + + res = platform_get_resource_byname(vpu->pdev, IORESOURCE_MEM, "ctrl"); + ctrl = devm_ioremap_resource(vpu->dev, res); + if (IS_ERR(ctrl)) + return PTR_ERR(ctrl); + + vpu->ctrl_base = devm_regmap_init_mmio(vpu->dev, ctrl, &ctrl_regmap_ctrl); + if (IS_ERR(vpu->ctrl_base)) + return PTR_ERR(vpu->ctrl_base); + } return 0; } @@ -198,7 +211,6 @@ static const struct hantro_irq imx8mq_irqs[] = { }; static const char * const imx8mq_clk_names[] = { "g1", "g2", "bus" }; -static const char * const imx8mq_reg_names[] = { "g1", "g2", "ctrl" }; const struct hantro_variant imx8mq_vpu_variant = { .dec_fmts = imx8m_vpu_dec_fmts, @@ -215,6 +227,4 @@ const struct hantro_variant imx8mq_vpu_variant = { .num_irqs = ARRAY_SIZE(imx8mq_irqs), .clk_names = imx8mq_clk_names, .num_clocks = ARRAY_SIZE(imx8mq_clk_names), - .reg_names = imx8mq_reg_names, - .num_regs = ARRAY_SIZE(imx8mq_reg_names) }; -- 2.25.1 From benjamin.gaignard at collabora.com Wed Mar 17 17:31:53 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 17 Mar 2021 18:31:53 +0100 Subject: [PATCH v5 04/13] media: hevc: Add fields and flags for hevc PPS In-Reply-To: <20210317173202.107519-1-benjamin.gaignard@collabora.com> References: <20210317173202.107519-1-benjamin.gaignard@collabora.com> Message-ID: <20210317173202.107519-5-benjamin.gaignard@collabora.com> Add fields and flags as they are defined in 7.4.3.3.1 "General picture parameter set RBSP semantics of the H.265 ITU specification. Signed-off-by: Benjamin Gaignard --- .../userspace-api/media/v4l/ext-ctrls-codec.rst | 14 ++++++++++++++ include/media/hevc-ctrls.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index 00944e97d638..d62e8e423f3b 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -3234,6 +3234,12 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - * - __u8 - ``num_extra_slice_header_bits`` - + * - __u8 + - ``num_ref_idx_l0_default_active_minus1`` + - Specifies the inferred value of num_ref_idx_l0_active_minus1 + * - __u8 + - ``num_ref_idx_l1_default_active_minus1`` + - Specifies the inferred value of num_ref_idx_l1_active_minus1 * - __s8 - ``init_qp_minus26`` - @@ -3342,6 +3348,14 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - * - ``V4L2_HEVC_PPS_FLAG_SLICE_SEGMENT_HEADER_EXTENSION_PRESENT`` - 0x00040000 - + * - ``V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT`` + - 0x00080000 + - Specifies the presence of deblocking filter control syntax elements in + the PPS + * - ``V4L2_HEVC_PPS_FLAG_UNIFORM_SPACING`` + - 0x00100000 + - Specifies that tile column boundaries and likewise tile row boundaries + are distributed uniformly across the picture ``V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS (struct)`` Specifies various slice-specific parameters, especially from the NAL unit diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h index b4cb2ef02f17..003f819ecb26 100644 --- a/include/media/hevc-ctrls.h +++ b/include/media/hevc-ctrls.h @@ -100,10 +100,14 @@ struct v4l2_ctrl_hevc_sps { #define V4L2_HEVC_PPS_FLAG_PPS_DISABLE_DEBLOCKING_FILTER (1ULL << 16) #define V4L2_HEVC_PPS_FLAG_LISTS_MODIFICATION_PRESENT (1ULL << 17) #define V4L2_HEVC_PPS_FLAG_SLICE_SEGMENT_HEADER_EXTENSION_PRESENT (1ULL << 18) +#define V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT (1ULL << 19) +#define V4L2_HEVC_PPS_FLAG_UNIFORM_SPACING (1ULL << 20) struct v4l2_ctrl_hevc_pps { /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */ __u8 num_extra_slice_header_bits; + __u8 num_ref_idx_l0_default_active_minus1; + __u8 num_ref_idx_l1_default_active_minus1; __s8 init_qp_minus26; __u8 diff_cu_qp_delta_depth; __s8 pps_cb_qp_offset; -- 2.25.1 From benjamin.gaignard at collabora.com Wed Mar 17 17:31:54 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 17 Mar 2021 18:31:54 +0100 Subject: [PATCH v5 05/13] media: hevc: Add decode params control In-Reply-To: <20210317173202.107519-1-benjamin.gaignard@collabora.com> References: <20210317173202.107519-1-benjamin.gaignard@collabora.com> Message-ID: <20210317173202.107519-6-benjamin.gaignard@collabora.com> Add decode params control and it associated structure to regroup all the information that are needed to decode a reference frame as it is describe in ITU-T Rec. H.265 section "8.3.2 Decoding process for reference picture set". Adapt Cedrus driver to these changes. Signed-off-by: Benjamin Gaignard --- .../media/v4l/ext-ctrls-codec.rst | 94 +++++++++++++++---- .../media/v4l/vidioc-queryctrl.rst | 6 ++ drivers/media/v4l2-core/v4l2-ctrls.c | 26 +++-- drivers/staging/media/sunxi/cedrus/cedrus.c | 6 ++ drivers/staging/media/sunxi/cedrus/cedrus.h | 1 + .../staging/media/sunxi/cedrus/cedrus_dec.c | 2 + .../staging/media/sunxi/cedrus/cedrus_h265.c | 6 +- include/media/hevc-ctrls.h | 29 ++++-- 8 files changed, 134 insertions(+), 36 deletions(-) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index d62e8e423f3b..8a6d45cb437e 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -3436,9 +3436,6 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - * - __u8 - ``pic_struct`` - - * - __u8 - - ``num_active_dpb_entries`` - - The number of entries in ``dpb``. * - __u8 - ``ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` - The list of L0 reference elements as indices in the DPB. @@ -3446,22 +3443,8 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - - ``ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` - The list of L1 reference elements as indices in the DPB. * - __u8 - - ``num_rps_poc_st_curr_before`` - - The number of reference pictures in the short-term set that come before - the current frame. - * - __u8 - - ``num_rps_poc_st_curr_after`` - - The number of reference pictures in the short-term set that come after - the current frame. - * - __u8 - - ``num_rps_poc_lt_curr`` - - The number of reference pictures in the long-term set. - * - __u8 - - ``padding[7]`` + - ``padding`` - Applications and drivers must set this to zero. - * - struct :c:type:`v4l2_hevc_dpb_entry` - - ``dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` - - The decoded picture buffer, for meta-data about reference frames. * - struct :c:type:`v4l2_hevc_pred_weight_table` - ``pred_weight_table`` - The prediction weight coefficients for inter-picture prediction. @@ -3660,3 +3643,78 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - so this has to come from client. This is applicable to H264 and valid Range is from 0 to 63. Source Rec. ITU-T H.264 (06/2019); G.7.4.1.1, G.8.8.1. + +``V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS (struct)`` + Specifies various decode parameters, especially the references picture order + count (POC) for all the lists (short, long, before, current, after) and the + number of entries for each of them. + These parameters are defined according to :ref:`hevc`. + They are described in section 8.3 "Slice decoding process" of the + specification. + +.. c:type:: v4l2_ctrl_hevc_decode_params + +.. cssclass:: longtable + +.. flat-table:: struct v4l2_ctrl_hevc_decode_params + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - __s32 + - ``pic_order_cnt_val`` + - PicOrderCntVal as described in section 8.3.1 "Decoding process + for picture order count" of the specification. + * - __u8 + - ``num_active_dpb_entries`` + - The number of entries in ``dpb``. + * - struct :c:type:`v4l2_hevc_dpb_entry` + - ``dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` + - The decoded picture buffer, for meta-data about reference frames. + * - __u8 + - ``num_poc_st_curr_before`` + - The number of reference pictures in the short-term set that come before + the current frame. + * - __u8 + - ``num_poc_st_curr_after`` + - The number of reference pictures in the short-term set that come after + the current frame. + * - __u8 + - ``num_poc_lt_curr`` + - The number of reference pictures in the long-term set. + * - __u8 + - ``poc_st_curr_before[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` + - PocStCurrBefore as described in section 8.3.2 "Decoding process for reference + picture set. + * - __u8 + - ``poc_st_curr_after[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` + - PocStCurrAfter as described in section 8.3.2 "Decoding process for reference + picture set. + * - __u8 + - ``poc_lt_curr[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` + - PocLtCurr as described in section 8.3.2 "Decoding process for reference + picture set. + * - __u64 + - ``flags`` + - See :ref:`Decode Parameters Flags ` + +.. _hevc_decode_params_flags: + +``Decode Parameters Flags`` + +.. cssclass:: longtable + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - ``V4L2_HEVC_DECODE_PARAM_FLAG_IRAP_PIC`` + - 0x00000001 + - + * - ``V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC`` + - 0x00000002 + - + * - ``V4L2_HEVC_DECODE_PARAM_FLAG_NO_OUTPUT_OF_PRIOR`` + - 0x00000004 + - diff --git a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst index 82f61f1e2fb8..d84ae255bc79 100644 --- a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst +++ b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst @@ -486,6 +486,12 @@ See also the examples in :ref:`control`. - n/a - A struct :c:type:`v4l2_ctrl_hevc_slice_params`, containing HEVC slice parameters for stateless video decoders. + * - ``V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS`` + - n/a + - n/a + - n/a + - A struct :c:type:`v4l2_ctrl_hevc_decode_params`, containing HEVC + decoding parameters for stateless video decoders. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 016cf6204cbb..4060b5bcc3c0 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1028,6 +1028,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MPEG_VIDEO_HEVC_SPS: return "HEVC Sequence Parameter Set"; case V4L2_CID_MPEG_VIDEO_HEVC_PPS: return "HEVC Picture Parameter Set"; case V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS: return "HEVC Slice Parameters"; + case V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS: return "HEVC Decode Parameters"; case V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE: return "HEVC Decode Mode"; case V4L2_CID_MPEG_VIDEO_HEVC_START_CODE: return "HEVC Start Code"; @@ -1482,6 +1483,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS: *type = V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS; break; + case V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS: + *type = V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS; + break; case V4L2_CID_UNIT_CELL_SIZE: *type = V4L2_CTRL_TYPE_AREA; *flags |= V4L2_CTRL_FLAG_READ_ONLY; @@ -1833,6 +1837,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, struct v4l2_ctrl_hevc_sps *p_hevc_sps; struct v4l2_ctrl_hevc_pps *p_hevc_pps; struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params; + struct v4l2_ctrl_hevc_decode_params *p_hevc_decode_params; struct v4l2_area *area; void *p = ptr.p + idx * ctrl->elem_size; unsigned int i; @@ -2108,23 +2113,27 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, zero_padding(*p_hevc_pps); break; - case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS: - p_hevc_slice_params = p; + case V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS: + p_hevc_decode_params = p; - if (p_hevc_slice_params->num_active_dpb_entries > + if (p_hevc_decode_params->num_active_dpb_entries > V4L2_HEVC_DPB_ENTRIES_NUM_MAX) return -EINVAL; - zero_padding(p_hevc_slice_params->pred_weight_table); - - for (i = 0; i < p_hevc_slice_params->num_active_dpb_entries; + for (i = 0; i < p_hevc_decode_params->num_active_dpb_entries; i++) { struct v4l2_hevc_dpb_entry *dpb_entry = - &p_hevc_slice_params->dpb[i]; + &p_hevc_decode_params->dpb[i]; zero_padding(*dpb_entry); } + break; + + case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS: + p_hevc_slice_params = p; + + zero_padding(p_hevc_slice_params->pred_weight_table); zero_padding(*p_hevc_slice_params); break; @@ -2821,6 +2830,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS: elem_size = sizeof(struct v4l2_ctrl_hevc_slice_params); break; + case V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS: + elem_size = sizeof(struct v4l2_ctrl_hevc_decode_params); + break; case V4L2_CTRL_TYPE_AREA: elem_size = sizeof(struct v4l2_area); break; diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c index 7bd9291c8d5f..4cd3cab1a257 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c @@ -151,6 +151,12 @@ static const struct cedrus_control cedrus_controls[] = { }, .codec = CEDRUS_CODEC_VP8, }, + { + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS, + }, + .codec = CEDRUS_CODEC_H265, + }, }; #define CEDRUS_CONTROLS_COUNT ARRAY_SIZE(cedrus_controls) diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/staging/media/sunxi/cedrus/cedrus.h index 251a6a660351..2ca33ac38b9a 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus.h +++ b/drivers/staging/media/sunxi/cedrus/cedrus.h @@ -76,6 +76,7 @@ struct cedrus_h265_run { const struct v4l2_ctrl_hevc_sps *sps; const struct v4l2_ctrl_hevc_pps *pps; const struct v4l2_ctrl_hevc_slice_params *slice_params; + const struct v4l2_ctrl_hevc_decode_params *decode_params; }; struct cedrus_vp8_run { diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c index a9090daf626a..cd821f417a14 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c @@ -68,6 +68,8 @@ void cedrus_device_run(void *priv) V4L2_CID_MPEG_VIDEO_HEVC_PPS); run.h265.slice_params = cedrus_find_control_data(ctx, V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS); + run.h265.decode_params = cedrus_find_control_data(ctx, + V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS); break; case V4L2_PIX_FMT_VP8_FRAME: diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c index ce497d0197df..dce5db6be13a 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c @@ -245,6 +245,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, const struct v4l2_ctrl_hevc_sps *sps; const struct v4l2_ctrl_hevc_pps *pps; const struct v4l2_ctrl_hevc_slice_params *slice_params; + const struct v4l2_ctrl_hevc_decode_params *decode_params; const struct v4l2_hevc_pred_weight_table *pred_weight_table; dma_addr_t src_buf_addr; dma_addr_t src_buf_end_addr; @@ -256,6 +257,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, sps = run->h265.sps; pps = run->h265.pps; slice_params = run->h265.slice_params; + decode_params = run->h265.decode_params; pred_weight_table = &slice_params->pred_weight_table; /* MV column buffer size and allocation. */ @@ -487,7 +489,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, reg = VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_TC_OFFSET_DIV2(slice_params->slice_tc_offset_div2) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_BETA_OFFSET_DIV2(slice_params->slice_beta_offset_div2) | - VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_POC_BIGEST_IN_RPS_ST(slice_params->num_rps_poc_st_curr_after == 0) | + VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_POC_BIGEST_IN_RPS_ST(decode_params->num_rps_poc_st_curr_after == 0) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CR_QP_OFFSET(slice_params->slice_cr_qp_offset) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CB_QP_OFFSET(slice_params->slice_cb_qp_offset) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_QP_DELTA(slice_params->slice_qp_delta); @@ -528,7 +530,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, /* Write decoded picture buffer in pic list. */ cedrus_h265_frame_info_write_dpb(ctx, slice_params->dpb, - slice_params->num_active_dpb_entries); + decode_params->num_active_dpb_entries); /* Output frame. */ diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h index 003f819ecb26..8e0109eea454 100644 --- a/include/media/hevc-ctrls.h +++ b/include/media/hevc-ctrls.h @@ -19,6 +19,7 @@ #define V4L2_CID_MPEG_VIDEO_HEVC_SPS (V4L2_CID_CODEC_BASE + 1008) #define V4L2_CID_MPEG_VIDEO_HEVC_PPS (V4L2_CID_CODEC_BASE + 1009) #define V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS (V4L2_CID_CODEC_BASE + 1010) +#define V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS (V4L2_CID_CODEC_BASE + 1012) #define V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE (V4L2_CID_CODEC_BASE + 1015) #define V4L2_CID_MPEG_VIDEO_HEVC_START_CODE (V4L2_CID_CODEC_BASE + 1016) @@ -26,6 +27,7 @@ #define V4L2_CTRL_TYPE_HEVC_SPS 0x0120 #define V4L2_CTRL_TYPE_HEVC_PPS 0x0121 #define V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS 0x0122 +#define V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS 0x0124 enum v4l2_mpeg_video_hevc_decode_mode { V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_SLICE_BASED, @@ -194,18 +196,10 @@ struct v4l2_ctrl_hevc_slice_params { __u8 pic_struct; /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ - __u8 num_active_dpb_entries; __u8 ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; __u8 ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; - __u8 num_rps_poc_st_curr_before; - __u8 num_rps_poc_st_curr_after; - __u8 num_rps_poc_lt_curr; - - __u8 padding; - - /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ - struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; + __u8 padding[5]; /* ISO/IEC 23008-2, ITU-T Rec. H.265: Weighted prediction parameter */ struct v4l2_hevc_pred_weight_table pred_weight_table; @@ -213,4 +207,21 @@ struct v4l2_ctrl_hevc_slice_params { __u64 flags; }; +#define V4L2_HEVC_DECODE_PARAM_FLAG_IRAP_PIC 0x1 +#define V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC 0x2 +#define V4L2_HEVC_DECODE_PARAM_FLAG_NO_OUTPUT_OF_PRIOR 0x4 + +struct v4l2_ctrl_hevc_decode_params { + __s32 pic_order_cnt_val; + __u8 num_active_dpb_entries; + struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; + __u8 num_poc_st_curr_before; + __u8 num_poc_st_curr_after; + __u8 num_poc_lt_curr; + __u8 poc_st_curr_before[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; + __u8 poc_st_curr_after[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; + __u8 poc_lt_curr[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; + __u64 flags; +}; + #endif -- 2.25.1 From benjamin.gaignard at collabora.com Wed Mar 17 17:31:55 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 17 Mar 2021 18:31:55 +0100 Subject: [PATCH v5 06/13] media: hantro: change hantro_codec_ops run prototype to return errors In-Reply-To: <20210317173202.107519-1-benjamin.gaignard@collabora.com> References: <20210317173202.107519-1-benjamin.gaignard@collabora.com> Message-ID: <20210317173202.107519-7-benjamin.gaignard@collabora.com> Change hantro_codec_ops run prototype from 'void' to 'int'. This allow to cancel the job if an error occur while configuring the hardware. Signed-off-by: Benjamin Gaignard --- version 5: - forward hantro_h264_dec_prepare_run() return value in case of error drivers/staging/media/hantro/hantro_drv.c | 4 +++- .../staging/media/hantro/hantro_g1_h264_dec.c | 10 +++++++--- .../media/hantro/hantro_g1_mpeg2_dec.c | 4 +++- .../staging/media/hantro/hantro_g1_vp8_dec.c | 6 ++++-- .../staging/media/hantro/hantro_h1_jpeg_enc.c | 4 +++- drivers/staging/media/hantro/hantro_hw.h | 19 ++++++++++--------- .../media/hantro/rk3399_vpu_hw_jpeg_enc.c | 4 +++- .../media/hantro/rk3399_vpu_hw_mpeg2_dec.c | 4 +++- .../media/hantro/rk3399_vpu_hw_vp8_dec.c | 6 ++++-- 9 files changed, 40 insertions(+), 21 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index e5f200e64993..ac1429f00b33 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -161,7 +161,9 @@ static void device_run(void *priv) v4l2_m2m_buf_copy_metadata(src, dst, true); - ctx->codec_ops->run(ctx); + if (ctx->codec_ops->run(ctx)) + goto err_cancel_job; + return; err_cancel_job: diff --git a/drivers/staging/media/hantro/hantro_g1_h264_dec.c b/drivers/staging/media/hantro/hantro_g1_h264_dec.c index 845bef73d218..5c792b7bcb79 100644 --- a/drivers/staging/media/hantro/hantro_g1_h264_dec.c +++ b/drivers/staging/media/hantro/hantro_g1_h264_dec.c @@ -273,13 +273,15 @@ static void set_buffers(struct hantro_ctx *ctx) vdpu_write_relaxed(vpu, ctx->h264_dec.priv.dma, G1_REG_ADDR_QTABLE); } -void hantro_g1_h264_dec_run(struct hantro_ctx *ctx) +int hantro_g1_h264_dec_run(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; + int ret; /* Prepare the H264 decoder context. */ - if (hantro_h264_dec_prepare_run(ctx)) - return; + ret = hantro_h264_dec_prepare_run(ctx); + if (ret) + return ret; /* Configure hardware registers. */ set_params(ctx); @@ -301,4 +303,6 @@ void hantro_g1_h264_dec_run(struct hantro_ctx *ctx) G1_REG_CONFIG_DEC_CLK_GATE_E, G1_REG_CONFIG); vdpu_write(vpu, G1_REG_INTERRUPT_DEC_E, G1_REG_INTERRUPT); + + return 0; } diff --git a/drivers/staging/media/hantro/hantro_g1_mpeg2_dec.c b/drivers/staging/media/hantro/hantro_g1_mpeg2_dec.c index 6386a3989bfe..5e8943d31dc5 100644 --- a/drivers/staging/media/hantro/hantro_g1_mpeg2_dec.c +++ b/drivers/staging/media/hantro/hantro_g1_mpeg2_dec.c @@ -155,7 +155,7 @@ hantro_g1_mpeg2_dec_set_buffers(struct hantro_dev *vpu, struct hantro_ctx *ctx, vdpu_write_relaxed(vpu, backward_addr, G1_REG_REFER3_BASE); } -void hantro_g1_mpeg2_dec_run(struct hantro_ctx *ctx) +int hantro_g1_mpeg2_dec_run(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *src_buf, *dst_buf; @@ -248,4 +248,6 @@ void hantro_g1_mpeg2_dec_run(struct hantro_ctx *ctx) reg = G1_REG_DEC_E(1); vdpu_write(vpu, reg, G1_SWREG(1)); + + return 0; } diff --git a/drivers/staging/media/hantro/hantro_g1_vp8_dec.c b/drivers/staging/media/hantro/hantro_g1_vp8_dec.c index a5cdf150cd16..d665df026546 100644 --- a/drivers/staging/media/hantro/hantro_g1_vp8_dec.c +++ b/drivers/staging/media/hantro/hantro_g1_vp8_dec.c @@ -426,7 +426,7 @@ static void cfg_buffers(struct hantro_ctx *ctx, vdpu_write_relaxed(vpu, dst_dma, G1_REG_ADDR_DST); } -void hantro_g1_vp8_dec_run(struct hantro_ctx *ctx) +int hantro_g1_vp8_dec_run(struct hantro_ctx *ctx) { const struct v4l2_ctrl_vp8_frame_header *hdr; struct hantro_dev *vpu = ctx->dev; @@ -439,7 +439,7 @@ void hantro_g1_vp8_dec_run(struct hantro_ctx *ctx) hdr = hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER); if (WARN_ON(!hdr)) - return; + return -EINVAL; /* Reset segment_map buffer in keyframe */ if (VP8_FRAME_IS_KEY_FRAME(hdr) && ctx->vp8_dec.segment_map.cpu) @@ -499,4 +499,6 @@ void hantro_g1_vp8_dec_run(struct hantro_ctx *ctx) hantro_end_prepare_run(ctx); vdpu_write(vpu, G1_REG_INTERRUPT_DEC_E, G1_REG_INTERRUPT); + + return 0; } diff --git a/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c b/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c index b88dc4ed06db..56cf261a8e95 100644 --- a/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c +++ b/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c @@ -88,7 +88,7 @@ hantro_h1_jpeg_enc_set_qtable(struct hantro_dev *vpu, } } -void hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx) +int hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *src_buf, *dst_buf; @@ -136,6 +136,8 @@ void hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx) hantro_end_prepare_run(ctx); vepu_write(vpu, reg, H1_REG_ENC_CTRL); + + return 0; } void hantro_jpeg_enc_done(struct hantro_ctx *ctx) diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h index 34c9e4649a25..4e2e7a5ed283 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -126,14 +126,15 @@ struct hantro_postproc_ctx { * Optional and called from process context. * @run: Start single {en,de)coding job. Called from atomic context * to indicate that a pair of buffers is ready and the hardware - * should be programmed and started. + * should be programmed and started. Returns zero if OK, a + * negative value in error cases. * @done: Read back processing results and additional data from hardware. * @reset: Reset the hardware in case of a timeout. */ struct hantro_codec_ops { int (*init)(struct hantro_ctx *ctx); void (*exit)(struct hantro_ctx *ctx); - void (*run)(struct hantro_ctx *ctx); + int (*run)(struct hantro_ctx *ctx); void (*done)(struct hantro_ctx *ctx); void (*reset)(struct hantro_ctx *ctx); }; @@ -164,8 +165,8 @@ void hantro_irq_done(struct hantro_dev *vpu, void hantro_start_prepare_run(struct hantro_ctx *ctx); void hantro_end_prepare_run(struct hantro_ctx *ctx); -void hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx); -void rk3399_vpu_jpeg_enc_run(struct hantro_ctx *ctx); +int hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx); +int rk3399_vpu_jpeg_enc_run(struct hantro_ctx *ctx); int hantro_jpeg_enc_init(struct hantro_ctx *ctx); void hantro_jpeg_enc_exit(struct hantro_ctx *ctx); void hantro_jpeg_enc_done(struct hantro_ctx *ctx); @@ -173,7 +174,7 @@ void hantro_jpeg_enc_done(struct hantro_ctx *ctx); dma_addr_t hantro_h264_get_ref_buf(struct hantro_ctx *ctx, unsigned int dpb_idx); int hantro_h264_dec_prepare_run(struct hantro_ctx *ctx); -void hantro_g1_h264_dec_run(struct hantro_ctx *ctx); +int hantro_g1_h264_dec_run(struct hantro_ctx *ctx); int hantro_h264_dec_init(struct hantro_ctx *ctx); void hantro_h264_dec_exit(struct hantro_ctx *ctx); @@ -204,15 +205,15 @@ hantro_h264_mv_size(unsigned int width, unsigned int height) return 64 * MB_WIDTH(width) * MB_WIDTH(height) + 32; } -void hantro_g1_mpeg2_dec_run(struct hantro_ctx *ctx); -void rk3399_vpu_mpeg2_dec_run(struct hantro_ctx *ctx); +int hantro_g1_mpeg2_dec_run(struct hantro_ctx *ctx); +int rk3399_vpu_mpeg2_dec_run(struct hantro_ctx *ctx); void hantro_mpeg2_dec_copy_qtable(u8 *qtable, const struct v4l2_ctrl_mpeg2_quantization *ctrl); int hantro_mpeg2_dec_init(struct hantro_ctx *ctx); void hantro_mpeg2_dec_exit(struct hantro_ctx *ctx); -void hantro_g1_vp8_dec_run(struct hantro_ctx *ctx); -void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx); +int hantro_g1_vp8_dec_run(struct hantro_ctx *ctx); +int rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx); int hantro_vp8_dec_init(struct hantro_ctx *ctx); void hantro_vp8_dec_exit(struct hantro_ctx *ctx); void hantro_vp8_prob_update(struct hantro_ctx *ctx, diff --git a/drivers/staging/media/hantro/rk3399_vpu_hw_jpeg_enc.c b/drivers/staging/media/hantro/rk3399_vpu_hw_jpeg_enc.c index 3498e6124acd..3a27ebef4f38 100644 --- a/drivers/staging/media/hantro/rk3399_vpu_hw_jpeg_enc.c +++ b/drivers/staging/media/hantro/rk3399_vpu_hw_jpeg_enc.c @@ -118,7 +118,7 @@ rk3399_vpu_jpeg_enc_set_qtable(struct hantro_dev *vpu, } } -void rk3399_vpu_jpeg_enc_run(struct hantro_ctx *ctx) +int rk3399_vpu_jpeg_enc_run(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *src_buf, *dst_buf; @@ -168,4 +168,6 @@ void rk3399_vpu_jpeg_enc_run(struct hantro_ctx *ctx) /* Kick the watchdog and start encoding */ hantro_end_prepare_run(ctx); vepu_write(vpu, reg, VEPU_REG_ENCODE_START); + + return 0; } diff --git a/drivers/staging/media/hantro/rk3399_vpu_hw_mpeg2_dec.c b/drivers/staging/media/hantro/rk3399_vpu_hw_mpeg2_dec.c index f610fa5b4335..4bd3080abbc1 100644 --- a/drivers/staging/media/hantro/rk3399_vpu_hw_mpeg2_dec.c +++ b/drivers/staging/media/hantro/rk3399_vpu_hw_mpeg2_dec.c @@ -157,7 +157,7 @@ rk3399_vpu_mpeg2_dec_set_buffers(struct hantro_dev *vpu, vdpu_write_relaxed(vpu, backward_addr, VDPU_REG_REFER3_BASE); } -void rk3399_vpu_mpeg2_dec_run(struct hantro_ctx *ctx) +int rk3399_vpu_mpeg2_dec_run(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *src_buf, *dst_buf; @@ -254,4 +254,6 @@ void rk3399_vpu_mpeg2_dec_run(struct hantro_ctx *ctx) reg = vdpu_read(vpu, VDPU_SWREG(57)) | VDPU_REG_DEC_E(1); vdpu_write(vpu, reg, VDPU_SWREG(57)); + + return 0; } diff --git a/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c b/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c index a4a792f00b11..755571e16fcd 100644 --- a/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c +++ b/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c @@ -504,7 +504,7 @@ static void cfg_buffers(struct hantro_ctx *ctx, vdpu_write_relaxed(vpu, dst_dma, VDPU_REG_ADDR_DST); } -void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx) +int rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx) { const struct v4l2_ctrl_vp8_frame_header *hdr; struct hantro_dev *vpu = ctx->dev; @@ -517,7 +517,7 @@ void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx) hdr = hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER); if (WARN_ON(!hdr)) - return; + return -EINVAL; /* Reset segment_map buffer in keyframe */ if (VP8_FRAME_IS_KEY_FRAME(hdr) && ctx->vp8_dec.segment_map.cpu) @@ -590,4 +590,6 @@ void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx) hantro_end_prepare_run(ctx); hantro_reg_write(vpu, &vp8_dec_start_dec, 1); + + return 0; } -- 2.25.1 From benjamin.gaignard at collabora.com Wed Mar 17 17:31:56 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 17 Mar 2021 18:31:56 +0100 Subject: [PATCH v5 07/13] media: hantro: Define HEVC codec profiles and supported features In-Reply-To: <20210317173202.107519-1-benjamin.gaignard@collabora.com> References: <20210317173202.107519-1-benjamin.gaignard@collabora.com> Message-ID: <20210317173202.107519-8-benjamin.gaignard@collabora.com> Define which HEVC profiles (up to level 5.1) and features (no scaling, no 10 bits) are supported by the driver. Signed-off-by: Benjamin Gaignard --- drivers/staging/media/hantro/hantro.h | 3 ++ drivers/staging/media/hantro/hantro_drv.c | 58 +++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h index a99a96b84b5e..4ae2071b3bfe 100644 --- a/drivers/staging/media/hantro/hantro.h +++ b/drivers/staging/media/hantro/hantro.h @@ -35,6 +35,7 @@ struct hantro_codec_ops; #define HANTRO_MPEG2_DECODER BIT(16) #define HANTRO_VP8_DECODER BIT(17) #define HANTRO_H264_DECODER BIT(18) +#define HANTRO_HEVC_DECODER BIT(19) #define HANTRO_DECODERS 0xffff0000 /** @@ -100,6 +101,7 @@ struct hantro_variant { * @HANTRO_MODE_H264_DEC: H264 decoder. * @HANTRO_MODE_MPEG2_DEC: MPEG-2 decoder. * @HANTRO_MODE_VP8_DEC: VP8 decoder. + * @HANTRO_MODE_HEVC_DEC: HEVC decoder. */ enum hantro_codec_mode { HANTRO_MODE_NONE = -1, @@ -107,6 +109,7 @@ enum hantro_codec_mode { HANTRO_MODE_H264_DEC, HANTRO_MODE_MPEG2_DEC, HANTRO_MODE_VP8_DEC, + HANTRO_MODE_HEVC_DEC, }; /* diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index ac1429f00b33..f0b68e16fcc0 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -245,6 +245,18 @@ static int hantro_try_ctrl(struct v4l2_ctrl *ctrl) if (sps->bit_depth_luma_minus8 != 0) /* Only 8-bit is supported */ return -EINVAL; + } else if (ctrl->id == V4L2_CID_MPEG_VIDEO_HEVC_SPS) { + const struct v4l2_ctrl_hevc_sps *sps = ctrl->p_new.p_hevc_sps; + + if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8) + /* Luma and chroma bit depth mismatch */ + return -EINVAL; + if (sps->bit_depth_luma_minus8 != 0) + /* Only 8-bit is supported */ + return -EINVAL; + if (sps->flags & V4L2_HEVC_SPS_FLAG_SCALING_LIST_ENABLED) + /* No scaling support */ + return -EINVAL; } return 0; } @@ -351,6 +363,52 @@ static const struct hantro_ctrl controls[] = { .def = V4L2_MPEG_VIDEO_H264_PROFILE_MAIN, } }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE, + .min = V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_FRAME_BASED, + .max = V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_FRAME_BASED, + .def = V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_FRAME_BASED, + }, + }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_START_CODE, + .min = V4L2_MPEG_VIDEO_HEVC_START_CODE_ANNEX_B, + .max = V4L2_MPEG_VIDEO_HEVC_START_CODE_ANNEX_B, + .def = V4L2_MPEG_VIDEO_HEVC_START_CODE_ANNEX_B, + }, + }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_PROFILE, + .min = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN, + .max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10, + .def = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN, + }, + }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_LEVEL, + .min = V4L2_MPEG_VIDEO_HEVC_LEVEL_1, + .max = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1, + }, + }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_SPS, + .ops = &hantro_ctrl_ops, + }, + }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_PPS, + }, + }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS, + }, }, }; -- 2.25.1 From benjamin.gaignard at collabora.com Wed Mar 17 17:31:57 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 17 Mar 2021 18:31:57 +0100 Subject: [PATCH v5 08/13] media: hantro: Only use postproc when post processed formats are defined In-Reply-To: <20210317173202.107519-1-benjamin.gaignard@collabora.com> References: <20210317173202.107519-1-benjamin.gaignard@collabora.com> Message-ID: <20210317173202.107519-9-benjamin.gaignard@collabora.com> If the variant doesn't offert postprocessed formats make sure it will be ok. Signed-off-by: Benjamin Gaignard --- drivers/staging/media/hantro/hantro.h | 8 ++------ drivers/staging/media/hantro/hantro_postproc.c | 14 ++++++++++++++ drivers/staging/media/hantro/hantro_v4l2.c | 4 +++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h index 4ae2071b3bfe..83299e8d3a6c 100644 --- a/drivers/staging/media/hantro/hantro.h +++ b/drivers/staging/media/hantro/hantro.h @@ -413,12 +413,8 @@ hantro_get_dst_buf(struct hantro_ctx *ctx) return v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); } -static inline bool -hantro_needs_postproc(const struct hantro_ctx *ctx, - const struct hantro_fmt *fmt) -{ - return !ctx->is_encoder && fmt->fourcc != V4L2_PIX_FMT_NV12; -} +bool hantro_needs_postproc(const struct hantro_ctx *ctx, + const struct hantro_fmt *fmt); static inline dma_addr_t hantro_get_dec_buf_addr(struct hantro_ctx *ctx, struct vb2_buffer *vb) diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c index 6d2a8f2a8f0b..ed8916c950a4 100644 --- a/drivers/staging/media/hantro/hantro_postproc.c +++ b/drivers/staging/media/hantro/hantro_postproc.c @@ -50,6 +50,20 @@ const struct hantro_postproc_regs hantro_g1_postproc_regs = { .display_width = {G1_REG_PP_DISPLAY_WIDTH, 0, 0xfff}, }; +bool hantro_needs_postproc(const struct hantro_ctx *ctx, + const struct hantro_fmt *fmt) +{ + struct hantro_dev *vpu = ctx->dev; + + if (ctx->is_encoder) + return false; + + if (!vpu->variant->postproc_fmts) + return false; + + return fmt->fourcc != V4L2_PIX_FMT_NV12; +} + void hantro_postproc_enable(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c index 1bc118e375a1..77d7fe62ce81 100644 --- a/drivers/staging/media/hantro/hantro_v4l2.c +++ b/drivers/staging/media/hantro/hantro_v4l2.c @@ -55,7 +55,9 @@ static const struct hantro_fmt * hantro_get_postproc_formats(const struct hantro_ctx *ctx, unsigned int *num_fmts) { - if (ctx->is_encoder) { + struct hantro_dev *vpu = ctx->dev; + + if (ctx->is_encoder || !vpu->variant->postproc_fmts) { *num_fmts = 0; return NULL; } -- 2.25.1 From benjamin.gaignard at collabora.com Wed Mar 17 17:31:58 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 17 Mar 2021 18:31:58 +0100 Subject: [PATCH v5 09/13] media: uapi: Add a control for HANTRO driver In-Reply-To: <20210317173202.107519-1-benjamin.gaignard@collabora.com> References: <20210317173202.107519-1-benjamin.gaignard@collabora.com> Message-ID: <20210317173202.107519-10-benjamin.gaignard@collabora.com> The HEVC HANTRO driver needs to know the number of bits to skip at the beginning of the slice header. That is a hardware specific requirement so create a dedicated control that this purpose. Signed-off-by: Benjamin Gaignard --- version 5: - Be even more verbose in control documentation. - Do not create class for the control. version 4: - The control is now an integer which is enough to provide the numbers of bits to skip. version 3: - Fix typo in field name .../userspace-api/media/drivers/hantro.rst | 14 ++++++++++++++ .../userspace-api/media/drivers/index.rst | 1 + include/uapi/linux/v4l2-controls.h | 13 +++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 Documentation/userspace-api/media/drivers/hantro.rst diff --git a/Documentation/userspace-api/media/drivers/hantro.rst b/Documentation/userspace-api/media/drivers/hantro.rst new file mode 100644 index 000000000000..78dcd2a44a03 --- /dev/null +++ b/Documentation/userspace-api/media/drivers/hantro.rst @@ -0,0 +1,14 @@ +.. SPDX-License-Identifier: GPL-2.0 + +Hantro video decoder driver +=========================== + +The Hantro video decoder driver implements the following driver-specific controls: + +``V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP (integer)`` + Specifies to Hantro HEVC video decoder driver the number of data (in bits) to + skip in the slice segment header. + If non-IDR, the bits to be skipped go from syntax element "pic_output_flag" + to before syntax element "slice_temporal_mvp_enabled_flag". + If IDR, the skipped bits are just "pic_output_flag" + (separate_colour_plane_flag is not supported). diff --git a/Documentation/userspace-api/media/drivers/index.rst b/Documentation/userspace-api/media/drivers/index.rst index 1a9038f5f9fa..12e3c512d718 100644 --- a/Documentation/userspace-api/media/drivers/index.rst +++ b/Documentation/userspace-api/media/drivers/index.rst @@ -33,6 +33,7 @@ For more details see the file COPYING in the source distribution of Linux. ccs cx2341x-uapi + hantro imx-uapi max2175 meye-uapi diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 039c0d7add1b..cebfb57080ed 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -865,6 +865,19 @@ enum v4l2_mpeg_mfc51_video_force_frame_type { #define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_CODEC_MFC51_BASE+53) #define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_CODEC_MFC51_BASE+54) +/* MPEG-class control IDs specific to the Hantro driver as defined by V4L2 */ +#define V4L2_CID_CODEC_HANTRO_BASE (V4L2_CTRL_CLASS_CODEC | 0x1200) +/* + * V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP - + * the number of data (in bits) to skip in the + * slice segment header. + * If non-IDR, the bits to be skipped go from syntax element "pic_output_flag" + * to before syntax element "slice_temporal_mvp_enabled_flag". + * If IDR, the skipped bits are just "pic_output_flag" + * (separate_colour_plane_flag is not supported). + */ +#define V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP (V4L2_CID_CODEC_HANTRO_BASE + 0) + /* Camera class control IDs */ #define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900) -- 2.25.1 From benjamin.gaignard at collabora.com Wed Mar 17 17:31:59 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 17 Mar 2021 18:31:59 +0100 Subject: [PATCH v5 10/13] media: hantro: handle V4L2_PIX_FMT_HEVC_SLICE control In-Reply-To: <20210317173202.107519-1-benjamin.gaignard@collabora.com> References: <20210317173202.107519-1-benjamin.gaignard@collabora.com> Message-ID: <20210317173202.107519-11-benjamin.gaignard@collabora.com> Make sure that V4L2_PIX_FMT_HEVC_SLICE is correctly handle by v4l2 of the driver. Signed-off-by: Benjamin Gaignard --- drivers/staging/media/hantro/hantro_v4l2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c index 77d7fe62ce81..0655324fd0d4 100644 --- a/drivers/staging/media/hantro/hantro_v4l2.c +++ b/drivers/staging/media/hantro/hantro_v4l2.c @@ -392,6 +392,7 @@ hantro_update_requires_request(struct hantro_ctx *ctx, u32 fourcc) case V4L2_PIX_FMT_MPEG2_SLICE: case V4L2_PIX_FMT_VP8_FRAME: case V4L2_PIX_FMT_H264_SLICE: + case V4L2_PIX_FMT_HEVC_SLICE: ctx->fh.m2m_ctx->out_q_ctx.q.requires_requests = true; break; default: -- 2.25.1 From benjamin.gaignard at collabora.com Wed Mar 17 17:32:00 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 17 Mar 2021 18:32:00 +0100 Subject: [PATCH v5 11/13] media: hantro: Introduce G2/HEVC decoder In-Reply-To: <20210317173202.107519-1-benjamin.gaignard@collabora.com> References: <20210317173202.107519-1-benjamin.gaignard@collabora.com> Message-ID: <20210317173202.107519-12-benjamin.gaignard@collabora.com> Implement all the logic to get G2 hardware decoding HEVC frames. It support up level 5.1 HEVC stream. It doesn't support yet 10 bits formats or scaling feature. Add HANTRO HEVC dedicated control to skip some bits at the beginning of the slice header. That is very specific to this hardware so can't go into uapi structures. Compute the needed value is complex and require information from the stream that only the userland knows so let it provide the correct value to the driver. Signed-off-by: Benjamin Gaignard Co-developed-by: Adrian Ratiu Signed-off-by: Adrian Ratiu Co-developed-by: Ezequiel Garcia Signed-off-by: Ezequiel Garcia --- version 5: - Add co-author tags. - Fix Ezequiel comments (typo, comments, etc). - Remove unused functions. version 4: - fix Ezequiel comments - use dedicated control as an integer - change hantro_g2_hevc_dec_run prototype to return errors version 2: - squash multiple commits in this one. - fix the comments done by Ezequiel about dma_alloc_coherent usage - fix Dan's comments about control copy, reverse the test logic in tile_buffer_reallocate, rework some goto and return cases. drivers/staging/media/hantro/Makefile | 2 + drivers/staging/media/hantro/hantro.h | 2 + drivers/staging/media/hantro/hantro_drv.c | 36 ++ .../staging/media/hantro/hantro_g2_hevc_dec.c | 587 ++++++++++++++++++ drivers/staging/media/hantro/hantro_g2_regs.h | 198 ++++++ drivers/staging/media/hantro/hantro_hevc.c | 324 ++++++++++ drivers/staging/media/hantro/hantro_hw.h | 49 ++ 7 files changed, 1198 insertions(+) create mode 100644 drivers/staging/media/hantro/hantro_g2_hevc_dec.c create mode 100644 drivers/staging/media/hantro/hantro_g2_regs.h create mode 100644 drivers/staging/media/hantro/hantro_hevc.c diff --git a/drivers/staging/media/hantro/Makefile b/drivers/staging/media/hantro/Makefile index 743ce08eb184..0357f1772267 100644 --- a/drivers/staging/media/hantro/Makefile +++ b/drivers/staging/media/hantro/Makefile @@ -9,12 +9,14 @@ hantro-vpu-y += \ hantro_h1_jpeg_enc.o \ hantro_g1_h264_dec.o \ hantro_g1_mpeg2_dec.o \ + hantro_g2_hevc_dec.o \ hantro_g1_vp8_dec.o \ rk3399_vpu_hw_jpeg_enc.o \ rk3399_vpu_hw_mpeg2_dec.o \ rk3399_vpu_hw_vp8_dec.o \ hantro_jpeg.o \ hantro_h264.o \ + hantro_hevc.o \ hantro_mpeg2.o \ hantro_vp8.o diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h index 83299e8d3a6c..976c1903d9ce 100644 --- a/drivers/staging/media/hantro/hantro.h +++ b/drivers/staging/media/hantro/hantro.h @@ -221,6 +221,7 @@ struct hantro_dev { * @jpeg_enc: JPEG-encoding context. * @mpeg2_dec: MPEG-2-decoding context. * @vp8_dec: VP8-decoding context. + * @hevc_dec: HEVC-decoding context. */ struct hantro_ctx { struct hantro_dev *dev; @@ -247,6 +248,7 @@ struct hantro_ctx { struct hantro_jpeg_enc_hw_ctx jpeg_enc; struct hantro_mpeg2_dec_hw_ctx mpeg2_dec; struct hantro_vp8_dec_hw_ctx vp8_dec; + struct hantro_hevc_dec_hw_ctx hevc_dec; }; }; diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index f0b68e16fcc0..13c197ca9ba3 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -281,6 +281,26 @@ static int hantro_jpeg_s_ctrl(struct v4l2_ctrl *ctrl) return 0; } +static int hantro_hevc_s_ctrl(struct v4l2_ctrl *ctrl) +{ + struct hantro_ctx *ctx; + + ctx = container_of(ctrl->handler, + struct hantro_ctx, ctrl_handler); + + vpu_debug(1, "s_ctrl: id = %d, val = %d\n", ctrl->id, ctrl->val); + + switch (ctrl->id) { + case V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP: + ctx->hevc_dec.ctrls.hevc_hdr_skip_length = ctrl->val; + break; + default: + return -EINVAL; + } + + return 0; +} + static const struct v4l2_ctrl_ops hantro_ctrl_ops = { .try_ctrl = hantro_try_ctrl, }; @@ -289,6 +309,10 @@ static const struct v4l2_ctrl_ops hantro_jpeg_ctrl_ops = { .s_ctrl = hantro_jpeg_s_ctrl, }; +static const struct v4l2_ctrl_ops hantro_hevc_ctrl_ops = { + .s_ctrl = hantro_hevc_s_ctrl, +}; + static const struct hantro_ctrl controls[] = { { .codec = HANTRO_JPEG_ENCODER, @@ -409,6 +433,18 @@ static const struct hantro_ctrl controls[] = { .cfg = { .id = V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS, }, + }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP, + .name = "Hantro HEVC slice header skip bytes", + .type = V4L2_CTRL_TYPE_INTEGER, + .min = 0, + .def = 0, + .max = 0x7fffffff, + .step = 1, + .ops = &hantro_hevc_ctrl_ops, + }, }, }; diff --git a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c new file mode 100644 index 000000000000..b9eaf4fa57b5 --- /dev/null +++ b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c @@ -0,0 +1,587 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Hantro VPU HEVC codec driver + * + * Copyright (C) 2020 Safran Passenger Innovations LLC + */ + +#include "hantro_hw.h" +#include "hantro_g2_regs.h" + +#define HEVC_DEC_MODE 0xC + +#define BUS_WIDTH_32 0 +#define BUS_WIDTH_64 1 +#define BUS_WIDTH_128 2 +#define BUS_WIDTH_256 3 + +static inline void hantro_write_addr(struct hantro_dev *vpu, + unsigned long offset, + dma_addr_t addr) +{ + vdpu_write(vpu, addr & 0xffffffff, offset); +} + +static void prepare_tile_info_buffer(struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls; + const struct v4l2_ctrl_hevc_pps *pps = ctrls->pps; + const struct v4l2_ctrl_hevc_sps *sps = ctrls->sps; + u16 *p = (u16 *)((u8 *)ctx->hevc_dec.tile_sizes.cpu); + unsigned int num_tile_rows = pps->num_tile_rows_minus1 + 1; + unsigned int num_tile_cols = pps->num_tile_columns_minus1 + 1; + unsigned int pic_width_in_ctbs, pic_height_in_ctbs; + unsigned int max_log2_ctb_size, ctb_size; + bool tiles_enabled, uniform_spacing; + u32 no_chroma = 0; + + tiles_enabled = !!(pps->flags & V4L2_HEVC_PPS_FLAG_TILES_ENABLED); + uniform_spacing = !!(pps->flags & V4L2_HEVC_PPS_FLAG_UNIFORM_SPACING); + + hantro_reg_write(vpu, hevc_tile_e, tiles_enabled); + + max_log2_ctb_size = sps->log2_min_luma_coding_block_size_minus3 + 3 + + sps->log2_diff_max_min_luma_coding_block_size; + pic_width_in_ctbs = (sps->pic_width_in_luma_samples + + (1 << max_log2_ctb_size) - 1) >> max_log2_ctb_size; + pic_height_in_ctbs = (sps->pic_height_in_luma_samples + (1 << max_log2_ctb_size) - 1) + >> max_log2_ctb_size; + ctb_size = 1 << max_log2_ctb_size; + + vpu_debug(1, "Preparing tile sizes buffer for %dx%d CTBs (CTB size %d)\n", + pic_width_in_ctbs, pic_height_in_ctbs, ctb_size); + + if (tiles_enabled) { + unsigned int i, j, h; + + vpu_debug(1, "Tiles enabled! %dx%d\n", num_tile_cols, num_tile_rows); + + hantro_reg_write(vpu, hevc_num_tile_rows, num_tile_rows); + hantro_reg_write(vpu, hevc_num_tile_cols, num_tile_cols); + + /* write width + height for each tile in pic */ + if (!uniform_spacing) { + u32 tmp_w = 0, tmp_h = 0; + + for (i = 0; i < num_tile_rows; i++) { + if (i == num_tile_rows - 1) + h = pic_height_in_ctbs - tmp_h; + else + h = pps->row_height_minus1[i] + 1; + tmp_h += h; + if (i == 0 && h == 1 && ctb_size == 16) + no_chroma = 1; + for (j = 0, tmp_w = 0; j < num_tile_cols - 1; j++) { + tmp_w += pps->column_width_minus1[j] + 1; + *p++ = pps->column_width_minus1[j + 1]; + *p++ = h; + if (i == 0 && h == 1 && ctb_size == 16) + no_chroma = 1; + } + /* last column */ + *p++ = pic_width_in_ctbs - tmp_w; + *p++ = h; + } + } else { /* uniform spacing */ + u32 tmp, prev_h, prev_w; + + for (i = 0, prev_h = 0; i < num_tile_rows; i++) { + tmp = (i + 1) * pic_height_in_ctbs / num_tile_rows; + h = tmp - prev_h; + prev_h = tmp; + if (i == 0 && h == 1 && ctb_size == 16) + no_chroma = 1; + for (j = 0, prev_w = 0; j < num_tile_cols; j++) { + tmp = (j + 1) * pic_width_in_ctbs / num_tile_cols; + *p++ = tmp - prev_w; + *p++ = h; + if (j == 0 && + (pps->column_width_minus1[0] + 1) == 1 && + ctb_size == 16) + no_chroma = 1; + prev_w = tmp; + } + } + } + } else { + hantro_reg_write(vpu, hevc_num_tile_rows, 1); + hantro_reg_write(vpu, hevc_num_tile_cols, 1); + + /* There's one tile, with dimensions equal to pic size. */ + p[0] = pic_width_in_ctbs; + p[1] = pic_height_in_ctbs; + } + + if (no_chroma) + vpu_debug(1, "%s: no chroma!\n", __func__); +} + +static void set_params(struct hantro_ctx *ctx) +{ + const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls; + const struct v4l2_ctrl_hevc_sps *sps = ctrls->sps; + const struct v4l2_ctrl_hevc_pps *pps = ctrls->pps; + const struct v4l2_ctrl_hevc_decode_params *decode_params = ctrls->decode_params; + struct hantro_dev *vpu = ctx->dev; + u32 min_log2_cb_size, max_log2_ctb_size, min_cb_size, max_ctb_size; + u32 pic_width_in_min_cbs, pic_height_in_min_cbs; + u32 pic_width_aligned, pic_height_aligned; + u32 partial_ctb_x, partial_ctb_y; + + hantro_reg_write(vpu, hevc_bit_depth_y_minus8, sps->bit_depth_luma_minus8); + hantro_reg_write(vpu, hevc_bit_depth_c_minus8, sps->bit_depth_chroma_minus8); + + hantro_reg_write(vpu, hevc_output_8_bits, 0); + + hantro_reg_write(vpu, hevc_hdr_skip_length, ctrls->hevc_hdr_skip_length); + + min_log2_cb_size = sps->log2_min_luma_coding_block_size_minus3 + 3; + max_log2_ctb_size = min_log2_cb_size + sps->log2_diff_max_min_luma_coding_block_size; + + hantro_reg_write(vpu, hevc_min_cb_size, min_log2_cb_size); + hantro_reg_write(vpu, hevc_max_cb_size, max_log2_ctb_size); + + min_cb_size = 1 << min_log2_cb_size; + max_ctb_size = 1 << max_log2_ctb_size; + + pic_width_in_min_cbs = sps->pic_width_in_luma_samples / min_cb_size; + pic_height_in_min_cbs = sps->pic_height_in_luma_samples / min_cb_size; + pic_width_aligned = ALIGN(sps->pic_width_in_luma_samples, max_ctb_size); + pic_height_aligned = ALIGN(sps->pic_height_in_luma_samples, max_ctb_size); + + partial_ctb_x = !!(sps->pic_width_in_luma_samples != pic_width_aligned); + partial_ctb_y = !!(sps->pic_height_in_luma_samples != pic_height_aligned); + + hantro_reg_write(vpu, hevc_partial_ctb_x, partial_ctb_x); + hantro_reg_write(vpu, hevc_partial_ctb_y, partial_ctb_y); + + hantro_reg_write(vpu, hevc_pic_width_in_cbs, pic_width_in_min_cbs); + hantro_reg_write(vpu, hevc_pic_height_in_cbs, pic_height_in_min_cbs); + + hantro_reg_write(vpu, hevc_pic_width_4x4, + (pic_width_in_min_cbs * min_cb_size) / 4); + hantro_reg_write(vpu, hevc_pic_height_4x4, + (pic_height_in_min_cbs * min_cb_size) / 4); + + hantro_reg_write(vpu, hevc_max_inter_hierdepth, + sps->max_transform_hierarchy_depth_inter); + hantro_reg_write(vpu, hevc_max_intra_hierdepth, + sps->max_transform_hierarchy_depth_intra); + hantro_reg_write(vpu, hevc_min_trb_size, + sps->log2_min_luma_transform_block_size_minus2 + 2); + hantro_reg_write(vpu, hevc_max_trb_size, + sps->log2_min_luma_transform_block_size_minus2 + 2 + + sps->log2_diff_max_min_luma_transform_block_size); + + hantro_reg_write(vpu, hevc_tempor_mvp_e, + !!(sps->flags & V4L2_HEVC_SPS_FLAG_SPS_TEMPORAL_MVP_ENABLED) && + !(decode_params->flags & V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC)); + hantro_reg_write(vpu, hevc_strong_smooth_e, + !!(sps->flags & V4L2_HEVC_SPS_FLAG_STRONG_INTRA_SMOOTHING_ENABLED)); + hantro_reg_write(vpu, hevc_asym_pred_e, + !!(sps->flags & V4L2_HEVC_SPS_FLAG_AMP_ENABLED)); + hantro_reg_write(vpu, hevc_sao_e, + !!(sps->flags & V4L2_HEVC_SPS_FLAG_SAMPLE_ADAPTIVE_OFFSET)); + hantro_reg_write(vpu, hevc_sign_data_hide, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_SIGN_DATA_HIDING_ENABLED)); + + if (pps->flags & V4L2_HEVC_PPS_FLAG_CU_QP_DELTA_ENABLED) { + hantro_reg_write(vpu, hevc_cu_qpd_e, 1); + hantro_reg_write(vpu, hevc_max_cu_qpd_depth, pps->diff_cu_qp_delta_depth); + } else { + hantro_reg_write(vpu, hevc_cu_qpd_e, 0); + hantro_reg_write(vpu, hevc_max_cu_qpd_depth, 0); + } + + if (pps->flags & V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT) { + hantro_reg_write(vpu, hevc_cb_qp_offset, pps->pps_cb_qp_offset); + hantro_reg_write(vpu, hevc_cr_qp_offset, pps->pps_cr_qp_offset); + } else { + hantro_reg_write(vpu, hevc_cb_qp_offset, 0); + hantro_reg_write(vpu, hevc_cr_qp_offset, 0); + } + + hantro_reg_write(vpu, hevc_filt_offset_beta, pps->pps_beta_offset_div2); + hantro_reg_write(vpu, hevc_filt_offset_tc, pps->pps_tc_offset_div2); + hantro_reg_write(vpu, hevc_slice_hdr_ext_e, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_SLICE_SEGMENT_HEADER_EXTENSION_PRESENT)); + hantro_reg_write(vpu, hevc_slice_hdr_ext_bits, pps->num_extra_slice_header_bits); + hantro_reg_write(vpu, hevc_slice_chqp_present, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT)); + hantro_reg_write(vpu, hevc_weight_bipr_idc, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_WEIGHTED_BIPRED)); + hantro_reg_write(vpu, hevc_transq_bypass, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_TRANSQUANT_BYPASS_ENABLED)); + hantro_reg_write(vpu, hevc_list_mod_e, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_LISTS_MODIFICATION_PRESENT)); + hantro_reg_write(vpu, hevc_entropy_sync_e, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_ENTROPY_CODING_SYNC_ENABLED)); + hantro_reg_write(vpu, hevc_cabac_init_present, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_CABAC_INIT_PRESENT)); + hantro_reg_write(vpu, hevc_idr_pic_e, + !!(decode_params->flags & V4L2_HEVC_DECODE_PARAM_FLAG_IRAP_PIC)); + hantro_reg_write(vpu, hevc_parallel_merge, + pps->log2_parallel_merge_level_minus2 + 2); + hantro_reg_write(vpu, hevc_pcm_filt_d, + !!(sps->flags & V4L2_HEVC_SPS_FLAG_PCM_LOOP_FILTER_DISABLED)); + hantro_reg_write(vpu, hevc_pcm_e, + !!(sps->flags & V4L2_HEVC_SPS_FLAG_PCM_ENABLED)); + if (sps->flags & V4L2_HEVC_SPS_FLAG_PCM_ENABLED) { + hantro_reg_write(vpu, hevc_max_pcm_size, + sps->log2_diff_max_min_pcm_luma_coding_block_size + + sps->log2_min_pcm_luma_coding_block_size_minus3 + 3); + hantro_reg_write(vpu, hevc_min_pcm_size, + sps->log2_min_pcm_luma_coding_block_size_minus3 + 3); + hantro_reg_write(vpu, hevc_bit_depth_pcm_y, + sps->pcm_sample_bit_depth_luma_minus1 + 1); + hantro_reg_write(vpu, hevc_bit_depth_pcm_c, + sps->pcm_sample_bit_depth_chroma_minus1 + 1); + } else { + hantro_reg_write(vpu, hevc_max_pcm_size, 0); + hantro_reg_write(vpu, hevc_min_pcm_size, 0); + hantro_reg_write(vpu, hevc_bit_depth_pcm_y, 0); + hantro_reg_write(vpu, hevc_bit_depth_pcm_c, 0); + } + + hantro_reg_write(vpu, hevc_start_code_e, 1); + hantro_reg_write(vpu, hevc_init_qp, pps->init_qp_minus26 + 26); + hantro_reg_write(vpu, hevc_weight_pred_e, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_WEIGHTED_PRED)); + hantro_reg_write(vpu, hevc_cabac_init_present, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_CABAC_INIT_PRESENT)); + hantro_reg_write(vpu, hevc_const_intra_e, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_CONSTRAINED_INTRA_PRED)); + hantro_reg_write(vpu, hevc_transform_skip, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_TRANSFORM_SKIP_ENABLED)); + hantro_reg_write(vpu, hevc_out_filtering_dis, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_PPS_DISABLE_DEBLOCKING_FILTER)); + hantro_reg_write(vpu, hevc_filt_ctrl_pres, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT)); + hantro_reg_write(vpu, hevc_dependent_slice, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT)); + hantro_reg_write(vpu, hevc_filter_override, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_OVERRIDE_ENABLED)); + hantro_reg_write(vpu, hevc_refidx0_active, + pps->num_ref_idx_l0_default_active_minus1 + 1); + hantro_reg_write(vpu, hevc_refidx1_active, + pps->num_ref_idx_l1_default_active_minus1 + 1); + hantro_reg_write(vpu, hevc_apf_threshold, 8); +} + +static int find_ref_pic_index(const struct v4l2_hevc_dpb_entry *dpb, int pic_order_cnt) +{ + int i; + + for (i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) { + if (dpb[i].pic_order_cnt[0] == pic_order_cnt) + return i; + } + + return 0x0; +} + +static void set_ref_pic_list(struct hantro_ctx *ctx) +{ + const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls; + struct hantro_dev *vpu = ctx->dev; + const struct v4l2_ctrl_hevc_decode_params *decode_params = ctrls->decode_params; + const struct v4l2_hevc_dpb_entry *dpb = decode_params->dpb; + u32 list0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] = {0}; + u32 list1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] = {0}; + const struct hantro_reg *ref_pic_regs0[] = { + hevc_rlist_f0, + hevc_rlist_f1, + hevc_rlist_f2, + hevc_rlist_f3, + hevc_rlist_f4, + hevc_rlist_f5, + hevc_rlist_f6, + hevc_rlist_f7, + hevc_rlist_f8, + hevc_rlist_f9, + hevc_rlist_f10, + hevc_rlist_f11, + hevc_rlist_f12, + hevc_rlist_f13, + hevc_rlist_f14, + hevc_rlist_f15, + }; + const struct hantro_reg *ref_pic_regs1[] = { + hevc_rlist_b0, + hevc_rlist_b1, + hevc_rlist_b2, + hevc_rlist_b3, + hevc_rlist_b4, + hevc_rlist_b5, + hevc_rlist_b6, + hevc_rlist_b7, + hevc_rlist_b8, + hevc_rlist_b9, + hevc_rlist_b10, + hevc_rlist_b11, + hevc_rlist_b12, + hevc_rlist_b13, + hevc_rlist_b14, + hevc_rlist_b15, + }; + unsigned int i, j; + + /* List 0 contains: short term before, short term after and long term */ + j = 0; + for (i = 0; i < decode_params->num_poc_st_curr_before && j < ARRAY_SIZE(list0); i++) + list0[j++] = find_ref_pic_index(dpb, decode_params->poc_st_curr_before[i]); + for (i = 0; i < decode_params->num_poc_st_curr_after && j < ARRAY_SIZE(list0); i++) + list0[j++] = find_ref_pic_index(dpb, decode_params->poc_st_curr_after[i]); + for (i = 0; i < decode_params->num_poc_lt_curr && j < ARRAY_SIZE(list0); i++) + list0[j++] = find_ref_pic_index(dpb, decode_params->poc_lt_curr[i]); + + /* Fill the list, copying over and over */ + i = 0; + while (j < ARRAY_SIZE(list0)) + list0[j++] = list0[i++]; + + j = 0; + for (i = 0; i < decode_params->num_poc_st_curr_after && j < ARRAY_SIZE(list1); i++) + list1[j++] = find_ref_pic_index(dpb, decode_params->poc_st_curr_after[i]); + for (i = 0; i < decode_params->num_poc_st_curr_before && j < ARRAY_SIZE(list1); i++) + list1[j++] = find_ref_pic_index(dpb, decode_params->poc_st_curr_before[i]); + for (i = 0; i < decode_params->num_poc_lt_curr && j < ARRAY_SIZE(list1); i++) + list1[j++] = find_ref_pic_index(dpb, decode_params->poc_lt_curr[i]); + + i = 0; + while (j < ARRAY_SIZE(list1)) + list1[j++] = list1[i++]; + + for (i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) { + hantro_reg_write(vpu, ref_pic_regs0[i], list0[i]); + hantro_reg_write(vpu, ref_pic_regs1[i], list1[i]); + } +} + +static int set_ref(struct hantro_ctx *ctx) +{ + const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls; + const struct v4l2_ctrl_hevc_sps *sps = ctrls->sps; + const struct v4l2_ctrl_hevc_pps *pps = ctrls->pps; + const struct v4l2_ctrl_hevc_decode_params *decode_params = ctrls->decode_params; + const struct v4l2_hevc_dpb_entry *dpb = decode_params->dpb; + dma_addr_t luma_addr, chroma_addr, mv_addr = 0; + struct hantro_dev *vpu = ctx->dev; + size_t cr_offset = hantro_hevc_chroma_offset(sps); + size_t mv_offset = hantro_hevc_motion_vectors_offset(sps); + u32 max_ref_frames; + u16 dpb_longterm_e; + + const struct hantro_reg *cur_poc[] = { + hevc_cur_poc_00, + hevc_cur_poc_01, + hevc_cur_poc_02, + hevc_cur_poc_03, + hevc_cur_poc_04, + hevc_cur_poc_05, + hevc_cur_poc_06, + hevc_cur_poc_07, + hevc_cur_poc_08, + hevc_cur_poc_09, + hevc_cur_poc_10, + hevc_cur_poc_11, + hevc_cur_poc_12, + hevc_cur_poc_13, + hevc_cur_poc_14, + hevc_cur_poc_15, + }; + unsigned int i; + + max_ref_frames = decode_params->num_poc_lt_curr + + decode_params->num_poc_st_curr_before + + decode_params->num_poc_st_curr_after; + /* + * Set max_ref_frames to non-zero to avoid HW hang when decoding + * badly marked I-frames. + */ + max_ref_frames = max_ref_frames ? max_ref_frames : 1; + hantro_reg_write(vpu, hevc_num_ref_frames, max_ref_frames); + hantro_reg_write(vpu, hevc_filter_over_slices, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED)); + hantro_reg_write(vpu, hevc_filter_over_tiles, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED)); + + /* + * Write POC count diff from current pic. For frame decoding only compute + * pic_order_cnt[0] and ignore pic_order_cnt[1] used in field-coding. + */ + for (i = 0; i < decode_params->num_active_dpb_entries && i < ARRAY_SIZE(cur_poc); i++) { + char poc_diff = decode_params->pic_order_cnt_val - dpb[i].pic_order_cnt[0]; + + hantro_reg_write(vpu, cur_poc[i], poc_diff); + } + + if (i < ARRAY_SIZE(cur_poc)) { + /* + * After the references, fill one entry pointing to itself, + * i.e. difference is zero. + */ + hantro_reg_write(vpu, cur_poc[i], 0); + i++; + } + + /* Fill the rest with the current picture */ + for (; i < ARRAY_SIZE(cur_poc); i++) + hantro_reg_write(vpu, cur_poc[i], decode_params->pic_order_cnt_val); + + set_ref_pic_list(ctx); + + /* We will only keep the references picture that are still used */ + ctx->hevc_dec.ref_bufs_used = 0; + + /* Set up addresses of DPB buffers */ + dpb_longterm_e = 0; + for (i = 0; i < decode_params->num_active_dpb_entries && + i < (V4L2_HEVC_DPB_ENTRIES_NUM_MAX - 1); i++) { + luma_addr = hantro_hevc_get_ref_buf(ctx, dpb[i].pic_order_cnt[0]); + if (!luma_addr) + return -ENOMEM; + + chroma_addr = luma_addr + cr_offset; + mv_addr = luma_addr + mv_offset; + + if (dpb[i].rps == V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR) + dpb_longterm_e |= BIT(V4L2_HEVC_DPB_ENTRIES_NUM_MAX - 1 - i); + + hantro_write_addr(vpu, HEVC_REG_ADDR_REF(i), luma_addr); + hantro_write_addr(vpu, HEVC_REG_CHR_REF(i), chroma_addr); + hantro_write_addr(vpu, HEVC_REG_DMV_REF(i), mv_addr); + } + + luma_addr = hantro_hevc_get_ref_buf(ctx, decode_params->pic_order_cnt_val); + if (!luma_addr) + return -ENOMEM; + + chroma_addr = luma_addr + cr_offset; + mv_addr = luma_addr + mv_offset; + + hantro_write_addr(vpu, HEVC_REG_ADDR_REF(i), luma_addr); + hantro_write_addr(vpu, HEVC_REG_CHR_REF(i), chroma_addr); + hantro_write_addr(vpu, HEVC_REG_DMV_REF(i++), mv_addr); + + hantro_write_addr(vpu, HEVC_ADDR_DST, luma_addr); + hantro_write_addr(vpu, HEVC_ADDR_DST_CHR, chroma_addr); + hantro_write_addr(vpu, HEVC_ADDR_DST_MV, mv_addr); + + hantro_hevc_ref_remove_unused(ctx); + + for (; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) { + hantro_write_addr(vpu, HEVC_REG_ADDR_REF(i), 0); + hantro_write_addr(vpu, HEVC_REG_CHR_REF(i), 0); + hantro_write_addr(vpu, HEVC_REG_DMV_REF(i), 0); + } + + hantro_reg_write(vpu, hevc_refer_lterm_e, dpb_longterm_e); + + return 0; +} + +static void set_buffers(struct hantro_ctx *ctx) +{ + struct vb2_v4l2_buffer *src_buf, *dst_buf; + struct hantro_dev *vpu = ctx->dev; + const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls; + const struct v4l2_ctrl_hevc_sps *sps = ctrls->sps; + size_t cr_offset = hantro_hevc_chroma_offset(sps); + dma_addr_t src_dma, dst_dma; + u32 src_len, src_buf_len; + + src_buf = hantro_get_src_buf(ctx); + dst_buf = hantro_get_dst_buf(ctx); + + /* Source (stream) buffer. */ + src_dma = vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0); + src_len = vb2_get_plane_payload(&src_buf->vb2_buf, 0); + src_buf_len = vb2_plane_size(&src_buf->vb2_buf, 0); + + hantro_write_addr(vpu, HEVC_ADDR_STR, src_dma); + hantro_reg_write(vpu, hevc_stream_len, src_len); + hantro_reg_write(vpu, hevc_strm_buffer_len, src_buf_len); + hantro_reg_write(vpu, hevc_strm_start_offset, 0); + hantro_reg_write(vpu, hevc_write_mvs_e, 1); + + /* Destination (decoded frame) buffer. */ + dst_dma = hantro_get_dec_buf_addr(ctx, &dst_buf->vb2_buf); + + hantro_write_addr(vpu, HEVC_RASTER_SCAN, dst_dma); + hantro_write_addr(vpu, HEVC_RASTER_SCAN_CHR, dst_dma + cr_offset); + hantro_write_addr(vpu, HEVC_ADDR_TILE_SIZE, ctx->hevc_dec.tile_sizes.dma); + hantro_write_addr(vpu, HEVC_TILE_FILTER, ctx->hevc_dec.tile_filter.dma); + hantro_write_addr(vpu, HEVC_TILE_SAO, ctx->hevc_dec.tile_sao.dma); + hantro_write_addr(vpu, HEVC_TILE_BSD, ctx->hevc_dec.tile_bsd.dma); +} + +void hantro_g2_check_idle(struct hantro_dev *vpu) +{ + int i; + + for (i = 0; i < 3; i++) { + u32 status; + + /* Make sure the VPU is idle */ + status = vdpu_read(vpu, HEVC_REG_INTERRUPT); + if (status & HEVC_REG_INTERRUPT_DEC_E) { + dev_warn(vpu->dev, "device still running, aborting"); + status |= HEVC_REG_INTERRUPT_DEC_ABORT_E | HEVC_REG_INTERRUPT_DEC_IRQ_DIS; + vdpu_write(vpu, status, HEVC_REG_INTERRUPT); + } + } +} + +int hantro_g2_hevc_dec_run(struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + int ret; + + hantro_g2_check_idle(vpu); + + /* Prepare HEVC decoder context. */ + ret = hantro_hevc_dec_prepare_run(ctx); + if (ret) + return ret; + + /* Configure hardware registers. */ + set_params(ctx); + + /* set reference pictures */ + ret = set_ref(ctx); + if (ret) + return ret; + + set_buffers(ctx); + prepare_tile_info_buffer(ctx); + + hantro_end_prepare_run(ctx); + + hantro_reg_write(vpu, hevc_mode, HEVC_DEC_MODE); + hantro_reg_write(vpu, hevc_clk_gate_e, 1); + + /* Don't disable output */ + hantro_reg_write(vpu, hevc_out_dis, 0); + + /* Don't compress buffers */ + hantro_reg_write(vpu, hevc_ref_compress_bypass, 1); + + /* use NV12 as output format */ + hantro_reg_write(vpu, hevc_out_rs_e, 1); + + /* Bus width and max burst */ + hantro_reg_write(vpu, hevc_buswidth, BUS_WIDTH_128); + hantro_reg_write(vpu, hevc_max_burst, 16); + + /* Swap */ + hantro_reg_write(vpu, hevc_strm_swap, 0xf); + hantro_reg_write(vpu, hevc_dirmv_swap, 0xf); + hantro_reg_write(vpu, hevc_compress_swap, 0xf); + + /* Start decoding! */ + vdpu_write(vpu, HEVC_REG_INTERRUPT_DEC_E, HEVC_REG_INTERRUPT); + + return 0; +} diff --git a/drivers/staging/media/hantro/hantro_g2_regs.h b/drivers/staging/media/hantro/hantro_g2_regs.h new file mode 100644 index 000000000000..a361c9ba911d --- /dev/null +++ b/drivers/staging/media/hantro/hantro_g2_regs.h @@ -0,0 +1,198 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2021, Collabora + * + * Author: Benjamin Gaignard + */ + +#ifndef HANTRO_G2_REGS_H_ +#define HANTRO_G2_REGS_H_ + +#include "hantro.h" + +#define G2_SWREG(nr) ((nr) * 4) + +#define HEVC_DEC_REG(name, base, shift, mask) \ + static const struct hantro_reg _hevc_##name[] = { \ + { G2_SWREG(base), (shift), (mask) } \ + }; \ + static const struct hantro_reg __maybe_unused *hevc_##name = &_hevc_##name[0]; + +#define HEVC_REG_VERSION G2_SWREG(0) + +#define HEVC_REG_INTERRUPT G2_SWREG(1) +#define HEVC_REG_INTERRUPT_DEC_RDY_INT BIT(12) +#define HEVC_REG_INTERRUPT_DEC_ABORT_E BIT(5) +#define HEVC_REG_INTERRUPT_DEC_IRQ_DIS BIT(4) +#define HEVC_REG_INTERRUPT_DEC_E BIT(0) + +HEVC_DEC_REG(strm_swap, 2, 28, 0xf) +HEVC_DEC_REG(dirmv_swap, 2, 20, 0xf) + +HEVC_DEC_REG(mode, 3, 27, 0x1f) +HEVC_DEC_REG(compress_swap, 3, 20, 0xf) +HEVC_DEC_REG(ref_compress_bypass, 3, 17, 0x1) +HEVC_DEC_REG(out_rs_e, 3, 16, 0x1) +HEVC_DEC_REG(out_dis, 3, 15, 0x1) +HEVC_DEC_REG(out_filtering_dis, 3, 14, 0x1) +HEVC_DEC_REG(write_mvs_e, 3, 12, 0x1) + +HEVC_DEC_REG(pic_width_in_cbs, 4, 19, 0x1ff) +HEVC_DEC_REG(pic_height_in_cbs, 4, 6, 0x1ff) +HEVC_DEC_REG(num_ref_frames, 4, 0, 0x1f) + +HEVC_DEC_REG(scaling_list_e, 5, 24, 0x1) +HEVC_DEC_REG(cb_qp_offset, 5, 19, 0x1f) +HEVC_DEC_REG(cr_qp_offset, 5, 14, 0x1f) +HEVC_DEC_REG(sign_data_hide, 5, 12, 0x1) +HEVC_DEC_REG(tempor_mvp_e, 5, 11, 0x1) +HEVC_DEC_REG(max_cu_qpd_depth, 5, 5, 0x3f) +HEVC_DEC_REG(cu_qpd_e, 5, 4, 0x1) + +HEVC_DEC_REG(stream_len, 6, 0, 0xffffffff) + +HEVC_DEC_REG(cabac_init_present, 7, 31, 0x1) +HEVC_DEC_REG(weight_pred_e, 7, 28, 0x1) +HEVC_DEC_REG(weight_bipr_idc, 7, 26, 0x3) +HEVC_DEC_REG(filter_over_slices, 7, 25, 0x1) +HEVC_DEC_REG(filter_over_tiles, 7, 24, 0x1) +HEVC_DEC_REG(asym_pred_e, 7, 23, 0x1) +HEVC_DEC_REG(sao_e, 7, 22, 0x1) +HEVC_DEC_REG(pcm_filt_d, 7, 21, 0x1) +HEVC_DEC_REG(slice_chqp_present, 7, 20, 0x1) +HEVC_DEC_REG(dependent_slice, 7, 19, 0x1) +HEVC_DEC_REG(filter_override, 7, 18, 0x1) +HEVC_DEC_REG(strong_smooth_e, 7, 17, 0x1) +HEVC_DEC_REG(filt_offset_beta, 7, 12, 0x1f) +HEVC_DEC_REG(filt_offset_tc, 7, 7, 0x1f) +HEVC_DEC_REG(slice_hdr_ext_e, 7, 6, 0x1) +HEVC_DEC_REG(slice_hdr_ext_bits, 7, 3, 0x7) + +HEVC_DEC_REG(const_intra_e, 8, 31, 0x1) +HEVC_DEC_REG(filt_ctrl_pres, 8, 30, 0x1) +HEVC_DEC_REG(idr_pic_e, 8, 16, 0x1) +HEVC_DEC_REG(bit_depth_pcm_y, 8, 12, 0xf) +HEVC_DEC_REG(bit_depth_pcm_c, 8, 8, 0xf) +HEVC_DEC_REG(bit_depth_y_minus8, 8, 6, 0x3) +HEVC_DEC_REG(bit_depth_c_minus8, 8, 4, 0x3) +HEVC_DEC_REG(output_8_bits, 8, 3, 0x1) + +HEVC_DEC_REG(refidx1_active, 9, 19, 0x1f) +HEVC_DEC_REG(refidx0_active, 9, 14, 0x1f) +HEVC_DEC_REG(hdr_skip_length, 9, 0, 0x3fff) + +HEVC_DEC_REG(start_code_e, 10, 31, 0x1) +HEVC_DEC_REG(init_qp, 10, 24, 0x3f) +HEVC_DEC_REG(num_tile_cols, 10, 19, 0x1f) +HEVC_DEC_REG(num_tile_rows, 10, 14, 0x1f) +HEVC_DEC_REG(tile_e, 10, 1, 0x1) +HEVC_DEC_REG(entropy_sync_e, 10, 0, 0x1) + +HEVC_DEC_REG(refer_lterm_e, 12, 16, 0xffff) +HEVC_DEC_REG(min_cb_size, 12, 13, 0x7) +HEVC_DEC_REG(max_cb_size, 12, 10, 0x7) +HEVC_DEC_REG(min_pcm_size, 12, 7, 0x7) +HEVC_DEC_REG(max_pcm_size, 12, 4, 0x7) +HEVC_DEC_REG(pcm_e, 12, 3, 0x1) +HEVC_DEC_REG(transform_skip, 12, 2, 0x1) +HEVC_DEC_REG(transq_bypass, 12, 1, 0x1) +HEVC_DEC_REG(list_mod_e, 12, 0, 0x1) + +HEVC_DEC_REG(min_trb_size, 13, 13, 0x7) +HEVC_DEC_REG(max_trb_size, 13, 10, 0x7) +HEVC_DEC_REG(max_intra_hierdepth, 13, 7, 0x7) +HEVC_DEC_REG(max_inter_hierdepth, 13, 4, 0x7) +HEVC_DEC_REG(parallel_merge, 13, 0, 0xf) + +HEVC_DEC_REG(rlist_f0, 14, 0, 0x1f) +HEVC_DEC_REG(rlist_f1, 14, 10, 0x1f) +HEVC_DEC_REG(rlist_f2, 14, 20, 0x1f) +HEVC_DEC_REG(rlist_b0, 14, 5, 0x1f) +HEVC_DEC_REG(rlist_b1, 14, 15, 0x1f) +HEVC_DEC_REG(rlist_b2, 14, 25, 0x1f) + +HEVC_DEC_REG(rlist_f3, 15, 0, 0x1f) +HEVC_DEC_REG(rlist_f4, 15, 10, 0x1f) +HEVC_DEC_REG(rlist_f5, 15, 20, 0x1f) +HEVC_DEC_REG(rlist_b3, 15, 5, 0x1f) +HEVC_DEC_REG(rlist_b4, 15, 15, 0x1f) +HEVC_DEC_REG(rlist_b5, 15, 25, 0x1f) + +HEVC_DEC_REG(rlist_f6, 16, 0, 0x1f) +HEVC_DEC_REG(rlist_f7, 16, 10, 0x1f) +HEVC_DEC_REG(rlist_f8, 16, 20, 0x1f) +HEVC_DEC_REG(rlist_b6, 16, 5, 0x1f) +HEVC_DEC_REG(rlist_b7, 16, 15, 0x1f) +HEVC_DEC_REG(rlist_b8, 16, 25, 0x1f) + +HEVC_DEC_REG(rlist_f9, 17, 0, 0x1f) +HEVC_DEC_REG(rlist_f10, 17, 10, 0x1f) +HEVC_DEC_REG(rlist_f11, 17, 20, 0x1f) +HEVC_DEC_REG(rlist_b9, 17, 5, 0x1f) +HEVC_DEC_REG(rlist_b10, 17, 15, 0x1f) +HEVC_DEC_REG(rlist_b11, 17, 25, 0x1f) + +HEVC_DEC_REG(rlist_f12, 18, 0, 0x1f) +HEVC_DEC_REG(rlist_f13, 18, 10, 0x1f) +HEVC_DEC_REG(rlist_f14, 18, 20, 0x1f) +HEVC_DEC_REG(rlist_b12, 18, 5, 0x1f) +HEVC_DEC_REG(rlist_b13, 18, 15, 0x1f) +HEVC_DEC_REG(rlist_b14, 18, 25, 0x1f) + +HEVC_DEC_REG(rlist_f15, 19, 0, 0x1f) +HEVC_DEC_REG(rlist_b15, 19, 5, 0x1f) + +HEVC_DEC_REG(partial_ctb_x, 20, 31, 0x1) +HEVC_DEC_REG(partial_ctb_y, 20, 30, 0x1) +HEVC_DEC_REG(pic_width_4x4, 20, 16, 0xfff) +HEVC_DEC_REG(pic_height_4x4, 20, 0, 0xfff) + +HEVC_DEC_REG(cur_poc_00, 46, 24, 0xff) +HEVC_DEC_REG(cur_poc_01, 46, 16, 0xff) +HEVC_DEC_REG(cur_poc_02, 46, 8, 0xff) +HEVC_DEC_REG(cur_poc_03, 46, 0, 0xff) + +HEVC_DEC_REG(cur_poc_04, 47, 24, 0xff) +HEVC_DEC_REG(cur_poc_05, 47, 16, 0xff) +HEVC_DEC_REG(cur_poc_06, 47, 8, 0xff) +HEVC_DEC_REG(cur_poc_07, 47, 0, 0xff) + +HEVC_DEC_REG(cur_poc_08, 48, 24, 0xff) +HEVC_DEC_REG(cur_poc_09, 48, 16, 0xff) +HEVC_DEC_REG(cur_poc_10, 48, 8, 0xff) +HEVC_DEC_REG(cur_poc_11, 48, 0, 0xff) + +HEVC_DEC_REG(cur_poc_12, 49, 24, 0xff) +HEVC_DEC_REG(cur_poc_13, 49, 16, 0xff) +HEVC_DEC_REG(cur_poc_14, 49, 8, 0xff) +HEVC_DEC_REG(cur_poc_15, 49, 0, 0xff) + +HEVC_DEC_REG(apf_threshold, 55, 0, 0xffff) + +HEVC_DEC_REG(clk_gate_e, 58, 16, 0x1) +HEVC_DEC_REG(buswidth, 58, 8, 0x7) +HEVC_DEC_REG(max_burst, 58, 0, 0xff) + +#define HEVC_REG_CONFIG G2_SWREG(58) +#define HEVC_REG_CONFIG_DEC_CLK_GATE_E BIT(16) +#define HEVC_REG_CONFIG_DEC_CLK_GATE_IDLE_E BIT(17) + +#define HEVC_ADDR_DST (G2_SWREG(65)) +#define HEVC_REG_ADDR_REF(i) (G2_SWREG(67) + ((i) * 0x8)) +#define HEVC_ADDR_DST_CHR (G2_SWREG(99)) +#define HEVC_REG_CHR_REF(i) (G2_SWREG(101) + ((i) * 0x8)) +#define HEVC_ADDR_DST_MV (G2_SWREG(133)) +#define HEVC_REG_DMV_REF(i) (G2_SWREG(135) + ((i) * 0x8)) +#define HEVC_ADDR_TILE_SIZE (G2_SWREG(167)) +#define HEVC_ADDR_STR (G2_SWREG(169)) +#define HEVC_SCALING_LIST (G2_SWREG(171)) +#define HEVC_RASTER_SCAN (G2_SWREG(175)) +#define HEVC_RASTER_SCAN_CHR (G2_SWREG(177)) +#define HEVC_TILE_FILTER (G2_SWREG(179)) +#define HEVC_TILE_SAO (G2_SWREG(181)) +#define HEVC_TILE_BSD (G2_SWREG(183)) + +HEVC_DEC_REG(strm_buffer_len, 258, 0, 0xffffffff) +HEVC_DEC_REG(strm_start_offset, 259, 0, 0xffffffff) + +#endif diff --git a/drivers/staging/media/hantro/hantro_hevc.c b/drivers/staging/media/hantro/hantro_hevc.c new file mode 100644 index 000000000000..4058046bb43e --- /dev/null +++ b/drivers/staging/media/hantro/hantro_hevc.c @@ -0,0 +1,324 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Hantro VPU HEVC codec driver + * + * Copyright (C) 2020 Safran Passenger Innovations LLC + */ + +#include +#include + +#include "hantro.h" +#include "hantro_hw.h" + +#define VERT_FILTER_RAM_SIZE 8 /* bytes per pixel row */ +/* + * BSD control data of current picture at tile border + * 128 bits per 4x4 tile = 128/(8*4) bytes per row + */ +#define BSD_CTRL_RAM_SIZE 4 /* bytes per pixel row */ +/* tile border coefficients of filter */ +#define VERT_SAO_RAM_SIZE 48 /* bytes per pixel */ + +#define MAX_TILE_COLS 20 +#define MAX_TILE_ROWS 22 + +#define UNUSED_REF -1 + +#define G2_ALIGN 16 +#define MC_WORD_SIZE 32 + +size_t hantro_hevc_chroma_offset(const struct v4l2_ctrl_hevc_sps *sps) +{ + int bytes_per_pixel = sps->bit_depth_luma_minus8 == 0 ? 1 : 2; + + return sps->pic_width_in_luma_samples * + sps->pic_height_in_luma_samples * bytes_per_pixel; +} + +size_t hantro_hevc_motion_vectors_offset(const struct v4l2_ctrl_hevc_sps *sps) +{ + size_t cr_offset = hantro_hevc_chroma_offset(sps); + + return ALIGN((cr_offset * 3) / 2, G2_ALIGN) + MC_WORD_SIZE; +} + +static size_t hantro_hevc_mv_size(const struct v4l2_ctrl_hevc_sps *sps) +{ + u32 pic_width_in_ctb64 = (sps->pic_width_in_luma_samples + (1 << 8) - 1) >> 8; + u32 pic_height_in_ctb64 = (sps->pic_height_in_luma_samples + (1 << 8) - 1) >> 8; + size_t mv_size; + + mv_size = (pic_width_in_ctb64 * pic_height_in_ctb64 * + (1 << (2 * (8 - 4))) * 16) + 32; + + vpu_debug(4, "%dx%d (CTBs) %lu MV bytes\n", + pic_width_in_ctb64, pic_height_in_ctb64, mv_size); + + return mv_size; +} + +static size_t hantro_hevc_ref_size(struct hantro_ctx *ctx) +{ + const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls; + const struct v4l2_ctrl_hevc_sps *sps = ctrls->sps; + + return hantro_hevc_motion_vectors_offset(sps) + hantro_hevc_mv_size(sps); +} + +static void hantro_hevc_ref_free(struct hantro_ctx *ctx) +{ + struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec; + struct hantro_dev *vpu = ctx->dev; + int i; + + for (i = 0; i < NUM_REF_PICTURES; i++) { + if (hevc_dec->ref_bufs[i].cpu) + dma_free_coherent(vpu->dev, hevc_dec->ref_bufs[i].size, + hevc_dec->ref_bufs[i].cpu, + hevc_dec->ref_bufs[i].dma); + } +} + +static void hantro_hevc_ref_init(struct hantro_ctx *ctx) +{ + struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec; + int i; + + for (i = 0; i < NUM_REF_PICTURES; i++) + hevc_dec->ref_bufs_poc[i] = UNUSED_REF; +} + +dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, + int poc) +{ + struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec; + int i; + + /* Find the reference buffer in already know ones */ + for (i = 0; i < NUM_REF_PICTURES; i++) { + if (hevc_dec->ref_bufs_poc[i] == poc) { + hevc_dec->ref_bufs_used |= 1 << i; + return hevc_dec->ref_bufs[i].dma; + } + } + + /* Allocate a new reference buffer */ + for (i = 0; i < NUM_REF_PICTURES; i++) { + if (hevc_dec->ref_bufs_poc[i] == UNUSED_REF) { + if (!hevc_dec->ref_bufs[i].cpu) { + struct hantro_dev *vpu = ctx->dev; + + /* + * Allocate the space needed for the raw data + + * motion vector data. Optimizations could be to + * allocate raw data in non coherent memory and only + * clear the motion vector data. + */ + hevc_dec->ref_bufs[i].cpu = + dma_alloc_coherent(vpu->dev, + hantro_hevc_ref_size(ctx), + &hevc_dec->ref_bufs[i].dma, + GFP_KERNEL); + if (!hevc_dec->ref_bufs[i].cpu) + return 0; + + hevc_dec->ref_bufs[i].size = hantro_hevc_ref_size(ctx); + } + hevc_dec->ref_bufs_used |= 1 << i; + memset(hevc_dec->ref_bufs[i].cpu, 0, hantro_hevc_ref_size(ctx)); + hevc_dec->ref_bufs_poc[i] = poc; + + return hevc_dec->ref_bufs[i].dma; + } + } + + return 0; +} + +void hantro_hevc_ref_remove_unused(struct hantro_ctx *ctx) +{ + struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec; + int i; + + /* Just tag buffer as unused, do not free them */ + for (i = 0; i < NUM_REF_PICTURES; i++) { + if (hevc_dec->ref_bufs_poc[i] == UNUSED_REF) + continue; + + if (hevc_dec->ref_bufs_used & (1 << i)) + continue; + + hevc_dec->ref_bufs_poc[i] = UNUSED_REF; + } +} + +static int tile_buffer_reallocate(struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec; + const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls; + const struct v4l2_ctrl_hevc_pps *pps = ctrls->pps; + const struct v4l2_ctrl_hevc_sps *sps = ctrls->sps; + unsigned int num_tile_cols = pps->num_tile_columns_minus1 + 1; + unsigned int height64 = (sps->pic_height_in_luma_samples + 63) & ~63; + unsigned int size; + + if (num_tile_cols <= 1 || + num_tile_cols <= hevc_dec->num_tile_cols_allocated) + return 0; + + /* Need to reallocate due to tiles passed via PPS */ + if (hevc_dec->tile_filter.size) + dma_free_coherent(vpu->dev, hevc_dec->tile_filter.size, + hevc_dec->tile_filter.cpu, + hevc_dec->tile_filter.dma); + + if (hevc_dec->tile_sao.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_sao.size, + hevc_dec->tile_sao.cpu, + hevc_dec->tile_sao.dma); + + if (hevc_dec->tile_bsd.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_bsd.size, + hevc_dec->tile_bsd.cpu, + hevc_dec->tile_bsd.dma); + + size = VERT_FILTER_RAM_SIZE * height64 * (num_tile_cols - 1); + hevc_dec->tile_filter.cpu = dma_alloc_coherent(vpu->dev, size, + &hevc_dec->tile_filter.dma, + GFP_KERNEL); + if (!hevc_dec->tile_filter.cpu) + goto err_free_tile_buffers; + hevc_dec->tile_filter.size = size; + + size = VERT_SAO_RAM_SIZE * height64 * (num_tile_cols - 1); + hevc_dec->tile_sao.cpu = dma_alloc_coherent(vpu->dev, size, + &hevc_dec->tile_sao.dma, + GFP_KERNEL); + if (!hevc_dec->tile_sao.cpu) + goto err_free_tile_buffers; + hevc_dec->tile_sao.size = size; + + size = BSD_CTRL_RAM_SIZE * height64 * (num_tile_cols - 1); + hevc_dec->tile_bsd.cpu = dma_alloc_coherent(vpu->dev, size, + &hevc_dec->tile_bsd.dma, + GFP_KERNEL); + if (!hevc_dec->tile_bsd.cpu) + goto err_free_tile_buffers; + hevc_dec->tile_bsd.size = size; + + hevc_dec->num_tile_cols_allocated = num_tile_cols; + + return 0; + +err_free_tile_buffers: + if (hevc_dec->tile_filter.size) + dma_free_coherent(vpu->dev, hevc_dec->tile_filter.size, + hevc_dec->tile_filter.cpu, + hevc_dec->tile_filter.dma); + hevc_dec->tile_filter.cpu = 0; + + if (hevc_dec->tile_sao.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_sao.size, + hevc_dec->tile_sao.cpu, + hevc_dec->tile_sao.dma); + hevc_dec->tile_sao.cpu = 0; + + if (hevc_dec->tile_bsd.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_bsd.size, + hevc_dec->tile_bsd.cpu, + hevc_dec->tile_bsd.dma); + hevc_dec->tile_bsd.cpu = 0; + + return -ENOMEM; +} + +int hantro_hevc_dec_prepare_run(struct hantro_ctx *ctx) +{ + struct hantro_hevc_dec_hw_ctx *hevc_ctx = &ctx->hevc_dec; + struct hantro_hevc_dec_ctrls *ctrls = &hevc_ctx->ctrls; + int ret; + + hantro_start_prepare_run(ctx); + + ctrls->decode_params = + hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS); + if (WARN_ON(!ctrls->decode_params)) + return -EINVAL; + + ctrls->sps = + hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_HEVC_SPS); + if (WARN_ON(!ctrls->sps)) + return -EINVAL; + + ctrls->pps = + hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_HEVC_PPS); + if (WARN_ON(!ctrls->pps)) + return -EINVAL; + + ret = tile_buffer_reallocate(ctx); + if (ret) + return ret; + + return 0; +} + +void hantro_hevc_dec_exit(struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec; + + if (hevc_dec->tile_sizes.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_sizes.size, + hevc_dec->tile_sizes.cpu, + hevc_dec->tile_sizes.dma); + hevc_dec->tile_sizes.cpu = 0; + + if (hevc_dec->tile_filter.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_filter.size, + hevc_dec->tile_filter.cpu, + hevc_dec->tile_filter.dma); + hevc_dec->tile_filter.cpu = 0; + + if (hevc_dec->tile_sao.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_sao.size, + hevc_dec->tile_sao.cpu, + hevc_dec->tile_sao.dma); + hevc_dec->tile_sao.cpu = 0; + + if (hevc_dec->tile_bsd.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_bsd.size, + hevc_dec->tile_bsd.cpu, + hevc_dec->tile_bsd.dma); + hevc_dec->tile_bsd.cpu = 0; + + hantro_hevc_ref_free(ctx); +} + +int hantro_hevc_dec_init(struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec; + unsigned int size; + + memset(hevc_dec, 0, sizeof(*hevc_dec)); + + /* + * Maximum number of tiles times width and height (2 bytes each), + * rounding up to next 16 bytes boundary + one extra 16 byte + * chunk (HW guys wanted to have this). + */ + size = round_up(MAX_TILE_COLS * MAX_TILE_ROWS * 4 * sizeof(u16) + 16, 16); + hevc_dec->tile_sizes.cpu = dma_alloc_coherent(vpu->dev, size, + &hevc_dec->tile_sizes.dma, + GFP_KERNEL); + if (!hevc_dec->tile_sizes.cpu) + return -ENOMEM; + + hevc_dec->tile_sizes.size = size; + + hantro_hevc_ref_init(ctx); + + return 0; +} diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h index 4e2e7a5ed283..dade3b0769c1 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -20,6 +20,8 @@ #define MB_WIDTH(w) DIV_ROUND_UP(w, MB_DIM) #define MB_HEIGHT(h) DIV_ROUND_UP(h, MB_DIM) +#define NUM_REF_PICTURES (V4L2_HEVC_DPB_ENTRIES_NUM_MAX + 1) + struct hantro_dev; struct hantro_ctx; struct hantro_buf; @@ -90,6 +92,44 @@ struct hantro_h264_dec_hw_ctx { struct hantro_h264_dec_ctrls ctrls; }; +/** + * struct hantro_hevc_dec_ctrls + * @decode_params: Decode params + * @sps: SPS info + * @pps: PPS info + * @hevc_hdr_skip_length: the number of data (in bits) to skip in the + * slice segment header syntax after 'slice type' + * token + */ +struct hantro_hevc_dec_ctrls { + const struct v4l2_ctrl_hevc_decode_params *decode_params; + const struct v4l2_ctrl_hevc_sps *sps; + const struct v4l2_ctrl_hevc_pps *pps; + u32 hevc_hdr_skip_length; +}; + +/** + * struct hantro_hevc_dec_hw_ctx + * @tile_sizes: Tile sizes buffer + * @tile_filter: Tile vertical filter buffer + * @tile_sao: Tile SAO buffer + * @tile_bsd: Tile BSD control buffer + * @dpb: DPB + * @reflists: P/B0/B1 reflists + * @ctrls: V4L2 controls attached to a run + */ +struct hantro_hevc_dec_hw_ctx { + struct hantro_aux_buf tile_sizes; + struct hantro_aux_buf tile_filter; + struct hantro_aux_buf tile_sao; + struct hantro_aux_buf tile_bsd; + struct hantro_aux_buf ref_bufs[NUM_REF_PICTURES]; + int ref_bufs_poc[NUM_REF_PICTURES]; + u32 ref_bufs_used; + struct hantro_hevc_dec_ctrls ctrls; + unsigned int num_tile_cols_allocated; +}; + /** * struct hantro_mpeg2_dec_hw_ctx * @qtable: Quantization table @@ -178,6 +218,15 @@ int hantro_g1_h264_dec_run(struct hantro_ctx *ctx); int hantro_h264_dec_init(struct hantro_ctx *ctx); void hantro_h264_dec_exit(struct hantro_ctx *ctx); +int hantro_hevc_dec_init(struct hantro_ctx *ctx); +void hantro_hevc_dec_exit(struct hantro_ctx *ctx); +int hantro_g2_hevc_dec_run(struct hantro_ctx *ctx); +int hantro_hevc_dec_prepare_run(struct hantro_ctx *ctx); +dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, int poc); +void hantro_hevc_ref_remove_unused(struct hantro_ctx *ctx); +size_t hantro_hevc_chroma_offset(const struct v4l2_ctrl_hevc_sps *sps); +size_t hantro_hevc_motion_vectors_offset(const struct v4l2_ctrl_hevc_sps *sps); + static inline size_t hantro_h264_mv_size(unsigned int width, unsigned int height) { -- 2.25.1 From benjamin.gaignard at collabora.com Wed Mar 17 17:32:01 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 17 Mar 2021 18:32:01 +0100 Subject: [PATCH v5 12/13] media: hantro: IMX8M: add variant for G2/HEVC codec In-Reply-To: <20210317173202.107519-1-benjamin.gaignard@collabora.com> References: <20210317173202.107519-1-benjamin.gaignard@collabora.com> Message-ID: <20210317173202.107519-13-benjamin.gaignard@collabora.com> Add variant to IMX8M to enable G2/HEVC codec. Define the capabilities for the hardware up to 3840x2160. G2 doesn't have postprocessor, use the same clocks and got it own interruption. Signed-off-by: Benjamin Gaignard --- version 5: - remove useless postproc fields for G2 version 2: - remove useless clocks drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 + drivers/staging/media/hantro/imx8m_vpu_hw.c | 76 ++++++++++++++++++++- 3 files changed, 76 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index 13c197ca9ba3..659124a52e8a 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -574,6 +574,7 @@ static const struct of_device_id of_hantro_match[] = { #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, }, + { .compatible = "nxp,imx8mq-vpu-g2", .data = &imx8mq_vpu_g2_variant }, #endif { /* sentinel */ } }; diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h index dade3b0769c1..f61f58da05fe 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -193,6 +193,7 @@ extern const struct hantro_variant rk3399_vpu_variant; extern const struct hantro_variant rk3328_vpu_variant; extern const struct hantro_variant rk3288_vpu_variant; extern const struct hantro_variant imx8mq_vpu_variant; +extern const struct hantro_variant imx8mq_vpu_g2_variant; extern const struct hantro_postproc_regs hantro_g1_postproc_regs; diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c index bd9d135dd440..b2ddb1fce0e8 100644 --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c @@ -12,6 +12,7 @@ #include "hantro.h" #include "hantro_jpeg.h" #include "hantro_g1_regs.h" +#include "hantro_g2_regs.h" #define CTRL_SOFT_RESET 0x00 #define RESET_G1 BIT(1) @@ -129,6 +130,26 @@ static const struct hantro_fmt imx8m_vpu_dec_fmts[] = { }, }; +static const struct hantro_fmt imx8m_vpu_g2_dec_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_NV12, + .codec_mode = HANTRO_MODE_NONE, + }, + { + .fourcc = V4L2_PIX_FMT_HEVC_SLICE, + .codec_mode = HANTRO_MODE_HEVC_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 3840, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 2160, + .step_height = MB_DIM, + }, + }, +}; + static irqreturn_t imx8m_vpu_g1_irq(int irq, void *dev_id) { struct hantro_dev *vpu = dev_id; @@ -147,6 +168,24 @@ static irqreturn_t imx8m_vpu_g1_irq(int irq, void *dev_id) return IRQ_HANDLED; } +static irqreturn_t imx8m_vpu_g2_irq(int irq, void *dev_id) +{ + struct hantro_dev *vpu = dev_id; + enum vb2_buffer_state state; + u32 status; + + status = vdpu_read(vpu, HEVC_REG_INTERRUPT); + state = (status & HEVC_REG_INTERRUPT_DEC_RDY_INT) ? + VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR; + + vdpu_write(vpu, 0, HEVC_REG_INTERRUPT); + vdpu_write(vpu, HEVC_REG_CONFIG_DEC_CLK_GATE_E, HEVC_REG_CONFIG); + + hantro_irq_done(vpu, state); + + return IRQ_HANDLED; +} + static int imx8mq_vpu_hw_init(struct hantro_dev *vpu) { struct device_node *np = vpu->dev->of_node; @@ -176,6 +215,13 @@ static void imx8m_vpu_g1_reset(struct hantro_ctx *ctx) imx8m_soft_reset(vpu, RESET_G1); } +static void imx8m_vpu_g2_reset(struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + + imx8m_soft_reset(vpu, RESET_G2); +} + /* * Supported codec ops. */ @@ -201,16 +247,28 @@ static const struct hantro_codec_ops imx8mq_vpu_codec_ops[] = { }, }; +static const struct hantro_codec_ops imx8mq_vpu_g2_codec_ops[] = { + [HANTRO_MODE_HEVC_DEC] = { + .run = hantro_g2_hevc_dec_run, + .reset = imx8m_vpu_g2_reset, + .init = hantro_hevc_dec_init, + .exit = hantro_hevc_dec_exit, + }, +}; + /* * VPU variants. */ static const struct hantro_irq imx8mq_irqs[] = { { "g1", imx8m_vpu_g1_irq }, - { "g2", NULL /* TODO: imx8m_vpu_g2_irq */ }, }; -static const char * const imx8mq_clk_names[] = { "g1", "g2", "bus" }; +static const struct hantro_irq imx8mq_g2_irqs[] = { + { "g2", imx8m_vpu_g2_irq }, +}; + +static const char * const imx8mq_clk_names[] = { "g1", "g2", "bus"}; const struct hantro_variant imx8mq_vpu_variant = { .dec_fmts = imx8m_vpu_dec_fmts, @@ -228,3 +286,17 @@ const struct hantro_variant imx8mq_vpu_variant = { .clk_names = imx8mq_clk_names, .num_clocks = ARRAY_SIZE(imx8mq_clk_names), }; + +const struct hantro_variant imx8mq_vpu_g2_variant = { + .dec_offset = 0x0, + .dec_fmts = imx8m_vpu_g2_dec_fmts, + .num_dec_fmts = ARRAY_SIZE(imx8m_vpu_g2_dec_fmts), + .codec = HANTRO_HEVC_DECODER, + .codec_ops = imx8mq_vpu_g2_codec_ops, + .init = imx8mq_vpu_hw_init, + .runtime_resume = imx8mq_runtime_resume, + .irqs = imx8mq_g2_irqs, + .num_irqs = ARRAY_SIZE(imx8mq_g2_irqs), + .clk_names = imx8mq_clk_names, + .num_clocks = ARRAY_SIZE(imx8mq_clk_names), +}; -- 2.25.1 From benjamin.gaignard at collabora.com Wed Mar 17 17:32:02 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Wed, 17 Mar 2021 18:32:02 +0100 Subject: [PATCH v5 13/13] arm64: dts: imx8mq: Add node to G2 hardware In-Reply-To: <20210317173202.107519-1-benjamin.gaignard@collabora.com> References: <20210317173202.107519-1-benjamin.gaignard@collabora.com> Message-ID: <20210317173202.107519-14-benjamin.gaignard@collabora.com> Split VPU node in two: one for G1 and one for G2 since they are different hardware blocks. Add syscon for hardware control block. Remove reg-names property that is useless. Each VPU node only need one interrupt. Signed-off-by: Benjamin Gaignard --- version 5: - use syscon instead of VPU reset arch/arm64/boot/dts/freescale/imx8mq.dtsi | 43 ++++++++++++++++++----- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi index 17c449e12c2e..b537d153ebbd 100644 --- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi @@ -1329,15 +1329,16 @@ usb3_phy1: usb-phy at 382f0040 { status = "disabled"; }; - vpu: video-codec at 38300000 { + vpu_ctrl: syscon at 38320000 { + compatible = "nxp,imx8mq-vpu-ctrl", "syscon"; + reg = <0x38320000 0x10000>; + }; + + vpu_g1: video-codec at 38300000 { compatible = "nxp,imx8mq-vpu"; - reg = <0x38300000 0x10000>, - <0x38310000 0x10000>, - <0x38320000 0x10000>; - reg-names = "g1", "g2", "ctrl"; - interrupts = , - ; - interrupt-names = "g1", "g2"; + reg = <0x38300000 0x10000>; + interrupts = ; + interrupt-names = "g1"; clocks = <&clk IMX8MQ_CLK_VPU_G1_ROOT>, <&clk IMX8MQ_CLK_VPU_G2_ROOT>, <&clk IMX8MQ_CLK_VPU_DEC_ROOT>; @@ -1350,9 +1351,33 @@ vpu: video-codec at 38300000 { <&clk IMX8MQ_VPU_PLL_OUT>, <&clk IMX8MQ_SYS1_PLL_800M>, <&clk IMX8MQ_VPU_PLL>; - assigned-clock-rates = <600000000>, <600000000>, + assigned-clock-rates = <600000000>, <300000000>, + <800000000>, <0>; + power-domains = <&pgc_vpu>; + nxp,imx8mq-vpu-ctrl = <&vpu_ctrl>; + }; + + vpu_g2: video-codec at 38310000 { + compatible = "nxp,imx8mq-vpu-g2"; + reg = <0x38310000 0x10000>; + interrupts = ; + interrupt-names = "g2"; + clocks = <&clk IMX8MQ_CLK_VPU_G1_ROOT>, + <&clk IMX8MQ_CLK_VPU_G2_ROOT>, + <&clk IMX8MQ_CLK_VPU_DEC_ROOT>; + clock-names = "g1", "g2", "bus"; + assigned-clocks = <&clk IMX8MQ_CLK_VPU_G1>, + <&clk IMX8MQ_CLK_VPU_G2>, + <&clk IMX8MQ_CLK_VPU_BUS>, + <&clk IMX8MQ_VPU_PLL_BYPASS>; + assigned-clock-parents = <&clk IMX8MQ_VPU_PLL_OUT>, + <&clk IMX8MQ_VPU_PLL_OUT>, + <&clk IMX8MQ_SYS1_PLL_800M>, + <&clk IMX8MQ_VPU_PLL>; + assigned-clock-rates = <600000000>, <300000000>, <800000000>, <0>; power-domains = <&pgc_vpu>; + nxp,imx8mq-vpu-ctrl = <&vpu_ctrl>; }; pcie0: pcie at 33800000 { -- 2.25.1 From rdunlap at infradead.org Wed Mar 17 17:35:30 2021 From: rdunlap at infradead.org (Randy Dunlap) Date: Wed, 17 Mar 2021 10:35:30 -0700 Subject: [PATCH] staging: wimax: i2400m: Mundane typo fix in the file driver.c In-Reply-To: <20210317092624.1138207-1-unixbhaskar@gmail.com> References: <20210317092624.1138207-1-unixbhaskar@gmail.com> Message-ID: <971c14bd-e755-d1cf-b518-c889e5348f11@infradead.org> On 3/17/21 2:26 AM, Bhaskar Chowdhury wrote: > > s/procesing/processing/ > > Signed-off-by: Bhaskar Chowdhury Acked-by: Randy Dunlap > --- > drivers/staging/wimax/i2400m/driver.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/wimax/i2400m/driver.c b/drivers/staging/wimax/i2400m/driver.c > index f5186458bb3d..8091106212f9 100644 > --- a/drivers/staging/wimax/i2400m/driver.c > +++ b/drivers/staging/wimax/i2400m/driver.c > @@ -96,7 +96,7 @@ MODULE_PARM_DESC(barkers, > * > * This function just verifies that the header declaration and the > * payload are consistent and then deals with it, either forwarding it > - * to the device or procesing it locally. > + * to the device or processing it locally. > * > * In the i2400m, messages are basically commands that will carry an > * ack, so we use i2400m_msg_to_dev() and then deliver the ack back to > -- -- ~Randy From christian.brauner at ubuntu.com Wed Mar 17 18:00:48 2021 From: christian.brauner at ubuntu.com (Christian Brauner) Date: Wed, 17 Mar 2021 19:00:48 +0100 Subject: [PATCH v3 0/3] Binder: Enable App Freezing Capability In-Reply-To: <20210316011630.1121213-1-dualli@chromium.org> References: <20210316011630.1121213-1-dualli@chromium.org> Message-ID: <20210317180048.inzdursqmnvxkgwp@wittgenstein> On Mon, Mar 15, 2021 at 06:16:27PM -0700, Li Li wrote: > From: Li Li > > To improve the user experience when switching between recently used > applications, the background applications which are not currently needed > are cached in the memory. Normally, a well designed application will not > consume valuable CPU resources in the background. However, it's possible > some applications are not able or willing to behave as expected, wasting > energy even after being cached. > > It is a good idea to freeze those applications when they're only being > kept alive for the sake of faster startup and energy saving. These kernel > patches will provide the necessary infrastructure for user space framework > to freeze and thaw a cached process, check the current freezing status and > correctly deal with outstanding binder transactions to frozen processes. > > Changes in v2: avoid panic by using pr_warn for unexpected cases. > Changes in v3: improved errcode logic in binder_proc_transaction(). > > Marco Ballesio (3): > binder: BINDER_FREEZE ioctl > binder: use EINTR for interrupted wait for work > binder: BINDER_GET_FROZEN_INFO ioctl > > drivers/android/binder.c | 198 ++++++++++++++++++++++++++-- > drivers/android/binder_internal.h | 18 +++ > include/uapi/linux/android/binder.h | 20 +++ > 3 files changed, 224 insertions(+), 12 deletions(-) [+Cc Jann] Christian From christian.brauner at ubuntu.com Wed Mar 17 18:15:18 2021 From: christian.brauner at ubuntu.com (Christian Brauner) Date: Wed, 17 Mar 2021 19:15:18 +0100 Subject: [PATCH v3 1/3] binder: BINDER_FREEZE ioctl In-Reply-To: <20210316011630.1121213-2-dualli@chromium.org> References: <20210316011630.1121213-1-dualli@chromium.org> <20210316011630.1121213-2-dualli@chromium.org> Message-ID: <20210317181518.zclcb5vmhxjuk52s@wittgenstein> On Mon, Mar 15, 2021 at 06:16:28PM -0700, Li Li wrote: > From: Marco Ballesio > > Frozen tasks can't process binder transactions, so a way is required to > inform transmitting ends of communication failures due to the frozen > state of their receiving counterparts. Additionally, races are possible > between transitions to frozen state and binder transactions enqueued to > a specific process. > > Implement BINDER_FREEZE ioctl for user space to inform the binder driver > about the intention to freeze or unfreeze a process. When the ioctl is > called, block the caller until any pending binder transactions toward > the target process are flushed. Return an error to transactions to > processes marked as frozen. > > Signed-off-by: Marco Ballesio > Co-developed-by: Todd Kjos > Signed-off-by: Todd Kjos > Signed-off-by: Li Li > --- > drivers/android/binder.c | 139 ++++++++++++++++++++++++++-- > drivers/android/binder_internal.h | 12 +++ > include/uapi/linux/android/binder.h | 13 +++ > 3 files changed, 154 insertions(+), 10 deletions(-) > > diff --git a/drivers/android/binder.c b/drivers/android/binder.c > index c119736ca56a..b93ca53bb90f 100644 > --- a/drivers/android/binder.c > +++ b/drivers/android/binder.c > @@ -1506,6 +1506,12 @@ static void binder_free_transaction(struct binder_transaction *t) > > if (target_proc) { > binder_inner_proc_lock(target_proc); > + target_proc->outstanding_txns--; > + if (target_proc->outstanding_txns < 0) > + pr_warn("%s: Unexpected outstanding_txns %d\n", > + __func__, target_proc->outstanding_txns); > + if (!target_proc->outstanding_txns && target_proc->is_frozen) > + wake_up_interruptible_all(&target_proc->freeze_wait); > if (t->buffer) > t->buffer->transaction = NULL; > binder_inner_proc_unlock(target_proc); > @@ -2331,10 +2337,11 @@ static int binder_fixup_parent(struct binder_transaction *t, > * If the @thread parameter is not NULL, the transaction is always queued > * to the waitlist of that specific thread. > * > - * Return: true if the transactions was successfully queued > - * false if the target process or thread is dead > + * Return: 0 if the transaction was successfully queued > + * BR_DEAD_REPLY if the target process or thread is dead > + * BR_FROZEN_REPLY if the target process or thread is frozen > */ > -static bool binder_proc_transaction(struct binder_transaction *t, > +static int binder_proc_transaction(struct binder_transaction *t, > struct binder_proc *proc, > struct binder_thread *thread) > { > @@ -2354,10 +2361,11 @@ static bool binder_proc_transaction(struct binder_transaction *t, > > binder_inner_proc_lock(proc); > > - if (proc->is_dead || (thread && thread->is_dead)) { > + if ((proc->is_frozen && !oneway) || proc->is_dead || > + (thread && thread->is_dead)) { > binder_inner_proc_unlock(proc); > binder_node_unlock(node); > - return false; > + return proc->is_frozen ? BR_FROZEN_REPLY : BR_DEAD_REPLY; > } > > if (!thread && !pending_async) > @@ -2373,10 +2381,11 @@ static bool binder_proc_transaction(struct binder_transaction *t, > if (!pending_async) > binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); > > + proc->outstanding_txns++; > binder_inner_proc_unlock(proc); > binder_node_unlock(node); > > - return true; > + return 0; > } > > /** > @@ -3013,13 +3022,16 @@ static void binder_transaction(struct binder_proc *proc, > if (reply) { > binder_enqueue_thread_work(thread, tcomplete); > binder_inner_proc_lock(target_proc); > - if (target_thread->is_dead) { > + if (target_thread->is_dead || target_proc->is_frozen) { > + return_error = target_thread->is_dead ? > + BR_DEAD_REPLY : BR_FROZEN_REPLY; > binder_inner_proc_unlock(target_proc); > goto err_dead_proc_or_thread; > } > BUG_ON(t->buffer->async_transaction != 0); > binder_pop_transaction_ilocked(target_thread, in_reply_to); > binder_enqueue_thread_work_ilocked(target_thread, &t->work); > + target_proc->outstanding_txns++; > binder_inner_proc_unlock(target_proc); > wake_up_interruptible_sync(&target_thread->wait); > binder_free_transaction(in_reply_to); > @@ -3038,7 +3050,9 @@ static void binder_transaction(struct binder_proc *proc, > t->from_parent = thread->transaction_stack; > thread->transaction_stack = t; > binder_inner_proc_unlock(proc); > - if (!binder_proc_transaction(t, target_proc, target_thread)) { > + return_error = binder_proc_transaction(t, > + target_proc, target_thread); > + if (return_error) { > binder_inner_proc_lock(proc); > binder_pop_transaction_ilocked(thread, t); > binder_inner_proc_unlock(proc); > @@ -3048,7 +3062,8 @@ static void binder_transaction(struct binder_proc *proc, > BUG_ON(target_node == NULL); > BUG_ON(t->buffer->async_transaction != 1); > binder_enqueue_thread_work(thread, tcomplete); > - if (!binder_proc_transaction(t, target_proc, NULL)) > + return_error = binder_proc_transaction(t, target_proc, NULL); > + if (return_error) > goto err_dead_proc_or_thread; > } > if (target_thread) > @@ -3065,7 +3080,6 @@ static void binder_transaction(struct binder_proc *proc, > return; > > err_dead_proc_or_thread: > - return_error = BR_DEAD_REPLY; > return_error_line = __LINE__; > binder_dequeue_work(proc, tcomplete); > err_translate_failed: > @@ -4298,6 +4312,9 @@ static void binder_free_proc(struct binder_proc *proc) > > BUG_ON(!list_empty(&proc->todo)); > BUG_ON(!list_empty(&proc->delivered_death)); > + if (proc->outstanding_txns) > + pr_warn("%s: Unexpected outstanding_txns %d\n", > + __func__, proc->outstanding_txns); > device = container_of(proc->context, struct binder_device, context); > if (refcount_dec_and_test(&device->ref)) { > kfree(proc->context->name); > @@ -4359,6 +4376,7 @@ static int binder_thread_release(struct binder_proc *proc, > (t->to_thread == thread) ? "in" : "out"); > > if (t->to_thread == thread) { > + thread->proc->outstanding_txns--; > t->to_proc = NULL; > t->to_thread = NULL; > if (t->buffer) { > @@ -4609,6 +4627,45 @@ static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, > return 0; > } > > +static int binder_ioctl_freeze(struct binder_freeze_info *info, > + struct binder_proc *target_proc) > +{ > + int ret = 0; > + > + if (!info->enable) { > + binder_inner_proc_lock(target_proc); > + target_proc->is_frozen = false; > + binder_inner_proc_unlock(target_proc); > + return 0; > + } > + > + /* > + * Freezing the target. Prevent new transactions by > + * setting frozen state. If timeout specified, wait > + * for transactions to drain. > + */ > + binder_inner_proc_lock(target_proc); > + target_proc->is_frozen = true; > + binder_inner_proc_unlock(target_proc); > + > + if (info->timeout_ms > 0) > + ret = wait_event_interruptible_timeout( > + target_proc->freeze_wait, > + (!target_proc->outstanding_txns), > + msecs_to_jiffies(info->timeout_ms)); > + > + if (!ret && target_proc->outstanding_txns) > + ret = -EAGAIN; > + > + if (ret < 0) { > + binder_inner_proc_lock(target_proc); > + target_proc->is_frozen = false; > + binder_inner_proc_unlock(target_proc); > + } > + > + return ret; > +} > + > static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > { > int ret; > @@ -4727,6 +4784,66 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > } > break; > } > + case BINDER_FREEZE: { > + struct binder_freeze_info info; > + struct binder_proc **target_procs = NULL, *target_proc; > + int target_procs_count = 0, i = 0; > + > + ret = 0; > + > + if (copy_from_user(&info, ubuf, sizeof(info))) { This is not at all a blocker to this I just want to point out that if you wanted to you could ensure that this API is extensible with guaranteed forward- and backward compatibility by switching to the copy_struct_from_user() API that Aleksa and I added and that is nowadays used in a bunch of syscalls (openat2((), clone3(), mount_setattr(), sched_setattr() etc.). For the seccomp notifier work we did we extended this concept to ioctls(), see kernel/seccomp.c: static long seccomp_notify_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct seccomp_filter *filter = file->private_data; void __user *buf = (void __user *)arg; /* Fixed-size ioctls */ switch (cmd) { case SECCOMP_IOCTL_NOTIF_RECV: return seccomp_notify_recv(filter, buf); case SECCOMP_IOCTL_NOTIF_SEND: return seccomp_notify_send(filter, buf); case SECCOMP_IOCTL_NOTIF_ID_VALID_WRONG_DIR: case SECCOMP_IOCTL_NOTIF_ID_VALID: return seccomp_notify_id_valid(filter, buf); } /* Extensible Argument ioctls */ #define EA_IOCTL(cmd) ((cmd) & ~(IOC_INOUT | IOCSIZE_MASK)) switch (EA_IOCTL(cmd)) { case EA_IOCTL(SECCOMP_IOCTL_NOTIF_ADDFD): return seccomp_notify_addfd(filter, buf, _IOC_SIZE(cmd)); default: return -EINVAL; } } Christian From gmahak1 at gmail.com Wed Mar 17 18:29:53 2021 From: gmahak1 at gmail.com (Mahak Gupta) Date: Wed, 17 Mar 2021 23:59:53 +0530 Subject: [PATCH] staging: octeon-usb: Match alignment with open parenthesis Message-ID: <20210317182953.3826-1-gmahak1@gmail.com> This patches fixes the checks- 'Alignment should match open parenthesis' of 'checkpatch.pl'. Signed-off-by: Mahak Gupta --- drivers/staging/octeon-usb/octeon-hcd.c | 32 +++++++++++++------------ 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index e2f8b6b67f75..f27f20a4aa2d 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -1258,7 +1258,7 @@ static void cvmx_usb_poll_tx_fifo(struct octeon_hcd *usb) union cvmx_usbcx_hptxsts tx_status; tx_status.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HPTXSTS(usb->index)); + CVMX_USBCX_HPTXSTS(usb->index)); if (cvmx_usb_fill_tx_hw(usb, &usb->periodic, tx_status.s.ptxfspcavail)) USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), @@ -1272,7 +1272,7 @@ static void cvmx_usb_poll_tx_fifo(struct octeon_hcd *usb) union cvmx_usbcx_gnptxsts tx_status; tx_status.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_GNPTXSTS(usb->index)); + CVMX_USBCX_GNPTXSTS(usb->index)); if (cvmx_usb_fill_tx_hw(usb, &usb->nonperiodic, tx_status.s.nptxfspcavail)) USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), @@ -1298,13 +1298,13 @@ static void cvmx_usb_fill_tx_fifo(struct octeon_hcd *usb, int channel) /* We only need to fill data on outbound channels */ hcchar.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCCHARX(channel, usb->index)); + CVMX_USBCX_HCCHARX(channel, usb->index)); if (hcchar.s.epdir != CVMX_USB_DIRECTION_OUT) return; /* OUT Splits only have data on the start and not the complete */ usbc_hcsplt.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCSPLTX(channel, usb->index)); + CVMX_USBCX_HCSPLTX(channel, usb->index)); if (usbc_hcsplt.s.spltena && usbc_hcsplt.s.compsplt) return; @@ -1313,7 +1313,7 @@ static void cvmx_usb_fill_tx_fifo(struct octeon_hcd *usb, int channel) * words. */ usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCTSIZX(channel, usb->index)); + CVMX_USBCX_HCTSIZX(channel, usb->index)); if (!usbc_hctsiz.s.xfersize) return; @@ -1360,7 +1360,7 @@ static void cvmx_usb_start_channel_control(struct octeon_hcd *usb, union cvmx_usbcx_hctsizx usbc_hctsiz; usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCTSIZX(channel, usb->index)); + CVMX_USBCX_HCTSIZX(channel, usb->index)); switch (transaction->stage) { case CVMX_USB_STAGE_NON_CONTROL: @@ -1517,7 +1517,7 @@ static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel, /* Clear all channel status bits */ usbc_hcint.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCINTX(channel, usb->index)); + CVMX_USBCX_HCINTX(channel, usb->index)); cvmx_usb_write_csr32(usb, CVMX_USBCX_HCINTX(channel, usb->index), @@ -1552,7 +1552,7 @@ static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel, /* Enable the channel interrupt to propagate */ usbc_haintmsk.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HAINTMSK(usb->index)); + CVMX_USBCX_HAINTMSK(usb->index)); usbc_haintmsk.s.haintmsk |= 1 << channel; cvmx_usb_write_csr32(usb, CVMX_USBCX_HAINTMSK(usb->index), usbc_haintmsk.u32); @@ -1836,7 +1836,7 @@ static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel, * Returns: Pipe or NULL if none are ready */ static struct cvmx_usb_pipe *cvmx_usb_find_ready_pipe(struct octeon_hcd *usb, - enum cvmx_usb_transfer xfer_type) + enum cvmx_usb_transfer xfer_type) { struct list_head *list = usb->active_pipes + xfer_type; u64 current_frame = usb->frame_number; @@ -2309,7 +2309,8 @@ static int cvmx_usb_cancel(struct octeon_hcd *usb, CVMX_SYNCW; usbc_hcchar.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCCHARX(pipe->channel, usb->index)); + CVMX_USBCX_HCCHARX(pipe->channel, + usb->index)); /* * If the channel isn't enabled then the transaction already * completed. @@ -2605,11 +2606,12 @@ static int cvmx_usb_poll_channel(struct octeon_hcd *usb, int channel) /* Read the interrupt status bits for the channel */ usbc_hcint.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCINTX(channel, usb->index)); + CVMX_USBCX_HCINTX(channel, usb->index)); if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) { usbc_hcchar.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCCHARX(channel, usb->index)); + CVMX_USBCX_HCCHARX(channel, + usb->index)); if (usbc_hcchar.s.chena && usbc_hcchar.s.chdis) { /* @@ -2688,9 +2690,9 @@ static int cvmx_usb_poll_channel(struct octeon_hcd *usb, int channel) * transferred */ usbc_hcchar.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCCHARX(channel, usb->index)); + CVMX_USBCX_HCCHARX(channel, usb->index)); usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCTSIZX(channel, usb->index)); + CVMX_USBCX_HCTSIZX(channel, usb->index)); /* * Calculating the number of bytes successfully transferred is dependent @@ -3010,7 +3012,7 @@ static int cvmx_usb_poll(struct octeon_hcd *usb) union cvmx_usbcx_haint usbc_haint; usbc_haint.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HAINT(usb->index)); + CVMX_USBCX_HAINT(usb->index)); while (usbc_haint.u32) { int channel; -- 2.17.1 From gmahak1 at gmail.com Wed Mar 17 18:38:46 2021 From: gmahak1 at gmail.com (Mahak Gupta) Date: Thu, 18 Mar 2021 00:08:46 +0530 Subject: [PATCH] staging: octeon-usb: Match alignment with open parenthesis Message-ID: <20210317183846.4867-1-gmahak1@gmail.com> This patches fixes the checks- 'Alignment should match open parenthesis' of 'checkpatch.pl'. Signed-off-by: Mahak Gupta --- drivers/staging/octeon-usb/octeon-hcd.c | 32 +++++++++++++------------ 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index e2f8b6b67f75..f27f20a4aa2d 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -1258,7 +1258,7 @@ static void cvmx_usb_poll_tx_fifo(struct octeon_hcd *usb) union cvmx_usbcx_hptxsts tx_status; tx_status.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HPTXSTS(usb->index)); + CVMX_USBCX_HPTXSTS(usb->index)); if (cvmx_usb_fill_tx_hw(usb, &usb->periodic, tx_status.s.ptxfspcavail)) USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), @@ -1272,7 +1272,7 @@ static void cvmx_usb_poll_tx_fifo(struct octeon_hcd *usb) union cvmx_usbcx_gnptxsts tx_status; tx_status.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_GNPTXSTS(usb->index)); + CVMX_USBCX_GNPTXSTS(usb->index)); if (cvmx_usb_fill_tx_hw(usb, &usb->nonperiodic, tx_status.s.nptxfspcavail)) USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), @@ -1298,13 +1298,13 @@ static void cvmx_usb_fill_tx_fifo(struct octeon_hcd *usb, int channel) /* We only need to fill data on outbound channels */ hcchar.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCCHARX(channel, usb->index)); + CVMX_USBCX_HCCHARX(channel, usb->index)); if (hcchar.s.epdir != CVMX_USB_DIRECTION_OUT) return; /* OUT Splits only have data on the start and not the complete */ usbc_hcsplt.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCSPLTX(channel, usb->index)); + CVMX_USBCX_HCSPLTX(channel, usb->index)); if (usbc_hcsplt.s.spltena && usbc_hcsplt.s.compsplt) return; @@ -1313,7 +1313,7 @@ static void cvmx_usb_fill_tx_fifo(struct octeon_hcd *usb, int channel) * words. */ usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCTSIZX(channel, usb->index)); + CVMX_USBCX_HCTSIZX(channel, usb->index)); if (!usbc_hctsiz.s.xfersize) return; @@ -1360,7 +1360,7 @@ static void cvmx_usb_start_channel_control(struct octeon_hcd *usb, union cvmx_usbcx_hctsizx usbc_hctsiz; usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCTSIZX(channel, usb->index)); + CVMX_USBCX_HCTSIZX(channel, usb->index)); switch (transaction->stage) { case CVMX_USB_STAGE_NON_CONTROL: @@ -1517,7 +1517,7 @@ static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel, /* Clear all channel status bits */ usbc_hcint.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCINTX(channel, usb->index)); + CVMX_USBCX_HCINTX(channel, usb->index)); cvmx_usb_write_csr32(usb, CVMX_USBCX_HCINTX(channel, usb->index), @@ -1552,7 +1552,7 @@ static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel, /* Enable the channel interrupt to propagate */ usbc_haintmsk.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HAINTMSK(usb->index)); + CVMX_USBCX_HAINTMSK(usb->index)); usbc_haintmsk.s.haintmsk |= 1 << channel; cvmx_usb_write_csr32(usb, CVMX_USBCX_HAINTMSK(usb->index), usbc_haintmsk.u32); @@ -1836,7 +1836,7 @@ static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel, * Returns: Pipe or NULL if none are ready */ static struct cvmx_usb_pipe *cvmx_usb_find_ready_pipe(struct octeon_hcd *usb, - enum cvmx_usb_transfer xfer_type) + enum cvmx_usb_transfer xfer_type) { struct list_head *list = usb->active_pipes + xfer_type; u64 current_frame = usb->frame_number; @@ -2309,7 +2309,8 @@ static int cvmx_usb_cancel(struct octeon_hcd *usb, CVMX_SYNCW; usbc_hcchar.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCCHARX(pipe->channel, usb->index)); + CVMX_USBCX_HCCHARX(pipe->channel, + usb->index)); /* * If the channel isn't enabled then the transaction already * completed. @@ -2605,11 +2606,12 @@ static int cvmx_usb_poll_channel(struct octeon_hcd *usb, int channel) /* Read the interrupt status bits for the channel */ usbc_hcint.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCINTX(channel, usb->index)); + CVMX_USBCX_HCINTX(channel, usb->index)); if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) { usbc_hcchar.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCCHARX(channel, usb->index)); + CVMX_USBCX_HCCHARX(channel, + usb->index)); if (usbc_hcchar.s.chena && usbc_hcchar.s.chdis) { /* @@ -2688,9 +2690,9 @@ static int cvmx_usb_poll_channel(struct octeon_hcd *usb, int channel) * transferred */ usbc_hcchar.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCCHARX(channel, usb->index)); + CVMX_USBCX_HCCHARX(channel, usb->index)); usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCTSIZX(channel, usb->index)); + CVMX_USBCX_HCTSIZX(channel, usb->index)); /* * Calculating the number of bytes successfully transferred is dependent @@ -3010,7 +3012,7 @@ static int cvmx_usb_poll(struct octeon_hcd *usb) union cvmx_usbcx_haint usbc_haint; usbc_haint.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HAINT(usb->index)); + CVMX_USBCX_HAINT(usb->index)); while (usbc_haint.u32) { int channel; -- 2.17.1 From jannh at google.com Wed Mar 17 20:17:18 2021 From: jannh at google.com (Jann Horn) Date: Wed, 17 Mar 2021 21:17:18 +0100 Subject: [PATCH v3 0/3] Binder: Enable App Freezing Capability In-Reply-To: <20210317180048.inzdursqmnvxkgwp@wittgenstein> References: <20210316011630.1121213-1-dualli@chromium.org> <20210317180048.inzdursqmnvxkgwp@wittgenstein> Message-ID: On Wed, Mar 17, 2021 at 7:00 PM Christian Brauner wrote: > On Mon, Mar 15, 2021 at 06:16:27PM -0700, Li Li wrote: > > To improve the user experience when switching between recently used > > applications, the background applications which are not currently needed > > are cached in the memory. Normally, a well designed application will not > > consume valuable CPU resources in the background. However, it's possible > > some applications are not able or willing to behave as expected, wasting > > energy even after being cached. > > > > It is a good idea to freeze those applications when they're only being > > kept alive for the sake of faster startup and energy saving. These kernel > > patches will provide the necessary infrastructure for user space framework > > to freeze and thaw a cached process, check the current freezing status and > > correctly deal with outstanding binder transactions to frozen processes. I just have some comments on the overall design: This seems a bit convoluted to me; and I'm not sure whether this is really something the kernel should get involved in, or whether this patchset is operating at the right layer. If there are non-binder threads that are misbehaving, could you instead stop all those threads in pure userspace code (e.g. by sending a thread-directed signal to all of them and letting the signal handler sleep on a futex); and if the binder thread receives a transaction that should be handled, wake up those threads again? Or alternatively you could detect that the application is being woken up frequently even though it's supposed to be idle (e.g. using information from procfs), and kill it since you consider it to be misbehaving? Or if there are specific usage patterns you see frequently that you consider to be wasting CPU resources (e.g. setting an interval timer that fires in short intervals), you could try to delay such timers. With your current approach, you're baking the assumption that all IPC goes through binder into the kernel API; things like passing a file descriptor to a pipe through binder or using shared futexes are no longer usable for cross-process communication without making more kernel changes. I'm not sure whether that's a good idea. On top of that, if you freeze a process while it is in the middle of some operation, resources associated with the operation will probably stay in use for quite some time; for example, if an app is in the middle of downloading some data over HTTP, and you freeze it, this may cause the TCP connection to remain active and consume resources for send/receive buffers on both the device and the server. From marcocesati at gmail.com Wed Mar 17 22:20:47 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:20:47 +0100 Subject: [PATCH 00/43] Staging: rtl8723bs: convert ALL_CAPS names Message-ID: <20210317222130.29528-1-marcocesati@gmail.com> This set of patches converts struct and enum names in the staging/rtl8723bs source code from all caps to lowercase. The checkpatch.pl script emits many errors and warnings for these patches, however all of them are caused by the original code. [PATCH 01/43] Staging: rtl8723bs: fix names in rtw_mlme.h [PATCH 02/43] Staging: rtl8723bs: fix names in wlan_bssdef.h [PATCH 03/43] Staging: rtl8723bs: fix names in rtw_pwrctrl.h [PATCH 04/43] Staging: rtl8723bs: fix names in hal_com.h [PATCH 05/43] Staging: rtl8723bs: fix names in rtw_eeprom.h [PATCH 06/43] Staging: rtl8723bs: fix names in rtw_recv.h [PATCH 07/43] Staging: rtl8723bs: fix names in drv_types.h [PATCH 08/43] Staging: rtl8723bs: fix names in rtw_ht.h [PATCH 09/43] Staging: rtl8723bs: fix names in rtw_mp.h [PATCH 10/43] Staging: rtl8723bs: fix names in rtw_cmd.h [PATCH 11/43] Staging: rtl8723bs: fix names in hal_intf.h [PATCH 12/43] Staging: rtl8723bs: fix names in osdep_service.h [PATCH 13/43] Staging: rtl8723bs: fix names in rtw_security.h [PATCH 14/43] Staging: rtl8723bs: fix names in hal_com_h2c.h [PATCH 15/43] Staging: rtl8723bs: fix names in rtl8723b_xmit.h [PATCH 16/43] Staging: rtl8723bs: fix names in HalVerDef.h [PATCH 17/43] Staging: rtl8723bs: fix names in wifi.h [PATCH 18/43] Staging: rtl8723bs: fix names in rtl8723b_hal.h [PATCH 19/43] Staging: rtl8723bs: fix names in hal_phy.h [PATCH 20/43] Staging: rtl8723bs: fix names in rtw_mlme_ext.h [PATCH 21/43] Staging: rtl8723bs: fix names in rtw_xmit.h [PATCH 22/43] Staging: rtl8723bs: fix names in rtw_rf.h [PATCH 23/43] Staging: rtl8723bs: fix names in HalPwrSeqCmd.h [PATCH 24/43] Staging: rtl8723bs: fix names in hal_com_phycfg.h [PATCH 25/43] Staging: rtl8723bs: fix names in sta_info.h [PATCH 26/43] Staging: rtl8723bs: fix names in hal_data.h [PATCH 27/43] Staging: rtl8723bs: fix names in ieee80211.h [PATCH 28/43] Staging: rtl8723bs: fix names in rtw_efuse.h [PATCH 29/43] Staging: rtl8723bs: fix names in hal_btcoex.h [PATCH 30/43] Staging: rtl8723bs: fix names in odm_interface.h [PATCH 31/43] Staging: rtl8723bs: fix names in HalBtcOutSrc.h [PATCH 32/43] Staging: rtl8723bs: fix names in odm_EdcaTurboCheck.h [PATCH 33/43] Staging: rtl8723bs: fix names in odm_HWConfig.h [PATCH 34/43] Staging: rtl8723bs: fix names in HalBtc8723b1Ant.h [PATCH 35/43] Staging: rtl8723bs: fix names in odm_types.h [PATCH 36/43] Staging: rtl8723bs: fix names in odm_DIG.h [PATCH 37/43] Staging: rtl8723bs: fix names in hal_btcoex.c [PATCH 38/43] Staging: rtl8723bs: fix names in odm_CfoTracking.h [PATCH 39/43] Staging: rtl8723bs: fix names in HalPhyRf.h [PATCH 40/43] Staging: rtl8723bs: fix names in odm.h [PATCH 41/43] Staging: rtl8723bs: fix in odm_DynamicBBPowerSaving.h [PATCH 42/43] Staging: rtl8723bs: fix names in odm_NoiseMonitor.h [PATCH 43/43] Staging: rtl8723bs: fix names in HalBtc8723b2Ant.h drivers/staging/rtl8723bs/core/rtw_cmd.c | 4 +- .../staging/rtl8723bs/core/rtw_ioctl_set.c | 6 +- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 26 +-- drivers/staging/rtl8723bs/core/rtw_odm.c | 6 +- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 4 +- .../staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 156 +++++++++--------- .../staging/rtl8723bs/hal/HalBtc8723b1Ant.h | 40 ++--- .../staging/rtl8723bs/hal/HalBtc8723b2Ant.c | 146 ++++++++-------- .../staging/rtl8723bs/hal/HalBtc8723b2Ant.h | 38 ++--- drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h | 100 +++++------ .../staging/rtl8723bs/hal/HalHWImg8723B_BB.c | 10 +- .../staging/rtl8723bs/hal/HalHWImg8723B_BB.h | 6 +- .../staging/rtl8723bs/hal/HalHWImg8723B_MAC.c | 6 +- .../staging/rtl8723bs/hal/HalHWImg8723B_MAC.h | 2 +- .../staging/rtl8723bs/hal/HalHWImg8723B_RF.c | 12 +- .../staging/rtl8723bs/hal/HalHWImg8723B_RF.h | 6 +- drivers/staging/rtl8723bs/hal/HalPhyRf.c | 8 +- drivers/staging/rtl8723bs/hal/HalPhyRf.h | 18 +- .../staging/rtl8723bs/hal/HalPhyRf_8723B.c | 56 +++---- .../staging/rtl8723bs/hal/HalPhyRf_8723B.h | 12 +- drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c | 4 +- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 138 ++++++++-------- drivers/staging/rtl8723bs/hal/hal_com.c | 22 +-- .../staging/rtl8723bs/hal/hal_com_phycfg.c | 18 +- drivers/staging/rtl8723bs/hal/hal_intf.c | 12 +- drivers/staging/rtl8723bs/hal/hal_pwr_seq.c | 22 +-- drivers/staging/rtl8723bs/hal/odm.c | 102 ++++++------ drivers/staging/rtl8723bs/hal/odm.h | 150 ++++++++--------- .../staging/rtl8723bs/hal/odm_CfoTracking.c | 28 ++-- .../staging/rtl8723bs/hal/odm_CfoTracking.h | 2 +- drivers/staging/rtl8723bs/hal/odm_DIG.c | 52 +++--- drivers/staging/rtl8723bs/hal/odm_DIG.h | 4 +- .../rtl8723bs/hal/odm_DynamicBBPowerSaving.c | 8 +- .../rtl8723bs/hal/odm_DynamicBBPowerSaving.h | 2 +- .../rtl8723bs/hal/odm_DynamicTxPower.c | 2 +- .../rtl8723bs/hal/odm_EdcaTurboCheck.c | 6 +- .../rtl8723bs/hal/odm_EdcaTurboCheck.h | 2 +- drivers/staging/rtl8723bs/hal/odm_HWConfig.c | 24 +-- drivers/staging/rtl8723bs/hal/odm_HWConfig.h | 28 ++-- .../staging/rtl8723bs/hal/odm_NoiseMonitor.c | 2 +- .../staging/rtl8723bs/hal/odm_NoiseMonitor.h | 2 +- drivers/staging/rtl8723bs/hal/odm_PathDiv.c | 4 +- .../rtl8723bs/hal/odm_RegConfig8723B.c | 16 +- .../rtl8723bs/hal/odm_RegConfig8723B.h | 16 +- drivers/staging/rtl8723bs/hal/odm_debug.c | 2 +- drivers/staging/rtl8723bs/hal/odm_debug.h | 2 +- drivers/staging/rtl8723bs/hal/odm_interface.h | 2 +- drivers/staging/rtl8723bs/hal/odm_types.h | 4 +- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 12 +- drivers/staging/rtl8723bs/hal/rtl8723b_dm.c | 12 +- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 54 +++--- .../staging/rtl8723bs/hal/rtl8723b_phycfg.c | 24 +-- .../staging/rtl8723bs/hal/rtl8723b_rf6052.c | 2 +- .../staging/rtl8723bs/hal/rtl8723bs_recv.c | 2 +- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 8 +- .../staging/rtl8723bs/include/HalPwrSeqCmd.h | 6 +- drivers/staging/rtl8723bs/include/HalVerDef.h | 50 +++--- drivers/staging/rtl8723bs/include/drv_types.h | 8 +- .../staging/rtl8723bs/include/hal_btcoex.h | 2 +- drivers/staging/rtl8723bs/include/hal_com.h | 14 +- .../staging/rtl8723bs/include/hal_com_h2c.h | 2 +- .../rtl8723bs/include/hal_com_phycfg.h | 14 +- drivers/staging/rtl8723bs/include/hal_data.h | 32 ++-- drivers/staging/rtl8723bs/include/hal_intf.h | 36 ++-- drivers/staging/rtl8723bs/include/hal_phy.h | 16 +- .../staging/rtl8723bs/include/hal_phy_cfg.h | 6 +- .../staging/rtl8723bs/include/hal_pwr_seq.h | 22 +-- drivers/staging/rtl8723bs/include/ieee80211.h | 10 +- .../staging/rtl8723bs/include/osdep_service.h | 2 +- .../staging/rtl8723bs/include/rtl8723b_hal.h | 10 +- .../staging/rtl8723bs/include/rtl8723b_rf.h | 2 +- .../staging/rtl8723bs/include/rtl8723b_xmit.h | 2 +- drivers/staging/rtl8723bs/include/rtw_cmd.h | 6 +- .../staging/rtl8723bs/include/rtw_eeprom.h | 2 +- drivers/staging/rtl8723bs/include/rtw_efuse.h | 6 +- drivers/staging/rtl8723bs/include/rtw_ht.h | 6 +- .../staging/rtl8723bs/include/rtw_ioctl_set.h | 4 +- drivers/staging/rtl8723bs/include/rtw_mlme.h | 20 +-- .../staging/rtl8723bs/include/rtw_mlme_ext.h | 28 ++-- drivers/staging/rtl8723bs/include/rtw_mp.h | 20 +-- .../staging/rtl8723bs/include/rtw_pwrctrl.h | 8 +- drivers/staging/rtl8723bs/include/rtw_recv.h | 2 +- drivers/staging/rtl8723bs/include/rtw_rf.h | 18 +- .../staging/rtl8723bs/include/rtw_security.h | 6 +- drivers/staging/rtl8723bs/include/rtw_xmit.h | 2 +- drivers/staging/rtl8723bs/include/sta_info.h | 4 +- drivers/staging/rtl8723bs/include/wifi.h | 14 +- .../staging/rtl8723bs/include/wlan_bssdef.h | 28 ++-- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 6 +- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 10 +- drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 8 +- drivers/staging/rtl8723bs/os_dep/wifi_regd.c | 2 +- 92 files changed, 943 insertions(+), 943 deletions(-) -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:20:48 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:20:48 +0100 Subject: [PATCH 01/43] Staging: rtl8723bs: fix names in rtw_mlme.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-2-marcocesati@gmail.com> This commit converts names of structs / enums in include/rtw_mlme.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 +- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 2 +- drivers/staging/rtl8723bs/include/rtw_mlme.h | 12 ++++++------ drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index e60a2ed32de5..416268f26dc3 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -4133,7 +4133,7 @@ Following are some utility functions for WiFi MLME void site_survey(struct adapter *padapter) { unsigned char survey_channel = 0, val8; - enum RT_SCAN_TYPE ScanType = SCAN_PASSIVE; + enum rt_scan_type ScanType = SCAN_PASSIVE; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u32 initialgain = 0; diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c index fb279b662122..0b339c155860 100644 --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c @@ -445,7 +445,7 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf) case BTC_GET_U4_WIFI_TRAFFIC_DIRECTION: { - struct RT_LINK_DETECT_T *plinkinfo; + struct rt_link_detect_t *plinkinfo; plinkinfo = &padapter->mlmepriv.LinkDetectInfo; if (plinkinfo->NumTxOkInPeriod > plinkinfo->NumRxOkInPeriod) diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h index 1ebc1e183381..ffcceb1fdde6 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mlme.h +++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h @@ -81,13 +81,13 @@ enum dot11AuthAlgrthmNum { }; /* Scan type including active and passive scan. */ -enum RT_SCAN_TYPE { +enum rt_scan_type { SCAN_PASSIVE, SCAN_ACTIVE, SCAN_MIX, }; -enum _BAND { +enum _band { GHZ24_50 = 0, GHZ_50, GHZ_24, @@ -101,7 +101,7 @@ enum DriverInterface { DRIVER_CFG80211 = 2 }; -enum SCAN_RESULT_TYPE { +enum scan_result_type { SCAN_RESULT_P2P_ONLY = 0, /* Will return all the P2P devices. */ SCAN_RESULT_ALL = 1, /* Will return all the scanned device, include AP. */ SCAN_RESULT_WFD_TYPE = 2 /* Will just return the correct WFD device. */ @@ -134,7 +134,7 @@ struct sitesurvey_ctrl { struct timer_list sitesurvey_ctrl_timer; }; -struct RT_LINK_DETECT_T { +struct rt_link_detect_t { u32 NumTxOkInPeriod; u32 NumRxOkInPeriod; u32 NumRxUnicastOkInPeriod; @@ -385,12 +385,12 @@ struct mlme_priv { struct ht_priv htpriv; - struct RT_LINK_DETECT_T LinkDetectInfo; + struct rt_link_detect_t LinkDetectInfo; struct timer_list dynamic_chk_timer; /* dynamic/periodic check timer */ u8 acm_mask; /* for wmm acm mask */ u8 ChannelPlan; - enum RT_SCAN_TYPE scan_mode; /* active: 1, passive: 0 */ + enum rt_scan_type scan_mode; /* active: 1, passive: 0 */ u8 *wps_probe_req_ie; u32 wps_probe_req_ie_len; diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h index e593293bb9c4..0f4dd33b6e55 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h @@ -419,7 +419,7 @@ struct mlme_ext_info { /* The channel information about this channel including joining, scanning, and power constraints. */ struct RT_CHANNEL_INFO { u8 ChannelNum; /* The channel number. */ - enum RT_SCAN_TYPE ScanType; /* Scan type such as passive or active scan. */ + enum rt_scan_type ScanType; /* Scan type such as passive or active scan. */ }; int rtw_ch_set_search_ch(struct RT_CHANNEL_INFO *ch_set, const u32 ch); -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:20:49 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:20:49 +0100 Subject: [PATCH 02/43] Staging: rtl8723bs: fix names in wlan_bssdef.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-3-marcocesati@gmail.com> This commit converts names of structs / enums in include/wlan_bssdef.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/core/rtw_cmd.c | 4 +-- .../staging/rtl8723bs/core/rtw_ioctl_set.c | 6 ++-- drivers/staging/rtl8723bs/hal/hal_intf.c | 2 +- drivers/staging/rtl8723bs/include/rtw_cmd.h | 2 +- .../staging/rtl8723bs/include/rtw_ioctl_set.h | 4 +-- .../staging/rtl8723bs/include/rtw_security.h | 2 +- .../staging/rtl8723bs/include/wlan_bssdef.h | 28 +++++++++---------- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 4 +-- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 8 +++--- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c index e671ccfea964..2aaf25b48f96 100644 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@ -760,7 +760,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) struct security_priv *psecuritypriv = &padapter->securitypriv; struct registry_priv *pregistrypriv = &padapter->registrypriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv; - enum NDIS_802_11_NETWORK_INFRASTRUCTURE ndis_network_mode = pnetwork->network.InfrastructureMode; + enum ndis_802_11_network_infrastructure ndis_network_mode = pnetwork->network.InfrastructureMode; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u32 tmp_len; @@ -914,7 +914,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu return res; } -u8 rtw_setopmode_cmd(struct adapter *padapter, enum NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, bool enqueue) +u8 rtw_setopmode_cmd(struct adapter *padapter, enum ndis_802_11_network_infrastructure networktype, bool enqueue) { struct cmd_obj *ph2c; struct setopmode_parm *psetop; diff --git a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c index c9418bfb2a00..211071e0254b 100644 --- a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c +++ b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c @@ -401,11 +401,11 @@ u8 rtw_set_802_11_connect(struct adapter *padapter, u8 *bssid, struct ndis_802_1 } u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter, - enum NDIS_802_11_NETWORK_INFRASTRUCTURE networktype) + enum ndis_802_11_network_infrastructure networktype) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_network *cur_network = &pmlmepriv->cur_network; - enum NDIS_802_11_NETWORK_INFRASTRUCTURE *pold_state = &(cur_network->network.InfrastructureMode); + enum ndis_802_11_network_infrastructure *pold_state = &(cur_network->network.InfrastructureMode); RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_notice_, ("+rtw_set_802_11_infrastructure_mode: old =%d new =%d fw_state = 0x%08x\n", @@ -539,7 +539,7 @@ u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_s return res; } -u8 rtw_set_802_11_authentication_mode(struct adapter *padapter, enum NDIS_802_11_AUTHENTICATION_MODE authmode) +u8 rtw_set_802_11_authentication_mode(struct adapter *padapter, enum ndis_802_11_authentication_mode authmode) { struct security_priv *psecuritypriv = &padapter->securitypriv; int res; diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c index a3d431af8d26..4df980f94327 100644 --- a/drivers/staging/rtl8723bs/hal/hal_intf.c +++ b/drivers/staging/rtl8723bs/hal/hal_intf.c @@ -63,7 +63,7 @@ void rtw_hal_dm_deinit(struct adapter *padapter) static void rtw_hal_init_opmode(struct adapter *padapter) { - enum NDIS_802_11_NETWORK_INFRASTRUCTURE networkType = Ndis802_11InfrastructureMax; + enum ndis_802_11_network_infrastructure networkType = Ndis802_11InfrastructureMax; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); signed int fw_state; diff --git a/drivers/staging/rtl8723bs/include/rtw_cmd.h b/drivers/staging/rtl8723bs/include/rtw_cmd.h index b15a5abca17c..dd01c3c76584 100644 --- a/drivers/staging/rtl8723bs/include/rtw_cmd.h +++ b/drivers/staging/rtl8723bs/include/rtw_cmd.h @@ -826,7 +826,7 @@ extern u8 rtw_clearstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 extern u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork); u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueue); -extern u8 rtw_setopmode_cmd(struct adapter *padapter, enum NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, bool enqueue); +extern u8 rtw_setopmode_cmd(struct adapter *padapter, enum ndis_802_11_network_infrastructure networktype, bool enqueue); extern u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset); extern u8 rtw_setrfintfs_cmd(struct adapter *padapter, u8 mode); diff --git a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h index 4db23b1c2d47..4b929b84040a 100644 --- a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h +++ b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h @@ -16,12 +16,12 @@ struct BSSIDInfo { }; -u8 rtw_set_802_11_authentication_mode(struct adapter *pdapter, enum NDIS_802_11_AUTHENTICATION_MODE authmode); +u8 rtw_set_802_11_authentication_mode(struct adapter *pdapter, enum ndis_802_11_authentication_mode authmode); u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid); u8 rtw_set_802_11_add_wep(struct adapter *padapter, struct ndis_802_11_wep *wep); u8 rtw_set_802_11_disassociate(struct adapter *padapter); u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_ssid *pssid, int ssid_max_num); -u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter, enum NDIS_802_11_NETWORK_INFRASTRUCTURE networktype); +u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter, enum ndis_802_11_network_infrastructure networktype); u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid); u8 rtw_set_802_11_connect(struct adapter *padapter, u8 *bssid, struct ndis_802_11_ssid *ssid); diff --git a/drivers/staging/rtl8723bs/include/rtw_security.h b/drivers/staging/rtl8723bs/include/rtw_security.h index 3f3fd19d61c3..8611dff1aa4a 100644 --- a/drivers/staging/rtl8723bs/include/rtw_security.h +++ b/drivers/staging/rtl8723bs/include/rtw_security.h @@ -142,7 +142,7 @@ struct security_priv { /* keeps the auth_type & enc_status from upper layer ioctl(wpa_supplicant or wzc) */ - u32 ndisauthtype; /* enum NDIS_802_11_AUTHENTICATION_MODE */ + u32 ndisauthtype; /* enum ndis_802_11_authentication_mode */ u32 ndisencryptstatus; /* NDIS_802_11_ENCRYPTION_STATUS */ struct wlan_bssid_ex sec_bss; /* for joinbss (h2c buffer) usage */ diff --git a/drivers/staging/rtl8723bs/include/wlan_bssdef.h b/drivers/staging/rtl8723bs/include/wlan_bssdef.h index b9bc8ba21914..259835386597 100644 --- a/drivers/staging/rtl8723bs/include/wlan_bssdef.h +++ b/drivers/staging/rtl8723bs/include/wlan_bssdef.h @@ -24,7 +24,7 @@ struct ndis_802_11_ssid { u8 Ssid[32]; }; -enum NDIS_802_11_NETWORK_TYPE { +enum ndis_802_11_network_type { Ndis802_11FH, Ndis802_11DS, Ndis802_11OFDM5, @@ -51,7 +51,7 @@ struct ndis_802_11_conf { struct ndis_802_11_conf_fh FHConfig; }; -enum NDIS_802_11_NETWORK_INFRASTRUCTURE { +enum ndis_802_11_network_infrastructure { Ndis802_11IBSS, Ndis802_11Infrastructure, Ndis802_11AutoUnknown, @@ -74,13 +74,13 @@ struct ndis_80211_var_ie { /* Length is the 4 bytes multiples of the sum of * sizeof (NDIS_802_11_MAC_ADDRESS) + 2 + * sizeof (struct ndis_802_11_ssid) + sizeof (u32) + - * sizeof (long) + sizeof (enum NDIS_802_11_NETWORK_TYPE) + + * sizeof (long) + sizeof (enum ndis_802_11_network_type) + * sizeof (struct ndis_802_11_conf) + sizeof (NDIS_802_11_RATES_EX) + IELength * * Except for IELength, all other fields are fixed length. Therefore, we can * define a macro to present the partial sum. */ -enum NDIS_802_11_AUTHENTICATION_MODE { +enum ndis_802_11_authentication_mode { Ndis802_11AuthModeOpen, Ndis802_11AuthModeShared, Ndis802_11AuthModeAutoSwitch, @@ -91,7 +91,7 @@ enum NDIS_802_11_AUTHENTICATION_MODE { Ndis802_11AuthModeMax /* Not a real mode, defined as upper bound */ }; -enum NDIS_802_11_WEP_STATUS { +enum ndis_802_11_wep_status { Ndis802_11WEPEnabled, Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled, Ndis802_11WEPDisabled, @@ -127,7 +127,7 @@ struct ndis_801_11_ai_resfi { u16 AssociationId; }; -struct NDIS_802_11_ASSOCIATION_INFORMATION { +struct ndis_802_11_association_information { u32 Length; u16 AvailableRequestFixedIEs; struct ndis_802_11_ai_reqfi RequestFixedIEs; @@ -139,13 +139,13 @@ struct NDIS_802_11_ASSOCIATION_INFORMATION { u32 OffsetResponseIEs; }; -enum NDIS_802_11_RELOAD_DEFAULTS { +enum ndis_802_11_reload_defaults { Ndis802_11ReloadWEPKeys }; /* Key mapping keys require a BSSID */ -struct NDIS_802_11_KEY { +struct ndis_802_11_key { u32 Length; /* Length of this structure */ u32 KeyIndex; u32 KeyLength; /* length of key in bytes */ @@ -154,7 +154,7 @@ struct NDIS_802_11_KEY { u8 KeyMaterial[32]; /* variable length depending on above field */ }; -struct NDIS_802_11_REMOVE_KEY { +struct ndis_802_11_remove_key { u32 Length; /* Length of this structure */ u32 KeyIndex; NDIS_802_11_MAC_ADDRESS BSSID; @@ -211,9 +211,9 @@ struct wlan_bssid_ex { struct ndis_802_11_ssid Ssid; u32 Privacy; long Rssi;/* in dBM, raw data , get from PHY) */ - enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; + enum ndis_802_11_network_type NetworkTypeInUse; struct ndis_802_11_conf Configuration; - enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; + enum ndis_802_11_network_infrastructure InfrastructureMode; NDIS_802_11_RATES_EX SupportedRates; struct wlan_phy_info PhyInfo; u32 IELength; @@ -236,13 +236,13 @@ struct wlan_network { struct wlan_bcn_info BcnInfo; }; -enum VRTL_CARRIER_SENSE { +enum vrtl_carrier_sense { DISABLE_VCS, ENABLE_VCS, AUTO_VCS }; -enum VCS_TYPE { +enum vcs_type { NONE_VCS, RTS_CTS, CTS_TO_SELF @@ -254,7 +254,7 @@ enum VCS_TYPE { #define PWR_UAPSD 3 #define PWR_VOIP 4 -enum UAPSD_MAX_SP { +enum uapsd_max_sp { NO_LIMIT, TWO_MSDU, FOUR_MSDU, diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index 2ff71d001c07..685ecb45e742 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -1274,7 +1274,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, struct vif_params *params) { enum nl80211_iftype old_type; - enum NDIS_802_11_NETWORK_INFRASTRUCTURE networkType; + enum ndis_802_11_network_infrastructure networkType; struct adapter *padapter = rtw_netdev_priv(ndev); struct wireless_dev *rtw_wdev = padapter->rtw_wdev; struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); @@ -2017,7 +2017,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_connect_params *sme) { int ret = 0; - enum NDIS_802_11_AUTHENTICATION_MODE authmode; + enum ndis_802_11_authentication_mode authmode; struct ndis_802_11_ssid ndis_ssid; struct adapter *padapter = rtw_netdev_priv(ndev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index aac1391bdbf1..2d8da969fbda 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -817,7 +817,7 @@ static int rtw_wx_set_mode(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *b) { struct adapter *padapter = rtw_netdev_priv(dev); - enum NDIS_802_11_NETWORK_INFRASTRUCTURE networkType; + enum ndis_802_11_network_infrastructure networkType; int ret = 0; if (_FAIL == rtw_pwr_wakeup(padapter)) { @@ -1103,7 +1103,7 @@ static int rtw_wx_set_wap(struct net_device *dev, u8 *dst_bssid, *src_bssid; struct __queue *queue = &(pmlmepriv->scanned_queue); struct wlan_network *pnetwork = NULL; - enum NDIS_802_11_AUTHENTICATION_MODE authmode; + enum ndis_802_11_authentication_mode authmode; rtw_ps_deny(padapter, PS_DENY_JOIN); if (_FAIL == rtw_pwr_wakeup(padapter)) { @@ -1469,7 +1469,7 @@ static int rtw_wx_set_essid(struct net_device *dev, struct __queue *queue = &pmlmepriv->scanned_queue; struct list_head *phead; struct wlan_network *pnetwork = NULL; - enum NDIS_802_11_AUTHENTICATION_MODE authmode; + enum ndis_802_11_authentication_mode authmode; struct ndis_802_11_ssid ndis_ssid; u8 *dst_ssid, *src_ssid; @@ -1807,7 +1807,7 @@ static int rtw_wx_set_enc(struct net_device *dev, u32 key, ret = 0; u32 keyindex_provided; struct ndis_802_11_wep wep; - enum NDIS_802_11_AUTHENTICATION_MODE authmode; + enum ndis_802_11_authentication_mode authmode; struct iw_point *erq = &(wrqu->encoding); struct adapter *padapter = rtw_netdev_priv(dev); -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:20:51 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:20:51 +0100 Subject: [PATCH 04/43] Staging: rtl8723bs: fix names in hal_com.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-5-marcocesati@gmail.com> This commit converts names of structs / enums in include/hal_com.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h | 2 +- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 2 +- drivers/staging/rtl8723bs/include/hal_com.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h index c38baf2bc412..866667134cad 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h +++ b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h @@ -540,7 +540,7 @@ void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type); void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type); void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 action); void EXhalbtcoutsrc_MediaStatusNotify( - struct BTC_COEXIST *pBtCoexist, enum RT_MEDIA_STATUS mediaStatus + struct BTC_COEXIST *pBtCoexist, enum rt_media_status mediaStatus ); void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 pktType); void EXhalbtcoutsrc_BtInfoNotify( diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c index 0b339c155860..e524c775307f 100644 --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c @@ -1106,7 +1106,7 @@ void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 action) } void EXhalbtcoutsrc_MediaStatusNotify(struct BTC_COEXIST *pBtCoexist, enum - RT_MEDIA_STATUS mediaStatus) + rt_media_status mediaStatus) { u8 mStatus; diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h index d71c26cfd54c..81c85ca3b402 100644 --- a/drivers/staging/rtl8723bs/include/hal_com.h +++ b/drivers/staging/rtl8723bs/include/hal_com.h @@ -165,13 +165,13 @@ enum{ UP_LINK, DOWN_LINK, }; -enum RT_MEDIA_STATUS { +enum rt_media_status { RT_MEDIA_DISCONNECT = 0, RT_MEDIA_CONNECT = 1 }; #define MAX_DLFW_PAGE_SIZE 4096 /* @ page : 4k bytes */ -enum FIRMWARE_SOURCE { +enum firmware_source { FW_SOURCE_IMG_FILE = 0, FW_SOURCE_HEADER_FILE = 1, /* from header file */ }; -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:20:52 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:20:52 +0100 Subject: [PATCH 05/43] Staging: rtl8723bs: fix names in rtw_eeprom.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-6-marcocesati@gmail.com> This commit converts names of structs / enums in include/rtw_eeprom.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtw_eeprom.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_eeprom.h b/drivers/staging/rtl8723bs/include/rtw_eeprom.h index fb619e83217a..da7f14aadaa0 100644 --- a/drivers/staging/rtl8723bs/include/rtw_eeprom.h +++ b/drivers/staging/rtl8723bs/include/rtw_eeprom.h @@ -42,7 +42,7 @@ /* Besides, CustomerID of registry has precedence of that of EEPROM. */ /* defined below. 060703, by rcnjko. */ /* */ -enum RT_CUSTOMER_ID { +enum rt_customer_id { RT_CID_DEFAULT = 0, RT_CID_8187_ALPHA0 = 1, RT_CID_8187_SERCOMM_PS = 2, -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:20:53 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:20:53 +0100 Subject: [PATCH 06/43] Staging: rtl8723bs: fix names in rtw_recv.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-7-marcocesati@gmail.com> This commit converts names of structs / enums in include/rtw_recv.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtw_recv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h index 0a56c3a66ee8..1439158829ac 100644 --- a/drivers/staging/rtl8723bs/include/rtw_recv.h +++ b/drivers/staging/rtl8723bs/include/rtw_recv.h @@ -369,7 +369,7 @@ union recv_frame { }; -enum RX_PACKET_TYPE { +enum rx_packet_type { NORMAL_RX,/* Normal rx packet */ TX_REPORT1,/* CCX */ TX_REPORT2,/* TX RPT */ -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:20:54 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:20:54 +0100 Subject: [PATCH 07/43] Staging: rtl8723bs: fix names in drv_types.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-8-marcocesati@gmail.com> This commit converts names of structs / enums in include/drv_types.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/drv_types.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h index 9d482a6115ab..49f10ff6d54c 100644 --- a/drivers/staging/rtl8723bs/include/drv_types.h +++ b/drivers/staging/rtl8723bs/include/drv_types.h @@ -24,7 +24,7 @@ #include #include -enum _NIC_VERSION { +enum _nic_version { RTL8711_NIC, RTL8712_NIC, @@ -359,19 +359,19 @@ static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj) struct adapter *dvobj_get_port0_adapter(struct dvobj_priv *dvobj); -enum _IFACE_TYPE { +enum _iface_type { IFACE_PORT0, /* mapping to port0 for C/D series chips */ IFACE_PORT1, /* mapping to port1 for C/D series chip */ MAX_IFACE_PORT, }; -enum ADAPTER_TYPE { +enum adapter_type { PRIMARY_ADAPTER, SECONDARY_ADAPTER, MAX_ADAPTER = 0xFF, }; -enum DRIVER_STATE { +enum driver_state { DRIVER_NORMAL = 0, DRIVER_DISAPPEAR = 1, DRIVER_REPLACE_DONGLE = 2, -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:20:50 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:20:50 +0100 Subject: [PATCH 03/43] Staging: rtl8723bs: fix names in rtw_pwrctrl.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-4-marcocesati@gmail.com> This commit converts names of structs / enums in include/rtw_pwrctrl.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 4 ++-- drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index 2e6c522b74e3..c2a2cec35d55 100644 --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c @@ -1304,7 +1304,7 @@ int rtw_pm_set_ips(struct adapter *padapter, u8 mode) * ATTENTION: *This function will request pwrctrl LOCK! */ -void rtw_ps_deny(struct adapter *padapter, enum PS_DENY_REASON reason) +void rtw_ps_deny(struct adapter *padapter, enum ps_deny_reason reason) { struct pwrctrl_priv *pwrpriv; @@ -1329,7 +1329,7 @@ void rtw_ps_deny(struct adapter *padapter, enum PS_DENY_REASON reason) * ATTENTION: *This function will request pwrctrl LOCK! */ -void rtw_ps_deny_cancel(struct adapter *padapter, enum PS_DENY_REASON reason) +void rtw_ps_deny_cancel(struct adapter *padapter, enum ps_deny_reason reason) { struct pwrctrl_priv *pwrpriv; diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h index 33e33591006d..cec9fc0cf794 100644 --- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h @@ -141,7 +141,7 @@ enum { /* for ips_mode */ }; /* Design for pwrctrl_priv.ips_deny, 32 bits for 32 reasons at most */ -enum PS_DENY_REASON { +enum ps_deny_reason { PS_DENY_DRV_INITIAL = 0, PS_DENY_SCAN, PS_DENY_JOIN, @@ -192,7 +192,7 @@ struct pwrctrl_priv { u8 pre_ips_type;/* 0: default flow, 1: carddisbale flow */ /* ps_deny: if 0, power save is free to go; otherwise deny all kinds of power save. */ - /* Use PS_DENY_REASON to decide reason. */ + /* Use enum ps_deny_reason to decide reason. */ /* Don't access this variable directly without control function, */ /* and this variable should be protected by lock. */ u32 ps_deny; @@ -290,8 +290,8 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal int rtw_pm_set_ips(struct adapter *padapter, u8 mode); int rtw_pm_set_lps(struct adapter *padapter, u8 mode); -void rtw_ps_deny(struct adapter *padapter, enum PS_DENY_REASON reason); -void rtw_ps_deny_cancel(struct adapter *padapter, enum PS_DENY_REASON reason); +void rtw_ps_deny(struct adapter *padapter, enum ps_deny_reason reason); +void rtw_ps_deny_cancel(struct adapter *padapter, enum ps_deny_reason reason); u32 rtw_ps_deny_get(struct adapter *padapter); #endif /* __RTL871X_PWRCTRL_H_ */ -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:20:55 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:20:55 +0100 Subject: [PATCH 08/43] Staging: rtl8723bs: fix names in rtw_ht.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-9-marcocesati@gmail.com> This commit converts names of structs / enums in include/rtw_ht.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtw_ht.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_ht.h b/drivers/staging/rtl8723bs/include/rtw_ht.h index bce5bff3b844..fb321d20d276 100644 --- a/drivers/staging/rtl8723bs/include/rtw_ht.h +++ b/drivers/staging/rtl8723bs/include/rtw_ht.h @@ -37,7 +37,7 @@ struct ht_priv { }; -enum AGGRE_SIZE_E { +enum aggre_size_e { HT_AGG_SIZE_8K = 0, HT_AGG_SIZE_16K = 1, HT_AGG_SIZE_32K = 2, @@ -48,7 +48,7 @@ enum AGGRE_SIZE_E { VHT_AGG_SIZE_1024K = 7, }; -enum RT_HT_INF0_CAPBILITY { +enum rt_ht_inf0_capbility { RT_HT_CAP_USE_TURBO_AGGR = 0x01, RT_HT_CAP_USE_LONG_PREAMBLE = 0x02, RT_HT_CAP_USE_AMPDU = 0x04, @@ -59,7 +59,7 @@ enum RT_HT_INF0_CAPBILITY { RT_HT_CAP_USE_AP_CLIENT_MODE = 0x80, /* AP team request to reserve this bit, by Emily */ }; -enum RT_HT_INF1_CAPBILITY { +enum rt_ht_inf1_capbility { RT_HT_CAP_USE_VIDEO_CLIENT = 0x01, RT_HT_CAP_USE_JAGUAR_BCUT = 0x02, RT_HT_CAP_USE_JAGUAR_CCUT = 0x04, -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:20:56 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:20:56 +0100 Subject: [PATCH 09/43] Staging: rtl8723bs: fix names in rtw_mp.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-10-marcocesati@gmail.com> This commit converts names of structs / enums in include/rtw_mp.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtw_mp.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_mp.h b/drivers/staging/rtl8723bs/include/rtw_mp.h index 8b6e4e9578f9..48e5915e0a7a 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mp.h +++ b/drivers/staging/rtl8723bs/include/rtw_mp.h @@ -49,7 +49,7 @@ struct mp_tx { #define MP_MAX_LINES_BYTES 256 typedef void (*MPT_WORK_ITEM_HANDLER)(void *Adapter); -struct MPT_CONTEXT { +struct mpt_context { /* Indicate if we have started Mass Production Test. */ bool bMassProdTest; @@ -257,12 +257,12 @@ struct mp_priv { bool bSetRxBssid; bool bTxBufCkFail; - struct MPT_CONTEXT MptCtx; + struct mpt_context MptCtx; u8 *TXradomBuffer; }; -struct IOCMD_STRUCT { +struct iocmd_struct { u8 cmdclass; u16 value; u8 index; @@ -286,7 +286,7 @@ struct bb_reg_param { #define BB_REG_BASE_ADDR 0x800 /* MP variables */ -enum MP_MODE { +enum mp_mode { MP_OFF, MP_ON, MP_ERR, @@ -303,7 +303,7 @@ enum MP_MODE { extern u8 mpdatarate[NumRates]; /* MP set force data rate base on the definition. */ -enum MPT_RATE_INDEX { +enum mpt_rate_index { /* CCK rate. */ MPT_RATE_1M = 0, /* 0 */ MPT_RATE_2M, @@ -363,13 +363,13 @@ enum MPT_RATE_INDEX { #define MAX_TX_PWR_INDEX_N_MODE 64 /* 0x3F */ -enum POWER_MODE { +enum power_mode { POWER_LOW = 0, POWER_NORMAL }; /* The following enumeration is used to define the value of Reg0xD00[30:28] or JaguarReg0x914[18:16]. */ -enum OFDM_TX_MODE { +enum ofdm_tx_mode { OFDM_ALL_OFF = 0, OFDM_ContinuousTx = 1, OFDM_SingleCarrier = 2, @@ -391,14 +391,14 @@ enum OFDM_TX_MODE { #define Mac_HT_FasleAlarm 0x90000000 #define Mac_DropPacket 0xA0000000 -enum ENCRY_CTRL_STATE { +enum encry_ctrl_state { HW_CONTROL, /* hw encryption& decryption */ SW_CONTROL, /* sw encryption& decryption */ HW_ENCRY_SW_DECRY, /* hw encryption & sw decryption */ SW_ENCRY_HW_DECRY /* sw encryption & hw decryption */ }; -enum MPT_TXPWR_DEF { +enum mpt_txpwr_def { MPT_CCK, MPT_OFDM, /* L and HT OFDM */ MPT_VHT_OFDM -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:20:57 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:20:57 +0100 Subject: [PATCH 10/43] Staging: rtl8723bs: fix names in rtw_cmd.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-11-marcocesati@gmail.com> This commit converts names of structs / enums in include/rtw_cmd.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtw_cmd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_cmd.h b/drivers/staging/rtl8723bs/include/rtw_cmd.h index dd01c3c76584..6f3b018463e4 100644 --- a/drivers/staging/rtl8723bs/include/rtw_cmd.h +++ b/drivers/staging/rtl8723bs/include/rtw_cmd.h @@ -158,7 +158,7 @@ enum rtw_drvextra_cmd_id { MAX_WK_CID }; -enum LPS_CTRL_TYPE { +enum lps_ctrl_type { LPS_CTRL_SCAN = 0, LPS_CTRL_JOINBSS = 1, LPS_CTRL_CONNECT = 2, @@ -168,7 +168,7 @@ enum LPS_CTRL_TYPE { LPS_CTRL_TRAFFIC_BUSY = 6, }; -enum RFINTFS { +enum rfintfs { SWSI, HWSI, HWPI, -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:00 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:00 +0100 Subject: [PATCH 13/43] Staging: rtl8723bs: fix names in rtw_security.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-14-marcocesati@gmail.com> This commit converts names of structs / enums in include/rtw_security.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtw_security.h | 4 ++-- drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 2 +- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 2 +- drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_security.h b/drivers/staging/rtl8723bs/include/rtw_security.h index 8611dff1aa4a..0d3f7d46c33f 100644 --- a/drivers/staging/rtl8723bs/include/rtw_security.h +++ b/drivers/staging/rtl8723bs/include/rtw_security.h @@ -84,7 +84,7 @@ union Keytype { }; -struct RT_PMKID_LIST { +struct rt_pmkid_list { u8 bUsed; u8 Bssid[6]; u8 PMKID[16]; @@ -163,7 +163,7 @@ struct security_priv { u32 btkip_countermeasure_time; /* For WPA2 Pre-Authentication. */ - struct RT_PMKID_LIST PMKIDList[NUM_PMKID_CACHE]; /* Renamed from PreAuthKey[NUM_PRE_AUTH_KEY]. Annie, 2006-10-13. */ + struct rt_pmkid_list PMKIDList[NUM_PMKID_CACHE]; /* Renamed from PreAuthKey[NUM_PRE_AUTH_KEY]. Annie, 2006-10-13. */ u8 PMKIDIndex; u8 bWepDefaultKeyIdxSet; diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index 685ecb45e742..e70bb7f1ca3a 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -2346,7 +2346,7 @@ static int cfg80211_rtw_flush_pmksa(struct wiphy *wiphy, DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - memset(&psecuritypriv->PMKIDList[0], 0x00, sizeof(struct RT_PMKID_LIST) * NUM_PMKID_CACHE); + memset(&psecuritypriv->PMKIDList[0], 0x00, sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE); psecuritypriv->PMKIDIndex = 0; return 0; diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index 2d8da969fbda..bd1b9571cd4b 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -969,7 +969,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev, } } else if (pPMK->cmd == IW_PMKSA_FLUSH) { DBG_871X("[rtw_wx_set_pmkid] IW_PMKSA_FLUSH!\n"); - memset(&psecuritypriv->PMKIDList[0], 0x00, sizeof(struct RT_PMKID_LIST) * NUM_PMKID_CACHE); + memset(&psecuritypriv->PMKIDList[0], 0x00, sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE); psecuritypriv->PMKIDIndex = 0; intReturn = true; } diff --git a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c index ac3ae26fc385..ba4d3789a41e 100644 --- a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c @@ -65,7 +65,7 @@ void rtw_os_indicate_scan_done(struct adapter *padapter, bool aborted) indicate_wx_scan_complete_event(padapter); } -static struct RT_PMKID_LIST backupPMKIDList[NUM_PMKID_CACHE]; +static struct rt_pmkid_list backupPMKIDList[NUM_PMKID_CACHE]; void rtw_reset_securitypriv(struct adapter *adapter) { u8 backupPMKIDIndex = 0; @@ -84,7 +84,7 @@ void rtw_reset_securitypriv(struct adapter *adapter) /* Backup the btkip_countermeasure information. */ /* When the countermeasure is trigger, the driver have to disconnect with AP for 60 seconds. */ - memcpy(&backupPMKIDList[0], &adapter->securitypriv.PMKIDList[0], sizeof(struct RT_PMKID_LIST) * NUM_PMKID_CACHE); + memcpy(&backupPMKIDList[0], &adapter->securitypriv.PMKIDList[0], sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE); backupPMKIDIndex = adapter->securitypriv.PMKIDIndex; backupTKIPCountermeasure = adapter->securitypriv.btkip_countermeasure; backupTKIPcountermeasure_time = adapter->securitypriv.btkip_countermeasure_time; @@ -96,7 +96,7 @@ void rtw_reset_securitypriv(struct adapter *adapter) /* Added by Albert 2009/02/18 */ /* Restore the PMK information to securitypriv structure for the following connection. */ - memcpy(&adapter->securitypriv.PMKIDList[0], &backupPMKIDList[0], sizeof(struct RT_PMKID_LIST) * NUM_PMKID_CACHE); + memcpy(&adapter->securitypriv.PMKIDList[0], &backupPMKIDList[0], sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE); adapter->securitypriv.PMKIDIndex = backupPMKIDIndex; adapter->securitypriv.btkip_countermeasure = backupTKIPCountermeasure; adapter->securitypriv.btkip_countermeasure_time = backupTKIPcountermeasure_time; @@ -127,7 +127,7 @@ void rtw_reset_securitypriv(struct adapter *adapter) void rtw_os_indicate_disconnect(struct adapter *adapter) { - /* struct RT_PMKID_LIST backupPMKIDList[ NUM_PMKID_CACHE ]; */ + /* struct rt_pmkid_list backupPMKIDList[ NUM_PMKID_CACHE ]; */ netif_carrier_off(adapter->pnetdev); /* Do it first for tx broadcast pkt after disconnection issue! */ -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:20:58 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:20:58 +0100 Subject: [PATCH 11/43] Staging: rtl8723bs: fix names in hal_intf.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-12-marcocesati@gmail.com> This commit converts names of structs / enums in include/hal_intf.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/hal_com.c | 8 ++--- drivers/staging/rtl8723bs/hal/hal_intf.c | 8 ++--- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 8 ++--- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 4 +-- drivers/staging/rtl8723bs/include/hal_com.h | 8 ++--- drivers/staging/rtl8723bs/include/hal_intf.h | 30 +++++++++---------- .../staging/rtl8723bs/include/rtl8723b_hal.h | 4 +-- 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 21e37976cb3a..32e6b8233341 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -1113,7 +1113,7 @@ void GetHwReg(struct adapter *adapter, u8 variable, u8 *val) u8 SetHalDefVar( - struct adapter *adapter, enum HAL_DEF_VARIABLE variable, void *value + struct adapter *adapter, enum hal_def_variable variable, void *value ) { struct hal_com_data *hal_data = GET_HAL_DATA(adapter); @@ -1198,7 +1198,7 @@ u8 SetHalDefVar( } u8 GetHalDefVar( - struct adapter *adapter, enum HAL_DEF_VARIABLE variable, void *value + struct adapter *adapter, enum hal_def_variable variable, void *value ) { struct hal_com_data *hal_data = GET_HAL_DATA(adapter); @@ -1254,7 +1254,7 @@ u8 GetHalDefVar( void GetHalODMVar( struct adapter *Adapter, - enum HAL_ODM_VARIABLE eVariable, + enum hal_odm_variable eVariable, void *pValue1, void *pValue2 ) @@ -1267,7 +1267,7 @@ void GetHalODMVar( void SetHalODMVar( struct adapter *Adapter, - enum HAL_ODM_VARIABLE eVariable, + enum hal_odm_variable eVariable, void *pValue1, bool bSet ) diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c index 4df980f94327..8554baef95b8 100644 --- a/drivers/staging/rtl8723bs/hal/hal_intf.c +++ b/drivers/staging/rtl8723bs/hal/hal_intf.c @@ -147,27 +147,27 @@ void rtw_hal_set_hwreg_with_buf(struct adapter *padapter, u8 variable, u8 *pbuf, padapter->HalFunc.SetHwRegHandlerWithBuf(padapter, variable, pbuf, len); } -u8 rtw_hal_set_def_var(struct adapter *padapter, enum HAL_DEF_VARIABLE eVariable, void *pValue) +u8 rtw_hal_set_def_var(struct adapter *padapter, enum hal_def_variable eVariable, void *pValue) { if (padapter->HalFunc.SetHalDefVarHandler) return padapter->HalFunc.SetHalDefVarHandler(padapter, eVariable, pValue); return _FAIL; } -u8 rtw_hal_get_def_var(struct adapter *padapter, enum HAL_DEF_VARIABLE eVariable, void *pValue) +u8 rtw_hal_get_def_var(struct adapter *padapter, enum hal_def_variable eVariable, void *pValue) { if (padapter->HalFunc.GetHalDefVarHandler) return padapter->HalFunc.GetHalDefVarHandler(padapter, eVariable, pValue); return _FAIL; } -void rtw_hal_set_odm_var(struct adapter *padapter, enum HAL_ODM_VARIABLE eVariable, void *pValue1, bool bSet) +void rtw_hal_set_odm_var(struct adapter *padapter, enum hal_odm_variable eVariable, void *pValue1, bool bSet) { if (padapter->HalFunc.SetHalODMVarHandler) padapter->HalFunc.SetHalODMVarHandler(padapter, eVariable, pValue1, bSet); } -void rtw_hal_get_odm_var(struct adapter *padapter, enum HAL_ODM_VARIABLE eVariable, void *pValue1, void *pValue2) +void rtw_hal_get_odm_var(struct adapter *padapter, enum hal_odm_variable eVariable, void *pValue1, void *pValue2) { if (padapter->HalFunc.GetHalODMVarHandler) padapter->HalFunc.GetHalODMVarHandler(padapter, eVariable, pValue1, pValue2); diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 9bcceb13ca2d..d30659a11236 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -2086,7 +2086,7 @@ static void rtl8723b_SetBeaconRelatedRegisters(struct adapter *padapter) static void rtl8723b_GetHalODMVar( struct adapter *Adapter, - enum HAL_ODM_VARIABLE eVariable, + enum hal_odm_variable eVariable, void *pValue1, void *pValue2 ) @@ -2096,7 +2096,7 @@ static void rtl8723b_GetHalODMVar( static void rtl8723b_SetHalODMVar( struct adapter *Adapter, - enum HAL_ODM_VARIABLE eVariable, + enum hal_odm_variable eVariable, void *pValue1, bool bSet ) @@ -4304,7 +4304,7 @@ void GetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val) /* Description: * Change default setting of specified variable. */ -u8 SetHalDefVar8723B(struct adapter *padapter, enum HAL_DEF_VARIABLE variable, void *pval) +u8 SetHalDefVar8723B(struct adapter *padapter, enum hal_def_variable variable, void *pval) { u8 bResult; @@ -4322,7 +4322,7 @@ u8 SetHalDefVar8723B(struct adapter *padapter, enum HAL_DEF_VARIABLE variable, v /* Description: * Query setting of specified variable. */ -u8 GetHalDefVar8723B(struct adapter *padapter, enum HAL_DEF_VARIABLE variable, void *pval) +u8 GetHalDefVar8723B(struct adapter *padapter, enum hal_def_variable variable, void *pval) { u8 bResult; diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index 5ceb3b635915..9fc565881e32 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -1458,7 +1458,7 @@ static void SetHwRegWithBuf8723B(struct adapter *padapter, u8 variable, u8 *pbuf /* Query setting of specified variable. */ /* */ static u8 GetHalDefVar8723BSDIO( - struct adapter *Adapter, enum HAL_DEF_VARIABLE eVariable, void *pValue + struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue ) { u8 bResult = _SUCCESS; @@ -1486,7 +1486,7 @@ static u8 GetHalDefVar8723BSDIO( /* Change default setting of specified variable. */ /* */ static u8 SetHalDefVar8723BSDIO(struct adapter *Adapter, - enum HAL_DEF_VARIABLE eVariable, void *pValue) + enum hal_def_variable eVariable, void *pValue) { return SetHalDefVar8723B(Adapter, eVariable, pValue); } diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h index 81c85ca3b402..18a72feb8b69 100644 --- a/drivers/staging/rtl8723bs/include/hal_com.h +++ b/drivers/staging/rtl8723bs/include/hal_com.h @@ -241,9 +241,9 @@ void SetHwReg(struct adapter *padapter, u8 variable, u8 *val); void GetHwReg(struct adapter *padapter, u8 variable, u8 *val); void rtw_hal_check_rxfifo_full(struct adapter *adapter); -u8 SetHalDefVar(struct adapter *adapter, enum HAL_DEF_VARIABLE variable, +u8 SetHalDefVar(struct adapter *adapter, enum hal_def_variable variable, void *value); -u8 GetHalDefVar(struct adapter *adapter, enum HAL_DEF_VARIABLE variable, +u8 GetHalDefVar(struct adapter *adapter, enum hal_def_variable variable, void *value); bool eqNByte(u8 *str1, u8 *str2, u32 num); @@ -278,12 +278,12 @@ void rtw_dump_raw_rssi_info(struct adapter *padapter); void rtw_bb_rf_gain_offset(struct adapter *padapter); void GetHalODMVar(struct adapter *Adapter, - enum HAL_ODM_VARIABLE eVariable, + enum hal_odm_variable eVariable, void *pValue1, void *pValue2); void SetHalODMVar( struct adapter *Adapter, - enum HAL_ODM_VARIABLE eVariable, + enum hal_odm_variable eVariable, void *pValue1, bool bSet); #endif /* __HAL_COMMON_H__ */ diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h index 093e00b9349b..f3be4eaa9685 100644 --- a/drivers/staging/rtl8723bs/include/hal_intf.h +++ b/drivers/staging/rtl8723bs/include/hal_intf.h @@ -8,14 +8,14 @@ #define __HAL_INTF_H__ -enum RTL871X_HCI_TYPE { +enum rtl871x_hci_type { RTW_PCIE = BIT0, RTW_USB = BIT1, RTW_SDIO = BIT2, RTW_GSPI = BIT3, }; -enum HW_VARIABLES { +enum hw_variables { HW_VAR_MEDIA_STATUS, HW_VAR_MEDIA_STATUS1, HW_VAR_SET_OPMODE, @@ -115,7 +115,7 @@ enum HW_VARIABLES { HW_VAR_MACID_WAKEUP, }; -enum HAL_DEF_VARIABLE { +enum hal_def_variable { HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, HAL_DEF_IS_SUPPORT_ANT_DIV, HAL_DEF_CURRENT_ANTENNA, @@ -150,14 +150,14 @@ enum HAL_DEF_VARIABLE { HAL_DEF_DBG_RX_INFO_DUMP, }; -enum HAL_ODM_VARIABLE { +enum hal_odm_variable { HAL_ODM_STA_INFO, HAL_ODM_P2P_STATE, HAL_ODM_WIFI_DISPLAY_STATE, HAL_ODM_NOISE_MONITOR, }; -enum HAL_INTF_PS_FUNC { +enum hal_intf_ps_func { HAL_USB_SELECT_SUSPEND, HAL_MAX_ID, }; @@ -213,11 +213,11 @@ struct hal_ops { void (*SetHwRegHandlerWithBuf)(struct adapter *padapter, u8 variable, u8 *pbuf, int len); - u8 (*GetHalDefVarHandler)(struct adapter *padapter, enum HAL_DEF_VARIABLE eVariable, void *pValue); - u8 (*SetHalDefVarHandler)(struct adapter *padapter, enum HAL_DEF_VARIABLE eVariable, void *pValue); + u8 (*GetHalDefVarHandler)(struct adapter *padapter, enum hal_def_variable eVariable, void *pValue); + u8 (*SetHalDefVarHandler)(struct adapter *padapter, enum hal_def_variable eVariable, void *pValue); - void (*GetHalODMVarHandler)(struct adapter *padapter, enum HAL_ODM_VARIABLE eVariable, void *pValue1, void *pValue2); - void (*SetHalODMVarHandler)(struct adapter *padapter, enum HAL_ODM_VARIABLE eVariable, void *pValue1, bool bSet); + void (*GetHalODMVarHandler)(struct adapter *padapter, enum hal_odm_variable eVariable, void *pValue1, void *pValue2); + void (*SetHalODMVarHandler)(struct adapter *padapter, enum hal_odm_variable eVariable, void *pValue1, bool bSet); void (*UpdateRAMaskHandler)(struct adapter *padapter, u32 mac_id, u8 rssi_level); void (*SetBeaconRelatedRegistersHandler)(struct adapter *padapter); @@ -227,7 +227,7 @@ struct hal_ops { void (*run_thread)(struct adapter *padapter); void (*cancel_thread)(struct adapter *padapter); - u8 (*interface_ps_func)(struct adapter *padapter, enum HAL_INTF_PS_FUNC efunc_id, u8 *val); + u8 (*interface_ps_func)(struct adapter *padapter, enum hal_intf_ps_func efunc_id, u8 *val); s32 (*hal_xmit)(struct adapter *padapter, struct xmit_frame *pxmitframe); /* @@ -260,7 +260,7 @@ struct hal_ops { s32 (*fill_h2c_cmd)(struct adapter *, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer); }; -enum RT_EEPROM_TYPE { +enum rt_eeprom_type { EEPROM_93C46, EEPROM_93C56, EEPROM_BOOT_EFUSE, @@ -330,11 +330,11 @@ void rtw_hal_chip_configure(struct adapter *padapter); void rtw_hal_read_chip_info(struct adapter *padapter); void rtw_hal_read_chip_version(struct adapter *padapter); -u8 rtw_hal_set_def_var(struct adapter *padapter, enum HAL_DEF_VARIABLE eVariable, void *pValue); -u8 rtw_hal_get_def_var(struct adapter *padapter, enum HAL_DEF_VARIABLE eVariable, void *pValue); +u8 rtw_hal_set_def_var(struct adapter *padapter, enum hal_def_variable eVariable, void *pValue); +u8 rtw_hal_get_def_var(struct adapter *padapter, enum hal_def_variable eVariable, void *pValue); -void rtw_hal_set_odm_var(struct adapter *padapter, enum HAL_ODM_VARIABLE eVariable, void *pValue1, bool bSet); -void rtw_hal_get_odm_var(struct adapter *padapter, enum HAL_ODM_VARIABLE eVariable, void *pValue1, void *pValue2); +void rtw_hal_set_odm_var(struct adapter *padapter, enum hal_odm_variable eVariable, void *pValue1, bool bSet); +void rtw_hal_get_odm_var(struct adapter *padapter, enum hal_odm_variable eVariable, void *pValue1, void *pValue2); void rtw_hal_enable_interrupt(struct adapter *padapter); void rtw_hal_disable_interrupt(struct adapter *padapter); diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index f9a4661997c4..fdade62bda28 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -231,9 +231,9 @@ void C2HPacketHandler_8723B(struct adapter *padapter, u8 *pbuffer, u16 length); void rtl8723b_set_hal_ops(struct hal_ops *pHalFunc); void SetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val); void GetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val); -u8 SetHalDefVar8723B(struct adapter *padapter, enum HAL_DEF_VARIABLE variable, +u8 SetHalDefVar8723B(struct adapter *padapter, enum hal_def_variable variable, void *pval); -u8 GetHalDefVar8723B(struct adapter *padapter, enum HAL_DEF_VARIABLE variable, +u8 GetHalDefVar8723B(struct adapter *padapter, enum hal_def_variable variable, void *pval); /* register */ -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:20:59 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:20:59 +0100 Subject: [PATCH 12/43] Staging: rtl8723bs: fix names in osdep_service.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-13-marcocesati@gmail.com> This commit converts names of structs / enums in include/osdep_service.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/osdep_service.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/include/osdep_service.h b/drivers/staging/rtl8723bs/include/osdep_service.h index 07f846efa0d1..10e1826eff77 100644 --- a/drivers/staging/rtl8723bs/include/osdep_service.h +++ b/drivers/staging/rtl8723bs/include/osdep_service.h @@ -80,7 +80,7 @@ enum mstat_f { #define mstat_tf_idx(flags) ((flags)&0xff) #define mstat_ff_idx(flags) (((flags)&0xff00) >> 8) -enum MSTAT_STATUS { +enum mstat_status { MSTAT_ALLOC_SUCCESS = 0, MSTAT_ALLOC_FAIL, MSTAT_FREE -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:02 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:02 +0100 Subject: [PATCH 15/43] Staging: rtl8723bs: fix names in rtl8723b_xmit.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-16-marcocesati@gmail.com> This commit converts names of structs / enums in include/rtl8723b_xmit.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 8 ++++---- drivers/staging/rtl8723bs/include/rtl8723b_xmit.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index d30659a11236..9c30024fa984 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -2991,7 +2991,7 @@ static u8 fill_txdesc_sectype(struct pkt_attrib *pattrib) return sectype; } -static void fill_txdesc_vcs_8723b(struct adapter *padapter, struct pkt_attrib *pattrib, struct TXDESC_8723B *ptxdesc) +static void fill_txdesc_vcs_8723b(struct adapter *padapter, struct pkt_attrib *pattrib, struct txdesc_8723b *ptxdesc) { /* DBG_8192C("cvs_mode =%d\n", pattrib->vcs_mode); */ @@ -3024,7 +3024,7 @@ static void fill_txdesc_vcs_8723b(struct adapter *padapter, struct pkt_attrib *p } } -static void fill_txdesc_phy_8723b(struct adapter *padapter, struct pkt_attrib *pattrib, struct TXDESC_8723B *ptxdesc) +static void fill_txdesc_phy_8723b(struct adapter *padapter, struct pkt_attrib *pattrib, struct txdesc_8723b *ptxdesc) { /* DBG_8192C("bwmode =%d, ch_off =%d\n", pattrib->bwmode, pattrib->ch_offset); */ @@ -3044,7 +3044,7 @@ static void rtl8723b_fill_default_txdesc( struct mlme_ext_priv *pmlmeext; struct mlme_ext_info *pmlmeinfo; struct pkt_attrib *pattrib; - struct TXDESC_8723B *ptxdesc; + struct txdesc_8723b *ptxdesc; s32 bmcst; memset(pbuf, 0, TXDESC_SIZE); @@ -3057,7 +3057,7 @@ static void rtl8723b_fill_default_txdesc( pattrib = &pxmitframe->attrib; bmcst = IS_MCAST(pattrib->ra); - ptxdesc = (struct TXDESC_8723B *)pbuf; + ptxdesc = (struct txdesc_8723b *)pbuf; if (pxmitframe->frame_tag == DATA_FRAMETAG) { u8 drv_userate = 0; diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h b/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h index ccadc3d11644..56bdc14af47d 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h @@ -59,7 +59,7 @@ /* */ /* defined for TX DESC Operation */ /* */ -struct TXDESC_8723B { +struct txdesc_8723b { /* Offset 0 */ u32 pktlen:16; u32 offset:8; -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:01 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:01 +0100 Subject: [PATCH 14/43] Staging: rtl8723bs: fix names in hal_com_h2c.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-15-marcocesati@gmail.com> This commit converts names of structs / enums in include/hal_com_h2c.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 12 ++++++------ drivers/staging/rtl8723bs/include/hal_com_h2c.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index 61fd643c244f..6897fc49e649 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -434,7 +434,7 @@ void CheckFwRsvdPageContent(struct adapter *Adapter) { } -static void rtl8723b_set_FwRsvdPage_cmd(struct adapter *padapter, struct RSVDPAGE_LOC *rsvdpageloc) +static void rtl8723b_set_FwRsvdPage_cmd(struct adapter *padapter, struct rsvdpage_loc *rsvdpageloc) { u8 u1H2CRsvdPageParm[H2C_RSVDPAGE_LOC_LEN] = {0}; @@ -453,7 +453,7 @@ static void rtl8723b_set_FwRsvdPage_cmd(struct adapter *padapter, struct RSVDPAG FillH2CCmd8723B(padapter, H2C_8723B_RSVD_PAGE, H2C_RSVDPAGE_LOC_LEN, u1H2CRsvdPageParm); } -static void rtl8723b_set_FwAoacRsvdPage_cmd(struct adapter *padapter, struct RSVDPAGE_LOC *rsvdpageloc) +static void rtl8723b_set_FwAoacRsvdPage_cmd(struct adapter *padapter, struct rsvdpage_loc *rsvdpageloc) { } @@ -789,7 +789,7 @@ static void rtl8723b_set_FwRsvdPagePkt( u16 BufIndex, PageSize = 128; u32 TotalPacketLen, MaxRsvdPageBufSize = 0; - struct RSVDPAGE_LOC RsvdPageLoc; + struct rsvdpage_loc RsvdPageLoc; /* DBG_871X("%s---->\n", __func__); */ @@ -808,7 +808,7 @@ static void rtl8723b_set_FwRsvdPagePkt( } ReservedPagePacket = pcmdframe->buf_addr; - memset(&RsvdPageLoc, 0, sizeof(struct RSVDPAGE_LOC)); + memset(&RsvdPageLoc, 0, sizeof(struct rsvdpage_loc)); /* 3 (1) beacon */ BufIndex = TxDescOffset; @@ -1267,7 +1267,7 @@ static void SetFwRsvdPagePkt_BTCoex(struct adapter *padapter) u8 TotalPageNum = 0, CurtPktPageNum = 0, RsvdPageNum = 0; u16 BufIndex, PageSize; u32 TotalPacketLen, MaxRsvdPageBufSize = 0; - struct RSVDPAGE_LOC RsvdPageLoc; + struct rsvdpage_loc RsvdPageLoc; /* DBG_8192C("+" FUNC_ADPT_FMT "\n", FUNC_ADPT_ARG(padapter)); */ @@ -1287,7 +1287,7 @@ static void SetFwRsvdPagePkt_BTCoex(struct adapter *padapter) } ReservedPagePacket = pcmdframe->buf_addr; - memset(&RsvdPageLoc, 0, sizeof(struct RSVDPAGE_LOC)); + memset(&RsvdPageLoc, 0, sizeof(struct rsvdpage_loc)); /* 3 (1) beacon */ BufIndex = TxDescOffset; diff --git a/drivers/staging/rtl8723bs/include/hal_com_h2c.h b/drivers/staging/rtl8723bs/include/hal_com_h2c.h index 1e1982621e2c..f8b5a53e90bc 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_h2c.h +++ b/drivers/staging/rtl8723bs/include/hal_com_h2c.h @@ -180,7 +180,7 @@ enum h2c_cmd { /* */ /* Structure -------------------------------------------------- */ /* */ -struct RSVDPAGE_LOC { +struct rsvdpage_loc { u8 LocProbeRsp; u8 LocPsPoll; u8 LocNullData; -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:03 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:03 +0100 Subject: [PATCH 16/43] Staging: rtl8723bs: fix names in HalVerDef.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-17-marcocesati@gmail.com> This commit converts names of structs / enums in include/HalVerDef.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/hal_com.c | 2 +- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 4 +- drivers/staging/rtl8723bs/include/HalVerDef.h | 50 +++++++++---------- drivers/staging/rtl8723bs/include/hal_com.h | 2 +- drivers/staging/rtl8723bs/include/hal_data.h | 2 +- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 32e6b8233341..1e66f749fd40 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -38,7 +38,7 @@ void rtw_hal_data_deinit(struct adapter *padapter) } -void dump_chip_info(struct HAL_VERSION ChipVersion) +void dump_chip_info(struct hal_version ChipVersion) { char buf[128]; size_t cnt = 0; diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 9c30024fa984..44bbffab0c02 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -1872,10 +1872,10 @@ static bool Hal_EfusePgPacketWrite_BT( return true; } -static struct HAL_VERSION ReadChipVersion8723B(struct adapter *padapter) +static struct hal_version ReadChipVersion8723B(struct adapter *padapter) { u32 value32; - struct HAL_VERSION ChipVersion; + struct hal_version ChipVersion; struct hal_com_data *pHalData; /* YJ, TODO, move read chip type here */ diff --git a/drivers/staging/rtl8723bs/include/HalVerDef.h b/drivers/staging/rtl8723bs/include/HalVerDef.h index 11055147a2a2..bab226f77b24 100644 --- a/drivers/staging/rtl8723bs/include/HalVerDef.h +++ b/drivers/staging/rtl8723bs/include/HalVerDef.h @@ -7,8 +7,8 @@ #ifndef __HAL_VERSION_DEF_H__ #define __HAL_VERSION_DEF_H__ -/* HAL_IC_TYPE_E */ -enum HAL_IC_TYPE_E { /* tag_HAL_IC_Type_Definition */ +/* hal_ic_type_e */ +enum hal_ic_type_e { /* tag_HAL_IC_Type_Definition */ CHIP_8192S = 0, CHIP_8188C = 1, CHIP_8192C = 2, @@ -21,15 +21,15 @@ enum HAL_IC_TYPE_E { /* tag_HAL_IC_Type_Definition */ CHIP_8192E = 9, }; -/* HAL_CHIP_TYPE_E */ -enum HAL_CHIP_TYPE_E { /* tag_HAL_CHIP_Type_Definition */ +/* hal_chip_type_e */ +enum hal_chip_type_e { /* tag_HAL_CHIP_Type_Definition */ TEST_CHIP = 0, NORMAL_CHIP = 1, FPGA = 2, }; -/* HAL_CUT_VERSION_E */ -enum HAL_CUT_VERSION_E { /* tag_HAL_Cut_Version_Definition */ +/* hal_cut_version_e */ +enum hal_cut_version_e { /* tag_HAL_Cut_Version_Definition */ A_CUT_VERSION = 0, B_CUT_VERSION = 1, C_CUT_VERSION = 2, @@ -44,13 +44,13 @@ enum HAL_CUT_VERSION_E { /* tag_HAL_Cut_Version_Definition */ }; /* HAL_Manufacturer */ -enum HAL_VENDOR_E { /* tag_HAL_Manufacturer_Version_Definition */ +enum hal_vendor_e { /* tag_HAL_Manufacturer_Version_Definition */ CHIP_VENDOR_TSMC = 0, CHIP_VENDOR_UMC = 1, CHIP_VENDOR_SMIC = 2, }; -enum HAL_RF_TYPE_E { /* tag_HAL_RF_Type_Definition */ +enum hal_rf_type_e { /* tag_HAL_RF_Type_Definition */ RF_TYPE_1T1R = 0, RF_TYPE_1T2R = 1, RF_TYPE_2T2R = 2, @@ -61,36 +61,36 @@ enum HAL_RF_TYPE_E { /* tag_HAL_RF_Type_Definition */ RF_TYPE_4T4R = 7, }; -struct HAL_VERSION { /* tag_HAL_VERSION */ - enum HAL_IC_TYPE_E ICType; - enum HAL_CHIP_TYPE_E ChipType; - enum HAL_CUT_VERSION_E CUTVersion; - enum HAL_VENDOR_E VendorType; - enum HAL_RF_TYPE_E RFType; +struct hal_version { /* tag_HAL_VERSION */ + enum hal_ic_type_e ICType; + enum hal_chip_type_e ChipType; + enum hal_cut_version_e CUTVersion; + enum hal_vendor_e VendorType; + enum hal_rf_type_e RFType; u8 ROMVer; }; /* VERSION_8192C VersionID; */ -/* HAL_VERSION VersionID; */ +/* hal_version VersionID; */ /* Get element */ -#define GET_CVID_IC_TYPE(version) ((enum HAL_IC_TYPE_E)((version).ICType)) -#define GET_CVID_CHIP_TYPE(version) ((enum HAL_CHIP_TYPE_E)((version).ChipType)) -#define GET_CVID_RF_TYPE(version) ((enum HAL_RF_TYPE_E)((version).RFType)) -#define GET_CVID_MANUFACTUER(version) ((enum HAL_VENDOR_E)((version).VendorType)) -#define GET_CVID_CUT_VERSION(version) ((enum HAL_CUT_VERSION_E)((version).CUTVersion)) +#define GET_CVID_IC_TYPE(version) ((enum hal_ic_type_e)((version).ICType)) +#define GET_CVID_CHIP_TYPE(version) ((enum hal_chip_type_e)((version).ChipType)) +#define GET_CVID_RF_TYPE(version) ((enum hal_rf_type_e)((version).RFType)) +#define GET_CVID_MANUFACTUER(version) ((enum hal_vendor_e)((version).VendorType)) +#define GET_CVID_CUT_VERSION(version) ((enum hal_cut_version_e)((version).CUTVersion)) #define GET_CVID_ROM_VERSION(version) (((version).ROMVer) & ROM_VERSION_MASK) /* */ /* Common Macro. -- */ /* */ -/* HAL_VERSION VersionID */ +/* hal_version VersionID */ -/* HAL_CHIP_TYPE_E */ +/* hal_chip_type_e */ #define IS_TEST_CHIP(version) ((GET_CVID_CHIP_TYPE(version) == TEST_CHIP) ? true : false) #define IS_NORMAL_CHIP(version) ((GET_CVID_CHIP_TYPE(version) == NORMAL_CHIP) ? true : false) -/* HAL_CUT_VERSION_E */ +/* hal_cut_version_e */ #define IS_A_CUT(version) ((GET_CVID_CUT_VERSION(version) == A_CUT_VERSION) ? true : false) #define IS_B_CUT(version) ((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true : false) #define IS_C_CUT(version) ((GET_CVID_CUT_VERSION(version) == C_CUT_VERSION) ? true : false) @@ -100,12 +100,12 @@ struct HAL_VERSION { /* tag_HAL_VERSION */ #define IS_J_CUT(version) ((GET_CVID_CUT_VERSION(version) == J_CUT_VERSION) ? true : false) #define IS_K_CUT(version) ((GET_CVID_CUT_VERSION(version) == K_CUT_VERSION) ? true : false) -/* HAL_VENDOR_E */ +/* hal_vendor_e */ #define IS_CHIP_VENDOR_TSMC(version) ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_TSMC) ? true : false) #define IS_CHIP_VENDOR_UMC(version) ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_UMC) ? true : false) #define IS_CHIP_VENDOR_SMIC(version) ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_SMIC) ? true : false) -/* HAL_RF_TYPE_E */ +/* hal_rf_type_e */ #define IS_1T1R(version) ((GET_CVID_RF_TYPE(version) == RF_TYPE_1T1R) ? true : false) #define IS_1T2R(version) ((GET_CVID_RF_TYPE(version) == RF_TYPE_1T2R) ? true : false) #define IS_2T2R(version) ((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R) ? true : false) diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h index 18a72feb8b69..28451385dec3 100644 --- a/drivers/staging/rtl8723bs/include/hal_com.h +++ b/drivers/staging/rtl8723bs/include/hal_com.h @@ -193,7 +193,7 @@ enum firmware_source { u8 rtw_hal_data_init(struct adapter *padapter); void rtw_hal_data_deinit(struct adapter *padapter); -void dump_chip_info(struct HAL_VERSION ChipVersion); +void dump_chip_info(struct hal_version ChipVersion); u8 /* return the final channel plan decision */ hal_com_config_channel_plan( diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h index 8e75a334c60b..5f7cad83ce1c 100644 --- a/drivers/staging/rtl8723bs/include/hal_data.h +++ b/drivers/staging/rtl8723bs/include/hal_data.h @@ -176,7 +176,7 @@ struct dm_priv { struct hal_com_data { - struct HAL_VERSION VersionID; + struct hal_version VersionID; enum RT_MULTI_FUNC MultiFunc; /* For multi-function consideration. */ enum RT_POLARITY_CTL PolarityCtl; /* For Wifi PDn Polarity control. */ enum RT_REGULATOR_MODE RegulatorMode; /* switching regulator or LDO */ -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:05 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:05 +0100 Subject: [PATCH 18/43] Staging: rtl8723bs: fix names in rtl8723b_hal.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-19-marcocesati@gmail.com> This commit converts names of structs / enums in include/rtl8723b_hal.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 4 ++-- drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c | 2 +- drivers/staging/rtl8723bs/include/rtl8723b_hal.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 44bbffab0c02..f33b084011b5 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -3695,7 +3695,7 @@ s32 c2h_handler_8723b(struct adapter *padapter, u8 *buf) return ret; } -static void process_c2h_event(struct adapter *padapter, struct C2H_EVT_HDR *pC2hEvent, u8 *c2hBuf) +static void process_c2h_event(struct adapter *padapter, struct c2h_evt_hdr_t *pC2hEvent, u8 *c2hBuf) { u8 index = 0; @@ -3739,7 +3739,7 @@ static void process_c2h_event(struct adapter *padapter, struct C2H_EVT_HDR *pC2h void C2HPacketHandler_8723B(struct adapter *padapter, u8 *pbuffer, u16 length) { - struct C2H_EVT_HDR C2hEvent; + struct c2h_evt_hdr_t C2hEvent; u8 *tmpBuf = NULL; C2hEvent.CmdID = pbuffer[0]; C2hEvent.CmdSeq = pbuffer[1]; diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c index 9e1b33c71710..17a3e7bf66ef 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c @@ -349,7 +349,7 @@ static void rtl8723bs_recv_tasklet(struct tasklet_struct *t) RT_TRACE(_module_rtl871x_recv_c_, _drv_dump_, ("%s: rtw_recv_entry(precvframe) != _SUCCESS\n", __func__)); } } else if (pattrib->pkt_rpt_type == C2H_PACKET) { - struct C2H_EVT_HDR C2hEvent; + struct c2h_evt_hdr_t C2hEvent; u16 len_c2h = pattrib->pkt_len; u8 *pbuf_c2h = precvframe->u.hdr.rx_data; diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index fdade62bda28..95dfcb338fa8 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -156,7 +156,7 @@ struct rt_firmware_hdr { /* Description: Determine the types of C2H events that are the same in driver * and FW; First constructed by tynli. 2009.10.09. */ -enum C2H_EVT { +enum c2h_evt { C2H_DBG = 0, C2H_TSF = 1, C2H_AP_RPT_RSP = 2, @@ -172,13 +172,13 @@ enum C2H_EVT { MAX_C2HEVENT }; -struct C2H_EVT_HDR { +struct c2h_evt_hdr_t { u8 CmdID; u8 CmdLen; u8 CmdSeq; } __attribute__((__packed__)); -enum PACKAGE_TYPE_E { /* tag_Package_Definition */ +enum package_type_e { /* tag_Package_Definition */ PACKAGE_DEFAULT, PACKAGE_QFN68, PACKAGE_TFBGA90, -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:06 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:06 +0100 Subject: [PATCH 19/43] Staging: rtl8723bs: fix names in hal_phy.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-20-marcocesati@gmail.com> This commit converts names of structs / enums in include/hal_phy.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 2 +- drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c | 4 ++-- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 4 ++-- .../staging/rtl8723bs/include/hal_com_phycfg.h | 2 +- drivers/staging/rtl8723bs/include/hal_data.h | 6 +++--- drivers/staging/rtl8723bs/include/hal_phy.h | 16 ++++++++-------- drivers/staging/rtl8723bs/include/rtw_mp.h | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 7405f9229117..b46db8909cb4 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -1673,7 +1673,7 @@ static s16 get_rate_sctn_idx(const u8 rate) } s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, - enum BAND_TYPE band_type, enum CHANNEL_WIDTH bandwidth, + enum band_type band_type, enum CHANNEL_WIDTH bandwidth, u8 rf_path, u8 data_rate, u8 channel) { s16 idx_band = -1; diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c index 9868d9f2b4df..9a41c185cf84 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c @@ -108,7 +108,7 @@ void PHY_SetBBReg_8723B( /* */ static u32 phy_RFSerialRead_8723B( - struct adapter *Adapter, enum RF_PATH eRFPath, u32 Offset + struct adapter *Adapter, enum rf_path eRFPath, u32 Offset ) { u32 retValue = 0; @@ -202,7 +202,7 @@ static u32 phy_RFSerialRead_8723B( */ static void phy_RFSerialWrite_8723B( struct adapter *Adapter, - enum RF_PATH eRFPath, + enum rf_path eRFPath, u32 Offset, u32 Data ) diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c index 9fc565881e32..6731ce2dadda 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -751,9 +751,9 @@ static u32 rtl8723bs_hal_init(struct adapter *padapter) /* Joseph Note: Keep RfRegChnlVal for later use. */ /* */ pHalData->RfRegChnlVal[0] = - PHY_QueryRFReg(padapter, (enum RF_PATH)0, RF_CHNLBW, bRFRegOffsetMask); + PHY_QueryRFReg(padapter, (enum rf_path)0, RF_CHNLBW, bRFRegOffsetMask); pHalData->RfRegChnlVal[1] = - PHY_QueryRFReg(padapter, (enum RF_PATH)1, RF_CHNLBW, bRFRegOffsetMask); + PHY_QueryRFReg(padapter, (enum rf_path)1, RF_CHNLBW, bRFRegOffsetMask); /* if (!pHalData->bMACFuncEnable) { */ diff --git a/drivers/staging/rtl8723bs/include/hal_com_phycfg.h b/drivers/staging/rtl8723bs/include/hal_com_phycfg.h index 580b85324ae7..32fd050428db 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_phycfg.h +++ b/drivers/staging/rtl8723bs/include/hal_com_phycfg.h @@ -178,7 +178,7 @@ u8 Channel, ); s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 RegPwrTblSel, - enum BAND_TYPE Band, enum CHANNEL_WIDTH Bandwidth, + enum band_type Band, enum CHANNEL_WIDTH Bandwidth, u8 RfPath, u8 DataRate, u8 Channel diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h index 5f7cad83ce1c..d731cec8ab81 100644 --- a/drivers/staging/rtl8723bs/include/hal_data.h +++ b/drivers/staging/rtl8723bs/include/hal_data.h @@ -187,10 +187,10 @@ struct hal_com_data { u16 FirmwareSignature; /* current WIFI_PHY values */ - enum WIRELESS_MODE CurrentWirelessMode; + enum wireless_mode CurrentWirelessMode; enum CHANNEL_WIDTH CurrentChannelBW; - enum BAND_TYPE CurrentBandType; /* 0:2.4G, 1:5G */ - enum BAND_TYPE BandSet; + enum band_type CurrentBandType; /* 0:2.4G, 1:5G */ + enum band_type BandSet; u8 CurrentChannel; u8 CurrentCenterFrequencyIndex1; u8 nCur40MhzPrimeSC;/* Control channel sub-carrier */ diff --git a/drivers/staging/rtl8723bs/include/hal_phy.h b/drivers/staging/rtl8723bs/include/hal_phy.h index ed0caa0574e3..d2f5e7afcd64 100644 --- a/drivers/staging/rtl8723bs/include/hal_phy.h +++ b/drivers/staging/rtl8723bs/include/hal_phy.h @@ -42,14 +42,14 @@ /*--------------------------Define Parameters-------------------------------*/ -enum BAND_TYPE { +enum band_type { BAND_ON_2_4G = 0, BAND_ON_5G, BAND_ON_BOTH, BANDMAX }; -enum RF_TYPE { +enum rf_type { RF_TYPE_MIN = 0, /* 0 */ RF_8225 = 1, /* 1 11b/g RF for verification only */ RF_8256 = 2, /* 2 11b/g/n */ @@ -59,7 +59,7 @@ enum RF_TYPE { RF_TYPE_MAX }; -enum RF_PATH { +enum rf_path { RF_PATH_A = 0, RF_PATH_B, RF_PATH_C, @@ -74,7 +74,7 @@ enum RF_PATH { #define RF_PATH_MAX_92C_88E 2 #define RF_PATH_MAX_90_8812 4 /* Max RF number 90 support */ -enum ANTENNA_PATH { +enum antenna_path { ANTENNA_NONE = 0, ANTENNA_D = 1, ANTENNA_C = 2, @@ -93,7 +93,7 @@ enum ANTENNA_PATH { ANTENNA_ABCD = 15 }; -enum RF_CONTENT { +enum rf_content { radioa_txt = 0x1000, radiob_txt = 0x1001, radioc_txt = 0x1002, @@ -108,7 +108,7 @@ enum BaseBand_Config_Type { BaseBand_Config_PHY_REG_PG }; -enum HW_BLOCK { +enum hw_block { HW_BLOCK_MAC = 0, HW_BLOCK_PHY0 = 1, HW_BLOCK_PHY1 = 2, @@ -116,7 +116,7 @@ enum HW_BLOCK { HW_BLOCK_MAXIMUM = 4, /* Never use this */ }; -enum WIRELESS_MODE { +enum wireless_mode { WIRELESS_MODE_UNKNOWN = 0x00, WIRELESS_MODE_A = 0x01, WIRELESS_MODE_B = 0x02, @@ -146,7 +146,7 @@ struct SwChnlCmd { u32 msDelay; }; -struct R_ANTENNA_SELECT_OFDM { +struct r_antenna_select_ofdm { #ifdef __LITTLE_ENDIAN u32 r_tx_antenna:4; u32 r_ant_l:4; diff --git a/drivers/staging/rtl8723bs/include/rtw_mp.h b/drivers/staging/rtl8723bs/include/rtw_mp.h index 48e5915e0a7a..3988da646a48 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mp.h +++ b/drivers/staging/rtl8723bs/include/rtw_mp.h @@ -89,7 +89,7 @@ struct mpt_context { /* The RfPath of IO operation is depend of MptActType. */ u32 MptRfPath; - enum WIRELESS_MODE MptWirelessModeToSw; /* Wireless mode to switch. */ + enum wireless_mode MptWirelessModeToSw; /* Wireless mode to switch. */ u8 MptChannelToSw; /* Channel to switch. */ u8 MptInitGainToSet; /* Initial gain to set. */ u32 MptBandWidth; /* bandwidth to switch. */ -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:04 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:04 +0100 Subject: [PATCH 17/43] Staging: rtl8723bs: fix names in wifi.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-18-marcocesati@gmail.com> This commit converts names of structs / enums in include/wifi.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtw_mlme.h | 8 ++++---- drivers/staging/rtl8723bs/include/wifi.h | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h index ffcceb1fdde6..02d973a5aed2 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mlme.h +++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h @@ -230,9 +230,9 @@ struct wifidirect_info { struct group_id_info groupid_info; /* Store the group id information when doing the group negotiation handshake. */ struct scan_limit_info rx_invitereq_info; /* Used for get the limit scan channel from the Invitation procedure */ struct scan_limit_info p2p_info; /* Used for get the limit scan channel from the P2P negotiation handshake */ - enum P2P_ROLE role; - enum P2P_STATE pre_p2p_state; - enum P2P_STATE p2p_state; + enum p2p_role role; + enum p2p_state pre_p2p_state; + enum p2p_state p2p_state; u8 device_addr[ETH_ALEN]; /* The device address should be the mac address of this device. */ u8 interface_addr[ETH_ALEN]; u8 social_chan[4]; @@ -275,7 +275,7 @@ struct wifidirect_info { /* In this case, the driver can issue the tdls setup request frame */ /* even the current security is weak security. */ - enum P2P_WPSINFO ui_got_wps_info; /* This field will store the WPS value (PIN value or PBC) that UI had got from the user. */ + enum p2p_wpsinfo ui_got_wps_info; /* This field will store the WPS value (PIN value or PBC) that UI had got from the user. */ u16 supported_wps_cm; /* This field describes the WPS config method which this driver supported. */ /* The value should be the combination of config method defined in page104 of WPS v2.0 spec. */ u8 external_uuid; /* UUID flag */ diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h index 4080803d9b1b..f9815411321c 100644 --- a/drivers/staging/rtl8723bs/include/wifi.h +++ b/drivers/staging/rtl8723bs/include/wifi.h @@ -43,14 +43,14 @@ /* This test verifies the WLAN NIC can update the NAV through sending the CTS with large duration. */ #define WiFiNavUpperUs 30000 /* 30 ms */ -enum WIFI_FRAME_TYPE { +enum wifi_frame_type { WIFI_MGT_TYPE = (0), WIFI_CTRL_TYPE = (BIT(2)), WIFI_DATA_TYPE = (BIT(3)), WIFI_QOS_DATA_TYPE = (BIT(7)|BIT(3)), /* QoS Data */ }; -enum WIFI_FRAME_SUBTYPE { +enum wifi_frame_subtype { /* below is for mgt frame */ WIFI_ASSOCREQ = (0 | WIFI_MGT_TYPE), @@ -88,7 +88,7 @@ enum WIFI_FRAME_SUBTYPE { WIFI_QOS_DATA_NULL = (BIT(6) | WIFI_QOS_DATA_TYPE), }; -enum WIFI_REG_DOMAIN { +enum wifi_reg_domain { DOMAIN_FCC = 1, DOMAIN_IC = 2, DOMAIN_ETSI = 3, @@ -751,14 +751,14 @@ struct ADDBA_request { #define WPS_CM_SW_DISPLAY_PIN 0x2008 #define WPS_CM_LCD_DISPLAY_PIN 0x4008 -enum P2P_ROLE { +enum p2p_role { P2P_ROLE_DISABLE = 0, P2P_ROLE_DEVICE = 1, P2P_ROLE_CLIENT = 2, P2P_ROLE_GO = 3 }; -enum P2P_STATE { +enum p2p_state { P2P_STATE_NONE = 0, /* P2P disable */ P2P_STATE_IDLE = 1, /* P2P had enabled and do nothing */ P2P_STATE_LISTEN = 2, /* In pure listen state */ @@ -784,7 +784,7 @@ enum P2P_STATE { P2P_STATE_TX_INFOR_NOREADY = 22, /* sending p2p negotiation response with information is not available */ }; -enum P2P_WPSINFO { +enum p2p_wpsinfo { P2P_NO_WPSINFO = 0, P2P_GOT_WPSINFO_PEER_DISPLAY_PIN = 1, P2P_GOT_WPSINFO_SELF_DISPLAY_PIN = 2, @@ -793,7 +793,7 @@ enum P2P_WPSINFO { #define P2P_PRIVATE_IOCTL_SET_LEN 64 -enum P2P_PROTO_WK_ID { +enum p2p_proto_wk_id { P2P_FIND_PHASE_WK = 0, P2P_RESTORE_STATE_WK = 1, P2P_PRE_TX_PROVDISC_PROCESS_WK = 2, -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:07 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:07 +0100 Subject: [PATCH 20/43] Staging: rtl8723bs: fix names in rtw_mlme_ext.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-21-marcocesati@gmail.com> This commit converts names of structs / enums in include/rtw_mlme_ext.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 24 ++++++++--------- .../staging/rtl8723bs/include/rtw_mlme_ext.h | 26 +++++++++---------- drivers/staging/rtl8723bs/os_dep/wifi_regd.c | 2 +- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index 416268f26dc3..7bd75744bcb2 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -71,7 +71,7 @@ static unsigned char REALTEK_96B_IE[] = {0x00, 0xe0, 0x4c, 0x02, 0x01, 0x20}; /******************************************************** ChannelPlan definitions *********************************************************/ -static struct RT_CHANNEL_PLAN_2G RTW_ChannelPlan2G[RT_CHANNEL_DOMAIN_2G_MAX] = { +static struct rt_channel_plan_2g RTW_ChannelPlan2G[RT_CHANNEL_DOMAIN_2G_MAX] = { {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, /* 0x00, RT_CHANNEL_DOMAIN_2G_WORLD , Passive scan CH 12, 13 */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, /* 0x01, RT_CHANNEL_DOMAIN_2G_ETSI1 */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 11}, /* 0x02, RT_CHANNEL_DOMAIN_2G_FCC1 */ @@ -81,7 +81,7 @@ static struct RT_CHANNEL_PLAN_2G RTW_ChannelPlan2G[RT_CHANNEL_DOMAIN_2G_MAX] = { {{}, 0}, /* 0x06, RT_CHANNEL_DOMAIN_2G_NULL */ }; -static struct RT_CHANNEL_PLAN_5G RTW_ChannelPlan5G[RT_CHANNEL_DOMAIN_5G_MAX] = { +static struct rt_channel_plan_5g RTW_ChannelPlan5G[RT_CHANNEL_DOMAIN_5G_MAX] = { {{}, 0}, /* 0x00, RT_CHANNEL_DOMAIN_5G_NULL */ {{36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}, 19}, /* 0x01, RT_CHANNEL_DOMAIN_5G_ETSI1 */ {{36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165}, 24}, /* 0x02, RT_CHANNEL_DOMAIN_5G_ETSI2 */ @@ -121,7 +121,7 @@ static struct RT_CHANNEL_PLAN_5G RTW_ChannelPlan5G[RT_CHANNEL_DOMAIN_5G_MAX] = { {{36, 40, 44, 48, 149, 153, 157, 161}, 8}, /* 0x22, RT_CHANNEL_DOMAIN_5G_FCC4_NO_DFS */ }; -static struct RT_CHANNEL_PLAN_MAP RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = { +static struct rt_channel_plan_map RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = { /* 0x00 ~ 0x1F , Old Define ===== */ {0x02, 0x20}, /* 0x00, RT_CHANNEL_DOMAIN_FCC */ {0x02, 0x0A}, /* 0x01, RT_CHANNEL_DOMAIN_IC */ @@ -209,7 +209,7 @@ static struct RT_CHANNEL_PLAN_MAP RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = { }; /* use the combination for max channel numbers */ -static struct RT_CHANNEL_PLAN_MAP RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE = {0x03, 0x02}; +static struct rt_channel_plan_map RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE = {0x03, 0x02}; /* Search the @param ch in given @param ch_set * @ch_set: the given channel set @@ -217,7 +217,7 @@ static struct RT_CHANNEL_PLAN_MAP RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE = {0x03, 0 * * return the index of channel_num in channel_set, -1 if not found */ -int rtw_ch_set_search_ch(struct RT_CHANNEL_INFO *ch_set, const u32 ch) +int rtw_ch_set_search_ch(struct rt_channel_info *ch_set, const u32 ch) { int i; @@ -325,7 +325,7 @@ static void init_mlme_ext_priv_value(struct adapter *padapter) pmlmeext->action_public_dialog_token = 0xff; } -static int has_channel(struct RT_CHANNEL_INFO *channel_set, +static int has_channel(struct rt_channel_info *channel_set, u8 chanset_size, u8 chan) { @@ -340,7 +340,7 @@ static int has_channel(struct RT_CHANNEL_INFO *channel_set, return 0; } -static void init_channel_list(struct adapter *padapter, struct RT_CHANNEL_INFO *channel_set, +static void init_channel_list(struct adapter *padapter, struct rt_channel_info *channel_set, u8 chanset_size, struct p2p_channels *channel_list) { @@ -392,13 +392,13 @@ static void init_channel_list(struct adapter *padapter, struct RT_CHANNEL_INFO * } -static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, struct RT_CHANNEL_INFO *channel_set) +static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, struct rt_channel_info *channel_set) { u8 index, chanset_size = 0; u8 b5GBand = false, b2_4GBand = false; u8 Index2G = 0, Index5G = 0; - memset(channel_set, 0, sizeof(struct RT_CHANNEL_INFO)*MAX_CHANNEL_NUM); + memset(channel_set, 0, sizeof(struct rt_channel_info)*MAX_CHANNEL_NUM); if (ChannelPlan >= RT_CHANNEL_DOMAIN_MAX && ChannelPlan != RT_CHANNEL_DOMAIN_REALTEK_DEFINE) { DBG_871X("ChannelPlan ID %x error !!!!!\n", ChannelPlan); @@ -4616,7 +4616,7 @@ static void process_80211d(struct adapter *padapter, struct wlan_bssid_ex *bssid { struct registry_priv *pregistrypriv; struct mlme_ext_priv *pmlmeext; - struct RT_CHANNEL_INFO *chplan_new; + struct rt_channel_info *chplan_new; u8 channel; u8 i; @@ -4629,8 +4629,8 @@ static void process_80211d(struct adapter *padapter, struct wlan_bssid_ex *bssid (!pmlmeext->update_channel_plan_by_ap_done)) { u8 *ie, *p; u32 len; - struct RT_CHANNEL_PLAN chplan_ap; - struct RT_CHANNEL_INFO chplan_sta[MAX_CHANNEL_NUM]; + struct rt_channel_plan chplan_ap; + struct rt_channel_info chplan_sta[MAX_CHANNEL_NUM]; u8 country[4]; u8 fcn; /* first channel number */ u8 noc; /* number of channel */ diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h index 0f4dd33b6e55..fb283dc04ee2 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h @@ -113,9 +113,9 @@ extern unsigned char WMM_PARA_OUI[]; /* We just add new channel plan when the new channel plan is different from any of the following */ /* channel plan. */ /* If you just wnat to customize the acitions(scan period or join actions) about one of the channel plan, */ -/* customize them in RT_CHANNEL_INFO in the RT_CHANNEL_LIST. */ +/* customize them in rt_channel_info in the RT_CHANNEL_LIST. */ /* */ -enum RT_CHANNEL_DOMAIN { +enum rt_channel_domain { /* old channel plan mapping ===== */ RT_CHANNEL_DOMAIN_FCC = 0x00, RT_CHANNEL_DOMAIN_IC = 0x01, @@ -183,7 +183,7 @@ enum RT_CHANNEL_DOMAIN { RT_CHANNEL_DOMAIN_REALTEK_DEFINE = 0x7F, }; -enum RT_CHANNEL_DOMAIN_2G { +enum rt_channel_domain_2g { RT_CHANNEL_DOMAIN_2G_WORLD = 0x00, /* Worldwird 13 */ RT_CHANNEL_DOMAIN_2G_ETSI1 = 0x01, /* Europe */ RT_CHANNEL_DOMAIN_2G_FCC1 = 0x02, /* US */ @@ -195,7 +195,7 @@ enum RT_CHANNEL_DOMAIN_2G { RT_CHANNEL_DOMAIN_2G_MAX, }; -enum RT_CHANNEL_DOMAIN_5G { +enum rt_channel_domain_5g { RT_CHANNEL_DOMAIN_5G_NULL = 0x00, RT_CHANNEL_DOMAIN_5G_ETSI1 = 0x01, /* Europe */ RT_CHANNEL_DOMAIN_5G_ETSI2 = 0x02, /* Australia, New Zealand */ @@ -238,22 +238,22 @@ enum RT_CHANNEL_DOMAIN_5G { #define rtw_is_channel_plan_valid(chplan) (chplan < RT_CHANNEL_DOMAIN_MAX || chplan == RT_CHANNEL_DOMAIN_REALTEK_DEFINE) -struct RT_CHANNEL_PLAN { +struct rt_channel_plan { unsigned char Channel[MAX_CHANNEL_NUM]; unsigned char Len; }; -struct RT_CHANNEL_PLAN_2G { +struct rt_channel_plan_2g { unsigned char Channel[MAX_CHANNEL_NUM_2G]; unsigned char Len; }; -struct RT_CHANNEL_PLAN_5G { +struct rt_channel_plan_5g { unsigned char Channel[MAX_CHANNEL_NUM_5G]; unsigned char Len; }; -struct RT_CHANNEL_PLAN_MAP { +struct rt_channel_plan_map { unsigned char Index2G; unsigned char Index5G; }; @@ -270,7 +270,7 @@ enum Associated_AP { maxAP, }; -enum HT_IOT_PEER_E { +enum ht_iot_peer_e { HT_IOT_PEER_UNKNOWN = 0, HT_IOT_PEER_REALTEK = 1, HT_IOT_PEER_REALTEK_92SE = 2, @@ -293,7 +293,7 @@ enum HT_IOT_PEER_E { }; -enum SCAN_STATE { +enum scan_state { SCAN_DISABLE = 0, SCAN_START = 1, SCAN_TXNULL = 2, @@ -417,12 +417,12 @@ struct mlme_ext_info { }; /* The channel information about this channel including joining, scanning, and power constraints. */ -struct RT_CHANNEL_INFO { +struct rt_channel_info { u8 ChannelNum; /* The channel number. */ enum rt_scan_type ScanType; /* Scan type such as passive or active scan. */ }; -int rtw_ch_set_search_ch(struct RT_CHANNEL_INFO *ch_set, const u32 ch); +int rtw_ch_set_search_ch(struct rt_channel_info *ch_set, const u32 ch); bool rtw_mlme_band_check(struct adapter *adapter, const u32 ch); /* P2P_MAX_REG_CLASSES - Maximum number of regulatory classes */ @@ -474,7 +474,7 @@ struct mlme_ext_priv { unsigned char cur_wireless_mode; /* NETWORK_TYPE */ unsigned char max_chan_nums; - struct RT_CHANNEL_INFO channel_set[MAX_CHANNEL_NUM]; + struct rt_channel_info channel_set[MAX_CHANNEL_NUM]; struct p2p_channels channel_list; unsigned char basicrate[NumRates]; unsigned char datarate[NumRates]; diff --git a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c index b3d87a971398..ee55893528b9 100644 --- a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c +++ b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c @@ -61,7 +61,7 @@ static void _rtw_reg_apply_flags(struct wiphy *wiphy) { struct adapter *padapter = wiphy_to_adapter(wiphy); struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct RT_CHANNEL_INFO *channel_set = pmlmeext->channel_set; + struct rt_channel_info *channel_set = pmlmeext->channel_set; u8 max_chan_nums = pmlmeext->max_chan_nums; struct ieee80211_supported_band *sband; -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:08 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:08 +0100 Subject: [PATCH 21/43] Staging: rtl8723bs: fix names in rtw_xmit.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-22-marcocesati@gmail.com> This commit converts names of structs / enums in include/rtw_xmit.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/rtw_xmit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_xmit.h b/drivers/staging/rtl8723bs/include/rtw_xmit.h index b482821c9af8..f7d6ac0ff865 100644 --- a/drivers/staging/rtl8723bs/include/rtw_xmit.h +++ b/drivers/staging/rtl8723bs/include/rtw_xmit.h @@ -83,7 +83,7 @@ do {\ #define TXDESC_OFFSET TXDESC_SIZE -enum TXDESC_SC { +enum txdesc_sc { SC_DONT_CARE = 0x00, SC_UPPER = 0x01, SC_LOWER = 0x02, -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:09 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:09 +0100 Subject: [PATCH 22/43] Staging: rtl8723bs: fix names in rtw_rf.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-23-marcocesati@gmail.com> This commit converts names of structs / enums in include/rtw_rf.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 8 ++++---- drivers/staging/rtl8723bs/hal/hal_intf.c | 2 +- .../staging/rtl8723bs/hal/rtl8723b_phycfg.c | 16 ++++++++-------- .../staging/rtl8723bs/hal/rtl8723b_rf6052.c | 2 +- .../staging/rtl8723bs/include/hal_com_phycfg.h | 6 +++--- drivers/staging/rtl8723bs/include/hal_data.h | 2 +- drivers/staging/rtl8723bs/include/hal_intf.h | 6 +++--- .../staging/rtl8723bs/include/hal_phy_cfg.h | 6 +++--- .../staging/rtl8723bs/include/rtl8723b_rf.h | 2 +- drivers/staging/rtl8723bs/include/rtw_rf.h | 18 +++++++++--------- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index b46db8909cb4..586e3ded447f 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -1039,7 +1039,7 @@ u8 PHY_GetTxPowerIndexBase( struct adapter *padapter, u8 RFPath, u8 Rate, - enum CHANNEL_WIDTH BandWidth, + enum channel_width BandWidth, u8 Channel, bool *bIn24G ) @@ -1556,7 +1556,7 @@ void PHY_SetTxPowerLevelByPath(struct adapter *Adapter, u8 channel, u8 path) void PHY_SetTxPowerIndexByRateArray( struct adapter *padapter, u8 RFPath, - enum CHANNEL_WIDTH BandWidth, + enum channel_width BandWidth, u8 Channel, u8 *Rates, u8 RateArraySize @@ -1610,7 +1610,7 @@ static s8 phy_GetChannelIndexOfTxPowerLimit(u8 Band, u8 Channel) return channelIndex; } -static s16 get_bandwidth_idx(const enum CHANNEL_WIDTH bandwidth) +static s16 get_bandwidth_idx(const enum channel_width bandwidth) { switch (bandwidth) { case CHANNEL_WIDTH_20: @@ -1673,7 +1673,7 @@ static s16 get_rate_sctn_idx(const u8 rate) } s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, - enum band_type band_type, enum CHANNEL_WIDTH bandwidth, + enum band_type band_type, enum channel_width bandwidth, u8 rf_path, u8 data_rate, u8 channel) { s16 idx_band = -1; diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c index 8554baef95b8..aa4356327636 100644 --- a/drivers/staging/rtl8723bs/hal/hal_intf.c +++ b/drivers/staging/rtl8723bs/hal/hal_intf.c @@ -342,7 +342,7 @@ void rtw_hal_set_chan(struct adapter *padapter, u8 channel) } void rtw_hal_set_chnl_bw(struct adapter *padapter, u8 channel, - enum CHANNEL_WIDTH Bandwidth, u8 Offset40, u8 Offset80) + enum channel_width Bandwidth, u8 Offset40, u8 Offset80) { if (padapter->HalFunc.set_chnl_bw_handler) padapter->HalFunc.set_chnl_bw_handler(padapter, channel, diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c index 9a41c185cf84..52cb58dc4e8d 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c @@ -559,7 +559,7 @@ u8 PHY_GetTxPowerIndex( struct adapter *padapter, u8 RFPath, u8 Rate, - enum CHANNEL_WIDTH BandWidth, + enum channel_width BandWidth, u8 Channel ) { @@ -616,7 +616,7 @@ void PHY_GetTxPowerLevel8723B(struct adapter *Adapter, s32 *powerlevel) } static void phy_SetRegBW_8723B( - struct adapter *Adapter, enum CHANNEL_WIDTH CurrentBW + struct adapter *Adapter, enum channel_width CurrentBW ) { u16 RegRfMod_BW, u2tmp = 0; @@ -806,16 +806,16 @@ static void PHY_HandleSwChnlAndSetBW8723B( bool bSwitchChannel, bool bSetBandWidth, u8 ChannelNum, - enum CHANNEL_WIDTH ChnlWidth, - enum EXTCHNL_OFFSET ExtChnlOffsetOf40MHz, - enum EXTCHNL_OFFSET ExtChnlOffsetOf80MHz, + enum channel_width ChnlWidth, + enum extchnl_offset ExtChnlOffsetOf40MHz, + enum extchnl_offset ExtChnlOffsetOf80MHz, u8 CenterFrequencyIndex1 ) { /* static bool bInitialzed = false; */ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); u8 tmpChannel = pHalData->CurrentChannel; - enum CHANNEL_WIDTH tmpBW = pHalData->CurrentChannelBW; + enum channel_width tmpBW = pHalData->CurrentChannelBW; u8 tmpnCur40MhzPrimeSC = pHalData->nCur40MhzPrimeSC; u8 tmpnCur80MhzPrimeSC = pHalData->nCur80MhzPrimeSC; u8 tmpCenterFrequencyIndex1 = pHalData->CurrentCenterFrequencyIndex1; @@ -874,7 +874,7 @@ static void PHY_HandleSwChnlAndSetBW8723B( void PHY_SetBWMode8723B( struct adapter *Adapter, - enum CHANNEL_WIDTH Bandwidth, /* 20M or 40M */ + enum channel_width Bandwidth, /* 20M or 40M */ unsigned char Offset /* Upper, Lower, or Don't care */ ) { @@ -892,7 +892,7 @@ void PHY_SwChnl8723B(struct adapter *Adapter, u8 channel) void PHY_SetSwChnlBWMode8723B( struct adapter *Adapter, u8 channel, - enum CHANNEL_WIDTH Bandwidth, + enum channel_width Bandwidth, u8 Offset40, u8 Offset80 ) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c b/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c index aafceaf9b139..73b47f053549 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c @@ -55,7 +55,7 @@ * Note: For RF type 0222D *---------------------------------------------------------------------------*/ void PHY_RF6052SetBandwidth8723B( - struct adapter *Adapter, enum CHANNEL_WIDTH Bandwidth + struct adapter *Adapter, enum channel_width Bandwidth ) /* 20M or 40M */ { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); diff --git a/drivers/staging/rtl8723bs/include/hal_com_phycfg.h b/drivers/staging/rtl8723bs/include/hal_com_phycfg.h index 32fd050428db..979b621f4baa 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_phycfg.h +++ b/drivers/staging/rtl8723bs/include/hal_com_phycfg.h @@ -140,7 +140,7 @@ void PHY_SetTxPowerIndexByRateArray( struct adapter *padapter, u8 RFPath, -enum CHANNEL_WIDTH BandWidth, +enum channel_width BandWidth, u8 Channel, u8 *Rates, u8 RateArraySize @@ -172,13 +172,13 @@ PHY_GetTxPowerIndexBase( struct adapter *padapter, u8 RFPath, u8 Rate, -enum CHANNEL_WIDTH BandWidth, +enum channel_width BandWidth, u8 Channel, bool *bIn24G ); s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 RegPwrTblSel, - enum band_type Band, enum CHANNEL_WIDTH Bandwidth, + enum band_type Band, enum channel_width Bandwidth, u8 RfPath, u8 DataRate, u8 Channel diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h index d731cec8ab81..83a538e5120b 100644 --- a/drivers/staging/rtl8723bs/include/hal_data.h +++ b/drivers/staging/rtl8723bs/include/hal_data.h @@ -188,7 +188,7 @@ struct hal_com_data { /* current WIFI_PHY values */ enum wireless_mode CurrentWirelessMode; - enum CHANNEL_WIDTH CurrentChannelBW; + enum channel_width CurrentChannelBW; enum band_type CurrentBandType; /* 0:2.4G, 1:5G */ enum band_type BandSet; u8 CurrentChannel; diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h index f3be4eaa9685..bfbf5fd07711 100644 --- a/drivers/staging/rtl8723bs/include/hal_intf.h +++ b/drivers/staging/rtl8723bs/include/hal_intf.h @@ -197,9 +197,9 @@ struct hal_ops { u8 (*check_ips_status)(struct adapter *padapter); s32 (*interrupt_handler)(struct adapter *padapter); void (*clear_interrupt)(struct adapter *padapter); - void (*set_bwmode_handler)(struct adapter *padapter, enum CHANNEL_WIDTH Bandwidth, u8 Offset); + void (*set_bwmode_handler)(struct adapter *padapter, enum channel_width Bandwidth, u8 Offset); void (*set_channel_handler)(struct adapter *padapter, u8 channel); - void (*set_chnl_bw_handler)(struct adapter *padapter, u8 channel, enum CHANNEL_WIDTH Bandwidth, u8 Offset40, u8 Offset80); + void (*set_chnl_bw_handler)(struct adapter *padapter, u8 channel, enum channel_width Bandwidth, u8 Offset40, u8 Offset80); void (*set_tx_power_level_handler)(struct adapter *padapter, u8 channel); void (*get_tx_power_level_handler)(struct adapter *padapter, s32 *powerlevel); @@ -373,7 +373,7 @@ void rtw_hal_write_rfreg(struct adapter *padapter, u32 eRFPath, u32 RegAddr, u32 #define PHY_QueryMacReg PHY_QueryBBReg void rtw_hal_set_chan(struct adapter *padapter, u8 channel); -void rtw_hal_set_chnl_bw(struct adapter *padapter, u8 channel, enum CHANNEL_WIDTH Bandwidth, u8 Offset40, u8 Offset80); +void rtw_hal_set_chnl_bw(struct adapter *padapter, u8 channel, enum channel_width Bandwidth, u8 Offset40, u8 Offset80); void rtw_hal_dm_watchdog(struct adapter *padapter); void rtw_hal_dm_watchdog_in_lps(struct adapter *padapter); diff --git a/drivers/staging/rtl8723bs/include/hal_phy_cfg.h b/drivers/staging/rtl8723bs/include/hal_phy_cfg.h index ed3488a09d79..ea494bcf830b 100644 --- a/drivers/staging/rtl8723bs/include/hal_phy_cfg.h +++ b/drivers/staging/rtl8723bs/include/hal_phy_cfg.h @@ -47,20 +47,20 @@ void PHY_SetTxPowerIndex(struct adapter *Adapter, u32 PowerIndex, u8 RFPath, u8 Rate); u8 PHY_GetTxPowerIndex(struct adapter *padapter, u8 RFPath, u8 Rate, - enum CHANNEL_WIDTH BandWidth, u8 Channel); + enum channel_width BandWidth, u8 Channel); void PHY_GetTxPowerLevel8723B(struct adapter *Adapter, s32 *powerlevel); void PHY_SetTxPowerLevel8723B(struct adapter *Adapter, u8 channel); -void PHY_SetBWMode8723B(struct adapter *Adapter, enum CHANNEL_WIDTH Bandwidth, +void PHY_SetBWMode8723B(struct adapter *Adapter, enum channel_width Bandwidth, unsigned char Offset); /* Call after initialization */ void PHY_SwChnl8723B(struct adapter *Adapter, u8 channel); void PHY_SetSwChnlBWMode8723B(struct adapter *Adapter, u8 channel, - enum CHANNEL_WIDTH Bandwidth, + enum channel_width Bandwidth, u8 Offset40, u8 Offset80); /*--------------------------Exported Function prototype End---------------------*/ diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_rf.h b/drivers/staging/rtl8723bs/include/rtl8723b_rf.h index d712c6d36a08..525eb2facca0 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_rf.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_rf.h @@ -12,6 +12,6 @@ int PHY_RF6052_Config8723B(struct adapter *Adapter); void PHY_RF6052SetBandwidth8723B(struct adapter *Adapter, - enum CHANNEL_WIDTH Bandwidth); + enum channel_width Bandwidth); #endif diff --git a/drivers/staging/rtl8723bs/include/rtw_rf.h b/drivers/staging/rtl8723bs/include/rtw_rf.h index d3a8e4b7069a..a8ddd6fe5f95 100644 --- a/drivers/staging/rtl8723bs/include/rtw_rf.h +++ b/drivers/staging/rtl8723bs/include/rtw_rf.h @@ -49,7 +49,7 @@ struct regulatory_class { u8 modem; }; -enum CAPABILITY { +enum capability { cESS = 0x0001, cIBSS = 0x0002, cPollable = 0x0004, @@ -68,13 +68,13 @@ enum CAPABILITY { cImmediateBA = 0x8000, }; -enum _REG_PREAMBLE_MODE { +enum _reg_preamble_mode { PREAMBLE_LONG = 1, PREAMBLE_AUTO = 2, PREAMBLE_SHORT = 3, }; -enum _RTL8712_RF_MIMO_CONFIG_ { +enum _rtl8712_rf_mimo_config_ { RTL8712_RFCONFIG_1T = 0x10, RTL8712_RFCONFIG_2T = 0x20, RTL8712_RFCONFIG_1R = 0x01, @@ -85,7 +85,7 @@ enum _RTL8712_RF_MIMO_CONFIG_ { RTL8712_RFCONFIG_2T2R = 0x22 }; -enum RF90_RADIO_PATH { +enum rf90_radio_path { RF90_PATH_A = 0, /* Radio Path A */ RF90_PATH_B = 1, /* Radio Path B */ RF90_PATH_C = 2, /* Radio Path C */ @@ -98,7 +98,7 @@ enum RF90_RADIO_PATH { #define HAL_PRIME_CHNL_OFFSET_UPPER 2 /* Represent Channel Width in HT Capabilities */ -enum CHANNEL_WIDTH { +enum channel_width { CHANNEL_WIDTH_20 = 0, CHANNEL_WIDTH_40 = 1, CHANNEL_WIDTH_80 = 2, @@ -109,14 +109,14 @@ enum CHANNEL_WIDTH { /* Represent Extension Channel Offset in HT Capabilities */ /* This is available only in 40Mhz mode. */ -enum EXTCHNL_OFFSET { +enum extchnl_offset { EXTCHNL_OFFSET_NO_EXT = 0, EXTCHNL_OFFSET_UPPER = 1, EXTCHNL_OFFSET_NO_DEF = 2, EXTCHNL_OFFSET_LOWER = 3, }; -enum VHT_DATA_SC { +enum vht_data_sc { VHT_DATA_SC_DONOT_CARE = 0, VHT_DATA_SC_20_UPPER_OF_80MHZ = 1, VHT_DATA_SC_20_LOWER_OF_80MHZ = 2, @@ -130,14 +130,14 @@ enum VHT_DATA_SC { VHT_DATA_SC_40_LOWER_OF_80MHZ = 10, }; -enum PROTECTION_MODE { +enum protection_mode { PROTECTION_MODE_AUTO = 0, PROTECTION_MODE_FORCE_ENABLE = 1, PROTECTION_MODE_FORCE_DISABLE = 2, }; /* 2007/11/15 MH Define different RF type. */ -enum RT_RF_TYPE_DEFINITION { +enum rt_rf_type_definition { RF_1T2R = 0, RF_2T4R = 1, RF_2T2R = 2, -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:10 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:10 +0100 Subject: [PATCH 23/43] Staging: rtl8723bs: fix names in HalPwrSeqCmd.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-24-marcocesati@gmail.com> This commit converts names of structs / enums in include/HalPwrSeqCmd.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c | 4 ++-- drivers/staging/rtl8723bs/hal/hal_pwr_seq.c | 22 +++++++++---------- .../staging/rtl8723bs/include/HalPwrSeqCmd.h | 6 ++--- .../staging/rtl8723bs/include/hal_pwr_seq.h | 22 +++++++++---------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c b/drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c index c1c9914d9b49..932b31fda6ad 100644 --- a/drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c +++ b/drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c @@ -39,10 +39,10 @@ u8 HalPwrSeqCmdParsing( u8 CutVersion, u8 FabVersion, u8 InterfaceType, - struct WLAN_PWR_CFG PwrSeqCmd[] + struct wlan_pwr_cfg PwrSeqCmd[] ) { - struct WLAN_PWR_CFG PwrCfgCmd; + struct wlan_pwr_cfg PwrCfgCmd; u8 bPollingBit = false; u32 AryIdx = 0; u8 value = 0; diff --git a/drivers/staging/rtl8723bs/hal/hal_pwr_seq.c b/drivers/staging/rtl8723bs/hal/hal_pwr_seq.c index 2a80da26f572..fba67a7c069c 100644 --- a/drivers/staging/rtl8723bs/hal/hal_pwr_seq.c +++ b/drivers/staging/rtl8723bs/hal/hal_pwr_seq.c @@ -21,7 +21,7 @@ Major Change History: /* drivers should parse below arrays and do the corresponding actions */ /* 3 Power on Array */ -struct WLAN_PWR_CFG rtl8723B_power_on_flow[ +struct wlan_pwr_cfg rtl8723B_power_on_flow[ RTL8723B_TRANS_CARDEMU_TO_ACT_STEPS+ RTL8723B_TRANS_END_STEPS ] = { @@ -30,7 +30,7 @@ struct WLAN_PWR_CFG rtl8723B_power_on_flow[ }; /* 3Radio off GPIO Array */ -struct WLAN_PWR_CFG rtl8723B_radio_off_flow[ +struct wlan_pwr_cfg rtl8723B_radio_off_flow[ RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+ RTL8723B_TRANS_END_STEPS ] = { @@ -39,7 +39,7 @@ struct WLAN_PWR_CFG rtl8723B_radio_off_flow[ }; /* 3Card Disable Array */ -struct WLAN_PWR_CFG rtl8723B_card_disable_flow[ +struct wlan_pwr_cfg rtl8723B_card_disable_flow[ RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+ RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+ RTL8723B_TRANS_END_STEPS @@ -50,7 +50,7 @@ struct WLAN_PWR_CFG rtl8723B_card_disable_flow[ }; /* 3 Card Enable Array */ -struct WLAN_PWR_CFG rtl8723B_card_enable_flow[ +struct wlan_pwr_cfg rtl8723B_card_enable_flow[ RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+ RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+ RTL8723B_TRANS_END_STEPS @@ -61,7 +61,7 @@ struct WLAN_PWR_CFG rtl8723B_card_enable_flow[ }; /* 3Suspend Array */ -struct WLAN_PWR_CFG rtl8723B_suspend_flow[ +struct wlan_pwr_cfg rtl8723B_suspend_flow[ RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+ RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+ RTL8723B_TRANS_END_STEPS @@ -72,7 +72,7 @@ struct WLAN_PWR_CFG rtl8723B_suspend_flow[ }; /* 3 Resume Array */ -struct WLAN_PWR_CFG rtl8723B_resume_flow[ +struct wlan_pwr_cfg rtl8723B_resume_flow[ RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+ RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+ RTL8723B_TRANS_END_STEPS @@ -83,7 +83,7 @@ struct WLAN_PWR_CFG rtl8723B_resume_flow[ }; /* 3HWPDN Array */ -struct WLAN_PWR_CFG rtl8723B_hwpdn_flow[ +struct wlan_pwr_cfg rtl8723B_hwpdn_flow[ RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+ RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+ RTL8723B_TRANS_END_STEPS @@ -94,7 +94,7 @@ struct WLAN_PWR_CFG rtl8723B_hwpdn_flow[ }; /* 3 Enter LPS */ -struct WLAN_PWR_CFG rtl8723B_enter_lps_flow[ +struct wlan_pwr_cfg rtl8723B_enter_lps_flow[ RTL8723B_TRANS_ACT_TO_LPS_STEPS+RTL8723B_TRANS_END_STEPS ] = { /* FW behavior */ @@ -103,7 +103,7 @@ struct WLAN_PWR_CFG rtl8723B_enter_lps_flow[ }; /* 3 Leave LPS */ -struct WLAN_PWR_CFG rtl8723B_leave_lps_flow[ +struct wlan_pwr_cfg rtl8723B_leave_lps_flow[ RTL8723B_TRANS_LPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS ] = { /* FW behavior */ @@ -112,7 +112,7 @@ struct WLAN_PWR_CFG rtl8723B_leave_lps_flow[ }; /* 3 Enter SW LPS */ -struct WLAN_PWR_CFG rtl8723B_enter_swlps_flow[ +struct wlan_pwr_cfg rtl8723B_enter_swlps_flow[ RTL8723B_TRANS_ACT_TO_SWLPS_STEPS+RTL8723B_TRANS_END_STEPS ] = { /* SW behavior */ @@ -121,7 +121,7 @@ struct WLAN_PWR_CFG rtl8723B_enter_swlps_flow[ }; /* 3 Leave SW LPS */ -struct WLAN_PWR_CFG rtl8723B_leave_swlps_flow[ +struct wlan_pwr_cfg rtl8723B_leave_swlps_flow[ RTL8723B_TRANS_SWLPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS ] = { /* SW behavior */ diff --git a/drivers/staging/rtl8723bs/include/HalPwrSeqCmd.h b/drivers/staging/rtl8723bs/include/HalPwrSeqCmd.h index 7e8c2e511d0b..ba9b033685ec 100644 --- a/drivers/staging/rtl8723bs/include/HalPwrSeqCmd.h +++ b/drivers/staging/rtl8723bs/include/HalPwrSeqCmd.h @@ -82,12 +82,12 @@ #define PWR_CUT_ALL_MSK 0xFF -enum PWRSEQ_CMD_DELAY_UNIT { +enum pwrseq_cmd_delay_unit { PWRSEQ_DELAY_US, PWRSEQ_DELAY_MS, }; -struct WLAN_PWR_CFG { +struct wlan_pwr_cfg { u16 offset; u8 cut_msk; u8 fab_msk:4; @@ -117,6 +117,6 @@ u8 HalPwrSeqCmdParsing( u8 CutVersion, u8 FabVersion, u8 InterfaceType, - struct WLAN_PWR_CFG PwrCfgCmd[]); + struct wlan_pwr_cfg PwrCfgCmd[]); #endif diff --git a/drivers/staging/rtl8723bs/include/hal_pwr_seq.h b/drivers/staging/rtl8723bs/include/hal_pwr_seq.h index 7c5fbf0b9736..0837506b6be8 100644 --- a/drivers/staging/rtl8723bs/include/hal_pwr_seq.h +++ b/drivers/staging/rtl8723bs/include/hal_pwr_seq.h @@ -219,15 +219,15 @@ {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, 0, PWR_CMD_END, 0, 0}, -extern struct WLAN_PWR_CFG rtl8723B_power_on_flow[RTL8723B_TRANS_CARDEMU_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS]; -extern struct WLAN_PWR_CFG rtl8723B_radio_off_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_END_STEPS]; -extern struct WLAN_PWR_CFG rtl8723B_card_disable_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS]; -extern struct WLAN_PWR_CFG rtl8723B_card_enable_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS]; -extern struct WLAN_PWR_CFG rtl8723B_suspend_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723B_TRANS_END_STEPS]; -extern struct WLAN_PWR_CFG rtl8723B_resume_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723B_TRANS_END_STEPS]; -extern struct WLAN_PWR_CFG rtl8723B_hwpdn_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS]; -extern struct WLAN_PWR_CFG rtl8723B_enter_lps_flow[RTL8723B_TRANS_ACT_TO_LPS_STEPS+RTL8723B_TRANS_END_STEPS]; -extern struct WLAN_PWR_CFG rtl8723B_leave_lps_flow[RTL8723B_TRANS_LPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS]; -extern struct WLAN_PWR_CFG rtl8723B_enter_swlps_flow[RTL8723B_TRANS_ACT_TO_SWLPS_STEPS+RTL8723B_TRANS_END_STEPS]; -extern struct WLAN_PWR_CFG rtl8723B_leave_swlps_flow[RTL8723B_TRANS_SWLPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct wlan_pwr_cfg rtl8723B_power_on_flow[RTL8723B_TRANS_CARDEMU_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct wlan_pwr_cfg rtl8723B_radio_off_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct wlan_pwr_cfg rtl8723B_card_disable_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct wlan_pwr_cfg rtl8723B_card_enable_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct wlan_pwr_cfg rtl8723B_suspend_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct wlan_pwr_cfg rtl8723B_resume_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct wlan_pwr_cfg rtl8723B_hwpdn_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct wlan_pwr_cfg rtl8723B_enter_lps_flow[RTL8723B_TRANS_ACT_TO_LPS_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct wlan_pwr_cfg rtl8723B_leave_lps_flow[RTL8723B_TRANS_LPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct wlan_pwr_cfg rtl8723B_enter_swlps_flow[RTL8723B_TRANS_ACT_TO_SWLPS_STEPS+RTL8723B_TRANS_END_STEPS]; +extern struct wlan_pwr_cfg rtl8723B_leave_swlps_flow[RTL8723B_TRANS_SWLPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS]; #endif -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:11 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:11 +0100 Subject: [PATCH 24/43] Staging: rtl8723bs: fix names in hal_com_phycfg.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-25-marcocesati@gmail.com> This commit converts names of structs / enums in include/hal_com_phycfg.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 4 ++-- drivers/staging/rtl8723bs/include/hal_com_phycfg.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 586e3ded447f..67db3c60b518 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -12,7 +12,7 @@ #include u8 PHY_GetTxPowerByRateBase(struct adapter *Adapter, u8 Band, u8 RfPath, - u8 TxNum, enum RATE_SECTION RateSection) + u8 TxNum, enum rate_section RateSection) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); u8 value = 0; @@ -104,7 +104,7 @@ phy_SetTxPowerByRateBase( struct adapter *Adapter, u8 Band, u8 RfPath, - enum RATE_SECTION RateSection, + enum rate_section RateSection, u8 TxNum, u8 Value ) diff --git a/drivers/staging/rtl8723bs/include/hal_com_phycfg.h b/drivers/staging/rtl8723bs/include/hal_com_phycfg.h index 979b621f4baa..51eef4d5c861 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_phycfg.h +++ b/drivers/staging/rtl8723bs/include/hal_com_phycfg.h @@ -12,7 +12,7 @@ #define PathC 0x2 #define PathD 0x3 -enum RATE_SECTION { +enum rate_section { CCK = 0, OFDM, HT_MCS0_MCS7, @@ -25,7 +25,7 @@ enum RATE_SECTION { VHT_4SSMCS0_4SSMCS9, }; -enum RF_TX_NUM { +enum rf_tx_num { RF_1TX = 0, RF_2TX, RF_3TX, @@ -36,7 +36,7 @@ enum RF_TX_NUM { #define MAX_POWER_INDEX 0x3F -enum _REGULATION_TXPWR_LMT { +enum _regulation_txpwr_lmt { TXPWR_LMT_FCC = 0, TXPWR_LMT_MKK, TXPWR_LMT_ETSI, @@ -76,7 +76,7 @@ struct adapter *Adapter, u8 Band, u8 RfPath, u8 TxNum, -enum RATE_SECTION RateSection +enum rate_section RateSection ); u8 -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:13 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:13 +0100 Subject: [PATCH 26/43] Staging: rtl8723bs: fix names in hal_data.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-27-marcocesati@gmail.com> This commit converts names of structs / enums in include/hal_data.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/hal_data.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h index 83a538e5120b..89943217fb42 100644 --- a/drivers/staging/rtl8723bs/include/hal_data.h +++ b/drivers/staging/rtl8723bs/include/hal_data.h @@ -15,7 +15,7 @@ /* */ /* For RTL8723 WiFi/BT/GPS multi-function configuration. 2010.10.06. */ /* */ -enum RT_MULTI_FUNC { +enum rt_multi_func { RT_MULTI_FUNC_NONE = 0x00, RT_MULTI_FUNC_WIFI = 0x01, RT_MULTI_FUNC_BT = 0x02, @@ -24,18 +24,18 @@ enum RT_MULTI_FUNC { /* */ /* For RTL8723 WiFi PDn/GPIO polarity control configuration. 2010.10.08. */ /* */ -enum RT_POLARITY_CTL { +enum rt_polarity_ctl { RT_POLARITY_LOW_ACT = 0, RT_POLARITY_HIGH_ACT = 1, }; /* For RTL8723 regulator mode. by tynli. 2011.01.14. */ -enum RT_REGULATOR_MODE { +enum rt_regulator_mode { RT_SWITCHING_REGULATOR = 0, RT_LDO_REGULATOR = 1, }; -enum RT_AMPDU_BURST { +enum rt_ampdu_burst { RT_AMPDU_BURST_NONE = 0, RT_AMPDU_BURST_92D = 1, RT_AMPDU_BURST_88E = 2, @@ -177,9 +177,9 @@ struct dm_priv { struct hal_com_data { struct hal_version VersionID; - enum RT_MULTI_FUNC MultiFunc; /* For multi-function consideration. */ - enum RT_POLARITY_CTL PolarityCtl; /* For Wifi PDn Polarity control. */ - enum RT_REGULATOR_MODE RegulatorMode; /* switching regulator or LDO */ + enum rt_multi_func MultiFunc; /* For multi-function consideration. */ + enum rt_polarity_ctl PolarityCtl; /* For Wifi PDn Polarity control. */ + enum rt_regulator_mode RegulatorMode; /* switching regulator or LDO */ u16 FirmwareVersion; u16 FirmwareVersionRev; @@ -411,7 +411,7 @@ struct hal_com_data { u8 RegIQKFWOffload; struct submit_ctx iqk_sctx; - enum RT_AMPDU_BURST AMPDUBurstMode; /* 92C maybe not use, but for compile successfully */ + enum rt_ampdu_burst AMPDUBurstMode; /* 92C maybe not use, but for compile successfully */ u32 sdio_himr; u32 sdio_hisr; -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:12 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:12 +0100 Subject: [PATCH 25/43] Staging: rtl8723bs: fix names in sta_info.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-26-marcocesati@gmail.com> This commit converts names of structs / enums in include/sta_info.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/sta_info.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/sta_info.h b/drivers/staging/rtl8723bs/include/sta_info.h index 33e6e00c126d..abde3e3df988 100644 --- a/drivers/staging/rtl8723bs/include/sta_info.h +++ b/drivers/staging/rtl8723bs/include/sta_info.h @@ -31,7 +31,7 @@ struct wlan_acl_pool { struct __queue acl_node_q; }; -struct RSSI_STA { +struct rssi_sta { s32 UndecoratedSmoothedPWDB; s32 UndecoratedSmoothedCCK; s32 UndecoratedSmoothedOFDM; @@ -186,7 +186,7 @@ struct sta_info { u32 assoc_req_len; /* for DM */ - struct RSSI_STA rssi_stat; + struct rssi_sta rssi_stat; /* ODM_STA_INFO_T */ /* ================ODM Relative Info ======================= */ -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:14 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:14 +0100 Subject: [PATCH 27/43] Staging: rtl8723bs: fix names in ieee80211.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-28-marcocesati@gmail.com> This commit converts names of structs / enums in include/ieee80211.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/ieee80211.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h index 1c671b778c57..a7cbd04059f8 100644 --- a/drivers/staging/rtl8723bs/include/ieee80211.h +++ b/drivers/staging/rtl8723bs/include/ieee80211.h @@ -125,7 +125,7 @@ extern u8 RSN_CIPHER_SUITE_CCMP[]; extern u8 RSN_CIPHER_SUITE_WEP104[]; -enum RATEID_IDX { +enum rateid_idx { RATEID_IDX_BGN_40M_2SS = 0, RATEID_IDX_BGN_40M_1SS = 1, RATEID_IDX_BGN_20M_2SS_BN = 2, @@ -139,7 +139,7 @@ enum RATEID_IDX { RATEID_IDX_VHT_1SS = 10, }; -enum RATR_TABLE_MODE { +enum ratr_table_mode { RATR_INX_WIRELESS_NGB = 0, /* BGN 40 Mhz 2SS 1SS */ RATR_INX_WIRELESS_NG = 1, /* GN or N */ RATR_INX_WIRELESS_NB = 2, /* BGN 20 Mhz 2SS 1SS or BN */ @@ -152,7 +152,7 @@ enum RATR_TABLE_MODE { }; -enum NETWORK_TYPE { +enum network_type { WIRELESS_INVALID = 0, /* Sub-Element */ WIRELESS_11B = BIT(0), /* tx: cck only , rx: cck only, hw: cck */ @@ -423,7 +423,7 @@ struct ieee80211_snap_hdr { #define IEEE80211_OFDM_SHIFT_MASK_A 4 -enum MGN_RATE { +enum mgn_rate { MGN_1M = 0x02, MGN_2M = 0x04, MGN_5_5M = 0x0B, @@ -799,7 +799,7 @@ enum rtw_ieee80211_category { RTW_WLAN_CATEGORY_P2P = 0x7f,/* P2P action frames */ }; -enum _PUBLIC_ACTION { +enum _public_action { ACT_PUBLIC_BSSCOEXIST = 0, /* 20/40 BSS Coexistence */ ACT_PUBLIC_DSE_ENABLE = 1, ACT_PUBLIC_DSE_DEENABLE = 2, -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:15 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:15 +0100 Subject: [PATCH 28/43] Staging: rtl8723bs: fix names in rtw_efuse.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-29-marcocesati@gmail.com> This commit converts names of structs / enums in include/rtw_efuse.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 28 +++++++++---------- drivers/staging/rtl8723bs/include/hal_data.h | 2 +- drivers/staging/rtl8723bs/include/rtw_efuse.h | 6 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index f33b084011b5..e0b5a608ec97 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -575,7 +575,7 @@ static u8 hal_EfuseSwitchToBank( u32 value32 = 0; #ifdef HAL_EFUSE_MEMORY struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct EFUSE_HAL *pEfuseHal = &pHalData->EfuseHal; + struct efuse_hal *pEfuseHal = &pHalData->EfuseHal; #endif @@ -856,7 +856,7 @@ static void hal_ReadEFuse_WiFi( { #ifdef HAL_EFUSE_MEMORY struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct EFUSE_HAL *pEfuseHal = &pHalData->EfuseHal; + struct efuse_hal *pEfuseHal = &pHalData->EfuseHal; #endif u8 *efuseTbl = NULL; u16 eFuse_Addr = 0; @@ -995,7 +995,7 @@ static void hal_ReadEFuse_BT( { #ifdef HAL_EFUSE_MEMORY struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct EFUSE_HAL *pEfuseHal = &pHalData->EfuseHal; + struct efuse_hal *pEfuseHal = &pHalData->EfuseHal; #endif u8 *efuseTbl; u8 bank; @@ -1138,7 +1138,7 @@ static u16 hal_EfuseGetCurrentSize_WiFi( { #ifdef HAL_EFUSE_MEMORY struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct EFUSE_HAL *pEfuseHal = &pHalData->EfuseHal; + struct efuse_hal *pEfuseHal = &pHalData->EfuseHal; #endif u16 efuse_addr = 0; u16 start_addr = 0; /* for debug */ @@ -1236,7 +1236,7 @@ static u16 hal_EfuseGetCurrentSize_BT(struct adapter *padapter, u8 bPseudoTest) { #ifdef HAL_EFUSE_MEMORY struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct EFUSE_HAL *pEfuseHal = &pHalData->EfuseHal; + struct efuse_hal *pEfuseHal = &pHalData->EfuseHal; #endif u16 btusedbytes; u16 efuse_addr; @@ -1541,7 +1541,7 @@ static void hal_EfuseConstructPGPkt( u8 offset, u8 word_en, u8 *pData, - struct PGPKT_STRUCT *pTargetPkt + struct pgpkt_struct *pTargetPkt ) { memset(pTargetPkt->data, 0xFF, PGPKT_DATA_SIZE); @@ -1555,12 +1555,12 @@ static u8 hal_EfusePartialWriteCheck( struct adapter *padapter, u8 efuseType, u16 *pAddr, - struct PGPKT_STRUCT *pTargetPkt, + struct pgpkt_struct *pTargetPkt, u8 bPseudoTest ) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct EFUSE_HAL *pEfuseHal = &pHalData->EfuseHal; + struct efuse_hal *pEfuseHal = &pHalData->EfuseHal; u8 bRet = false; u16 startAddr = 0, efuse_max_available_len = 0, efuse_max = 0; u8 efuse_data = 0; @@ -1673,7 +1673,7 @@ static u8 hal_EfusePgPacketWrite1ByteHeader( struct adapter *padapter, u8 efuseType, u16 *pAddr, - struct PGPKT_STRUCT *pTargetPkt, + struct pgpkt_struct *pTargetPkt, u8 bPseudoTest ) { @@ -1710,7 +1710,7 @@ static u8 hal_EfusePgPacketWrite2ByteHeader( struct adapter *padapter, u8 efuseType, u16 *pAddr, - struct PGPKT_STRUCT *pTargetPkt, + struct pgpkt_struct *pTargetPkt, u8 bPseudoTest ) { @@ -1777,7 +1777,7 @@ static u8 hal_EfusePgPacketWriteHeader( struct adapter *padapter, u8 efuseType, u16 *pAddr, - struct PGPKT_STRUCT *pTargetPkt, + struct pgpkt_struct *pTargetPkt, u8 bPseudoTest ) { @@ -1795,7 +1795,7 @@ static u8 hal_EfusePgPacketWriteData( struct adapter *padapter, u8 efuseType, u16 *pAddr, - struct PGPKT_STRUCT *pTargetPkt, + struct pgpkt_struct *pTargetPkt, u8 bPseudoTest ) { @@ -1822,7 +1822,7 @@ static s32 Hal_EfusePgPacketWrite( bool bPseudoTest ) { - struct PGPKT_STRUCT targetPkt; + struct pgpkt_struct targetPkt; u16 startAddr = 0; u8 efuseType = EFUSE_WIFI; @@ -1851,7 +1851,7 @@ static bool Hal_EfusePgPacketWrite_BT( bool bPseudoTest ) { - struct PGPKT_STRUCT targetPkt; + struct pgpkt_struct targetPkt; u16 startAddr = 0; u8 efuseType = EFUSE_BT; diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h index 89943217fb42..6a0c5626e19f 100644 --- a/drivers/staging/rtl8723bs/include/hal_data.h +++ b/drivers/staging/rtl8723bs/include/hal_data.h @@ -233,7 +233,7 @@ struct hal_com_data { bool EepromOrEfuse; u8 EfuseUsedPercentage; u16 EfuseUsedBytes; - struct EFUSE_HAL EfuseHal; + struct efuse_hal EfuseHal; /* 3 [2.4G] */ u8 Index24G_CCK_Base[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; diff --git a/drivers/staging/rtl8723bs/include/rtw_efuse.h b/drivers/staging/rtl8723bs/include/rtw_efuse.h index 3c6673910574..5bae46ecd9de 100644 --- a/drivers/staging/rtl8723bs/include/rtw_efuse.h +++ b/drivers/staging/rtl8723bs/include/rtw_efuse.h @@ -25,7 +25,7 @@ #define EFUSE_WIFI 0 #define EFUSE_BT 1 -enum _EFUSE_DEF_TYPE { +enum _efuse_def_type { TYPE_EFUSE_MAX_SECTION = 0, TYPE_EFUSE_REAL_CONTENT_LEN = 1, TYPE_AVAILABLE_EFUSE_BYTES_BANK = 2, @@ -57,7 +57,7 @@ enum _EFUSE_DEF_TYPE { #define EFUSE_MAX_WORD_UNIT 4 /*------------------------------Define structure----------------------------*/ -struct PGPKT_STRUCT { +struct pgpkt_struct { u8 offset; u8 word_en; u8 data[8]; @@ -65,7 +65,7 @@ struct PGPKT_STRUCT { }; /*------------------------------Define structure----------------------------*/ -struct EFUSE_HAL { +struct efuse_hal { u8 fakeEfuseBank; u32 fakeEfuseUsedBytes; u8 fakeEfuseContent[EFUSE_MAX_HW_SIZE]; -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:16 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:16 +0100 Subject: [PATCH 29/43] Staging: rtl8723bs: fix names in hal_btcoex.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-30-marcocesati@gmail.com> This commit converts names of structs / enums in include/hal_btcoex.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/include/hal_btcoex.h | 2 +- drivers/staging/rtl8723bs/include/hal_data.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/hal_btcoex.h b/drivers/staging/rtl8723bs/include/hal_btcoex.h index fb8bc2cf083b..3c03be210d87 100644 --- a/drivers/staging/rtl8723bs/include/hal_btcoex.h +++ b/drivers/staging/rtl8723bs/include/hal_btcoex.h @@ -11,7 +11,7 @@ /* Some variables can't get from outsrc BT-Coex, */ /* so we need to save here */ -struct BT_COEXIST { +struct bt_coexist { u8 bBtExist; u8 btTotalAntNum; u8 btChipType; diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h index 6a0c5626e19f..9512da2a7e95 100644 --- a/drivers/staging/rtl8723bs/include/hal_data.h +++ b/drivers/staging/rtl8723bs/include/hal_data.h @@ -434,7 +434,7 @@ struct hal_com_data { struct DM_ODM_T odmpriv; /* For bluetooth co-existance */ - struct BT_COEXIST bt_coexist; + struct bt_coexist bt_coexist; /* Interrupt related register information. */ u32 SysIntrStatus; -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:17 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:17 +0100 Subject: [PATCH 30/43] Staging: rtl8723bs: fix names in odm_interface.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-31-marcocesati@gmail.com> This commit converts names of structs / enums in hal/odm_interface.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_interface.h b/drivers/staging/rtl8723bs/hal/odm_interface.h index b129eb81bca0..8159bbd06c22 100644 --- a/drivers/staging/rtl8723bs/hal/odm_interface.h +++ b/drivers/staging/rtl8723bs/hal/odm_interface.h @@ -39,7 +39,7 @@ ODM_REG(DIG, _pDM_Odm) #define ODM_REG(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _reg) #define ODM_BIT(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _bit) -enum ODM_H2C_CMD { +enum odm_h2c_cmd { ODM_H2C_RSSI_REPORT = 0, ODM_H2C_PSD_RESULT = 1, ODM_H2C_PathDiv = 2, -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:19 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:19 +0100 Subject: [PATCH 32/43] Staging: rtl8723bs: fix names in odm_EdcaTurboCheck.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-33-marcocesati@gmail.com> This commit converts names of structs / enums in hal/odm_EdcaTurboCheck.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm.h | 2 +- drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h index 8f457b0ea70d..80683d3fb80f 100644 --- a/drivers/staging/rtl8723bs/hal/odm.h +++ b/drivers/staging/rtl8723bs/hal/odm.h @@ -1121,7 +1121,7 @@ struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ bool RSSI_test; struct CFO_TRACKING DM_CfoTrack; - struct EDCA_T DM_EDCA_Table; + struct edca_t DM_EDCA_Table; u32 WMMEDCA_BE; struct PATHDIV_T DM_PathDiv; /* Copy from SD4 structure */ diff --git a/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.h b/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.h index 09764431c4d6..e9f9f07221f2 100644 --- a/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.h +++ b/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.h @@ -8,7 +8,7 @@ #ifndef __ODMEDCATURBOCHECK_H__ #define __ODMEDCATURBOCHECK_H__ -struct EDCA_T { /* _EDCA_TURBO_ */ +struct edca_t { /* _EDCA_TURBO_ */ bool bCurrentTurboEDCA; bool bIsCurRDLState; -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:20 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:20 +0100 Subject: [PATCH 33/43] Staging: rtl8723bs: fix names in odm_HWConfig.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-34-marcocesati@gmail.com> This commit converts names of structs / enums in hal/odm_HWConfig.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_HWConfig.c | 2 +- drivers/staging/rtl8723bs/hal/odm_HWConfig.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c index 56fd583eb283..47237cd636cf 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c @@ -90,7 +90,7 @@ static void odm_RxPhyStatus92CSeries_Parsing( bool isCCKrate = false; u8 rf_rx_num = 0; u8 LNA_idx, VGA_idx; - struct PHY_STATUS_RPT_8192CD_T *pPhyStaRpt = (struct PHY_STATUS_RPT_8192CD_T *)pPhyStatus; + struct phy_status_rpt_8192cd_t *pPhyStaRpt = (struct phy_status_rpt_8192cd_t *)pPhyStatus; isCCKrate = pPktinfo->data_rate <= DESC_RATE11M; pPhyInfo->rx_mimo_signal_quality[ODM_RF_PATH_A] = -1; diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.h b/drivers/staging/rtl8723bs/hal/odm_HWConfig.h index deec2e71bd49..10cd4e8b1c9d 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.h +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.h @@ -30,7 +30,7 @@ /* structure and define */ /* */ -struct PHY_RX_AGC_INFO_T { +struct phy_rx_agc_info_t { #if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE) u8 gain:7, trsw:1; #else @@ -38,8 +38,8 @@ struct PHY_RX_AGC_INFO_T { #endif }; -struct PHY_STATUS_RPT_8192CD_T { - struct PHY_RX_AGC_INFO_T path_agc[2]; +struct phy_status_rpt_8192cd_t { + struct phy_rx_agc_info_t path_agc[2]; u8 ch_corr[2]; u8 cck_sig_qual_ofdm_pwdb_all; u8 cck_agc_rpt_ofdm_cfosho_a; @@ -77,7 +77,7 @@ struct PHY_STATUS_RPT_8192CD_T { }; -struct PHY_STATUS_RPT_8812_T { +struct phy_status_rpt_8812_t { /* 2012.05.24 LukeLee: This structure should take big/little endian in consideration later..... */ /* DWORD 0 */ -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:21 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:21 +0100 Subject: [PATCH 34/43] Staging: rtl8723bs: fix names in HalBtc8723b1Ant.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-35-marcocesati@gmail.com> This commit converts names of structs / enums in hal/HalBtc8723b1Ant.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 8 ++++---- drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c index 55d6a97d61dc..621f8181f46d 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c @@ -8,10 +8,10 @@ #include "Mp_Precomp.h" /* Global variables, these are static variables */ -static struct COEX_DM_8723B_1ANT GLCoexDm8723b1Ant; -static struct COEX_DM_8723B_1ANT *pCoexDm = &GLCoexDm8723b1Ant; -static struct COEX_STA_8723B_1ANT GLCoexSta8723b1Ant; -static struct COEX_STA_8723B_1ANT *pCoexSta = &GLCoexSta8723b1Ant; +static struct coex_dm_8723b_1ant GLCoexDm8723b1Ant; +static struct coex_dm_8723b_1ant *pCoexDm = &GLCoexDm8723b1Ant; +static struct coex_sta_8723b_1ant GLCoexSta8723b1Ant; +static struct coex_sta_8723b_1ant *pCoexSta = &GLCoexSta8723b1Ant; static const char *const GLBtInfoSrc8723b1Ant[] = { "BT Info[wifi fw]", diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h index 46d964d3cb06..ed569e77e518 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h @@ -21,14 +21,14 @@ #define BT_8723B_1ANT_WIFI_NOISY_THRESH 30 /* max: 255 */ -enum BT_INFO_SRC_8723B_1ANT { +enum bt_info_src_8723b_1ant { BT_INFO_SRC_8723B_1ANT_WIFI_FW = 0x0, BT_INFO_SRC_8723B_1ANT_BT_RSP = 0x1, BT_INFO_SRC_8723B_1ANT_BT_ACTIVE_SEND = 0x2, BT_INFO_SRC_8723B_1ANT_MAX }; -enum BT_8723B_1ANT_BT_STATUS { +enum bt_8723b_1ant_bt_status { BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0, BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1, BT_8723B_1ANT_BT_STATUS_INQ_PAGE = 0x2, @@ -38,7 +38,7 @@ enum BT_8723B_1ANT_BT_STATUS { BT_8723B_1ANT_BT_STATUS_MAX }; -enum BT_8723B_1ANT_WIFI_STATUS { +enum bt_8723b_1ant_wifi_status { BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0, BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1, BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2, @@ -48,7 +48,7 @@ enum BT_8723B_1ANT_WIFI_STATUS { BT_8723B_1ANT_WIFI_STATUS_MAX }; -enum BT_8723B_1ANT_COEX_ALGO { +enum bt_8723b_1ant_coex_algo { BT_8723B_1ANT_COEX_ALGO_UNDEFINED = 0x0, BT_8723B_1ANT_COEX_ALGO_SCO = 0x1, BT_8723B_1ANT_COEX_ALGO_HID = 0x2, @@ -63,7 +63,7 @@ enum BT_8723B_1ANT_COEX_ALGO { BT_8723B_1ANT_COEX_ALGO_MAX = 0xb, }; -struct COEX_DM_8723B_1ANT { +struct coex_dm_8723b_1ant { /* fw mechanism */ bool bCurIgnoreWlanAct; bool bPreIgnoreWlanAct; @@ -118,7 +118,7 @@ struct COEX_DM_8723B_1ANT { u8 errorCondition; }; -struct COEX_STA_8723B_1ANT { +struct coex_sta_8723b_1ant { bool bBtLinkExist; bool bScoExist; bool bA2dpExist; -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:22 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:22 +0100 Subject: [PATCH 35/43] Staging: rtl8723bs: fix names in odm_types.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-36-marcocesati@gmail.com> This commit converts names of structs / enums in hal/odm_types.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm_HWConfig.c | 6 +++--- drivers/staging/rtl8723bs/hal/odm_HWConfig.h | 8 ++++---- drivers/staging/rtl8723bs/hal/odm_types.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c index 47237cd636cf..b1b69459282f 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c @@ -421,7 +421,7 @@ void ODM_PhyStatusQuery( /* */ /* */ -enum HAL_STATUS ODM_ConfigRFWithHeaderFile( +enum hal_status ODM_ConfigRFWithHeaderFile( struct DM_ODM_T *pDM_Odm, enum ODM_RF_Config_Type ConfigType, enum ODM_RF_RADIO_PATH_E eRFPath @@ -441,7 +441,7 @@ enum HAL_STATUS ODM_ConfigRFWithHeaderFile( return HAL_STATUS_SUCCESS; } -enum HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T *pDM_Odm) +enum hal_status ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T *pDM_Odm) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===>ODM_ConfigRFWithTxPwrTrackHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip")); @@ -455,7 +455,7 @@ enum HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T *pDM_Odm) return HAL_STATUS_SUCCESS; } -enum HAL_STATUS ODM_ConfigBBWithHeaderFile( +enum hal_status ODM_ConfigBBWithHeaderFile( struct DM_ODM_T *pDM_Odm, enum ODM_BB_Config_Type ConfigType ) { diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.h b/drivers/staging/rtl8723bs/hal/odm_HWConfig.h index 10cd4e8b1c9d..184609623f5c 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.h +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.h @@ -128,19 +128,19 @@ void ODM_PhyStatusQuery( struct odm_packet_info *pPktinfo ); -enum HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T *pDM_Odm); +enum hal_status ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T *pDM_Odm); -enum HAL_STATUS ODM_ConfigRFWithHeaderFile( +enum hal_status ODM_ConfigRFWithHeaderFile( struct DM_ODM_T *pDM_Odm, enum ODM_RF_Config_Type ConfigType, enum ODM_RF_RADIO_PATH_E eRFPath ); -enum HAL_STATUS ODM_ConfigBBWithHeaderFile( +enum hal_status ODM_ConfigBBWithHeaderFile( struct DM_ODM_T *pDM_Odm, enum ODM_BB_Config_Type ConfigType ); -enum HAL_STATUS ODM_ConfigFWWithHeaderFile( +enum hal_status ODM_ConfigFWWithHeaderFile( struct DM_ODM_T *pDM_Odm, enum ODM_FW_Config_Type ConfigType, u8 *pFirmware, diff --git a/drivers/staging/rtl8723bs/hal/odm_types.h b/drivers/staging/rtl8723bs/hal/odm_types.h index 72c7e971ac96..0b1b3e14d451 100644 --- a/drivers/staging/rtl8723bs/hal/odm_types.h +++ b/drivers/staging/rtl8723bs/hal/odm_types.h @@ -15,7 +15,7 @@ #define GET_ODM(__padapter) ((PDM_ODM_T)(&((GET_HAL_DATA(__padapter))->odmpriv))) -enum HAL_STATUS { +enum hal_status { HAL_STATUS_SUCCESS, HAL_STATUS_FAILURE, /*RT_STATUS_PENDING, @@ -30,7 +30,7 @@ enum HAL_STATUS { /* */ /* Declare for ODM spin lock definition temporarily from compile pass. */ /* */ -enum RT_SPINLOCK_TYPE { +enum rt_spinlock_type { RT_TX_SPINLOCK = 1, RT_RX_SPINLOCK = 2, RT_RM_SPINLOCK = 3, -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:18 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:18 +0100 Subject: [PATCH 31/43] Staging: rtl8723bs: fix names in HalBtcOutSrc.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-32-marcocesati@gmail.com> This commit converts names of structs / enums in hal/HalBtcOutSrc.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- .../staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 148 +++++++++--------- .../staging/rtl8723bs/hal/HalBtc8723b1Ant.h | 28 ++-- .../staging/rtl8723bs/hal/HalBtc8723b2Ant.c | 138 ++++++++-------- .../staging/rtl8723bs/hal/HalBtc8723b2Ant.h | 28 ++-- drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h | 100 ++++++------ drivers/staging/rtl8723bs/hal/hal_btcoex.c | 122 +++++++-------- 6 files changed, 282 insertions(+), 282 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c index 9e81dec49712..55d6a97d61dc 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c @@ -151,7 +151,7 @@ static u8 halbtc8723b1ant_BtRssiState( } static void halbtc8723b1ant_UpdateRaMask( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, u32 disRateMask + struct btc_coexist *pBtCoexist, bool bForceExec, u32 disRateMask ) { pCoexDm->curRaMask = disRateMask; @@ -166,7 +166,7 @@ static void halbtc8723b1ant_UpdateRaMask( } static void halbtc8723b1ant_AutoRateFallbackRetry( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 type + struct btc_coexist *pBtCoexist, bool bForceExec, u8 type ) { bool bWifiUnderBMode = false; @@ -204,7 +204,7 @@ static void halbtc8723b1ant_AutoRateFallbackRetry( } static void halbtc8723b1ant_RetryLimit( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 type + struct btc_coexist *pBtCoexist, bool bForceExec, u8 type ) { pCoexDm->curRetryLimitType = type; @@ -231,7 +231,7 @@ static void halbtc8723b1ant_RetryLimit( } static void halbtc8723b1ant_AmpduMaxTime( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 type + struct btc_coexist *pBtCoexist, bool bForceExec, u8 type ) { pCoexDm->curAmpduTimeType = type; @@ -257,7 +257,7 @@ static void halbtc8723b1ant_AmpduMaxTime( } static void halbtc8723b1ant_LimitedTx( - struct BTC_COEXIST *pBtCoexist, + struct btc_coexist *pBtCoexist, bool bForceExec, u8 raMaskType, u8 arfrType, @@ -285,7 +285,7 @@ static void halbtc8723b1ant_LimitedTx( } static void halbtc8723b1ant_LimitedRx( - struct BTC_COEXIST *pBtCoexist, + struct btc_coexist *pBtCoexist, bool bForceExec, bool bRejApAggPkt, bool bBtCtrlAggBufSize, @@ -314,7 +314,7 @@ static void halbtc8723b1ant_LimitedRx( } -static void halbtc8723b1ant_QueryBtInfo(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b1ant_QueryBtInfo(struct btc_coexist *pBtCoexist) { u8 H2C_Parameter[1] = {0}; @@ -331,7 +331,7 @@ static void halbtc8723b1ant_QueryBtInfo(struct BTC_COEXIST *pBtCoexist) pBtCoexist->fBtcFillH2c(pBtCoexist, 0x61, 1, H2C_Parameter); } -static void halbtc8723b1ant_MonitorBtCtr(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b1ant_MonitorBtCtr(struct btc_coexist *pBtCoexist) { u32 regHPTxRx, regLPTxRx, u4Tmp; u32 regHPTx = 0, regHPRx = 0, regLPTx = 0, regLPRx = 0; @@ -392,7 +392,7 @@ static void halbtc8723b1ant_MonitorBtCtr(struct BTC_COEXIST *pBtCoexist) } -static void halbtc8723b1ant_MonitorWiFiCtr(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b1ant_MonitorWiFiCtr(struct btc_coexist *pBtCoexist) { s32 wifiRssi = 0; bool bWifiBusy = false, bWifiUnderBMode = false; @@ -478,7 +478,7 @@ static void halbtc8723b1ant_MonitorWiFiCtr(struct BTC_COEXIST *pBtCoexist) } -static bool halbtc8723b1ant_IsWifiStatusChanged(struct BTC_COEXIST *pBtCoexist) +static bool halbtc8723b1ant_IsWifiStatusChanged(struct btc_coexist *pBtCoexist) { static bool bPreWifiBusy, bPreUnder4way, bPreBtHsOn; bool bWifiBusy = false, bUnder4way = false, bBtHsOn = false; @@ -513,9 +513,9 @@ static bool halbtc8723b1ant_IsWifiStatusChanged(struct BTC_COEXIST *pBtCoexist) return false; } -static void halbtc8723b1ant_UpdateBtLinkInfo(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b1ant_UpdateBtLinkInfo(struct btc_coexist *pBtCoexist) { - struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bBtHsOn = false; pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); @@ -577,9 +577,9 @@ static void halbtc8723b1ant_UpdateBtLinkInfo(struct BTC_COEXIST *pBtCoexist) pBtLinkInfo->bHidOnly = false; } -static u8 halbtc8723b1ant_ActionAlgorithm(struct BTC_COEXIST *pBtCoexist) +static u8 halbtc8723b1ant_ActionAlgorithm(struct btc_coexist *pBtCoexist) { - struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bBtHsOn = false; u8 algorithm = BT_8723B_1ANT_COEX_ALGO_UNDEFINED; u8 numOfDiffProfile = 0; @@ -805,7 +805,7 @@ static u8 halbtc8723b1ant_ActionAlgorithm(struct BTC_COEXIST *pBtCoexist) } static void halbtc8723b1ant_SetSwPenaltyTxRateAdaptive( - struct BTC_COEXIST *pBtCoexist, bool bLowPenaltyRa + struct btc_coexist *pBtCoexist, bool bLowPenaltyRa ) { u8 H2C_Parameter[6] = {0}; @@ -833,7 +833,7 @@ static void halbtc8723b1ant_SetSwPenaltyTxRateAdaptive( } static void halbtc8723b1ant_LowPenaltyRa( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bLowPenaltyRa + struct btc_coexist *pBtCoexist, bool bForceExec, bool bLowPenaltyRa ) { pCoexDm->bCurLowPenaltyRa = bLowPenaltyRa; @@ -850,7 +850,7 @@ static void halbtc8723b1ant_LowPenaltyRa( } static void halbtc8723b1ant_SetCoexTable( - struct BTC_COEXIST *pBtCoexist, + struct btc_coexist *pBtCoexist, u32 val0x6c0, u32 val0x6c4, u32 val0x6c8, @@ -887,7 +887,7 @@ static void halbtc8723b1ant_SetCoexTable( } static void halbtc8723b1ant_CoexTable( - struct BTC_COEXIST *pBtCoexist, + struct btc_coexist *pBtCoexist, bool bForceExec, u32 val0x6c0, u32 val0x6c4, @@ -930,7 +930,7 @@ static void halbtc8723b1ant_CoexTable( } static void halbtc8723b1ant_CoexTableWithType( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 type + struct btc_coexist *pBtCoexist, bool bForceExec, u8 type ) { BTC_PRINT( @@ -988,7 +988,7 @@ static void halbtc8723b1ant_CoexTableWithType( } static void halbtc8723b1ant_SetFwIgnoreWlanAct( - struct BTC_COEXIST *pBtCoexist, bool bEnable + struct btc_coexist *pBtCoexist, bool bEnable ) { u8 H2C_Parameter[1] = {0}; @@ -1009,7 +1009,7 @@ static void halbtc8723b1ant_SetFwIgnoreWlanAct( } static void halbtc8723b1ant_IgnoreWlanAct( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bEnable + struct btc_coexist *pBtCoexist, bool bForceExec, bool bEnable ) { BTC_PRINT( @@ -1043,7 +1043,7 @@ static void halbtc8723b1ant_IgnoreWlanAct( } static void halbtc8723b1ant_SetLpsRpwm( - struct BTC_COEXIST *pBtCoexist, u8 lpsVal, u8 rpwmVal + struct btc_coexist *pBtCoexist, u8 lpsVal, u8 rpwmVal ) { u8 lps = lpsVal; @@ -1054,7 +1054,7 @@ static void halbtc8723b1ant_SetLpsRpwm( } static void halbtc8723b1ant_LpsRpwm( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 lpsVal, u8 rpwmVal + struct btc_coexist *pBtCoexist, bool bForceExec, u8 lpsVal, u8 rpwmVal ) { BTC_PRINT( @@ -1105,7 +1105,7 @@ static void halbtc8723b1ant_LpsRpwm( } static void halbtc8723b1ant_SwMechanism( - struct BTC_COEXIST *pBtCoexist, bool bLowPenaltyRA + struct btc_coexist *pBtCoexist, bool bLowPenaltyRA ) { BTC_PRINT( @@ -1118,10 +1118,10 @@ static void halbtc8723b1ant_SwMechanism( } static void halbtc8723b1ant_SetAntPath( - struct BTC_COEXIST *pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff + struct btc_coexist *pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff ) { - struct BTC_BOARD_INFO *pBoardInfo = &pBtCoexist->boardInfo; + struct btc_board_info *pBoardInfo = &pBtCoexist->boardInfo; u32 fwVer = 0, u4Tmp = 0, cntBtCalChk = 0; bool bPgExtSwitch = false; bool bUseExtSwitch = false; @@ -1307,7 +1307,7 @@ static void halbtc8723b1ant_SetAntPath( } static void halbtc8723b1ant_SetFwPstdma( - struct BTC_COEXIST *pBtCoexist, u8 byte1, u8 byte2, u8 byte3, u8 byte4, u8 byte5 + struct btc_coexist *pBtCoexist, u8 byte1, u8 byte2, u8 byte3, u8 byte4, u8 byte5 ) { u8 H2C_Parameter[5] = {0}; @@ -1361,10 +1361,10 @@ static void halbtc8723b1ant_SetFwPstdma( static void halbtc8723b1ant_PsTdma( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bTurnOn, u8 type + struct btc_coexist *pBtCoexist, bool bForceExec, bool bTurnOn, u8 type ) { - struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bWifiBusy = false; u8 rssiAdjustVal = 0; u8 psTdmaByte4Val = 0x50, psTdmaByte0Val = 0x51, psTdmaByte3Val = 0x10; @@ -1661,7 +1661,7 @@ static void halbtc8723b1ant_PsTdma( pCoexDm->prePsTdma = pCoexDm->curPsTdma; } -static bool halbtc8723b1ant_IsCommonAction(struct BTC_COEXIST *pBtCoexist) +static bool halbtc8723b1ant_IsCommonAction(struct btc_coexist *pBtCoexist) { bool bCommon = false, bWifiConnected = false, bWifiBusy = false; @@ -1752,7 +1752,7 @@ static bool halbtc8723b1ant_IsCommonAction(struct BTC_COEXIST *pBtCoexist) static void halbtc8723b1ant_TdmaDurationAdjustForAcl( - struct BTC_COEXIST *pBtCoexist, u8 wifiStatus + struct btc_coexist *pBtCoexist, u8 wifiStatus ) { static s32 up, dn, m, n, WaitCount; @@ -1941,7 +1941,7 @@ static void halbtc8723b1ant_TdmaDurationAdjustForAcl( } static void halbtc8723b1ant_PsTdmaCheckForPowerSaveState( - struct BTC_COEXIST *pBtCoexist, bool bNewPsState + struct btc_coexist *pBtCoexist, bool bNewPsState ) { u8 lpsMode = 0x0; @@ -1963,7 +1963,7 @@ static void halbtc8723b1ant_PsTdmaCheckForPowerSaveState( } static void halbtc8723b1ant_PowerSaveState( - struct BTC_COEXIST *pBtCoexist, u8 psType, u8 lpsVal, u8 rpwmVal + struct btc_coexist *pBtCoexist, u8 psType, u8 lpsVal, u8 rpwmVal ) { bool bLowPwrDisable = false; @@ -2011,7 +2011,7 @@ static void halbtc8723b1ant_PowerSaveState( /* Non-Software Coex Mechanism start */ /* */ /* */ -static void halbtc8723b1ant_ActionWifiMultiPort(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b1ant_ActionWifiMultiPort(struct btc_coexist *pBtCoexist) { halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2019,15 +2019,15 @@ static void halbtc8723b1ant_ActionWifiMultiPort(struct BTC_COEXIST *pBtCoexist) halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); } -static void halbtc8723b1ant_ActionHs(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b1ant_ActionHs(struct btc_coexist *pBtCoexist) { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 5); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); } -static void halbtc8723b1ant_ActionBtInquiry(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b1ant_ActionBtInquiry(struct btc_coexist *pBtCoexist) { - struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bWifiConnected = false; bool bApEnable = false; bool bWifiBusy = false; @@ -2067,10 +2067,10 @@ static void halbtc8723b1ant_ActionBtInquiry(struct BTC_COEXIST *pBtCoexist) } static void halbtc8723b1ant_ActionBtScoHidOnlyBusy( - struct BTC_COEXIST *pBtCoexist, u8 wifiStatus + struct btc_coexist *pBtCoexist, u8 wifiStatus ) { - struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bWifiConnected = false; pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); @@ -2087,12 +2087,12 @@ static void halbtc8723b1ant_ActionBtScoHidOnlyBusy( } static void halbtc8723b1ant_ActionWifiConnectedBtAclBusy( - struct BTC_COEXIST *pBtCoexist, u8 wifiStatus + struct btc_coexist *pBtCoexist, u8 wifiStatus ) { u8 btRssiState; - struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo; btRssiState = halbtc8723b1ant_BtRssiState(2, 28, 0); if ((pCoexSta->lowPriorityRx >= 1000) && (pCoexSta->lowPriorityRx != 65535)) @@ -2141,7 +2141,7 @@ static void halbtc8723b1ant_ActionWifiConnectedBtAclBusy( } } -static void halbtc8723b1ant_ActionWifiNotConnected(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b1ant_ActionWifiNotConnected(struct btc_coexist *pBtCoexist) { /* power save state */ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2152,10 +2152,10 @@ static void halbtc8723b1ant_ActionWifiNotConnected(struct BTC_COEXIST *pBtCoexis } static void halbtc8723b1ant_ActionWifiNotConnectedScan( - struct BTC_COEXIST *pBtCoexist + struct btc_coexist *pBtCoexist ) { - struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo; halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2186,10 +2186,10 @@ static void halbtc8723b1ant_ActionWifiNotConnectedScan( } static void halbtc8723b1ant_ActionWifiNotConnectedAssoAuth( - struct BTC_COEXIST *pBtCoexist + struct btc_coexist *pBtCoexist ) { - struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo; halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2210,9 +2210,9 @@ static void halbtc8723b1ant_ActionWifiNotConnectedAssoAuth( } } -static void halbtc8723b1ant_ActionWifiConnectedScan(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b1ant_ActionWifiConnectedScan(struct btc_coexist *pBtCoexist) { - struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo; halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2243,10 +2243,10 @@ static void halbtc8723b1ant_ActionWifiConnectedScan(struct BTC_COEXIST *pBtCoexi } static void halbtc8723b1ant_ActionWifiConnectedSpecialPacket( - struct BTC_COEXIST *pBtCoexist + struct btc_coexist *pBtCoexist ) { - struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo; halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -2267,7 +2267,7 @@ static void halbtc8723b1ant_ActionWifiConnectedSpecialPacket( } } -static void halbtc8723b1ant_ActionWifiConnected(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b1ant_ActionWifiConnected(struct btc_coexist *pBtCoexist) { bool bWifiBusy = false; bool bScan = false, bLink = false, bRoam = false; @@ -2387,7 +2387,7 @@ static void halbtc8723b1ant_ActionWifiConnected(struct BTC_COEXIST *pBtCoexist) } } -static void halbtc8723b1ant_RunSwCoexistMechanism(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b1ant_RunSwCoexistMechanism(struct btc_coexist *pBtCoexist) { u8 algorithm = 0; @@ -2446,9 +2446,9 @@ static void halbtc8723b1ant_RunSwCoexistMechanism(struct BTC_COEXIST *pBtCoexist } } -static void halbtc8723b1ant_RunCoexistMechanism(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b1ant_RunCoexistMechanism(struct btc_coexist *pBtCoexist) { - struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bWifiConnected = false, bBtHsOn = false; bool bIncreaseScanDevNum = false; bool bBtCtrlAggBufSize = false; @@ -2579,7 +2579,7 @@ static void halbtc8723b1ant_RunCoexistMechanism(struct BTC_COEXIST *pBtCoexist) halbtc8723b1ant_ActionWifiConnected(pBtCoexist); } -static void halbtc8723b1ant_InitCoexDm(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b1ant_InitCoexDm(struct btc_coexist *pBtCoexist) { /* force to reset coex mechanism */ @@ -2593,7 +2593,7 @@ static void halbtc8723b1ant_InitCoexDm(struct BTC_COEXIST *pBtCoexist) } static void halbtc8723b1ant_InitHwConfig( - struct BTC_COEXIST *pBtCoexist, + struct btc_coexist *pBtCoexist, bool bBackUp, bool bWifiOnly ) @@ -2648,9 +2648,9 @@ static void halbtc8723b1ant_InitHwConfig( /* */ /* extern function start with EXhalbtc8723b1ant_ */ /* */ -void EXhalbtc8723b1ant_PowerOnSetting(struct BTC_COEXIST *pBtCoexist) +void EXhalbtc8723b1ant_PowerOnSetting(struct btc_coexist *pBtCoexist) { - struct BTC_BOARD_INFO *pBoardInfo = &pBtCoexist->boardInfo; + struct btc_board_info *pBoardInfo = &pBtCoexist->boardInfo; u8 u1Tmp = 0x0; u16 u2Tmp = 0x0; @@ -2700,12 +2700,12 @@ void EXhalbtc8723b1ant_PowerOnSetting(struct BTC_COEXIST *pBtCoexist) } } -void EXhalbtc8723b1ant_InitHwConfig(struct BTC_COEXIST *pBtCoexist, bool bWifiOnly) +void EXhalbtc8723b1ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bWifiOnly) { halbtc8723b1ant_InitHwConfig(pBtCoexist, true, bWifiOnly); } -void EXhalbtc8723b1ant_InitCoexDm(struct BTC_COEXIST *pBtCoexist) +void EXhalbtc8723b1ant_InitCoexDm(struct btc_coexist *pBtCoexist) { BTC_PRINT( BTC_MSG_INTERFACE, @@ -2720,11 +2720,11 @@ void EXhalbtc8723b1ant_InitCoexDm(struct BTC_COEXIST *pBtCoexist) halbtc8723b1ant_QueryBtInfo(pBtCoexist); } -void EXhalbtc8723b1ant_DisplayCoexInfo(struct BTC_COEXIST *pBtCoexist) +void EXhalbtc8723b1ant_DisplayCoexInfo(struct btc_coexist *pBtCoexist) { - struct BTC_BOARD_INFO *pBoardInfo = &pBtCoexist->boardInfo; - struct BTC_STACK_INFO *pStackInfo = &pBtCoexist->stackInfo; - struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct btc_board_info *pBoardInfo = &pBtCoexist->boardInfo; + struct btc_stack_info *pStackInfo = &pBtCoexist->stackInfo; + struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo; u8 *cliBuf = pBtCoexist->cliBuf; u8 u1Tmp[4], i, btInfoExt, psTdmaCase = 0; u16 u2Tmp[4]; @@ -3183,7 +3183,7 @@ void EXhalbtc8723b1ant_DisplayCoexInfo(struct BTC_COEXIST *pBtCoexist) } -void EXhalbtc8723b1ant_IpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) +void EXhalbtc8723b1ant_IpsNotify(struct btc_coexist *pBtCoexist, u8 type) { if (pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm) return; @@ -3209,7 +3209,7 @@ void EXhalbtc8723b1ant_IpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) } } -void EXhalbtc8723b1ant_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) +void EXhalbtc8723b1ant_LpsNotify(struct btc_coexist *pBtCoexist, u8 type) { if (pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm) return; @@ -3227,7 +3227,7 @@ void EXhalbtc8723b1ant_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) } } -void EXhalbtc8723b1ant_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type) +void EXhalbtc8723b1ant_ScanNotify(struct btc_coexist *pBtCoexist, u8 type) { bool bWifiConnected = false, bBtHsOn = false; u32 wifiLinkStatus = 0; @@ -3317,7 +3317,7 @@ void EXhalbtc8723b1ant_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type) } } -void EXhalbtc8723b1ant_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 type) +void EXhalbtc8723b1ant_ConnectNotify(struct btc_coexist *pBtCoexist, u8 type) { bool bWifiConnected = false, bBtHsOn = false; u32 wifiLinkStatus = 0; @@ -3374,7 +3374,7 @@ void EXhalbtc8723b1ant_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 type) } } -void EXhalbtc8723b1ant_MediaStatusNotify(struct BTC_COEXIST *pBtCoexist, u8 type) +void EXhalbtc8723b1ant_MediaStatusNotify(struct btc_coexist *pBtCoexist, u8 type) { u8 H2C_Parameter[3] = {0}; u32 wifiBw; @@ -3444,7 +3444,7 @@ void EXhalbtc8723b1ant_MediaStatusNotify(struct BTC_COEXIST *pBtCoexist, u8 type pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter); } -void EXhalbtc8723b1ant_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 type) +void EXhalbtc8723b1ant_SpecialPacketNotify(struct btc_coexist *pBtCoexist, u8 type) { bool bBtHsOn = false; u32 wifiLinkStatus = 0; @@ -3533,7 +3533,7 @@ void EXhalbtc8723b1ant_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 ty } void EXhalbtc8723b1ant_BtInfoNotify( - struct BTC_COEXIST *pBtCoexist, u8 *tmpBuf, u8 length + struct btc_coexist *pBtCoexist, u8 *tmpBuf, u8 length ) { u8 btInfo = 0; @@ -3698,7 +3698,7 @@ void EXhalbtc8723b1ant_BtInfoNotify( halbtc8723b1ant_RunCoexistMechanism(pBtCoexist); } -void EXhalbtc8723b1ant_HaltNotify(struct BTC_COEXIST *pBtCoexist) +void EXhalbtc8723b1ant_HaltNotify(struct btc_coexist *pBtCoexist) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n")); @@ -3713,7 +3713,7 @@ void EXhalbtc8723b1ant_HaltNotify(struct BTC_COEXIST *pBtCoexist) pBtCoexist->bStopCoexDm = true; } -void EXhalbtc8723b1ant_PnpNotify(struct BTC_COEXIST *pBtCoexist, u8 pnpState) +void EXhalbtc8723b1ant_PnpNotify(struct btc_coexist *pBtCoexist, u8 pnpState) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify\n")); @@ -3735,7 +3735,7 @@ void EXhalbtc8723b1ant_PnpNotify(struct BTC_COEXIST *pBtCoexist, u8 pnpState) } } -void EXhalbtc8723b1ant_Periodical(struct BTC_COEXIST *pBtCoexist) +void EXhalbtc8723b1ant_Periodical(struct btc_coexist *pBtCoexist) { static u8 disVerInfoCnt; u32 fwVer = 0, btPatchVer = 0; diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h index b26a169e5088..46d964d3cb06 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h @@ -167,19 +167,19 @@ struct COEX_STA_8723B_1ANT { /* */ /* The following is interface which will notify coex module. */ /* */ -void EXhalbtc8723b1ant_PowerOnSetting(struct BTC_COEXIST *pBtCoexist); -void EXhalbtc8723b1ant_InitHwConfig(struct BTC_COEXIST *pBtCoexist, bool bWifiOnly); -void EXhalbtc8723b1ant_InitCoexDm(struct BTC_COEXIST *pBtCoexist); -void EXhalbtc8723b1ant_IpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type); -void EXhalbtc8723b1ant_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type); -void EXhalbtc8723b1ant_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type); -void EXhalbtc8723b1ant_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 type); -void EXhalbtc8723b1ant_MediaStatusNotify(struct BTC_COEXIST *pBtCoexist, u8 type); -void EXhalbtc8723b1ant_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 type); +void EXhalbtc8723b1ant_PowerOnSetting(struct btc_coexist *pBtCoexist); +void EXhalbtc8723b1ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bWifiOnly); +void EXhalbtc8723b1ant_InitCoexDm(struct btc_coexist *pBtCoexist); +void EXhalbtc8723b1ant_IpsNotify(struct btc_coexist *pBtCoexist, u8 type); +void EXhalbtc8723b1ant_LpsNotify(struct btc_coexist *pBtCoexist, u8 type); +void EXhalbtc8723b1ant_ScanNotify(struct btc_coexist *pBtCoexist, u8 type); +void EXhalbtc8723b1ant_ConnectNotify(struct btc_coexist *pBtCoexist, u8 type); +void EXhalbtc8723b1ant_MediaStatusNotify(struct btc_coexist *pBtCoexist, u8 type); +void EXhalbtc8723b1ant_SpecialPacketNotify(struct btc_coexist *pBtCoexist, u8 type); void EXhalbtc8723b1ant_BtInfoNotify( - struct BTC_COEXIST *pBtCoexist, u8 *tmpBuf, u8 length + struct btc_coexist *pBtCoexist, u8 *tmpBuf, u8 length ); -void EXhalbtc8723b1ant_HaltNotify(struct BTC_COEXIST *pBtCoexist); -void EXhalbtc8723b1ant_PnpNotify(struct BTC_COEXIST *pBtCoexist, u8 pnpState); -void EXhalbtc8723b1ant_Periodical(struct BTC_COEXIST *pBtCoexist); -void EXhalbtc8723b1ant_DisplayCoexInfo(struct BTC_COEXIST *pBtCoexist); +void EXhalbtc8723b1ant_HaltNotify(struct btc_coexist *pBtCoexist); +void EXhalbtc8723b1ant_PnpNotify(struct btc_coexist *pBtCoexist, u8 pnpState); +void EXhalbtc8723b1ant_Periodical(struct btc_coexist *pBtCoexist); +void EXhalbtc8723b1ant_DisplayCoexInfo(struct btc_coexist *pBtCoexist); diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c index 8d5f666b2e23..0e1aa204c099 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c @@ -108,7 +108,7 @@ static u8 halbtc8723b2ant_BtRssiState( } static u8 halbtc8723b2ant_WifiRssiState( - struct BTC_COEXIST *pBtCoexist, + struct btc_coexist *pBtCoexist, u8 index, u8 levelNum, u8 rssiThresh, @@ -189,7 +189,7 @@ static u8 halbtc8723b2ant_WifiRssiState( } static void halbtc8723b2ant_LimitedRx( - struct BTC_COEXIST *pBtCoexist, + struct btc_coexist *pBtCoexist, bool bForceExec, bool bRejApAggPkt, bool bBtCtrlAggBufSize, @@ -212,7 +212,7 @@ static void halbtc8723b2ant_LimitedRx( pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL); } -static void halbtc8723b2ant_MonitorBtCtr(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_MonitorBtCtr(struct btc_coexist *pBtCoexist) { u32 regHPTxRx, regLPTxRx, u4Tmp; u32 regHPTx = 0, regHPRx = 0, regLPTx = 0, regLPRx = 0; @@ -262,7 +262,7 @@ static void halbtc8723b2ant_MonitorBtCtr(struct BTC_COEXIST *pBtCoexist) pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); } -static void halbtc8723b2ant_QueryBtInfo(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_QueryBtInfo(struct btc_coexist *pBtCoexist) { u8 H2C_Parameter[1] = {0}; @@ -279,7 +279,7 @@ static void halbtc8723b2ant_QueryBtInfo(struct BTC_COEXIST *pBtCoexist) pBtCoexist->fBtcFillH2c(pBtCoexist, 0x61, 1, H2C_Parameter); } -static bool halbtc8723b2ant_IsWifiStatusChanged(struct BTC_COEXIST *pBtCoexist) +static bool halbtc8723b2ant_IsWifiStatusChanged(struct btc_coexist *pBtCoexist) { static bool bPreWifiBusy, bPreUnder4way, bPreBtHsOn; bool bWifiBusy = false, bUnder4way = false, bBtHsOn = false; @@ -310,9 +310,9 @@ static bool halbtc8723b2ant_IsWifiStatusChanged(struct BTC_COEXIST *pBtCoexist) return false; } -static void halbtc8723b2ant_UpdateBtLinkInfo(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_UpdateBtLinkInfo(struct btc_coexist *pBtCoexist) { - struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bBtHsOn = false; pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); @@ -374,9 +374,9 @@ static void halbtc8723b2ant_UpdateBtLinkInfo(struct BTC_COEXIST *pBtCoexist) pBtLinkInfo->bHidOnly = false; } -static u8 halbtc8723b2ant_ActionAlgorithm(struct BTC_COEXIST *pBtCoexist) +static u8 halbtc8723b2ant_ActionAlgorithm(struct btc_coexist *pBtCoexist) { - struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo; bool bBtHsOn = false; u8 algorithm = BT_8723B_2ANT_COEX_ALGO_UNDEFINED; u8 numOfDiffProfile = 0; @@ -549,7 +549,7 @@ static u8 halbtc8723b2ant_ActionAlgorithm(struct BTC_COEXIST *pBtCoexist) } static void halbtc8723b2ant_SetFwDacSwingLevel( - struct BTC_COEXIST *pBtCoexist, u8 dacSwingLvl + struct btc_coexist *pBtCoexist, u8 dacSwingLvl ) { u8 H2C_Parameter[1] = {0}; @@ -573,7 +573,7 @@ static void halbtc8723b2ant_SetFwDacSwingLevel( } static void halbtc8723b2ant_SetFwDecBtPwr( - struct BTC_COEXIST *pBtCoexist, u8 decBtPwrLvl + struct btc_coexist *pBtCoexist, u8 decBtPwrLvl ) { u8 H2C_Parameter[1] = {0}; @@ -594,7 +594,7 @@ static void halbtc8723b2ant_SetFwDecBtPwr( } static void halbtc8723b2ant_DecBtPwr( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 decBtPwrLvl + struct btc_coexist *pBtCoexist, bool bForceExec, u8 decBtPwrLvl ) { BTC_PRINT( @@ -628,7 +628,7 @@ static void halbtc8723b2ant_DecBtPwr( } static void halbtc8723b2ant_FwDacSwingLvl( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 fwDacSwingLvl + struct btc_coexist *pBtCoexist, bool bForceExec, u8 fwDacSwingLvl ) { BTC_PRINT( @@ -663,7 +663,7 @@ static void halbtc8723b2ant_FwDacSwingLvl( } static void halbtc8723b2ant_SetSwRfRxLpfCorner( - struct BTC_COEXIST *pBtCoexist, + struct btc_coexist *pBtCoexist, bool bRxRfShrinkOn ) { @@ -686,7 +686,7 @@ static void halbtc8723b2ant_SetSwRfRxLpfCorner( } static void halbtc8723b2ant_RfShrink( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bRxRfShrinkOn + struct btc_coexist *pBtCoexist, bool bForceExec, bool bRxRfShrinkOn ) { BTC_PRINT( @@ -720,7 +720,7 @@ static void halbtc8723b2ant_RfShrink( } static void halbtc8723b2ant_SetSwPenaltyTxRateAdaptive( - struct BTC_COEXIST *pBtCoexist, bool bLowPenaltyRa + struct btc_coexist *pBtCoexist, bool bLowPenaltyRa ) { u8 H2C_Parameter[6] = {0}; @@ -748,7 +748,7 @@ static void halbtc8723b2ant_SetSwPenaltyTxRateAdaptive( } static void halbtc8723b2ant_LowPenaltyRa( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bLowPenaltyRa + struct btc_coexist *pBtCoexist, bool bForceExec, bool bLowPenaltyRa ) { /* return; */ @@ -782,7 +782,7 @@ static void halbtc8723b2ant_LowPenaltyRa( pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa; } -static void halbtc8723b2ant_SetDacSwingReg(struct BTC_COEXIST *pBtCoexist, u32 level) +static void halbtc8723b2ant_SetDacSwingReg(struct btc_coexist *pBtCoexist, u32 level) { u8 val = (u8)level; @@ -795,7 +795,7 @@ static void halbtc8723b2ant_SetDacSwingReg(struct BTC_COEXIST *pBtCoexist, u32 l } static void halbtc8723b2ant_SetSwFullTimeDacSwing( - struct BTC_COEXIST *pBtCoexist, bool bSwDacSwingOn, u32 swDacSwingLvl + struct btc_coexist *pBtCoexist, bool bSwDacSwingOn, u32 swDacSwingLvl ) { if (bSwDacSwingOn) @@ -806,7 +806,7 @@ static void halbtc8723b2ant_SetSwFullTimeDacSwing( static void halbtc8723b2ant_DacSwing( - struct BTC_COEXIST *pBtCoexist, + struct btc_coexist *pBtCoexist, bool bForceExec, bool bDacSwingOn, u32 dacSwingLvl @@ -850,7 +850,7 @@ static void halbtc8723b2ant_DacSwing( } static void halbtc8723b2ant_SetAgcTable( - struct BTC_COEXIST *pBtCoexist, bool bAgcTableEn + struct btc_coexist *pBtCoexist, bool bAgcTableEn ) { u8 rssiAdjustVal = 0; @@ -910,7 +910,7 @@ static void halbtc8723b2ant_SetAgcTable( } static void halbtc8723b2ant_AgcTable( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bAgcTableEn + struct btc_coexist *pBtCoexist, bool bForceExec, bool bAgcTableEn ) { BTC_PRINT( @@ -944,7 +944,7 @@ static void halbtc8723b2ant_AgcTable( } static void halbtc8723b2ant_SetCoexTable( - struct BTC_COEXIST *pBtCoexist, + struct btc_coexist *pBtCoexist, u32 val0x6c0, u32 val0x6c4, u32 val0x6c8, @@ -981,7 +981,7 @@ static void halbtc8723b2ant_SetCoexTable( } static void halbtc8723b2ant_CoexTable( - struct BTC_COEXIST *pBtCoexist, + struct btc_coexist *pBtCoexist, bool bForceExec, u32 val0x6c0, u32 val0x6c4, @@ -1047,7 +1047,7 @@ static void halbtc8723b2ant_CoexTable( } static void halbtc8723b2ant_CoexTableWithType( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, u8 type + struct btc_coexist *pBtCoexist, bool bForceExec, u8 type ) { switch (type) { @@ -1096,7 +1096,7 @@ static void halbtc8723b2ant_CoexTableWithType( } static void halbtc8723b2ant_SetFwIgnoreWlanAct( - struct BTC_COEXIST *pBtCoexist, bool bEnable + struct btc_coexist *pBtCoexist, bool bEnable ) { u8 H2C_Parameter[1] = {0}; @@ -1117,7 +1117,7 @@ static void halbtc8723b2ant_SetFwIgnoreWlanAct( } static void halbtc8723b2ant_IgnoreWlanAct( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bEnable + struct btc_coexist *pBtCoexist, bool bForceExec, bool bEnable ) { BTC_PRINT( @@ -1145,7 +1145,7 @@ static void halbtc8723b2ant_IgnoreWlanAct( } static void halbtc8723b2ant_SetFwPstdma( - struct BTC_COEXIST *pBtCoexist, + struct btc_coexist *pBtCoexist, u8 byte1, u8 byte2, u8 byte3, @@ -1184,7 +1184,7 @@ static void halbtc8723b2ant_SetFwPstdma( } static void halbtc8723b2ant_SwMechanism1( - struct BTC_COEXIST *pBtCoexist, + struct btc_coexist *pBtCoexist, bool bShrinkRxLPF, bool bLowPenaltyRA, bool bLimitedDIG, @@ -1196,7 +1196,7 @@ static void halbtc8723b2ant_SwMechanism1( } static void halbtc8723b2ant_SwMechanism2( - struct BTC_COEXIST *pBtCoexist, + struct btc_coexist *pBtCoexist, bool bAGCTableShift, bool bADCBackOff, bool bSWDACSwing, @@ -1208,10 +1208,10 @@ static void halbtc8723b2ant_SwMechanism2( } static void halbtc8723b2ant_SetAntPath( - struct BTC_COEXIST *pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff + struct btc_coexist *pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff ) { - struct BTC_BOARD_INFO *pBoardInfo = &pBtCoexist->boardInfo; + struct btc_board_info *pBoardInfo = &pBtCoexist->boardInfo; u32 fwVer = 0, u4Tmp = 0; bool bPgExtSwitch = false; bool bUseExtSwitch = false; @@ -1302,7 +1302,7 @@ static void halbtc8723b2ant_SetAntPath( } static void halbtc8723b2ant_PsTdma( - struct BTC_COEXIST *pBtCoexist, bool bForceExec, bool bTurnOn, u8 type + struct btc_coexist *pBtCoexist, bool bForceExec, bool bTurnOn, u8 type ) { BTC_PRINT( @@ -1434,7 +1434,7 @@ static void halbtc8723b2ant_PsTdma( pCoexDm->prePsTdma = pCoexDm->curPsTdma; } -static void halbtc8723b2ant_CoexAllOff(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_CoexAllOff(struct btc_coexist *pBtCoexist) { /* fw all off */ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, false, 1); @@ -1450,7 +1450,7 @@ static void halbtc8723b2ant_CoexAllOff(struct BTC_COEXIST *pBtCoexist) halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0); } -static void halbtc8723b2ant_InitCoexDm(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_InitCoexDm(struct btc_coexist *pBtCoexist) { /* force to reset coex mechanism */ @@ -1462,7 +1462,7 @@ static void halbtc8723b2ant_InitCoexDm(struct BTC_COEXIST *pBtCoexist) halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); } -static void halbtc8723b2ant_ActionBtInquiry(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_ActionBtInquiry(struct btc_coexist *pBtCoexist) { bool bWifiConnected = false; bool bLowPwrDisable = true; @@ -1490,7 +1490,7 @@ static void halbtc8723b2ant_ActionBtInquiry(struct BTC_COEXIST *pBtCoexist) halbtc8723b2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_AUX, false, false); } -static bool halbtc8723b2ant_IsCommonAction(struct BTC_COEXIST *pBtCoexist) +static bool halbtc8723b2ant_IsCommonAction(struct btc_coexist *pBtCoexist) { u8 btRssiState = BTC_RSSI_STATE_HIGH; bool bCommon = false, bWifiConnected = false, bWifiBusy = false; @@ -1591,7 +1591,7 @@ static bool halbtc8723b2ant_IsCommonAction(struct BTC_COEXIST *pBtCoexist) } static void halbtc8723b2ant_TdmaDurationAdjust( - struct BTC_COEXIST *pBtCoexist, bool bScoHid, bool bTxPause, u8 maxInterval + struct btc_coexist *pBtCoexist, bool bScoHid, bool bTxPause, u8 maxInterval ) { static s32 up, dn, m, n, WaitCount; @@ -2041,7 +2041,7 @@ static void halbtc8723b2ant_TdmaDurationAdjust( } /* SCO only or SCO+PAN(HS) */ -static void halbtc8723b2ant_ActionSco(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_ActionSco(struct btc_coexist *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2096,7 +2096,7 @@ static void halbtc8723b2ant_ActionSco(struct BTC_COEXIST *pBtCoexist) } -static void halbtc8723b2ant_ActionHid(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_ActionHid(struct btc_coexist *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2157,7 +2157,7 @@ static void halbtc8723b2ant_ActionHid(struct BTC_COEXIST *pBtCoexist) } /* A2DP only / PAN(EDR) only/ A2DP+PAN(HS) */ -static void halbtc8723b2ant_ActionA2dp(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_ActionA2dp(struct btc_coexist *pBtCoexist) { u8 wifiRssiState, wifiRssiState1, btRssiState; u32 wifiBw; @@ -2238,7 +2238,7 @@ static void halbtc8723b2ant_ActionA2dp(struct BTC_COEXIST *pBtCoexist) } } -static void halbtc8723b2ant_ActionA2dpPanHs(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_ActionA2dpPanHs(struct btc_coexist *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2288,7 +2288,7 @@ static void halbtc8723b2ant_ActionA2dpPanHs(struct BTC_COEXIST *pBtCoexist) } } -static void halbtc8723b2ant_ActionPanEdr(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_ActionPanEdr(struct btc_coexist *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2346,7 +2346,7 @@ static void halbtc8723b2ant_ActionPanEdr(struct BTC_COEXIST *pBtCoexist) /* PAN(HS) only */ -static void halbtc8723b2ant_ActionPanHs(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_ActionPanHs(struct btc_coexist *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2396,7 +2396,7 @@ static void halbtc8723b2ant_ActionPanHs(struct BTC_COEXIST *pBtCoexist) } /* PAN(EDR)+A2DP */ -static void halbtc8723b2ant_ActionPanEdrA2dp(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_ActionPanEdrA2dp(struct btc_coexist *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2457,7 +2457,7 @@ static void halbtc8723b2ant_ActionPanEdrA2dp(struct BTC_COEXIST *pBtCoexist) } } -static void halbtc8723b2ant_ActionPanEdrHid(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_ActionPanEdrHid(struct btc_coexist *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2521,7 +2521,7 @@ static void halbtc8723b2ant_ActionPanEdrHid(struct BTC_COEXIST *pBtCoexist) } /* HID+A2DP+PAN(EDR) */ -static void halbtc8723b2ant_ActionHidA2dpPanEdr(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_ActionHidA2dpPanEdr(struct btc_coexist *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2581,7 +2581,7 @@ static void halbtc8723b2ant_ActionHidA2dpPanEdr(struct BTC_COEXIST *pBtCoexist) } } -static void halbtc8723b2ant_ActionHidA2dp(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_ActionHidA2dp(struct btc_coexist *pBtCoexist) { u8 wifiRssiState, btRssiState; u32 wifiBw; @@ -2656,7 +2656,7 @@ static void halbtc8723b2ant_ActionHidA2dp(struct BTC_COEXIST *pBtCoexist) } } -static void halbtc8723b2ant_RunCoexistMechanism(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_RunCoexistMechanism(struct btc_coexist *pBtCoexist) { u8 algorithm = 0; @@ -2755,7 +2755,7 @@ static void halbtc8723b2ant_RunCoexistMechanism(struct BTC_COEXIST *pBtCoexist) } } -static void halbtc8723b2ant_WifiOffHwCfg(struct BTC_COEXIST *pBtCoexist) +static void halbtc8723b2ant_WifiOffHwCfg(struct btc_coexist *pBtCoexist) { bool bIsInMpMode = false; u8 H2C_Parameter[2] = {0}; @@ -2780,7 +2780,7 @@ static void halbtc8723b2ant_WifiOffHwCfg(struct BTC_COEXIST *pBtCoexist) pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1); /* BT select s0/s1 is controlled by WiFi */ } -static void halbtc8723b2ant_InitHwConfig(struct BTC_COEXIST *pBtCoexist, bool bBackUp) +static void halbtc8723b2ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bBackUp) { u8 u1Tmp = 0; @@ -2814,9 +2814,9 @@ static void halbtc8723b2ant_InitHwConfig(struct BTC_COEXIST *pBtCoexist, bool bB /* */ /* extern function start with EXhalbtc8723b2ant_ */ /* */ -void EXhalbtc8723b2ant_PowerOnSetting(struct BTC_COEXIST *pBtCoexist) +void EXhalbtc8723b2ant_PowerOnSetting(struct btc_coexist *pBtCoexist) { - struct BTC_BOARD_INFO *pBoardInfo = &pBtCoexist->boardInfo; + struct btc_board_info *pBoardInfo = &pBtCoexist->boardInfo; u8 u1Tmp = 0x4; /* Set BIT2 by default since it's 2ant case */ u16 u2Tmp = 0x0; @@ -2866,23 +2866,23 @@ void EXhalbtc8723b2ant_PowerOnSetting(struct BTC_COEXIST *pBtCoexist) } } -void EXhalbtc8723b2ant_InitHwConfig(struct BTC_COEXIST *pBtCoexist, bool bWifiOnly) +void EXhalbtc8723b2ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bWifiOnly) { halbtc8723b2ant_InitHwConfig(pBtCoexist, true); } -void EXhalbtc8723b2ant_InitCoexDm(struct BTC_COEXIST *pBtCoexist) +void EXhalbtc8723b2ant_InitCoexDm(struct btc_coexist *pBtCoexist) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n")); halbtc8723b2ant_InitCoexDm(pBtCoexist); } -void EXhalbtc8723b2ant_DisplayCoexInfo(struct BTC_COEXIST *pBtCoexist) +void EXhalbtc8723b2ant_DisplayCoexInfo(struct btc_coexist *pBtCoexist) { - struct BTC_BOARD_INFO *pBoardInfo = &pBtCoexist->boardInfo; - struct BTC_STACK_INFO *pStackInfo = &pBtCoexist->stackInfo; - struct BTC_BT_LINK_INFO *pBtLinkInfo = &pBtCoexist->btLinkInfo; + struct btc_board_info *pBoardInfo = &pBtCoexist->boardInfo; + struct btc_stack_info *pStackInfo = &pBtCoexist->stackInfo; + struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo; u8 *cliBuf = pBtCoexist->cliBuf; u8 u1Tmp[4], i, btInfoExt, psTdmaCase = 0; u32 u4Tmp[4]; @@ -3259,7 +3259,7 @@ void EXhalbtc8723b2ant_DisplayCoexInfo(struct BTC_COEXIST *pBtCoexist) } -void EXhalbtc8723b2ant_IpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) +void EXhalbtc8723b2ant_IpsNotify(struct btc_coexist *pBtCoexist, u8 type) { if (BTC_IPS_ENTER == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS ENTER notify\n")); @@ -3276,7 +3276,7 @@ void EXhalbtc8723b2ant_IpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) } } -void EXhalbtc8723b2ant_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) +void EXhalbtc8723b2ant_LpsNotify(struct btc_coexist *pBtCoexist, u8 type) { if (BTC_LPS_ENABLE == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS ENABLE notify\n")); @@ -3287,7 +3287,7 @@ void EXhalbtc8723b2ant_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) } } -void EXhalbtc8723b2ant_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type) +void EXhalbtc8723b2ant_ScanNotify(struct btc_coexist *pBtCoexist, u8 type) { if (BTC_SCAN_START == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n")); @@ -3296,7 +3296,7 @@ void EXhalbtc8723b2ant_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type) } } -void EXhalbtc8723b2ant_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 type) +void EXhalbtc8723b2ant_ConnectNotify(struct btc_coexist *pBtCoexist, u8 type) { if (BTC_ASSOCIATE_START == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n")); @@ -3305,7 +3305,7 @@ void EXhalbtc8723b2ant_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 type) } } -void EXhalbtc8723b2ant_MediaStatusNotify(struct BTC_COEXIST *pBtCoexist, u8 type) +void EXhalbtc8723b2ant_MediaStatusNotify(struct btc_coexist *pBtCoexist, u8 type) { u8 H2C_Parameter[3] = {0}; u32 wifiBw; @@ -3351,7 +3351,7 @@ void EXhalbtc8723b2ant_MediaStatusNotify(struct BTC_COEXIST *pBtCoexist, u8 type pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter); } -void EXhalbtc8723b2ant_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 type) +void EXhalbtc8723b2ant_SpecialPacketNotify(struct btc_coexist *pBtCoexist, u8 type) { if (type == BTC_PACKET_DHCP) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], DHCP Packet notify\n")); @@ -3359,7 +3359,7 @@ void EXhalbtc8723b2ant_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 ty } void EXhalbtc8723b2ant_BtInfoNotify( - struct BTC_COEXIST *pBtCoexist, u8 *tmpBuf, u8 length + struct btc_coexist *pBtCoexist, u8 *tmpBuf, u8 length ) { u8 btInfo = 0; @@ -3503,7 +3503,7 @@ void EXhalbtc8723b2ant_BtInfoNotify( halbtc8723b2ant_RunCoexistMechanism(pBtCoexist); } -void EXhalbtc8723b2ant_HaltNotify(struct BTC_COEXIST *pBtCoexist) +void EXhalbtc8723b2ant_HaltNotify(struct btc_coexist *pBtCoexist) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n")); @@ -3514,7 +3514,7 @@ void EXhalbtc8723b2ant_HaltNotify(struct BTC_COEXIST *pBtCoexist) EXhalbtc8723b2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT); } -void EXhalbtc8723b2ant_PnpNotify(struct BTC_COEXIST *pBtCoexist, u8 pnpState) +void EXhalbtc8723b2ant_PnpNotify(struct btc_coexist *pBtCoexist, u8 pnpState) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify\n")); @@ -3528,7 +3528,7 @@ void EXhalbtc8723b2ant_PnpNotify(struct BTC_COEXIST *pBtCoexist, u8 pnpState) } } -void EXhalbtc8723b2ant_Periodical(struct BTC_COEXIST *pBtCoexist) +void EXhalbtc8723b2ant_Periodical(struct btc_coexist *pBtCoexist) { static u8 disVerInfoCnt; u32 fwVer = 0, btPatchVer = 0; diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h index f9a885f4ab89..340444017327 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h @@ -129,19 +129,19 @@ struct COEX_STA_8723B_2ANT { /* */ /* The following is interface which will notify coex module. */ /* */ -void EXhalbtc8723b2ant_PowerOnSetting(struct BTC_COEXIST *pBtCoexist); -void EXhalbtc8723b2ant_InitHwConfig(struct BTC_COEXIST *pBtCoexist, bool bWifiOnly); -void EXhalbtc8723b2ant_InitCoexDm(struct BTC_COEXIST *pBtCoexist); -void EXhalbtc8723b2ant_IpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type); -void EXhalbtc8723b2ant_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type); -void EXhalbtc8723b2ant_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type); -void EXhalbtc8723b2ant_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 type); -void EXhalbtc8723b2ant_MediaStatusNotify(struct BTC_COEXIST *pBtCoexist, u8 type); -void EXhalbtc8723b2ant_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 type); +void EXhalbtc8723b2ant_PowerOnSetting(struct btc_coexist *pBtCoexist); +void EXhalbtc8723b2ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bWifiOnly); +void EXhalbtc8723b2ant_InitCoexDm(struct btc_coexist *pBtCoexist); +void EXhalbtc8723b2ant_IpsNotify(struct btc_coexist *pBtCoexist, u8 type); +void EXhalbtc8723b2ant_LpsNotify(struct btc_coexist *pBtCoexist, u8 type); +void EXhalbtc8723b2ant_ScanNotify(struct btc_coexist *pBtCoexist, u8 type); +void EXhalbtc8723b2ant_ConnectNotify(struct btc_coexist *pBtCoexist, u8 type); +void EXhalbtc8723b2ant_MediaStatusNotify(struct btc_coexist *pBtCoexist, u8 type); +void EXhalbtc8723b2ant_SpecialPacketNotify(struct btc_coexist *pBtCoexist, u8 type); void EXhalbtc8723b2ant_BtInfoNotify( - struct BTC_COEXIST *pBtCoexist, u8 *tmpBuf, u8 length + struct btc_coexist *pBtCoexist, u8 *tmpBuf, u8 length ); -void EXhalbtc8723b2ant_HaltNotify(struct BTC_COEXIST *pBtCoexist); -void EXhalbtc8723b2ant_PnpNotify(struct BTC_COEXIST *pBtCoexist, u8 pnpState); -void EXhalbtc8723b2ant_Periodical(struct BTC_COEXIST *pBtCoexist); -void EXhalbtc8723b2ant_DisplayCoexInfo(struct BTC_COEXIST *pBtCoexist); +void EXhalbtc8723b2ant_HaltNotify(struct btc_coexist *pBtCoexist); +void EXhalbtc8723b2ant_PnpNotify(struct btc_coexist *pBtCoexist, u8 pnpState); +void EXhalbtc8723b2ant_Periodical(struct btc_coexist *pBtCoexist); +void EXhalbtc8723b2ant_DisplayCoexInfo(struct btc_coexist *pBtCoexist); diff --git a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h index 866667134cad..b49dee8b7276 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h +++ b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h @@ -44,14 +44,14 @@ #define BTC_ANT_WIFI_AT_CPL_MAIN 0 #define BTC_ANT_WIFI_AT_CPL_AUX 1 -enum BTC_POWERSAVE_TYPE { +enum btc_powersave_type { BTC_PS_WIFI_NATIVE = 0, /* wifi original power save behavior */ BTC_PS_LPS_ON = 1, BTC_PS_LPS_OFF = 2, BTC_PS_MAX }; -enum BTC_BT_REG_TYPE { +enum btc_bt_reg_type { BTC_BT_REG_RF = 0, BTC_BT_REG_MODEM = 1, BTC_BT_REG_BLUEWIZE = 2, @@ -60,7 +60,7 @@ enum BTC_BT_REG_TYPE { BTC_BT_REG_MAX }; -enum BTC_CHIP_INTERFACE { +enum btc_chip_interface { BTC_INTF_UNKNOWN = 0, BTC_INTF_PCI = 1, BTC_INTF_USB = 2, @@ -68,7 +68,7 @@ enum BTC_CHIP_INTERFACE { BTC_INTF_MAX }; -enum BTC_CHIP_TYPE { +enum btc_chip_type { BTC_CHIP_UNDEF = 0, BTC_CHIP_CSR_BC4 = 1, BTC_CHIP_CSR_BC8 = 2, @@ -78,7 +78,7 @@ enum BTC_CHIP_TYPE { BTC_CHIP_MAX }; -enum BTC_MSG_TYPE { +enum btc_msg_type { BTC_MSG_INTERFACE = 0x0, BTC_MSG_ALGORITHM = 0x1, BTC_MSG_MAX @@ -164,7 +164,7 @@ extern u32 GLBtcDbgType[]; no_printk("%s %p %zu", _TitleString, _HexData, _HexDataLen) #endif -struct BTC_BOARD_INFO { +struct btc_board_info { /* The following is some board information */ u8 btChipType; u8 pgAntNum; /* pg ant number */ @@ -174,7 +174,7 @@ struct BTC_BOARD_INFO { /* bool bBtExist; */ }; -enum BTC_DBG_OPCODE { +enum btc_dbg_opcode { BTC_DBG_SET_COEX_NORMAL = 0x0, BTC_DBG_SET_COEX_WIFI_ONLY = 0x1, BTC_DBG_SET_COEX_BT_ONLY = 0x2, @@ -184,7 +184,7 @@ enum BTC_DBG_OPCODE { BTC_DBG_MAX }; -enum BTC_RSSI_STATE { +enum btc_rssi_state { BTC_RSSI_STATE_HIGH = 0x0, BTC_RSSI_STATE_MEDIUM = 0x1, BTC_RSSI_STATE_LOW = 0x2, @@ -197,7 +197,7 @@ enum BTC_RSSI_STATE { #define BTC_RSSI_MEDIUM(_rssi_) ((_rssi_ == BTC_RSSI_STATE_MEDIUM || _rssi_ == BTC_RSSI_STATE_STAY_MEDIUM) ? true : false) #define BTC_RSSI_LOW(_rssi_) ((_rssi_ == BTC_RSSI_STATE_LOW || _rssi_ == BTC_RSSI_STATE_STAY_LOW) ? true : false) -enum BTC_WIFI_ROLE { +enum btc_wifi_role { BTC_ROLE_STATION = 0x0, BTC_ROLE_AP = 0x1, BTC_ROLE_IBSS = 0x2, @@ -205,27 +205,27 @@ enum BTC_WIFI_ROLE { BTC_ROLE_MAX }; -enum BTC_WIFI_BW_MODE { +enum btc_wifi_bw_mode { BTC_WIFI_BW_LEGACY = 0x0, BTC_WIFI_BW_HT20 = 0x1, BTC_WIFI_BW_HT40 = 0x2, BTC_WIFI_BW_MAX }; -enum BTC_WIFI_TRAFFIC_DIR { +enum btc_wifi_traffic_dir { BTC_WIFI_TRAFFIC_TX = 0x0, BTC_WIFI_TRAFFIC_RX = 0x1, BTC_WIFI_TRAFFIC_MAX }; -enum BTC_WIFI_PNP { +enum btc_wifi_pnp { BTC_WIFI_PNP_WAKE_UP = 0x0, BTC_WIFI_PNP_SLEEP = 0x1, BTC_WIFI_PNP_MAX }; /* for 8723b-d cut large current issue */ -enum BT_WIFI_COEX_STATE { +enum bt_wifi_coex_state { BTC_WIFI_STAT_INIT, BTC_WIFI_STAT_IQK, BTC_WIFI_STAT_NORMAL_OFF, @@ -236,7 +236,7 @@ enum BT_WIFI_COEX_STATE { }; /* defined for BFP_BTC_GET */ -enum BTC_GET_TYPE { +enum btc_get_type { /* type bool */ BTC_GET_BL_HS_OPERATION, BTC_GET_BL_HS_CONNECTING, @@ -278,7 +278,7 @@ enum BTC_GET_TYPE { }; /* defined for BFP_BTC_SET */ -enum BTC_SET_TYPE { +enum btc_set_type { /* type bool */ BTC_SET_BL_BT_DISABLE, BTC_SET_BL_BT_TRAFFIC_BUSY, @@ -318,44 +318,44 @@ enum BTC_SET_TYPE { BTC_SET_MAX }; -enum BTC_DBG_DISP_TYPE { +enum btc_dbg_disp_type { BTC_DBG_DISP_COEX_STATISTICS = 0x0, BTC_DBG_DISP_BT_LINK_INFO = 0x1, BTC_DBG_DISP_FW_PWR_MODE_CMD = 0x2, BTC_DBG_DISP_MAX }; -enum BTC_NOTIFY_TYPE_IPS { +enum btc_notify_type_ips { BTC_IPS_LEAVE = 0x0, BTC_IPS_ENTER = 0x1, BTC_IPS_MAX }; -enum BTC_NOTIFY_TYPE_LPS { +enum btc_notify_type_lps { BTC_LPS_DISABLE = 0x0, BTC_LPS_ENABLE = 0x1, BTC_LPS_MAX }; -enum BTC_NOTIFY_TYPE_SCAN { +enum btc_notify_type_scan { BTC_SCAN_FINISH = 0x0, BTC_SCAN_START = 0x1, BTC_SCAN_MAX }; -enum BTC_NOTIFY_TYPE_ASSOCIATE { +enum btc_notify_type_associate { BTC_ASSOCIATE_FINISH = 0x0, BTC_ASSOCIATE_START = 0x1, BTC_ASSOCIATE_MAX }; -enum BTC_NOTIFY_TYPE_MEDIA_STATUS { +enum btc_notify_type_media_status { BTC_MEDIA_DISCONNECT = 0x0, BTC_MEDIA_CONNECT = 0x1, BTC_MEDIA_MAX }; -enum BTC_NOTIFY_TYPE_SPECIAL_PACKET { +enum btc_notify_type_special_packet { BTC_PACKET_UNKNOWN = 0x0, BTC_PACKET_DHCP = 0x1, BTC_PACKET_ARP = 0x2, @@ -363,7 +363,7 @@ enum BTC_NOTIFY_TYPE_SPECIAL_PACKET { BTC_PACKET_MAX }; -enum BTC_NOTIFY_TYPE_STACK_OPERATION { +enum btc_notify_type_stack_operation { BTC_STACK_OP_NONE = 0x0, BTC_STACK_OP_INQ_PAGE_PAIR_START = 0x1, BTC_STACK_OP_INQ_PAGE_PAIR_FINISH = 0x2, @@ -371,7 +371,7 @@ enum BTC_NOTIFY_TYPE_STACK_OPERATION { }; /* Bryant Add */ -enum BTC_ANTENNA_POS { +enum btc_antenna_pos { BTC_ANTENNA_AT_MAIN_PORT = 0x1, BTC_ANTENNA_AT_AUX_PORT = 0x2, }; @@ -409,7 +409,7 @@ typedef void (*BFP_BTC_SET_BT_REG)( typedef u32 (*BFP_BTC_GET_BT_REG)(void *pBtcContext, u8 regType, u32 offset); typedef void (*BFP_BTC_DISP_DBG_MSG)(void *pBtCoexist, u8 dispType); -struct BTC_BT_INFO { +struct btc_bt_info { bool bBtDisabled; u8 rssiAdjustForAgcTableOn; u8 rssiAdjustFor1AntCoexType; @@ -437,7 +437,7 @@ struct BTC_BT_INFO { u32 raMask; }; -struct BTC_STACK_INFO { +struct btc_stack_info { bool bProfileNotified; u16 hciVersion; /* stack hci version */ u8 numOfLink; @@ -452,7 +452,7 @@ struct BTC_STACK_INFO { s8 minBtRssi; }; -struct BTC_BT_LINK_INFO { +struct btc_bt_link_info { bool bBtLinkExist; bool bScoExist; bool bScoOnly; @@ -465,7 +465,7 @@ struct BTC_BT_LINK_INFO { bool bSlaveRole; }; -struct BTC_STATISTICS { +struct btc_statistics { u32 cntBind; u32 cntPowerOn; u32 cntInitHwConfig; @@ -484,20 +484,20 @@ struct BTC_STATISTICS { u32 cntDbgCtrl; }; -struct BTC_COEXIST { +struct btc_coexist { bool bBinded; /* make sure only one adapter can bind the data context */ void *Adapter; /* default adapter */ - struct BTC_BOARD_INFO boardInfo; - struct BTC_BT_INFO btInfo; /* some bt info referenced by non-bt module */ - struct BTC_STACK_INFO stackInfo; - struct BTC_BT_LINK_INFO btLinkInfo; - enum BTC_CHIP_INTERFACE chipInterface; + struct btc_board_info boardInfo; + struct btc_bt_info btInfo; /* some bt info referenced by non-bt module */ + struct btc_stack_info stackInfo; + struct btc_bt_link_info btLinkInfo; + enum btc_chip_interface chipInterface; bool bInitilized; bool bStopCoexDm; bool bManualControl; u8 *cliBuf; - struct BTC_STATISTICS statistics; + struct btc_statistics statistics; u8 pwrModeVal[10]; /* function pointers */ @@ -530,28 +530,28 @@ struct BTC_COEXIST { BFP_BTC_SET_BT_REG fBtcSetBtReg; }; -extern struct BTC_COEXIST GLBtCoexist; +extern struct btc_coexist GLBtCoexist; -void EXhalbtcoutsrc_PowerOnSetting(struct BTC_COEXIST *pBtCoexist); -void EXhalbtcoutsrc_InitHwConfig(struct BTC_COEXIST *pBtCoexist, u8 bWifiOnly); -void EXhalbtcoutsrc_InitCoexDm(struct BTC_COEXIST *pBtCoexist); -void EXhalbtcoutsrc_IpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type); -void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type); -void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type); -void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 action); +void EXhalbtcoutsrc_PowerOnSetting(struct btc_coexist *pBtCoexist); +void EXhalbtcoutsrc_InitHwConfig(struct btc_coexist *pBtCoexist, u8 bWifiOnly); +void EXhalbtcoutsrc_InitCoexDm(struct btc_coexist *pBtCoexist); +void EXhalbtcoutsrc_IpsNotify(struct btc_coexist *pBtCoexist, u8 type); +void EXhalbtcoutsrc_LpsNotify(struct btc_coexist *pBtCoexist, u8 type); +void EXhalbtcoutsrc_ScanNotify(struct btc_coexist *pBtCoexist, u8 type); +void EXhalbtcoutsrc_ConnectNotify(struct btc_coexist *pBtCoexist, u8 action); void EXhalbtcoutsrc_MediaStatusNotify( - struct BTC_COEXIST *pBtCoexist, enum rt_media_status mediaStatus + struct btc_coexist *pBtCoexist, enum rt_media_status mediaStatus ); -void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 pktType); +void EXhalbtcoutsrc_SpecialPacketNotify(struct btc_coexist *pBtCoexist, u8 pktType); void EXhalbtcoutsrc_BtInfoNotify( - struct BTC_COEXIST *pBtCoexist, u8 *tmpBuf, u8 length + struct btc_coexist *pBtCoexist, u8 *tmpBuf, u8 length ); -void EXhalbtcoutsrc_HaltNotify(struct BTC_COEXIST *pBtCoexist); -void EXhalbtcoutsrc_PnpNotify(struct BTC_COEXIST *pBtCoexist, u8 pnpState); -void EXhalbtcoutsrc_Periodical(struct BTC_COEXIST *pBtCoexist); +void EXhalbtcoutsrc_HaltNotify(struct btc_coexist *pBtCoexist); +void EXhalbtcoutsrc_PnpNotify(struct btc_coexist *pBtCoexist, u8 pnpState); +void EXhalbtcoutsrc_Periodical(struct btc_coexist *pBtCoexist); void EXhalbtcoutsrc_SetChipType(u8 chipType); void EXhalbtcoutsrc_SetAntNum(u8 type, u8 antNum); void EXhalbtcoutsrc_SetSingleAntPath(u8 singleAntPath); -void EXhalbtcoutsrc_DisplayBtCoexInfo(struct BTC_COEXIST *pBtCoexist); +void EXhalbtcoutsrc_DisplayBtCoexInfo(struct btc_coexist *pBtCoexist); #endif diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c index e524c775307f..e718120457e7 100644 --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c @@ -13,7 +13,7 @@ /* Global variables */ -struct BTC_COEXIST GLBtCoexist; +struct btc_coexist GLBtCoexist; static u8 GLBtcWiFiInScanState; static u8 GLBtcWiFiInIQKState; @@ -67,7 +67,7 @@ void DBG_BT_INFO(u8 *dbgmsg) /* */ /* Debug related function */ /* */ -static u8 halbtcoutsrc_IsBtCoexistAvailable(struct BTC_COEXIST *pBtCoexist) +static u8 halbtcoutsrc_IsBtCoexistAvailable(struct btc_coexist *pBtCoexist) { if (!pBtCoexist->bBinded || !pBtCoexist->Adapter) return false; @@ -101,7 +101,7 @@ static void halbtcoutsrc_DbgInit(void) 0; } -static void halbtcoutsrc_LeaveLps(struct BTC_COEXIST *pBtCoexist) +static void halbtcoutsrc_LeaveLps(struct btc_coexist *pBtCoexist) { struct adapter *padapter; @@ -114,7 +114,7 @@ static void halbtcoutsrc_LeaveLps(struct BTC_COEXIST *pBtCoexist) rtw_btcoex_LPS_Leave(padapter); } -static void halbtcoutsrc_EnterLps(struct BTC_COEXIST *pBtCoexist) +static void halbtcoutsrc_EnterLps(struct btc_coexist *pBtCoexist) { struct adapter *padapter; @@ -127,7 +127,7 @@ static void halbtcoutsrc_EnterLps(struct BTC_COEXIST *pBtCoexist) rtw_btcoex_LPS_Enter(padapter); } -static void halbtcoutsrc_NormalLps(struct BTC_COEXIST *pBtCoexist) +static void halbtcoutsrc_NormalLps(struct btc_coexist *pBtCoexist) { struct adapter *padapter; @@ -149,7 +149,7 @@ static void halbtcoutsrc_NormalLps(struct BTC_COEXIST *pBtCoexist) * Constraint: * 1. this function will request pwrctrl->lock */ -static void halbtcoutsrc_LeaveLowPower(struct BTC_COEXIST *pBtCoexist) +static void halbtcoutsrc_LeaveLowPower(struct btc_coexist *pBtCoexist) { struct adapter *padapter; s32 ready; @@ -184,7 +184,7 @@ static void halbtcoutsrc_LeaveLowPower(struct BTC_COEXIST *pBtCoexist) * Constraint: * 1. this function will request pwrctrl->lock */ -static void halbtcoutsrc_NormalLowPower(struct BTC_COEXIST *pBtCoexist) +static void halbtcoutsrc_NormalLowPower(struct btc_coexist *pBtCoexist) { struct adapter *padapter; @@ -193,7 +193,7 @@ static void halbtcoutsrc_NormalLowPower(struct BTC_COEXIST *pBtCoexist) rtw_unregister_task_alive(padapter, BTCOEX_ALIVE); } -static void halbtcoutsrc_DisableLowPower(struct BTC_COEXIST *pBtCoexist, u8 bLowPwrDisable) +static void halbtcoutsrc_DisableLowPower(struct btc_coexist *pBtCoexist, u8 bLowPwrDisable) { pBtCoexist->btInfo.bBtDisableLowPwr = bLowPwrDisable; if (bLowPwrDisable) @@ -202,7 +202,7 @@ static void halbtcoutsrc_DisableLowPower(struct BTC_COEXIST *pBtCoexist, u8 bLow halbtcoutsrc_NormalLowPower(pBtCoexist); /* original 32k low power behavior. */ } -static void halbtcoutsrc_AggregationCheck(struct BTC_COEXIST *pBtCoexist) +static void halbtcoutsrc_AggregationCheck(struct btc_coexist *pBtCoexist) { struct adapter *padapter; bool bNeedToAct; @@ -280,7 +280,7 @@ static u32 _halbtcoutsrc_GetWifiLinkStatus(struct adapter *padapter) return portConnectedStatus; } -static u32 halbtcoutsrc_GetWifiLinkStatus(struct BTC_COEXIST *pBtCoexist) +static u32 halbtcoutsrc_GetWifiLinkStatus(struct btc_coexist *pBtCoexist) { /* */ /* return value: */ @@ -308,7 +308,7 @@ static u32 halbtcoutsrc_GetWifiLinkStatus(struct BTC_COEXIST *pBtCoexist) return retVal; } -static u32 halbtcoutsrc_GetBtPatchVer(struct BTC_COEXIST *pBtCoexist) +static u32 halbtcoutsrc_GetBtPatchVer(struct btc_coexist *pBtCoexist) { return pBtCoexist->btInfo.btRealFwVer; } @@ -339,7 +339,7 @@ static u8 halbtcoutsrc_GetWifiScanAPNum(struct adapter *padapter) static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; struct adapter *padapter; struct hal_com_data *pHalData; struct mlme_ext_priv *mlmeext; @@ -349,7 +349,7 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf) u8 ret; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return false; @@ -507,14 +507,14 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf) static u8 halbtcoutsrc_Set(void *pBtcContext, u8 setType, void *pInBuf) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; struct adapter *padapter; u8 *pu8; u32 *pU4Tmp; u8 ret; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; padapter = pBtCoexist->Adapter; pu8 = pInBuf; pU4Tmp = pInBuf; @@ -642,7 +642,7 @@ static u8 halbtcoutsrc_Set(void *pBtcContext, u8 setType, void *pInBuf) return ret; } -static void halbtcoutsrc_DisplayFwPwrModeCmd(struct BTC_COEXIST *pBtCoexist) +static void halbtcoutsrc_DisplayFwPwrModeCmd(struct btc_coexist *pBtCoexist) { u8 *cliBuf = pBtCoexist->cliBuf; @@ -658,11 +658,11 @@ static void halbtcoutsrc_DisplayFwPwrModeCmd(struct BTC_COEXIST *pBtCoexist) /* */ static u8 halbtcoutsrc_Read1Byte(void *pBtcContext, u32 RegAddr) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; struct adapter *padapter; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; padapter = pBtCoexist->Adapter; return rtw_read8(padapter, RegAddr); @@ -670,11 +670,11 @@ static u8 halbtcoutsrc_Read1Byte(void *pBtcContext, u32 RegAddr) static u16 halbtcoutsrc_Read2Byte(void *pBtcContext, u32 RegAddr) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; struct adapter *padapter; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; padapter = pBtCoexist->Adapter; return rtw_read16(padapter, RegAddr); @@ -682,11 +682,11 @@ static u16 halbtcoutsrc_Read2Byte(void *pBtcContext, u32 RegAddr) static u32 halbtcoutsrc_Read4Byte(void *pBtcContext, u32 RegAddr) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; struct adapter *padapter; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; padapter = pBtCoexist->Adapter; return rtw_read32(padapter, RegAddr); @@ -694,11 +694,11 @@ static u32 halbtcoutsrc_Read4Byte(void *pBtcContext, u32 RegAddr) static void halbtcoutsrc_Write1Byte(void *pBtcContext, u32 RegAddr, u8 Data) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; struct adapter *padapter; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; padapter = pBtCoexist->Adapter; rtw_write8(padapter, RegAddr, Data); @@ -706,13 +706,13 @@ static void halbtcoutsrc_Write1Byte(void *pBtcContext, u32 RegAddr, u8 Data) static void halbtcoutsrc_BitMaskWrite1Byte(void *pBtcContext, u32 regAddr, u8 bitMask, u8 data1b) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; struct adapter *padapter; u8 originalValue, bitShift; u8 i; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; padapter = pBtCoexist->Adapter; originalValue = 0; bitShift = 0; @@ -734,11 +734,11 @@ static void halbtcoutsrc_BitMaskWrite1Byte(void *pBtcContext, u32 regAddr, u8 bi static void halbtcoutsrc_Write2Byte(void *pBtcContext, u32 RegAddr, u16 Data) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; struct adapter *padapter; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; padapter = pBtCoexist->Adapter; rtw_write16(padapter, RegAddr, Data); @@ -746,11 +746,11 @@ static void halbtcoutsrc_Write2Byte(void *pBtcContext, u32 RegAddr, u16 Data) static void halbtcoutsrc_Write4Byte(void *pBtcContext, u32 RegAddr, u32 Data) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; struct adapter *padapter; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; padapter = pBtCoexist->Adapter; rtw_write32(padapter, RegAddr, Data); @@ -758,7 +758,7 @@ static void halbtcoutsrc_Write4Byte(void *pBtcContext, u32 RegAddr, u32 Data) static void halbtcoutsrc_WriteLocalReg1Byte(void *pBtcContext, u32 RegAddr, u8 Data) { - struct BTC_COEXIST *pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + struct btc_coexist *pBtCoexist = (struct btc_coexist *)pBtcContext; struct adapter *Adapter = pBtCoexist->Adapter; if (BTC_INTF_SDIO == pBtCoexist->chipInterface) @@ -769,11 +769,11 @@ static void halbtcoutsrc_WriteLocalReg1Byte(void *pBtcContext, u32 RegAddr, u8 D static void halbtcoutsrc_SetBbReg(void *pBtcContext, u32 RegAddr, u32 BitMask, u32 Data) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; struct adapter *padapter; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; padapter = pBtCoexist->Adapter; PHY_SetBBReg(padapter, RegAddr, BitMask, Data); @@ -782,11 +782,11 @@ static void halbtcoutsrc_SetBbReg(void *pBtcContext, u32 RegAddr, u32 BitMask, u static u32 halbtcoutsrc_GetBbReg(void *pBtcContext, u32 RegAddr, u32 BitMask) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; struct adapter *padapter; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; padapter = pBtCoexist->Adapter; return PHY_QueryBBReg(padapter, RegAddr, BitMask); @@ -794,11 +794,11 @@ static u32 halbtcoutsrc_GetBbReg(void *pBtcContext, u32 RegAddr, u32 BitMask) static void halbtcoutsrc_SetRfReg(void *pBtcContext, u8 eRFPath, u32 RegAddr, u32 BitMask, u32 Data) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; struct adapter *padapter; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; padapter = pBtCoexist->Adapter; PHY_SetRFReg(padapter, eRFPath, RegAddr, BitMask, Data); @@ -806,11 +806,11 @@ static void halbtcoutsrc_SetRfReg(void *pBtcContext, u8 eRFPath, u32 RegAddr, u3 static u32 halbtcoutsrc_GetRfReg(void *pBtcContext, u8 eRFPath, u32 RegAddr, u32 BitMask) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; struct adapter *padapter; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; padapter = pBtCoexist->Adapter; return PHY_QueryRFReg(padapter, eRFPath, RegAddr, BitMask); @@ -818,7 +818,7 @@ static u32 halbtcoutsrc_GetRfReg(void *pBtcContext, u8 eRFPath, u32 RegAddr, u32 static void halbtcoutsrc_SetBtReg(void *pBtcContext, u8 RegType, u32 RegAddr, u32 Data) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; struct adapter *padapter; u8 CmdBuffer1[4] = {0}; u8 CmdBuffer2[4] = {0}; @@ -827,7 +827,7 @@ static void halbtcoutsrc_SetBtReg(void *pBtcContext, u8 RegType, u32 RegAddr, u3 u8 OperVer = 0; u8 ReqNum = 0; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; padapter = pBtCoexist->Adapter; CmdBuffer1[0] |= (OperVer & 0x0f); /* Set OperVer */ @@ -854,11 +854,11 @@ static u32 halbtcoutsrc_GetBtReg(void *pBtcContext, u8 RegType, u32 RegAddr) static void halbtcoutsrc_FillH2cCmd(void *pBtcContext, u8 elementId, u32 cmdLen, u8 *pCmdBuffer) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; struct adapter *padapter; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; padapter = pBtCoexist->Adapter; rtw_hal_fill_h2c_cmd(padapter, elementId, cmdLen, pCmdBuffer); @@ -866,10 +866,10 @@ static void halbtcoutsrc_FillH2cCmd(void *pBtcContext, u8 elementId, u32 cmdLen, static void halbtcoutsrc_DisplayDbgMsg(void *pBtcContext, u8 dispType) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; - pBtCoexist = (struct BTC_COEXIST *)pBtcContext; + pBtCoexist = (struct btc_coexist *)pBtcContext; switch (dispType) { case BTC_DBG_DISP_COEX_STATISTICS: break; @@ -888,7 +888,7 @@ static void halbtcoutsrc_DisplayDbgMsg(void *pBtcContext, u8 dispType) /* */ static u8 EXhalbtcoutsrc_BindBtCoexWithAdapter(void *padapter) { - struct BTC_COEXIST *pBtCoexist = &GLBtCoexist; + struct btc_coexist *pBtCoexist = &GLBtCoexist; if (pBtCoexist->bBinded) return false; @@ -914,7 +914,7 @@ static u8 EXhalbtcoutsrc_BindBtCoexWithAdapter(void *padapter) void hal_btcoex_Initialize(void *padapter) { - struct BTC_COEXIST *pBtCoexist; + struct btc_coexist *pBtCoexist; memset(&GLBtCoexist, 0, sizeof(GLBtCoexist)); @@ -960,7 +960,7 @@ void hal_btcoex_Initialize(void *padapter) GLBtcWiFiInIQKState = false; } -void EXhalbtcoutsrc_PowerOnSetting(struct BTC_COEXIST *pBtCoexist) +void EXhalbtcoutsrc_PowerOnSetting(struct btc_coexist *pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -972,7 +972,7 @@ void EXhalbtcoutsrc_PowerOnSetting(struct BTC_COEXIST *pBtCoexist) EXhalbtc8723b1ant_PowerOnSetting(pBtCoexist); } -void EXhalbtcoutsrc_InitHwConfig(struct BTC_COEXIST *pBtCoexist, u8 bWifiOnly) +void EXhalbtcoutsrc_InitHwConfig(struct btc_coexist *pBtCoexist, u8 bWifiOnly) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -985,7 +985,7 @@ void EXhalbtcoutsrc_InitHwConfig(struct BTC_COEXIST *pBtCoexist, u8 bWifiOnly) EXhalbtc8723b1ant_InitHwConfig(pBtCoexist, bWifiOnly); } -void EXhalbtcoutsrc_InitCoexDm(struct BTC_COEXIST *pBtCoexist) +void EXhalbtcoutsrc_InitCoexDm(struct btc_coexist *pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -1000,7 +1000,7 @@ void EXhalbtcoutsrc_InitCoexDm(struct BTC_COEXIST *pBtCoexist) pBtCoexist->bInitilized = true; } -void EXhalbtcoutsrc_IpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) +void EXhalbtcoutsrc_IpsNotify(struct btc_coexist *pBtCoexist, u8 type) { u8 ipsType; @@ -1027,7 +1027,7 @@ void EXhalbtcoutsrc_IpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) +void EXhalbtcoutsrc_LpsNotify(struct btc_coexist *pBtCoexist, u8 type) { u8 lpsType; @@ -1050,7 +1050,7 @@ void EXhalbtcoutsrc_LpsNotify(struct BTC_COEXIST *pBtCoexist, u8 type) EXhalbtc8723b1ant_LpsNotify(pBtCoexist, lpsType); } -void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type) +void EXhalbtcoutsrc_ScanNotify(struct btc_coexist *pBtCoexist, u8 type) { u8 scanType; @@ -1079,7 +1079,7 @@ void EXhalbtcoutsrc_ScanNotify(struct BTC_COEXIST *pBtCoexist, u8 type) /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 action) +void EXhalbtcoutsrc_ConnectNotify(struct btc_coexist *pBtCoexist, u8 action) { u8 assoType; @@ -1105,7 +1105,7 @@ void EXhalbtcoutsrc_ConnectNotify(struct BTC_COEXIST *pBtCoexist, u8 action) /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_MediaStatusNotify(struct BTC_COEXIST *pBtCoexist, enum +void EXhalbtcoutsrc_MediaStatusNotify(struct btc_coexist *pBtCoexist, enum rt_media_status mediaStatus) { u8 mStatus; @@ -1133,7 +1133,7 @@ void EXhalbtcoutsrc_MediaStatusNotify(struct BTC_COEXIST *pBtCoexist, enum /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 pktType) +void EXhalbtcoutsrc_SpecialPacketNotify(struct btc_coexist *pBtCoexist, u8 pktType) { u8 packetType; @@ -1164,7 +1164,7 @@ void EXhalbtcoutsrc_SpecialPacketNotify(struct BTC_COEXIST *pBtCoexist, u8 pktTy /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_BtInfoNotify(struct BTC_COEXIST *pBtCoexist, u8 *tmpBuf, u8 length) +void EXhalbtcoutsrc_BtInfoNotify(struct btc_coexist *pBtCoexist, u8 *tmpBuf, u8 length) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -1182,7 +1182,7 @@ void EXhalbtcoutsrc_BtInfoNotify(struct BTC_COEXIST *pBtCoexist, u8 *tmpBuf, u8 /* halbtcoutsrc_NormalLowPower(pBtCoexist); */ } -void EXhalbtcoutsrc_HaltNotify(struct BTC_COEXIST *pBtCoexist) +void EXhalbtcoutsrc_HaltNotify(struct btc_coexist *pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -1195,7 +1195,7 @@ void EXhalbtcoutsrc_HaltNotify(struct BTC_COEXIST *pBtCoexist) pBtCoexist->bBinded = false; } -void EXhalbtcoutsrc_PnpNotify(struct BTC_COEXIST *pBtCoexist, u8 pnpState) +void EXhalbtcoutsrc_PnpNotify(struct btc_coexist *pBtCoexist, u8 pnpState) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -1211,7 +1211,7 @@ void EXhalbtcoutsrc_PnpNotify(struct BTC_COEXIST *pBtCoexist, u8 pnpState) EXhalbtc8723b2ant_PnpNotify(pBtCoexist, pnpState); } -void EXhalbtcoutsrc_Periodical(struct BTC_COEXIST *pBtCoexist) +void EXhalbtcoutsrc_Periodical(struct btc_coexist *pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -1256,7 +1256,7 @@ void EXhalbtcoutsrc_SetSingleAntPath(u8 singleAntPath) GLBtCoexist.boardInfo.singleAntPath = singleAntPath; } -void EXhalbtcoutsrc_DisplayBtCoexInfo(struct BTC_COEXIST *pBtCoexist) +void EXhalbtcoutsrc_DisplayBtCoexInfo(struct btc_coexist *pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:23 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:23 +0100 Subject: [PATCH 36/43] Staging: rtl8723bs: fix names in odm_DIG.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-37-marcocesati@gmail.com> This commit converts names of structs / enums in hal/odm_DIG.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/hal_com.c | 2 +- drivers/staging/rtl8723bs/hal/odm.c | 2 +- drivers/staging/rtl8723bs/hal/odm.h | 2 +- drivers/staging/rtl8723bs/hal/odm_DIG.c | 12 ++++++------ drivers/staging/rtl8723bs/hal/odm_DIG.h | 4 ++-- drivers/staging/rtl8723bs/hal/rtl8723b_dm.c | 2 +- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 1e66f749fd40..3d2120f0d843 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -1170,7 +1170,7 @@ u8 SetHalDefVar( odm->SupportAbility &= (~DYNAMIC_BB_ANT_DIV); } else if (dm_func == 6) {/* turn on all dynamic func */ if (!(odm->SupportAbility & DYNAMIC_BB_DIG)) { - struct DIG_T *pDigTable = &odm->DM_DigTable; + struct dig_t *pDigTable = &odm->DM_DigTable; pDigTable->CurIGValue = rtw_read8(adapter, 0xc50); } dm->DMFlag |= DYNAMIC_FUNC_BT; diff --git a/drivers/staging/rtl8723bs/hal/odm.c b/drivers/staging/rtl8723bs/hal/odm.c index c7607e7d26c5..3e5f6623971b 100644 --- a/drivers/staging/rtl8723bs/hal/odm.c +++ b/drivers/staging/rtl8723bs/hal/odm.c @@ -417,7 +417,7 @@ void ODM_DMWatchdog(struct DM_ODM_T *pDM_Odm) odm_DIG(pDM_Odm); { - struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; + struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; odm_Adaptivity(pDM_Odm, pDM_DigTable->CurIGValue); } diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h index 80683d3fb80f..1dda34ffdad3 100644 --- a/drivers/staging/rtl8723bs/hal/odm.h +++ b/drivers/staging/rtl8723bs/hal/odm.h @@ -1110,7 +1110,7 @@ struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ /* ODM Structure */ /* */ struct FAT_T DM_FatTable; - struct DIG_T DM_DigTable; + struct dig_t DM_DigTable; struct PS_T DM_PSTable; struct dynamic_primary_CCA DM_PriCCA; struct RXHP_T DM_RXHP_Table; diff --git a/drivers/staging/rtl8723bs/hal/odm_DIG.c b/drivers/staging/rtl8723bs/hal/odm_DIG.c index eca34f45aaa3..aa185d5a3251 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DIG.c +++ b/drivers/staging/rtl8723bs/hal/odm_DIG.c @@ -323,7 +323,7 @@ void odm_Adaptivity(void *pDM_VOID, u8 IGI) void ODM_Write_DIG(void *pDM_VOID, u8 CurrentIGI) { struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; + struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; if (pDM_DigTable->bStopDIG) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("Stop Writing IGI\n")); @@ -363,7 +363,7 @@ void odm_PauseDIG( ) { struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; + struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; static bool bPaused; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG() =========>\n")); @@ -467,7 +467,7 @@ bool odm_DigAbort(void *pDM_VOID) void odm_DIGInit(void *pDM_VOID) { struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; + struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; pDM_DigTable->bStopDIG = false; pDM_DigTable->bPSDInProgress = false; @@ -507,7 +507,7 @@ void odm_DIG(void *pDM_VOID) struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; /* Common parameters */ - struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; + struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; struct false_ALARM_STATISTICS *pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; bool FirstConnect, FirstDisConnect; u8 DIG_MaxOfMin, DIG_Dynamic_MIN; @@ -1079,7 +1079,7 @@ void odm_FAThresholdCheck( u8 odm_ForbiddenIGICheck(void *pDM_VOID, u8 DIG_Dynamic_MIN, u8 CurrentIGI) { struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; + struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; struct false_ALARM_STATISTICS *pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; u8 rx_gain_range_min = pDM_DigTable->rx_gain_range_min; @@ -1196,7 +1196,7 @@ void odm_CCKPacketDetectionThresh(void *pDM_VOID) void ODM_Write_CCK_CCA_Thres(void *pDM_VOID, u8 CurCCK_CCAThres) { struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; + struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; /* modify by Guo.Mingzhi 2012-01-03 */ if (pDM_DigTable->CurCCK_CCAThres != CurCCK_CCAThres) diff --git a/drivers/staging/rtl8723bs/hal/odm_DIG.h b/drivers/staging/rtl8723bs/hal/odm_DIG.h index 5a1900d1e8d1..20d4b88da9ff 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DIG.h +++ b/drivers/staging/rtl8723bs/hal/odm_DIG.h @@ -8,7 +8,7 @@ #ifndef __ODMDIG_H__ #define __ODMDIG_H__ -struct DIG_T { /* _Dynamic_Initial_Gain_Threshold_ */ +struct dig_t { /* _Dynamic_Initial_Gain_Threshold_ */ bool bStopDIG; bool bPSDInProgress; @@ -77,7 +77,7 @@ struct false_ALARM_STATISTICS { u32 Cnt_BW_LSC; /* Gary */ }; -enum DM_DIG_OP_E { /* tag_Dynamic_Init_Gain_Operation_Type_Definition */ +enum dm_dig_op_e { /* tag_Dynamic_Init_Gain_Operation_Type_Definition */ DIG_TYPE_THRESH_HIGH = 0, DIG_TYPE_THRESH_LOW = 1, DIG_TYPE_BACKOFF = 2, diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c index a584615556d4..f851efaadae5 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c @@ -227,7 +227,7 @@ void rtl8723b_HalDmWatchDog_in_LPS(struct adapter *Adapter) struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; - struct DIG_T *pDM_DigTable = &pDM_Odm->DM_DigTable; + struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; struct sta_priv *pstapriv = &Adapter->stapriv; struct sta_info *psta = NULL; diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index e0b5a608ec97..29894252c73c 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -4047,7 +4047,7 @@ void SetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val) case HW_VAR_INITIAL_GAIN: { - struct DIG_T *pDigTable = &pHalData->odmpriv.DM_DigTable; + struct dig_t *pDigTable = &pHalData->odmpriv.DM_DigTable; u32 rx_gain = *(u32 *)val; if (rx_gain == 0xff) {/* restore rx gain */ -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:24 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:24 +0100 Subject: [PATCH 37/43] Staging: rtl8723bs: fix names in hal_btcoex.c In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-38-marcocesati@gmail.com> This commit converts names of structs / enums in hal/hal_btcoex.c from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c index e718120457e7..d42cc24c7535 100644 --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c @@ -20,22 +20,22 @@ static u8 GLBtcWiFiInIQKState; u32 GLBtcDbgType[BTC_MSG_MAX]; static u8 GLBtcDbgBuf[BT_TMP_BUF_SIZE]; -struct BTCDBGINFO { /* _btcoexdbginfo */ +struct btcdbginfo { /* _btcoexdbginfo */ u8 *info; u32 size; /* buffer total size */ u32 len; /* now used length */ }; -static struct BTCDBGINFO GLBtcDbgInfo; +static struct btcdbginfo GLBtcDbgInfo; #define BT_Operation(Adapter) false -static void DBG_BT_INFO_INIT(struct BTCDBGINFO *pinfo, u8 *pbuf, u32 size) +static void DBG_BT_INFO_INIT(struct btcdbginfo *pinfo, u8 *pbuf, u32 size) { if (!pinfo) return; - memset(pinfo, 0, sizeof(struct BTCDBGINFO)); + memset(pinfo, 0, sizeof(struct btcdbginfo)); if (pbuf && size) { pinfo->info = pbuf; @@ -45,7 +45,7 @@ static void DBG_BT_INFO_INIT(struct BTCDBGINFO *pinfo, u8 *pbuf, u32 size) void DBG_BT_INFO(u8 *dbgmsg) { - struct BTCDBGINFO *pinfo; + struct btcdbginfo *pinfo; u32 msglen; u8 *pbuf; @@ -1490,7 +1490,7 @@ void hal_btcoex_RecordPwrMode(struct adapter *padapter, u8 *pCmdBuf, u8 cmdLen) void hal_btcoex_DisplayBtCoexInfo(struct adapter *padapter, u8 *pbuf, u32 bufsize) { - struct BTCDBGINFO *pinfo; + struct btcdbginfo *pinfo; pinfo = &GLBtcDbgInfo; -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:26 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:26 +0100 Subject: [PATCH 39/43] Staging: rtl8723bs: fix names in HalPhyRf.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-40-marcocesati@gmail.com> This commit converts names of structs / enums in hal/HalPhyRf.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalPhyRf.c | 4 ++-- drivers/staging/rtl8723bs/hal/HalPhyRf.h | 10 +++++----- drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c | 4 ++-- drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf.c b/drivers/staging/rtl8723bs/hal/HalPhyRf.c index 08064fd1d941..9599c45997bb 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf.c +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf.c @@ -23,7 +23,7 @@ } while (0) -void ConfigureTxpowerTrack(struct DM_ODM_T *pDM_Odm, struct TXPWRTRACK_CFG *pConfig) +void ConfigureTxpowerTrack(struct DM_ODM_T *pDM_Odm, struct txpwrtrack_cfg *pConfig) { ConfigureTxpowerTrack_8723B(pConfig); } @@ -83,7 +83,7 @@ void ODM_TXPowerTrackingCallback_ThermalMeter(struct adapter *Adapter) u8 OFDM_min_index = 0; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */ u8 Indexforchannel = 0; /* GetRightChnlPlaceforIQK(pHalData->CurrentChannel) */ - struct TXPWRTRACK_CFG c; + struct txpwrtrack_cfg c; /* 4 1. The following TWO tables decide the final index of OFDM/CCK swing table. */ diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf.h b/drivers/staging/rtl8723bs/hal/HalPhyRf.h index eaa5bd2811a1..5a07f3c14d80 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf.h +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf.h @@ -8,23 +8,23 @@ #ifndef __HAL_PHY_RF_H__ #define __HAL_PHY_RF_H__ -enum SPUR_CAL_METHOD { +enum spur_cal_method { PLL_RESET, AFE_PHASE_SEL }; -enum PWRTRACK_METHOD { +enum pwrtrack_method { BBSWING, TXAGC, MIX_MODE }; -typedef void (*FuncSetPwr)(struct DM_ODM_T *, enum PWRTRACK_METHOD, u8, u8); +typedef void (*FuncSetPwr)(struct DM_ODM_T *, enum pwrtrack_method, u8, u8); typedef void (*FuncIQK)(struct DM_ODM_T *, u8, u8, u8); typedef void (*FuncLCK)(struct DM_ODM_T *); typedef void (*FuncSwing)(struct DM_ODM_T *, u8 **, u8 **, u8 **, u8 **); -struct TXPWRTRACK_CFG { +struct txpwrtrack_cfg { u8 SwingTableSize_CCK; u8 SwingTableSize_OFDM; u8 Threshold_IQK; @@ -37,7 +37,7 @@ struct TXPWRTRACK_CFG { FuncSwing GetDeltaSwingTable; }; -void ConfigureTxpowerTrack(struct DM_ODM_T *pDM_Odm, struct TXPWRTRACK_CFG *pConfig); +void ConfigureTxpowerTrack(struct DM_ODM_T *pDM_Odm, struct txpwrtrack_cfg *pConfig); void ODM_ClearTxPowerTrackingState(struct DM_ODM_T *pDM_Odm); diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c index 50aabed8ace6..30cbe125eb4c 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c @@ -186,7 +186,7 @@ void DoIQK_8723B( *---------------------------------------------------------------------------*/ void ODM_TxPwrTrackSetPwr_8723B( struct DM_ODM_T *pDM_Odm, - enum PWRTRACK_METHOD Method, + enum pwrtrack_method Method, u8 RFPath, u8 ChannelMappedIndex ) @@ -409,7 +409,7 @@ static void GetDeltaSwingTable_8723B( } -void ConfigureTxpowerTrack_8723B(struct TXPWRTRACK_CFG *pConfig) +void ConfigureTxpowerTrack_8723B(struct txpwrtrack_cfg *pConfig) { pConfig->SwingTableSize_CCK = CCK_TABLE_SIZE; pConfig->SwingTableSize_OFDM = OFDM_TABLE_SIZE; diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h index 5cd65a7cfebc..7b009b11540c 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h @@ -16,7 +16,7 @@ #define RF_T_METER_8723B 0x42 /* */ -void ConfigureTxpowerTrack_8723B(struct TXPWRTRACK_CFG *pConfig); +void ConfigureTxpowerTrack_8723B(struct txpwrtrack_cfg *pConfig); void DoIQK_8723B( struct DM_ODM_T *pDM_Odm, @@ -27,7 +27,7 @@ void DoIQK_8723B( void ODM_TxPwrTrackSetPwr_8723B( struct DM_ODM_T *pDM_Odm, - enum PWRTRACK_METHOD Method, + enum pwrtrack_method Method, u8 RFPath, u8 ChannelMappedIndex ); -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:25 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:25 +0100 Subject: [PATCH 38/43] Staging: rtl8723bs: fix names in odm_CfoTracking.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-39-marcocesati@gmail.com> This commit converts names of structs / enums in hal/odm_CfoTracking.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm.h | 2 +- drivers/staging/rtl8723bs/hal/odm_CfoTracking.c | 12 ++++++------ drivers/staging/rtl8723bs/hal/odm_CfoTracking.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h index 1dda34ffdad3..932a5b357877 100644 --- a/drivers/staging/rtl8723bs/hal/odm.h +++ b/drivers/staging/rtl8723bs/hal/odm.h @@ -1119,7 +1119,7 @@ struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ struct false_ALARM_STATISTICS FlaseAlmCntBuddyAdapter; struct SWAT_T DM_SWAT_Table; bool RSSI_test; - struct CFO_TRACKING DM_CfoTrack; + struct cfo_tracking DM_CfoTrack; struct edca_t DM_EDCA_Table; u32 WMMEDCA_BE; diff --git a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c index fc059822edd9..edfdd9101008 100644 --- a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c +++ b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c @@ -10,7 +10,7 @@ static void odm_SetCrystalCap(void *pDM_VOID, u8 CrystalCap) { struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct CFO_TRACKING *pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct cfo_tracking *pCfoTrack = &pDM_Odm->DM_CfoTrack; if (pCfoTrack->CrystalCap == CrystalCap) return; @@ -50,7 +50,7 @@ static u8 odm_GetDefaultCrytaltalCap(void *pDM_VOID) static void odm_SetATCStatus(void *pDM_VOID, bool ATCStatus) { struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct CFO_TRACKING *pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct cfo_tracking *pCfoTrack = &pDM_Odm->DM_CfoTrack; if (pCfoTrack->bATCStatus == ATCStatus) return; @@ -80,7 +80,7 @@ static bool odm_GetATCStatus(void *pDM_VOID) void ODM_CfoTrackingReset(void *pDM_VOID) { struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct CFO_TRACKING *pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct cfo_tracking *pCfoTrack = &pDM_Odm->DM_CfoTrack; pCfoTrack->DefXCap = odm_GetDefaultCrytaltalCap(pDM_Odm); pCfoTrack->bAdjust = true; @@ -92,7 +92,7 @@ void ODM_CfoTrackingReset(void *pDM_VOID) void ODM_CfoTrackingInit(void *pDM_VOID) { struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct CFO_TRACKING *pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct cfo_tracking *pCfoTrack = &pDM_Odm->DM_CfoTrack; pCfoTrack->DefXCap = pCfoTrack->CrystalCap = odm_GetDefaultCrytaltalCap(pDM_Odm); @@ -119,7 +119,7 @@ void ODM_CfoTrackingInit(void *pDM_VOID) void ODM_CfoTracking(void *pDM_VOID) { struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; - struct CFO_TRACKING *pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct cfo_tracking *pCfoTrack = &pDM_Odm->DM_CfoTrack; int CFO_kHz_A, CFO_kHz_B, CFO_ave = 0; int CFO_ave_diff; int CrystalCap = (int)pCfoTrack->CrystalCap; @@ -299,7 +299,7 @@ void ODM_ParsingCFO(void *pDM_VOID, void *pPktinfo_VOID, s8 *pcfotail) { struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; struct odm_packet_info *pPktinfo = pPktinfo_VOID; - struct CFO_TRACKING *pCfoTrack = &pDM_Odm->DM_CfoTrack; + struct cfo_tracking *pCfoTrack = &pDM_Odm->DM_CfoTrack; u8 i; if (!(pDM_Odm->SupportAbility & ODM_BB_CFO_TRACKING)) diff --git a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.h b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.h index 3c4e286436b8..bb00d8c893bd 100644 --- a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.h +++ b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.h @@ -12,7 +12,7 @@ #define CFO_TH_XTAL_LOW 10 /* kHz */ #define CFO_TH_ATC 80 /* kHz */ -struct CFO_TRACKING { +struct cfo_tracking { bool bATCStatus; bool largeCFOHit; bool bAdjust; -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:28 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:28 +0100 Subject: [PATCH 41/43] Staging: rtl8723bs: fix in odm_DynamicBBPowerSaving.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-42-marcocesati@gmail.com> This commit converts names of structs / enums in hal/odm_DynamicBBPowerSaving.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm.h | 2 +- drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c | 4 ++-- drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h index e2dd8c34c569..ec6e32ec20de 100644 --- a/drivers/staging/rtl8723bs/hal/odm.h +++ b/drivers/staging/rtl8723bs/hal/odm.h @@ -1111,7 +1111,7 @@ struct dm_odm_t { /* DM_Out_Source_Dynamic_Mechanism_Structure */ /* */ struct fat_t DM_FatTable; struct dig_t DM_DigTable; - struct PS_T DM_PSTable; + struct ps_t DM_PSTable; struct dynamic_primary_CCA DM_PriCCA; struct rxhp_t dM_RXHP_Table; struct ra_t DM_RA_Table; diff --git a/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c b/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c index d12f4841114c..57c5736527d2 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c +++ b/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c @@ -10,7 +10,7 @@ void odm_DynamicBBPowerSavingInit(void *pDM_VOID) { struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; - struct PS_T *pDM_PSTable = &pDM_Odm->DM_PSTable; + struct ps_t *pDM_PSTable = &pDM_Odm->DM_PSTable; pDM_PSTable->PreCCAState = CCA_MAX; pDM_PSTable->CurCCAState = CCA_MAX; @@ -23,7 +23,7 @@ void odm_DynamicBBPowerSavingInit(void *pDM_VOID) void ODM_RF_Saving(void *pDM_VOID, u8 bForceInNormal) { struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; - struct PS_T *pDM_PSTable = &pDM_Odm->DM_PSTable; + struct ps_t *pDM_PSTable = &pDM_Odm->DM_PSTable; u8 Rssi_Up_bound = 30; u8 Rssi_Low_bound = 25; diff --git a/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.h b/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.h index 90b9c7659084..3ebbbfd1dd1f 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.h +++ b/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.h @@ -8,7 +8,7 @@ #ifndef __ODMDYNAMICBBPOWERSAVING_H__ #define __ODMDYNAMICBBPOWERSAVING_H__ -struct PS_T { /* _Dynamic_Power_Saving_ */ +struct ps_t { /* _Dynamic_Power_Saving_ */ u8 PreCCAState; u8 CurCCAState; -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:29 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:29 +0100 Subject: [PATCH 42/43] Staging: rtl8723bs: fix names in odm_NoiseMonitor.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-43-marcocesati@gmail.com> This commit converts names of structs / enums in hal/odm_NoiseMonitor.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/odm.h | 2 +- drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h index ec6e32ec20de..3c8d76e42c99 100644 --- a/drivers/staging/rtl8723bs/hal/odm.h +++ b/drivers/staging/rtl8723bs/hal/odm.h @@ -1076,7 +1076,7 @@ struct dm_odm_t { /* DM_Out_Source_Dynamic_Mechanism_Structure */ u8 Adaptivity_IGI_upper; u8 NHM_cnt_0; - struct ODM_NOISE_MONITOR noise_level;/* ODM_MAX_CHANNEL_NUM]; */ + struct odm_noise_monitor noise_level;/* ODM_MAX_CHANNEL_NUM]; */ /* */ /* 2 Define STA info. */ /* _ODM_STA_INFO */ diff --git a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.h b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.h index 0eb55d785c7f..ab114543f39c 100644 --- a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.h +++ b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.h @@ -24,7 +24,7 @@ struct noise_level { }; -struct ODM_NOISE_MONITOR { +struct odm_noise_monitor { s8 noise[MAX_RF_PATH]; s16 noise_all; }; -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:30 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:30 +0100 Subject: [PATCH 43/43] Staging: rtl8723bs: fix names in HalBtc8723b2Ant.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-44-marcocesati@gmail.com> This commit converts names of structs / enums in hal/HalBtc8723b2Ant.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c | 8 ++++---- drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c index 0e1aa204c099..6edaefa47af1 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c @@ -15,10 +15,10 @@ do { \ } while (0) /* Global variables, these are static variables */ -static struct COEX_DM_8723B_2ANT GLCoexDm8723b2Ant; -static struct COEX_DM_8723B_2ANT *pCoexDm = &GLCoexDm8723b2Ant; -static struct COEX_STA_8723B_2ANT GLCoexSta8723b2Ant; -static struct COEX_STA_8723B_2ANT *pCoexSta = &GLCoexSta8723b2Ant; +static struct coex_dm_8723b_2ant GLCoexDm8723b2Ant; +static struct coex_dm_8723b_2ant *pCoexDm = &GLCoexDm8723b2Ant; +static struct coex_sta_8723b_2ant GLCoexSta8723b2Ant; +static struct coex_sta_8723b_2ant *pCoexSta = &GLCoexSta8723b2Ant; static const char *const GLBtInfoSrc8723b2Ant[] = { "BT Info[wifi fw]", diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h index 340444017327..1c220257e2e4 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h @@ -16,14 +16,14 @@ #define BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT 2 -enum BT_INFO_SRC_8723B_2ANT { +enum bt_info_src_8723b_2ant { BT_INFO_SRC_8723B_2ANT_WIFI_FW = 0x0, BT_INFO_SRC_8723B_2ANT_BT_RSP = 0x1, BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND = 0x2, BT_INFO_SRC_8723B_2ANT_MAX }; -enum BT_8723B_2ANT_BT_STATUS { +enum bt_8723b_2ant_bt_status { BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0, BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1, BT_8723B_2ANT_BT_STATUS_INQ_PAGE = 0x2, @@ -33,7 +33,7 @@ enum BT_8723B_2ANT_BT_STATUS { BT_8723B_2ANT_BT_STATUS_MAX }; -enum BT_8723B_2ANT_COEX_ALGO { +enum bt_8723b_2ant_coex_algo { BT_8723B_2ANT_COEX_ALGO_UNDEFINED = 0x0, BT_8723B_2ANT_COEX_ALGO_SCO = 0x1, BT_8723B_2ANT_COEX_ALGO_HID = 0x2, @@ -48,7 +48,7 @@ enum BT_8723B_2ANT_COEX_ALGO { BT_8723B_2ANT_COEX_ALGO_MAX = 0xb, }; -struct COEX_DM_8723B_2ANT { +struct coex_dm_8723b_2ant { /* fw mechanism */ u8 preBtDecPwrLvl; u8 curBtDecPwrLvl; @@ -101,7 +101,7 @@ struct COEX_DM_8723B_2ANT { u32 backup0x948; }; -struct COEX_STA_8723B_2ANT { +struct coex_sta_8723b_2ant { bool bBtLinkExist; bool bScoExist; bool bA2dpExist; -- 2.30.2 From marcocesati at gmail.com Wed Mar 17 22:21:27 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Wed, 17 Mar 2021 23:21:27 +0100 Subject: [PATCH 40/43] Staging: rtl8723bs: fix names in odm.h In-Reply-To: <20210317222130.29528-1-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> Message-ID: <20210317222130.29528-41-marcocesati@gmail.com> This commit converts names of structs / enums in hal/odm.h from ALL_CAPS format to lowercase Signed-off-by: Marco Cesati --- drivers/staging/rtl8723bs/core/rtw_odm.c | 6 +- .../staging/rtl8723bs/hal/HalHWImg8723B_BB.c | 10 +- .../staging/rtl8723bs/hal/HalHWImg8723B_BB.h | 6 +- .../staging/rtl8723bs/hal/HalHWImg8723B_MAC.c | 6 +- .../staging/rtl8723bs/hal/HalHWImg8723B_MAC.h | 2 +- .../staging/rtl8723bs/hal/HalHWImg8723B_RF.c | 12 +- .../staging/rtl8723bs/hal/HalHWImg8723B_RF.h | 6 +- drivers/staging/rtl8723bs/hal/HalPhyRf.c | 6 +- drivers/staging/rtl8723bs/hal/HalPhyRf.h | 12 +- .../staging/rtl8723bs/hal/HalPhyRf_8723B.c | 52 +++---- .../staging/rtl8723bs/hal/HalPhyRf_8723B.h | 8 +- drivers/staging/rtl8723bs/hal/hal_com.c | 10 +- .../staging/rtl8723bs/hal/hal_com_phycfg.c | 6 +- drivers/staging/rtl8723bs/hal/odm.c | 100 ++++++------- drivers/staging/rtl8723bs/hal/odm.h | 140 +++++++++--------- .../staging/rtl8723bs/hal/odm_CfoTracking.c | 16 +- drivers/staging/rtl8723bs/hal/odm_DIG.c | 40 ++--- .../rtl8723bs/hal/odm_DynamicBBPowerSaving.c | 4 +- .../rtl8723bs/hal/odm_DynamicTxPower.c | 2 +- .../rtl8723bs/hal/odm_EdcaTurboCheck.c | 6 +- drivers/staging/rtl8723bs/hal/odm_HWConfig.c | 18 +-- drivers/staging/rtl8723bs/hal/odm_HWConfig.h | 14 +- .../staging/rtl8723bs/hal/odm_NoiseMonitor.c | 2 +- drivers/staging/rtl8723bs/hal/odm_PathDiv.c | 4 +- .../rtl8723bs/hal/odm_RegConfig8723B.c | 16 +- .../rtl8723bs/hal/odm_RegConfig8723B.h | 16 +- drivers/staging/rtl8723bs/hal/odm_debug.c | 2 +- drivers/staging/rtl8723bs/hal/odm_debug.h | 2 +- drivers/staging/rtl8723bs/hal/rtl8723b_dm.c | 10 +- .../staging/rtl8723bs/hal/rtl8723b_phycfg.c | 4 +- drivers/staging/rtl8723bs/include/hal_data.h | 2 +- 31 files changed, 270 insertions(+), 270 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_odm.c b/drivers/staging/rtl8723bs/core/rtw_odm.c index 87fed69e64d7..53f7cc0444ba 100644 --- a/drivers/staging/rtl8723bs/core/rtw_odm.c +++ b/drivers/staging/rtl8723bs/core/rtw_odm.c @@ -152,7 +152,7 @@ inline void rtw_odm_ability_set(struct adapter *adapter, u32 ability) void rtw_odm_adaptivity_parm_msg(void *sel, struct adapter *adapter) { struct hal_com_data *pHalData = GET_HAL_DATA(adapter); - struct DM_ODM_T *odm = &pHalData->odmpriv; + struct dm_odm_t *odm = &pHalData->odmpriv; DBG_871X_SEL_NL(sel, "%10s %16s %8s %10s %11s %14s\n", "TH_L2H_ini", "TH_EDCCA_HL_diff", "IGI_Base", @@ -173,7 +173,7 @@ void rtw_odm_adaptivity_parm_set(struct adapter *adapter, s8 TH_L2H_ini, u8 IGI_LowerBound) { struct hal_com_data *pHalData = GET_HAL_DATA(adapter); - struct DM_ODM_T *odm = &pHalData->odmpriv; + struct dm_odm_t *odm = &pHalData->odmpriv; odm->TH_L2H_ini = TH_L2H_ini; odm->TH_EDCCA_HL_diff = TH_EDCCA_HL_diff; @@ -186,7 +186,7 @@ void rtw_odm_adaptivity_parm_set(struct adapter *adapter, s8 TH_L2H_ini, void rtw_odm_get_perpkt_rssi(void *sel, struct adapter *adapter) { struct hal_com_data *hal_data = GET_HAL_DATA(adapter); - struct DM_ODM_T *odm = &hal_data->odmpriv; + struct dm_odm_t *odm = &hal_data->odmpriv; DBG_871X_SEL_NL(sel, "RxRate = %s, RSSI_A = %d(%%), RSSI_B = %d(%%)\n", HDATA_RATE(odm->RxRate), odm->RSSI_A, odm->RSSI_B); diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c index 4faa9038417d..016d257b90a0 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c @@ -9,7 +9,7 @@ #include "odm_precomp.h" static bool CheckPositive( - struct DM_ODM_T *pDM_Odm, const u32 Condition1, const u32 Condition2 + struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2 ) { u8 _BoardType = @@ -112,7 +112,7 @@ static bool CheckPositive( } static bool CheckNegative( - struct DM_ODM_T *pDM_Odm, const u32 Condition1, const u32 Condition2 + struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2 ) { return true; @@ -257,7 +257,7 @@ static u32 Array_MP_8723B_AGC_TAB[] = { }; -void ODM_ReadAndConfig_MP_8723B_AGC_TAB(struct DM_ODM_T *pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_AGC_TAB(struct dm_odm_t *pDM_Odm) { u32 i = 0; u32 ArrayLen = ARRAY_SIZE(Array_MP_8723B_AGC_TAB); @@ -526,7 +526,7 @@ static u32 Array_MP_8723B_PHY_REG[] = { }; -void ODM_ReadAndConfig_MP_8723B_PHY_REG(struct DM_ODM_T *pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_PHY_REG(struct dm_odm_t *pDM_Odm) { u32 i = 0; u32 ArrayLen = ARRAY_SIZE(Array_MP_8723B_PHY_REG); @@ -606,7 +606,7 @@ static u32 Array_MP_8723B_PHY_REG_PG[] = { 0, 0, 0, 0x00000e14, 0xffffffff, 0x26303436 }; -void ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(struct DM_ODM_T *pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(struct dm_odm_t *pDM_Odm) { u32 i = 0; u32 *Array = Array_MP_8723B_PHY_REG_PG; diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.h b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.h index 1cb572604206..186007ce57d5 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.h +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.h @@ -15,7 +15,7 @@ void ODM_ReadAndConfig_MP_8723B_AGC_TAB(/* TC: Test Chip, MP: MP Chip */ - struct DM_ODM_T *pDM_Odm + struct dm_odm_t *pDM_Odm ); /****************************************************************************** @@ -24,7 +24,7 @@ ODM_ReadAndConfig_MP_8723B_AGC_TAB(/* TC: Test Chip, MP: MP Chip */ void ODM_ReadAndConfig_MP_8723B_PHY_REG(/* TC: Test Chip, MP: MP Chip */ - struct DM_ODM_T *pDM_Odm + struct dm_odm_t *pDM_Odm ); /****************************************************************************** @@ -33,7 +33,7 @@ ODM_ReadAndConfig_MP_8723B_PHY_REG(/* TC: Test Chip, MP: MP Chip */ void ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(/* TC: Test Chip, MP: MP Chip */ - struct DM_ODM_T *pDM_Odm + struct dm_odm_t *pDM_Odm ); u32 ODM_GetVersion_MP_8723B_PHY_REG_PG(void); diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c index 51d7bf3e6d83..677bcfa10b0d 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c @@ -9,7 +9,7 @@ #include "odm_precomp.h" static bool CheckPositive( - struct DM_ODM_T *pDM_Odm, const u32 Condition1, const u32 Condition2 + struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2 ) { u8 _BoardType = @@ -111,7 +111,7 @@ static bool CheckPositive( } static bool CheckNegative( - struct DM_ODM_T *pDM_Odm, const u32 Condition1, const u32 Condition2 + struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2 ) { return true; @@ -228,7 +228,7 @@ static u32 Array_MP_8723B_MAC_REG[] = { }; -void ODM_ReadAndConfig_MP_8723B_MAC_REG(struct DM_ODM_T *pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_MAC_REG(struct dm_odm_t *pDM_Odm) { u32 i = 0; u32 ArrayLen = ARRAY_SIZE(Array_MP_8723B_MAC_REG); diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.h b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.h index 4ff8b7c28999..50429c159fee 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.h +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.h @@ -15,6 +15,6 @@ void ODM_ReadAndConfig_MP_8723B_MAC_REG(/* TC: Test Chip, MP: MP Chip */ - struct DM_ODM_T *pDM_Odm + struct dm_odm_t *pDM_Odm ); #endif diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c index 5f78a64ca737..2c450c1ce7e7 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c @@ -9,7 +9,7 @@ #include "odm_precomp.h" static bool CheckPositive( - struct DM_ODM_T *pDM_Odm, const u32 Condition1, const u32 Condition2 + struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2 ) { u8 _BoardType = @@ -121,7 +121,7 @@ static bool CheckPositive( } static bool CheckNegative( - struct DM_ODM_T *pDM_Odm, const u32 Condition1, const u32 Condition2 + struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2 ) { return true; @@ -259,7 +259,7 @@ static u32 Array_MP_8723B_RadioA[] = { }; -void ODM_ReadAndConfig_MP_8723B_RadioA(struct DM_ODM_T *pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_RadioA(struct dm_odm_t *pDM_Odm) { u32 i = 0; u32 ArrayLen = ARRAY_SIZE(Array_MP_8723B_RadioA); @@ -420,9 +420,9 @@ static u8 gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_SDIO_8723B[] = { 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15 }; -void ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO(struct DM_ODM_T *pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO(struct dm_odm_t *pDM_Odm) { - struct ODM_RF_CAL_T *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; + struct odm_rf_cal_t *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; ODM_RT_TRACE( pDM_Odm, @@ -755,7 +755,7 @@ static u8 *Array_MP_8723B_TXPWR_LMT[] = { "MKK", "2.4G", "40M", "HT", "2T", "14", "63" }; -void ODM_ReadAndConfig_MP_8723B_TXPWR_LMT(struct DM_ODM_T *pDM_Odm) +void ODM_ReadAndConfig_MP_8723B_TXPWR_LMT(struct dm_odm_t *pDM_Odm) { u32 i = 0; u8 **Array = Array_MP_8723B_TXPWR_LMT; diff --git a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.h b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.h index 1bb266f34e7d..acf5679d188c 100644 --- a/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.h +++ b/drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.h @@ -15,7 +15,7 @@ void ODM_ReadAndConfig_MP_8723B_RadioA(/* TC: Test Chip, MP: MP Chip */ - struct DM_ODM_T *pDM_Odm + struct dm_odm_t *pDM_Odm ); /****************************************************************************** @@ -24,7 +24,7 @@ ODM_ReadAndConfig_MP_8723B_RadioA(/* TC: Test Chip, MP: MP Chip */ void ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO(/* TC: Test Chip, MP: MP Chip */ - struct DM_ODM_T *pDM_Odm + struct dm_odm_t *pDM_Odm ); u32 ODM_GetVersion_MP_8723B_TxPowerTrack_SDIO(void); @@ -34,7 +34,7 @@ u32 ODM_GetVersion_MP_8723B_TxPowerTrack_SDIO(void); void ODM_ReadAndConfig_MP_8723B_TXPWR_LMT(/* TC: Test Chip, MP: MP Chip */ - struct DM_ODM_T *pDM_Odm + struct dm_odm_t *pDM_Odm ); u32 ODM_GetVersion_MP_8723B_TXPWR_LMT(void); diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf.c b/drivers/staging/rtl8723bs/hal/HalPhyRf.c index 9599c45997bb..14426151faae 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf.c +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf.c @@ -23,7 +23,7 @@ } while (0) -void ConfigureTxpowerTrack(struct DM_ODM_T *pDM_Odm, struct txpwrtrack_cfg *pConfig) +void ConfigureTxpowerTrack(struct dm_odm_t *pDM_Odm, struct txpwrtrack_cfg *pConfig) { ConfigureTxpowerTrack_8723B(pConfig); } @@ -36,7 +36,7 @@ void ConfigureTxpowerTrack(struct DM_ODM_T *pDM_Odm, struct txpwrtrack_cfg *pCon /* NOTE: If Tx BB swing or Tx scaling is varified during run-time, still */ /* need to call this function. */ /* */ -void ODM_ClearTxPowerTrackingState(struct DM_ODM_T *pDM_Odm) +void ODM_ClearTxPowerTrackingState(struct dm_odm_t *pDM_Odm) { struct hal_com_data *pHalData = GET_HAL_DATA(pDM_Odm->Adapter); u8 p = 0; @@ -74,7 +74,7 @@ void ODM_TXPowerTrackingCallback_ThermalMeter(struct adapter *Adapter) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; u8 ThermalValue = 0, delta, delta_LCK, delta_IQK, p = 0, i = 0; u8 ThermalValue_AVG_count = 0; diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf.h b/drivers/staging/rtl8723bs/hal/HalPhyRf.h index 5a07f3c14d80..d7eda508d04d 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf.h +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf.h @@ -19,10 +19,10 @@ enum pwrtrack_method { MIX_MODE }; -typedef void (*FuncSetPwr)(struct DM_ODM_T *, enum pwrtrack_method, u8, u8); -typedef void (*FuncIQK)(struct DM_ODM_T *, u8, u8, u8); -typedef void (*FuncLCK)(struct DM_ODM_T *); -typedef void (*FuncSwing)(struct DM_ODM_T *, u8 **, u8 **, u8 **, u8 **); +typedef void (*FuncSetPwr)(struct dm_odm_t *, enum pwrtrack_method, u8, u8); +typedef void (*FuncIQK)(struct dm_odm_t *, u8, u8, u8); +typedef void (*FuncLCK)(struct dm_odm_t *); +typedef void (*FuncSwing)(struct dm_odm_t *, u8 **, u8 **, u8 **, u8 **); struct txpwrtrack_cfg { u8 SwingTableSize_CCK; @@ -37,10 +37,10 @@ struct txpwrtrack_cfg { FuncSwing GetDeltaSwingTable; }; -void ConfigureTxpowerTrack(struct DM_ODM_T *pDM_Odm, struct txpwrtrack_cfg *pConfig); +void ConfigureTxpowerTrack(struct dm_odm_t *pDM_Odm, struct txpwrtrack_cfg *pConfig); -void ODM_ClearTxPowerTrackingState(struct DM_ODM_T *pDM_Odm); +void ODM_ClearTxPowerTrackingState(struct dm_odm_t *pDM_Odm); void ODM_TXPowerTrackingCallback_ThermalMeter(struct adapter *Adapter); diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c index 30cbe125eb4c..12f0e3601531 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c @@ -54,7 +54,7 @@ static u8 DeltaSwingTableIdx_2GA_P_8188E[] = { static void setIqkMatrix_8723B( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, u8 OFDM_index, u8 RFPath, s32 IqkResult_X, @@ -135,7 +135,7 @@ static void setIqkMatrix_8723B( } -static void setCCKFilterCoefficient(struct DM_ODM_T *pDM_Odm, u8 CCKSwingIndex) +static void setCCKFilterCoefficient(struct dm_odm_t *pDM_Odm, u8 CCKSwingIndex) { if (!pDM_Odm->RFCalibrateInfo.bCCKinCH14) { rtw_write8(pDM_Odm->Adapter, 0xa22, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][0]); @@ -159,7 +159,7 @@ static void setCCKFilterCoefficient(struct DM_ODM_T *pDM_Odm, u8 CCKSwingIndex) } void DoIQK_8723B( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, u8 DeltaThermalIndex, u8 ThermalValue, u8 Threshold @@ -185,7 +185,7 @@ void DoIQK_8723B( * *---------------------------------------------------------------------------*/ void ODM_TxPwrTrackSetPwr_8723B( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, enum pwrtrack_method Method, u8 RFPath, u8 ChannelMappedIndex @@ -360,7 +360,7 @@ void ODM_TxPwrTrackSetPwr_8723B( } static void GetDeltaSwingTable_8723B( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, u8 **TemperatureUP_A, u8 **TemperatureDOWN_A, u8 **TemperatureUP_B, @@ -368,7 +368,7 @@ static void GetDeltaSwingTable_8723B( ) { struct adapter *Adapter = pDM_Odm->Adapter; - struct ODM_RF_CAL_T *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; + struct odm_rf_cal_t *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); u16 rate = *(pDM_Odm->pForcedDataRate); u8 channel = pHalData->CurrentChannel; @@ -437,7 +437,7 @@ static u8 phy_PathA_IQK_8723B( u8 result = 0x00; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; /* Save RF Path */ Path_SEL_BB = PHY_QueryBBReg(pDM_Odm->Adapter, 0x948, bMaskDWord); @@ -548,7 +548,7 @@ static u8 phy_PathA_RxIQK8723B( u32 regEAC, regE94, regE9C, regEA4, u4tmp, tmp, Path_SEL_BB; u8 result = 0x00; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; /* ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK!\n")); */ @@ -762,7 +762,7 @@ static u8 phy_PathB_IQK_8723B(struct adapter *padapter) u32 regEAC, regE94, regE9C, tmp, Path_SEL_BB/*, regEC4, regECC, Path_SEL_BB*/; u8 result = 0x00; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK!\n")); @@ -869,7 +869,7 @@ static u8 phy_PathB_RxIQK8723B(struct adapter *padapter, bool configPathB) u32 regE94, regE9C, regEA4, regEAC, u4tmp, tmp, Path_SEL_BB; u8 result = 0x00; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; /* ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B Rx IQK!\n")); */ @@ -1092,9 +1092,9 @@ static void _PHY_PathAFillIQKMatrix8723B( u32 Oldval_0, X, TX0_A, reg; s32 Y, TX0_C; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; - struct ODM_RF_CAL_T *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; + struct odm_rf_cal_t *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQ Calibration %s !\n", (bIQKOK)?"Success":"Failed")); @@ -1172,9 +1172,9 @@ static void _PHY_PathBFillIQKMatrix8723B( u32 Oldval_1, X, TX1_A, reg; s32 Y, TX1_C; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; - struct ODM_RF_CAL_T *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; + struct odm_rf_cal_t *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQ Calibration %s !\n", (bIQKOK)?"Success":"Failed")); @@ -1247,10 +1247,10 @@ static void _PHY_PathBFillIQKMatrix8723B( /* */ /* MP Already declare in odm.c */ -void ODM_SetIQCbyRFpath(struct DM_ODM_T *pDM_Odm, u32 RFpath) +void ODM_SetIQCbyRFpath(struct dm_odm_t *pDM_Odm, u32 RFpath) { - struct ODM_RF_CAL_T *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; + struct odm_rf_cal_t *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; if ( (pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC80][VAL] != 0x0) && @@ -1292,7 +1292,7 @@ static void _PHY_SaveADDARegisters8723B( { u32 i; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; if (!ODM_CheckPowerStatus(padapter)) return; @@ -1310,7 +1310,7 @@ static void _PHY_SaveMACRegisters8723B( { u32 i; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Save MAC parameters.\n")); for (i = 0 ; i < (IQK_MAC_REG_NUM - 1); i++) { @@ -1330,7 +1330,7 @@ static void _PHY_ReloadADDARegisters8723B( { u32 i; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Reload ADDA power saving parameters !\n")); for (i = 0 ; i < RegiesterNum; i++) { @@ -1360,7 +1360,7 @@ static void _PHY_PathADDAOn8723B( u32 pathOn; u32 i; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("ADDA ON.\n")); @@ -1384,7 +1384,7 @@ static void _PHY_MACSettingCalibration8723B( { u32 i = 0; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("MAC settings for Calibration.\n")); @@ -1489,7 +1489,7 @@ static void phy_IQCalibrate_8723B( ) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; u32 i; u8 PathAOK, PathBOK; @@ -1697,7 +1697,7 @@ static void phy_IQCalibrate_8723B( } -static void phy_LCCalibrate_8723B(struct DM_ODM_T *pDM_Odm, bool is2T) +static void phy_LCCalibrate_8723B(struct dm_odm_t *pDM_Odm, bool is2T) { u8 tmpReg; u32 RF_Amode = 0, RF_Bmode = 0, LC_Cal; @@ -1784,7 +1784,7 @@ void PHY_IQCalibrate_8723B( { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; s32 result[4][8]; /* last is final result */ u8 i, final_candidate; @@ -1830,7 +1830,7 @@ void PHY_IQCalibrate_8723B( if (bRestore) { u32 offset, data; u8 path, bResult = SUCCESS; - struct ODM_RF_CAL_T *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; + struct odm_rf_cal_t *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; path = (PHY_QueryBBReg(pDM_Odm->Adapter, rS0S1_PathSwitch, bMaskByte0) == 0x00) ? ODM_RF_PATH_A : ODM_RF_PATH_B; @@ -2038,7 +2038,7 @@ void PHY_IQCalibrate_8723B( } -void PHY_LCCalibrate_8723B(struct DM_ODM_T *pDM_Odm) +void PHY_LCCalibrate_8723B(struct dm_odm_t *pDM_Odm) { bool bSingleTone = false, bCarrierSuppression = false; u32 timeout = 2000, timecount = 0; diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h index 7b009b11540c..775095ad0921 100644 --- a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h +++ b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.h @@ -19,14 +19,14 @@ void ConfigureTxpowerTrack_8723B(struct txpwrtrack_cfg *pConfig); void DoIQK_8723B( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, u8 DeltaThermalIndex, u8 ThermalValue, u8 Threshold ); void ODM_TxPwrTrackSetPwr_8723B( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, enum pwrtrack_method Method, u8 RFPath, u8 ChannelMappedIndex @@ -41,12 +41,12 @@ void PHY_IQCalibrate_8723B( u8 RF_Path ); -void ODM_SetIQCbyRFpath(struct DM_ODM_T *pDM_Odm, u32 RFpath); +void ODM_SetIQCbyRFpath(struct dm_odm_t *pDM_Odm, u32 RFpath); /* */ /* LC calibrate */ /* */ -void PHY_LCCalibrate_8723B(struct DM_ODM_T *pDM_Odm); +void PHY_LCCalibrate_8723B(struct dm_odm_t *pDM_Odm); /* */ /* AP calibrate */ diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 3d2120f0d843..98a363698843 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -1006,7 +1006,7 @@ void hw_var_port_switch(struct adapter *adapter) void SetHwReg(struct adapter *adapter, u8 variable, u8 *val) { struct hal_com_data *hal_data = GET_HAL_DATA(adapter); - struct DM_ODM_T *odm = &(hal_data->odmpriv); + struct dm_odm_t *odm = &(hal_data->odmpriv); switch (variable) { case HW_VAR_PORT_SWITCH: @@ -1086,7 +1086,7 @@ void SetHwReg(struct adapter *adapter, u8 variable, u8 *val) void GetHwReg(struct adapter *adapter, u8 variable, u8 *val) { struct hal_com_data *hal_data = GET_HAL_DATA(adapter); - struct DM_ODM_T *odm = &(hal_data->odmpriv); + struct dm_odm_t *odm = &(hal_data->odmpriv); switch (variable) { case HW_VAR_BASIC_RATE: @@ -1117,7 +1117,7 @@ u8 SetHalDefVar( ) { struct hal_com_data *hal_data = GET_HAL_DATA(adapter); - struct DM_ODM_T *odm = &(hal_data->odmpriv); + struct dm_odm_t *odm = &(hal_data->odmpriv); u8 bResult = _SUCCESS; switch (variable) { @@ -1202,7 +1202,7 @@ u8 GetHalDefVar( ) { struct hal_com_data *hal_data = GET_HAL_DATA(adapter); - struct DM_ODM_T *odm = &(hal_data->odmpriv); + struct dm_odm_t *odm = &(hal_data->odmpriv); u8 bResult = _SUCCESS; switch (variable) { @@ -1273,7 +1273,7 @@ void SetHalODMVar( ) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - struct DM_ODM_T *podmpriv = &pHalData->odmpriv; + struct dm_odm_t *podmpriv = &pHalData->odmpriv; /* _irqL irqL; */ switch (eVariable) { case HAL_ODM_STA_INFO: diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 67db3c60b518..9d7e0211a457 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -270,7 +270,7 @@ u8 PHY_GetRateSectionIndexOfTxPowerByRate( ) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; u8 index = 0; if (pDM_Odm->PhyRegPgVersion == 0) { @@ -795,7 +795,7 @@ void PHY_StoreTxPowerByRate( ) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; if (pDM_Odm->PhyRegPgVersion > 0) PHY_StoreTxPowerByRateNew(padapter, Band, RfPath, TxNum, RegAddr, BitMask, Data); @@ -1188,7 +1188,7 @@ u8 PHY_GetTxPowerIndexBase( s8 PHY_GetTxPowerTrackingOffset(struct adapter *padapter, u8 RFPath, u8 Rate) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; s8 offset = 0; if (pDM_Odm->RFCalibrateInfo.TxPowerTrackControl == false) diff --git a/drivers/staging/rtl8723bs/hal/odm.c b/drivers/staging/rtl8723bs/hal/odm.c index 3e5f6623971b..931c8eeb09bd 100644 --- a/drivers/staging/rtl8723bs/hal/odm.c +++ b/drivers/staging/rtl8723bs/hal/odm.c @@ -282,13 +282,13 @@ u32 TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE] = { /* Local Function predefine. */ /* START------------COMMON INFO RELATED--------------- */ -void odm_CommonInfoSelfInit(struct DM_ODM_T *pDM_Odm); +void odm_CommonInfoSelfInit(struct dm_odm_t *pDM_Odm); -void odm_CommonInfoSelfUpdate(struct DM_ODM_T *pDM_Odm); +void odm_CommonInfoSelfUpdate(struct dm_odm_t *pDM_Odm); -void odm_CmnInfoInit_Debug(struct DM_ODM_T *pDM_Odm); +void odm_CmnInfoInit_Debug(struct dm_odm_t *pDM_Odm); -void odm_BasicDbgMessage(struct DM_ODM_T *pDM_Odm); +void odm_BasicDbgMessage(struct dm_odm_t *pDM_Odm); /* END------------COMMON INFO RELATED--------------- */ @@ -302,17 +302,17 @@ void odm_BasicDbgMessage(struct DM_ODM_T *pDM_Odm); /* Remove BB power Saving by YuChen */ /* END---------BB POWER SAVE----------------------- */ -void odm_RefreshRateAdaptiveMaskCE(struct DM_ODM_T *pDM_Odm); +void odm_RefreshRateAdaptiveMaskCE(struct dm_odm_t *pDM_Odm); /* Remove by YuChen */ -void odm_RSSIMonitorInit(struct DM_ODM_T *pDM_Odm); +void odm_RSSIMonitorInit(struct dm_odm_t *pDM_Odm); -void odm_RSSIMonitorCheckCE(struct DM_ODM_T *pDM_Odm); +void odm_RSSIMonitorCheckCE(struct dm_odm_t *pDM_Odm); -void odm_RSSIMonitorCheck(struct DM_ODM_T *pDM_Odm); +void odm_RSSIMonitorCheck(struct dm_odm_t *pDM_Odm); -void odm_SwAntDetectInit(struct DM_ODM_T *pDM_Odm); +void odm_SwAntDetectInit(struct dm_odm_t *pDM_Odm); void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext); @@ -320,14 +320,14 @@ void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext); void odm_GlobalAdapterCheck(void); -void odm_RefreshRateAdaptiveMask(struct DM_ODM_T *pDM_Odm); +void odm_RefreshRateAdaptiveMask(struct dm_odm_t *pDM_Odm); -void ODM_TXPowerTrackingCheck(struct DM_ODM_T *pDM_Odm); +void ODM_TXPowerTrackingCheck(struct dm_odm_t *pDM_Odm); -void odm_RateAdaptiveMaskInit(struct DM_ODM_T *pDM_Odm); +void odm_RateAdaptiveMaskInit(struct dm_odm_t *pDM_Odm); -void odm_TXPowerTrackingInit(struct DM_ODM_T *pDM_Odm); +void odm_TXPowerTrackingInit(struct dm_odm_t *pDM_Odm); /* Remove Edca by Yu Chen */ @@ -335,10 +335,10 @@ void odm_TXPowerTrackingInit(struct DM_ODM_T *pDM_Odm); #define RxDefaultAnt1 0x65a9 #define RxDefaultAnt2 0x569a -void odm_InitHybridAntDiv(struct DM_ODM_T *pDM_Odm); +void odm_InitHybridAntDiv(struct dm_odm_t *pDM_Odm); bool odm_StaDefAntSel( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, u32 OFDM_Ant1_Cnt, u32 OFDM_Ant2_Cnt, u32 CCK_Ant1_Cnt, @@ -346,11 +346,11 @@ bool odm_StaDefAntSel( u8 *pDefAnt ); -void odm_SetRxIdleAnt(struct DM_ODM_T *pDM_Odm, u8 Ant, bool bDualPath); +void odm_SetRxIdleAnt(struct dm_odm_t *pDM_Odm, u8 Ant, bool bDualPath); -void odm_HwAntDiv(struct DM_ODM_T *pDM_Odm); +void odm_HwAntDiv(struct dm_odm_t *pDM_Odm); /* */ @@ -360,7 +360,7 @@ void odm_HwAntDiv(struct DM_ODM_T *pDM_Odm); /* */ /* 2011/09/21 MH Add to describe different team necessary resource allocate?? */ /* */ -void ODM_DMInit(struct DM_ODM_T *pDM_Odm) +void ODM_DMInit(struct dm_odm_t *pDM_Odm) { odm_CommonInfoSelfInit(pDM_Odm); @@ -390,7 +390,7 @@ void ODM_DMInit(struct DM_ODM_T *pDM_Odm) /* You can not add any dummy function here, be care, you can only use DM structure */ /* to perform any new ODM_DM. */ /* */ -void ODM_DMWatchdog(struct DM_ODM_T *pDM_Odm) +void ODM_DMWatchdog(struct dm_odm_t *pDM_Odm) { odm_CommonInfoSelfUpdate(pDM_Odm); odm_BasicDbgMessage(pDM_Odm); @@ -445,7 +445,7 @@ void ODM_DMWatchdog(struct DM_ODM_T *pDM_Odm) /* */ /* Init /.. Fixed HW value. Only init time. */ /* */ -void ODM_CmnInfoInit(struct DM_ODM_T *pDM_Odm, enum ODM_CMNINFO_E CmnInfo, u32 Value) +void ODM_CmnInfoInit(struct dm_odm_t *pDM_Odm, enum odm_cmninfo_e CmnInfo, u32 Value) { /* */ /* This section is used for init value */ @@ -519,16 +519,16 @@ void ODM_CmnInfoInit(struct DM_ODM_T *pDM_Odm, enum ODM_CMNINFO_E CmnInfo, u32 V break; case ODM_CMNINFO_GPA: - pDM_Odm->TypeGPA = (enum ODM_TYPE_GPA_E)Value; + pDM_Odm->TypeGPA = (enum odm_type_gpa_e)Value; break; case ODM_CMNINFO_APA: - pDM_Odm->TypeAPA = (enum ODM_TYPE_APA_E)Value; + pDM_Odm->TypeAPA = (enum odm_type_apa_e)Value; break; case ODM_CMNINFO_GLNA: - pDM_Odm->TypeGLNA = (enum ODM_TYPE_GLNA_E)Value; + pDM_Odm->TypeGLNA = (enum odm_type_glna_e)Value; break; case ODM_CMNINFO_ALNA: - pDM_Odm->TypeALNA = (enum ODM_TYPE_ALNA_E)Value; + pDM_Odm->TypeALNA = (enum odm_type_alna_e)Value; break; case ODM_CMNINFO_EXT_TRSW: @@ -557,7 +557,7 @@ void ODM_CmnInfoInit(struct DM_ODM_T *pDM_Odm, enum ODM_CMNINFO_E CmnInfo, u32 V } -void ODM_CmnInfoHook(struct DM_ODM_T *pDM_Odm, enum ODM_CMNINFO_E CmnInfo, void *pValue) +void ODM_CmnInfoHook(struct dm_odm_t *pDM_Odm, enum odm_cmninfo_e CmnInfo, void *pValue) { /* */ /* Hook call by reference pointer. */ @@ -686,8 +686,8 @@ void ODM_CmnInfoHook(struct DM_ODM_T *pDM_Odm, enum ODM_CMNINFO_E CmnInfo, void void ODM_CmnInfoPtrArrayHook( - struct DM_ODM_T *pDM_Odm, - enum ODM_CMNINFO_E CmnInfo, + struct dm_odm_t *pDM_Odm, + enum odm_cmninfo_e CmnInfo, u16 Index, void *pValue ) @@ -714,7 +714,7 @@ void ODM_CmnInfoPtrArrayHook( /* */ /* Update Band/CHannel/.. The values are dynamic but non-per-packet. */ /* */ -void ODM_CmnInfoUpdate(struct DM_ODM_T *pDM_Odm, u32 CmnInfo, u64 Value) +void ODM_CmnInfoUpdate(struct dm_odm_t *pDM_Odm, u32 CmnInfo, u64 Value) { /* */ /* This init variable may be changed in run time. */ @@ -828,7 +828,7 @@ void ODM_CmnInfoUpdate(struct DM_ODM_T *pDM_Odm, u32 CmnInfo, u64 Value) } -void odm_CommonInfoSelfInit(struct DM_ODM_T *pDM_Odm) +void odm_CommonInfoSelfInit(struct dm_odm_t *pDM_Odm) { pDM_Odm->bCckHighPower = (bool) PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG(CCK_RPT_FORMAT, pDM_Odm), ODM_BIT(CCK_RPT_FORMAT, pDM_Odm)); pDM_Odm->RFPathRxEnable = (u8) PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG(BB_RX_PATH, pDM_Odm), ODM_BIT(BB_RX_PATH, pDM_Odm)); @@ -838,7 +838,7 @@ void odm_CommonInfoSelfInit(struct DM_ODM_T *pDM_Odm) pDM_Odm->TxRate = 0xFF; } -void odm_CommonInfoSelfUpdate(struct DM_ODM_T *pDM_Odm) +void odm_CommonInfoSelfUpdate(struct dm_odm_t *pDM_Odm) { u8 EntryCnt = 0; u8 i; @@ -864,7 +864,7 @@ void odm_CommonInfoSelfUpdate(struct DM_ODM_T *pDM_Odm) pDM_Odm->bOneEntryOnly = false; } -void odm_CmnInfoInit_Debug(struct DM_ODM_T *pDM_Odm) +void odm_CmnInfoInit_Debug(struct dm_odm_t *pDM_Odm) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_CmnInfoInit_Debug ==>\n")); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("SupportPlatform =%d\n", pDM_Odm->SupportPlatform)); @@ -885,7 +885,7 @@ void odm_CmnInfoInit_Debug(struct DM_ODM_T *pDM_Odm) } -void odm_BasicDbgMessage(struct DM_ODM_T *pDM_Odm) +void odm_BasicDbgMessage(struct dm_odm_t *pDM_Odm) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_BasicDbgMsg ==>\n")); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("bLinked = %d, RSSI_Min = %d,\n", @@ -932,9 +932,9 @@ void odm_BasicDbgMessage(struct DM_ODM_T *pDM_Odm) /* 3 Rate Adaptive */ /* 3 ============================================================ */ -void odm_RateAdaptiveMaskInit(struct DM_ODM_T *pDM_Odm) +void odm_RateAdaptiveMaskInit(struct dm_odm_t *pDM_Odm) { - struct ODM_RATE_ADAPTIVE *pOdmRA = &pDM_Odm->RateAdaptive; + struct odm_rate_adaptive *pOdmRA = &pDM_Odm->RateAdaptive; pOdmRA->Type = DM_Type_ByDriver; if (pOdmRA->Type == DM_Type_ByDriver) @@ -950,7 +950,7 @@ void odm_RateAdaptiveMaskInit(struct DM_ODM_T *pDM_Odm) } u32 ODM_Get_Rate_Bitmap( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, u32 macid, u32 ra_mask, u8 rssi_level @@ -1080,7 +1080,7 @@ u32 ODM_Get_Rate_Bitmap( * * -------------------------------------------------------------------------- */ -void odm_RefreshRateAdaptiveMask(struct DM_ODM_T *pDM_Odm) +void odm_RefreshRateAdaptiveMask(struct dm_odm_t *pDM_Odm) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, ("odm_RefreshRateAdaptiveMask()---------->\n")); @@ -1091,7 +1091,7 @@ void odm_RefreshRateAdaptiveMask(struct DM_ODM_T *pDM_Odm) odm_RefreshRateAdaptiveMaskCE(pDM_Odm); } -void odm_RefreshRateAdaptiveMaskCE(struct DM_ODM_T *pDM_Odm) +void odm_RefreshRateAdaptiveMaskCE(struct dm_odm_t *pDM_Odm) { u8 i; struct adapter *padapter = pDM_Odm->Adapter; @@ -1128,13 +1128,13 @@ void odm_RefreshRateAdaptiveMaskCE(struct DM_ODM_T *pDM_Odm) /* Return Value: bool */ /* - true: RATRState is changed. */ bool ODM_RAStateCheck( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, s32 RSSI, bool bForceUpdate, u8 *pRATRState ) { - struct ODM_RATE_ADAPTIVE *pRA = &pDM_Odm->RateAdaptive; + struct odm_rate_adaptive *pRA = &pDM_Odm->RateAdaptive; const u8 GoUpGap = 5; u8 HighRSSIThreshForRA = pRA->HighRSSIThresh; u8 LowRSSIThreshForRA = pRA->LowRSSIThresh; @@ -1193,15 +1193,15 @@ bool ODM_RAStateCheck( /* 3 RSSI Monitor */ /* 3 ============================================================ */ -void odm_RSSIMonitorInit(struct DM_ODM_T *pDM_Odm) +void odm_RSSIMonitorInit(struct dm_odm_t *pDM_Odm) { - struct RA_T *pRA_Table = &pDM_Odm->DM_RA_Table; + struct ra_t *pRA_Table = &pDM_Odm->DM_RA_Table; pRA_Table->firstconnect = false; } -void odm_RSSIMonitorCheck(struct DM_ODM_T *pDM_Odm) +void odm_RSSIMonitorCheck(struct dm_odm_t *pDM_Odm) { if (!(pDM_Odm->SupportAbility & ODM_BB_RSSI_MONITOR)) return; @@ -1214,7 +1214,7 @@ static void FindMinimumRSSI(struct adapter *padapter) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; /* 1 1.Determine the minimum RSSI */ @@ -1231,7 +1231,7 @@ static void FindMinimumRSSI(struct adapter *padapter) /* ODM_RT_TRACE(pDM_Odm, COMP_DIG, DBG_LOUD, ("MinUndecoratedPWDBForDM =%d\n", pHalData->MinUndecoratedPWDBForDM)); */ } -void odm_RSSIMonitorCheckCE(struct DM_ODM_T *pDM_Odm) +void odm_RSSIMonitorCheckCE(struct dm_odm_t *pDM_Odm) { struct adapter *Adapter = pDM_Odm->Adapter; struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); @@ -1240,7 +1240,7 @@ void odm_RSSIMonitorCheckCE(struct DM_ODM_T *pDM_Odm) int tmpEntryMaxPWDB = 0, tmpEntryMinPWDB = 0xff; u8 sta_cnt = 0; u32 PWDB_rssi[NUM_STA] = {0};/* 0~15]:MACID, [16~31]:PWDB_rssi */ - struct RA_T *pRA_Table = &pDM_Odm->DM_RA_Table; + struct ra_t *pRA_Table = &pDM_Odm->DM_RA_Table; if (pDM_Odm->bLinked != true) return; @@ -1303,7 +1303,7 @@ void odm_RSSIMonitorCheckCE(struct DM_ODM_T *pDM_Odm) /* 3 Tx Power Tracking */ /* 3 ============================================================ */ -static u8 getSwingIndex(struct DM_ODM_T *pDM_Odm) +static u8 getSwingIndex(struct dm_odm_t *pDM_Odm) { struct adapter *Adapter = pDM_Odm->Adapter; u8 i = 0; @@ -1327,7 +1327,7 @@ static u8 getSwingIndex(struct DM_ODM_T *pDM_Odm) return i; } -void odm_TXPowerTrackingInit(struct DM_ODM_T *pDM_Odm) +void odm_TXPowerTrackingInit(struct dm_odm_t *pDM_Odm) { u8 defaultSwingIndex = getSwingIndex(pDM_Odm); u8 p = 0; @@ -1371,7 +1371,7 @@ void odm_TXPowerTrackingInit(struct DM_ODM_T *pDM_Odm) } -void ODM_TXPowerTrackingCheck(struct DM_ODM_T *pDM_Odm) +void ODM_TXPowerTrackingCheck(struct dm_odm_t *pDM_Odm) { struct adapter *Adapter = pDM_Odm->Adapter; @@ -1395,9 +1395,9 @@ void ODM_TXPowerTrackingCheck(struct DM_ODM_T *pDM_Odm) /* 3 ============================================================ */ /* 3 SW Antenna Diversity */ /* 3 ============================================================ */ -void odm_SwAntDetectInit(struct DM_ODM_T *pDM_Odm) +void odm_SwAntDetectInit(struct dm_odm_t *pDM_Odm) { - struct SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; + struct swat_t *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; pDM_SWAT_Table->SWAS_NoLink_BK_Reg92c = rtw_read32(pDM_Odm->Adapter, rDPDT_control); pDM_SWAT_Table->PreAntenna = MAIN_ANT; diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h index 932a5b357877..e2dd8c34c569 100644 --- a/drivers/staging/rtl8723bs/hal/odm.h +++ b/drivers/staging/rtl8723bs/hal/odm.h @@ -92,11 +92,11 @@ struct dynamic_primary_CCA { u8 MF_state; }; -struct RA_T { +struct ra_t { u8 firstconnect; }; -struct RXHP_T { +struct rxhp_t { u8 RXHP_flag; u8 PSD_func_trigger; u8 PSD_bitmap_RXHP[80]; @@ -126,7 +126,7 @@ struct RXHP_T { #define TRAFFIC_HIGH 1 #define TRAFFIC_UltraLOW 2 -struct SWAT_T { /* _SW_Antenna_Switch_ */ +struct swat_t { /* _SW_Antenna_Switch_ */ u8 Double_chk_flag; u8 try_flag; s32 PreRSSI; @@ -178,7 +178,7 @@ struct SWAT_T { /* _SW_Antenna_Switch_ */ /* Remove Edca by YuChen */ -struct ODM_RATE_ADAPTIVE { +struct odm_rate_adaptive { u8 Type; /* DM_Type_ByFW/DM_Type_ByDriver */ u8 LdpcThres; /* if RSSI > LdpcThres => switch from LPDC to BCC */ bool bUseLdpc; @@ -297,7 +297,7 @@ enum ODM_Ability_E { /* tag_Dynamic_ODM_Support_Ability_Type */ /* 2011/20/20 MH For MP driver RT_WLAN_STA = STA_INFO_T */ /* Please declare below ODM relative info in your STA info structure. */ /* */ -struct ODM_STA_INFO_T { +struct odm_sta_info_t { /* Driver Write */ bool bUsed; /* record the sta status link or not? */ /* u8 WirelessMode; */ @@ -325,7 +325,7 @@ struct ODM_STA_INFO_T { /* */ /* 2011/10/20 MH Define Common info enum for all team. */ /* */ -enum ODM_CMNINFO_E { +enum odm_cmninfo_e { /* Fixed value: */ /* HOOK BEFORE REG INIT----------- */ @@ -415,7 +415,7 @@ enum ODM_CMNINFO_E { }; /* 2011/10/20 MH Define ODM support ability. ODM_CMNINFO_ABILITY */ -enum ODM_ABILITY_E { /* _ODM_Support_Ability_Definition */ +enum odm_ability_e { /* _ODM_Support_Ability_Definition */ /* */ /* BB ODM section BIT 0-15 */ /* */ @@ -446,18 +446,18 @@ enum ODM_ABILITY_E { /* _ODM_Support_Ability_Definition */ }; /* ODM_CMNINFO_INTERFACE */ -enum ODM_INTERFACE_E { /* tag_ODM_Support_Interface_Definition */ +enum odm_interface_e { /* tag_ODM_Support_Interface_Definition */ ODM_ITRF_SDIO = 0x4, ODM_ITRF_ALL = 0x7, }; /* ODM_CMNINFO_IC_TYPE */ -enum ODM_IC_TYPE_E { /* tag_ODM_Support_IC_Type_Definition */ +enum odm_ic_type_e { /* tag_ODM_Support_IC_Type_Definition */ ODM_RTL8723B = BIT8, }; /* ODM_CMNINFO_CUT_VER */ -enum ODM_CUT_VERSION_E { /* tag_ODM_Cut_Version_Definition */ +enum odm_cut_version_e { /* tag_ODM_Cut_Version_Definition */ ODM_CUT_A = 0, ODM_CUT_B = 1, ODM_CUT_C = 2, @@ -472,7 +472,7 @@ enum ODM_CUT_VERSION_E { /* tag_ODM_Cut_Version_Definition */ }; /* ODM_CMNINFO_FAB_VER */ -enum ODM_FAB_E { /* tag_ODM_Fab_Version_Definition */ +enum odm_fab_e { /* tag_ODM_Fab_Version_Definition */ ODM_TSMC = 0, ODM_UMC = 1, }; @@ -481,7 +481,7 @@ enum ODM_FAB_E { /* tag_ODM_Fab_Version_Definition */ /* */ /* For example 1T2R (A+AB = BIT0|BIT4|BIT5) */ /* */ -enum ODM_RF_PATH_E { /* tag_ODM_RF_Path_Bit_Definition */ +enum odm_rf_path_e { /* tag_ODM_RF_Path_Bit_Definition */ ODM_RF_TX_A = BIT0, ODM_RF_TX_B = BIT1, ODM_RF_TX_C = BIT2, @@ -492,7 +492,7 @@ enum ODM_RF_PATH_E { /* tag_ODM_RF_Path_Bit_Definition */ ODM_RF_RX_D = BIT7, }; -enum ODM_RF_TYPE_E { /* tag_ODM_RF_Type_Definition */ +enum odm_rf_type_e { /* tag_ODM_RF_Type_Definition */ ODM_1T1R = 0, ODM_1T2R = 1, ODM_2T2R = 2, @@ -513,13 +513,13 @@ enum ODM_RF_TYPE_E { /* tag_ODM_RF_Type_Definition */ /* DUALMAC_SINGLEPHY, */ /* MACPHY_MODE_8192D,*PMACPHY_MODE_8192D; */ /* Above is the original define in MP driver. Please use the same define. THX. */ -enum ODM_MAC_PHY_MODE_E { /* tag_ODM_MAC_PHY_Mode_Definition */ +enum odm_mac_phy_mode_e { /* tag_ODM_MAC_PHY_Mode_Definition */ ODM_SMSP = 0, ODM_DMSP = 1, ODM_DMDP = 2, }; -enum ODM_BT_COEXIST_E { /* tag_BT_Coexist_Definition */ +enum odm_bt_coexist_e { /* tag_BT_Coexist_Definition */ ODM_BT_BUSY = 1, ODM_BT_ON = 2, ODM_BT_OFF = 3, @@ -527,7 +527,7 @@ enum ODM_BT_COEXIST_E { /* tag_BT_Coexist_Definition */ }; /* ODM_CMNINFO_OP_MODE */ -enum ODM_OPERATION_MODE_E { /* tag_Operation_Mode_Definition */ +enum odm_operation_mode_e { /* tag_Operation_Mode_Definition */ ODM_NO_LINK = BIT0, ODM_LINK = BIT1, ODM_SCAN = BIT2, @@ -540,7 +540,7 @@ enum ODM_OPERATION_MODE_E { /* tag_Operation_Mode_Definition */ }; /* ODM_CMNINFO_WM_MODE */ -enum ODM_WIRELESS_MODE_E { /* tag_Wireless_Mode_Definition */ +enum odm_wireless_mode_e { /* tag_Wireless_Mode_Definition */ ODM_WM_UNKNOWN = 0x0, ODM_WM_B = BIT0, ODM_WM_G = BIT1, @@ -552,7 +552,7 @@ enum ODM_WIRELESS_MODE_E { /* tag_Wireless_Mode_Definition */ }; /* ODM_CMNINFO_BAND */ -enum ODM_BAND_TYPE_E { /* tag_Band_Type_Definition */ +enum odm_band_type_e { /* tag_Band_Type_Definition */ ODM_BAND_2_4G = 0, ODM_BAND_5G, ODM_BAND_ON_BOTH, @@ -560,14 +560,14 @@ enum ODM_BAND_TYPE_E { /* tag_Band_Type_Definition */ }; /* ODM_CMNINFO_SEC_CHNL_OFFSET */ -enum ODM_SEC_CHNL_OFFSET_E { /* tag_Secondary_Channel_Offset_Definition */ +enum odm_sec_chnl_offset_e { /* tag_Secondary_Channel_Offset_Definition */ ODM_DONT_CARE = 0, ODM_BELOW = 1, ODM_ABOVE = 2 }; /* ODM_CMNINFO_SEC_MODE */ -enum ODM_SECURITY_E { /* tag_Security_Definition */ +enum odm_security_e { /* tag_Security_Definition */ ODM_SEC_OPEN = 0, ODM_SEC_WEP40 = 1, ODM_SEC_TKIP = 2, @@ -579,7 +579,7 @@ enum ODM_SECURITY_E { /* tag_Security_Definition */ }; /* ODM_CMNINFO_BW */ -enum ODM_BW_E { /* tag_Bandwidth_Definition */ +enum odm_bw_e { /* tag_Bandwidth_Definition */ ODM_BW20M = 0, ODM_BW40M = 1, ODM_BW80M = 2, @@ -590,7 +590,7 @@ enum ODM_BW_E { /* tag_Bandwidth_Definition */ /* ODM_CMNINFO_BOARD_TYPE */ /* For non-AC-series IC , ODM_BOARD_5G_EXT_PA and ODM_BOARD_5G_EXT_LNA are ignored */ /* For AC-series IC, external PA & LNA can be indivisuallly added on 2.4G and/or 5G */ -enum ODM_BOARD_TYPE_E { /* tag_Board_Definition */ +enum odm_board_type_e { /* tag_Board_Definition */ ODM_BOARD_DEFAULT = 0, /* The DEFAULT case. */ ODM_BOARD_MINICARD = BIT(0), /* 0 = non-mini card, 1 = mini card. */ ODM_BOARD_SLIM = BIT(1), /* 0 = non-slim card, 1 = slim card */ @@ -609,24 +609,24 @@ enum ODM_Package_TYPE_E { /* tag_ODM_Package_Definition */ ODM_PACKAGE_TFBGA79 = BIT(2), }; -enum ODM_TYPE_GPA_E { /* tag_ODM_TYPE_GPA_Definition */ +enum odm_type_gpa_e { /* tag_ODM_TYPE_GPA_Definition */ TYPE_GPA0 = 0, TYPE_GPA1 = BIT(1)|BIT(0) }; -enum ODM_TYPE_APA_E { /* tag_ODM_TYPE_APA_Definition */ +enum odm_type_apa_e { /* tag_ODM_TYPE_APA_Definition */ TYPE_APA0 = 0, TYPE_APA1 = BIT(1)|BIT(0) }; -enum ODM_TYPE_GLNA_E { /* tag_ODM_TYPE_GLNA_Definition */ +enum odm_type_glna_e { /* tag_ODM_TYPE_GLNA_Definition */ TYPE_GLNA0 = 0, TYPE_GLNA1 = BIT(2)|BIT(0), TYPE_GLNA2 = BIT(3)|BIT(1), TYPE_GLNA3 = BIT(3)|BIT(2)|BIT(1)|BIT(0) }; -enum ODM_TYPE_ALNA_E { /* tag_ODM_TYPE_ALNA_Definition */ +enum odm_type_alna_e { /* tag_ODM_TYPE_ALNA_Definition */ TYPE_ALNA0 = 0, TYPE_ALNA1 = BIT(2)|BIT(0), TYPE_ALNA2 = BIT(3)|BIT(1), @@ -634,13 +634,13 @@ enum ODM_TYPE_ALNA_E { /* tag_ODM_TYPE_ALNA_Definition */ }; /* ODM_CMNINFO_ONE_PATH_CCA */ -enum ODM_CCA_PATH_E { /* tag_CCA_Path */ +enum odm_cca_path_e { /* tag_CCA_Path */ ODM_CCA_2R = 0, ODM_CCA_1R_A = 1, ODM_CCA_1R_B = 2, }; -struct ODM_RA_INFO_T { /* _ODM_RA_Info_ */ +struct odm_ra_info_t { /* _ODM_RA_Info_ */ u8 RateID; u32 RateMask; u32 RAUseRate; @@ -672,7 +672,7 @@ struct ODM_RA_INFO_T { /* _ODM_RA_Info_ */ u8 PTSmoothFactor; }; -struct IQK_MATRIX_REGS_SETTING { /* _IQK_MATRIX_REGS_SETTING */ +struct iqk_matrix_regs_setting { /* _IQK_MATRIX_REGS_SETTING */ bool bIQKDone; s32 Value[3][IQK_Matrix_REG_NUM]; bool bBWIqkResultSaved[3]; @@ -680,7 +680,7 @@ struct IQK_MATRIX_REGS_SETTING { /* _IQK_MATRIX_REGS_SETTING */ /* Remove PATHDIV_PARA struct to odm_PathDiv.h */ -struct ODM_RF_CAL_T { /* ODM_RF_Calibration_Structure */ +struct odm_rf_cal_t { /* ODM_RF_Calibration_Structure */ /* for tx power tracking */ u32 RegA24; /* for TempCCK */ @@ -724,7 +724,7 @@ struct ODM_RF_CAL_T { /* ODM_RF_Calibration_Structure */ u8 ThermalValue_HP[HP_THERMAL_NUM]; u8 ThermalValue_HP_index; - struct IQK_MATRIX_REGS_SETTING IQKMatrixRegSetting[IQK_Matrix_Settings_NUM]; + struct iqk_matrix_regs_setting IQKMatrixRegSetting[IQK_Matrix_Settings_NUM]; bool bNeedIQK; bool bIQKInProgress; u8 Delta_IQK; @@ -785,7 +785,7 @@ struct ODM_RF_CAL_T { /* ODM_RF_Calibration_Structure */ /* ODM Dynamic common info value definition */ /* */ -struct FAT_T { /* _FAST_ANTENNA_TRAINNING_ */ +struct fat_t { /* _FAST_ANTENNA_TRAINNING_ */ u8 Bssid[6]; u8 antsel_rx_keep_0; u8 antsel_rx_keep_1; @@ -825,12 +825,12 @@ struct FAT_T { /* _FAST_ANTENNA_TRAINNING_ */ }; -enum FAT_STATE_E { +enum fat_state_e { FAT_NORMAL_STATE = 0, FAT_TRAINING_STATE = 1, }; -enum ANT_DIV_TYPE_E { +enum ant_div_type_e { NO_ANTDIV = 0xFF, CG_TRX_HW_ANTDIV = 0x01, CGCS_RX_HW_ANTDIV = 0x02, @@ -840,7 +840,7 @@ enum ANT_DIV_TYPE_E { S0S1_SW_ANTDIV = 0x06 /* 8723B intrnal switch S0 S1 */ }; -struct PATHDIV_T { /* _ODM_PATH_DIVERSITY_ */ +struct pathdiv_t { /* _ODM_PATH_DIVERSITY_ */ u8 RespTxPath; u8 PathSel[ODM_ASSOCIATE_ENTRY_NUM]; u32 PathA_Sum[ODM_ASSOCIATE_ENTRY_NUM]; @@ -849,7 +849,7 @@ struct PATHDIV_T { /* _ODM_PATH_DIVERSITY_ */ u32 PathB_Cnt[ODM_ASSOCIATE_ENTRY_NUM]; }; -enum PHY_REG_PG_TYPE { /* _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE */ +enum phy_reg_pg_type { /* _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE */ PHY_REG_PG_RELATIVE_VALUE = 0, PHY_REG_PG_EXACT_VALUE = 1 }; @@ -857,7 +857,7 @@ enum PHY_REG_PG_TYPE { /* _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE */ /* */ /* Antenna detection information from single tone mechanism, added by Roger, 2012.11.27. */ /* */ -struct ANT_DETECTED_INFO { +struct ant_detected_info { bool bAntDetected; u32 dBForAntA; u32 dBForAntB; @@ -867,7 +867,7 @@ struct ANT_DETECTED_INFO { /* */ /* 2011/09/22 MH Copy from SD4 defined structure. We use to support PHY DM integration. */ /* */ -struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ +struct dm_odm_t { /* DM_Out_Source_Dynamic_Mechanism_Structure */ /* struct timer_list FastAntTrainingTimer; */ /* */ /* Add for different team use temporarily */ @@ -876,7 +876,7 @@ struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ /* WHen you use Adapter or priv pointer, you must make sure the pointer is ready. */ bool odm_ready; - enum PHY_REG_PG_TYPE PhyRegPgValueType; + enum phy_reg_pg_type PhyRegPgValueType; u8 PhyRegPgVersion; u64 DebugComponents; @@ -1109,21 +1109,21 @@ struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ /* */ /* ODM Structure */ /* */ - struct FAT_T DM_FatTable; + struct fat_t DM_FatTable; struct dig_t DM_DigTable; struct PS_T DM_PSTable; struct dynamic_primary_CCA DM_PriCCA; - struct RXHP_T DM_RXHP_Table; - struct RA_T DM_RA_Table; + struct rxhp_t dM_RXHP_Table; + struct ra_t DM_RA_Table; struct false_ALARM_STATISTICS FalseAlmCnt; struct false_ALARM_STATISTICS FlaseAlmCntBuddyAdapter; - struct SWAT_T DM_SWAT_Table; + struct swat_t DM_SWAT_Table; bool RSSI_test; struct cfo_tracking DM_CfoTrack; struct edca_t DM_EDCA_Table; u32 WMMEDCA_BE; - struct PATHDIV_T DM_PathDiv; + struct pathdiv_t DM_PathDiv; /* Copy from SD4 structure */ /* */ /* ================================================== */ @@ -1158,11 +1158,11 @@ struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ /* for rate adaptive, in fact, 88c/92c fw will handle this */ u8 bUseRAMask; - struct ODM_RATE_ADAPTIVE RateAdaptive; + struct odm_rate_adaptive RateAdaptive; - struct ANT_DETECTED_INFO AntDetectedInfo; /* Antenna detected information for RSSI tool */ + struct ant_detected_info AntDetectedInfo; /* Antenna detected information for RSSI tool */ - struct ODM_RF_CAL_T RFCalibrateInfo; + struct odm_rf_cal_t RFCalibrateInfo; /* */ /* TX power tracking */ @@ -1208,7 +1208,7 @@ struct DM_ODM_T { /* DM_Out_Source_Dynamic_Mechanism_Structure */ #define ODM_RF_PATH_MAX 2 -enum ODM_RF_RADIO_PATH_E { +enum odm_rf_radio_path_e { ODM_RF_PATH_A = 0, /* Radio Path A */ ODM_RF_PATH_B = 1, /* Radio Path B */ ODM_RF_PATH_C = 2, /* Radio Path C */ @@ -1226,7 +1226,7 @@ enum ODM_RF_RADIO_PATH_E { /* ODM_RF_PATH_MAX, Max RF number 90 support */ }; - enum ODM_RF_CONTENT { + enum odm_rf_content { odm_radioa_txt = 0x1000, odm_radiob_txt = 0x1001, odm_radioc_txt = 0x1002, @@ -1259,7 +1259,7 @@ enum ODM_FW_Config_Type { }; /* Status code */ -enum RT_STATUS { +enum rt_status { RT_STATUS_SUCCESS, RT_STATUS_FAILURE, RT_STATUS_PENDING, @@ -1316,13 +1316,13 @@ enum RT_STATUS { /* 3 BB Power Save */ /* 3 =========================================================== */ -enum DM_1R_CCA_E { /* tag_1R_CCA_Type_Definition */ +enum dm_1r_cca_e { /* tag_1R_CCA_Type_Definition */ CCA_1R = 0, CCA_2R = 1, CCA_MAX = 2, }; -enum DM_RF_E { /* tag_RF_Type_Definition */ +enum dm_rf_e { /* tag_RF_Type_Definition */ RF_Save = 0, RF_Normal = 1, RF_MAX = 2, @@ -1331,7 +1331,7 @@ enum DM_RF_E { /* tag_RF_Type_Definition */ /* 3 =========================================================== */ /* 3 Antenna Diversity */ /* 3 =========================================================== */ -enum DM_SWAS_E { /* tag_SW_Antenna_Switch_Definition */ +enum dm_swas_e { /* tag_SW_Antenna_Switch_Definition */ Antenna_A = 1, Antenna_B = 2, Antenna_MAX = 3, @@ -1368,10 +1368,10 @@ extern u32 TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE]; /* Remove BB power saving by Yuchen */ #define dm_CheckTXPowerTracking ODM_TXPowerTrackingCheck -void ODM_TXPowerTrackingCheck(struct DM_ODM_T *pDM_Odm); +void ODM_TXPowerTrackingCheck(struct dm_odm_t *pDM_Odm); bool ODM_RAStateCheck( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, s32 RSSI, bool bForceUpdate, u8 *pRATRState @@ -1379,13 +1379,13 @@ bool ODM_RAStateCheck( #define dm_SWAW_RSSI_Check ODM_SwAntDivChkPerPktRssi void ODM_SwAntDivChkPerPktRssi( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, u8 StationID, struct odm_phy_info *pPhyInfo ); u32 ODM_Get_Rate_Bitmap( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, u32 macid, u32 ra_mask, u8 rssi_level @@ -1395,38 +1395,38 @@ u32 ODM_Get_Rate_Bitmap( BEAMFORMING_CAP Beamforming_GetEntryBeamCapByMacId(PMGNT_INFO pMgntInfo, u8 MacId); #endif -void odm_TXPowerTrackingInit(struct DM_ODM_T *pDM_Odm); +void odm_TXPowerTrackingInit(struct dm_odm_t *pDM_Odm); -void ODM_DMInit(struct DM_ODM_T *pDM_Odm); +void ODM_DMInit(struct dm_odm_t *pDM_Odm); -void ODM_DMWatchdog(struct DM_ODM_T *pDM_Odm); /* For common use in the future */ +void ODM_DMWatchdog(struct dm_odm_t *pDM_Odm); /* For common use in the future */ -void ODM_CmnInfoInit(struct DM_ODM_T *pDM_Odm, enum ODM_CMNINFO_E CmnInfo, u32 Value); +void ODM_CmnInfoInit(struct dm_odm_t *pDM_Odm, enum odm_cmninfo_e CmnInfo, u32 Value); -void ODM_CmnInfoHook(struct DM_ODM_T *pDM_Odm, enum ODM_CMNINFO_E CmnInfo, void *pValue); +void ODM_CmnInfoHook(struct dm_odm_t *pDM_Odm, enum odm_cmninfo_e CmnInfo, void *pValue); void ODM_CmnInfoPtrArrayHook( - struct DM_ODM_T *pDM_Odm, - enum ODM_CMNINFO_E CmnInfo, + struct dm_odm_t *pDM_Odm, + enum odm_cmninfo_e CmnInfo, u16 Index, void *pValue ); -void ODM_CmnInfoUpdate(struct DM_ODM_T *pDM_Odm, u32 CmnInfo, u64 Value); +void ODM_CmnInfoUpdate(struct dm_odm_t *pDM_Odm, u32 CmnInfo, u64 Value); -void ODM_InitAllTimers(struct DM_ODM_T *pDM_Odm); +void ODM_InitAllTimers(struct dm_odm_t *pDM_Odm); -void ODM_CancelAllTimers(struct DM_ODM_T *pDM_Odm); +void ODM_CancelAllTimers(struct dm_odm_t *pDM_Odm); -void ODM_ReleaseAllTimers(struct DM_ODM_T *pDM_Odm); +void ODM_ReleaseAllTimers(struct dm_odm_t *pDM_Odm); void ODM_AntselStatistics_88C( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, u8 MacId, u32 PWDBAll, bool isCCKrate ); -void ODM_DynamicARFBSelect(struct DM_ODM_T *pDM_Odm, u8 rate, bool Collision_State); +void ODM_DynamicARFBSelect(struct dm_odm_t *pDM_Odm, u8 rate, bool Collision_State); #endif diff --git a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c index edfdd9101008..75471c6c168e 100644 --- a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c +++ b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c @@ -9,7 +9,7 @@ static void odm_SetCrystalCap(void *pDM_VOID, u8 CrystalCap) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct cfo_tracking *pCfoTrack = &pDM_Odm->DM_CfoTrack; if (pCfoTrack->CrystalCap == CrystalCap) @@ -39,7 +39,7 @@ static void odm_SetCrystalCap(void *pDM_VOID, u8 CrystalCap) static u8 odm_GetDefaultCrytaltalCap(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct adapter *Adapter = pDM_Odm->Adapter; struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); @@ -49,7 +49,7 @@ static u8 odm_GetDefaultCrytaltalCap(void *pDM_VOID) static void odm_SetATCStatus(void *pDM_VOID, bool ATCStatus) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct cfo_tracking *pCfoTrack = &pDM_Odm->DM_CfoTrack; if (pCfoTrack->bATCStatus == ATCStatus) @@ -67,7 +67,7 @@ static void odm_SetATCStatus(void *pDM_VOID, bool ATCStatus) static bool odm_GetATCStatus(void *pDM_VOID) { bool ATCStatus; - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; ATCStatus = (bool)PHY_QueryBBReg( pDM_Odm->Adapter, @@ -79,7 +79,7 @@ static bool odm_GetATCStatus(void *pDM_VOID) void ODM_CfoTrackingReset(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct cfo_tracking *pCfoTrack = &pDM_Odm->DM_CfoTrack; pCfoTrack->DefXCap = odm_GetDefaultCrytaltalCap(pDM_Odm); @@ -91,7 +91,7 @@ void ODM_CfoTrackingReset(void *pDM_VOID) void ODM_CfoTrackingInit(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct cfo_tracking *pCfoTrack = &pDM_Odm->DM_CfoTrack; pCfoTrack->DefXCap = @@ -118,7 +118,7 @@ void ODM_CfoTrackingInit(void *pDM_VOID) void ODM_CfoTracking(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct cfo_tracking *pCfoTrack = &pDM_Odm->DM_CfoTrack; int CFO_kHz_A, CFO_kHz_B, CFO_ave = 0; int CFO_ave_diff; @@ -297,7 +297,7 @@ void ODM_CfoTracking(void *pDM_VOID) void ODM_ParsingCFO(void *pDM_VOID, void *pPktinfo_VOID, s8 *pcfotail) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct odm_packet_info *pPktinfo = pPktinfo_VOID; struct cfo_tracking *pCfoTrack = &pDM_Odm->DM_CfoTrack; u8 i; diff --git a/drivers/staging/rtl8723bs/hal/odm_DIG.c b/drivers/staging/rtl8723bs/hal/odm_DIG.c index aa185d5a3251..dcef7fb17389 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DIG.c +++ b/drivers/staging/rtl8723bs/hal/odm_DIG.c @@ -11,7 +11,7 @@ void odm_NHMCounterStatisticsInit(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; /* PHY parameters initialize for n series */ rtw_write16(pDM_Odm->Adapter, ODM_REG_NHM_TIMER_11N+2, 0x2710); /* 0x894[31:16]= 0x2710 Time duration for NHM unit: 4us, 0x2710 =40ms */ @@ -27,7 +27,7 @@ void odm_NHMCounterStatisticsInit(void *pDM_VOID) void odm_NHMCounterStatistics(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; /* Get NHM report */ odm_GetNHMCounterStatistics(pDM_Odm); @@ -38,7 +38,7 @@ void odm_NHMCounterStatistics(void *pDM_VOID) void odm_GetNHMCounterStatistics(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; u32 value32 = 0; value32 = PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG_NHM_CNT_11N, bMaskDWord); @@ -48,7 +48,7 @@ void odm_GetNHMCounterStatistics(void *pDM_VOID) void odm_NHMCounterStatisticsReset(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_NHM_TH9_TH10_11N, BIT1, 0); PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_NHM_TH9_TH10_11N, BIT1, 1); @@ -56,7 +56,7 @@ void odm_NHMCounterStatisticsReset(void *pDM_VOID) void odm_NHMBBInit(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; pDM_Odm->adaptivity_flag = 0; pDM_Odm->tolerance_cnt = 3; @@ -69,7 +69,7 @@ void odm_NHMBBInit(void *pDM_VOID) /* */ void odm_NHMBB(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; /* u8 test_status; */ /* struct false_ALARM_STATISTICS *pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; */ @@ -133,7 +133,7 @@ void odm_NHMBB(void *pDM_VOID) void odm_SearchPwdBLowerBound(void *pDM_VOID, u8 IGI_target) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; u32 value32 = 0; u8 cnt, IGI; bool bAdjust = true; @@ -205,7 +205,7 @@ void odm_SearchPwdBLowerBound(void *pDM_VOID, u8 IGI_target) void odm_AdaptivityInit(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; if (pDM_Odm->Carrier_Sense_enable == false) pDM_Odm->TH_L2H_ini = 0xf7; /* -7 */ @@ -233,7 +233,7 @@ void odm_AdaptivityInit(void *pDM_VOID) void odm_Adaptivity(void *pDM_VOID, u8 IGI) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; s8 TH_L2H_dmc, TH_H2L_dmc; s8 Diff, IGI_target; bool EDCCA_State = false; @@ -322,7 +322,7 @@ void odm_Adaptivity(void *pDM_VOID, u8 IGI) void ODM_Write_DIG(void *pDM_VOID, u8 CurrentIGI) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; if (pDM_DigTable->bStopDIG) { @@ -362,7 +362,7 @@ void odm_PauseDIG( u8 IGIValue ) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; static bool bPaused; @@ -435,7 +435,7 @@ void odm_PauseDIG( bool odm_DigAbort(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; /* SupportAbility */ if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) { @@ -466,7 +466,7 @@ bool odm_DigAbort(void *pDM_VOID) void odm_DIGInit(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; pDM_DigTable->bStopDIG = false; @@ -504,7 +504,7 @@ void odm_DIGInit(void *pDM_VOID) void odm_DIG(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; /* Common parameters */ struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; @@ -823,7 +823,7 @@ void odm_DIG(void *pDM_VOID) void odm_DIGbyRSSI_LPS(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct false_ALARM_STATISTICS *pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; u8 RSSI_Lower = DM_DIG_MIN_NIC; /* 0x1E or 0x1C */ @@ -892,7 +892,7 @@ void odm_DIGbyRSSI_LPS(void *pDM_VOID) void odm_FalseAlarmCounterStatistics(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct false_ALARM_STATISTICS *FalseAlmCnt = &pDM_Odm->FalseAlmCnt; u32 ret_value; @@ -1062,7 +1062,7 @@ void odm_FAThresholdCheck( u32 *dm_FA_thres ) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; if (pDM_Odm->bLinked && (bPerformance || bDFSBand)) { /* For NIC */ @@ -1078,7 +1078,7 @@ void odm_FAThresholdCheck( u8 odm_ForbiddenIGICheck(void *pDM_VOID, u8 DIG_Dynamic_MIN, u8 CurrentIGI) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; struct false_ALARM_STATISTICS *pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; u8 rx_gain_range_min = pDM_DigTable->rx_gain_range_min; @@ -1134,7 +1134,7 @@ u8 odm_ForbiddenIGICheck(void *pDM_VOID, u8 DIG_Dynamic_MIN, u8 CurrentIGI) void odm_CCKPacketDetectionThresh(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct false_ALARM_STATISTICS *FalseAlmCnt = &pDM_Odm->FalseAlmCnt; u8 CurCCK_CCAThres; @@ -1195,7 +1195,7 @@ void odm_CCKPacketDetectionThresh(void *pDM_VOID) void ODM_Write_CCK_CCA_Thres(void *pDM_VOID, u8 CurCCK_CCAThres) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; /* modify by Guo.Mingzhi 2012-01-03 */ diff --git a/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c b/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c index 522f87fe69b2..d12f4841114c 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c +++ b/drivers/staging/rtl8723bs/hal/odm_DynamicBBPowerSaving.c @@ -9,7 +9,7 @@ void odm_DynamicBBPowerSavingInit(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct PS_T *pDM_PSTable = &pDM_Odm->DM_PSTable; pDM_PSTable->PreCCAState = CCA_MAX; @@ -22,7 +22,7 @@ void odm_DynamicBBPowerSavingInit(void *pDM_VOID) void ODM_RF_Saving(void *pDM_VOID, u8 bForceInNormal) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct PS_T *pDM_PSTable = &pDM_Odm->DM_PSTable; u8 Rssi_Up_bound = 30; u8 Rssi_Low_bound = 25; diff --git a/drivers/staging/rtl8723bs/hal/odm_DynamicTxPower.c b/drivers/staging/rtl8723bs/hal/odm_DynamicTxPower.c index ca8246c1a2cd..398dfa13449d 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DynamicTxPower.c +++ b/drivers/staging/rtl8723bs/hal/odm_DynamicTxPower.c @@ -9,7 +9,7 @@ void odm_DynamicTxPowerInit(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct adapter *Adapter = pDM_Odm->Adapter; struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); diff --git a/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.c b/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.c index 95fbb91aeb7d..12b37c17ea0c 100644 --- a/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.c +++ b/drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.c @@ -31,7 +31,7 @@ static u32 edca_setting_DL[HT_IOT_PEER_MAX] = { void ODM_EdcaTurboInit(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct adapter *Adapter = pDM_Odm->Adapter; pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = false; @@ -58,7 +58,7 @@ void odm_EdcaTurboCheck(void *pDM_VOID) * operate at the same time. In stage2/3, we need to prove universal * interface and merge all HW dynamic mechanism. */ - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("odm_EdcaTurboCheck ========================>\n")); @@ -73,7 +73,7 @@ void odm_EdcaTurboCheck(void *pDM_VOID) void odm_EdcaTurboCheckCE(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; struct adapter *Adapter = pDM_Odm->Adapter; struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(Adapter); struct recv_priv *precvpriv = &(Adapter->recvpriv); diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c index b1b69459282f..638c16f5c668 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c @@ -23,7 +23,7 @@ static u8 odm_QueryRxPwrPercentage(s8 AntPower) } -s32 odm_SignalScaleMapping(struct DM_ODM_T *pDM_Odm, s32 CurrSig) +s32 odm_SignalScaleMapping(struct dm_odm_t *pDM_Odm, s32 CurrSig) { s32 RetSig = 0; @@ -77,7 +77,7 @@ static u8 odm_EVMdbToPercentage(s8 Value) } static void odm_RxPhyStatus92CSeries_Parsing( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, struct odm_phy_info *pPhyInfo, u8 *pPhyStatus, struct odm_packet_info *pPktinfo @@ -238,7 +238,7 @@ static void odm_RxPhyStatus92CSeries_Parsing( } static void odm_Process_RSSIForDM( - struct DM_ODM_T *pDM_Odm, struct odm_phy_info *pPhyInfo, struct odm_packet_info *pPktinfo + struct dm_odm_t *pDM_Odm, struct odm_phy_info *pPhyInfo, struct odm_packet_info *pPktinfo ) { @@ -392,7 +392,7 @@ static void odm_Process_RSSIForDM( /* Endianness before calling this API */ /* */ static void ODM_PhyStatusQuery_92CSeries( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, struct odm_phy_info *pPhyInfo, u8 *pPhyStatus, struct odm_packet_info *pPktinfo @@ -406,7 +406,7 @@ static void ODM_PhyStatusQuery_92CSeries( } void ODM_PhyStatusQuery( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, struct odm_phy_info *pPhyInfo, u8 *pPhyStatus, struct odm_packet_info *pPktinfo @@ -422,9 +422,9 @@ void ODM_PhyStatusQuery( /* */ enum hal_status ODM_ConfigRFWithHeaderFile( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, enum ODM_RF_Config_Type ConfigType, - enum ODM_RF_RADIO_PATH_E eRFPath + enum odm_rf_radio_path_e eRFPath ) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, @@ -441,7 +441,7 @@ enum hal_status ODM_ConfigRFWithHeaderFile( return HAL_STATUS_SUCCESS; } -enum hal_status ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T *pDM_Odm) +enum hal_status ODM_ConfigRFWithTxPwrTrackHeaderFile(struct dm_odm_t *pDM_Odm) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===>ODM_ConfigRFWithTxPwrTrackHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip")); @@ -456,7 +456,7 @@ enum hal_status ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T *pDM_Odm) } enum hal_status ODM_ConfigBBWithHeaderFile( - struct DM_ODM_T *pDM_Odm, enum ODM_BB_Config_Type ConfigType + struct dm_odm_t *pDM_Odm, enum ODM_BB_Config_Type ConfigType ) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.h b/drivers/staging/rtl8723bs/hal/odm_HWConfig.h index 184609623f5c..eda35d2e7d29 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.h +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.h @@ -122,31 +122,31 @@ struct phy_status_rpt_8812_t { void ODM_PhyStatusQuery( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, struct odm_phy_info *pPhyInfo, u8 *pPhyStatus, struct odm_packet_info *pPktinfo ); -enum hal_status ODM_ConfigRFWithTxPwrTrackHeaderFile(struct DM_ODM_T *pDM_Odm); +enum hal_status ODM_ConfigRFWithTxPwrTrackHeaderFile(struct dm_odm_t *pDM_Odm); enum hal_status ODM_ConfigRFWithHeaderFile( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, enum ODM_RF_Config_Type ConfigType, - enum ODM_RF_RADIO_PATH_E eRFPath + enum odm_rf_radio_path_e eRFPath ); enum hal_status ODM_ConfigBBWithHeaderFile( - struct DM_ODM_T *pDM_Odm, enum ODM_BB_Config_Type ConfigType + struct dm_odm_t *pDM_Odm, enum ODM_BB_Config_Type ConfigType ); enum hal_status ODM_ConfigFWWithHeaderFile( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, enum ODM_FW_Config_Type ConfigType, u8 *pFirmware, u32 *pSize ); -s32 odm_SignalScaleMapping(struct DM_ODM_T *pDM_Odm, s32 CurrSig); +s32 odm_SignalScaleMapping(struct dm_odm_t *pDM_Odm, s32 CurrSig); #endif diff --git a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c index 54b9a70a7060..c3de123e2a48 100644 --- a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c +++ b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c @@ -19,7 +19,7 @@ #define ValidCnt 5 static s16 odm_InbandNoise_Monitor_NSeries( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, u8 bPauseDIG, u8 IGIValue, u32 max_time diff --git a/drivers/staging/rtl8723bs/hal/odm_PathDiv.c b/drivers/staging/rtl8723bs/hal/odm_PathDiv.c index eeb8c87f2612..92b708265d47 100644 --- a/drivers/staging/rtl8723bs/hal/odm_PathDiv.c +++ b/drivers/staging/rtl8723bs/hal/odm_PathDiv.c @@ -9,7 +9,7 @@ void odm_PathDiversityInit(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; if (!(pDM_Odm->SupportAbility & ODM_BB_PATH_DIV)) ODM_RT_TRACE( @@ -22,7 +22,7 @@ void odm_PathDiversityInit(void *pDM_VOID) void odm_PathDiversity(void *pDM_VOID) { - struct DM_ODM_T *pDM_Odm = (struct DM_ODM_T *)pDM_VOID; + struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; if (!(pDM_Odm->SupportAbility & ODM_BB_PATH_DIV)) ODM_RT_TRACE( diff --git a/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.c b/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.c index 0fc5abe6ae23..63bf5ba3e0d5 100644 --- a/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.c +++ b/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.c @@ -8,10 +8,10 @@ #include "odm_precomp.h" void odm_ConfigRFReg_8723B( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, u32 Addr, u32 Data, - enum ODM_RF_RADIO_PATH_E RF_PATH, + enum odm_rf_radio_path_e RF_PATH, u32 RegAddr ) { @@ -106,7 +106,7 @@ void odm_ConfigRFReg_8723B( } -void odm_ConfigRF_RadioA_8723B(struct DM_ODM_T *pDM_Odm, u32 Addr, u32 Data) +void odm_ConfigRF_RadioA_8723B(struct dm_odm_t *pDM_Odm, u32 Addr, u32 Data) { u32 content = 0x1000; /* RF_Content: radioa_txt */ u32 maskforPhySet = (u32)(content&0xE000); @@ -131,7 +131,7 @@ void odm_ConfigRF_RadioA_8723B(struct DM_ODM_T *pDM_Odm, u32 Addr, u32 Data) ); } -void odm_ConfigMAC_8723B(struct DM_ODM_T *pDM_Odm, u32 Addr, u8 Data) +void odm_ConfigMAC_8723B(struct dm_odm_t *pDM_Odm, u32 Addr, u8 Data) { rtw_write8(pDM_Odm->Adapter, Addr, Data); ODM_RT_TRACE( @@ -147,7 +147,7 @@ void odm_ConfigMAC_8723B(struct DM_ODM_T *pDM_Odm, u32 Addr, u8 Data) } void odm_ConfigBB_AGC_8723B( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data @@ -170,7 +170,7 @@ void odm_ConfigBB_AGC_8723B( } void odm_ConfigBB_PHY_REG_PG_8723B( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, u32 Band, u32 RfPath, u32 TxNum, @@ -198,7 +198,7 @@ void odm_ConfigBB_PHY_REG_PG_8723B( } void odm_ConfigBB_PHY_8723B( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data @@ -226,7 +226,7 @@ void odm_ConfigBB_PHY_8723B( } void odm_ConfigBB_TXPWR_LMT_8723B( - struct DM_ODM_T *pDM_Odm, + struct dm_odm_t *pDM_Odm, u8 *Regulation, u8 *Band, u8 *Bandwidth, diff --git a/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h b/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h index e863f0c6d27a..b392d14c389d 100644 --- a/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h +++ b/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h @@ -7,24 +7,24 @@ #ifndef __INC_ODM_REGCONFIG_H_8723B #define __INC_ODM_REGCONFIG_H_8723B -void odm_ConfigRFReg_8723B(struct DM_ODM_T *pDM_Odm, +void odm_ConfigRFReg_8723B(struct dm_odm_t *pDM_Odm, u32 Addr, u32 Data, - enum ODM_RF_RADIO_PATH_E RF_PATH, + enum odm_rf_radio_path_e RF_PATH, u32 RegAddr ); -void odm_ConfigRF_RadioA_8723B(struct DM_ODM_T *pDM_Odm, u32 Addr, u32 Data); +void odm_ConfigRF_RadioA_8723B(struct dm_odm_t *pDM_Odm, u32 Addr, u32 Data); -void odm_ConfigMAC_8723B(struct DM_ODM_T *pDM_Odm, u32 Addr, u8 Data); +void odm_ConfigMAC_8723B(struct dm_odm_t *pDM_Odm, u32 Addr, u8 Data); -void odm_ConfigBB_AGC_8723B(struct DM_ODM_T *pDM_Odm, +void odm_ConfigBB_AGC_8723B(struct dm_odm_t *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data ); -void odm_ConfigBB_PHY_REG_PG_8723B(struct DM_ODM_T *pDM_Odm, +void odm_ConfigBB_PHY_REG_PG_8723B(struct dm_odm_t *pDM_Odm, u32 Band, u32 RfPath, u32 TxNum, @@ -33,13 +33,13 @@ void odm_ConfigBB_PHY_REG_PG_8723B(struct DM_ODM_T *pDM_Odm, u32 Data ); -void odm_ConfigBB_PHY_8723B(struct DM_ODM_T *pDM_Odm, +void odm_ConfigBB_PHY_8723B(struct dm_odm_t *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data ); -void odm_ConfigBB_TXPWR_LMT_8723B(struct DM_ODM_T *pDM_Odm, +void odm_ConfigBB_TXPWR_LMT_8723B(struct dm_odm_t *pDM_Odm, u8 *Regulation, u8 *Band, u8 *Bandwidth, diff --git a/drivers/staging/rtl8723bs/hal/odm_debug.c b/drivers/staging/rtl8723bs/hal/odm_debug.c index 8e0fb04bc3d6..b35451bcb437 100644 --- a/drivers/staging/rtl8723bs/hal/odm_debug.c +++ b/drivers/staging/rtl8723bs/hal/odm_debug.c @@ -7,7 +7,7 @@ #include "odm_precomp.h" -void ODM_InitDebugSetting(struct DM_ODM_T *pDM_Odm) +void ODM_InitDebugSetting(struct dm_odm_t *pDM_Odm) { pDM_Odm->DebugLevel = ODM_DBG_LOUD; diff --git a/drivers/staging/rtl8723bs/hal/odm_debug.h b/drivers/staging/rtl8723bs/hal/odm_debug.h index 22f0e37456e2..05dbfa55e933 100644 --- a/drivers/staging/rtl8723bs/hal/odm_debug.h +++ b/drivers/staging/rtl8723bs/hal/odm_debug.h @@ -162,6 +162,6 @@ no_printk("%s %p", title_str, ptr) #endif -void ODM_InitDebugSetting(struct DM_ODM_T *pDM_Odm); +void ODM_InitDebugSetting(struct dm_odm_t *pDM_Odm); #endif /* __ODM_DBG_H__ */ diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c index f851efaadae5..3792280f93d5 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c @@ -25,7 +25,7 @@ static void Init_ODM_ComInfo_8723b(struct adapter *Adapter) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; u8 cut_ver, fab_ver; @@ -74,7 +74,7 @@ static void Update_ODM_ComInfo_8723b(struct adapter *Adapter) struct dvobj_priv *dvobj = adapter_to_dvobj(Adapter); struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(Adapter); struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; int i; u8 zero = 0; @@ -126,7 +126,7 @@ void rtl8723b_InitHalDm(struct adapter *Adapter) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; pdmpriv->DM_Type = DM_Type_ByDriver; pdmpriv->DMFlag = DYNAMIC_FUNC_DISABLE; @@ -200,7 +200,7 @@ void rtl8723b_hal_dm_in_lps(struct adapter *padapter) u32 PWDB_rssi = 0; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info *psta = NULL; @@ -226,7 +226,7 @@ void rtl8723b_HalDmWatchDog_in_LPS(struct adapter *Adapter) struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; struct sta_priv *pstapriv = &Adapter->stapriv; struct sta_info *psta = NULL; diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c index 52cb58dc4e8d..2abff4673be2 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c @@ -594,8 +594,8 @@ u8 PHY_GetTxPowerIndex( void PHY_SetTxPowerLevel8723B(struct adapter *Adapter, u8 Channel) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - struct DM_ODM_T *pDM_Odm = &pHalData->odmpriv; - struct FAT_T *pDM_FatTable = &pDM_Odm->DM_FatTable; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; + struct fat_t *pDM_FatTable = &pDM_Odm->DM_FatTable; u8 RFPath = ODM_RF_PATH_A; if (pHalData->AntDivCfg) {/* antenna diversity Enable */ diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h index 9512da2a7e95..b5a0be35a6ce 100644 --- a/drivers/staging/rtl8723bs/include/hal_data.h +++ b/drivers/staging/rtl8723bs/include/hal_data.h @@ -431,7 +431,7 @@ struct hal_com_data { u32 sdio_tx_max_len[SDIO_MAX_TX_QUEUE];/* H, N, L, used for sdio tx aggregation max length per queue */ struct dm_priv dmpriv; - struct DM_ODM_T odmpriv; + struct dm_odm_t odmpriv; /* For bluetooth co-existance */ struct bt_coexist bt_coexist; -- 2.30.2 From ztong0001 at gmail.com Wed Mar 17 22:43:31 2021 From: ztong0001 at gmail.com (Tong Zhang) Date: Wed, 17 Mar 2021 18:43:31 -0400 Subject: [PATCH] staging: comedi: das800: fix request_irq() warn In-Reply-To: <20210317065248.GW21246@kadam> References: <92b7c57b-b645-9965-8157-4ca76a803cba@mev.co.uk> <20210316224227.348310-1-ztong0001@gmail.com> <20210317051426.GX2087@kadam> <20210317065248.GW21246@kadam> Message-ID: Thanks for sharing those best practices, Dan. I was wondering if there is a spelling checker for git. From shubhrajyoti.datta at gmail.com Thu Mar 18 05:41:57 2021 From: shubhrajyoti.datta at gmail.com (Shubhrajyoti Datta) Date: Thu, 18 Mar 2021 11:11:57 +0530 Subject: [PATCH v10 5/9] staging: clocking-wizard: Add support for dynamic reconfiguration In-Reply-To: References: Message-ID: On Mon, Mar 15, 2021 at 12:37 PM Zhengxun Li wrote: > > Hi Shubhrajyoti, > > My name is Zhengxun and I am the engineer from Macronix. We are > using the platform PicoZed 7015/7030 SOM (System On Module), > which is based on Xilinx Zynq?-7000 All Programmable (AP) SoC to > verify our Flash driver. Of course, we are also using your clock > wizard, our version seems to be v5.2, but something went wrong. > > +static int clk_wzrd_dynamic_reconfig(struct clk_hw *hw, unsigned long rate, > + unsigned long parent_rate) > +{ > + int err; > + u32 value; > + unsigned long flags = 0; > + struct clk_wzrd_divider *divider = to_clk_wzrd_divider(hw); > + void __iomem *div_addr = divider->base + divider->offset; > + > + if (divider->lock) > + spin_lock_irqsave(divider->lock, flags); > + else > + __acquire(divider->lock); > + > + value = DIV_ROUND_CLOSEST(parent_rate, rate); > + > + /* Cap the value to max */ > + min_t(u32, value, WZRD_DR_MAX_INT_DIV_VALUE); > + > + /* Set divisor and clear phase offset */ > + writel(value, div_addr); > + writel(0x00, div_addr + WZRD_DR_DIV_TO_PHASE_OFFSET); > > Why phase always set to zero? We want to support DTR operation in > Flash driver. Can you add a set_phase function to adjust the phase? > The phase setting is a separate feature will address in a separate series. > From kishi at techcave.pl Thu Mar 18 02:15:58 2021 From: kishi at techcave.pl (Florence Edward) Date: Thu, 18 Mar 2021 03:15:58 +0100 Subject: Payment of US$5,550,000.00 to your account Message-ID: <20210318055643.68039840B9@smtp1.osuosl.org> Ref: UNDR/EFD550/SE Good Morning, We wish to congratulate and inform you that after thorough review of all unclaimed funds, lottery funds, Inheritance and contract funds, etc. in conjunction with the auditor;s reports sent to the united nation accounts department, your payment file was forwarded to this office for immediate transfer of US$5,550,000.00 to your bank account, a compensation for your funds retarded. The auditors reports shows that you have been going through hard times to see the release of the fund into your bank account, which has been by some delay dubious officials. We therefore advice you to stop further correspondence with any officer or persons outside this office, You do not have to pay any fee since you have met up with the funds transfer requirements. Should you follow our directives, your US$5,550,000.00 compensation will be credited to your bank account within the next three (3) working days and copies of the fund transfer release documents will be sent to you and your bankers for confirmation. For the immediate transfer of the US$5,550,000.00 to your bank account, kindly contact Mrs.Evelyn Bernard today with the below information; she will give you guidelines on how to claim your fund. Contact Name: Mrs.Evelyn Bernard. E-mail: mdredban775 at gmail.com (OR) unccpmoln at yahoo.co.jp PLEASE NOTE: All correspondences to Mrs.Evelyn Bernard have the reference number: Ref: UNDR/EFD550/SE sent along with your Full Names and Telephone numbers for prompt attention. Yours sincerely, Florence Edward Financial services, UK From kishi at techcave.pl Thu Mar 18 02:15:58 2021 From: kishi at techcave.pl (Florence Edward) Date: Thu, 18 Mar 2021 03:15:58 +0100 Subject: Payment of US$5,550,000.00 to your account Message-ID: <20210318055643.747EF6065F@smtp3.osuosl.org> Ref: UNDR/EFD550/SE Good Morning, We wish to congratulate and inform you that after thorough review of all unclaimed funds, lottery funds, Inheritance and contract funds, etc. in conjunction with the auditor;s reports sent to the united nation accounts department, your payment file was forwarded to this office for immediate transfer of US$5,550,000.00 to your bank account, a compensation for your funds retarded. The auditors reports shows that you have been going through hard times to see the release of the fund into your bank account, which has been by some delay dubious officials. We therefore advice you to stop further correspondence with any officer or persons outside this office, You do not have to pay any fee since you have met up with the funds transfer requirements. Should you follow our directives, your US$5,550,000.00 compensation will be credited to your bank account within the next three (3) working days and copies of the fund transfer release documents will be sent to you and your bankers for confirmation. For the immediate transfer of the US$5,550,000.00 to your bank account, kindly contact Mrs.Evelyn Bernard today with the below information; she will give you guidelines on how to claim your fund. Contact Name: Mrs.Evelyn Bernard. E-mail: mdredban775 at gmail.com (OR) unccpmoln at yahoo.co.jp PLEASE NOTE: All correspondences to Mrs.Evelyn Bernard have the reference number: Ref: UNDR/EFD550/SE sent along with your Full Names and Telephone numbers for prompt attention. Yours sincerely, Florence Edward Financial services, UK From benjamin.gaignard at collabora.com Thu Mar 18 08:20:34 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Thu, 18 Mar 2021 09:20:34 +0100 Subject: [PATCH v6 01/13] dt-bindings: mfd: Add 'nxp, imx8mq-vpu-ctrl' to syscon list In-Reply-To: <20210318082046.51546-1-benjamin.gaignard@collabora.com> References: <20210318082046.51546-1-benjamin.gaignard@collabora.com> Message-ID: <20210318082046.51546-2-benjamin.gaignard@collabora.com> Add 'nxp,imx8mq-vpu-ctrl' in the list of possible syscon. It will used to access to the VPU control registers. Signed-off-by: Benjamin Gaignard --- Documentation/devicetree/bindings/mfd/syscon.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/mfd/syscon.yaml b/Documentation/devicetree/bindings/mfd/syscon.yaml index f14ae6da0068..ae22c4730613 100644 --- a/Documentation/devicetree/bindings/mfd/syscon.yaml +++ b/Documentation/devicetree/bindings/mfd/syscon.yaml @@ -44,6 +44,7 @@ properties: - hisilicon,peri-subctrl - microchip,sparx5-cpu-syscon - mstar,msc313-pmsleep + - nxp,imx8mq-vpu-ctrl - rockchip,px30-qos - rockchip,rk3066-qos - rockchip,rk3288-qos -- 2.25.1 From benjamin.gaignard at collabora.com Thu Mar 18 08:20:35 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Thu, 18 Mar 2021 09:20:35 +0100 Subject: [PATCH v6 02/13] dt-bindings: media: nxp, imx8mq-vpu: Update the bindings for G2 support In-Reply-To: <20210318082046.51546-1-benjamin.gaignard@collabora.com> References: <20210318082046.51546-1-benjamin.gaignard@collabora.com> Message-ID: <20210318082046.51546-3-benjamin.gaignard@collabora.com> Introducing G2 hevc video decoder lead to modify the bindings to allow to get one node per VPUs. VPUs share one hardware control block which is provided as a phandle on an syscon. Each node got now one reg and one interrupt. Add a compatible for G2 hardware block: nxp,imx8mq-vpu-g2. To be compatible with older DT the driver is still capable to use 'ctrl' reg-name even if it is deprecated now. Signed-off-by: Benjamin Gaignard --- version 5: - This version doesn't break the backward compatibilty between kernel and DT. .../bindings/media/nxp,imx8mq-vpu.yaml | 53 ++++++++++++------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.yaml b/Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.yaml index 762be3f96ce9..79502fc8bde5 100644 --- a/Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.yaml +++ b/Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.yaml @@ -15,22 +15,18 @@ description: properties: compatible: - const: nxp,imx8mq-vpu + oneOf: + - const: nxp,imx8mq-vpu + - const: nxp,imx8mq-vpu-g2 reg: - maxItems: 3 - - reg-names: - items: - - const: g1 - - const: g2 - - const: ctrl + maxItems: 1 interrupts: - maxItems: 2 + maxItems: 1 interrupt-names: - items: + oneOf: - const: g1 - const: g2 @@ -46,14 +42,18 @@ properties: power-domains: maxItems: 1 + nxp,imx8mq-vpu-ctrl: + description: Specifies a phandle to syscon VPU hardware control block + $ref: "/schemas/types.yaml#/definitions/phandle" + required: - compatible - reg - - reg-names - interrupts - interrupt-names - clocks - clock-names + - nxp,imx8mq-vpu-ctrl additionalProperties: false @@ -62,18 +62,33 @@ examples: #include #include - vpu: video-codec at 38300000 { + vpu_ctrl: syscon at 38320000 { + compatible = "nxp,imx8mq-vpu-ctrl", "syscon"; + reg = <0x38320000 0x10000>; + }; + + vpu_g1: video-codec at 38300000 { compatible = "nxp,imx8mq-vpu"; - reg = <0x38300000 0x10000>, - <0x38310000 0x10000>, - <0x38320000 0x10000>; - reg-names = "g1", "g2", "ctrl"; - interrupts = , - ; - interrupt-names = "g1", "g2"; + reg = <0x38300000 0x10000>; + interrupts = ; + interrupt-names = "g1"; + clocks = <&clk IMX8MQ_CLK_VPU_G1_ROOT>, + <&clk IMX8MQ_CLK_VPU_G2_ROOT>, + <&clk IMX8MQ_CLK_VPU_DEC_ROOT>; + clock-names = "g1", "g2", "bus"; + power-domains = <&pgc_vpu>; + nxp,imx8mq-vpu-ctrl = <&vpu_ctrl>; + }; + + vpu_g2: video-codec at 38310000 { + compatible = "nxp,imx8mq-vpu-g2"; + reg = <0x38300000 0x10000>; + interrupts = ; + interrupt-names = "g2"; clocks = <&clk IMX8MQ_CLK_VPU_G1_ROOT>, <&clk IMX8MQ_CLK_VPU_G2_ROOT>, <&clk IMX8MQ_CLK_VPU_DEC_ROOT>; clock-names = "g1", "g2", "bus"; power-domains = <&pgc_vpu>; + nxp,imx8mq-vpu-ctrl = <&vpu_ctrl>; }; -- 2.25.1 From benjamin.gaignard at collabora.com Thu Mar 18 08:20:33 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Thu, 18 Mar 2021 09:20:33 +0100 Subject: [PATCH v6 00/13] Add HANTRO G2/HEVC decoder support for IMX8MQ Message-ID: <20210318082046.51546-1-benjamin.gaignard@collabora.com> The IMX8MQ got two VPUs but until now only G1 has been enabled. This series aim to add the second VPU (aka G2) and provide basic HEVC decoding support. To be able to decode HEVC it is needed to add/update some of the structures in the uapi. In addition of them one HANTRO dedicated control is required to inform the driver of the numbre of bits to skip at the beginning of the slice header. The hardware require to allocate few auxiliary buffers to store the references frame or tile size data. The driver has been tested with fluster test suite stream. For example with this command: ./fluster.py run -ts JCT-VC-HEVC_V1 -d GStreamer-H.265-V4L2SL-Gst1.0 This series depends of the reset rework posted here: https://www.spinics.net/lists/arm-kernel/msg878440.html Finally the both VPUs will have a node the device-tree and be independent from v4l2 point of view. A branch with all the dev is available here: https://gitlab.collabora.com/benjamin.gaignard/for-upstream/-/commits/upstream_g2_v6 version 6: - fix the errors reported by kernel test robot version 5: - use syscon instead of VPU reset driver. - Do not break kernel/DT backward compatibility. - Add documentation for dedicated Hantro control. - Fix the remarks done by Ezequeil (typo, comments, unused function) - Run v4l2-compliance without errors (see below). - Do not add field to distinguish version, check postproc reg instead version 4: - Split the changes in hevc controls in 2 commits to make them easier to review. - Change hantro_codec_ops run() prototype to return errors - Hantro v4l2 dedicated control is now only an integer - rebase on top of VPU reset changes posted here: https://www.spinics.net/lists/arm-kernel/msg878440.html - Various fix from previous remarks - Limit the modifications in API to what the driver needs version 3: - Fix typo in Hantro v4l2 dedicated control - Add documentation for the new structures and fields - Rebased on top of media_tree for-linus-5.12-rc1 tag version 2: - remove all change related to scaling - squash commits to a coherent split - be more verbose about the added fields - fix the comments done by Ezequiel about dma_alloc_coherent usage - fix Dan's comments about control copy, reverse the test logic in tile_buffer_reallocate, rework some goto and return cases. - be more verbose about why I change the bindings - remove all sign-off expect mime since it is confusing - remove useless clocks in VPUs nodes ./v4l2-compliance -m 1 v4l2-compliance 1.21.0-4705, 64 bits, 64-bit time_t v4l2-compliance SHA: 733f7a54f79d 2021-02-03 08:25:49 Compliance test for hantro-vpu device /dev/media1: Media Driver Info: Driver name : hantro-vpu Model : hantro-vpu Serial : Bus info : platform: hantro-vpu Media version : 5.11.0 Hardware revision: 0x00000000 (0) Driver version : 5.11.0 Required ioctls: test MEDIA_IOC_DEVICE_INFO: OK test invalid ioctls: OK Allow for multiple opens: test second /dev/media1 open: OK test MEDIA_IOC_DEVICE_INFO: OK test for unlimited opens: OK Media Controller ioctls: test MEDIA_IOC_G_TOPOLOGY: OK Entities: 3 Interfaces: 1 Pads: 4 Links: 4 test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK test MEDIA_IOC_SETUP_LINK: OK Total for hantro-vpu device /dev/media1: 8, Succeeded: 8, Failed: 0, Warnings: 0 -------------------------------------------------------------------------------- Compliance test for hantro-vpu device /dev/video1: Driver Info: Driver name : hantro-vpu Card type : nxp,imx8mq-vpu-g2-dec Bus info : platform: hantro-vpu Driver version : 5.11.0 Capabilities : 0x84204000 Video Memory-to-Memory Multiplanar Streaming Extended Pix Format Device Capabilities Device Caps : 0x04204000 Video Memory-to-Memory Multiplanar Streaming Extended Pix Format Media Driver Info: Driver name : hantro-vpu Model : hantro-vpu Serial : Bus info : platform: hantro-vpu Media version : 5.11.0 Hardware revision: 0x00000000 (0) Driver version : 5.11.0 Interface Info: ID : 0x0300000c Type : V4L Video Entity Info: ID : 0x00000001 (1) Name : nxp,imx8mq-vpu-g2-dec-source Function : V4L2 I/O Pad 0x01000002 : 0: Source Link 0x02000008: to remote pad 0x1000004 of entity 'nxp,imx8mq-vpu-g2-dec-proc': Data, Enabled, Immutable Required ioctls: test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK test invalid ioctls: OK Allow for multiple opens: test second /dev/video1 open: OK test VIDIOC_QUERYCAP: OK test VIDIOC_G/S_PRIORITY: OK test for unlimited opens: OK Debug ioctls: test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported) Input ioctls: test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported) test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported) Inputs: 0 Audio Inputs: 0 Tuners: 0 Output ioctls: test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported) Outputs: 0 Audio Outputs: 0 Modulators: 0 Input/Output configuration ioctls: test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported) Control ioctls: test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK test VIDIOC_G/S_CTRL: OK test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 8 Private Controls: 1 Format ioctls: test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK test VIDIOC_TRY_FMT: OK test VIDIOC_S_FMT: OK test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported) test Composing: OK (Not Supported) test Scaling: OK (Not Supported) Codec ioctls: test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) Buffer ioctls: test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK test Requests: OK Total for hantro-vpu device /dev/video1: 46, Succeeded: 46, Failed: 0, Warnings: 0 Grand Total for hantro-vpu device /dev/media1: 54, Succeeded: 54, Failed: 0, Warnings: 0 Benjamin Benjamin Gaignard (13): dt-bindings: mfd: Add 'nxp,imx8mq-vpu-ctrl' to syscon list dt-bindings: media: nxp,imx8mq-vpu: Update the bindings for G2 support media: hantro: Use syscon instead of 'ctrl' register media: hevc: Add fields and flags for hevc PPS media: hevc: Add decode params control media: hantro: change hantro_codec_ops run prototype to return errors media: hantro: Define HEVC codec profiles and supported features media: hantro: Only use postproc when post processed formats are defined media: uapi: Add a control for HANTRO driver media: hantro: handle V4L2_PIX_FMT_HEVC_SLICE control media: hantro: Introduce G2/HEVC decoder media: hantro: IMX8M: add variant for G2/HEVC codec arm64: dts: imx8mq: Add node to G2 hardware .../bindings/media/nxp,imx8mq-vpu.yaml | 53 +- .../devicetree/bindings/mfd/syscon.yaml | 1 + .../userspace-api/media/drivers/hantro.rst | 14 + .../userspace-api/media/drivers/index.rst | 1 + .../media/v4l/ext-ctrls-codec.rst | 108 +++- .../media/v4l/vidioc-queryctrl.rst | 6 + arch/arm64/boot/dts/freescale/imx8mq.dtsi | 43 +- drivers/media/v4l2-core/v4l2-ctrls.c | 26 +- drivers/staging/media/hantro/Makefile | 2 + drivers/staging/media/hantro/hantro.h | 18 +- drivers/staging/media/hantro/hantro_drv.c | 99 ++- .../staging/media/hantro/hantro_g1_h264_dec.c | 10 +- .../media/hantro/hantro_g1_mpeg2_dec.c | 4 +- .../staging/media/hantro/hantro_g1_vp8_dec.c | 6 +- .../staging/media/hantro/hantro_g2_hevc_dec.c | 587 ++++++++++++++++++ drivers/staging/media/hantro/hantro_g2_regs.h | 198 ++++++ .../staging/media/hantro/hantro_h1_jpeg_enc.c | 4 +- drivers/staging/media/hantro/hantro_hevc.c | 324 ++++++++++ drivers/staging/media/hantro/hantro_hw.h | 69 +- .../staging/media/hantro/hantro_postproc.c | 14 + drivers/staging/media/hantro/hantro_v4l2.c | 5 +- drivers/staging/media/hantro/imx8m_vpu_hw.c | 128 +++- .../media/hantro/rk3399_vpu_hw_jpeg_enc.c | 4 +- .../media/hantro/rk3399_vpu_hw_mpeg2_dec.c | 4 +- .../media/hantro/rk3399_vpu_hw_vp8_dec.c | 6 +- drivers/staging/media/sunxi/cedrus/cedrus.c | 6 + drivers/staging/media/sunxi/cedrus/cedrus.h | 1 + .../staging/media/sunxi/cedrus/cedrus_dec.c | 2 + .../staging/media/sunxi/cedrus/cedrus_h265.c | 12 +- include/media/hevc-ctrls.h | 33 +- include/uapi/linux/v4l2-controls.h | 13 + 31 files changed, 1681 insertions(+), 120 deletions(-) create mode 100644 Documentation/userspace-api/media/drivers/hantro.rst create mode 100644 drivers/staging/media/hantro/hantro_g2_hevc_dec.c create mode 100644 drivers/staging/media/hantro/hantro_g2_regs.h create mode 100644 drivers/staging/media/hantro/hantro_hevc.c -- 2.25.1 From benjamin.gaignard at collabora.com Thu Mar 18 08:20:36 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Thu, 18 Mar 2021 09:20:36 +0100 Subject: [PATCH v6 03/13] media: hantro: Use syscon instead of 'ctrl' register In-Reply-To: <20210318082046.51546-1-benjamin.gaignard@collabora.com> References: <20210318082046.51546-1-benjamin.gaignard@collabora.com> Message-ID: <20210318082046.51546-4-benjamin.gaignard@collabora.com> In order to be able to share the control hardware block between VPUs use a syscon instead a ioremap it in the driver. To keep the compatibility with older DT if 'nxp,imx8mq-vpu-ctrl' phandle is not found look at 'ctrl' reg-name. With the method it becomes useless to provide a list of register names so remove it. Signed-off-by: Benjamin Gaignard --- version 5: - use syscon instead of VPU reset driver. - if DT doesn't provide syscon keep backward compatibilty by using 'ctrl' reg-name. drivers/staging/media/hantro/hantro.h | 5 +- drivers/staging/media/hantro/imx8m_vpu_hw.c | 52 ++++++++++++--------- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h index 65f9f7ea7dcf..a99a96b84b5e 100644 --- a/drivers/staging/media/hantro/hantro.h +++ b/drivers/staging/media/hantro/hantro.h @@ -13,6 +13,7 @@ #define HANTRO_H_ #include +#include #include #include #include @@ -167,7 +168,7 @@ hantro_vdev_to_func(struct video_device *vdev) * @reg_bases: Mapped addresses of VPU registers. * @enc_base: Mapped address of VPU encoder register for convenience. * @dec_base: Mapped address of VPU decoder register for convenience. - * @ctrl_base: Mapped address of VPU control block. + * @ctrl_base: Regmap of VPU control block. * @vpu_mutex: Mutex to synchronize V4L2 calls. * @irqlock: Spinlock to synchronize access to data structures * shared with interrupt handlers. @@ -186,7 +187,7 @@ struct hantro_dev { void __iomem **reg_bases; void __iomem *enc_base; void __iomem *dec_base; - void __iomem *ctrl_base; + struct regmap *ctrl_base; struct mutex vpu_mutex; /* video_device lock */ spinlock_t irqlock; diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c index c222de075ef4..bd9d135dd440 100644 --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c @@ -7,6 +7,7 @@ #include #include +#include #include "hantro.h" #include "hantro_jpeg.h" @@ -24,30 +25,28 @@ #define CTRL_G1_PP_FUSE 0x0c #define CTRL_G2_DEC_FUSE 0x10 +static const struct regmap_config ctrl_regmap_ctrl = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 0x14, +}; + static void imx8m_soft_reset(struct hantro_dev *vpu, u32 reset_bits) { - u32 val; - /* Assert */ - val = readl(vpu->ctrl_base + CTRL_SOFT_RESET); - val &= ~reset_bits; - writel(val, vpu->ctrl_base + CTRL_SOFT_RESET); + regmap_update_bits(vpu->ctrl_base, CTRL_SOFT_RESET, reset_bits, 0); udelay(2); /* Release */ - val = readl(vpu->ctrl_base + CTRL_SOFT_RESET); - val |= reset_bits; - writel(val, vpu->ctrl_base + CTRL_SOFT_RESET); + regmap_update_bits(vpu->ctrl_base, CTRL_SOFT_RESET, + reset_bits, reset_bits); } static void imx8m_clk_enable(struct hantro_dev *vpu, u32 clock_bits) { - u32 val; - - val = readl(vpu->ctrl_base + CTRL_CLOCK_ENABLE); - val |= clock_bits; - writel(val, vpu->ctrl_base + CTRL_CLOCK_ENABLE); + regmap_update_bits(vpu->ctrl_base, CTRL_CLOCK_ENABLE, + clock_bits, clock_bits); } static int imx8mq_runtime_resume(struct hantro_dev *vpu) @@ -64,9 +63,9 @@ static int imx8mq_runtime_resume(struct hantro_dev *vpu) imx8m_clk_enable(vpu, CLOCK_G1 | CLOCK_G2); /* Set values of the fuse registers */ - writel(0xffffffff, vpu->ctrl_base + CTRL_G1_DEC_FUSE); - writel(0xffffffff, vpu->ctrl_base + CTRL_G1_PP_FUSE); - writel(0xffffffff, vpu->ctrl_base + CTRL_G2_DEC_FUSE); + regmap_write(vpu->ctrl_base, CTRL_G1_DEC_FUSE, 0xffffffff); + regmap_write(vpu->ctrl_base, CTRL_G1_PP_FUSE, 0xffffffff); + regmap_write(vpu->ctrl_base, CTRL_G2_DEC_FUSE, 0xffffffff); clk_bulk_disable_unprepare(vpu->variant->num_clocks, vpu->clocks); @@ -150,8 +149,22 @@ static irqreturn_t imx8m_vpu_g1_irq(int irq, void *dev_id) static int imx8mq_vpu_hw_init(struct hantro_dev *vpu) { - vpu->dec_base = vpu->reg_bases[0]; - vpu->ctrl_base = vpu->reg_bases[vpu->variant->num_regs - 1]; + struct device_node *np = vpu->dev->of_node; + + vpu->ctrl_base = syscon_regmap_lookup_by_phandle(np, "nxp,imx8mq-vpu-ctrl"); + if (IS_ERR(vpu->ctrl_base)) { + struct resource *res; + void __iomem *ctrl; + + res = platform_get_resource_byname(vpu->pdev, IORESOURCE_MEM, "ctrl"); + ctrl = devm_ioremap_resource(vpu->dev, res); + if (IS_ERR(ctrl)) + return PTR_ERR(ctrl); + + vpu->ctrl_base = devm_regmap_init_mmio(vpu->dev, ctrl, &ctrl_regmap_ctrl); + if (IS_ERR(vpu->ctrl_base)) + return PTR_ERR(vpu->ctrl_base); + } return 0; } @@ -198,7 +211,6 @@ static const struct hantro_irq imx8mq_irqs[] = { }; static const char * const imx8mq_clk_names[] = { "g1", "g2", "bus" }; -static const char * const imx8mq_reg_names[] = { "g1", "g2", "ctrl" }; const struct hantro_variant imx8mq_vpu_variant = { .dec_fmts = imx8m_vpu_dec_fmts, @@ -215,6 +227,4 @@ const struct hantro_variant imx8mq_vpu_variant = { .num_irqs = ARRAY_SIZE(imx8mq_irqs), .clk_names = imx8mq_clk_names, .num_clocks = ARRAY_SIZE(imx8mq_clk_names), - .reg_names = imx8mq_reg_names, - .num_regs = ARRAY_SIZE(imx8mq_reg_names) }; -- 2.25.1 From benjamin.gaignard at collabora.com Thu Mar 18 08:20:37 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Thu, 18 Mar 2021 09:20:37 +0100 Subject: [PATCH v6 04/13] media: hevc: Add fields and flags for hevc PPS In-Reply-To: <20210318082046.51546-1-benjamin.gaignard@collabora.com> References: <20210318082046.51546-1-benjamin.gaignard@collabora.com> Message-ID: <20210318082046.51546-5-benjamin.gaignard@collabora.com> Add fields and flags as they are defined in 7.4.3.3.1 "General picture parameter set RBSP semantics of the H.265 ITU specification. Signed-off-by: Benjamin Gaignard --- .../userspace-api/media/v4l/ext-ctrls-codec.rst | 14 ++++++++++++++ include/media/hevc-ctrls.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index 00944e97d638..d62e8e423f3b 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -3234,6 +3234,12 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - * - __u8 - ``num_extra_slice_header_bits`` - + * - __u8 + - ``num_ref_idx_l0_default_active_minus1`` + - Specifies the inferred value of num_ref_idx_l0_active_minus1 + * - __u8 + - ``num_ref_idx_l1_default_active_minus1`` + - Specifies the inferred value of num_ref_idx_l1_active_minus1 * - __s8 - ``init_qp_minus26`` - @@ -3342,6 +3348,14 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - * - ``V4L2_HEVC_PPS_FLAG_SLICE_SEGMENT_HEADER_EXTENSION_PRESENT`` - 0x00040000 - + * - ``V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT`` + - 0x00080000 + - Specifies the presence of deblocking filter control syntax elements in + the PPS + * - ``V4L2_HEVC_PPS_FLAG_UNIFORM_SPACING`` + - 0x00100000 + - Specifies that tile column boundaries and likewise tile row boundaries + are distributed uniformly across the picture ``V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS (struct)`` Specifies various slice-specific parameters, especially from the NAL unit diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h index b4cb2ef02f17..003f819ecb26 100644 --- a/include/media/hevc-ctrls.h +++ b/include/media/hevc-ctrls.h @@ -100,10 +100,14 @@ struct v4l2_ctrl_hevc_sps { #define V4L2_HEVC_PPS_FLAG_PPS_DISABLE_DEBLOCKING_FILTER (1ULL << 16) #define V4L2_HEVC_PPS_FLAG_LISTS_MODIFICATION_PRESENT (1ULL << 17) #define V4L2_HEVC_PPS_FLAG_SLICE_SEGMENT_HEADER_EXTENSION_PRESENT (1ULL << 18) +#define V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT (1ULL << 19) +#define V4L2_HEVC_PPS_FLAG_UNIFORM_SPACING (1ULL << 20) struct v4l2_ctrl_hevc_pps { /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */ __u8 num_extra_slice_header_bits; + __u8 num_ref_idx_l0_default_active_minus1; + __u8 num_ref_idx_l1_default_active_minus1; __s8 init_qp_minus26; __u8 diff_cu_qp_delta_depth; __s8 pps_cb_qp_offset; -- 2.25.1 From benjamin.gaignard at collabora.com Thu Mar 18 08:20:38 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Thu, 18 Mar 2021 09:20:38 +0100 Subject: [PATCH v6 05/13] media: hevc: Add decode params control In-Reply-To: <20210318082046.51546-1-benjamin.gaignard@collabora.com> References: <20210318082046.51546-1-benjamin.gaignard@collabora.com> Message-ID: <20210318082046.51546-6-benjamin.gaignard@collabora.com> Add decode params control and it associated structure to regroup all the information that are needed to decode a reference frame as it is describe in ITU-T Rec. H.265 section "8.3.2 Decoding process for reference picture set". Adapt Cedrus driver to these changes. Signed-off-by: Benjamin Gaignard --- version 6: - fix compilation errors .../media/v4l/ext-ctrls-codec.rst | 94 +++++++++++++++---- .../media/v4l/vidioc-queryctrl.rst | 6 ++ drivers/media/v4l2-core/v4l2-ctrls.c | 26 +++-- drivers/staging/media/sunxi/cedrus/cedrus.c | 6 ++ drivers/staging/media/sunxi/cedrus/cedrus.h | 1 + .../staging/media/sunxi/cedrus/cedrus_dec.c | 2 + .../staging/media/sunxi/cedrus/cedrus_h265.c | 12 ++- include/media/hevc-ctrls.h | 29 ++++-- 8 files changed, 137 insertions(+), 39 deletions(-) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index d62e8e423f3b..8a6d45cb437e 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -3436,9 +3436,6 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - * - __u8 - ``pic_struct`` - - * - __u8 - - ``num_active_dpb_entries`` - - The number of entries in ``dpb``. * - __u8 - ``ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` - The list of L0 reference elements as indices in the DPB. @@ -3446,22 +3443,8 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - - ``ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` - The list of L1 reference elements as indices in the DPB. * - __u8 - - ``num_rps_poc_st_curr_before`` - - The number of reference pictures in the short-term set that come before - the current frame. - * - __u8 - - ``num_rps_poc_st_curr_after`` - - The number of reference pictures in the short-term set that come after - the current frame. - * - __u8 - - ``num_rps_poc_lt_curr`` - - The number of reference pictures in the long-term set. - * - __u8 - - ``padding[7]`` + - ``padding`` - Applications and drivers must set this to zero. - * - struct :c:type:`v4l2_hevc_dpb_entry` - - ``dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` - - The decoded picture buffer, for meta-data about reference frames. * - struct :c:type:`v4l2_hevc_pred_weight_table` - ``pred_weight_table`` - The prediction weight coefficients for inter-picture prediction. @@ -3660,3 +3643,78 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - so this has to come from client. This is applicable to H264 and valid Range is from 0 to 63. Source Rec. ITU-T H.264 (06/2019); G.7.4.1.1, G.8.8.1. + +``V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS (struct)`` + Specifies various decode parameters, especially the references picture order + count (POC) for all the lists (short, long, before, current, after) and the + number of entries for each of them. + These parameters are defined according to :ref:`hevc`. + They are described in section 8.3 "Slice decoding process" of the + specification. + +.. c:type:: v4l2_ctrl_hevc_decode_params + +.. cssclass:: longtable + +.. flat-table:: struct v4l2_ctrl_hevc_decode_params + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - __s32 + - ``pic_order_cnt_val`` + - PicOrderCntVal as described in section 8.3.1 "Decoding process + for picture order count" of the specification. + * - __u8 + - ``num_active_dpb_entries`` + - The number of entries in ``dpb``. + * - struct :c:type:`v4l2_hevc_dpb_entry` + - ``dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` + - The decoded picture buffer, for meta-data about reference frames. + * - __u8 + - ``num_poc_st_curr_before`` + - The number of reference pictures in the short-term set that come before + the current frame. + * - __u8 + - ``num_poc_st_curr_after`` + - The number of reference pictures in the short-term set that come after + the current frame. + * - __u8 + - ``num_poc_lt_curr`` + - The number of reference pictures in the long-term set. + * - __u8 + - ``poc_st_curr_before[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` + - PocStCurrBefore as described in section 8.3.2 "Decoding process for reference + picture set. + * - __u8 + - ``poc_st_curr_after[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` + - PocStCurrAfter as described in section 8.3.2 "Decoding process for reference + picture set. + * - __u8 + - ``poc_lt_curr[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` + - PocLtCurr as described in section 8.3.2 "Decoding process for reference + picture set. + * - __u64 + - ``flags`` + - See :ref:`Decode Parameters Flags ` + +.. _hevc_decode_params_flags: + +``Decode Parameters Flags`` + +.. cssclass:: longtable + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - ``V4L2_HEVC_DECODE_PARAM_FLAG_IRAP_PIC`` + - 0x00000001 + - + * - ``V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC`` + - 0x00000002 + - + * - ``V4L2_HEVC_DECODE_PARAM_FLAG_NO_OUTPUT_OF_PRIOR`` + - 0x00000004 + - diff --git a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst index 82f61f1e2fb8..d84ae255bc79 100644 --- a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst +++ b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst @@ -486,6 +486,12 @@ See also the examples in :ref:`control`. - n/a - A struct :c:type:`v4l2_ctrl_hevc_slice_params`, containing HEVC slice parameters for stateless video decoders. + * - ``V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS`` + - n/a + - n/a + - n/a + - A struct :c:type:`v4l2_ctrl_hevc_decode_params`, containing HEVC + decoding parameters for stateless video decoders. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 016cf6204cbb..4060b5bcc3c0 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1028,6 +1028,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MPEG_VIDEO_HEVC_SPS: return "HEVC Sequence Parameter Set"; case V4L2_CID_MPEG_VIDEO_HEVC_PPS: return "HEVC Picture Parameter Set"; case V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS: return "HEVC Slice Parameters"; + case V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS: return "HEVC Decode Parameters"; case V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE: return "HEVC Decode Mode"; case V4L2_CID_MPEG_VIDEO_HEVC_START_CODE: return "HEVC Start Code"; @@ -1482,6 +1483,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS: *type = V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS; break; + case V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS: + *type = V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS; + break; case V4L2_CID_UNIT_CELL_SIZE: *type = V4L2_CTRL_TYPE_AREA; *flags |= V4L2_CTRL_FLAG_READ_ONLY; @@ -1833,6 +1837,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, struct v4l2_ctrl_hevc_sps *p_hevc_sps; struct v4l2_ctrl_hevc_pps *p_hevc_pps; struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params; + struct v4l2_ctrl_hevc_decode_params *p_hevc_decode_params; struct v4l2_area *area; void *p = ptr.p + idx * ctrl->elem_size; unsigned int i; @@ -2108,23 +2113,27 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, zero_padding(*p_hevc_pps); break; - case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS: - p_hevc_slice_params = p; + case V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS: + p_hevc_decode_params = p; - if (p_hevc_slice_params->num_active_dpb_entries > + if (p_hevc_decode_params->num_active_dpb_entries > V4L2_HEVC_DPB_ENTRIES_NUM_MAX) return -EINVAL; - zero_padding(p_hevc_slice_params->pred_weight_table); - - for (i = 0; i < p_hevc_slice_params->num_active_dpb_entries; + for (i = 0; i < p_hevc_decode_params->num_active_dpb_entries; i++) { struct v4l2_hevc_dpb_entry *dpb_entry = - &p_hevc_slice_params->dpb[i]; + &p_hevc_decode_params->dpb[i]; zero_padding(*dpb_entry); } + break; + + case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS: + p_hevc_slice_params = p; + + zero_padding(p_hevc_slice_params->pred_weight_table); zero_padding(*p_hevc_slice_params); break; @@ -2821,6 +2830,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS: elem_size = sizeof(struct v4l2_ctrl_hevc_slice_params); break; + case V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS: + elem_size = sizeof(struct v4l2_ctrl_hevc_decode_params); + break; case V4L2_CTRL_TYPE_AREA: elem_size = sizeof(struct v4l2_area); break; diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c index 7bd9291c8d5f..4cd3cab1a257 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c @@ -151,6 +151,12 @@ static const struct cedrus_control cedrus_controls[] = { }, .codec = CEDRUS_CODEC_VP8, }, + { + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS, + }, + .codec = CEDRUS_CODEC_H265, + }, }; #define CEDRUS_CONTROLS_COUNT ARRAY_SIZE(cedrus_controls) diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/staging/media/sunxi/cedrus/cedrus.h index 251a6a660351..2ca33ac38b9a 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus.h +++ b/drivers/staging/media/sunxi/cedrus/cedrus.h @@ -76,6 +76,7 @@ struct cedrus_h265_run { const struct v4l2_ctrl_hevc_sps *sps; const struct v4l2_ctrl_hevc_pps *pps; const struct v4l2_ctrl_hevc_slice_params *slice_params; + const struct v4l2_ctrl_hevc_decode_params *decode_params; }; struct cedrus_vp8_run { diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c index a9090daf626a..cd821f417a14 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c @@ -68,6 +68,8 @@ void cedrus_device_run(void *priv) V4L2_CID_MPEG_VIDEO_HEVC_PPS); run.h265.slice_params = cedrus_find_control_data(ctx, V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS); + run.h265.decode_params = cedrus_find_control_data(ctx, + V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS); break; case V4L2_PIX_FMT_VP8_FRAME: diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c index ce497d0197df..397a4ba5df4c 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c @@ -245,6 +245,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, const struct v4l2_ctrl_hevc_sps *sps; const struct v4l2_ctrl_hevc_pps *pps; const struct v4l2_ctrl_hevc_slice_params *slice_params; + const struct v4l2_ctrl_hevc_decode_params *decode_params; const struct v4l2_hevc_pred_weight_table *pred_weight_table; dma_addr_t src_buf_addr; dma_addr_t src_buf_end_addr; @@ -256,6 +257,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, sps = run->h265.sps; pps = run->h265.pps; slice_params = run->h265.slice_params; + decode_params = run->h265.decode_params; pred_weight_table = &slice_params->pred_weight_table; /* MV column buffer size and allocation. */ @@ -487,7 +489,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, reg = VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_TC_OFFSET_DIV2(slice_params->slice_tc_offset_div2) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_BETA_OFFSET_DIV2(slice_params->slice_beta_offset_div2) | - VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_POC_BIGEST_IN_RPS_ST(slice_params->num_rps_poc_st_curr_after == 0) | + VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_POC_BIGEST_IN_RPS_ST(decode_params->num_poc_st_curr_after == 0) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CR_QP_OFFSET(slice_params->slice_cr_qp_offset) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CB_QP_OFFSET(slice_params->slice_cb_qp_offset) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_QP_DELTA(slice_params->slice_qp_delta); @@ -527,8 +529,8 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, cedrus_write(dev, VE_DEC_H265_NEIGHBOR_INFO_ADDR, reg); /* Write decoded picture buffer in pic list. */ - cedrus_h265_frame_info_write_dpb(ctx, slice_params->dpb, - slice_params->num_active_dpb_entries); + cedrus_h265_frame_info_write_dpb(ctx, decode_params->dpb, + decode_params->num_active_dpb_entries); /* Output frame. */ @@ -545,7 +547,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, /* Reference picture list 0 (for P/B frames). */ if (slice_params->slice_type != V4L2_HEVC_SLICE_TYPE_I) { - cedrus_h265_ref_pic_list_write(dev, slice_params->dpb, + cedrus_h265_ref_pic_list_write(dev, decode_params->dpb, slice_params->ref_idx_l0, slice_params->num_ref_idx_l0_active_minus1 + 1, VE_DEC_H265_SRAM_OFFSET_REF_PIC_LIST0); @@ -564,7 +566,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, /* Reference picture list 1 (for B frames). */ if (slice_params->slice_type == V4L2_HEVC_SLICE_TYPE_B) { - cedrus_h265_ref_pic_list_write(dev, slice_params->dpb, + cedrus_h265_ref_pic_list_write(dev, decode_params->dpb, slice_params->ref_idx_l1, slice_params->num_ref_idx_l1_active_minus1 + 1, VE_DEC_H265_SRAM_OFFSET_REF_PIC_LIST1); diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h index 003f819ecb26..8e0109eea454 100644 --- a/include/media/hevc-ctrls.h +++ b/include/media/hevc-ctrls.h @@ -19,6 +19,7 @@ #define V4L2_CID_MPEG_VIDEO_HEVC_SPS (V4L2_CID_CODEC_BASE + 1008) #define V4L2_CID_MPEG_VIDEO_HEVC_PPS (V4L2_CID_CODEC_BASE + 1009) #define V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS (V4L2_CID_CODEC_BASE + 1010) +#define V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS (V4L2_CID_CODEC_BASE + 1012) #define V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE (V4L2_CID_CODEC_BASE + 1015) #define V4L2_CID_MPEG_VIDEO_HEVC_START_CODE (V4L2_CID_CODEC_BASE + 1016) @@ -26,6 +27,7 @@ #define V4L2_CTRL_TYPE_HEVC_SPS 0x0120 #define V4L2_CTRL_TYPE_HEVC_PPS 0x0121 #define V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS 0x0122 +#define V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS 0x0124 enum v4l2_mpeg_video_hevc_decode_mode { V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_SLICE_BASED, @@ -194,18 +196,10 @@ struct v4l2_ctrl_hevc_slice_params { __u8 pic_struct; /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ - __u8 num_active_dpb_entries; __u8 ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; __u8 ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; - __u8 num_rps_poc_st_curr_before; - __u8 num_rps_poc_st_curr_after; - __u8 num_rps_poc_lt_curr; - - __u8 padding; - - /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ - struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; + __u8 padding[5]; /* ISO/IEC 23008-2, ITU-T Rec. H.265: Weighted prediction parameter */ struct v4l2_hevc_pred_weight_table pred_weight_table; @@ -213,4 +207,21 @@ struct v4l2_ctrl_hevc_slice_params { __u64 flags; }; +#define V4L2_HEVC_DECODE_PARAM_FLAG_IRAP_PIC 0x1 +#define V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC 0x2 +#define V4L2_HEVC_DECODE_PARAM_FLAG_NO_OUTPUT_OF_PRIOR 0x4 + +struct v4l2_ctrl_hevc_decode_params { + __s32 pic_order_cnt_val; + __u8 num_active_dpb_entries; + struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; + __u8 num_poc_st_curr_before; + __u8 num_poc_st_curr_after; + __u8 num_poc_lt_curr; + __u8 poc_st_curr_before[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; + __u8 poc_st_curr_after[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; + __u8 poc_lt_curr[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; + __u64 flags; +}; + #endif -- 2.25.1 From benjamin.gaignard at collabora.com Thu Mar 18 08:20:39 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Thu, 18 Mar 2021 09:20:39 +0100 Subject: [PATCH v6 06/13] media: hantro: change hantro_codec_ops run prototype to return errors In-Reply-To: <20210318082046.51546-1-benjamin.gaignard@collabora.com> References: <20210318082046.51546-1-benjamin.gaignard@collabora.com> Message-ID: <20210318082046.51546-7-benjamin.gaignard@collabora.com> Change hantro_codec_ops run prototype from 'void' to 'int'. This allow to cancel the job if an error occur while configuring the hardware. Signed-off-by: Benjamin Gaignard --- version 5: - forward hantro_h264_dec_prepare_run() return value in case of error drivers/staging/media/hantro/hantro_drv.c | 4 +++- .../staging/media/hantro/hantro_g1_h264_dec.c | 10 +++++++--- .../media/hantro/hantro_g1_mpeg2_dec.c | 4 +++- .../staging/media/hantro/hantro_g1_vp8_dec.c | 6 ++++-- .../staging/media/hantro/hantro_h1_jpeg_enc.c | 4 +++- drivers/staging/media/hantro/hantro_hw.h | 19 ++++++++++--------- .../media/hantro/rk3399_vpu_hw_jpeg_enc.c | 4 +++- .../media/hantro/rk3399_vpu_hw_mpeg2_dec.c | 4 +++- .../media/hantro/rk3399_vpu_hw_vp8_dec.c | 6 ++++-- 9 files changed, 40 insertions(+), 21 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index e5f200e64993..ac1429f00b33 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -161,7 +161,9 @@ static void device_run(void *priv) v4l2_m2m_buf_copy_metadata(src, dst, true); - ctx->codec_ops->run(ctx); + if (ctx->codec_ops->run(ctx)) + goto err_cancel_job; + return; err_cancel_job: diff --git a/drivers/staging/media/hantro/hantro_g1_h264_dec.c b/drivers/staging/media/hantro/hantro_g1_h264_dec.c index 845bef73d218..5c792b7bcb79 100644 --- a/drivers/staging/media/hantro/hantro_g1_h264_dec.c +++ b/drivers/staging/media/hantro/hantro_g1_h264_dec.c @@ -273,13 +273,15 @@ static void set_buffers(struct hantro_ctx *ctx) vdpu_write_relaxed(vpu, ctx->h264_dec.priv.dma, G1_REG_ADDR_QTABLE); } -void hantro_g1_h264_dec_run(struct hantro_ctx *ctx) +int hantro_g1_h264_dec_run(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; + int ret; /* Prepare the H264 decoder context. */ - if (hantro_h264_dec_prepare_run(ctx)) - return; + ret = hantro_h264_dec_prepare_run(ctx); + if (ret) + return ret; /* Configure hardware registers. */ set_params(ctx); @@ -301,4 +303,6 @@ void hantro_g1_h264_dec_run(struct hantro_ctx *ctx) G1_REG_CONFIG_DEC_CLK_GATE_E, G1_REG_CONFIG); vdpu_write(vpu, G1_REG_INTERRUPT_DEC_E, G1_REG_INTERRUPT); + + return 0; } diff --git a/drivers/staging/media/hantro/hantro_g1_mpeg2_dec.c b/drivers/staging/media/hantro/hantro_g1_mpeg2_dec.c index 6386a3989bfe..5e8943d31dc5 100644 --- a/drivers/staging/media/hantro/hantro_g1_mpeg2_dec.c +++ b/drivers/staging/media/hantro/hantro_g1_mpeg2_dec.c @@ -155,7 +155,7 @@ hantro_g1_mpeg2_dec_set_buffers(struct hantro_dev *vpu, struct hantro_ctx *ctx, vdpu_write_relaxed(vpu, backward_addr, G1_REG_REFER3_BASE); } -void hantro_g1_mpeg2_dec_run(struct hantro_ctx *ctx) +int hantro_g1_mpeg2_dec_run(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *src_buf, *dst_buf; @@ -248,4 +248,6 @@ void hantro_g1_mpeg2_dec_run(struct hantro_ctx *ctx) reg = G1_REG_DEC_E(1); vdpu_write(vpu, reg, G1_SWREG(1)); + + return 0; } diff --git a/drivers/staging/media/hantro/hantro_g1_vp8_dec.c b/drivers/staging/media/hantro/hantro_g1_vp8_dec.c index a5cdf150cd16..d665df026546 100644 --- a/drivers/staging/media/hantro/hantro_g1_vp8_dec.c +++ b/drivers/staging/media/hantro/hantro_g1_vp8_dec.c @@ -426,7 +426,7 @@ static void cfg_buffers(struct hantro_ctx *ctx, vdpu_write_relaxed(vpu, dst_dma, G1_REG_ADDR_DST); } -void hantro_g1_vp8_dec_run(struct hantro_ctx *ctx) +int hantro_g1_vp8_dec_run(struct hantro_ctx *ctx) { const struct v4l2_ctrl_vp8_frame_header *hdr; struct hantro_dev *vpu = ctx->dev; @@ -439,7 +439,7 @@ void hantro_g1_vp8_dec_run(struct hantro_ctx *ctx) hdr = hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER); if (WARN_ON(!hdr)) - return; + return -EINVAL; /* Reset segment_map buffer in keyframe */ if (VP8_FRAME_IS_KEY_FRAME(hdr) && ctx->vp8_dec.segment_map.cpu) @@ -499,4 +499,6 @@ void hantro_g1_vp8_dec_run(struct hantro_ctx *ctx) hantro_end_prepare_run(ctx); vdpu_write(vpu, G1_REG_INTERRUPT_DEC_E, G1_REG_INTERRUPT); + + return 0; } diff --git a/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c b/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c index b88dc4ed06db..56cf261a8e95 100644 --- a/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c +++ b/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c @@ -88,7 +88,7 @@ hantro_h1_jpeg_enc_set_qtable(struct hantro_dev *vpu, } } -void hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx) +int hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *src_buf, *dst_buf; @@ -136,6 +136,8 @@ void hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx) hantro_end_prepare_run(ctx); vepu_write(vpu, reg, H1_REG_ENC_CTRL); + + return 0; } void hantro_jpeg_enc_done(struct hantro_ctx *ctx) diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h index 34c9e4649a25..4e2e7a5ed283 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -126,14 +126,15 @@ struct hantro_postproc_ctx { * Optional and called from process context. * @run: Start single {en,de)coding job. Called from atomic context * to indicate that a pair of buffers is ready and the hardware - * should be programmed and started. + * should be programmed and started. Returns zero if OK, a + * negative value in error cases. * @done: Read back processing results and additional data from hardware. * @reset: Reset the hardware in case of a timeout. */ struct hantro_codec_ops { int (*init)(struct hantro_ctx *ctx); void (*exit)(struct hantro_ctx *ctx); - void (*run)(struct hantro_ctx *ctx); + int (*run)(struct hantro_ctx *ctx); void (*done)(struct hantro_ctx *ctx); void (*reset)(struct hantro_ctx *ctx); }; @@ -164,8 +165,8 @@ void hantro_irq_done(struct hantro_dev *vpu, void hantro_start_prepare_run(struct hantro_ctx *ctx); void hantro_end_prepare_run(struct hantro_ctx *ctx); -void hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx); -void rk3399_vpu_jpeg_enc_run(struct hantro_ctx *ctx); +int hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx); +int rk3399_vpu_jpeg_enc_run(struct hantro_ctx *ctx); int hantro_jpeg_enc_init(struct hantro_ctx *ctx); void hantro_jpeg_enc_exit(struct hantro_ctx *ctx); void hantro_jpeg_enc_done(struct hantro_ctx *ctx); @@ -173,7 +174,7 @@ void hantro_jpeg_enc_done(struct hantro_ctx *ctx); dma_addr_t hantro_h264_get_ref_buf(struct hantro_ctx *ctx, unsigned int dpb_idx); int hantro_h264_dec_prepare_run(struct hantro_ctx *ctx); -void hantro_g1_h264_dec_run(struct hantro_ctx *ctx); +int hantro_g1_h264_dec_run(struct hantro_ctx *ctx); int hantro_h264_dec_init(struct hantro_ctx *ctx); void hantro_h264_dec_exit(struct hantro_ctx *ctx); @@ -204,15 +205,15 @@ hantro_h264_mv_size(unsigned int width, unsigned int height) return 64 * MB_WIDTH(width) * MB_WIDTH(height) + 32; } -void hantro_g1_mpeg2_dec_run(struct hantro_ctx *ctx); -void rk3399_vpu_mpeg2_dec_run(struct hantro_ctx *ctx); +int hantro_g1_mpeg2_dec_run(struct hantro_ctx *ctx); +int rk3399_vpu_mpeg2_dec_run(struct hantro_ctx *ctx); void hantro_mpeg2_dec_copy_qtable(u8 *qtable, const struct v4l2_ctrl_mpeg2_quantization *ctrl); int hantro_mpeg2_dec_init(struct hantro_ctx *ctx); void hantro_mpeg2_dec_exit(struct hantro_ctx *ctx); -void hantro_g1_vp8_dec_run(struct hantro_ctx *ctx); -void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx); +int hantro_g1_vp8_dec_run(struct hantro_ctx *ctx); +int rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx); int hantro_vp8_dec_init(struct hantro_ctx *ctx); void hantro_vp8_dec_exit(struct hantro_ctx *ctx); void hantro_vp8_prob_update(struct hantro_ctx *ctx, diff --git a/drivers/staging/media/hantro/rk3399_vpu_hw_jpeg_enc.c b/drivers/staging/media/hantro/rk3399_vpu_hw_jpeg_enc.c index 3498e6124acd..3a27ebef4f38 100644 --- a/drivers/staging/media/hantro/rk3399_vpu_hw_jpeg_enc.c +++ b/drivers/staging/media/hantro/rk3399_vpu_hw_jpeg_enc.c @@ -118,7 +118,7 @@ rk3399_vpu_jpeg_enc_set_qtable(struct hantro_dev *vpu, } } -void rk3399_vpu_jpeg_enc_run(struct hantro_ctx *ctx) +int rk3399_vpu_jpeg_enc_run(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *src_buf, *dst_buf; @@ -168,4 +168,6 @@ void rk3399_vpu_jpeg_enc_run(struct hantro_ctx *ctx) /* Kick the watchdog and start encoding */ hantro_end_prepare_run(ctx); vepu_write(vpu, reg, VEPU_REG_ENCODE_START); + + return 0; } diff --git a/drivers/staging/media/hantro/rk3399_vpu_hw_mpeg2_dec.c b/drivers/staging/media/hantro/rk3399_vpu_hw_mpeg2_dec.c index f610fa5b4335..4bd3080abbc1 100644 --- a/drivers/staging/media/hantro/rk3399_vpu_hw_mpeg2_dec.c +++ b/drivers/staging/media/hantro/rk3399_vpu_hw_mpeg2_dec.c @@ -157,7 +157,7 @@ rk3399_vpu_mpeg2_dec_set_buffers(struct hantro_dev *vpu, vdpu_write_relaxed(vpu, backward_addr, VDPU_REG_REFER3_BASE); } -void rk3399_vpu_mpeg2_dec_run(struct hantro_ctx *ctx) +int rk3399_vpu_mpeg2_dec_run(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *src_buf, *dst_buf; @@ -254,4 +254,6 @@ void rk3399_vpu_mpeg2_dec_run(struct hantro_ctx *ctx) reg = vdpu_read(vpu, VDPU_SWREG(57)) | VDPU_REG_DEC_E(1); vdpu_write(vpu, reg, VDPU_SWREG(57)); + + return 0; } diff --git a/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c b/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c index a4a792f00b11..755571e16fcd 100644 --- a/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c +++ b/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c @@ -504,7 +504,7 @@ static void cfg_buffers(struct hantro_ctx *ctx, vdpu_write_relaxed(vpu, dst_dma, VDPU_REG_ADDR_DST); } -void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx) +int rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx) { const struct v4l2_ctrl_vp8_frame_header *hdr; struct hantro_dev *vpu = ctx->dev; @@ -517,7 +517,7 @@ void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx) hdr = hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER); if (WARN_ON(!hdr)) - return; + return -EINVAL; /* Reset segment_map buffer in keyframe */ if (VP8_FRAME_IS_KEY_FRAME(hdr) && ctx->vp8_dec.segment_map.cpu) @@ -590,4 +590,6 @@ void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx) hantro_end_prepare_run(ctx); hantro_reg_write(vpu, &vp8_dec_start_dec, 1); + + return 0; } -- 2.25.1 From benjamin.gaignard at collabora.com Thu Mar 18 08:20:40 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Thu, 18 Mar 2021 09:20:40 +0100 Subject: [PATCH v6 07/13] media: hantro: Define HEVC codec profiles and supported features In-Reply-To: <20210318082046.51546-1-benjamin.gaignard@collabora.com> References: <20210318082046.51546-1-benjamin.gaignard@collabora.com> Message-ID: <20210318082046.51546-8-benjamin.gaignard@collabora.com> Define which HEVC profiles (up to level 5.1) and features (no scaling, no 10 bits) are supported by the driver. Signed-off-by: Benjamin Gaignard --- drivers/staging/media/hantro/hantro.h | 3 ++ drivers/staging/media/hantro/hantro_drv.c | 58 +++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h index a99a96b84b5e..4ae2071b3bfe 100644 --- a/drivers/staging/media/hantro/hantro.h +++ b/drivers/staging/media/hantro/hantro.h @@ -35,6 +35,7 @@ struct hantro_codec_ops; #define HANTRO_MPEG2_DECODER BIT(16) #define HANTRO_VP8_DECODER BIT(17) #define HANTRO_H264_DECODER BIT(18) +#define HANTRO_HEVC_DECODER BIT(19) #define HANTRO_DECODERS 0xffff0000 /** @@ -100,6 +101,7 @@ struct hantro_variant { * @HANTRO_MODE_H264_DEC: H264 decoder. * @HANTRO_MODE_MPEG2_DEC: MPEG-2 decoder. * @HANTRO_MODE_VP8_DEC: VP8 decoder. + * @HANTRO_MODE_HEVC_DEC: HEVC decoder. */ enum hantro_codec_mode { HANTRO_MODE_NONE = -1, @@ -107,6 +109,7 @@ enum hantro_codec_mode { HANTRO_MODE_H264_DEC, HANTRO_MODE_MPEG2_DEC, HANTRO_MODE_VP8_DEC, + HANTRO_MODE_HEVC_DEC, }; /* diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index ac1429f00b33..f0b68e16fcc0 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -245,6 +245,18 @@ static int hantro_try_ctrl(struct v4l2_ctrl *ctrl) if (sps->bit_depth_luma_minus8 != 0) /* Only 8-bit is supported */ return -EINVAL; + } else if (ctrl->id == V4L2_CID_MPEG_VIDEO_HEVC_SPS) { + const struct v4l2_ctrl_hevc_sps *sps = ctrl->p_new.p_hevc_sps; + + if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8) + /* Luma and chroma bit depth mismatch */ + return -EINVAL; + if (sps->bit_depth_luma_minus8 != 0) + /* Only 8-bit is supported */ + return -EINVAL; + if (sps->flags & V4L2_HEVC_SPS_FLAG_SCALING_LIST_ENABLED) + /* No scaling support */ + return -EINVAL; } return 0; } @@ -351,6 +363,52 @@ static const struct hantro_ctrl controls[] = { .def = V4L2_MPEG_VIDEO_H264_PROFILE_MAIN, } }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE, + .min = V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_FRAME_BASED, + .max = V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_FRAME_BASED, + .def = V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_FRAME_BASED, + }, + }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_START_CODE, + .min = V4L2_MPEG_VIDEO_HEVC_START_CODE_ANNEX_B, + .max = V4L2_MPEG_VIDEO_HEVC_START_CODE_ANNEX_B, + .def = V4L2_MPEG_VIDEO_HEVC_START_CODE_ANNEX_B, + }, + }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_PROFILE, + .min = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN, + .max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10, + .def = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN, + }, + }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_LEVEL, + .min = V4L2_MPEG_VIDEO_HEVC_LEVEL_1, + .max = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1, + }, + }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_SPS, + .ops = &hantro_ctrl_ops, + }, + }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_PPS, + }, + }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS, + }, }, }; -- 2.25.1 From benjamin.gaignard at collabora.com Thu Mar 18 08:20:41 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Thu, 18 Mar 2021 09:20:41 +0100 Subject: [PATCH v6 08/13] media: hantro: Only use postproc when post processed formats are defined In-Reply-To: <20210318082046.51546-1-benjamin.gaignard@collabora.com> References: <20210318082046.51546-1-benjamin.gaignard@collabora.com> Message-ID: <20210318082046.51546-9-benjamin.gaignard@collabora.com> If the variant doesn't offert postprocessed formats make sure it will be ok. Signed-off-by: Benjamin Gaignard --- drivers/staging/media/hantro/hantro.h | 8 ++------ drivers/staging/media/hantro/hantro_postproc.c | 14 ++++++++++++++ drivers/staging/media/hantro/hantro_v4l2.c | 4 +++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h index 4ae2071b3bfe..83299e8d3a6c 100644 --- a/drivers/staging/media/hantro/hantro.h +++ b/drivers/staging/media/hantro/hantro.h @@ -413,12 +413,8 @@ hantro_get_dst_buf(struct hantro_ctx *ctx) return v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); } -static inline bool -hantro_needs_postproc(const struct hantro_ctx *ctx, - const struct hantro_fmt *fmt) -{ - return !ctx->is_encoder && fmt->fourcc != V4L2_PIX_FMT_NV12; -} +bool hantro_needs_postproc(const struct hantro_ctx *ctx, + const struct hantro_fmt *fmt); static inline dma_addr_t hantro_get_dec_buf_addr(struct hantro_ctx *ctx, struct vb2_buffer *vb) diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c index 6d2a8f2a8f0b..ed8916c950a4 100644 --- a/drivers/staging/media/hantro/hantro_postproc.c +++ b/drivers/staging/media/hantro/hantro_postproc.c @@ -50,6 +50,20 @@ const struct hantro_postproc_regs hantro_g1_postproc_regs = { .display_width = {G1_REG_PP_DISPLAY_WIDTH, 0, 0xfff}, }; +bool hantro_needs_postproc(const struct hantro_ctx *ctx, + const struct hantro_fmt *fmt) +{ + struct hantro_dev *vpu = ctx->dev; + + if (ctx->is_encoder) + return false; + + if (!vpu->variant->postproc_fmts) + return false; + + return fmt->fourcc != V4L2_PIX_FMT_NV12; +} + void hantro_postproc_enable(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c index 1bc118e375a1..77d7fe62ce81 100644 --- a/drivers/staging/media/hantro/hantro_v4l2.c +++ b/drivers/staging/media/hantro/hantro_v4l2.c @@ -55,7 +55,9 @@ static const struct hantro_fmt * hantro_get_postproc_formats(const struct hantro_ctx *ctx, unsigned int *num_fmts) { - if (ctx->is_encoder) { + struct hantro_dev *vpu = ctx->dev; + + if (ctx->is_encoder || !vpu->variant->postproc_fmts) { *num_fmts = 0; return NULL; } -- 2.25.1 From benjamin.gaignard at collabora.com Thu Mar 18 08:20:42 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Thu, 18 Mar 2021 09:20:42 +0100 Subject: [PATCH v6 09/13] media: uapi: Add a control for HANTRO driver In-Reply-To: <20210318082046.51546-1-benjamin.gaignard@collabora.com> References: <20210318082046.51546-1-benjamin.gaignard@collabora.com> Message-ID: <20210318082046.51546-10-benjamin.gaignard@collabora.com> The HEVC HANTRO driver needs to know the number of bits to skip at the beginning of the slice header. That is a hardware specific requirement so create a dedicated control that this purpose. Signed-off-by: Benjamin Gaignard --- version 5: - Be even more verbose in control documentation. - Do not create class for the control. version 4: - The control is now an integer which is enough to provide the numbers of bits to skip. version 3: - Fix typo in field name .../userspace-api/media/drivers/hantro.rst | 14 ++++++++++++++ .../userspace-api/media/drivers/index.rst | 1 + include/uapi/linux/v4l2-controls.h | 13 +++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 Documentation/userspace-api/media/drivers/hantro.rst diff --git a/Documentation/userspace-api/media/drivers/hantro.rst b/Documentation/userspace-api/media/drivers/hantro.rst new file mode 100644 index 000000000000..78dcd2a44a03 --- /dev/null +++ b/Documentation/userspace-api/media/drivers/hantro.rst @@ -0,0 +1,14 @@ +.. SPDX-License-Identifier: GPL-2.0 + +Hantro video decoder driver +=========================== + +The Hantro video decoder driver implements the following driver-specific controls: + +``V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP (integer)`` + Specifies to Hantro HEVC video decoder driver the number of data (in bits) to + skip in the slice segment header. + If non-IDR, the bits to be skipped go from syntax element "pic_output_flag" + to before syntax element "slice_temporal_mvp_enabled_flag". + If IDR, the skipped bits are just "pic_output_flag" + (separate_colour_plane_flag is not supported). diff --git a/Documentation/userspace-api/media/drivers/index.rst b/Documentation/userspace-api/media/drivers/index.rst index 1a9038f5f9fa..12e3c512d718 100644 --- a/Documentation/userspace-api/media/drivers/index.rst +++ b/Documentation/userspace-api/media/drivers/index.rst @@ -33,6 +33,7 @@ For more details see the file COPYING in the source distribution of Linux. ccs cx2341x-uapi + hantro imx-uapi max2175 meye-uapi diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 039c0d7add1b..cebfb57080ed 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -865,6 +865,19 @@ enum v4l2_mpeg_mfc51_video_force_frame_type { #define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_CODEC_MFC51_BASE+53) #define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_CODEC_MFC51_BASE+54) +/* MPEG-class control IDs specific to the Hantro driver as defined by V4L2 */ +#define V4L2_CID_CODEC_HANTRO_BASE (V4L2_CTRL_CLASS_CODEC | 0x1200) +/* + * V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP - + * the number of data (in bits) to skip in the + * slice segment header. + * If non-IDR, the bits to be skipped go from syntax element "pic_output_flag" + * to before syntax element "slice_temporal_mvp_enabled_flag". + * If IDR, the skipped bits are just "pic_output_flag" + * (separate_colour_plane_flag is not supported). + */ +#define V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP (V4L2_CID_CODEC_HANTRO_BASE + 0) + /* Camera class control IDs */ #define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900) -- 2.25.1 From benjamin.gaignard at collabora.com Thu Mar 18 08:20:43 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Thu, 18 Mar 2021 09:20:43 +0100 Subject: [PATCH v6 10/13] media: hantro: handle V4L2_PIX_FMT_HEVC_SLICE control In-Reply-To: <20210318082046.51546-1-benjamin.gaignard@collabora.com> References: <20210318082046.51546-1-benjamin.gaignard@collabora.com> Message-ID: <20210318082046.51546-11-benjamin.gaignard@collabora.com> Make sure that V4L2_PIX_FMT_HEVC_SLICE is correctly handle by v4l2 of the driver. Signed-off-by: Benjamin Gaignard --- drivers/staging/media/hantro/hantro_v4l2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c index 77d7fe62ce81..0655324fd0d4 100644 --- a/drivers/staging/media/hantro/hantro_v4l2.c +++ b/drivers/staging/media/hantro/hantro_v4l2.c @@ -392,6 +392,7 @@ hantro_update_requires_request(struct hantro_ctx *ctx, u32 fourcc) case V4L2_PIX_FMT_MPEG2_SLICE: case V4L2_PIX_FMT_VP8_FRAME: case V4L2_PIX_FMT_H264_SLICE: + case V4L2_PIX_FMT_HEVC_SLICE: ctx->fh.m2m_ctx->out_q_ctx.q.requires_requests = true; break; default: -- 2.25.1 From benjamin.gaignard at collabora.com Thu Mar 18 08:20:45 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Thu, 18 Mar 2021 09:20:45 +0100 Subject: [PATCH v6 12/13] media: hantro: IMX8M: add variant for G2/HEVC codec In-Reply-To: <20210318082046.51546-1-benjamin.gaignard@collabora.com> References: <20210318082046.51546-1-benjamin.gaignard@collabora.com> Message-ID: <20210318082046.51546-13-benjamin.gaignard@collabora.com> Add variant to IMX8M to enable G2/HEVC codec. Define the capabilities for the hardware up to 3840x2160. G2 doesn't have postprocessor, use the same clocks and got it own interruption. Signed-off-by: Benjamin Gaignard --- version 5: - remove useless postproc fields for G2 version 2: - remove useless clocks drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 + drivers/staging/media/hantro/imx8m_vpu_hw.c | 76 ++++++++++++++++++++- 3 files changed, 76 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index 13c197ca9ba3..659124a52e8a 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -574,6 +574,7 @@ static const struct of_device_id of_hantro_match[] = { #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, }, + { .compatible = "nxp,imx8mq-vpu-g2", .data = &imx8mq_vpu_g2_variant }, #endif { /* sentinel */ } }; diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h index dade3b0769c1..f61f58da05fe 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -193,6 +193,7 @@ extern const struct hantro_variant rk3399_vpu_variant; extern const struct hantro_variant rk3328_vpu_variant; extern const struct hantro_variant rk3288_vpu_variant; extern const struct hantro_variant imx8mq_vpu_variant; +extern const struct hantro_variant imx8mq_vpu_g2_variant; extern const struct hantro_postproc_regs hantro_g1_postproc_regs; diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c index bd9d135dd440..b2ddb1fce0e8 100644 --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c @@ -12,6 +12,7 @@ #include "hantro.h" #include "hantro_jpeg.h" #include "hantro_g1_regs.h" +#include "hantro_g2_regs.h" #define CTRL_SOFT_RESET 0x00 #define RESET_G1 BIT(1) @@ -129,6 +130,26 @@ static const struct hantro_fmt imx8m_vpu_dec_fmts[] = { }, }; +static const struct hantro_fmt imx8m_vpu_g2_dec_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_NV12, + .codec_mode = HANTRO_MODE_NONE, + }, + { + .fourcc = V4L2_PIX_FMT_HEVC_SLICE, + .codec_mode = HANTRO_MODE_HEVC_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 3840, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 2160, + .step_height = MB_DIM, + }, + }, +}; + static irqreturn_t imx8m_vpu_g1_irq(int irq, void *dev_id) { struct hantro_dev *vpu = dev_id; @@ -147,6 +168,24 @@ static irqreturn_t imx8m_vpu_g1_irq(int irq, void *dev_id) return IRQ_HANDLED; } +static irqreturn_t imx8m_vpu_g2_irq(int irq, void *dev_id) +{ + struct hantro_dev *vpu = dev_id; + enum vb2_buffer_state state; + u32 status; + + status = vdpu_read(vpu, HEVC_REG_INTERRUPT); + state = (status & HEVC_REG_INTERRUPT_DEC_RDY_INT) ? + VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR; + + vdpu_write(vpu, 0, HEVC_REG_INTERRUPT); + vdpu_write(vpu, HEVC_REG_CONFIG_DEC_CLK_GATE_E, HEVC_REG_CONFIG); + + hantro_irq_done(vpu, state); + + return IRQ_HANDLED; +} + static int imx8mq_vpu_hw_init(struct hantro_dev *vpu) { struct device_node *np = vpu->dev->of_node; @@ -176,6 +215,13 @@ static void imx8m_vpu_g1_reset(struct hantro_ctx *ctx) imx8m_soft_reset(vpu, RESET_G1); } +static void imx8m_vpu_g2_reset(struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + + imx8m_soft_reset(vpu, RESET_G2); +} + /* * Supported codec ops. */ @@ -201,16 +247,28 @@ static const struct hantro_codec_ops imx8mq_vpu_codec_ops[] = { }, }; +static const struct hantro_codec_ops imx8mq_vpu_g2_codec_ops[] = { + [HANTRO_MODE_HEVC_DEC] = { + .run = hantro_g2_hevc_dec_run, + .reset = imx8m_vpu_g2_reset, + .init = hantro_hevc_dec_init, + .exit = hantro_hevc_dec_exit, + }, +}; + /* * VPU variants. */ static const struct hantro_irq imx8mq_irqs[] = { { "g1", imx8m_vpu_g1_irq }, - { "g2", NULL /* TODO: imx8m_vpu_g2_irq */ }, }; -static const char * const imx8mq_clk_names[] = { "g1", "g2", "bus" }; +static const struct hantro_irq imx8mq_g2_irqs[] = { + { "g2", imx8m_vpu_g2_irq }, +}; + +static const char * const imx8mq_clk_names[] = { "g1", "g2", "bus"}; const struct hantro_variant imx8mq_vpu_variant = { .dec_fmts = imx8m_vpu_dec_fmts, @@ -228,3 +286,17 @@ const struct hantro_variant imx8mq_vpu_variant = { .clk_names = imx8mq_clk_names, .num_clocks = ARRAY_SIZE(imx8mq_clk_names), }; + +const struct hantro_variant imx8mq_vpu_g2_variant = { + .dec_offset = 0x0, + .dec_fmts = imx8m_vpu_g2_dec_fmts, + .num_dec_fmts = ARRAY_SIZE(imx8m_vpu_g2_dec_fmts), + .codec = HANTRO_HEVC_DECODER, + .codec_ops = imx8mq_vpu_g2_codec_ops, + .init = imx8mq_vpu_hw_init, + .runtime_resume = imx8mq_runtime_resume, + .irqs = imx8mq_g2_irqs, + .num_irqs = ARRAY_SIZE(imx8mq_g2_irqs), + .clk_names = imx8mq_clk_names, + .num_clocks = ARRAY_SIZE(imx8mq_clk_names), +}; -- 2.25.1 From benjamin.gaignard at collabora.com Thu Mar 18 08:20:44 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Thu, 18 Mar 2021 09:20:44 +0100 Subject: [PATCH v6 11/13] media: hantro: Introduce G2/HEVC decoder In-Reply-To: <20210318082046.51546-1-benjamin.gaignard@collabora.com> References: <20210318082046.51546-1-benjamin.gaignard@collabora.com> Message-ID: <20210318082046.51546-12-benjamin.gaignard@collabora.com> Implement all the logic to get G2 hardware decoding HEVC frames. It support up level 5.1 HEVC stream. It doesn't support yet 10 bits formats or scaling feature. Add HANTRO HEVC dedicated control to skip some bits at the beginning of the slice header. That is very specific to this hardware so can't go into uapi structures. Compute the needed value is complex and require information from the stream that only the userland knows so let it provide the correct value to the driver. Signed-off-by: Benjamin Gaignard Co-developed-by: Adrian Ratiu Signed-off-by: Adrian Ratiu Co-developed-by: Ezequiel Garcia Signed-off-by: Ezequiel Garcia --- version 6: - Add 'static' to hantro_g2_check_idle() prototype version 5: - Add co-author tags. - Fix Ezequiel comments (typo, comments, etc). - Remove unused functions. version 4: - fix Ezequiel comments - use dedicated control as an integer - change hantro_g2_hevc_dec_run prototype to return errors version 2: - squash multiple commits in this one. - fix the comments done by Ezequiel about dma_alloc_coherent usage - fix Dan's comments about control copy, reverse the test logic in tile_buffer_reallocate, rework some goto and return cases. drivers/staging/media/hantro/Makefile | 2 + drivers/staging/media/hantro/hantro.h | 2 + drivers/staging/media/hantro/hantro_drv.c | 36 ++ .../staging/media/hantro/hantro_g2_hevc_dec.c | 587 ++++++++++++++++++ drivers/staging/media/hantro/hantro_g2_regs.h | 198 ++++++ drivers/staging/media/hantro/hantro_hevc.c | 324 ++++++++++ drivers/staging/media/hantro/hantro_hw.h | 49 ++ 7 files changed, 1198 insertions(+) create mode 100644 drivers/staging/media/hantro/hantro_g2_hevc_dec.c create mode 100644 drivers/staging/media/hantro/hantro_g2_regs.h create mode 100644 drivers/staging/media/hantro/hantro_hevc.c diff --git a/drivers/staging/media/hantro/Makefile b/drivers/staging/media/hantro/Makefile index 743ce08eb184..0357f1772267 100644 --- a/drivers/staging/media/hantro/Makefile +++ b/drivers/staging/media/hantro/Makefile @@ -9,12 +9,14 @@ hantro-vpu-y += \ hantro_h1_jpeg_enc.o \ hantro_g1_h264_dec.o \ hantro_g1_mpeg2_dec.o \ + hantro_g2_hevc_dec.o \ hantro_g1_vp8_dec.o \ rk3399_vpu_hw_jpeg_enc.o \ rk3399_vpu_hw_mpeg2_dec.o \ rk3399_vpu_hw_vp8_dec.o \ hantro_jpeg.o \ hantro_h264.o \ + hantro_hevc.o \ hantro_mpeg2.o \ hantro_vp8.o diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h index 83299e8d3a6c..976c1903d9ce 100644 --- a/drivers/staging/media/hantro/hantro.h +++ b/drivers/staging/media/hantro/hantro.h @@ -221,6 +221,7 @@ struct hantro_dev { * @jpeg_enc: JPEG-encoding context. * @mpeg2_dec: MPEG-2-decoding context. * @vp8_dec: VP8-decoding context. + * @hevc_dec: HEVC-decoding context. */ struct hantro_ctx { struct hantro_dev *dev; @@ -247,6 +248,7 @@ struct hantro_ctx { struct hantro_jpeg_enc_hw_ctx jpeg_enc; struct hantro_mpeg2_dec_hw_ctx mpeg2_dec; struct hantro_vp8_dec_hw_ctx vp8_dec; + struct hantro_hevc_dec_hw_ctx hevc_dec; }; }; diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index f0b68e16fcc0..13c197ca9ba3 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -281,6 +281,26 @@ static int hantro_jpeg_s_ctrl(struct v4l2_ctrl *ctrl) return 0; } +static int hantro_hevc_s_ctrl(struct v4l2_ctrl *ctrl) +{ + struct hantro_ctx *ctx; + + ctx = container_of(ctrl->handler, + struct hantro_ctx, ctrl_handler); + + vpu_debug(1, "s_ctrl: id = %d, val = %d\n", ctrl->id, ctrl->val); + + switch (ctrl->id) { + case V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP: + ctx->hevc_dec.ctrls.hevc_hdr_skip_length = ctrl->val; + break; + default: + return -EINVAL; + } + + return 0; +} + static const struct v4l2_ctrl_ops hantro_ctrl_ops = { .try_ctrl = hantro_try_ctrl, }; @@ -289,6 +309,10 @@ static const struct v4l2_ctrl_ops hantro_jpeg_ctrl_ops = { .s_ctrl = hantro_jpeg_s_ctrl, }; +static const struct v4l2_ctrl_ops hantro_hevc_ctrl_ops = { + .s_ctrl = hantro_hevc_s_ctrl, +}; + static const struct hantro_ctrl controls[] = { { .codec = HANTRO_JPEG_ENCODER, @@ -409,6 +433,18 @@ static const struct hantro_ctrl controls[] = { .cfg = { .id = V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS, }, + }, { + .codec = HANTRO_HEVC_DECODER, + .cfg = { + .id = V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP, + .name = "Hantro HEVC slice header skip bytes", + .type = V4L2_CTRL_TYPE_INTEGER, + .min = 0, + .def = 0, + .max = 0x7fffffff, + .step = 1, + .ops = &hantro_hevc_ctrl_ops, + }, }, }; diff --git a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c new file mode 100644 index 000000000000..03a193a50c09 --- /dev/null +++ b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c @@ -0,0 +1,587 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Hantro VPU HEVC codec driver + * + * Copyright (C) 2020 Safran Passenger Innovations LLC + */ + +#include "hantro_hw.h" +#include "hantro_g2_regs.h" + +#define HEVC_DEC_MODE 0xC + +#define BUS_WIDTH_32 0 +#define BUS_WIDTH_64 1 +#define BUS_WIDTH_128 2 +#define BUS_WIDTH_256 3 + +static inline void hantro_write_addr(struct hantro_dev *vpu, + unsigned long offset, + dma_addr_t addr) +{ + vdpu_write(vpu, addr & 0xffffffff, offset); +} + +static void prepare_tile_info_buffer(struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls; + const struct v4l2_ctrl_hevc_pps *pps = ctrls->pps; + const struct v4l2_ctrl_hevc_sps *sps = ctrls->sps; + u16 *p = (u16 *)((u8 *)ctx->hevc_dec.tile_sizes.cpu); + unsigned int num_tile_rows = pps->num_tile_rows_minus1 + 1; + unsigned int num_tile_cols = pps->num_tile_columns_minus1 + 1; + unsigned int pic_width_in_ctbs, pic_height_in_ctbs; + unsigned int max_log2_ctb_size, ctb_size; + bool tiles_enabled, uniform_spacing; + u32 no_chroma = 0; + + tiles_enabled = !!(pps->flags & V4L2_HEVC_PPS_FLAG_TILES_ENABLED); + uniform_spacing = !!(pps->flags & V4L2_HEVC_PPS_FLAG_UNIFORM_SPACING); + + hantro_reg_write(vpu, hevc_tile_e, tiles_enabled); + + max_log2_ctb_size = sps->log2_min_luma_coding_block_size_minus3 + 3 + + sps->log2_diff_max_min_luma_coding_block_size; + pic_width_in_ctbs = (sps->pic_width_in_luma_samples + + (1 << max_log2_ctb_size) - 1) >> max_log2_ctb_size; + pic_height_in_ctbs = (sps->pic_height_in_luma_samples + (1 << max_log2_ctb_size) - 1) + >> max_log2_ctb_size; + ctb_size = 1 << max_log2_ctb_size; + + vpu_debug(1, "Preparing tile sizes buffer for %dx%d CTBs (CTB size %d)\n", + pic_width_in_ctbs, pic_height_in_ctbs, ctb_size); + + if (tiles_enabled) { + unsigned int i, j, h; + + vpu_debug(1, "Tiles enabled! %dx%d\n", num_tile_cols, num_tile_rows); + + hantro_reg_write(vpu, hevc_num_tile_rows, num_tile_rows); + hantro_reg_write(vpu, hevc_num_tile_cols, num_tile_cols); + + /* write width + height for each tile in pic */ + if (!uniform_spacing) { + u32 tmp_w = 0, tmp_h = 0; + + for (i = 0; i < num_tile_rows; i++) { + if (i == num_tile_rows - 1) + h = pic_height_in_ctbs - tmp_h; + else + h = pps->row_height_minus1[i] + 1; + tmp_h += h; + if (i == 0 && h == 1 && ctb_size == 16) + no_chroma = 1; + for (j = 0, tmp_w = 0; j < num_tile_cols - 1; j++) { + tmp_w += pps->column_width_minus1[j] + 1; + *p++ = pps->column_width_minus1[j + 1]; + *p++ = h; + if (i == 0 && h == 1 && ctb_size == 16) + no_chroma = 1; + } + /* last column */ + *p++ = pic_width_in_ctbs - tmp_w; + *p++ = h; + } + } else { /* uniform spacing */ + u32 tmp, prev_h, prev_w; + + for (i = 0, prev_h = 0; i < num_tile_rows; i++) { + tmp = (i + 1) * pic_height_in_ctbs / num_tile_rows; + h = tmp - prev_h; + prev_h = tmp; + if (i == 0 && h == 1 && ctb_size == 16) + no_chroma = 1; + for (j = 0, prev_w = 0; j < num_tile_cols; j++) { + tmp = (j + 1) * pic_width_in_ctbs / num_tile_cols; + *p++ = tmp - prev_w; + *p++ = h; + if (j == 0 && + (pps->column_width_minus1[0] + 1) == 1 && + ctb_size == 16) + no_chroma = 1; + prev_w = tmp; + } + } + } + } else { + hantro_reg_write(vpu, hevc_num_tile_rows, 1); + hantro_reg_write(vpu, hevc_num_tile_cols, 1); + + /* There's one tile, with dimensions equal to pic size. */ + p[0] = pic_width_in_ctbs; + p[1] = pic_height_in_ctbs; + } + + if (no_chroma) + vpu_debug(1, "%s: no chroma!\n", __func__); +} + +static void set_params(struct hantro_ctx *ctx) +{ + const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls; + const struct v4l2_ctrl_hevc_sps *sps = ctrls->sps; + const struct v4l2_ctrl_hevc_pps *pps = ctrls->pps; + const struct v4l2_ctrl_hevc_decode_params *decode_params = ctrls->decode_params; + struct hantro_dev *vpu = ctx->dev; + u32 min_log2_cb_size, max_log2_ctb_size, min_cb_size, max_ctb_size; + u32 pic_width_in_min_cbs, pic_height_in_min_cbs; + u32 pic_width_aligned, pic_height_aligned; + u32 partial_ctb_x, partial_ctb_y; + + hantro_reg_write(vpu, hevc_bit_depth_y_minus8, sps->bit_depth_luma_minus8); + hantro_reg_write(vpu, hevc_bit_depth_c_minus8, sps->bit_depth_chroma_minus8); + + hantro_reg_write(vpu, hevc_output_8_bits, 0); + + hantro_reg_write(vpu, hevc_hdr_skip_length, ctrls->hevc_hdr_skip_length); + + min_log2_cb_size = sps->log2_min_luma_coding_block_size_minus3 + 3; + max_log2_ctb_size = min_log2_cb_size + sps->log2_diff_max_min_luma_coding_block_size; + + hantro_reg_write(vpu, hevc_min_cb_size, min_log2_cb_size); + hantro_reg_write(vpu, hevc_max_cb_size, max_log2_ctb_size); + + min_cb_size = 1 << min_log2_cb_size; + max_ctb_size = 1 << max_log2_ctb_size; + + pic_width_in_min_cbs = sps->pic_width_in_luma_samples / min_cb_size; + pic_height_in_min_cbs = sps->pic_height_in_luma_samples / min_cb_size; + pic_width_aligned = ALIGN(sps->pic_width_in_luma_samples, max_ctb_size); + pic_height_aligned = ALIGN(sps->pic_height_in_luma_samples, max_ctb_size); + + partial_ctb_x = !!(sps->pic_width_in_luma_samples != pic_width_aligned); + partial_ctb_y = !!(sps->pic_height_in_luma_samples != pic_height_aligned); + + hantro_reg_write(vpu, hevc_partial_ctb_x, partial_ctb_x); + hantro_reg_write(vpu, hevc_partial_ctb_y, partial_ctb_y); + + hantro_reg_write(vpu, hevc_pic_width_in_cbs, pic_width_in_min_cbs); + hantro_reg_write(vpu, hevc_pic_height_in_cbs, pic_height_in_min_cbs); + + hantro_reg_write(vpu, hevc_pic_width_4x4, + (pic_width_in_min_cbs * min_cb_size) / 4); + hantro_reg_write(vpu, hevc_pic_height_4x4, + (pic_height_in_min_cbs * min_cb_size) / 4); + + hantro_reg_write(vpu, hevc_max_inter_hierdepth, + sps->max_transform_hierarchy_depth_inter); + hantro_reg_write(vpu, hevc_max_intra_hierdepth, + sps->max_transform_hierarchy_depth_intra); + hantro_reg_write(vpu, hevc_min_trb_size, + sps->log2_min_luma_transform_block_size_minus2 + 2); + hantro_reg_write(vpu, hevc_max_trb_size, + sps->log2_min_luma_transform_block_size_minus2 + 2 + + sps->log2_diff_max_min_luma_transform_block_size); + + hantro_reg_write(vpu, hevc_tempor_mvp_e, + !!(sps->flags & V4L2_HEVC_SPS_FLAG_SPS_TEMPORAL_MVP_ENABLED) && + !(decode_params->flags & V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC)); + hantro_reg_write(vpu, hevc_strong_smooth_e, + !!(sps->flags & V4L2_HEVC_SPS_FLAG_STRONG_INTRA_SMOOTHING_ENABLED)); + hantro_reg_write(vpu, hevc_asym_pred_e, + !!(sps->flags & V4L2_HEVC_SPS_FLAG_AMP_ENABLED)); + hantro_reg_write(vpu, hevc_sao_e, + !!(sps->flags & V4L2_HEVC_SPS_FLAG_SAMPLE_ADAPTIVE_OFFSET)); + hantro_reg_write(vpu, hevc_sign_data_hide, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_SIGN_DATA_HIDING_ENABLED)); + + if (pps->flags & V4L2_HEVC_PPS_FLAG_CU_QP_DELTA_ENABLED) { + hantro_reg_write(vpu, hevc_cu_qpd_e, 1); + hantro_reg_write(vpu, hevc_max_cu_qpd_depth, pps->diff_cu_qp_delta_depth); + } else { + hantro_reg_write(vpu, hevc_cu_qpd_e, 0); + hantro_reg_write(vpu, hevc_max_cu_qpd_depth, 0); + } + + if (pps->flags & V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT) { + hantro_reg_write(vpu, hevc_cb_qp_offset, pps->pps_cb_qp_offset); + hantro_reg_write(vpu, hevc_cr_qp_offset, pps->pps_cr_qp_offset); + } else { + hantro_reg_write(vpu, hevc_cb_qp_offset, 0); + hantro_reg_write(vpu, hevc_cr_qp_offset, 0); + } + + hantro_reg_write(vpu, hevc_filt_offset_beta, pps->pps_beta_offset_div2); + hantro_reg_write(vpu, hevc_filt_offset_tc, pps->pps_tc_offset_div2); + hantro_reg_write(vpu, hevc_slice_hdr_ext_e, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_SLICE_SEGMENT_HEADER_EXTENSION_PRESENT)); + hantro_reg_write(vpu, hevc_slice_hdr_ext_bits, pps->num_extra_slice_header_bits); + hantro_reg_write(vpu, hevc_slice_chqp_present, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT)); + hantro_reg_write(vpu, hevc_weight_bipr_idc, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_WEIGHTED_BIPRED)); + hantro_reg_write(vpu, hevc_transq_bypass, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_TRANSQUANT_BYPASS_ENABLED)); + hantro_reg_write(vpu, hevc_list_mod_e, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_LISTS_MODIFICATION_PRESENT)); + hantro_reg_write(vpu, hevc_entropy_sync_e, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_ENTROPY_CODING_SYNC_ENABLED)); + hantro_reg_write(vpu, hevc_cabac_init_present, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_CABAC_INIT_PRESENT)); + hantro_reg_write(vpu, hevc_idr_pic_e, + !!(decode_params->flags & V4L2_HEVC_DECODE_PARAM_FLAG_IRAP_PIC)); + hantro_reg_write(vpu, hevc_parallel_merge, + pps->log2_parallel_merge_level_minus2 + 2); + hantro_reg_write(vpu, hevc_pcm_filt_d, + !!(sps->flags & V4L2_HEVC_SPS_FLAG_PCM_LOOP_FILTER_DISABLED)); + hantro_reg_write(vpu, hevc_pcm_e, + !!(sps->flags & V4L2_HEVC_SPS_FLAG_PCM_ENABLED)); + if (sps->flags & V4L2_HEVC_SPS_FLAG_PCM_ENABLED) { + hantro_reg_write(vpu, hevc_max_pcm_size, + sps->log2_diff_max_min_pcm_luma_coding_block_size + + sps->log2_min_pcm_luma_coding_block_size_minus3 + 3); + hantro_reg_write(vpu, hevc_min_pcm_size, + sps->log2_min_pcm_luma_coding_block_size_minus3 + 3); + hantro_reg_write(vpu, hevc_bit_depth_pcm_y, + sps->pcm_sample_bit_depth_luma_minus1 + 1); + hantro_reg_write(vpu, hevc_bit_depth_pcm_c, + sps->pcm_sample_bit_depth_chroma_minus1 + 1); + } else { + hantro_reg_write(vpu, hevc_max_pcm_size, 0); + hantro_reg_write(vpu, hevc_min_pcm_size, 0); + hantro_reg_write(vpu, hevc_bit_depth_pcm_y, 0); + hantro_reg_write(vpu, hevc_bit_depth_pcm_c, 0); + } + + hantro_reg_write(vpu, hevc_start_code_e, 1); + hantro_reg_write(vpu, hevc_init_qp, pps->init_qp_minus26 + 26); + hantro_reg_write(vpu, hevc_weight_pred_e, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_WEIGHTED_PRED)); + hantro_reg_write(vpu, hevc_cabac_init_present, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_CABAC_INIT_PRESENT)); + hantro_reg_write(vpu, hevc_const_intra_e, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_CONSTRAINED_INTRA_PRED)); + hantro_reg_write(vpu, hevc_transform_skip, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_TRANSFORM_SKIP_ENABLED)); + hantro_reg_write(vpu, hevc_out_filtering_dis, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_PPS_DISABLE_DEBLOCKING_FILTER)); + hantro_reg_write(vpu, hevc_filt_ctrl_pres, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT)); + hantro_reg_write(vpu, hevc_dependent_slice, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT)); + hantro_reg_write(vpu, hevc_filter_override, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_OVERRIDE_ENABLED)); + hantro_reg_write(vpu, hevc_refidx0_active, + pps->num_ref_idx_l0_default_active_minus1 + 1); + hantro_reg_write(vpu, hevc_refidx1_active, + pps->num_ref_idx_l1_default_active_minus1 + 1); + hantro_reg_write(vpu, hevc_apf_threshold, 8); +} + +static int find_ref_pic_index(const struct v4l2_hevc_dpb_entry *dpb, int pic_order_cnt) +{ + int i; + + for (i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) { + if (dpb[i].pic_order_cnt[0] == pic_order_cnt) + return i; + } + + return 0x0; +} + +static void set_ref_pic_list(struct hantro_ctx *ctx) +{ + const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls; + struct hantro_dev *vpu = ctx->dev; + const struct v4l2_ctrl_hevc_decode_params *decode_params = ctrls->decode_params; + const struct v4l2_hevc_dpb_entry *dpb = decode_params->dpb; + u32 list0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] = {0}; + u32 list1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] = {0}; + const struct hantro_reg *ref_pic_regs0[] = { + hevc_rlist_f0, + hevc_rlist_f1, + hevc_rlist_f2, + hevc_rlist_f3, + hevc_rlist_f4, + hevc_rlist_f5, + hevc_rlist_f6, + hevc_rlist_f7, + hevc_rlist_f8, + hevc_rlist_f9, + hevc_rlist_f10, + hevc_rlist_f11, + hevc_rlist_f12, + hevc_rlist_f13, + hevc_rlist_f14, + hevc_rlist_f15, + }; + const struct hantro_reg *ref_pic_regs1[] = { + hevc_rlist_b0, + hevc_rlist_b1, + hevc_rlist_b2, + hevc_rlist_b3, + hevc_rlist_b4, + hevc_rlist_b5, + hevc_rlist_b6, + hevc_rlist_b7, + hevc_rlist_b8, + hevc_rlist_b9, + hevc_rlist_b10, + hevc_rlist_b11, + hevc_rlist_b12, + hevc_rlist_b13, + hevc_rlist_b14, + hevc_rlist_b15, + }; + unsigned int i, j; + + /* List 0 contains: short term before, short term after and long term */ + j = 0; + for (i = 0; i < decode_params->num_poc_st_curr_before && j < ARRAY_SIZE(list0); i++) + list0[j++] = find_ref_pic_index(dpb, decode_params->poc_st_curr_before[i]); + for (i = 0; i < decode_params->num_poc_st_curr_after && j < ARRAY_SIZE(list0); i++) + list0[j++] = find_ref_pic_index(dpb, decode_params->poc_st_curr_after[i]); + for (i = 0; i < decode_params->num_poc_lt_curr && j < ARRAY_SIZE(list0); i++) + list0[j++] = find_ref_pic_index(dpb, decode_params->poc_lt_curr[i]); + + /* Fill the list, copying over and over */ + i = 0; + while (j < ARRAY_SIZE(list0)) + list0[j++] = list0[i++]; + + j = 0; + for (i = 0; i < decode_params->num_poc_st_curr_after && j < ARRAY_SIZE(list1); i++) + list1[j++] = find_ref_pic_index(dpb, decode_params->poc_st_curr_after[i]); + for (i = 0; i < decode_params->num_poc_st_curr_before && j < ARRAY_SIZE(list1); i++) + list1[j++] = find_ref_pic_index(dpb, decode_params->poc_st_curr_before[i]); + for (i = 0; i < decode_params->num_poc_lt_curr && j < ARRAY_SIZE(list1); i++) + list1[j++] = find_ref_pic_index(dpb, decode_params->poc_lt_curr[i]); + + i = 0; + while (j < ARRAY_SIZE(list1)) + list1[j++] = list1[i++]; + + for (i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) { + hantro_reg_write(vpu, ref_pic_regs0[i], list0[i]); + hantro_reg_write(vpu, ref_pic_regs1[i], list1[i]); + } +} + +static int set_ref(struct hantro_ctx *ctx) +{ + const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls; + const struct v4l2_ctrl_hevc_sps *sps = ctrls->sps; + const struct v4l2_ctrl_hevc_pps *pps = ctrls->pps; + const struct v4l2_ctrl_hevc_decode_params *decode_params = ctrls->decode_params; + const struct v4l2_hevc_dpb_entry *dpb = decode_params->dpb; + dma_addr_t luma_addr, chroma_addr, mv_addr = 0; + struct hantro_dev *vpu = ctx->dev; + size_t cr_offset = hantro_hevc_chroma_offset(sps); + size_t mv_offset = hantro_hevc_motion_vectors_offset(sps); + u32 max_ref_frames; + u16 dpb_longterm_e; + + const struct hantro_reg *cur_poc[] = { + hevc_cur_poc_00, + hevc_cur_poc_01, + hevc_cur_poc_02, + hevc_cur_poc_03, + hevc_cur_poc_04, + hevc_cur_poc_05, + hevc_cur_poc_06, + hevc_cur_poc_07, + hevc_cur_poc_08, + hevc_cur_poc_09, + hevc_cur_poc_10, + hevc_cur_poc_11, + hevc_cur_poc_12, + hevc_cur_poc_13, + hevc_cur_poc_14, + hevc_cur_poc_15, + }; + unsigned int i; + + max_ref_frames = decode_params->num_poc_lt_curr + + decode_params->num_poc_st_curr_before + + decode_params->num_poc_st_curr_after; + /* + * Set max_ref_frames to non-zero to avoid HW hang when decoding + * badly marked I-frames. + */ + max_ref_frames = max_ref_frames ? max_ref_frames : 1; + hantro_reg_write(vpu, hevc_num_ref_frames, max_ref_frames); + hantro_reg_write(vpu, hevc_filter_over_slices, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED)); + hantro_reg_write(vpu, hevc_filter_over_tiles, + !!(pps->flags & V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED)); + + /* + * Write POC count diff from current pic. For frame decoding only compute + * pic_order_cnt[0] and ignore pic_order_cnt[1] used in field-coding. + */ + for (i = 0; i < decode_params->num_active_dpb_entries && i < ARRAY_SIZE(cur_poc); i++) { + char poc_diff = decode_params->pic_order_cnt_val - dpb[i].pic_order_cnt[0]; + + hantro_reg_write(vpu, cur_poc[i], poc_diff); + } + + if (i < ARRAY_SIZE(cur_poc)) { + /* + * After the references, fill one entry pointing to itself, + * i.e. difference is zero. + */ + hantro_reg_write(vpu, cur_poc[i], 0); + i++; + } + + /* Fill the rest with the current picture */ + for (; i < ARRAY_SIZE(cur_poc); i++) + hantro_reg_write(vpu, cur_poc[i], decode_params->pic_order_cnt_val); + + set_ref_pic_list(ctx); + + /* We will only keep the references picture that are still used */ + ctx->hevc_dec.ref_bufs_used = 0; + + /* Set up addresses of DPB buffers */ + dpb_longterm_e = 0; + for (i = 0; i < decode_params->num_active_dpb_entries && + i < (V4L2_HEVC_DPB_ENTRIES_NUM_MAX - 1); i++) { + luma_addr = hantro_hevc_get_ref_buf(ctx, dpb[i].pic_order_cnt[0]); + if (!luma_addr) + return -ENOMEM; + + chroma_addr = luma_addr + cr_offset; + mv_addr = luma_addr + mv_offset; + + if (dpb[i].rps == V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR) + dpb_longterm_e |= BIT(V4L2_HEVC_DPB_ENTRIES_NUM_MAX - 1 - i); + + hantro_write_addr(vpu, HEVC_REG_ADDR_REF(i), luma_addr); + hantro_write_addr(vpu, HEVC_REG_CHR_REF(i), chroma_addr); + hantro_write_addr(vpu, HEVC_REG_DMV_REF(i), mv_addr); + } + + luma_addr = hantro_hevc_get_ref_buf(ctx, decode_params->pic_order_cnt_val); + if (!luma_addr) + return -ENOMEM; + + chroma_addr = luma_addr + cr_offset; + mv_addr = luma_addr + mv_offset; + + hantro_write_addr(vpu, HEVC_REG_ADDR_REF(i), luma_addr); + hantro_write_addr(vpu, HEVC_REG_CHR_REF(i), chroma_addr); + hantro_write_addr(vpu, HEVC_REG_DMV_REF(i++), mv_addr); + + hantro_write_addr(vpu, HEVC_ADDR_DST, luma_addr); + hantro_write_addr(vpu, HEVC_ADDR_DST_CHR, chroma_addr); + hantro_write_addr(vpu, HEVC_ADDR_DST_MV, mv_addr); + + hantro_hevc_ref_remove_unused(ctx); + + for (; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) { + hantro_write_addr(vpu, HEVC_REG_ADDR_REF(i), 0); + hantro_write_addr(vpu, HEVC_REG_CHR_REF(i), 0); + hantro_write_addr(vpu, HEVC_REG_DMV_REF(i), 0); + } + + hantro_reg_write(vpu, hevc_refer_lterm_e, dpb_longterm_e); + + return 0; +} + +static void set_buffers(struct hantro_ctx *ctx) +{ + struct vb2_v4l2_buffer *src_buf, *dst_buf; + struct hantro_dev *vpu = ctx->dev; + const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls; + const struct v4l2_ctrl_hevc_sps *sps = ctrls->sps; + size_t cr_offset = hantro_hevc_chroma_offset(sps); + dma_addr_t src_dma, dst_dma; + u32 src_len, src_buf_len; + + src_buf = hantro_get_src_buf(ctx); + dst_buf = hantro_get_dst_buf(ctx); + + /* Source (stream) buffer. */ + src_dma = vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0); + src_len = vb2_get_plane_payload(&src_buf->vb2_buf, 0); + src_buf_len = vb2_plane_size(&src_buf->vb2_buf, 0); + + hantro_write_addr(vpu, HEVC_ADDR_STR, src_dma); + hantro_reg_write(vpu, hevc_stream_len, src_len); + hantro_reg_write(vpu, hevc_strm_buffer_len, src_buf_len); + hantro_reg_write(vpu, hevc_strm_start_offset, 0); + hantro_reg_write(vpu, hevc_write_mvs_e, 1); + + /* Destination (decoded frame) buffer. */ + dst_dma = hantro_get_dec_buf_addr(ctx, &dst_buf->vb2_buf); + + hantro_write_addr(vpu, HEVC_RASTER_SCAN, dst_dma); + hantro_write_addr(vpu, HEVC_RASTER_SCAN_CHR, dst_dma + cr_offset); + hantro_write_addr(vpu, HEVC_ADDR_TILE_SIZE, ctx->hevc_dec.tile_sizes.dma); + hantro_write_addr(vpu, HEVC_TILE_FILTER, ctx->hevc_dec.tile_filter.dma); + hantro_write_addr(vpu, HEVC_TILE_SAO, ctx->hevc_dec.tile_sao.dma); + hantro_write_addr(vpu, HEVC_TILE_BSD, ctx->hevc_dec.tile_bsd.dma); +} + +static void hantro_g2_check_idle(struct hantro_dev *vpu) +{ + int i; + + for (i = 0; i < 3; i++) { + u32 status; + + /* Make sure the VPU is idle */ + status = vdpu_read(vpu, HEVC_REG_INTERRUPT); + if (status & HEVC_REG_INTERRUPT_DEC_E) { + dev_warn(vpu->dev, "device still running, aborting"); + status |= HEVC_REG_INTERRUPT_DEC_ABORT_E | HEVC_REG_INTERRUPT_DEC_IRQ_DIS; + vdpu_write(vpu, status, HEVC_REG_INTERRUPT); + } + } +} + +int hantro_g2_hevc_dec_run(struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + int ret; + + hantro_g2_check_idle(vpu); + + /* Prepare HEVC decoder context. */ + ret = hantro_hevc_dec_prepare_run(ctx); + if (ret) + return ret; + + /* Configure hardware registers. */ + set_params(ctx); + + /* set reference pictures */ + ret = set_ref(ctx); + if (ret) + return ret; + + set_buffers(ctx); + prepare_tile_info_buffer(ctx); + + hantro_end_prepare_run(ctx); + + hantro_reg_write(vpu, hevc_mode, HEVC_DEC_MODE); + hantro_reg_write(vpu, hevc_clk_gate_e, 1); + + /* Don't disable output */ + hantro_reg_write(vpu, hevc_out_dis, 0); + + /* Don't compress buffers */ + hantro_reg_write(vpu, hevc_ref_compress_bypass, 1); + + /* use NV12 as output format */ + hantro_reg_write(vpu, hevc_out_rs_e, 1); + + /* Bus width and max burst */ + hantro_reg_write(vpu, hevc_buswidth, BUS_WIDTH_128); + hantro_reg_write(vpu, hevc_max_burst, 16); + + /* Swap */ + hantro_reg_write(vpu, hevc_strm_swap, 0xf); + hantro_reg_write(vpu, hevc_dirmv_swap, 0xf); + hantro_reg_write(vpu, hevc_compress_swap, 0xf); + + /* Start decoding! */ + vdpu_write(vpu, HEVC_REG_INTERRUPT_DEC_E, HEVC_REG_INTERRUPT); + + return 0; +} diff --git a/drivers/staging/media/hantro/hantro_g2_regs.h b/drivers/staging/media/hantro/hantro_g2_regs.h new file mode 100644 index 000000000000..a361c9ba911d --- /dev/null +++ b/drivers/staging/media/hantro/hantro_g2_regs.h @@ -0,0 +1,198 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2021, Collabora + * + * Author: Benjamin Gaignard + */ + +#ifndef HANTRO_G2_REGS_H_ +#define HANTRO_G2_REGS_H_ + +#include "hantro.h" + +#define G2_SWREG(nr) ((nr) * 4) + +#define HEVC_DEC_REG(name, base, shift, mask) \ + static const struct hantro_reg _hevc_##name[] = { \ + { G2_SWREG(base), (shift), (mask) } \ + }; \ + static const struct hantro_reg __maybe_unused *hevc_##name = &_hevc_##name[0]; + +#define HEVC_REG_VERSION G2_SWREG(0) + +#define HEVC_REG_INTERRUPT G2_SWREG(1) +#define HEVC_REG_INTERRUPT_DEC_RDY_INT BIT(12) +#define HEVC_REG_INTERRUPT_DEC_ABORT_E BIT(5) +#define HEVC_REG_INTERRUPT_DEC_IRQ_DIS BIT(4) +#define HEVC_REG_INTERRUPT_DEC_E BIT(0) + +HEVC_DEC_REG(strm_swap, 2, 28, 0xf) +HEVC_DEC_REG(dirmv_swap, 2, 20, 0xf) + +HEVC_DEC_REG(mode, 3, 27, 0x1f) +HEVC_DEC_REG(compress_swap, 3, 20, 0xf) +HEVC_DEC_REG(ref_compress_bypass, 3, 17, 0x1) +HEVC_DEC_REG(out_rs_e, 3, 16, 0x1) +HEVC_DEC_REG(out_dis, 3, 15, 0x1) +HEVC_DEC_REG(out_filtering_dis, 3, 14, 0x1) +HEVC_DEC_REG(write_mvs_e, 3, 12, 0x1) + +HEVC_DEC_REG(pic_width_in_cbs, 4, 19, 0x1ff) +HEVC_DEC_REG(pic_height_in_cbs, 4, 6, 0x1ff) +HEVC_DEC_REG(num_ref_frames, 4, 0, 0x1f) + +HEVC_DEC_REG(scaling_list_e, 5, 24, 0x1) +HEVC_DEC_REG(cb_qp_offset, 5, 19, 0x1f) +HEVC_DEC_REG(cr_qp_offset, 5, 14, 0x1f) +HEVC_DEC_REG(sign_data_hide, 5, 12, 0x1) +HEVC_DEC_REG(tempor_mvp_e, 5, 11, 0x1) +HEVC_DEC_REG(max_cu_qpd_depth, 5, 5, 0x3f) +HEVC_DEC_REG(cu_qpd_e, 5, 4, 0x1) + +HEVC_DEC_REG(stream_len, 6, 0, 0xffffffff) + +HEVC_DEC_REG(cabac_init_present, 7, 31, 0x1) +HEVC_DEC_REG(weight_pred_e, 7, 28, 0x1) +HEVC_DEC_REG(weight_bipr_idc, 7, 26, 0x3) +HEVC_DEC_REG(filter_over_slices, 7, 25, 0x1) +HEVC_DEC_REG(filter_over_tiles, 7, 24, 0x1) +HEVC_DEC_REG(asym_pred_e, 7, 23, 0x1) +HEVC_DEC_REG(sao_e, 7, 22, 0x1) +HEVC_DEC_REG(pcm_filt_d, 7, 21, 0x1) +HEVC_DEC_REG(slice_chqp_present, 7, 20, 0x1) +HEVC_DEC_REG(dependent_slice, 7, 19, 0x1) +HEVC_DEC_REG(filter_override, 7, 18, 0x1) +HEVC_DEC_REG(strong_smooth_e, 7, 17, 0x1) +HEVC_DEC_REG(filt_offset_beta, 7, 12, 0x1f) +HEVC_DEC_REG(filt_offset_tc, 7, 7, 0x1f) +HEVC_DEC_REG(slice_hdr_ext_e, 7, 6, 0x1) +HEVC_DEC_REG(slice_hdr_ext_bits, 7, 3, 0x7) + +HEVC_DEC_REG(const_intra_e, 8, 31, 0x1) +HEVC_DEC_REG(filt_ctrl_pres, 8, 30, 0x1) +HEVC_DEC_REG(idr_pic_e, 8, 16, 0x1) +HEVC_DEC_REG(bit_depth_pcm_y, 8, 12, 0xf) +HEVC_DEC_REG(bit_depth_pcm_c, 8, 8, 0xf) +HEVC_DEC_REG(bit_depth_y_minus8, 8, 6, 0x3) +HEVC_DEC_REG(bit_depth_c_minus8, 8, 4, 0x3) +HEVC_DEC_REG(output_8_bits, 8, 3, 0x1) + +HEVC_DEC_REG(refidx1_active, 9, 19, 0x1f) +HEVC_DEC_REG(refidx0_active, 9, 14, 0x1f) +HEVC_DEC_REG(hdr_skip_length, 9, 0, 0x3fff) + +HEVC_DEC_REG(start_code_e, 10, 31, 0x1) +HEVC_DEC_REG(init_qp, 10, 24, 0x3f) +HEVC_DEC_REG(num_tile_cols, 10, 19, 0x1f) +HEVC_DEC_REG(num_tile_rows, 10, 14, 0x1f) +HEVC_DEC_REG(tile_e, 10, 1, 0x1) +HEVC_DEC_REG(entropy_sync_e, 10, 0, 0x1) + +HEVC_DEC_REG(refer_lterm_e, 12, 16, 0xffff) +HEVC_DEC_REG(min_cb_size, 12, 13, 0x7) +HEVC_DEC_REG(max_cb_size, 12, 10, 0x7) +HEVC_DEC_REG(min_pcm_size, 12, 7, 0x7) +HEVC_DEC_REG(max_pcm_size, 12, 4, 0x7) +HEVC_DEC_REG(pcm_e, 12, 3, 0x1) +HEVC_DEC_REG(transform_skip, 12, 2, 0x1) +HEVC_DEC_REG(transq_bypass, 12, 1, 0x1) +HEVC_DEC_REG(list_mod_e, 12, 0, 0x1) + +HEVC_DEC_REG(min_trb_size, 13, 13, 0x7) +HEVC_DEC_REG(max_trb_size, 13, 10, 0x7) +HEVC_DEC_REG(max_intra_hierdepth, 13, 7, 0x7) +HEVC_DEC_REG(max_inter_hierdepth, 13, 4, 0x7) +HEVC_DEC_REG(parallel_merge, 13, 0, 0xf) + +HEVC_DEC_REG(rlist_f0, 14, 0, 0x1f) +HEVC_DEC_REG(rlist_f1, 14, 10, 0x1f) +HEVC_DEC_REG(rlist_f2, 14, 20, 0x1f) +HEVC_DEC_REG(rlist_b0, 14, 5, 0x1f) +HEVC_DEC_REG(rlist_b1, 14, 15, 0x1f) +HEVC_DEC_REG(rlist_b2, 14, 25, 0x1f) + +HEVC_DEC_REG(rlist_f3, 15, 0, 0x1f) +HEVC_DEC_REG(rlist_f4, 15, 10, 0x1f) +HEVC_DEC_REG(rlist_f5, 15, 20, 0x1f) +HEVC_DEC_REG(rlist_b3, 15, 5, 0x1f) +HEVC_DEC_REG(rlist_b4, 15, 15, 0x1f) +HEVC_DEC_REG(rlist_b5, 15, 25, 0x1f) + +HEVC_DEC_REG(rlist_f6, 16, 0, 0x1f) +HEVC_DEC_REG(rlist_f7, 16, 10, 0x1f) +HEVC_DEC_REG(rlist_f8, 16, 20, 0x1f) +HEVC_DEC_REG(rlist_b6, 16, 5, 0x1f) +HEVC_DEC_REG(rlist_b7, 16, 15, 0x1f) +HEVC_DEC_REG(rlist_b8, 16, 25, 0x1f) + +HEVC_DEC_REG(rlist_f9, 17, 0, 0x1f) +HEVC_DEC_REG(rlist_f10, 17, 10, 0x1f) +HEVC_DEC_REG(rlist_f11, 17, 20, 0x1f) +HEVC_DEC_REG(rlist_b9, 17, 5, 0x1f) +HEVC_DEC_REG(rlist_b10, 17, 15, 0x1f) +HEVC_DEC_REG(rlist_b11, 17, 25, 0x1f) + +HEVC_DEC_REG(rlist_f12, 18, 0, 0x1f) +HEVC_DEC_REG(rlist_f13, 18, 10, 0x1f) +HEVC_DEC_REG(rlist_f14, 18, 20, 0x1f) +HEVC_DEC_REG(rlist_b12, 18, 5, 0x1f) +HEVC_DEC_REG(rlist_b13, 18, 15, 0x1f) +HEVC_DEC_REG(rlist_b14, 18, 25, 0x1f) + +HEVC_DEC_REG(rlist_f15, 19, 0, 0x1f) +HEVC_DEC_REG(rlist_b15, 19, 5, 0x1f) + +HEVC_DEC_REG(partial_ctb_x, 20, 31, 0x1) +HEVC_DEC_REG(partial_ctb_y, 20, 30, 0x1) +HEVC_DEC_REG(pic_width_4x4, 20, 16, 0xfff) +HEVC_DEC_REG(pic_height_4x4, 20, 0, 0xfff) + +HEVC_DEC_REG(cur_poc_00, 46, 24, 0xff) +HEVC_DEC_REG(cur_poc_01, 46, 16, 0xff) +HEVC_DEC_REG(cur_poc_02, 46, 8, 0xff) +HEVC_DEC_REG(cur_poc_03, 46, 0, 0xff) + +HEVC_DEC_REG(cur_poc_04, 47, 24, 0xff) +HEVC_DEC_REG(cur_poc_05, 47, 16, 0xff) +HEVC_DEC_REG(cur_poc_06, 47, 8, 0xff) +HEVC_DEC_REG(cur_poc_07, 47, 0, 0xff) + +HEVC_DEC_REG(cur_poc_08, 48, 24, 0xff) +HEVC_DEC_REG(cur_poc_09, 48, 16, 0xff) +HEVC_DEC_REG(cur_poc_10, 48, 8, 0xff) +HEVC_DEC_REG(cur_poc_11, 48, 0, 0xff) + +HEVC_DEC_REG(cur_poc_12, 49, 24, 0xff) +HEVC_DEC_REG(cur_poc_13, 49, 16, 0xff) +HEVC_DEC_REG(cur_poc_14, 49, 8, 0xff) +HEVC_DEC_REG(cur_poc_15, 49, 0, 0xff) + +HEVC_DEC_REG(apf_threshold, 55, 0, 0xffff) + +HEVC_DEC_REG(clk_gate_e, 58, 16, 0x1) +HEVC_DEC_REG(buswidth, 58, 8, 0x7) +HEVC_DEC_REG(max_burst, 58, 0, 0xff) + +#define HEVC_REG_CONFIG G2_SWREG(58) +#define HEVC_REG_CONFIG_DEC_CLK_GATE_E BIT(16) +#define HEVC_REG_CONFIG_DEC_CLK_GATE_IDLE_E BIT(17) + +#define HEVC_ADDR_DST (G2_SWREG(65)) +#define HEVC_REG_ADDR_REF(i) (G2_SWREG(67) + ((i) * 0x8)) +#define HEVC_ADDR_DST_CHR (G2_SWREG(99)) +#define HEVC_REG_CHR_REF(i) (G2_SWREG(101) + ((i) * 0x8)) +#define HEVC_ADDR_DST_MV (G2_SWREG(133)) +#define HEVC_REG_DMV_REF(i) (G2_SWREG(135) + ((i) * 0x8)) +#define HEVC_ADDR_TILE_SIZE (G2_SWREG(167)) +#define HEVC_ADDR_STR (G2_SWREG(169)) +#define HEVC_SCALING_LIST (G2_SWREG(171)) +#define HEVC_RASTER_SCAN (G2_SWREG(175)) +#define HEVC_RASTER_SCAN_CHR (G2_SWREG(177)) +#define HEVC_TILE_FILTER (G2_SWREG(179)) +#define HEVC_TILE_SAO (G2_SWREG(181)) +#define HEVC_TILE_BSD (G2_SWREG(183)) + +HEVC_DEC_REG(strm_buffer_len, 258, 0, 0xffffffff) +HEVC_DEC_REG(strm_start_offset, 259, 0, 0xffffffff) + +#endif diff --git a/drivers/staging/media/hantro/hantro_hevc.c b/drivers/staging/media/hantro/hantro_hevc.c new file mode 100644 index 000000000000..4058046bb43e --- /dev/null +++ b/drivers/staging/media/hantro/hantro_hevc.c @@ -0,0 +1,324 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Hantro VPU HEVC codec driver + * + * Copyright (C) 2020 Safran Passenger Innovations LLC + */ + +#include +#include + +#include "hantro.h" +#include "hantro_hw.h" + +#define VERT_FILTER_RAM_SIZE 8 /* bytes per pixel row */ +/* + * BSD control data of current picture at tile border + * 128 bits per 4x4 tile = 128/(8*4) bytes per row + */ +#define BSD_CTRL_RAM_SIZE 4 /* bytes per pixel row */ +/* tile border coefficients of filter */ +#define VERT_SAO_RAM_SIZE 48 /* bytes per pixel */ + +#define MAX_TILE_COLS 20 +#define MAX_TILE_ROWS 22 + +#define UNUSED_REF -1 + +#define G2_ALIGN 16 +#define MC_WORD_SIZE 32 + +size_t hantro_hevc_chroma_offset(const struct v4l2_ctrl_hevc_sps *sps) +{ + int bytes_per_pixel = sps->bit_depth_luma_minus8 == 0 ? 1 : 2; + + return sps->pic_width_in_luma_samples * + sps->pic_height_in_luma_samples * bytes_per_pixel; +} + +size_t hantro_hevc_motion_vectors_offset(const struct v4l2_ctrl_hevc_sps *sps) +{ + size_t cr_offset = hantro_hevc_chroma_offset(sps); + + return ALIGN((cr_offset * 3) / 2, G2_ALIGN) + MC_WORD_SIZE; +} + +static size_t hantro_hevc_mv_size(const struct v4l2_ctrl_hevc_sps *sps) +{ + u32 pic_width_in_ctb64 = (sps->pic_width_in_luma_samples + (1 << 8) - 1) >> 8; + u32 pic_height_in_ctb64 = (sps->pic_height_in_luma_samples + (1 << 8) - 1) >> 8; + size_t mv_size; + + mv_size = (pic_width_in_ctb64 * pic_height_in_ctb64 * + (1 << (2 * (8 - 4))) * 16) + 32; + + vpu_debug(4, "%dx%d (CTBs) %lu MV bytes\n", + pic_width_in_ctb64, pic_height_in_ctb64, mv_size); + + return mv_size; +} + +static size_t hantro_hevc_ref_size(struct hantro_ctx *ctx) +{ + const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls; + const struct v4l2_ctrl_hevc_sps *sps = ctrls->sps; + + return hantro_hevc_motion_vectors_offset(sps) + hantro_hevc_mv_size(sps); +} + +static void hantro_hevc_ref_free(struct hantro_ctx *ctx) +{ + struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec; + struct hantro_dev *vpu = ctx->dev; + int i; + + for (i = 0; i < NUM_REF_PICTURES; i++) { + if (hevc_dec->ref_bufs[i].cpu) + dma_free_coherent(vpu->dev, hevc_dec->ref_bufs[i].size, + hevc_dec->ref_bufs[i].cpu, + hevc_dec->ref_bufs[i].dma); + } +} + +static void hantro_hevc_ref_init(struct hantro_ctx *ctx) +{ + struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec; + int i; + + for (i = 0; i < NUM_REF_PICTURES; i++) + hevc_dec->ref_bufs_poc[i] = UNUSED_REF; +} + +dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, + int poc) +{ + struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec; + int i; + + /* Find the reference buffer in already know ones */ + for (i = 0; i < NUM_REF_PICTURES; i++) { + if (hevc_dec->ref_bufs_poc[i] == poc) { + hevc_dec->ref_bufs_used |= 1 << i; + return hevc_dec->ref_bufs[i].dma; + } + } + + /* Allocate a new reference buffer */ + for (i = 0; i < NUM_REF_PICTURES; i++) { + if (hevc_dec->ref_bufs_poc[i] == UNUSED_REF) { + if (!hevc_dec->ref_bufs[i].cpu) { + struct hantro_dev *vpu = ctx->dev; + + /* + * Allocate the space needed for the raw data + + * motion vector data. Optimizations could be to + * allocate raw data in non coherent memory and only + * clear the motion vector data. + */ + hevc_dec->ref_bufs[i].cpu = + dma_alloc_coherent(vpu->dev, + hantro_hevc_ref_size(ctx), + &hevc_dec->ref_bufs[i].dma, + GFP_KERNEL); + if (!hevc_dec->ref_bufs[i].cpu) + return 0; + + hevc_dec->ref_bufs[i].size = hantro_hevc_ref_size(ctx); + } + hevc_dec->ref_bufs_used |= 1 << i; + memset(hevc_dec->ref_bufs[i].cpu, 0, hantro_hevc_ref_size(ctx)); + hevc_dec->ref_bufs_poc[i] = poc; + + return hevc_dec->ref_bufs[i].dma; + } + } + + return 0; +} + +void hantro_hevc_ref_remove_unused(struct hantro_ctx *ctx) +{ + struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec; + int i; + + /* Just tag buffer as unused, do not free them */ + for (i = 0; i < NUM_REF_PICTURES; i++) { + if (hevc_dec->ref_bufs_poc[i] == UNUSED_REF) + continue; + + if (hevc_dec->ref_bufs_used & (1 << i)) + continue; + + hevc_dec->ref_bufs_poc[i] = UNUSED_REF; + } +} + +static int tile_buffer_reallocate(struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec; + const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls; + const struct v4l2_ctrl_hevc_pps *pps = ctrls->pps; + const struct v4l2_ctrl_hevc_sps *sps = ctrls->sps; + unsigned int num_tile_cols = pps->num_tile_columns_minus1 + 1; + unsigned int height64 = (sps->pic_height_in_luma_samples + 63) & ~63; + unsigned int size; + + if (num_tile_cols <= 1 || + num_tile_cols <= hevc_dec->num_tile_cols_allocated) + return 0; + + /* Need to reallocate due to tiles passed via PPS */ + if (hevc_dec->tile_filter.size) + dma_free_coherent(vpu->dev, hevc_dec->tile_filter.size, + hevc_dec->tile_filter.cpu, + hevc_dec->tile_filter.dma); + + if (hevc_dec->tile_sao.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_sao.size, + hevc_dec->tile_sao.cpu, + hevc_dec->tile_sao.dma); + + if (hevc_dec->tile_bsd.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_bsd.size, + hevc_dec->tile_bsd.cpu, + hevc_dec->tile_bsd.dma); + + size = VERT_FILTER_RAM_SIZE * height64 * (num_tile_cols - 1); + hevc_dec->tile_filter.cpu = dma_alloc_coherent(vpu->dev, size, + &hevc_dec->tile_filter.dma, + GFP_KERNEL); + if (!hevc_dec->tile_filter.cpu) + goto err_free_tile_buffers; + hevc_dec->tile_filter.size = size; + + size = VERT_SAO_RAM_SIZE * height64 * (num_tile_cols - 1); + hevc_dec->tile_sao.cpu = dma_alloc_coherent(vpu->dev, size, + &hevc_dec->tile_sao.dma, + GFP_KERNEL); + if (!hevc_dec->tile_sao.cpu) + goto err_free_tile_buffers; + hevc_dec->tile_sao.size = size; + + size = BSD_CTRL_RAM_SIZE * height64 * (num_tile_cols - 1); + hevc_dec->tile_bsd.cpu = dma_alloc_coherent(vpu->dev, size, + &hevc_dec->tile_bsd.dma, + GFP_KERNEL); + if (!hevc_dec->tile_bsd.cpu) + goto err_free_tile_buffers; + hevc_dec->tile_bsd.size = size; + + hevc_dec->num_tile_cols_allocated = num_tile_cols; + + return 0; + +err_free_tile_buffers: + if (hevc_dec->tile_filter.size) + dma_free_coherent(vpu->dev, hevc_dec->tile_filter.size, + hevc_dec->tile_filter.cpu, + hevc_dec->tile_filter.dma); + hevc_dec->tile_filter.cpu = 0; + + if (hevc_dec->tile_sao.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_sao.size, + hevc_dec->tile_sao.cpu, + hevc_dec->tile_sao.dma); + hevc_dec->tile_sao.cpu = 0; + + if (hevc_dec->tile_bsd.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_bsd.size, + hevc_dec->tile_bsd.cpu, + hevc_dec->tile_bsd.dma); + hevc_dec->tile_bsd.cpu = 0; + + return -ENOMEM; +} + +int hantro_hevc_dec_prepare_run(struct hantro_ctx *ctx) +{ + struct hantro_hevc_dec_hw_ctx *hevc_ctx = &ctx->hevc_dec; + struct hantro_hevc_dec_ctrls *ctrls = &hevc_ctx->ctrls; + int ret; + + hantro_start_prepare_run(ctx); + + ctrls->decode_params = + hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS); + if (WARN_ON(!ctrls->decode_params)) + return -EINVAL; + + ctrls->sps = + hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_HEVC_SPS); + if (WARN_ON(!ctrls->sps)) + return -EINVAL; + + ctrls->pps = + hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_HEVC_PPS); + if (WARN_ON(!ctrls->pps)) + return -EINVAL; + + ret = tile_buffer_reallocate(ctx); + if (ret) + return ret; + + return 0; +} + +void hantro_hevc_dec_exit(struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec; + + if (hevc_dec->tile_sizes.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_sizes.size, + hevc_dec->tile_sizes.cpu, + hevc_dec->tile_sizes.dma); + hevc_dec->tile_sizes.cpu = 0; + + if (hevc_dec->tile_filter.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_filter.size, + hevc_dec->tile_filter.cpu, + hevc_dec->tile_filter.dma); + hevc_dec->tile_filter.cpu = 0; + + if (hevc_dec->tile_sao.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_sao.size, + hevc_dec->tile_sao.cpu, + hevc_dec->tile_sao.dma); + hevc_dec->tile_sao.cpu = 0; + + if (hevc_dec->tile_bsd.cpu) + dma_free_coherent(vpu->dev, hevc_dec->tile_bsd.size, + hevc_dec->tile_bsd.cpu, + hevc_dec->tile_bsd.dma); + hevc_dec->tile_bsd.cpu = 0; + + hantro_hevc_ref_free(ctx); +} + +int hantro_hevc_dec_init(struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec; + unsigned int size; + + memset(hevc_dec, 0, sizeof(*hevc_dec)); + + /* + * Maximum number of tiles times width and height (2 bytes each), + * rounding up to next 16 bytes boundary + one extra 16 byte + * chunk (HW guys wanted to have this). + */ + size = round_up(MAX_TILE_COLS * MAX_TILE_ROWS * 4 * sizeof(u16) + 16, 16); + hevc_dec->tile_sizes.cpu = dma_alloc_coherent(vpu->dev, size, + &hevc_dec->tile_sizes.dma, + GFP_KERNEL); + if (!hevc_dec->tile_sizes.cpu) + return -ENOMEM; + + hevc_dec->tile_sizes.size = size; + + hantro_hevc_ref_init(ctx); + + return 0; +} diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h index 4e2e7a5ed283..dade3b0769c1 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -20,6 +20,8 @@ #define MB_WIDTH(w) DIV_ROUND_UP(w, MB_DIM) #define MB_HEIGHT(h) DIV_ROUND_UP(h, MB_DIM) +#define NUM_REF_PICTURES (V4L2_HEVC_DPB_ENTRIES_NUM_MAX + 1) + struct hantro_dev; struct hantro_ctx; struct hantro_buf; @@ -90,6 +92,44 @@ struct hantro_h264_dec_hw_ctx { struct hantro_h264_dec_ctrls ctrls; }; +/** + * struct hantro_hevc_dec_ctrls + * @decode_params: Decode params + * @sps: SPS info + * @pps: PPS info + * @hevc_hdr_skip_length: the number of data (in bits) to skip in the + * slice segment header syntax after 'slice type' + * token + */ +struct hantro_hevc_dec_ctrls { + const struct v4l2_ctrl_hevc_decode_params *decode_params; + const struct v4l2_ctrl_hevc_sps *sps; + const struct v4l2_ctrl_hevc_pps *pps; + u32 hevc_hdr_skip_length; +}; + +/** + * struct hantro_hevc_dec_hw_ctx + * @tile_sizes: Tile sizes buffer + * @tile_filter: Tile vertical filter buffer + * @tile_sao: Tile SAO buffer + * @tile_bsd: Tile BSD control buffer + * @dpb: DPB + * @reflists: P/B0/B1 reflists + * @ctrls: V4L2 controls attached to a run + */ +struct hantro_hevc_dec_hw_ctx { + struct hantro_aux_buf tile_sizes; + struct hantro_aux_buf tile_filter; + struct hantro_aux_buf tile_sao; + struct hantro_aux_buf tile_bsd; + struct hantro_aux_buf ref_bufs[NUM_REF_PICTURES]; + int ref_bufs_poc[NUM_REF_PICTURES]; + u32 ref_bufs_used; + struct hantro_hevc_dec_ctrls ctrls; + unsigned int num_tile_cols_allocated; +}; + /** * struct hantro_mpeg2_dec_hw_ctx * @qtable: Quantization table @@ -178,6 +218,15 @@ int hantro_g1_h264_dec_run(struct hantro_ctx *ctx); int hantro_h264_dec_init(struct hantro_ctx *ctx); void hantro_h264_dec_exit(struct hantro_ctx *ctx); +int hantro_hevc_dec_init(struct hantro_ctx *ctx); +void hantro_hevc_dec_exit(struct hantro_ctx *ctx); +int hantro_g2_hevc_dec_run(struct hantro_ctx *ctx); +int hantro_hevc_dec_prepare_run(struct hantro_ctx *ctx); +dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, int poc); +void hantro_hevc_ref_remove_unused(struct hantro_ctx *ctx); +size_t hantro_hevc_chroma_offset(const struct v4l2_ctrl_hevc_sps *sps); +size_t hantro_hevc_motion_vectors_offset(const struct v4l2_ctrl_hevc_sps *sps); + static inline size_t hantro_h264_mv_size(unsigned int width, unsigned int height) { -- 2.25.1 From benjamin.gaignard at collabora.com Thu Mar 18 08:20:46 2021 From: benjamin.gaignard at collabora.com (Benjamin Gaignard) Date: Thu, 18 Mar 2021 09:20:46 +0100 Subject: [PATCH v6 13/13] arm64: dts: imx8mq: Add node to G2 hardware In-Reply-To: <20210318082046.51546-1-benjamin.gaignard@collabora.com> References: <20210318082046.51546-1-benjamin.gaignard@collabora.com> Message-ID: <20210318082046.51546-14-benjamin.gaignard@collabora.com> Split VPU node in two: one for G1 and one for G2 since they are different hardware blocks. Add syscon for hardware control block. Remove reg-names property that is useless. Each VPU node only need one interrupt. Signed-off-by: Benjamin Gaignard --- version 5: - use syscon instead of VPU reset arch/arm64/boot/dts/freescale/imx8mq.dtsi | 43 ++++++++++++++++++----- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi index 17c449e12c2e..b537d153ebbd 100644 --- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi @@ -1329,15 +1329,16 @@ usb3_phy1: usb-phy at 382f0040 { status = "disabled"; }; - vpu: video-codec at 38300000 { + vpu_ctrl: syscon at 38320000 { + compatible = "nxp,imx8mq-vpu-ctrl", "syscon"; + reg = <0x38320000 0x10000>; + }; + + vpu_g1: video-codec at 38300000 { compatible = "nxp,imx8mq-vpu"; - reg = <0x38300000 0x10000>, - <0x38310000 0x10000>, - <0x38320000 0x10000>; - reg-names = "g1", "g2", "ctrl"; - interrupts = , - ; - interrupt-names = "g1", "g2"; + reg = <0x38300000 0x10000>; + interrupts = ; + interrupt-names = "g1"; clocks = <&clk IMX8MQ_CLK_VPU_G1_ROOT>, <&clk IMX8MQ_CLK_VPU_G2_ROOT>, <&clk IMX8MQ_CLK_VPU_DEC_ROOT>; @@ -1350,9 +1351,33 @@ vpu: video-codec at 38300000 { <&clk IMX8MQ_VPU_PLL_OUT>, <&clk IMX8MQ_SYS1_PLL_800M>, <&clk IMX8MQ_VPU_PLL>; - assigned-clock-rates = <600000000>, <600000000>, + assigned-clock-rates = <600000000>, <300000000>, + <800000000>, <0>; + power-domains = <&pgc_vpu>; + nxp,imx8mq-vpu-ctrl = <&vpu_ctrl>; + }; + + vpu_g2: video-codec at 38310000 { + compatible = "nxp,imx8mq-vpu-g2"; + reg = <0x38310000 0x10000>; + interrupts = ; + interrupt-names = "g2"; + clocks = <&clk IMX8MQ_CLK_VPU_G1_ROOT>, + <&clk IMX8MQ_CLK_VPU_G2_ROOT>, + <&clk IMX8MQ_CLK_VPU_DEC_ROOT>; + clock-names = "g1", "g2", "bus"; + assigned-clocks = <&clk IMX8MQ_CLK_VPU_G1>, + <&clk IMX8MQ_CLK_VPU_G2>, + <&clk IMX8MQ_CLK_VPU_BUS>, + <&clk IMX8MQ_VPU_PLL_BYPASS>; + assigned-clock-parents = <&clk IMX8MQ_VPU_PLL_OUT>, + <&clk IMX8MQ_VPU_PLL_OUT>, + <&clk IMX8MQ_SYS1_PLL_800M>, + <&clk IMX8MQ_VPU_PLL>; + assigned-clock-rates = <600000000>, <300000000>, <800000000>, <0>; power-domains = <&pgc_vpu>; + nxp,imx8mq-vpu-ctrl = <&vpu_ctrl>; }; pcie0: pcie at 33800000 { -- 2.25.1 From fabioaiuto83 at gmail.com Thu Mar 18 09:14:15 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 10:14:15 +0100 Subject: staging: rtl8723bs: prefer ftrace Message-ID: <20210318091415.GA3683@agape.jhs> Hi, some suggestions before diving in a new task. The following checkpatch issue: -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace #559: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:559: + DBG_871X("%s\n", __func__); simply says to remove the line, due to the existence of the more appealing ftrace facility, right? @@ -556,8 +554,6 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) /* set intf_tag to if1 */ /* psta->intf_tag = 0; */ - DBG_871X("%s\n", __func__); - /* psta->mac_id = psta->aid+4; */ /* psta->mac_id = psta->aid+1;//alloc macid when call rtw_alloc_stainfo(), */ /* release macid when call rtw_free_stainfo() */ thank you, fabio From gregkh at linuxfoundation.org Thu Mar 18 09:23:07 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Thu, 18 Mar 2021 10:23:07 +0100 Subject: staging: rtl8723bs: prefer ftrace In-Reply-To: <20210318091415.GA3683@agape.jhs> References: <20210318091415.GA3683@agape.jhs> Message-ID: On Thu, Mar 18, 2021 at 10:14:15AM +0100, Fabio Aiuto wrote: > Hi, > > some suggestions before diving in a new task. > The following checkpatch issue: > > -- > WARNING: Unnecessary ftrace-like logging - prefer using ftrace > #559: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:559: > + DBG_871X("%s\n", __func__); > > simply says to remove the line, due to the existence of the more > appealing ftrace facility, right? > > @@ -556,8 +554,6 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) > /* set intf_tag to if1 */ > /* psta->intf_tag = 0; */ > > - DBG_871X("%s\n", __func__); > - > /* psta->mac_id = psta->aid+4; */ > /* psta->mac_id = psta->aid+1;//alloc macid when call rtw_alloc_stainfo(), */ > /* release macid when call rtw_free_stainfo() */ > Yes, stuff like this can be deleted. thanks, greg k-h From gregkh at linuxfoundation.org Thu Mar 18 11:42:40 2021 From: gregkh at linuxfoundation.org (Greg KH) Date: Thu, 18 Mar 2021 12:42:40 +0100 Subject: [PATCH] rtsx_chip.c:Fix usleep_range is preferred over udelay In-Reply-To: <20210318110837.kxzojquwkdp7rgcy@akshith-VirtualBox> References: <20210318110837.kxzojquwkdp7rgcy@akshith-VirtualBox> Message-ID: On Thu, Mar 18, 2021 at 04:38:37PM +0530, Akshith A V wrote: > changed udelay to usleep_range Trailing whitespace and odd line wrap :( > because usleep_range is preferred over udelay by checkpatch.pl > > Signed-off-by: Akshith A V > --- > drivers/staging/rts5208/rtsx_chip.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/rts5208/rtsx_chip.c b/drivers/staging/rts5208/rtsx_chip.c > index ee9ddc4eb94d..41ee334a4e6c 100644 > --- a/drivers/staging/rts5208/rtsx_chip.c > +++ b/drivers/staging/rts5208/rtsx_chip.c > @@ -1804,7 +1804,7 @@ void rtsx_exit_ss(struct rtsx_chip *chip) > > if (chip->power_down_in_ss) { > rtsx_force_power_on(chip, SSC_PDCTL | OC_PDCTL); > - udelay(1000); > + usleep_range(1000, 1010); Does this really do anything different? Did you test this? > } > > if (RTSX_TST_DELINK(chip)) { > -- > 2.25.1 > From dan.carpenter at oracle.com Thu Mar 18 12:16:04 2021 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Thu, 18 Mar 2021 15:16:04 +0300 Subject: [PATCH 01/43] Staging: rtl8723bs: fix names in rtw_mlme.h In-Reply-To: <20210317222130.29528-2-marcocesati@gmail.com> References: <20210317222130.29528-1-marcocesati@gmail.com> <20210317222130.29528-2-marcocesati@gmail.com> Message-ID: <20210318121604.GE2087@kadam> On Wed, Mar 17, 2021 at 11:20:48PM +0100, Marco Cesati wrote: > diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h > index 1ebc1e183381..ffcceb1fdde6 100644 > --- a/drivers/staging/rtl8723bs/include/rtw_mlme.h > +++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h > @@ -81,13 +81,13 @@ enum dot11AuthAlgrthmNum { > }; > > /* Scan type including active and passive scan. */ > -enum RT_SCAN_TYPE { > +enum rt_scan_type { > SCAN_PASSIVE, > SCAN_ACTIVE, > SCAN_MIX, > }; > > -enum _BAND { > +enum _band { _band is a bad name. > GHZ24_50 = 0, > GHZ_50, > GHZ_24, regards, dan carpenter From fabioaiuto83 at gmail.com Thu Mar 18 15:25:55 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:25:55 +0100 Subject: [PATCH 00/15] remove unnecessary logging In-Reply-To: References: Message-ID: <20210318152610.16758-1-fabioaiuto83@gmail.com> remove unnsecessary loggings warned by checkpatch Fabio Aiuto (15): staging: rtl8723bs: remove unnecessary logging in core/rtw_ap.c staging: rtl8723bs: remove unnecessary logging in core/rtw_mlme.c staging: rtl8723bs: remove unnecessary logging in core/rtw_mlme_ext.c staging: rtl8723bs: remove unnecessary logging in core/rtw_pwrctrl.c staging: rtl8723bs: remove unnecessary logging in core/rtw_wlan_util.c staging: rtl8723bs: remove unnecessary logging in hal/HalBtcOutSrc.h staging: rtl8723bs: remove unnecessary logging in hal/hal_com_phycfg.c staging: rtl8723bs: remove unnecessary logging in hal/odm.c staging: rtl8723bs: remove unnecessary logging in hal/odm_debug.h staging: rtl8723bs: remove unnecessary logging in hal/rtl8723b_cmd.c staging: rtl8723bs: remove unnecessary logging in hal/rtl8723b_hal_init.c staging: rtl8723bs: remove unnecessary logging in os_dep/ioctl_cfg80211.c staging: rtl8723bs: remove unnecessary logging in os_dep/ioctl_linux.c staging: rtl8723bs: remove unnecessary logging in os_dep/os_intfs.c staging: rtl8723bs: remove unnecessary logging in os_dep/wifi_regd.c drivers/staging/rtl8723bs/core/rtw_ap.c | 26 -------------- drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 +--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 36 +------------------ drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 5 --- .../staging/rtl8723bs/core/rtw_wlan_util.c | 2 -- drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h | 8 ----- .../staging/rtl8723bs/hal/hal_com_phycfg.c | 4 --- drivers/staging/rtl8723bs/hal/odm.c | 2 -- drivers/staging/rtl8723bs/hal/odm_debug.h | 2 -- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 13 ------- .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 4 --- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 14 -------- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 9 ----- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 7 ---- drivers/staging/rtl8723bs/os_dep/wifi_regd.c | 2 -- 15 files changed, 2 insertions(+), 138 deletions(-) -- 2.20.1 From fabioaiuto83 at gmail.com Thu Mar 18 15:25:56 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:25:56 +0100 Subject: [PATCH 01/15] staging: rtl8723bs: remove unnecessary logging in core/rtw_ap.c In-Reply-To: <20210318152610.16758-1-fabioaiuto83@gmail.com> References: <20210318152610.16758-1-fabioaiuto83@gmail.com> Message-ID: <20210318152610.16758-2-fabioaiuto83@gmail.com> fix the following checkpatch.pl issues: WARNING: Unnecessary ftrace-like logging - prefer using ftrace 66: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:66: + /* DBG_871X("%s\n", __func__); */ -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 559: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:559: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 716: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:716: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 770: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:770: + /* DBG_871X("%s\n", __func__); */ -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1476: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:1476: + /* DBG_871X("%s\n", __func__); */ -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1531: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:1531: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1557: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:1557: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1564: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:1564: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1609: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:1609: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1614: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:1614: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1619: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:1619: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1624: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:1624: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1629: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:1629: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1647: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:1647: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1716: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:1716: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1740: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:1740: + /* DBG_871X("%s\n", __func__); */ Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_ap.c | 26 ------------------------- 1 file changed, 26 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c index 63b339484289..d86ab7d0ddf2 100644 --- a/drivers/staging/rtl8723bs/core/rtw_ap.c +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c @@ -63,8 +63,6 @@ static void update_BCNTIM(struct adapter *padapter) struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network; unsigned char *pie = pnetwork_mlmeext->IEs; - /* DBG_871X("%s\n", __func__); */ - /* update TIM IE */ /* if (pstapriv->tim_bitmap) */ if (true) { @@ -556,8 +554,6 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) /* set intf_tag to if1 */ /* psta->intf_tag = 0; */ - DBG_871X("%s\n", __func__); - /* psta->mac_id = psta->aid+4; */ /* psta->mac_id = psta->aid+1;//alloc macid when call rtw_alloc_stainfo(), */ /* release macid when call rtw_free_stainfo() */ @@ -713,8 +709,6 @@ static void update_hw_ht_param(struct adapter *padapter) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - DBG_871X("%s\n", __func__); - /* handle A-MPDU parameter field * * AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k @@ -767,8 +761,6 @@ void start_bss_network(struct adapter *padapter, u8 *pbuf) struct HT_info_element *pht_info = NULL; u8 cbw40_enable = 0; - /* DBG_871X("%s\n", __func__); */ - bcn_interval = (u16)pnetwork->Configuration.BeaconPeriod; cur_channel = pnetwork->Configuration.DSConfig; cur_bwmode = CHANNEL_WIDTH_20; @@ -1473,8 +1465,6 @@ static int rtw_ap_set_key( struct cmd_priv *pcmdpriv = &(padapter->cmdpriv); int res = _SUCCESS; - /* DBG_871X("%s\n", __func__); */ - pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); if (pcmd == NULL) { res = _FAIL; @@ -1528,8 +1518,6 @@ static int rtw_ap_set_key( int rtw_ap_set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid) { - DBG_871X("%s\n", __func__); - return rtw_ap_set_key(padapter, key, alg, keyid, 1); } @@ -1554,14 +1542,11 @@ int rtw_ap_set_wep_key( alg = _NO_PRIVACY_; } - DBG_871X("%s\n", __func__); - return rtw_ap_set_key(padapter, key, alg, keyid, set_tx); } static void update_bcn_fixed_ie(struct adapter *padapter) { - DBG_871X("%s\n", __func__); } static void update_bcn_erpinfo_ie(struct adapter *padapter) @@ -1606,27 +1591,22 @@ static void update_bcn_erpinfo_ie(struct adapter *padapter) static void update_bcn_htcap_ie(struct adapter *padapter) { - DBG_871X("%s\n", __func__); } static void update_bcn_htinfo_ie(struct adapter *padapter) { - DBG_871X("%s\n", __func__); } static void update_bcn_rsn_ie(struct adapter *padapter) { - DBG_871X("%s\n", __func__); } static void update_bcn_wpa_ie(struct adapter *padapter) { - DBG_871X("%s\n", __func__); } static void update_bcn_wmm_ie(struct adapter *padapter) { - DBG_871X("%s\n", __func__); } static void update_bcn_wps_ie(struct adapter *padapter) @@ -1644,8 +1624,6 @@ static void update_bcn_wps_ie(struct adapter *padapter) unsigned char *ie = pnetwork->IEs; u32 ielen = pnetwork->IELength; - DBG_871X("%s\n", __func__); - pwps_ie = rtw_get_wps_ie( ie + _FIXED_IE_LENGTH_, ielen - _FIXED_IE_LENGTH_, @@ -1713,8 +1691,6 @@ static void update_bcn_p2p_ie(struct adapter *padapter) static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8 *oui) { - DBG_871X("%s\n", __func__); - if (!memcmp(RTW_WPA_OUI, oui, 4)) update_bcn_wpa_ie(padapter); @@ -1737,8 +1713,6 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) struct mlme_ext_priv *pmlmeext; /* struct mlme_ext_info *pmlmeinfo; */ - /* DBG_871X("%s\n", __func__); */ - if (!padapter) return; -- 2.20.1 From fabioaiuto83 at gmail.com Thu Mar 18 15:25:57 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:25:57 +0100 Subject: [PATCH 02/15] staging: rtl8723bs: remove unnecessary logging in core/rtw_mlme.c In-Reply-To: <20210318152610.16758-1-fabioaiuto83@gmail.com> References: <20210318152610.16758-1-fabioaiuto83@gmail.com> Message-ID: <20210318152610.16758-3-fabioaiuto83@gmail.com> fix the following checkpatch.pl issues: WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1134: FILE: drivers/staging/rtl8723bs/core/rtw_mlme.c:1134: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1223: FILE: drivers/staging/rtl8723bs/core/rtw_mlme.c:1223: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1528: FILE: drivers/staging/rtl8723bs/core/rtw_mlme.c:1528: + DBG_871X("%s\n", __func__); Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index 725f699abda9..368f0cdea65c 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -1131,8 +1131,6 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str if (psta) { /* update ptarget_sta */ - DBG_871X("%s\n", __func__); - psta->aid = pnetwork->join_res; update_sta_info(padapter, psta); @@ -1220,8 +1218,6 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct wlan_network *cur_network = &(pmlmepriv->cur_network); - DBG_871X("%s\n", __func__); - RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("\nfw_state:%x, BSSID:%pM\n" , get_fwstate(pmlmepriv), MAC_ARG(pnetwork->network.MacAddress))); @@ -1525,7 +1521,7 @@ void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf) psta->qos_option = 0; psta->mac_id = (uint)pstassoc->cam_id; /* psta->aid = (uint)pstassoc->cam_id; */ - DBG_871X("%s\n", __func__); + /* for ad-hoc mode */ rtw_hal_set_odm_var(adapter, HAL_ODM_STA_INFO, psta, true); -- 2.20.1 From fabioaiuto83 at gmail.com Thu Mar 18 15:25:58 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:25:58 +0100 Subject: [PATCH 03/15] staging: rtl8723bs: remove unnecessary logging in core/rtw_mlme_ext.c In-Reply-To: <20210318152610.16758-1-fabioaiuto83@gmail.com> References: <20210318152610.16758-1-fabioaiuto83@gmail.com> Message-ID: <20210318152610.16758-4-fabioaiuto83@gmail.com> fix the following checkpatch.pl issues: WARNING: Unnecessary ftrace-like logging - prefer using ftrace 987: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:987: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1115: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:1115: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1547: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:1547: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1760: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:1760: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1813: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:1813: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 2340: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:2340: + /* DBG_871X("%s\n", __func__); */ -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 2499: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:2499: + /* DBG_871X("%s\n", __func__); */ -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 2948: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:2948: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 2969: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:2969: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 3445: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:3445: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 3677: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:3677: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 3915: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:3915: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 4599: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:4599: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 5355: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:5355: + DBG_871X("=>%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 5366: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:5366: + DBG_871X("%s\n", __func__); Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 36 +------------------ 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index e60a2ed32de5..1633f868467b 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -984,8 +984,6 @@ unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_fram u8 *pframe = precv_frame->u.hdr.rx_data; uint pkt_len = precv_frame->u.hdr.len; - DBG_871X("%s\n", __func__); - /* check A1 matches or not */ if (memcmp(myid(&(padapter->eeprompriv)), get_da(pframe), ETH_ALEN)) return _SUCCESS; @@ -1111,9 +1109,6 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) left = pkt_len - (sizeof(struct ieee80211_hdr_3addr) + ie_offset); pos = pframe + (sizeof(struct ieee80211_hdr_3addr) + ie_offset); - - DBG_871X("%s\n", __func__); - /* check if this stat has been successfully authenticated/assocated */ if (!((pstat->state) & WIFI_FW_AUTH_SUCCESS)) { if (!((pstat->state) & WIFI_FW_ASSOC_SUCCESS)) { @@ -1544,8 +1539,6 @@ unsigned int OnAssocRsp(struct adapter *padapter, union recv_frame *precv_frame) u8 *pframe = precv_frame->u.hdr.rx_data; uint pkt_len = precv_frame->u.hdr.len; - DBG_871X("%s\n", __func__); - /* check A1 matches or not */ if (memcmp(myid(&(padapter->eeprompriv)), get_da(pframe), ETH_ALEN)) return _SUCCESS; @@ -1757,7 +1750,6 @@ unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame) unsigned int OnAtim(struct adapter *padapter, union recv_frame *precv_frame) { - DBG_871X("%s\n", __func__); return _SUCCESS; } @@ -1810,8 +1802,6 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra u8 *pframe = precv_frame->u.hdr.rx_data; struct sta_priv *pstapriv = &padapter->stapriv; - DBG_871X("%s\n", __func__); - /* check RA matches or not */ if (memcmp(myid(&(padapter->eeprompriv)), GetAddr1Ptr(pframe), ETH_ALEN))/* for if1, sta/ap mode */ return _SUCCESS; @@ -2337,8 +2327,6 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - /* DBG_871X("%s\n", __func__); */ - pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (!pmgntframe) { DBG_871X("%s, alloc mgnt frame fail\n", __func__); @@ -2496,8 +2484,6 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); unsigned int rate_len; - /* DBG_871X("%s\n", __func__); */ - if (da == NULL) return; @@ -2945,7 +2931,6 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short pattrib->last_txcmdsz = pattrib->pktlen; rtw_wep_encrypt(padapter, (u8 *)pmgntframe); - DBG_871X("%s\n", __func__); dump_mgntframe(padapter, pmgntframe); } @@ -2966,8 +2951,6 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i u8 *ie = pnetwork->IEs; __le16 lestatus, le_tmp; - DBG_871X("%s\n", __func__); - pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (pmgntframe == NULL) return; @@ -3442,8 +3425,6 @@ static int _issue_qos_nulldata(struct adapter *padapter, unsigned char *da, struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - DBG_871X("%s\n", __func__); - pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (pmgntframe == NULL) goto exit; @@ -3674,8 +3655,6 @@ void issue_action_SA_Query(struct adapter *padapter, unsigned char *raddr, unsig struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); __le16 le_tmp; - DBG_871X("%s\n", __func__); - pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (pmgntframe == NULL) { DBG_871X("%s: alloc_mgtxmitframe fail\n", __func__); @@ -3911,10 +3890,6 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) if (true == pmlmeinfo->bwmode_updated) return; - - DBG_871X("%s\n", __func__); - - category = RTW_WLAN_CATEGORY_PUBLIC; action = ACT_PUBLIC_BSSCOEXIST; @@ -4596,8 +4571,6 @@ unsigned int receive_disconnect(struct adapter *padapter, unsigned char *MacAddr if (!(!memcmp(MacAddr, get_my_bssid(&pmlmeinfo->network), ETH_ALEN))) return _SUCCESS; - DBG_871X("%s\n", __func__); - if ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) { if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) { pmlmeinfo->state = WIFI_FW_NULL_STATE; @@ -5287,7 +5260,7 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res) rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type)); rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, null_addr); - goto exit_mlmeext_joinbss_event_callback; + return; } if ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) @@ -5349,11 +5322,6 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res) if (get_iface_type(padapter) == IFACE_PORT0) rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_CONNECT, 0); - -exit_mlmeext_joinbss_event_callback: - - DBG_871X("=>%s\n", __func__); - } /* currently only adhoc mode will go here */ @@ -5363,8 +5331,6 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter, struct sta_info *p struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u8 join_type; - DBG_871X("%s\n", __func__); - if ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) { if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) { /* adhoc master or sta_count>1 */ -- 2.20.1 From fabioaiuto83 at gmail.com Thu Mar 18 15:25:59 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:25:59 +0100 Subject: [PATCH 04/15] staging: rtl8723bs: remove unnecessary logging in core/rtw_pwrctrl.c In-Reply-To: <20210318152610.16758-1-fabioaiuto83@gmail.com> References: <20210318152610.16758-1-fabioaiuto83@gmail.com> Message-ID: <20210318152610.16758-5-fabioaiuto83@gmail.com> fix the following checkpatch.pl issues: WARNING: Unnecessary ftrace-like logging - prefer using ftrace 185: FILE: drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:185: + DBG_871X("==>%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 606: FILE: drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:606: + DBG_871X("%s.....\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 753: FILE: drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:753: + /* DBG_871X("%s\n", __func__); */ Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c index 2e6c522b74e3..908591a8f3c2 100644 --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c @@ -182,7 +182,6 @@ void rtw_ps_processor(struct adapter *padapter) goto exit; if ((pwrpriv->rf_pwrstate == rf_on) && ((pwrpriv->pwr_state_check_cnts%4) == 0)) { - DBG_871X("==>%s\n", __func__); pwrpriv->change_rfpwrstate = rf_off; { ips_enter(padapter); @@ -603,8 +602,6 @@ void LeaveAllPowerSaveModeDirect(struct adapter *Adapter) struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(Adapter); - DBG_871X("%s.....\n", __func__); - if (Adapter->bSurpriseRemoved) { DBG_871X(FUNC_ADPT_FMT ": bSurpriseRemoved =%d Skip!\n", FUNC_ADPT_ARG(Adapter), Adapter->bSurpriseRemoved); @@ -750,8 +747,6 @@ static void cpwm_event_callback(struct work_struct *work) struct adapter *adapter = dvobj->if1; struct reportpwrstate_parm report; - /* DBG_871X("%s\n", __func__); */ - report.state = PS_STATE_S2; cpwm_int_hdl(adapter, &report); } -- 2.20.1 From fabioaiuto83 at gmail.com Thu Mar 18 15:26:00 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:26:00 +0100 Subject: [PATCH 05/15] staging: rtl8723bs: remove unnecessary logging in core/rtw_wlan_util.c In-Reply-To: <20210318152610.16758-1-fabioaiuto83@gmail.com> References: <20210318152610.16758-1-fabioaiuto83@gmail.com> Message-ID: <20210318152610.16758-6-fabioaiuto83@gmail.com> fix the following checkpatch.pl issues: WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1140: FILE: drivers/staging/rtl8723bs/core/rtw_wlan_util.c:1140: + DBG_871X("%s\n", __func__); Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c index 355e43c4cf9a..c267f1b546a4 100644 --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -1137,8 +1137,6 @@ void HTOnAssocRsp(struct adapter *padapter) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - DBG_871X("%s\n", __func__); - if ((pmlmeinfo->HT_info_enable) && (pmlmeinfo->HT_caps_enable)) { pmlmeinfo->HT_enable = 1; } else { -- 2.20.1 From fabioaiuto83 at gmail.com Thu Mar 18 15:26:01 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:26:01 +0100 Subject: [PATCH 06/15] staging: rtl8723bs: remove unnecessary logging in hal/HalBtcOutSrc.h In-Reply-To: <20210318152610.16758-1-fabioaiuto83@gmail.com> References: <20210318152610.16758-1-fabioaiuto83@gmail.com> Message-ID: <20210318152610.16758-7-fabioaiuto83@gmail.com> fix the following checkpatch.pl issues: WARNING: Unnecessary ftrace-like logging - prefer using ftrace 126: FILE: drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h:126: + DbgPrint("%s(): ", __func__);\ and remove the whole unused containing macro BTC_PRINT_F Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h index c38baf2bc412..aac8e8ed080d 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h +++ b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h @@ -120,14 +120,6 @@ extern u32 GLBtcDbgType[]; DbgPrint printstr;\ } -#define BTC_PRINT_F(dbgtype, dbgflag, printstr)\ -{\ - if (GLBtcDbgType[dbgtype] & dbgflag) {\ - DbgPrint("%s(): ", __func__);\ - DbgPrint printstr;\ - } \ -} - #define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr)\ {\ if (GLBtcDbgType[dbgtype] & dbgflag) {\ -- 2.20.1 From fabioaiuto83 at gmail.com Thu Mar 18 15:26:02 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:26:02 +0100 Subject: [PATCH 07/15] staging: rtl8723bs: remove unnecessary logging in hal/hal_com_phycfg.c In-Reply-To: <20210318152610.16758-1-fabioaiuto83@gmail.com> References: <20210318152610.16758-1-fabioaiuto83@gmail.com> Message-ID: <20210318152610.16758-8-fabioaiuto83@gmail.com> fix the following checkpatch.pl issues: WARNING: Unnecessary ftrace-like logging - prefer using ftrace 201: FILE: drivers/staging/rtl8723bs/hal/hal_com_phycfg.c:201: + /* DBG_871X("===>%s\n", __func__); */ -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 265: FILE: drivers/staging/rtl8723bs/hal/hal_com_phycfg.c:265: + /* DBG_871X("<===%s\n", __func__); */ Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 7405f9229117..20d81198f316 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -198,8 +198,6 @@ struct adapter *padapter { u8 path, base; - /* DBG_871X("===>%s\n", __func__); */ - for (path = ODM_RF_PATH_A; path <= ODM_RF_PATH_B; ++path) { base = PHY_GetTxPowerByRate(padapter, BAND_ON_2_4G, path, RF_1TX, MGN_11M); phy_SetTxPowerByRateBase(padapter, BAND_ON_2_4G, path, CCK, RF_1TX, base); @@ -261,8 +259,6 @@ struct adapter *padapter phy_SetTxPowerByRateBase(padapter, BAND_ON_5G, path, VHT_3SSMCS0_3SSMCS9, RF_3TX, base); /* DBG_871X("Power index base of 5G path %d 3Tx VHT3SS = > 0x%x\n", path, base); */ } - - /* DBG_871X("<===%s\n", __func__); */ } u8 PHY_GetRateSectionIndexOfTxPowerByRate( -- 2.20.1 From fabioaiuto83 at gmail.com Thu Mar 18 15:26:03 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:26:03 +0100 Subject: [PATCH 08/15] staging: rtl8723bs: remove unnecessary logging in hal/odm.c In-Reply-To: <20210318152610.16758-1-fabioaiuto83@gmail.com> References: <20210318152610.16758-1-fabioaiuto83@gmail.com> Message-ID: <20210318152610.16758-9-fabioaiuto83@gmail.com> fix the following checkpatch.pl issues: WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1109: FILE: drivers/staging/rtl8723bs/hal/odm.c:1109: + /* printk("==> %s\n", __func__); */ Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/hal/odm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm.c b/drivers/staging/rtl8723bs/hal/odm.c index c7607e7d26c5..80c9a95be870 100644 --- a/drivers/staging/rtl8723bs/hal/odm.c +++ b/drivers/staging/rtl8723bs/hal/odm.c @@ -1106,8 +1106,6 @@ void odm_RefreshRateAdaptiveMaskCE(struct DM_ODM_T *pDM_Odm) return; } - /* printk("==> %s\n", __func__); */ - for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) { PSTA_INFO_T pstat = pDM_Odm->pODM_StaInfo[i]; -- 2.20.1 From fabioaiuto83 at gmail.com Thu Mar 18 15:26:04 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:26:04 +0100 Subject: [PATCH 09/15] staging: rtl8723bs: remove unnecessary logging in hal/odm_debug.h In-Reply-To: <20210318152610.16758-1-fabioaiuto83@gmail.com> References: <20210318152610.16758-1-fabioaiuto83@gmail.com> Message-ID: <20210318152610.16758-10-fabioaiuto83@gmail.com> fix the following checkpatch.pl issues: WARNING: Unnecessary ftrace-like logging - prefer using ftrace 134: FILE: drivers/staging/rtl8723bs/hal/odm_debug.h:134: +#define ODM_dbg_enter() { DbgPrint("==> %s\n", __func__); } -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 135: FILE: drivers/staging/rtl8723bs/hal/odm_debug.h:135: +#define ODM_dbg_exit() { DbgPrint("<== %s\n", __func__); } and removed containing unused macros Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/hal/odm_debug.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_debug.h b/drivers/staging/rtl8723bs/hal/odm_debug.h index 22f0e37456e2..f2b2e169a6ac 100644 --- a/drivers/staging/rtl8723bs/hal/odm_debug.h +++ b/drivers/staging/rtl8723bs/hal/odm_debug.h @@ -131,8 +131,6 @@ ASSERT(false);\ } \ } while (0) -#define ODM_dbg_enter() { DbgPrint("==> %s\n", __func__); } -#define ODM_dbg_exit() { DbgPrint("<== %s\n", __func__); } #define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __func__, str); } #define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr)\ -- 2.20.1 From fabioaiuto83 at gmail.com Thu Mar 18 15:26:05 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:26:05 +0100 Subject: [PATCH 10/15] staging: rtl8723bs: remove unnecessary logging in hal/rtl8723b_cmd.c In-Reply-To: <20210318152610.16758-1-fabioaiuto83@gmail.com> References: <20210318152610.16758-1-fabioaiuto83@gmail.com> Message-ID: <20210318152610.16758-11-fabioaiuto83@gmail.com> fix the following checkpatch.pl issues: WARNING: Unnecessary ftrace-like logging - prefer using ftrace 129: FILE: drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c:129: + /* DBG_871X("%s\n", __func__); */ -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 222: FILE: drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c:222: + /* DBG_871X("%s\n", __func__); */ -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 329: FILE: drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c:329: + /* DBG_871X("%s\n", __func__); */ -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 696: FILE: drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c:696: + DBG_871X("%s()\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 794: FILE: drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c:794: + /* DBG_871X("%s---->\n", __func__); */ -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 965: FILE: drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c:965: + /* DBG_871X("%s---->\n", __func__); */ Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index 61fd643c244f..f6c191863747 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -125,9 +125,6 @@ static void ConstructBeacon(struct adapter *padapter, u8 *pframe, u32 *pLength) struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - /* DBG_871X("%s\n", __func__); */ - pwlanhdr = (struct ieee80211_hdr *)pframe; fctrl = &(pwlanhdr->frame_control); @@ -219,8 +216,6 @@ static void ConstructPSPoll(struct adapter *padapter, u8 *pframe, u32 *pLength) struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - /* DBG_871X("%s\n", __func__); */ - pwlanhdr = (struct ieee80211_hdr *)pframe; /* Frame control. */ @@ -326,8 +321,6 @@ static void ConstructProbeRsp(struct adapter *padapter, u8 *pframe, u32 *pLength uint wps_ielen; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - /* DBG_871X("%s\n", __func__); */ - pwlanhdr = (struct ieee80211_hdr *)pframe; mac = myid(&(padapter->eeprompriv)); @@ -692,9 +685,6 @@ void rtl8723b_set_FwPsTuneParam_cmd(struct adapter *padapter) void rtl8723b_set_FwPwrModeInIPS_cmd(struct adapter *padapter, u8 cmd_param) { /* BIT0:enable, BIT1:NoConnect32k */ - - DBG_871X("%s()\n", __func__); - FillH2CCmd8723B(padapter, H2C_8723B_FWLPS_IN_IPS_, 1, &cmd_param); } @@ -791,8 +781,6 @@ static void rtl8723b_set_FwRsvdPagePkt( struct RSVDPAGE_LOC RsvdPageLoc; - /* DBG_871X("%s---->\n", __func__); */ - pxmitpriv = &padapter->xmitpriv; pmlmeext = &padapter->mlmeextpriv; pmlmeinfo = &pmlmeext->mlmext_info; @@ -962,7 +950,6 @@ static void rtl8723b_set_AP_FwRsvdPagePkt( u32 TotalPacketLen = 0, MaxRsvdPageBufSize = 0; struct RSVDPAGE_LOC RsvdPageLoc; - /* DBG_871X("%s---->\n", __func__); */ DBG_8192C("+" FUNC_ADPT_FMT ": iface_type =%d\n", FUNC_ADPT_ARG(padapter), get_iface_type(padapter)); -- 2.20.1 From fabioaiuto83 at gmail.com Thu Mar 18 15:26:06 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:26:06 +0100 Subject: [PATCH 11/15] staging: rtl8723bs: remove unnecessary logging in hal/rtl8723b_hal_init.c In-Reply-To: <20210318152610.16758-1-fabioaiuto83@gmail.com> References: <20210318152610.16758-1-fabioaiuto83@gmail.com> Message-ID: <20210318152610.16758-12-fabioaiuto83@gmail.com> fix the following checkpatch.pl issues: WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1685: FILE: drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:1685: +/* DBG_8192C("%s\n", __func__); */ -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1722: FILE: drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:1722: +/* DBG_8192C("%s\n", __func__); */ Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 9bcceb13ca2d..cc7f9af680b1 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -1681,8 +1681,6 @@ static u8 hal_EfusePgPacketWrite1ByteHeader( u16 efuse_addr = *pAddr; u8 repeatcnt = 0; - -/* DBG_8192C("%s\n", __func__); */ pg_header = ((pTargetPkt->offset << 4) & 0xf0) | pTargetPkt->word_en; do { @@ -1718,8 +1716,6 @@ static u8 hal_EfusePgPacketWrite2ByteHeader( u8 pg_header = 0, tmp_header = 0; u8 repeatcnt = 0; - -/* DBG_8192C("%s\n", __func__); */ EFUSE_GetEfuseDefinition(padapter, efuseType, TYPE_AVAILABLE_EFUSE_BYTES_BANK, &efuse_max_available_len, bPseudoTest); efuse_addr = *pAddr; -- 2.20.1 From fabioaiuto83 at gmail.com Thu Mar 18 15:26:07 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:26:07 +0100 Subject: [PATCH 12/15] staging: rtl8723bs: remove unnecessary logging in os_dep/ioctl_cfg80211.c In-Reply-To: <20210318152610.16758-1-fabioaiuto83@gmail.com> References: <20210318152610.16758-1-fabioaiuto83@gmail.com> Message-ID: <20210318152610.16758-13-fabioaiuto83@gmail.com> fix the following checkpatch.pl issues: WARNING: Unnecessary ftrace-like logging - prefer using ftrace 239: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:239: + /* DBG_8192C("%s\n", __func__); */ -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 569: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:569: + DBG_8192C("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 854: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:854: + DBG_8192C("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1408: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:1408: + DBG_8192C("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1645: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:1645: + DBG_8192C("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 2222: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2222: + DBG_8192C("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 2230: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2230: + DBG_8192C("%s\n", __func__); Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index 2ff71d001c07..08fbbf05a8c7 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -235,9 +235,6 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl struct wiphy *wiphy = wdev->wiphy; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - - /* DBG_8192C("%s\n", __func__); */ - bssinf_len = pnetwork->network.IELength + sizeof(struct ieee80211_hdr_3addr); if (bssinf_len > MAX_BSSINFO_LEN) { DBG_871X("%s IE Length too long > %d byte\n", __func__, MAX_BSSINFO_LEN); @@ -566,8 +563,6 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa struct security_priv *psecuritypriv = &(padapter->securitypriv); struct sta_priv *pstapriv = &padapter->stapriv; - DBG_8192C("%s\n", __func__); - param->u.crypt.err = 0; param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; @@ -851,8 +846,6 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; - DBG_8192C("%s\n", __func__); - param->u.crypt.err = 0; param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; @@ -1405,7 +1398,6 @@ void rtw_cfg80211_surveydone_event_callback(struct adapter *padapter) struct wlan_network *pnetwork = NULL; #ifdef DEBUG_CFG80211 - DBG_8192C("%s\n", __func__); #endif spin_lock_bh(&(pmlmepriv->scanned_queue.lock)); @@ -1642,12 +1634,9 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy static int cfg80211_rtw_set_wiphy_params(struct wiphy *wiphy, u32 changed) { - DBG_8192C("%s\n", __func__); return 0; } - - static int rtw_cfg80211_set_wpa_version(struct security_priv *psecuritypriv, u32 wpa_version) { DBG_8192C("%s, wpa_version =%d\n", __func__, wpa_version); @@ -2219,7 +2208,6 @@ static int cfg80211_rtw_set_txpower(struct wiphy *wiphy, struct wireless_dev *wdev, enum nl80211_tx_power_setting type, int mbm) { - DBG_8192C("%s\n", __func__); return 0; } @@ -2227,8 +2215,6 @@ static int cfg80211_rtw_get_txpower(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm) { - DBG_8192C("%s\n", __func__); - *dbm = (12); return 0; -- 2.20.1 From fabioaiuto83 at gmail.com Thu Mar 18 15:26:08 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:26:08 +0100 Subject: [PATCH 13/15] staging: rtl8723bs: remove unnecessary logging in os_dep/ioctl_linux.c In-Reply-To: <20210318152610.16758-1-fabioaiuto83@gmail.com> References: <20210318152610.16758-1-fabioaiuto83@gmail.com> Message-ID: <20210318152610.16758-14-fabioaiuto83@gmail.com> fix the following checkpatch.pl issues: WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1207: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:1207: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1507: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:1507: + DBG_871X("=>%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 3390: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:3390: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 3687: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:3687: + DBG_871X("%s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 4143: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:4143: + /* DBG_871X("%s\n", __func__); */ Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index aac1391bdbf1..590da76e9e8e 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -1204,8 +1204,6 @@ static int rtw_wx_set_mlme(struct net_device *dev, if (mlme == NULL) return -1; - DBG_871X("%s\n", __func__); - reason = mlme->reason_code; DBG_871X("%s, cmd =%d, reason =%d\n", __func__, mlme->cmd, reason); @@ -1504,7 +1502,6 @@ static int rtw_wx_set_essid(struct net_device *dev, } authmode = padapter->securitypriv.ndisauthtype; - DBG_871X("=>%s\n", __func__); if (wrqu->essid.flags && wrqu->essid.length) { len = (wrqu->essid.length < IW_ESSID_MAX_SIZE) ? wrqu->essid.length : IW_ESSID_MAX_SIZE; @@ -3387,8 +3384,6 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, struct security_priv *psecuritypriv = &(padapter->securitypriv); struct sta_priv *pstapriv = &padapter->stapriv; - DBG_871X("%s\n", __func__); - param->u.crypt.err = 0; param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; @@ -3684,8 +3679,6 @@ static void rtw_hostapd_sta_flush(struct net_device *dev) struct adapter *padapter = rtw_netdev_priv(dev); /* struct sta_priv *pstapriv = &padapter->stapriv; */ - DBG_871X("%s\n", __func__); - flush_all_cam_entry(padapter); /* clear CAM */ rtw_sta_flush(padapter); @@ -4140,8 +4133,6 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) int ret = 0; struct adapter *padapter = rtw_netdev_priv(dev); - /* DBG_871X("%s\n", __func__); */ - /* * this function is expect to call in master mode, which allows no power saving * so, we just check hw_init_completed -- 2.20.1 From fabioaiuto83 at gmail.com Thu Mar 18 15:26:09 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:26:09 +0100 Subject: [PATCH 14/15] staging: rtl8723bs: remove unnecessary logging in os_dep/os_intfs.c In-Reply-To: <20210318152610.16758-1-fabioaiuto83@gmail.com> References: <20210318152610.16758-1-fabioaiuto83@gmail.com> Message-ID: <20210318152610.16758-15-fabioaiuto83@gmail.com> fix the following checkpatch.pl issues: WARNING: Unnecessary ftrace-like logging - prefer using ftrace 977: FILE: drivers/staging/rtl8723bs/os_dep/os_intfs.c:977: + DBG_871X("===> %s.........\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1030: FILE: drivers/staging/rtl8723bs/os_dep/os_intfs.c:1030: + DBG_871X("====> %s...\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1127: FILE: drivers/staging/rtl8723bs/os_dep/os_intfs.c:1127: + DBG_871X("===> %s\n", __func__); -- WARNING: Unnecessary ftrace-like logging - prefer using ftrace 1177: FILE: drivers/staging/rtl8723bs/os_dep/os_intfs.c:1177: + DBG_871X("<=== %s\n", __func__); Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index 3909f149de47..93d696d5cf19 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -974,9 +974,6 @@ static int ips_netdrv_open(struct adapter *padapter) padapter->net_closed = false; - DBG_871X("===> %s.........\n", __func__); - - padapter->bDriverStopped = false; padapter->bCardDisableWOHSM = false; /* padapter->bup = true; */ @@ -1027,8 +1024,6 @@ void rtw_ips_pwr_down(struct adapter *padapter) void rtw_ips_dev_unload(struct adapter *padapter) { - DBG_871X("====> %s...\n", __func__); - if (!padapter->bSurpriseRemoved) rtw_hal_deinit(padapter); @@ -1124,7 +1119,6 @@ void rtw_dev_unload(struct adapter *padapter) RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("+%s\n", __func__)); if (padapter->bup) { - DBG_871X("===> %s\n", __func__); padapter->bDriverStopped = true; if (padapter->xmitpriv.ack_tx) @@ -1174,7 +1168,6 @@ void rtw_dev_unload(struct adapter *padapter) padapter->bup = false; - DBG_871X("<=== %s\n", __func__); } else { RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("%s: bup ==false\n", __func__)); DBG_871X("%s: bup ==false\n", __func__); -- 2.20.1 From fabioaiuto83 at gmail.com Thu Mar 18 15:26:10 2021 From: fabioaiuto83 at gmail.com (Fabio Aiuto) Date: Thu, 18 Mar 2021 16:26:10 +0100 Subject: [PATCH 15/15] staging: rtl8723bs: remove unnecessary logging in os_dep/wifi_regd.c In-Reply-To: <20210318152610.16758-1-fabioaiuto83@gmail.com> References: <20210318152610.16758-1-fabioaiuto83@gmail.com> Message-ID: <20210318152610.16758-16-fabioaiuto83@gmail.com> fix the following checkpatch.pl issues: WARNING: Unnecessary ftrace-like logging - prefer using ftrace 153: FILE: drivers/staging/rtl8723bs/os_dep/wifi_regd.c:153: + DBG_8192C("%s\n", __func__); Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/os_dep/wifi_regd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c index b3d87a971398..93a35b94d8bc 100644 --- a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c +++ b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c @@ -150,7 +150,5 @@ void rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) { struct rtw_regulatory *reg = NULL; - DBG_8192C("%s\n", __func__); - _rtw_reg_notifier_apply(wiphy, request, reg); } -- 2.20.1 From tkjos at google.com Thu Mar 18 16:20:17 2021 From: tkjos at google.com (Todd Kjos) Date: Thu, 18 Mar 2021 09:20:17 -0700 Subject: [PATCH v3 0/3] Binder: Enable App Freezing Capability In-Reply-To: References: <20210316011630.1121213-1-dualli@chromium.org> <20210317180048.inzdursqmnvxkgwp@wittgenstein> Message-ID: On Wed, Mar 17, 2021 at 1:17 PM Jann Horn wrote: > > On Wed, Mar 17, 2021 at 7:00 PM Christian Brauner > wrote: > > On Mon, Mar 15, 2021 at 06:16:27PM -0700, Li Li wrote: > > > To improve the user experience when switching between recently used > > > applications, the background applications which are not currently needed > > > are cached in the memory. Normally, a well designed application will not > > > consume valuable CPU resources in the background. However, it's possible > > > some applications are not able or willing to behave as expected, wasting > > > energy even after being cached. > > > > > > It is a good idea to freeze those applications when they're only being > > > kept alive for the sake of faster startup and energy saving. These kernel > > > patches will provide the necessary infrastructure for user space framework > > > to freeze and thaw a cached process, check the current freezing status and > > > correctly deal with outstanding binder transactions to frozen processes. > > I just have some comments on the overall design: > > This seems a bit convoluted to me; and I'm not sure whether this is > really something the kernel should get involved in, or whether this > patchset is operating at the right layer. The issue is that there is lot's of per-process state in the binder driver that needs to be quiesced prior to freezing the process (using the standard freeze mechanism of Documentation/admin-guide/cgroup-v1/freezer-subsystem.rst). That's all this series does... quiesces binder state prior to freeze and then re-enable transactions when the process is thawed. > > If there are non-binder threads that are misbehaving, could you > instead stop all those threads in pure userspace code (e.g. by sending > a thread-directed signal to all of them and letting the signal handler > sleep on a futex); and if the binder thread receives a transaction > that should be handled, wake up those threads again? It is not an issue of stopping threads. It's an issue of quiescing binder for a process so clients aren't blocked waiting for a response from a frozen process that may never handle the transaction. This series causes the soon-to-be-frozen process to reject new transactions and allows user-space to detect when the transactions have drained from the queues prior to freezing the process. > > Or alternatively you could detect that the application is being woken > up frequently even though it's supposed to be idle (e.g. using > information from procfs), and kill it since you consider it to be > misbehaving? > > Or if there are specific usage patterns you see frequently that you > consider to be wasting CPU resources (e.g. setting an interval timer > that fires in short intervals), you could try to delay such timers. > > > With your current approach, you're baking the assumption that all IPC > goes through binder into the kernel API; things like passing a file > descriptor to a pipe through binder or using shared futexes are no No, we're dealing with an issue that is particular to binder IPC when freezing a process. I suspect that other IPC mechanisms do not have this issue -- and if any do for Android, then they would need equivalent pre-freeze/post-freeze mechanisms. So far in the testing of freezing in Android R, there haven't been issues with pipes or futexes that required this kind of explicit quiescing (at least none that I know of -- dualli@, please comment if there have been these kinds of issues). > longer usable for cross-process communication without making more > kernel changes. I'm not sure whether that's a good idea. On top of > that, if you freeze a process while it is in the middle of some > operation, resources associated with the operation will probably stay > in use for quite some time; for example, if an app is in the middle of > downloading some data over HTTP, and you freeze it, this may cause the > TCP connection to remain active and consume resources for send/receive > buffers on both the device and the server. From dualli at chromium.org Thu Mar 18 17:10:57 2021 From: dualli at chromium.org (Li Li) Date: Thu, 18 Mar 2021 10:10:57 -0700 Subject: [PATCH v3 0/3] Binder: Enable App Freezing Capability In-Reply-To: References: <20210316011630.1121213-1-dualli@chromium.org> <20210317180048.inzdursqmnvxkgwp@wittgenstein> Message-ID: On Thu, Mar 18, 2021 at 9:20 AM Todd Kjos wrote: > > On Wed, Mar 17, 2021 at 1:17 PM Jann Horn wrote: > > > > On Wed, Mar 17, 2021 at 7:00 PM Christian Brauner > > wrote: > > > On Mon, Mar 15, 2021 at 06:16:27PM -0700, Li Li wrote: > > > > To improve the user experience when switching between recently used > > > > applications, the background applications which are not currently needed > > > > are cached in the memory. Normally, a well designed application will not > > > > consume valuable CPU resources in the background. However, it's possible > > > > some applications are not able or willing to behave as expected, wasting > > > > energy even after being cached. > > > > > > > > It is a good idea to freeze those applications when they're only being > > > > kept alive for the sake of faster startup and energy saving. These kernel > > > > patches will provide the necessary infrastructure for user space framework > > > > to freeze and thaw a cached process, check the current freezing status and > > > > correctly deal with outstanding binder transactions to frozen processes. > > > > I just have some comments on the overall design: > > > > This seems a bit convoluted to me; and I'm not sure whether this is > > really something the kernel should get involved in, or whether this > > patchset is operating at the right layer. > > The issue is that there is lot's of per-process state in the binder > driver that needs to be quiesced prior to freezing the process (using > the standard freeze mechanism of > Documentation/admin-guide/cgroup-v1/freezer-subsystem.rst). That's all > this series does... quiesces binder state prior to freeze and then > re-enable transactions when the process is thawed. > > > > > If there are non-binder threads that are misbehaving, could you > > instead stop all those threads in pure userspace code (e.g. by sending > > a thread-directed signal to all of them and letting the signal handler > > sleep on a futex); and if the binder thread receives a transaction > > that should be handled, wake up those threads again? > > It is not an issue of stopping threads. It's an issue of quiescing > binder for a process so clients aren't blocked waiting for a response > from a frozen process that may never handle the transaction. This > series causes the soon-to-be-frozen process to reject new transactions > and allows user-space to detect when the transactions have drained > from the queues prior to freezing the process. > > > > > Or alternatively you could detect that the application is being woken > > up frequently even though it's supposed to be idle (e.g. using > > information from procfs), and kill it since you consider it to be > > misbehaving? > > > > Or if there are specific usage patterns you see frequently that you > > consider to be wasting CPU resources (e.g. setting an interval timer > > that fires in short intervals), you could try to delay such timers. > > > > > > With your current approach, you're baking the assumption that all IPC > > goes through binder into the kernel API; things like passing a file > > descriptor to a pipe through binder or using shared futexes are no > > No, we're dealing with an issue that is particular to binder IPC when > freezing a process. I suspect that other IPC mechanisms do not have > this issue -- and if any do for Android, then they would need > equivalent pre-freeze/post-freeze mechanisms. So far in the testing of > freezing in Android R, there haven't been issues with pipes or futexes > that required this kind of explicit quiescing (at least none that I > know of -- dualli@, please comment if there have been these kinds of > issues). Correct, currently there's no evidence the similar things should be applied to other IPC mechanisms. But we'll keep an eye on this. > > > longer usable for cross-process communication without making more > > kernel changes. I'm not sure whether that's a good idea. On top of > > that, if you freeze a process while it is in the middle of some > > operation, resources associated with the operation will probably stay > > in use for quite some time; for example, if an app is in the middle of > > downloading some data over HTTP, and you freeze it, this may cause the > > TCP connection to remain active and consume resources for send/receive > > buffers on both the device and the server. From marcocesati at gmail.com Thu Mar 18 17:43:35 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Thu, 18 Mar 2021 18:43:35 +0100 Subject: [PATCH 01/43] Staging: rtl8723bs: fix names in rtw_mlme.h In-Reply-To: <20210318121604.GE2087@kadam> References: <20210317222130.29528-1-marcocesati@gmail.com> <20210317222130.29528-2-marcocesati@gmail.com> <20210318121604.GE2087@kadam> Message-ID: <20210318174335.tjmulpy4q43qfpte@cesati.gmail.com> On Thu, Mar 18, 2021 at 03:16:04PM +0300, Dan Carpenter wrote: > On Wed, Mar 17, 2021 at 11:20:48PM +0100, Marco Cesati wrote: > > diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h > > index 1ebc1e183381..ffcceb1fdde6 100644 > > --- a/drivers/staging/rtl8723bs/include/rtw_mlme.h > > +++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h > > @@ -81,13 +81,13 @@ enum dot11AuthAlgrthmNum { > > }; > > > > /* Scan type including active and passive scan. */ > > -enum RT_SCAN_TYPE { > > +enum rt_scan_type { > > SCAN_PASSIVE, > > SCAN_ACTIVE, > > SCAN_MIX, > > }; > > > > -enum _BAND { > > +enum _band { > > _band is a bad name. OK, I'll fix it. Marco > > > GHZ24_50 = 0, > > GHZ_50, > > GHZ_24, > > regards, > dan carpenter -- ---- Marco Cesati, PhD Dept. of Civil Engineering and Computer Science Engineering Univ. of Rome Tor Vergata via del Politecnico 1, I-00133 Rome, Italy Tel. +39 06 7259 7389 From marcocesati at gmail.com Thu Mar 18 17:45:13 2021 From: marcocesati at gmail.com (Marco Cesati) Date: Thu, 18 Mar 2021 18:45:13 +0100 Subject: [PATCH 01/43] Staging: rtl8723bs: fix names in rtw_mlme.h In-Reply-To: <20210318121604.GE2087@kadam> References: <20210317222130.29528-1-marcocesati@gmail.com> <20210317222130.29528-2-marcocesati@gmail.com> <20210318121604.GE2087@kadam> Message-ID: <20210318174513.7ksachb6lfo3lxst@cesati.gmail.com> On Thu, Mar 18, 2021 at 03:16:04PM +0300, Dan Carpenter wrote: > On Wed, Mar 17, 2021 at 11:20:48PM +0100, Marco Cesati wrote: > > diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h > > index 1ebc1e183381..ffcceb1fdde6 100644 > > --- a/drivers/staging/rtl8723bs/include/rtw_mlme.h > > +++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h > > @@ -81,13 +81,13 @@ enum dot11AuthAlgrthmNum { > > }; > > > > /* Scan type including active and passive scan. */ > > -enum RT_SCAN_TYPE { > > +enum rt_scan_type { > > SCAN_PASSIVE, > > SCAN_ACTIVE, > > SCAN_MIX, > > }; > > > > -enum _BAND { > > +enum _band { > > _band is a bad name. OK, I'll fix it. Thanks, Marco > > > GHZ24_50 = 0, > > GHZ_50, > > GHZ_24, > > regards, > dan carpenter From paulmcquad at gmail.com Thu Mar 18 20:05:27 2021 From: paulmcquad at gmail.com (Paul McQuade) Date: Thu, 18 Mar 2021 20:05:27 +0000 Subject: [PATCH] rtl8188eu: Removed Unnecessary ftrace-like logging Message-ID: <20210318200527.454486-1-paulmcquad@gmail.com> prefer using ftrace Signed-off-by: Paul McQuade --- drivers/staging/rtl8188eu/core/rtw_ap.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 182bb944c9b3..008b60e72758 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -507,7 +507,6 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) struct ht_priv *phtpriv_sta = &psta->htpriv; psta->mac_id = psta->aid + 1; - DBG_88E("%s\n", __func__); /* ap mode */ rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, true); @@ -571,8 +570,6 @@ static void update_hw_ht_param(struct adapter *padapter) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - DBG_88E("%s\n", __func__); - /* handle A-MPDU parameter field * ampdu_params_info [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k * ampdu_params_info [4:2]:Min MPDU Start Spacing @@ -1166,8 +1163,6 @@ static void update_bcn_wps_ie(struct adapter *padapter) unsigned char *ie = pnetwork->ies; u32 ielen = pnetwork->ie_length; - DBG_88E("%s\n", __func__); - pwps_ie_src = pmlmepriv->wps_beacon_ie; if (!pwps_ie_src) return; @@ -1207,7 +1202,6 @@ static void update_bcn_wps_ie(struct adapter *padapter) static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8 *oui) { - DBG_88E("%s\n", __func__); if (!memcmp(WPS_OUI, oui, 4)) update_bcn_wps_ie(padapter); -- 2.30.1 From lkp at intel.com Thu Mar 18 21:48:25 2021 From: lkp at intel.com (kernel test robot) Date: Fri, 19 Mar 2021 05:48:25 +0800 Subject: [staging:staging-linus] BUILD SUCCESS 2cafd46a714af1e55354bc6dcea9dcc13f9475b5 Message-ID: <6053caa9.JbwVKMU5lt72H2M4%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-linus branch HEAD: 2cafd46a714af1e55354bc6dcea9dcc13f9475b5 staging: vt665x: fix alignment constraints elapsed time: 720m configs tested: 126 configs skipped: 3 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig x86_64 allyesconfig riscv allmodconfig i386 allyesconfig riscv allyesconfig arm omap2plus_defconfig arm clps711x_defconfig m68k m5475evb_defconfig sparc alldefconfig powerpc icon_defconfig xtensa nommu_kc705_defconfig powerpc socrates_defconfig arm assabet_defconfig h8300 h8300h-sim_defconfig mips decstation_64_defconfig arm nhk8815_defconfig arm cns3420vb_defconfig powerpc sbc8548_defconfig arm magician_defconfig mips tb0226_defconfig arm davinci_all_defconfig sh se7750_defconfig mips maltasmvp_eva_defconfig mips qi_lb60_defconfig xtensa alldefconfig mips decstation_defconfig arm exynos_defconfig mips gpr_defconfig arm multi_v4t_defconfig powerpc chrp32_defconfig powerpc mpc8560_ads_defconfig powerpc lite5200b_defconfig csky alldefconfig powerpc acadia_defconfig sh rsk7269_defconfig mips rm200_defconfig mips cu1000-neo_defconfig powerpc tqm8560_defconfig arm pxa910_defconfig arm simpad_defconfig powerpc mpc866_ads_defconfig powerpc ppc40x_defconfig powerpc stx_gp3_defconfig arm multi_v7_defconfig arm sama5_defconfig arc hsdk_defconfig mips nlm_xlp_defconfig sh sh03_defconfig sh j2_defconfig mips jmr3927_defconfig powerpc makalu_defconfig arm pxa3xx_defconfig sh ap325rxa_defconfig powerpc ppc64e_defconfig um kunit_defconfig sh edosk7705_defconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig sparc allyesconfig sparc defconfig i386 tinyconfig i386 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a001-20210318 i386 randconfig-a005-20210318 i386 randconfig-a003-20210318 i386 randconfig-a002-20210318 i386 randconfig-a006-20210318 i386 randconfig-a004-20210318 x86_64 randconfig-a011-20210318 x86_64 randconfig-a016-20210318 x86_64 randconfig-a013-20210318 x86_64 randconfig-a015-20210318 x86_64 randconfig-a014-20210318 x86_64 randconfig-a012-20210318 i386 randconfig-a013-20210318 i386 randconfig-a016-20210318 i386 randconfig-a011-20210318 i386 randconfig-a014-20210318 i386 randconfig-a015-20210318 i386 randconfig-a012-20210318 riscv nommu_k210_defconfig riscv nommu_virt_defconfig riscv allnoconfig riscv defconfig riscv rv32_defconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a006-20210318 x86_64 randconfig-a001-20210318 x86_64 randconfig-a005-20210318 x86_64 randconfig-a002-20210318 x86_64 randconfig-a003-20210318 x86_64 randconfig-a004-20210318 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From lkp at intel.com Thu Mar 18 21:56:47 2021 From: lkp at intel.com (kernel test robot) Date: Fri, 19 Mar 2021 05:56:47 +0800 Subject: [staging:staging-testing] BUILD SUCCESS 20ad01363a72c8378bd382a026d17c0eef2793cc Message-ID: <6053cc9f.TqQIdJahEAd0psk9%lkp@intel.com> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-testing branch HEAD: 20ad01363a72c8378bd382a026d17c0eef2793cc staging: octeon-usb: Match alignment with open parenthesis elapsed time: 728m configs tested: 134 configs skipped: 3 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64 allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig x86_64 allyesconfig riscv allmodconfig i386 allyesconfig riscv allyesconfig arm omap2plus_defconfig arm clps711x_defconfig m68k m5475evb_defconfig sparc alldefconfig powerpc icon_defconfig xtensa nommu_kc705_defconfig powerpc socrates_defconfig arm assabet_defconfig h8300 h8300h-sim_defconfig mips decstation_64_defconfig arm nhk8815_defconfig arm cns3420vb_defconfig powerpc sbc8548_defconfig arm magician_defconfig mips tb0226_defconfig arm imx_v4_v5_defconfig powerpc tqm8541_defconfig sh sh7724_generic_defconfig sh sh7770_generic_defconfig arm davinci_all_defconfig sh se7750_defconfig mips maltasmvp_eva_defconfig mips qi_lb60_defconfig xtensa alldefconfig mips decstation_defconfig arm exynos_defconfig mips gpr_defconfig arm multi_v4t_defconfig arm moxart_defconfig powerpc klondike_defconfig sh migor_defconfig riscv rv32_defconfig sh magicpanelr2_defconfig powerpc chrp32_defconfig powerpc mpc8560_ads_defconfig powerpc lite5200b_defconfig csky alldefconfig powerpc acadia_defconfig sh rsk7269_defconfig mips rm200_defconfig mips cu1000-neo_defconfig powerpc tqm8560_defconfig arm pxa910_defconfig arm simpad_defconfig powerpc mpc866_ads_defconfig powerpc ppc40x_defconfig powerpc stx_gp3_defconfig arm multi_v7_defconfig arm sama5_defconfig arc hsdk_defconfig mips nlm_xlp_defconfig sh sh03_defconfig sh j2_defconfig mips jmr3927_defconfig powerpc makalu_defconfig arm pxa3xx_defconfig sh ap325rxa_defconfig powerpc ppc64e_defconfig um kunit_defconfig sh edosk7705_defconfig ia64 allmodconfig ia64 defconfig ia64 allyesconfig m68k allmodconfig m68k defconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig nds32 defconfig nios2 allyesconfig csky defconfig alpha defconfig alpha allyesconfig xtensa allyesconfig h8300 allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig s390 allmodconfig parisc allyesconfig s390 defconfig sparc allyesconfig sparc defconfig i386 tinyconfig i386 defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a001-20210318 i386 randconfig-a005-20210318 i386 randconfig-a003-20210318 i386 randconfig-a002-20210318 i386 randconfig-a006-20210318 i386 randconfig-a004-20210318 x86_64 randconfig-a011-20210318 x86_64 randconfig-a016-20210318 x86_64 randconfig-a013-20210318 x86_64 randconfig-a015-20210318 x86_64 randconfig-a014-20210318 x86_64 randconfig-a012-20210318 i386 randconfig-a013-20210318 i386 randconfig-a016-20210318 i386 randconfig-a011-20210318 i386 randconfig-a014-20210318 i386 randconfig-a015-20210318 i386 randconfig-a012-20210318 riscv nommu_k210_defconfig riscv nommu_virt_defconfig riscv allnoconfig riscv defconfig x86_64 rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 rhel-8.3-kbuiltin x86_64 kexec clang tested configs: x86_64 randconfig-a006-20210318 x86_64 randconfig-a001-20210318 x86_64 randconfig-a005-20210318 x86_64 randconfig-a002-20210318 x86_64 randconfig-a003-20210318 x86_64 randconfig-a004-20210318 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org From unixbhaskar at gmail.com Fri Mar 19 01:41:20 2021 From: unixbhaskar at gmail.com (Bhaskar Chowdhury) Date: Fri, 19 Mar 2021 07:11:20 +0530 Subject: [PATCH] staging: rtl8188eu: Fix a typo Message-ID: <20210319014120.6474-1-unixbhaskar@gmail.com> s/pasive/passive/ Signed-off-by: Bhaskar Chowdhury --- drivers/staging/rtl8188eu/core/rtw_mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index f87dd71934c3..96d15fca48b0 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -37,7 +37,7 @@ int rtw_init_mlme_priv(struct adapter *padapter) pmlmepriv->pscanned = NULL; pmlmepriv->fw_state = 0; pmlmepriv->cur_network.network.InfrastructureMode = Ndis802_11AutoUnknown; - pmlmepriv->scan_mode = SCAN_ACTIVE;/* 1: active, 0: pasive. Maybe someday we should rename this varable to "active_mode" (Jeff) */ + pmlmepriv->scan_mode = SCAN_ACTIVE;/* 1: active, 0: passive. Maybe someday we should rename this varable to "active_mode" (Jeff) */ spin_lock_init(&pmlmepriv->lock); _rtw_init_queue(&pmlmepriv->free_bss_pool); -- 2.26.2 From xji at analogixsemi.com Fri Mar 19 02:34:27 2021 From: xji at analogixsemi.com (Xin Ji) Date: Fri, 19 Mar 2021 10:34:27 +0800 Subject: [PATCH v5 0/5] Add MIPI rx DPI support Message-ID: Hi all, this patch series implement MIPI rx DPI feature. Please help to review. This is the v5 version, any mistakes, please let me know, I'll fix it in the next series. Change history: v5: Fix Rob Herring, Hsin-Yi, Robert Foss comments - Rebase code on the branch 'drm-misc-next', refer video-interfaces.yaml - Seprate HDCP function to a new patch - Fix driver not correctly get 'bus-type' 'data-lanes' - Add audio HDMI codec function support v4: Fix Rob Herring comment - Rebase code on the branch 'drm-misc-next' - Change 'analogix,hdcp-support' type to boolean v3: Fix Rob Herring, Dan Carpenter, Nicolas comment - Split the patch, fix not correct return data - Fix several coding format - Split DP tx swing register setting to two property - Add HDCP support vender flag - remove 'analogix,swing-setting' and 'analogix,mipi-dpi-in' property v2: Fix Rob Herring comment - Fix yamllint warnings/errors in analogix,anx7625.yaml - Fix kernel robot compile warning v1: initial MIPI rx DPI feature support Xin Ji (5): dt-bindings:drm/bridge:anx7625:add vendor define flags drm/bridge: anx7625: fix not correct return value drm/bridge: anx7625: add MIPI DPI input feature support drm/bridge: anx7625: add HDCP support drm/bridge: anx7625: add HDMI audio function .../bindings/display/bridge/analogix,anx7625.yaml | 58 +- drivers/gpu/drm/bridge/analogix/anx7625.c | 601 +++++++++++++++++++-- drivers/gpu/drm/bridge/analogix/anx7625.h | 59 +- 3 files changed, 665 insertions(+), 53 deletions(-) -- 2.7.4 From xji at analogixsemi.com Fri Mar 19 02:37:02 2021 From: xji at analogixsemi.com (Xin Ji) Date: Fri, 19 Mar 2021 10:37:02 +0800 Subject: [PATCH v5 2/5] drm/bridge: anx7625: fix not correct return value In-Reply-To: References: Message-ID: <2295557fc68b89505e18e11fe079c7df361153e8.1616071250.git.xji@analogixsemi.com> At some time, the original code may return non zero value, force return 0 if operation finished. Signed-off-by: Xin Ji --- drivers/gpu/drm/bridge/analogix/anx7625.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 65cc059..04536cc 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -189,10 +189,10 @@ static int wait_aux_op_finish(struct anx7625_data *ctx) AP_AUX_CTRL_STATUS); if (val < 0 || (val & 0x0F)) { DRM_DEV_ERROR(dev, "aux status %02x\n", val); - val = -EIO; + return -EIO; } - return val; + return 0; } static int anx7625_video_mute_control(struct anx7625_data *ctx, -- 2.7.4 From xji at analogixsemi.com Fri Mar 19 02:37:45 2021 From: xji at analogixsemi.com (Xin Ji) Date: Fri, 19 Mar 2021 10:37:45 +0800 Subject: [PATCH v5 3/5] drm/bridge: anx7625: add MIPI DPI input feature support In-Reply-To: References: Message-ID: Add MIPI rx DPI input support. Reported-by: kernel test robot Signed-off-by: Xin Ji --- drivers/gpu/drm/bridge/analogix/anx7625.c | 243 ++++++++++++++++++++++-------- drivers/gpu/drm/bridge/analogix/anx7625.h | 18 ++- 2 files changed, 201 insertions(+), 60 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 04536cc..5c9b801 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -150,18 +150,18 @@ static int anx7625_write_and(struct anx7625_data *ctx, return anx7625_reg_write(ctx, client, offset, (val & (mask))); } -static int anx7625_write_and_or(struct anx7625_data *ctx, - struct i2c_client *client, - u8 offset, u8 and_mask, u8 or_mask) +static int anx7625_config_bit_matrix(struct anx7625_data *ctx) { - int val; + int i, ret; - val = anx7625_reg_read(ctx, client, offset); - if (val < 0) - return val; + ret = anx7625_write_or(ctx, ctx->i2c.tx_p2_client, + AUDIO_CONTROL_REGISTER, 0x80); + for (i = 0; i < 13; i++) + ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, + VIDEO_BIT_MATRIX_12 + i, + 0x18 + i); - return anx7625_reg_write(ctx, client, - offset, (val & and_mask) | (or_mask)); + return ret; } static int anx7625_read_ctrl_status_p0(struct anx7625_data *ctx) @@ -219,38 +219,6 @@ static int anx7625_video_mute_control(struct anx7625_data *ctx, return ret; } -static int anx7625_config_audio_input(struct anx7625_data *ctx) -{ - struct device *dev = &ctx->client->dev; - int ret; - - /* Channel num */ - ret = anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, - AUDIO_CHANNEL_STATUS_6, I2S_CH_2 << 5); - - /* FS */ - ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client, - AUDIO_CHANNEL_STATUS_4, - 0xf0, AUDIO_FS_48K); - /* Word length */ - ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client, - AUDIO_CHANNEL_STATUS_5, - 0xf0, AUDIO_W_LEN_24_24MAX); - /* I2S */ - ret |= anx7625_write_or(ctx, ctx->i2c.tx_p2_client, - AUDIO_CHANNEL_STATUS_6, I2S_SLAVE_MODE); - ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client, - AUDIO_CONTROL_REGISTER, ~TDM_TIMING_MODE); - /* Audio change flag */ - ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client, - AP_AV_STATUS, AP_AUDIO_CHG); - - if (ret < 0) - DRM_DEV_ERROR(dev, "fail to config audio.\n"); - - return ret; -} - /* Reduction of fraction a/b */ static void anx7625_reduction_of_a_fraction(unsigned long *a, unsigned long *b) { @@ -410,7 +378,7 @@ static int anx7625_dsi_video_timing_config(struct anx7625_data *ctx) ret |= anx7625_write_and(ctx, ctx->i2c.rx_p1_client, MIPI_LANE_CTRL_0, 0xfc); ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, - MIPI_LANE_CTRL_0, 3); + MIPI_LANE_CTRL_0, ctx->pdata.mipi_lanes - 1); /* Htotal */ htotal = ctx->dt.hactive.min + ctx->dt.hfront_porch.min + @@ -595,6 +563,76 @@ static int anx7625_dsi_config(struct anx7625_data *ctx) return ret; } +static int anx7625_api_dpi_config(struct anx7625_data *ctx) +{ + struct device *dev = &ctx->client->dev; + u16 freq = ctx->dt.pixelclock.min / 1000; + int ret; + + /* configure pixel clock */ + ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, + PIXEL_CLOCK_L, freq & 0xFF); + ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, + PIXEL_CLOCK_H, (freq >> 8)); + + /* set DPI mode */ + /* set to DPI PLL module sel */ + ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, + MIPI_DIGITAL_PLL_9, 0x20); + /* power down MIPI */ + ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, + MIPI_LANE_CTRL_10, 0x08); + /* enable DPI mode */ + ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, + MIPI_DIGITAL_PLL_18, 0x1C); + /* set first edge */ + ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, + VIDEO_CONTROL_0, 0x06); + if (ret < 0) + DRM_DEV_ERROR(dev, "IO error : dpi phy set failed.\n"); + + return ret; +} + +static int anx7625_dpi_config(struct anx7625_data *ctx) +{ + struct device *dev = &ctx->client->dev; + int ret; + + DRM_DEV_DEBUG_DRIVER(dev, "config dpi\n"); + + /* DSC disable */ + ret = anx7625_write_and(ctx, ctx->i2c.rx_p0_client, + R_DSC_CTRL_0, ~DSC_EN); + if (ret < 0) { + DRM_DEV_ERROR(dev, "IO error : disable dsc failed.\n"); + return ret; + } + + ret = anx7625_config_bit_matrix(ctx); + if (ret < 0) { + DRM_DEV_ERROR(dev, "config bit matrix failed.\n"); + return ret; + } + + ret = anx7625_api_dpi_config(ctx); + if (ret < 0) { + DRM_DEV_ERROR(dev, "mipi phy(dpi) setup failed.\n"); + return ret; + } + + /* set MIPI RX EN */ + ret = anx7625_write_or(ctx, ctx->i2c.rx_p0_client, + AP_AV_STATUS, AP_MIPI_RX_EN); + /* clear mute flag */ + ret |= anx7625_write_and(ctx, ctx->i2c.rx_p0_client, + AP_AV_STATUS, (u8)~AP_MIPI_MUTE); + if (ret < 0) + DRM_DEV_ERROR(dev, "IO error : enable mipi rx failed.\n"); + + return ret; +} + static void anx7625_dp_start(struct anx7625_data *ctx) { int ret; @@ -605,9 +643,10 @@ static void anx7625_dp_start(struct anx7625_data *ctx) return; } - anx7625_config_audio_input(ctx); - - ret = anx7625_dsi_config(ctx); + if (ctx->pdata.is_dpi) + ret = anx7625_dpi_config(ctx); + else + ret = anx7625_dsi_config(ctx); if (ret < 0) DRM_DEV_ERROR(dev, "MIPI phy setup error.\n"); @@ -1051,6 +1090,7 @@ static void anx7625_start_dp_work(struct anx7625_data *ctx) return; } + ctx->hpd_status = 1; ctx->hpd_high_cnt++; /* Not support HDCP */ @@ -1060,8 +1100,10 @@ static void anx7625_start_dp_work(struct anx7625_data *ctx) ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xec, 0x10); /* Interrupt for DRM */ ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xff, 0x01); - if (ret < 0) + if (ret < 0) { + DRM_DEV_ERROR(dev, "fail to setting HDCP/auth\n"); return; + } ret = anx7625_reg_read(ctx, ctx->i2c.rx_p1_client, 0x86); if (ret < 0) @@ -1080,6 +1122,10 @@ static void anx7625_hpd_polling(struct anx7625_data *ctx) int ret, val; struct device *dev = &ctx->client->dev; + /* Interrupt mode, no need poll HPD status, just return */ + if (ctx->pdata.intp_irq) + return; + if (atomic_read(&ctx->power_status) != 1) { DRM_DEV_DEBUG_DRIVER(dev, "No need to poling HPD status.\n"); return; @@ -1130,6 +1176,21 @@ static void anx7625_remove_edid(struct anx7625_data *ctx) ctx->slimport_edid_p.edid_block_num = -1; } +static void anx7625_dp_adjust_swing(struct anx7625_data *ctx) +{ + int i; + + for (i = 0; i < ctx->pdata.dp_lane0_swing_reg_cnt; i++) + anx7625_reg_write(ctx, ctx->i2c.tx_p1_client, + DP_TX_LANE0_SWING_REG0 + i, + ctx->pdata.lane0_reg_data[i] & 0xFF); + + for (i = 0; i < ctx->pdata.dp_lane1_swing_reg_cnt; i++) + anx7625_reg_write(ctx, ctx->i2c.tx_p1_client, + DP_TX_LANE1_SWING_REG0 + i, + ctx->pdata.lane1_reg_data[i] & 0xFF); +} + static void dp_hpd_change_handler(struct anx7625_data *ctx, bool on) { struct device *dev = &ctx->client->dev; @@ -1145,9 +1206,8 @@ static void dp_hpd_change_handler(struct anx7625_data *ctx, bool on) } else { DRM_DEV_DEBUG_DRIVER(dev, " HPD high\n"); anx7625_start_dp_work(ctx); + anx7625_dp_adjust_swing(ctx); } - - ctx->hpd_status = 1; } static int anx7625_hpd_change_detect(struct anx7625_data *ctx) @@ -1224,20 +1284,70 @@ static irqreturn_t anx7625_intr_hpd_isr(int irq, void *data) return IRQ_HANDLED; } +static int anx7625_get_swing_setting(struct device *dev, + struct anx7625_platform_data *pdata) +{ + int num_regs; + + if (of_get_property(dev->of_node, + "analogix,lane0-swing", &num_regs)) { + if (num_regs > DP_TX_SWING_REG_CNT) + num_regs = DP_TX_SWING_REG_CNT; + + pdata->dp_lane0_swing_reg_cnt = num_regs; + of_property_read_u32_array(dev->of_node, "analogix,lane0-swing", + pdata->lane0_reg_data, num_regs); + } + + if (of_get_property(dev->of_node, + "analogix,lane1-swing", &num_regs)) { + if (num_regs > DP_TX_SWING_REG_CNT) + num_regs = DP_TX_SWING_REG_CNT; + + pdata->dp_lane1_swing_reg_cnt = num_regs; + of_property_read_u32_array(dev->of_node, "analogix,lane1-swing", + pdata->lane1_reg_data, num_regs); + } + + return 0; +} + static int anx7625_parse_dt(struct device *dev, struct anx7625_platform_data *pdata) { - struct device_node *np = dev->of_node; + struct device_node *np = dev->of_node, *ep0; struct drm_panel *panel; int ret; + int bus_type, mipi_lanes; + anx7625_get_swing_setting(dev, pdata); + + pdata->is_dpi = 1; /* default dpi mode */ pdata->mipi_host_node = of_graph_get_remote_node(np, 0, 0); if (!pdata->mipi_host_node) { DRM_DEV_ERROR(dev, "fail to get internal panel.\n"); return -ENODEV; } - DRM_DEV_DEBUG_DRIVER(dev, "found dsi host node.\n"); + ep0 = of_graph_get_endpoint_by_regs(np, 0, 0); + if (ep0) { + if (of_property_read_u32(ep0, "bus-type", &bus_type)) + bus_type = 0; + + mipi_lanes = of_property_count_u32_elems(ep0, "data-lanes"); + } + + if (bus_type == 5) /* bus type is Parallel(DSI) */ + pdata->is_dpi = 0; + + pdata->mipi_lanes = mipi_lanes; + if (pdata->mipi_lanes > MAX_LANES_SUPPORT || pdata->mipi_lanes <= 0) + pdata->mipi_lanes = MAX_LANES_SUPPORT; + + if (pdata->is_dpi) + DRM_DEV_DEBUG_DRIVER(dev, "found MIPI DPI host node.\n"); + else + DRM_DEV_DEBUG_DRIVER(dev, "found MIPI DSI host node.\n"); ret = drm_of_find_panel_or_bridge(np, 1, 0, &panel, NULL); if (ret < 0) { @@ -1300,9 +1410,13 @@ static enum drm_connector_status anx7625_sink_detect(struct anx7625_data *ctx) { struct device *dev = &ctx->client->dev; - DRM_DEV_DEBUG_DRIVER(dev, "sink detect, return connected\n"); + DRM_DEV_DEBUG_DRIVER(dev, "sink detect\n"); + + if (ctx->pdata.panel_bridge) + return connector_status_connected; - return connector_status_connected; + return ctx->hpd_status ? connector_status_connected : + connector_status_disconnected; } static int anx7625_attach_dsi(struct anx7625_data *ctx) @@ -1330,7 +1444,7 @@ static int anx7625_attach_dsi(struct anx7625_data *ctx) return -EINVAL; } - dsi->lanes = 4; + dsi->lanes = ctx->pdata.mipi_lanes; dsi->format = MIPI_DSI_FMT_RGB888; dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | @@ -1376,10 +1490,12 @@ static int anx7625_bridge_attach(struct drm_bridge *bridge, return -ENODEV; } - err = anx7625_attach_dsi(ctx); - if (err) { - DRM_DEV_ERROR(dev, "Fail to attach to dsi : %d\n", err); - return err; + if (!ctx->pdata.is_dpi) { + err = anx7625_attach_dsi(ctx); + if (err) { + DRM_DEV_ERROR(dev, "Fail to attach to dsi : %d\n", err); + return err; + } } if (ctx->pdata.panel_bridge) { @@ -1478,6 +1594,10 @@ static bool anx7625_bridge_mode_fixup(struct drm_bridge *bridge, DRM_DEV_DEBUG_DRIVER(dev, "drm mode fixup set\n"); + /* No need fixup for external monitor */ + if (!ctx->pdata.panel_bridge) + return true; + hsync = mode->hsync_end - mode->hsync_start; hfp = mode->hsync_start - mode->hdisplay; hbp = mode->htotal - mode->hsync_end; @@ -1786,8 +1906,13 @@ static int anx7625_i2c_probe(struct i2c_client *client, platform->bridge.funcs = &anx7625_bridge_funcs; platform->bridge.of_node = client->dev.of_node; - platform->bridge.ops = DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_HPD; - platform->bridge.type = DRM_MODE_CONNECTOR_eDP; + platform->bridge.ops = DRM_BRIDGE_OP_EDID; + if (!platform->pdata.panel_bridge) + platform->bridge.ops |= DRM_BRIDGE_OP_HPD | + DRM_BRIDGE_OP_DETECT; + platform->bridge.type = platform->pdata.panel_bridge ? + DRM_MODE_CONNECTOR_eDP : + DRM_MODE_CONNECTOR_DisplayPort; drm_bridge_add(&platform->bridge); DRM_DEV_DEBUG_DRIVER(dev, "probe done\n"); diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.h b/drivers/gpu/drm/bridge/analogix/anx7625.h index 193ad86..beee95d 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.h +++ b/drivers/gpu/drm/bridge/analogix/anx7625.h @@ -141,12 +141,20 @@ #define HORIZONTAL_BACK_PORCH_H 0x22 /* Bit[7:4] are reserved */ /******** END of I2C Address 0x72 *********/ + +/***************************************************************/ +/* Register definition of device address 0x7a */ +#define DP_TX_SWING_REG_CNT 0x14 +#define DP_TX_LANE0_SWING_REG0 0x00 +#define DP_TX_LANE1_SWING_REG0 0x14 +/******** END of I2C Address 0x7a *********/ + /***************************************************************/ /* Register definition of device address 0x7e */ #define I2C_ADDR_7E_FLASH_CONTROLLER 0x7E -#define FLASH_LOAD_STA 0x05 +#define FLASH_LOAD_STA 0x05 #define FLASH_LOAD_STA_CHK BIT(7) #define XTAL_FRQ_SEL 0x3F @@ -347,11 +355,19 @@ struct s_edid_data { /***************** Display End *****************/ +#define MAX_LANES_SUPPORT 4 + struct anx7625_platform_data { struct gpio_desc *gpio_p_on; struct gpio_desc *gpio_reset; struct drm_bridge *panel_bridge; int intp_irq; + int is_dpi; + int mipi_lanes; + int dp_lane0_swing_reg_cnt; + int lane0_reg_data[DP_TX_SWING_REG_CNT]; + int dp_lane1_swing_reg_cnt; + int lane1_reg_data[DP_TX_SWING_REG_CNT]; u32 low_power_mode; struct device_node *mipi_host_node; }; -- 2.7.4 From xji at analogixsemi.com Fri Mar 19 02:38:33 2021 From: xji at analogixsemi.com (Xin Ji) Date: Fri, 19 Mar 2021 10:38:33 +0800 Subject: [PATCH v5 4/5] drm/bridge: anx7625: add HDCP support In-Reply-To: References: Message-ID: <3288c572e44b12da47dcd013b9a3073bae71ebf9.1616071250.git.xji@analogixsemi.com> Add HDCP feature, enable HDCP function through chip internal key and downstream's capability. Signed-off-by: Xin Ji --- drivers/gpu/drm/bridge/analogix/anx7625.c | 147 ++++++++++++++++++++++++++++++ drivers/gpu/drm/bridge/analogix/anx7625.h | 36 ++++++++ 2 files changed, 183 insertions(+) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 5c9b801..5e19170 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -633,6 +633,150 @@ static int anx7625_dpi_config(struct anx7625_data *ctx) return ret; } +static int anx7625_aux_dpcd_read(struct anx7625_data *ctx, + u8 addrh, u8 addrm, u8 addrl, + u8 len, u8 *buf) +{ + struct device *dev = &ctx->client->dev; + int ret; + u8 cmd; + + if (len > MAX_DPCD_BUFFER_SIZE) { + DRM_DEV_ERROR(dev, "exceed aux buffer len.\n"); + return -E2BIG; + } + + cmd = ((len - 1) << 4) | 0x09; + + /* Set command and length */ + ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, + AP_AUX_COMMAND, cmd); + + /* Set aux access address */ + ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, + AP_AUX_ADDR_7_0, addrl); + ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, + AP_AUX_ADDR_15_8, addrm); + ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, + AP_AUX_ADDR_19_16, addrh); + + /* Enable aux access */ + ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client, + AP_AUX_CTRL_STATUS, AP_AUX_CTRL_OP_EN); + + if (ret < 0) { + DRM_DEV_ERROR(dev, "cannot access aux related register.\n"); + return -EIO; + } + + usleep_range(2000, 2100); + + ret = wait_aux_op_finish(ctx); + if (ret) { + DRM_DEV_ERROR(dev, "aux IO error: wait aux op finish.\n"); + return ret; + } + + ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client, + AP_AUX_BUFF_START, len, buf); + if (ret < 0) { + DRM_DEV_ERROR(dev, "read dpcd register failed\n"); + return -EIO; + } + + return 0; +} + +static int anx7625_read_flash_status(struct anx7625_data *ctx) +{ + return anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, R_RAM_CTRL); +} + +static int anx7625_hdcp_key_probe(struct anx7625_data *ctx) +{ + int ret, val; + struct device *dev = &ctx->client->dev; + u8 ident[32]; + + ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, + FLASH_ADDR_HIGH, 0x91); + ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, + FLASH_ADDR_LOW, 0xA0); + if (ret < 0) { + DRM_DEV_ERROR(dev, "IO error : set key flash address.\n"); + return ret; + } + + ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, + FLASH_LEN_HIGH, (FLASH_BUF_LEN - 1) >> 8); + ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, + FLASH_LEN_LOW, (FLASH_BUF_LEN - 1) & 0xFF); + if (ret < 0) { + DRM_DEV_ERROR(dev, "IO error : set key flash len.\n"); + return ret; + } + + ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, + R_FLASH_RW_CTRL, FLASH_READ); + ret |= readx_poll_timeout(anx7625_read_flash_status, + ctx, val, + ((val & FLASH_DONE) || (val < 0)), + 2000, + 2000 * 150); + if (ret) { + DRM_DEV_ERROR(dev, "flash read access fail!\n"); + return -EIO; + } + + ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client, + FLASH_BUF_BASE_ADDR, + FLASH_BUF_LEN, ident); + if (ret < 0) { + DRM_DEV_ERROR(dev, "read flash data fail!\n"); + return -EIO; + } + + if (ident[29] == 0xFF && ident[30] == 0xFF && ident[31] == 0xFF) + return -EINVAL; + + return 0; +} + +static int anx7625_hdcp_setting(struct anx7625_data *ctx) +{ + u8 bcap; + int ret; + struct device *dev = &ctx->client->dev; + + ret = anx7625_hdcp_key_probe(ctx); + if (ret) { + DRM_DEV_DEBUG_DRIVER(dev, "disable HDCP by config\n"); + return anx7625_write_and(ctx, ctx->i2c.rx_p1_client, + 0xee, 0x9f); + } + + anx7625_aux_dpcd_read(ctx, 0x06, 0x80, 0x28, 1, &bcap); + if (!(bcap & 0x01)) { + DRM_DEV_DEBUG_DRIVER(dev, "bcap(0x%x) not support HDCP 1.4.\n", + bcap); + return anx7625_write_and(ctx, ctx->i2c.rx_p1_client, + 0xee, 0x9f); + } + + DRM_DEV_DEBUG_DRIVER(dev, "enable HDCP 1.4\n"); + + ret = anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xee, 0x20); + + /* Try auth flag */ + ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xec, 0x10); + /* Interrupt for DRM */ + ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xff, 0x01); + if (ret < 0) + DRM_DEV_ERROR(dev, "fail to enable HDCP\n"); + + return ret; +} + static void anx7625_dp_start(struct anx7625_data *ctx) { int ret; @@ -643,6 +787,9 @@ static void anx7625_dp_start(struct anx7625_data *ctx) return; } + /* HDCP config */ + anx7625_hdcp_setting(ctx); + if (ctx->pdata.is_dpi) ret = anx7625_dpi_config(ctx); else diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.h b/drivers/gpu/drm/bridge/analogix/anx7625.h index beee95d..c6f93e4 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.h +++ b/drivers/gpu/drm/bridge/analogix/anx7625.h @@ -154,9 +154,45 @@ #define I2C_ADDR_7E_FLASH_CONTROLLER 0x7E +#define FLASH_SRAM_SEL 0x00 +#define SRAM_ADDR_HIGH 0x01 +#define SRAM_ADDR_LOW 0x02 +#define SRAM_LEN_HIGH 0x03 +#define SRAM_LEN_LOW 0x04 #define FLASH_LOAD_STA 0x05 #define FLASH_LOAD_STA_CHK BIT(7) +#define R_RAM_CTRL 0x05 +/* bit positions */ +#define FLASH_DONE BIT(7) +#define BOOT_LOAD_DONE BIT(6) +#define CRC_OK BIT(5) +#define LOAD_DONE BIT(4) +#define O_RW_DONE BIT(3) +#define FUSE_BUSY BIT(2) +#define DECRYPT_EN BIT(1) +#define LOAD_START BIT(0) + +#define FLASH_ADDR_HIGH 0x0F +#define FLASH_ADDR_LOW 0x10 +#define FLASH_LEN_HIGH 0x31 +#define FLASH_LEN_LOW 0x32 + +#define R_FLASH_RW_CTRL 0x33 +/* bit positions */ +#define READ_DELAY_SELECT BIT(7) +#define GENERAL_INSTRUCTION_EN BIT(6) +#define FLASH_ERASE_EN BIT(5) +#define RDID_READ_EN BIT(4) +#define REMS_READ_EN BIT(3) +#define WRITE_STATUS_EN BIT(2) +#define FLASH_READ BIT(1) +#define FLASH_WRITE BIT(0) + +#define FLASH_BUF_BASE_ADDR 0x60 +#define FLASH_BUF_LEN 0x20 +#define FLASH_KEY_OFFSET 0x8000 + #define XTAL_FRQ_SEL 0x3F /* bit field positions */ #define XTAL_FRQ_SEL_POS 5 -- 2.7.4 From xji at analogixsemi.com Fri Mar 19 02:39:16 2021 From: xji at analogixsemi.com (Xin Ji) Date: Fri, 19 Mar 2021 10:39:16 +0800 Subject: [PATCH v5 5/5] drm/bridge: anx7625: add HDMI audio function In-Reply-To: References: Message-ID: <0ee28b74edfaeb5b8047bade7c97988d6133b81b.1616071250.git.xji@analogixsemi.com> Add audio HDMI codec function support, enable it through device true flag "analogix,audio-enable". Signed-off-by: Xin Ji --- drivers/gpu/drm/bridge/analogix/anx7625.c | 227 ++++++++++++++++++++++++++++++ drivers/gpu/drm/bridge/analogix/anx7625.h | 5 + 2 files changed, 232 insertions(+) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 5e19170..f4653f2 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -30,6 +30,8 @@ #include #include +#include + #include