This set removes some unused variables, functions and defines in
rtw_recv.[ch]
Martin Kaiser (6):
staging: r8188eu: smooth_rssi_data is not used
staging: r8188eu: irq_prepare_beacon_tasklet is unused
staging: r8188eu: cnt is set but not used
staging: r8188eu: recvframe_push is not used
staging: r8188eu: get_rx_status is not used
staging: r8188eu: remove unused define
drivers/staging/r8188eu/core/rtw_recv.c | 2 --
drivers/staging/r8188eu/include/rtw_recv.h | 34 ----------------------
2 files changed, 36 deletions(-)
--
2.30.2
The recvframe_push function is not used. It can be removed.
Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/include/rtw_recv.h | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h
index a417a70835e7..25afcbe862e6 100644
--- a/drivers/staging/r8188eu/include/rtw_recv.h
+++ b/drivers/staging/r8188eu/include/rtw_recv.h
@@ -286,26 +286,6 @@ static inline u8 *get_rx_status(struct recv_frame *precvframe)
return get_rxmem(precvframe);
}
-static inline u8 *recvframe_push(struct recv_frame *precvframe, int sz)
-{
- /* append data before rx_data */
-
- /* add data to the start of recv_frame
- *
- * This function extends the used data area of the recv_frame at the buffer
- * start. rx_data must be still larger than rx_head, after pushing.
- */
- if (precvframe == NULL)
- return NULL;
- precvframe->rx_data -= sz ;
- if (precvframe->rx_data < precvframe->rx_head) {
- precvframe->rx_data += sz;
- return NULL;
- }
- precvframe->len += sz;
- return precvframe->rx_data;
-}
-
static inline u8 *recvframe_pull(struct recv_frame *precvframe, int sz)
{
/* rx_data += sz; move rx_data sz bytes hereafter */
--
2.30.2
In function recv_func, the cnt variable is set but not used.
It can be removed.
Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_recv.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
index 0144c4642911..9a2e2bc2e294 100644
--- a/drivers/staging/r8188eu/core/rtw_recv.c
+++ b/drivers/staging/r8188eu/core/rtw_recv.c
@@ -1798,11 +1798,9 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe)
if (check_fwstate(mlmepriv, WIFI_STATION_STATE) &&
psecuritypriv->busetkipkey) {
struct recv_frame *pending_frame;
- int cnt = 0;
pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue);
while (pending_frame) {
- cnt++;
recv_func_posthandle(padapter, pending_frame);
}
}
--
2.30.2
Hi Pavel,
Thus wrote Pavel Skripkin ([email protected]):
> Hi Martin,
> On 2/26/22 17:48, Martin Kaiser wrote:
> > In function recv_func, the cnt variable is set but not used.
> > It can be removed.
> > Signed-off-by: Martin Kaiser <[email protected]>
> > ---
> > drivers/staging/r8188eu/core/rtw_recv.c | 2 --
> > 1 file changed, 2 deletions(-)
> > diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
> > index 0144c4642911..9a2e2bc2e294 100644
> > --- a/drivers/staging/r8188eu/core/rtw_recv.c
> > +++ b/drivers/staging/r8188eu/core/rtw_recv.c
> > @@ -1798,11 +1798,9 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe)
> > if (check_fwstate(mlmepriv, WIFI_STATION_STATE) &&
> > psecuritypriv->busetkipkey) {
> > struct recv_frame *pending_frame;
> > - int cnt = 0;
> > pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue);
> > while (pending_frame) {
> Just out of curiosity: is this thing infinity loop?
yes it is. And the issue has been present since the driver was first
merged. Let's fix this before removing cnt so that the fix can be
backported to stable. I'll send out v2 shortly.
Thanks,
Martin
> > - cnt++;
> > recv_func_posthandle(padapter, pending_frame);
> > }
> Nit: bracers can be removed
> > }
> With regards,
> Pavel Skripkin
This set removes some unused variables, functions and defines in
rtw_recv.[ch]
v2: Fix an endless loop in recv_func.
Martin Kaiser (7):
staging: r8188eu: smooth_rssi_data is not used
staging: r8188eu: irq_prepare_beacon_tasklet is unused
staging: r8188eu: fix endless loop in recv_func
staging: r8188eu: cnt is set but not used
staging: r8188eu: recvframe_push is not used
staging: r8188eu: get_rx_status is not used
staging: r8188eu: remove unused define
drivers/staging/r8188eu/core/rtw_recv.c | 6 +---
drivers/staging/r8188eu/include/rtw_recv.h | 34 ----------------------
2 files changed, 1 insertion(+), 39 deletions(-)
--
2.30.2
Remove the unused function get_rx_status.
Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/include/rtw_recv.h | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h
index 25afcbe862e6..d2c1efbe62f0 100644
--- a/drivers/staging/r8188eu/include/rtw_recv.h
+++ b/drivers/staging/r8188eu/include/rtw_recv.h
@@ -281,11 +281,6 @@ static inline u8 *get_rxmem(struct recv_frame *precvframe)
return precvframe->rx_head;
}
-static inline u8 *get_rx_status(struct recv_frame *precvframe)
-{
- return get_rxmem(precvframe);
-}
-
static inline u8 *recvframe_pull(struct recv_frame *precvframe, int sz)
{
/* rx_data += sz; move rx_data sz bytes hereafter */
--
2.30.2
Fix an endless loop in recv_func. If pending_frame is not NULL, we're
stuck in the while loop forever. We have to call rtw_alloc_recvframe
each time we loop.
Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver")
Reported-by: Pavel Skripkin <[email protected]>
Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_recv.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
index 0144c4642911..c9878907de33 100644
--- a/drivers/staging/r8188eu/core/rtw_recv.c
+++ b/drivers/staging/r8188eu/core/rtw_recv.c
@@ -1800,8 +1800,7 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe)
struct recv_frame *pending_frame;
int cnt = 0;
- pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue);
- while (pending_frame) {
+ while ((pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue))) {
cnt++;
recv_func_posthandle(padapter, pending_frame);
}
--
2.30.2
irq_prepare_beacon_tasklet in struct recv_priv is not used for r8188eu.
Remove it.
Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/include/rtw_recv.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h
index 13df95781747..a417a70835e7 100644
--- a/drivers/staging/r8188eu/include/rtw_recv.h
+++ b/drivers/staging/r8188eu/include/rtw_recv.h
@@ -170,7 +170,6 @@ struct recv_priv {
struct semaphore allrxreturnevt;
u8 rx_pending_cnt;
- struct tasklet_struct irq_prepare_beacon_tasklet;
struct tasklet_struct recv_tasklet;
struct sk_buff_head free_recv_skb_queue;
struct sk_buff_head rx_skb_queue;
--
2.30.2
Thus wrote Pavel Skripkin ([email protected]):
> On 2/26/22 19:57, Pavel Skripkin wrote:
> > Hi Martin,
> > On 2/26/22 17:48, Martin Kaiser wrote:
> > > In function recv_func, the cnt variable is set but not used.
> > > It can be removed.
> > > Signed-off-by: Martin Kaiser <[email protected]>
> > > ---
> > > drivers/staging/r8188eu/core/rtw_recv.c | 2 --
> > > 1 file changed, 2 deletions(-)
> > > diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
> > > index 0144c4642911..9a2e2bc2e294 100644
> > > --- a/drivers/staging/r8188eu/core/rtw_recv.c
> > > +++ b/drivers/staging/r8188eu/core/rtw_recv.c
> > > @@ -1798,11 +1798,9 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe)
> > > if (check_fwstate(mlmepriv, WIFI_STATION_STATE) &&
> > > psecuritypriv->busetkipkey) {
> > > struct recv_frame *pending_frame;
> > > - int cnt = 0;
> > > pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue);
> > > while (pending_frame) {
> > Just out of curiosity: is this thing infinity loop?
> Hm.
> This function is called only inside a tasklet. IIRC it's not ok to have this
> kind of loops in softirq context
What exactly is this doing that's not allowed in a tasklet? Does it call
anything that could potentially block?
If I pull rtw_alloc_recvframe into the loop, that function uses spin_lock_bh +
spin_unlock_bh, I guess this is ok. As for recv_func_posthandle, I don't
see anything where we could be stuck...
Thanks,
Martin
Hi Martin,
On 2/26/22 21:07, Martin Kaiser wrote:
> What exactly is this doing that's not allowed in a tasklet? Does it call
> anything that could potentially block?
>
I mean infinity loop :)
> If I pull rtw_alloc_recvframe into the loop, that function uses spin_lock_bh +
> spin_unlock_bh, I guess this is ok. As for recv_func_posthandle, I don't
> see anything where we could be stuck...
>
Yeah, I guess, it's how it meant to be (like in
rtw_free_uc_swdec_pending_queue())
With regards,
Pavel Skripkin
On 2/26/22 19:57, Pavel Skripkin wrote:
> Hi Martin,
>
> On 2/26/22 17:48, Martin Kaiser wrote:
>> In function recv_func, the cnt variable is set but not used.
>> It can be removed.
>>
>> Signed-off-by: Martin Kaiser <[email protected]>
>> ---
>> drivers/staging/r8188eu/core/rtw_recv.c | 2 --
>> 1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
>> index 0144c4642911..9a2e2bc2e294 100644
>> --- a/drivers/staging/r8188eu/core/rtw_recv.c
>> +++ b/drivers/staging/r8188eu/core/rtw_recv.c
>> @@ -1798,11 +1798,9 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe)
>> if (check_fwstate(mlmepriv, WIFI_STATION_STATE) &&
>> psecuritypriv->busetkipkey) {
>> struct recv_frame *pending_frame;
>> - int cnt = 0;
>>
>> pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue);
>> while (pending_frame) {
>
> Just out of curiosity: is this thing infinity loop?
>
Hm.
This function is called only inside a tasklet. IIRC it's not ok to have
this kind of loops in softirq context
With regards,
Pavel Skripkin
struct smooth_rssi_data is not used in this driver.
It can be removed.
Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/include/rtw_recv.h | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h
index 5e65cf6b87bc..13df95781747 100644
--- a/drivers/staging/r8188eu/include/rtw_recv.h
+++ b/drivers/staging/r8188eu/include/rtw_recv.h
@@ -55,13 +55,6 @@ struct stainfo_rxcache {
*/
};
-struct smooth_rssi_data {
- u32 elements[100]; /* array to store values */
- u32 index; /* index to current array to store */
- u32 total_num; /* num of valid elements */
- u32 total_val; /* sum of valid elements */
-};
-
struct signal_stat {
u8 update_req; /* used to indicate */
u8 avg_val; /* avg of valid elements */
--
2.30.2
struct smooth_rssi_data is not used in this driver.
It can be removed.
Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/include/rtw_recv.h | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h
index 5e65cf6b87bc..13df95781747 100644
--- a/drivers/staging/r8188eu/include/rtw_recv.h
+++ b/drivers/staging/r8188eu/include/rtw_recv.h
@@ -55,13 +55,6 @@ struct stainfo_rxcache {
*/
};
-struct smooth_rssi_data {
- u32 elements[100]; /* array to store values */
- u32 index; /* index to current array to store */
- u32 total_num; /* num of valid elements */
- u32 total_val; /* sum of valid elements */
-};
-
struct signal_stat {
u8 update_req; /* used to indicate */
u8 avg_val; /* avg of valid elements */
--
2.30.2
Hi Martin,
On 2/26/22 17:48, Martin Kaiser wrote:
> In function recv_func, the cnt variable is set but not used.
> It can be removed.
>
> Signed-off-by: Martin Kaiser <[email protected]>
> ---
> drivers/staging/r8188eu/core/rtw_recv.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
> index 0144c4642911..9a2e2bc2e294 100644
> --- a/drivers/staging/r8188eu/core/rtw_recv.c
> +++ b/drivers/staging/r8188eu/core/rtw_recv.c
> @@ -1798,11 +1798,9 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe)
> if (check_fwstate(mlmepriv, WIFI_STATION_STATE) &&
> psecuritypriv->busetkipkey) {
> struct recv_frame *pending_frame;
> - int cnt = 0;
>
> pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue);
> while (pending_frame) {
Just out of curiosity: is this thing infinity loop?
> - cnt++;
> recv_func_posthandle(padapter, pending_frame);
> }
Nit: bracers can be removed
> }
With regards,
Pavel Skripkin
The recvframe_push function is not used. It can be removed.
Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/include/rtw_recv.h | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h
index a417a70835e7..25afcbe862e6 100644
--- a/drivers/staging/r8188eu/include/rtw_recv.h
+++ b/drivers/staging/r8188eu/include/rtw_recv.h
@@ -286,26 +286,6 @@ static inline u8 *get_rx_status(struct recv_frame *precvframe)
return get_rxmem(precvframe);
}
-static inline u8 *recvframe_push(struct recv_frame *precvframe, int sz)
-{
- /* append data before rx_data */
-
- /* add data to the start of recv_frame
- *
- * This function extends the used data area of the recv_frame at the buffer
- * start. rx_data must be still larger than rx_head, after pushing.
- */
- if (precvframe == NULL)
- return NULL;
- precvframe->rx_data -= sz ;
- if (precvframe->rx_data < precvframe->rx_head) {
- precvframe->rx_data += sz;
- return NULL;
- }
- precvframe->len += sz;
- return precvframe->rx_data;
-}
-
static inline u8 *recvframe_pull(struct recv_frame *precvframe, int sz)
{
/* rx_data += sz; move rx_data sz bytes hereafter */
--
2.30.2
Remove the rtw_dequeue_recvframe define, which is not used.
Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/include/rtw_recv.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h
index d2c1efbe62f0..6a6f6373467b 100644
--- a/drivers/staging/r8188eu/include/rtw_recv.h
+++ b/drivers/staging/r8188eu/include/rtw_recv.h
@@ -264,7 +264,6 @@ struct recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue);
struct recv_frame *rtw_alloc_recvframe(struct __queue *pfree_recv_queue);
int rtw_free_recvframe(struct recv_frame *precvframe,
struct __queue *pfree_recv_queue);
-#define rtw_dequeue_recvframe(queue) rtw_alloc_recvframe(queue)
int _rtw_enqueue_recvframe(struct recv_frame *precvframe, struct __queue *queue);
int rtw_enqueue_recvframe(struct recv_frame *precvframe, struct __queue *queue);
void rtw_free_recvframe_queue(struct __queue *pframequeue,
--
2.30.2