* [PATCH] staging: r8188eu: remove HW_VAR_AMPDU_FACTOR from SetHwReg8188EU()
@ 2022-07-01 21:07 Michael Straube
2022-07-02 7:14 ` Philipp Hortmann
0 siblings, 1 reply; 2+ messages in thread
From: Michael Straube @ 2022-07-01 21:07 UTC (permalink / raw)
To: gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel, Michael Straube
Remove the case HW_VAR_AMPDU_FACTOR from SetHwReg8188EU() and move
the functionality to a static function in rtw_wlan_util.c. This is
part of the ongoing effort to get rid of SetHwReg8188EU().
Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
drivers/staging/r8188eu/core/rtw_wlan_util.c | 28 +++++++++++++++++++-
drivers/staging/r8188eu/hal/usb_halinit.c | 26 ------------------
drivers/staging/r8188eu/include/hal_intf.h | 1 -
3 files changed, 27 insertions(+), 28 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c
index 2d5fd654ead9..aa6b549fd54d 100644
--- a/drivers/staging/r8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c
@@ -805,6 +805,32 @@ static void set_min_ampdu_spacing(struct adapter *adapter, u8 spacing)
}
}
+static void set_ampdu_factor(struct adapter *adapter, u8 factor)
+{
+ u8 RegToSet_Normal[4] = {0x41, 0xa8, 0x72, 0xb9};
+ u8 FactorToSet;
+ u8 *pRegToSet;
+ u8 index = 0;
+
+ pRegToSet = RegToSet_Normal; /* 0xb972a841; */
+ FactorToSet = factor;
+ if (FactorToSet <= 3) {
+ FactorToSet = (1 << (FactorToSet + 2));
+ if (FactorToSet > 0xf)
+ FactorToSet = 0xf;
+
+ for (index = 0; index < 4; index++) {
+ if ((pRegToSet[index] & 0xf0) > (FactorToSet << 4))
+ pRegToSet[index] = (pRegToSet[index] & 0x0f) | (FactorToSet << 4);
+
+ if ((pRegToSet[index] & 0x0f) > FactorToSet)
+ pRegToSet[index] = (pRegToSet[index] & 0xf0) | (FactorToSet);
+
+ rtw_write8(adapter, (REG_AGGLEN_LMT + index), pRegToSet[index]);
+ }
+ }
+}
+
void HTOnAssocRsp(struct adapter *padapter)
{
unsigned char max_AMPDU_len;
@@ -831,7 +857,7 @@ void HTOnAssocRsp(struct adapter *padapter)
set_min_ampdu_spacing(padapter, min_MPDU_spacing);
- SetHwReg8188EU(padapter, HW_VAR_AMPDU_FACTOR, (u8 *)(&max_AMPDU_len));
+ set_ampdu_factor(padapter, max_AMPDU_len);
}
void ERP_IE_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index 3908c46d2fbe..1a08de85a6ae 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -1209,32 +1209,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val)
case HW_VAR_DM_FUNC_CLR:
podmpriv->SupportAbility = 0;
break;
- case HW_VAR_AMPDU_FACTOR:
- {
- u8 RegToSet_Normal[4] = {0x41, 0xa8, 0x72, 0xb9};
- u8 FactorToSet;
- u8 *pRegToSet;
- u8 index = 0;
-
- pRegToSet = RegToSet_Normal; /* 0xb972a841; */
- FactorToSet = *((u8 *)val);
- if (FactorToSet <= 3) {
- FactorToSet = (1 << (FactorToSet + 2));
- if (FactorToSet > 0xf)
- FactorToSet = 0xf;
-
- for (index = 0; index < 4; index++) {
- if ((pRegToSet[index] & 0xf0) > (FactorToSet << 4))
- pRegToSet[index] = (pRegToSet[index] & 0x0f) | (FactorToSet << 4);
-
- if ((pRegToSet[index] & 0x0f) > FactorToSet)
- pRegToSet[index] = (pRegToSet[index] & 0xf0) | (FactorToSet);
-
- rtw_write8(Adapter, (REG_AGGLEN_LMT + index), pRegToSet[index]);
- }
- }
- }
- break;
default:
break;
}
diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index c3704618bccc..b81144932d9a 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -17,7 +17,6 @@ enum hw_variables {
HW_VAR_DM_FUNC_OP,
HW_VAR_DM_FUNC_RESET,
HW_VAR_DM_FUNC_CLR,
- HW_VAR_AMPDU_FACTOR,
};
typedef s32 (*c2h_id_filter)(u8 id);
--
2.36.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: r8188eu: remove HW_VAR_AMPDU_FACTOR from SetHwReg8188EU()
2022-07-01 21:07 [PATCH] staging: r8188eu: remove HW_VAR_AMPDU_FACTOR from SetHwReg8188EU() Michael Straube
@ 2022-07-02 7:14 ` Philipp Hortmann
0 siblings, 0 replies; 2+ messages in thread
From: Philipp Hortmann @ 2022-07-02 7:14 UTC (permalink / raw)
To: Michael Straube, gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel
On 7/1/22 23:07, Michael Straube wrote:
> Remove the case HW_VAR_AMPDU_FACTOR from SetHwReg8188EU() and move
> the functionality to a static function in rtw_wlan_util.c. This is
> part of the ongoing effort to get rid of SetHwReg8188EU().
>
> Signed-off-by: Michael Straube <straube.linux@gmail.com>
> ---
> drivers/staging/r8188eu/core/rtw_wlan_util.c | 28 +++++++++++++++++++-
> drivers/staging/r8188eu/hal/usb_halinit.c | 26 ------------------
> drivers/staging/r8188eu/include/hal_intf.h | 1 -
> 3 files changed, 27 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c
> index 2d5fd654ead9..aa6b549fd54d 100644
> --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c
> +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c
> @@ -805,6 +805,32 @@ static void set_min_ampdu_spacing(struct adapter *adapter, u8 spacing)
> }
> }
>
> +static void set_ampdu_factor(struct adapter *adapter, u8 factor)
> +{
> + u8 RegToSet_Normal[4] = {0x41, 0xa8, 0x72, 0xb9};
> + u8 FactorToSet;
> + u8 *pRegToSet;
> + u8 index = 0;
> +
> + pRegToSet = RegToSet_Normal; /* 0xb972a841; */
> + FactorToSet = factor;
> + if (FactorToSet <= 3) {
> + FactorToSet = (1 << (FactorToSet + 2));
> + if (FactorToSet > 0xf)
> + FactorToSet = 0xf;
> +
> + for (index = 0; index < 4; index++) {
> + if ((pRegToSet[index] & 0xf0) > (FactorToSet << 4))
> + pRegToSet[index] = (pRegToSet[index] & 0x0f) | (FactorToSet << 4);
> +
> + if ((pRegToSet[index] & 0x0f) > FactorToSet)
> + pRegToSet[index] = (pRegToSet[index] & 0xf0) | (FactorToSet);
> +
> + rtw_write8(adapter, (REG_AGGLEN_LMT + index), pRegToSet[index]);
> + }
> + }
> +}
> +
> void HTOnAssocRsp(struct adapter *padapter)
> {
> unsigned char max_AMPDU_len;
> @@ -831,7 +857,7 @@ void HTOnAssocRsp(struct adapter *padapter)
>
> set_min_ampdu_spacing(padapter, min_MPDU_spacing);
>
> - SetHwReg8188EU(padapter, HW_VAR_AMPDU_FACTOR, (u8 *)(&max_AMPDU_len));
> + set_ampdu_factor(padapter, max_AMPDU_len);
> }
>
> void ERP_IE_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
> diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
> index 3908c46d2fbe..1a08de85a6ae 100644
> --- a/drivers/staging/r8188eu/hal/usb_halinit.c
> +++ b/drivers/staging/r8188eu/hal/usb_halinit.c
> @@ -1209,32 +1209,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val)
> case HW_VAR_DM_FUNC_CLR:
> podmpriv->SupportAbility = 0;
> break;
> - case HW_VAR_AMPDU_FACTOR:
> - {
> - u8 RegToSet_Normal[4] = {0x41, 0xa8, 0x72, 0xb9};
> - u8 FactorToSet;
> - u8 *pRegToSet;
> - u8 index = 0;
> -
> - pRegToSet = RegToSet_Normal; /* 0xb972a841; */
> - FactorToSet = *((u8 *)val);
> - if (FactorToSet <= 3) {
> - FactorToSet = (1 << (FactorToSet + 2));
> - if (FactorToSet > 0xf)
> - FactorToSet = 0xf;
> -
> - for (index = 0; index < 4; index++) {
> - if ((pRegToSet[index] & 0xf0) > (FactorToSet << 4))
> - pRegToSet[index] = (pRegToSet[index] & 0x0f) | (FactorToSet << 4);
> -
> - if ((pRegToSet[index] & 0x0f) > FactorToSet)
> - pRegToSet[index] = (pRegToSet[index] & 0xf0) | (FactorToSet);
> -
> - rtw_write8(Adapter, (REG_AGGLEN_LMT + index), pRegToSet[index]);
> - }
> - }
> - }
> - break;
> default:
> break;
> }
> diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
> index c3704618bccc..b81144932d9a 100644
> --- a/drivers/staging/r8188eu/include/hal_intf.h
> +++ b/drivers/staging/r8188eu/include/hal_intf.h
> @@ -17,7 +17,6 @@ enum hw_variables {
> HW_VAR_DM_FUNC_OP,
> HW_VAR_DM_FUNC_RESET,
> HW_VAR_DM_FUNC_CLR,
> - HW_VAR_AMPDU_FACTOR,
> };
>
> typedef s32 (*c2h_id_filter)(u8 id);
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-02 7:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-01 21:07 [PATCH] staging: r8188eu: remove HW_VAR_AMPDU_FACTOR from SetHwReg8188EU() Michael Straube
2022-07-02 7:14 ` Philipp Hortmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).