staging: r8188eu: another round of removals
cover staging: r8188eu: another round of removals
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(-)
Signature · 1 line
2.30.2
PATCH 1/6 staging: r8188eu: smooth_rssi_data is not used
struct smooth_rssi_data is not used in this driver. It can be removed.
--- drivers/staging/r8188eu/include/rtw_recv.h | 7 ------- 1 file changed, 7 deletions(-)
drivers/staging/r8188eu/include/rtw_recv.h +0 -7
@@ -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 */
Signature · 1 line
2.30.2
PATCH 2/6 staging: r8188eu: irq_prepare_beacon_tasklet is unused
In reply to Martin Kaiserirq_prepare_beacon_tasklet in struct recv_priv is not used for r8188eu. Remove it.
--- drivers/staging/r8188eu/include/rtw_recv.h | 1 - 1 file changed, 1 deletion(-)
drivers/staging/r8188eu/include/rtw_recv.h +0 -1
@@ -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;
Signature · 1 line
2.30.2
PATCH 3/6 staging: r8188eu: cnt is set but not used
In reply to Martin KaiserIn function recv_func, the cnt variable is set but not used. It can be removed.
--- drivers/staging/r8188eu/core/rtw_recv.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/r8188eu/core/rtw_recv.c +0 -2
@@ -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); } }
Signature · 1 line
2.30.2
Re: [PATCH 3/6] staging: r8188eu: cnt is set but not used
Hi Martin,
Quoted 13 lines · Martin Kaiser
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(-)drivers/staging/r8188eu/core/rtw_recv.c +0
-0
drivers/staging/r8188eu/core/rtw_recv.c static int recv_func(struct adapter *padapter, struct recv_frame *rframe) · line 1803
Quoted 7 lines
drivers/staging/r8188eu/core/rtw_recv.c +0
-1@@ -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?
drivers/staging/r8188eu/core/rtw_recv.c static int recv_func(struct adapter *padapter, struct recv_frame *rframe) · line 1805
Quoted 3 lines
drivers/staging/r8188eu/core/rtw_recv.c +0
-1- cnt++;recv_func_posthandle (padapter, pending_frame); }
Nit: bracers can be removed
drivers/staging/r8188eu/core/rtw_recv.c static int recv_func(struct adapter *padapter, struct recv_frame *rframe) · line 1806
Quoted 1 line
drivers/staging/r8188eu/core/rtw_recv.c +0
-0}
With regards,
Pavel Skripkin
Re: [PATCH 3/6] staging: r8188eu: cnt is set but not used
Quoted 21 lines · Pavel Skripkin
Hi Martin,
Quoted 18 lines · Martin Kaiser
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(-)drivers/staging/r8188eu/core/rtw_recv.c +0
-1@@ -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 ;
Quoted 5 lines
drivers/staging/r8188eu/core/rtw_recv.c static int recv_func(struct adapter *padapter, struct recv_frame *rframe) · line 1803
Quoted 2 lines
drivers/staging/r8188eu/core/rtw_recv.c +0
-0pending_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
Re: [PATCH 3/6] staging: r8188eu: cnt is set but not used
Thus wrote Pavel Skripkin ([email protected]):
Quoted 27 lines · Pavel Skripkin
Quoted 11 lines
Hi Martin,
Quoted 7 lines · Martin Kaiser
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(-)Quoted 13 lines
drivers/staging/r8188eu/core/rtw_recv.c static int recv_func(struct adapter *padapter, struct recv_frame *rframe) · line 1802
Quoted 11 lines
drivers/staging/r8188eu/core/rtw_recv.c +0
-1@@ -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?
Quoted 4 lines
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
Re: [PATCH 3/6] staging: r8188eu: cnt is set but not used
Hi Martin,
Quoted 3 lines · Martin Kaiser
What exactly is this doing that's not allowed in a tasklet? Does it call anything that could potentially block?
I mean infinity loop :)
Quoted 4 lines
If I pull
rtw_alloc_recvframeinto the loop, that function usesspin_lock_bh+spin_unlock_bh, I guess this is ok. As forrecv_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
Re: [PATCH 3/6] staging: r8188eu: cnt is set but not used
In reply to Pavel SkripkinHi Pavel,
Thus wrote Pavel Skripkin ([email protected]):
Quoted 11 lines
Hi Martin,
Quoted 7 lines · Martin Kaiser
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(-)
Quoted 13 lines
drivers/staging/r8188eu/core/rtw_recv.c static int recv_func(struct adapter *padapter, struct recv_frame *rframe) · line 1802
Quoted 11 lines
drivers/staging/r8188eu/core/rtw_recv.c +0
-1@@ -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
Quoted 13 lines
drivers/staging/r8188eu/core/rtw_recv.c static int recv_func(struct adapter *padapter, struct recv_frame *rframe) · line 1805
Quoted 3 lines
drivers/staging/r8188eu/core/rtw_recv.c +0
-1- cnt++;recv_func_posthandle (padapter, pending_frame); }Nit: bracers can be removed
drivers/staging/r8188eu/core/rtw_recv.c static int recv_func(struct adapter *padapter, struct recv_frame *rframe) · line 1805
Quoted 1 line
drivers/staging/r8188eu/core/rtw_recv.c +0
-0}With regards,
Pavel Skripkin
PATCH 4/6 staging: r8188eu: recvframe_push is not used
In reply to Martin KaiserThe recvframe_push function is not used. It can be removed.
--- drivers/staging/r8188eu/include/rtw_recv.h | 20 -------------------- 1 file changed, 20 deletions(-)
drivers/staging/r8188eu/include/rtw_recv.h +0 -20
@@ -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 */
Signature · 1 line
2.30.2
PATCH 5/6 staging: r8188eu: get_rx_status is not used
In reply to Martin KaiserRemove the unused function get_rx_status.
--- drivers/staging/r8188eu/include/rtw_recv.h | 5 ----- 1 file changed, 5 deletions(-)
drivers/staging/r8188eu/include/rtw_recv.h +0 -5
@@ -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 */
Signature · 1 line
2.30.2
PATCH 6/6 staging: r8188eu: remove unused define
In reply to Martin KaiserRemove the rtw_dequeue_recvframe define, which is not used.
--- drivers/staging/r8188eu/include/rtw_recv.h | 1 - 1 file changed, 1 deletion(-)
drivers/staging/r8188eu/include/rtw_recv.h +0 -1
@@ -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,
Signature · 1 line
2.30.2
v2 cover staging: r8188eu: some removals, fix an endless loop
In reply to Martin KaiserThis 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(-)
Signature · 1 line
2.30.2
PATCH v2 1/7 staging: r8188eu: smooth_rssi_data is not used
struct smooth_rssi_data is not used in this driver. It can be removed.
--- drivers/staging/r8188eu/include/rtw_recv.h | 7 ------- 1 file changed, 7 deletions(-)
drivers/staging/r8188eu/include/rtw_recv.h +0 -7
@@ -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 */
Signature · 1 line
2.30.2
PATCH v2 2/7 staging: r8188eu: irq_prepare_beacon_tasklet is unused
In reply to Martin Kaiserirq_prepare_beacon_tasklet in struct recv_priv is not used for r8188eu. Remove it.
--- drivers/staging/r8188eu/include/rtw_recv.h | 1 - 1 file changed, 1 deletion(-)
drivers/staging/r8188eu/include/rtw_recv.h +0 -1
@@ -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;
Signature · 1 line
2.30.2
PATCH v2 3/7 staging: r8188eu: fix endless loop in recv_func
In reply to Martin KaiserFix 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.
--- drivers/staging/r8188eu/core/rtw_recv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/r8188eu/core/rtw_recv.c +1 -2
@@ -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); }
Signature · 1 line
2.30.2
PATCH v2 4/7 staging: r8188eu: cnt is set but not used
In reply to Martin KaiserIn function recv_func, the cnt variable is set but not used. It can be removed.
--- drivers/staging/r8188eu/core/rtw_recv.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/r8188eu/core/rtw_recv.c +1 -4
@@ -1798,12 +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 ; -while ((pending_frame =rtw_alloc_recvframe (&padapter->recvpriv.uc_swdec_pending_queue))) { - cnt++; +while ((pending_frame =rtw_alloc_recvframe (&padapter->recvpriv.uc_swdec_pending_queue)))recv_func_posthandle (padapter, pending_frame); - } } ret =recv_func_prehandle (padapter, rframe);
Signature · 1 line
2.30.2
PATCH v2 5/7 staging: r8188eu: recvframe_push is not used
In reply to Martin KaiserThe recvframe_push function is not used. It can be removed.
--- drivers/staging/r8188eu/include/rtw_recv.h | 20 -------------------- 1 file changed, 20 deletions(-)
drivers/staging/r8188eu/include/rtw_recv.h +0 -20
@@ -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 */
Signature · 1 line
2.30.2
PATCH v2 6/7 staging: r8188eu: get_rx_status is not used
In reply to Martin KaiserRemove the unused function get_rx_status.
--- drivers/staging/r8188eu/include/rtw_recv.h | 5 ----- 1 file changed, 5 deletions(-)
drivers/staging/r8188eu/include/rtw_recv.h +0 -5
@@ -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 */
Signature · 1 line
2.30.2
PATCH v2 7/7 staging: r8188eu: remove unused define
In reply to Martin KaiserRemove the rtw_dequeue_recvframe define, which is not used.
--- drivers/staging/r8188eu/include/rtw_recv.h | 1 - 1 file changed, 1 deletion(-)
drivers/staging/r8188eu/include/rtw_recv.h +0 -1
@@ -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,
Signature · 1 line
2.30.2