* [PATCH 1/5] staging: r8188eu: remove a temporary variable
2022-08-08 20:14 [PATCH 0/5] staging: r8188eu: clean up _InitQueueReservedPage Martin Kaiser
@ 2022-08-08 20:14 ` Martin Kaiser
2022-08-08 20:14 ` [PATCH 2/5] staging: r8188eu: make numNQ a u8 Martin Kaiser
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Martin Kaiser @ 2022-08-08 20:14 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
linux-staging, linux-kernel, Martin Kaiser
Use pregistrypriv->wifi_spec directly instead of defining a temporary
variable.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/staging/r8188eu/hal/usb_halinit.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index e1d56370a471..b63f5bb21017 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -160,9 +160,8 @@ static void _InitQueueReservedPage(struct adapter *Adapter)
u32 numPubQ;
u32 value32;
u8 value8;
- bool bWiFiConfig = pregistrypriv->wifi_spec;
- if (bWiFiConfig) {
+ if (pregistrypriv->wifi_spec) {
if (haldata->OutEpQueueSel & TX_SELE_HQ)
numHQ = 0x29;
--
2.30.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/5] staging: r8188eu: make numNQ a u8
2022-08-08 20:14 [PATCH 0/5] staging: r8188eu: clean up _InitQueueReservedPage Martin Kaiser
2022-08-08 20:14 ` [PATCH 1/5] staging: r8188eu: remove a temporary variable Martin Kaiser
@ 2022-08-08 20:14 ` Martin Kaiser
2022-08-08 20:14 ` [PATCH 3/5] staging: r8188eu: change all num...Q variables to u8 Martin Kaiser
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Martin Kaiser @ 2022-08-08 20:14 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
linux-staging, linux-kernel, Martin Kaiser
The numNQ variable in _InitQueueReservedPage is defined as u32. It is
either set to 0 or to 0x1C. Change its type to u8 and remove the code that
casts the u32 value to u8.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/staging/r8188eu/hal/usb_halinit.c | 7 +++----
drivers/staging/r8188eu/include/rtl8188e_spec.h | 2 --
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index b63f5bb21017..18465e5ce9cc 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -156,10 +156,9 @@ static void _InitQueueReservedPage(struct adapter *Adapter)
struct registry_priv *pregistrypriv = &Adapter->registrypriv;
u32 numHQ = 0;
u32 numLQ = 0;
- u32 numNQ = 0;
+ u8 numNQ = 0;
u32 numPubQ;
u32 value32;
- u8 value8;
if (pregistrypriv->wifi_spec) {
if (haldata->OutEpQueueSel & TX_SELE_HQ)
@@ -171,8 +170,8 @@ static void _InitQueueReservedPage(struct adapter *Adapter)
/* NOTE: This step shall be proceed before writing REG_RQPN. */
if (haldata->OutEpQueueSel & TX_SELE_NQ)
numNQ = 0x1C;
- value8 = (u8)_NPQ(numNQ);
- rtw_write8(Adapter, REG_RQPN_NPQ, value8);
+
+ rtw_write8(Adapter, REG_RQPN_NPQ, numNQ);
numPubQ = 0xA8 - numHQ - numLQ - numNQ;
diff --git a/drivers/staging/r8188eu/include/rtl8188e_spec.h b/drivers/staging/r8188eu/include/rtl8188e_spec.h
index 9e7b1f89037c..d9a85fd13230 100644
--- a/drivers/staging/r8188eu/include/rtl8188e_spec.h
+++ b/drivers/staging/r8188eu/include/rtl8188e_spec.h
@@ -928,8 +928,6 @@ Current IOREG MAP
#define _HPQ(x) ((x) & 0xFF)
#define _LPQ(x) (((x) & 0xFF) << 8)
#define _PUBQ(x) (((x) & 0xFF) << 16)
-/* NOTE: in RQPN_NPQ register */
-#define _NPQ(x) ((x) & 0xFF)
#define HPQ_PUBLIC_DIS BIT(24)
#define LPQ_PUBLIC_DIS BIT(25)
--
2.30.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/5] staging: r8188eu: change all num...Q variables to u8
2022-08-08 20:14 [PATCH 0/5] staging: r8188eu: clean up _InitQueueReservedPage Martin Kaiser
2022-08-08 20:14 ` [PATCH 1/5] staging: r8188eu: remove a temporary variable Martin Kaiser
2022-08-08 20:14 ` [PATCH 2/5] staging: r8188eu: make numNQ a u8 Martin Kaiser
@ 2022-08-08 20:14 ` Martin Kaiser
2022-08-08 20:14 ` [PATCH 4/5] staging: r8188eu: remove two unused defines Martin Kaiser
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Martin Kaiser @ 2022-08-08 20:14 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
linux-staging, linux-kernel, Martin Kaiser
All of numPubQ, numHQ and numLQ variables store only u8 values. Change
their types to u8. We can then simplify the REG_RQPN expression. The
macros and the temporary variable are not needed any more.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/staging/r8188eu/hal/usb_halinit.c | 10 ++++------
drivers/staging/r8188eu/include/rtl8188e_spec.h | 4 ----
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index 18465e5ce9cc..25fd6b46e76d 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -154,11 +154,10 @@ static void _InitQueueReservedPage(struct adapter *Adapter)
{
struct hal_data_8188e *haldata = &Adapter->haldata;
struct registry_priv *pregistrypriv = &Adapter->registrypriv;
- u32 numHQ = 0;
- u32 numLQ = 0;
+ u8 numHQ = 0;
+ u8 numLQ = 0;
u8 numNQ = 0;
- u32 numPubQ;
- u32 value32;
+ u8 numPubQ;
if (pregistrypriv->wifi_spec) {
if (haldata->OutEpQueueSel & TX_SELE_HQ)
@@ -176,8 +175,7 @@ static void _InitQueueReservedPage(struct adapter *Adapter)
numPubQ = 0xA8 - numHQ - numLQ - numNQ;
/* TX DMA */
- value32 = _HPQ(numHQ) | _LPQ(numLQ) | _PUBQ(numPubQ) | LD_RQPN;
- rtw_write32(Adapter, REG_RQPN, value32);
+ rtw_write32(Adapter, REG_RQPN, LD_RQPN | numPubQ << 16 | numLQ << 8 | numHQ);
} else {
rtw_write16(Adapter, REG_RQPN_NPQ, 0x0000);/* Just follow MP Team,??? Georgia 03/28 */
rtw_write16(Adapter, REG_RQPN_NPQ, 0x0d);
diff --git a/drivers/staging/r8188eu/include/rtl8188e_spec.h b/drivers/staging/r8188eu/include/rtl8188e_spec.h
index d9a85fd13230..011da538df5f 100644
--- a/drivers/staging/r8188eu/include/rtl8188e_spec.h
+++ b/drivers/staging/r8188eu/include/rtl8188e_spec.h
@@ -924,10 +924,6 @@ Current IOREG MAP
#define _LLT_OP_VALUE(x) (((x) >> 30) & 0x3)
/* 0x0200h ~ 0x027Fh TXDMA Configuration */
-/* 2RQPN */
-#define _HPQ(x) ((x) & 0xFF)
-#define _LPQ(x) (((x) & 0xFF) << 8)
-#define _PUBQ(x) (((x) & 0xFF) << 16)
#define HPQ_PUBLIC_DIS BIT(24)
#define LPQ_PUBLIC_DIS BIT(25)
--
2.30.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/5] staging: r8188eu: remove two unused defines
2022-08-08 20:14 [PATCH 0/5] staging: r8188eu: clean up _InitQueueReservedPage Martin Kaiser
` (2 preceding siblings ...)
2022-08-08 20:14 ` [PATCH 3/5] staging: r8188eu: change all num...Q variables to u8 Martin Kaiser
@ 2022-08-08 20:14 ` Martin Kaiser
2022-08-08 20:14 ` [PATCH 5/5] staging: r8188eu: the high prio queue is always selected Martin Kaiser
2022-08-08 21:40 ` [PATCH 0/5] staging: r8188eu: clean up _InitQueueReservedPage Philipp Hortmann
5 siblings, 0 replies; 7+ messages in thread
From: Martin Kaiser @ 2022-08-08 20:14 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
linux-staging, linux-kernel, Martin Kaiser
HPQ_PUBLIC_DIS and LPQ_PUBLIC_DIS are not used by the r8188eu driver.
Remove them.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/staging/r8188eu/include/rtl8188e_spec.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/staging/r8188eu/include/rtl8188e_spec.h b/drivers/staging/r8188eu/include/rtl8188e_spec.h
index 011da538df5f..5d12ba46e205 100644
--- a/drivers/staging/r8188eu/include/rtl8188e_spec.h
+++ b/drivers/staging/r8188eu/include/rtl8188e_spec.h
@@ -925,8 +925,6 @@ Current IOREG MAP
/* 0x0200h ~ 0x027Fh TXDMA Configuration */
-#define HPQ_PUBLIC_DIS BIT(24)
-#define LPQ_PUBLIC_DIS BIT(25)
#define LD_RQPN BIT(31)
/* 2TDECTRL */
--
2.30.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 5/5] staging: r8188eu: the high prio queue is always selected
2022-08-08 20:14 [PATCH 0/5] staging: r8188eu: clean up _InitQueueReservedPage Martin Kaiser
` (3 preceding siblings ...)
2022-08-08 20:14 ` [PATCH 4/5] staging: r8188eu: remove two unused defines Martin Kaiser
@ 2022-08-08 20:14 ` Martin Kaiser
2022-08-08 21:40 ` [PATCH 0/5] staging: r8188eu: clean up _InitQueueReservedPage Philipp Hortmann
5 siblings, 0 replies; 7+ messages in thread
From: Martin Kaiser @ 2022-08-08 20:14 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
linux-staging, linux-kernel, Martin Kaiser
The high priority queue is always selected, regardless of the number of
out endpoints.
Therefore, haldata->OutEpQueueSel & TX_SELE_HQ is always true. We can
remove the check and use a define instead of the numHQ variable.
This check was the last user of TX_SELE_HQ. Rename haldata->OutEpQueueSel
to haldata->out_ep_extra_queues and store only the queues that are selected
in addition to the high priority queue.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/staging/r8188eu/hal/usb_halinit.c | 17 ++++++-----------
drivers/staging/r8188eu/include/rtl8188e_hal.h | 3 +--
drivers/staging/r8188eu/include/rtl8188e_spec.h | 2 ++
3 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index 25fd6b46e76d..63c5cec655d5 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -69,15 +69,14 @@ int rtl8188eu_interface_configure(struct adapter *adapt)
switch (pdvobjpriv->RtNumOutPipes) {
case 3:
- haldata->OutEpQueueSel = TX_SELE_HQ | TX_SELE_LQ | TX_SELE_NQ;
+ haldata->out_ep_extra_queues = TX_SELE_LQ | TX_SELE_NQ;
three_out_pipe(adapt, wifi_cfg);
break;
case 2:
- haldata->OutEpQueueSel = TX_SELE_HQ | TX_SELE_NQ;
+ haldata->out_ep_extra_queues = TX_SELE_NQ;
two_out_pipe(adapt, wifi_cfg);
break;
case 1:
- haldata->OutEpQueueSel = TX_SELE_HQ;
one_out_pipe(adapt);
break;
default:
@@ -154,28 +153,24 @@ static void _InitQueueReservedPage(struct adapter *Adapter)
{
struct hal_data_8188e *haldata = &Adapter->haldata;
struct registry_priv *pregistrypriv = &Adapter->registrypriv;
- u8 numHQ = 0;
u8 numLQ = 0;
u8 numNQ = 0;
u8 numPubQ;
if (pregistrypriv->wifi_spec) {
- if (haldata->OutEpQueueSel & TX_SELE_HQ)
- numHQ = 0x29;
-
- if (haldata->OutEpQueueSel & TX_SELE_LQ)
+ if (haldata->out_ep_extra_queues & TX_SELE_LQ)
numLQ = 0x1C;
/* NOTE: This step shall be proceed before writing REG_RQPN. */
- if (haldata->OutEpQueueSel & TX_SELE_NQ)
+ if (haldata->out_ep_extra_queues & TX_SELE_NQ)
numNQ = 0x1C;
rtw_write8(Adapter, REG_RQPN_NPQ, numNQ);
- numPubQ = 0xA8 - numHQ - numLQ - numNQ;
+ numPubQ = 0xA8 - NUM_HQ - numLQ - numNQ;
/* TX DMA */
- rtw_write32(Adapter, REG_RQPN, LD_RQPN | numPubQ << 16 | numLQ << 8 | numHQ);
+ rtw_write32(Adapter, REG_RQPN, LD_RQPN | numPubQ << 16 | numLQ << 8 | NUM_HQ);
} else {
rtw_write16(Adapter, REG_RQPN_NPQ, 0x0000);/* Just follow MP Team,??? Georgia 03/28 */
rtw_write16(Adapter, REG_RQPN_NPQ, 0x0d);
diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h
index ff0a4ce19dde..64cdc2fad20e 100644
--- a/drivers/staging/r8188eu/include/rtl8188e_hal.h
+++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h
@@ -36,7 +36,6 @@
0x2400 /* 9k for 88E nornal chip , MaxRxBuff=10k-max(TxReportSize(64*8),
* WOLPattern(16*24)) */
-#define TX_SELE_HQ BIT(0) /* High Queue */
#define TX_SELE_LQ BIT(1) /* Low Queue */
#define TX_SELE_NQ BIT(2) /* Normal Queue */
@@ -149,7 +148,7 @@ struct hal_data_8188e {
u8 AntDivCfg;
u8 TRxAntDivType;
- u8 OutEpQueueSel;
+ u8 out_ep_extra_queues;
struct P2P_PS_Offload_t p2p_ps_offload;
diff --git a/drivers/staging/r8188eu/include/rtl8188e_spec.h b/drivers/staging/r8188eu/include/rtl8188e_spec.h
index 5d12ba46e205..e34619140e33 100644
--- a/drivers/staging/r8188eu/include/rtl8188e_spec.h
+++ b/drivers/staging/r8188eu/include/rtl8188e_spec.h
@@ -925,6 +925,8 @@ Current IOREG MAP
/* 0x0200h ~ 0x027Fh TXDMA Configuration */
+#define NUM_HQ 0x29
+
#define LD_RQPN BIT(31)
/* 2TDECTRL */
--
2.30.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 0/5] staging: r8188eu: clean up _InitQueueReservedPage
2022-08-08 20:14 [PATCH 0/5] staging: r8188eu: clean up _InitQueueReservedPage Martin Kaiser
` (4 preceding siblings ...)
2022-08-08 20:14 ` [PATCH 5/5] staging: r8188eu: the high prio queue is always selected Martin Kaiser
@ 2022-08-08 21:40 ` Philipp Hortmann
5 siblings, 0 replies; 7+ messages in thread
From: Philipp Hortmann @ 2022-08-08 21:40 UTC (permalink / raw)
To: Martin Kaiser, Greg Kroah-Hartman
Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
linux-staging, linux-kernel
On 8/8/22 22:14, Martin Kaiser wrote:
> Simplify the _InitQueueReservedPage function. Remove unused code.
>
> This series depends on the "simplify endpoint configuration" series.
>
> Martin Kaiser (5):
> staging: r8188eu: remove a temporary variable
> staging: r8188eu: make numNQ a u8
> staging: r8188eu: change all num...Q variables to u8
> staging: r8188eu: remove two unused defines
> staging: r8188eu: the high prio queue is always selected
>
> drivers/staging/r8188eu/hal/usb_halinit.c | 33 +++++++------------
> .../staging/r8188eu/include/rtl8188e_hal.h | 3 +-
> .../staging/r8188eu/include/rtl8188e_spec.h | 12 ++-----
> 3 files changed, 16 insertions(+), 32 deletions(-)
>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
^ permalink raw reply [flat|nested] 7+ messages in thread