mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/9] staging: r8188eu: another round of xmit cleanups
@ 2023-01-30 19:52 Martin Kaiser
  2023-01-30 19:52 ` [PATCH 1/9] staging: r8188eu: rtw_free_xmitframe_queue needs no spinlock Martin Kaiser
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Martin Kaiser @ 2023-01-30 19:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Here's some more cleanups for the xmit code. Amongst other things, there's
one more __queue that can be replaced with a list_head.

Martin Kaiser (9):
  staging: r8188eu: rtw_free_xmitframe_queue needs no spinlock
  staging: r8188eu: change function param from __queue to list_head
  staging: r8188eu: change another function param from __queue to
    list_head
  staging: r8188eu: make sta_pending a list_head
  staging: r8188eu: use kernel helper to iterate over a list
  staging: r8188eu: legacy_dz is initialised but never used
  staging: r8188eu: apsd is initialised but never used
  staging: r8188eu: option in struct sta_xmit_priv is not used
  staging: r8188eu: replace switch-case with if

 drivers/staging/r8188eu/core/rtw_sta_mgt.c    | 10 +++---
 drivers/staging/r8188eu/core/rtw_xmit.c       | 31 +++++--------------
 drivers/staging/r8188eu/hal/rtl8188eu_xmit.c  |  4 +--
 drivers/staging/r8188eu/include/rtw_xmit.h    |  8 ++---
 .../staging/r8188eu/os_dep/usb_ops_linux.c    |  8 +----
 5 files changed, 18 insertions(+), 43 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/9] staging: r8188eu: rtw_free_xmitframe_queue needs no spinlock
  2023-01-30 19:52 [PATCH 0/9] staging: r8188eu: another round of xmit cleanups Martin Kaiser
@ 2023-01-30 19:52 ` Martin Kaiser
  2023-01-30 19:52 ` [PATCH 2/9] staging: r8188eu: change function param from __queue to list_head Martin Kaiser
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2023-01-30 19:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

There's no need for a spinlock in rtw_free_xmitframe_queue.

This function is called only from rtw_free_stainfo. rtw_free_stainfo holds
pxmitpriv->lock during all rtw_free_xmitframe_queue calls.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_xmit.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index f50e10f0d51f..4e49f1d49eb5 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1330,8 +1330,6 @@ void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, struct __queue *pfram
 	struct list_head *plist, *phead;
 	struct	xmit_frame	*pxmitframe;
 
-	spin_lock_bh(&pframequeue->lock);
-
 	phead = get_list_head(pframequeue);
 	plist = phead->next;
 
@@ -1342,7 +1340,6 @@ void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, struct __queue *pfram
 
 		rtw_free_xmitframe(pxmitpriv, pxmitframe);
 	}
-	spin_unlock_bh(&pframequeue->lock);
 }
 
 struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i)
-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/9] staging: r8188eu: change function param from __queue to list_head
  2023-01-30 19:52 [PATCH 0/9] staging: r8188eu: another round of xmit cleanups Martin Kaiser
  2023-01-30 19:52 ` [PATCH 1/9] staging: r8188eu: rtw_free_xmitframe_queue needs no spinlock Martin Kaiser
@ 2023-01-30 19:52 ` Martin Kaiser
  2023-01-30 19:52 ` [PATCH 3/9] staging: r8188eu: change another " Martin Kaiser
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2023-01-30 19:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Modify the dequeue_xmitframes_to_sleeping_queue function to take a
list_head pointer instead of a __queue pointer.

This is an intermediate step towards changing struct tx_servq's
sta_pending from __queue to list_head.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_xmit.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 4e49f1d49eb5..3117db41d749 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1788,16 +1788,15 @@ int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fra
 	return ret;
 }
 
-static void dequeue_xmitframes_to_sleeping_queue(struct adapter *padapter, struct sta_info *psta, struct __queue *pframequeue)
+static void dequeue_xmitframes_to_sleeping_queue(struct adapter *padapter, struct sta_info *psta, struct list_head *phead)
 {
-	struct list_head *plist, *phead;
+	struct list_head *plist;
 	u8	ac_index;
 	struct tx_servq	*ptxservq;
 	struct pkt_attrib	*pattrib;
 	struct xmit_frame	*pxmitframe;
 	struct hw_xmit *phwxmits =  padapter->xmitpriv.hwxmits;
 
-	phead = get_list_head(pframequeue);
 	plist = phead->next;
 
 	while (phead != plist) {
@@ -1834,21 +1833,21 @@ void stop_sta_xmit(struct adapter *padapter, struct sta_info *psta)
 
 	pstapriv->sta_dz_bitmap |= BIT(psta->aid);
 
-	dequeue_xmitframes_to_sleeping_queue(padapter, psta, &pstaxmitpriv->vo_q.sta_pending);
+	dequeue_xmitframes_to_sleeping_queue(padapter, psta, get_list_head(&pstaxmitpriv->vo_q.sta_pending));
 	list_del_init(&pstaxmitpriv->vo_q.tx_pending);
 
-	dequeue_xmitframes_to_sleeping_queue(padapter, psta, &pstaxmitpriv->vi_q.sta_pending);
+	dequeue_xmitframes_to_sleeping_queue(padapter, psta, get_list_head(&pstaxmitpriv->vi_q.sta_pending));
 	list_del_init(&pstaxmitpriv->vi_q.tx_pending);
 
-	dequeue_xmitframes_to_sleeping_queue(padapter, psta, &pstaxmitpriv->be_q.sta_pending);
+	dequeue_xmitframes_to_sleeping_queue(padapter, psta, get_list_head(&pstaxmitpriv->be_q.sta_pending));
 	list_del_init(&pstaxmitpriv->be_q.tx_pending);
 
-	dequeue_xmitframes_to_sleeping_queue(padapter, psta, &pstaxmitpriv->bk_q.sta_pending);
+	dequeue_xmitframes_to_sleeping_queue(padapter, psta, get_list_head(&pstaxmitpriv->bk_q.sta_pending));
 	list_del_init(&pstaxmitpriv->bk_q.tx_pending);
 
 	/* for BC/MC Frames */
 	pstaxmitpriv = &psta_bmc->sta_xmitpriv;
-	dequeue_xmitframes_to_sleeping_queue(padapter, psta_bmc, &pstaxmitpriv->be_q.sta_pending);
+	dequeue_xmitframes_to_sleeping_queue(padapter, psta_bmc, get_list_head(&pstaxmitpriv->be_q.sta_pending));
 	list_del_init(&pstaxmitpriv->be_q.tx_pending);
 
 	spin_unlock_bh(&pxmitpriv->lock);
-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/9] staging: r8188eu: change another function param from __queue to list_head
  2023-01-30 19:52 [PATCH 0/9] staging: r8188eu: another round of xmit cleanups Martin Kaiser
  2023-01-30 19:52 ` [PATCH 1/9] staging: r8188eu: rtw_free_xmitframe_queue needs no spinlock Martin Kaiser
  2023-01-30 19:52 ` [PATCH 2/9] staging: r8188eu: change function param from __queue to list_head Martin Kaiser
@ 2023-01-30 19:52 ` Martin Kaiser
  2023-01-30 19:52 ` [PATCH 4/9] staging: r8188eu: make sta_pending a list_head Martin Kaiser
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2023-01-30 19:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Modify the rtw_free_xmitframe_queue function to take a list_head pointer
instead of a __queue pointer.

This is an intermediate step towards changing struct tx_servq's
sta_pending from __queue to list_head.

Now that the function takes a list instead of a queue, we should also
rename it to rtw_free_xmitframe_list.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_sta_mgt.c | 10 +++++-----
 drivers/staging/r8188eu/core/rtw_xmit.c    |  9 ++++-----
 drivers/staging/r8188eu/include/rtw_xmit.h |  3 +--
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_sta_mgt.c b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
index b4aee8623099..49a92725c5ed 100644
--- a/drivers/staging/r8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
@@ -260,22 +260,22 @@ void rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
 
 	spin_lock_bh(&pxmitpriv->lock);
 
-	rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q);
+	rtw_free_xmitframe_list(pxmitpriv, get_list_head(&psta->sleep_q));
 	psta->sleepq_len = 0;
 
-	rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vo_q.sta_pending);
+	rtw_free_xmitframe_list(pxmitpriv, get_list_head(&pstaxmitpriv->vo_q.sta_pending));
 
 	list_del_init(&pstaxmitpriv->vo_q.tx_pending);
 
-	rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vi_q.sta_pending);
+	rtw_free_xmitframe_list(pxmitpriv, get_list_head(&pstaxmitpriv->vi_q.sta_pending));
 
 	list_del_init(&pstaxmitpriv->vi_q.tx_pending);
 
-	rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->bk_q.sta_pending);
+	rtw_free_xmitframe_list(pxmitpriv, get_list_head(&pstaxmitpriv->bk_q.sta_pending));
 
 	list_del_init(&pstaxmitpriv->bk_q.tx_pending);
 
-	rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->be_q.sta_pending);
+	rtw_free_xmitframe_list(pxmitpriv, get_list_head(&pstaxmitpriv->be_q.sta_pending));
 
 	list_del_init(&pstaxmitpriv->be_q.tx_pending);
 
diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 3117db41d749..d272166a99ec 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1325,15 +1325,14 @@ s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitfram
 	return _SUCCESS;
 }
 
-void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, struct __queue *pframequeue)
+void rtw_free_xmitframe_list(struct xmit_priv *pxmitpriv, struct list_head *xframe_list)
 {
-	struct list_head *plist, *phead;
+	struct list_head *plist;
 	struct	xmit_frame	*pxmitframe;
 
-	phead = get_list_head(pframequeue);
-	plist = phead->next;
+	plist = xframe_list->next;
 
-	while (phead != plist) {
+	while (xframe_list != plist) {
 		pxmitframe = container_of(plist, struct xmit_frame, list);
 
 		plist = plist->next;
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index d8808e68f778..8557b311e809 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -309,8 +309,7 @@ s32 rtw_put_snap(u8 *data, u16 h_proto);
 struct xmit_frame *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv);
 s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv,
 		       struct xmit_frame *pxmitframe);
-void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv,
-			      struct __queue *pframequeue);
+void rtw_free_xmitframe_list(struct xmit_priv *pxmitpriv, struct list_head *xframe_list);
 struct tx_servq *rtw_get_sta_pending(struct adapter *padapter,
 				     struct sta_info *psta, int up, u8 *ac);
 struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv,
-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 4/9] staging: r8188eu: make sta_pending a list_head
  2023-01-30 19:52 [PATCH 0/9] staging: r8188eu: another round of xmit cleanups Martin Kaiser
                   ` (2 preceding siblings ...)
  2023-01-30 19:52 ` [PATCH 3/9] staging: r8188eu: change another " Martin Kaiser
@ 2023-01-30 19:52 ` Martin Kaiser
  2023-01-30 19:52 ` [PATCH 5/9] staging: r8188eu: use kernel helper to iterate over a list Martin Kaiser
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2023-01-30 19:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

We can now change sta_pending in struct tx_servq from __queue to
list_head. The driver defines __queue as list_head + spinlock, the
spinlock is not used for sta_pending.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_sta_mgt.c   |  8 ++++----
 drivers/staging/r8188eu/core/rtw_xmit.c      | 16 ++++++++--------
 drivers/staging/r8188eu/hal/rtl8188eu_xmit.c |  4 ++--
 drivers/staging/r8188eu/include/rtw_xmit.h   |  2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_sta_mgt.c b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
index 49a92725c5ed..a9c29b2bf230 100644
--- a/drivers/staging/r8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
@@ -263,19 +263,19 @@ void rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
 	rtw_free_xmitframe_list(pxmitpriv, get_list_head(&psta->sleep_q));
 	psta->sleepq_len = 0;
 
-	rtw_free_xmitframe_list(pxmitpriv, get_list_head(&pstaxmitpriv->vo_q.sta_pending));
+	rtw_free_xmitframe_list(pxmitpriv, &pstaxmitpriv->vo_q.sta_pending);
 
 	list_del_init(&pstaxmitpriv->vo_q.tx_pending);
 
-	rtw_free_xmitframe_list(pxmitpriv, get_list_head(&pstaxmitpriv->vi_q.sta_pending));
+	rtw_free_xmitframe_list(pxmitpriv, &pstaxmitpriv->vi_q.sta_pending);
 
 	list_del_init(&pstaxmitpriv->vi_q.tx_pending);
 
-	rtw_free_xmitframe_list(pxmitpriv, get_list_head(&pstaxmitpriv->bk_q.sta_pending));
+	rtw_free_xmitframe_list(pxmitpriv, &pstaxmitpriv->bk_q.sta_pending);
 
 	list_del_init(&pstaxmitpriv->bk_q.tx_pending);
 
-	rtw_free_xmitframe_list(pxmitpriv, get_list_head(&pstaxmitpriv->be_q.sta_pending));
+	rtw_free_xmitframe_list(pxmitpriv, &pstaxmitpriv->be_q.sta_pending);
 
 	list_del_init(&pstaxmitpriv->be_q.tx_pending);
 
diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index d272166a99ec..24cf11e7b4bc 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -17,7 +17,7 @@ static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
 static void _init_txservq(struct tx_servq *ptxservq)
 {
 	INIT_LIST_HEAD(&ptxservq->tx_pending);
-	rtw_init_queue(&ptxservq->sta_pending);
+	INIT_LIST_HEAD(&ptxservq->sta_pending);
 	ptxservq->qcnt = 0;
 }
 
@@ -1361,7 +1361,7 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi
 	for (i = 0; i < HWXMIT_ENTRY; i++) {
 		phwxmit = phwxmit_i + inx[i];
 		list_for_each_entry_safe(ptxservq, tmp_txservq, phwxmit->sta_list, tx_pending) {
-			xframe_list = get_list_head(&ptxservq->sta_pending);
+			xframe_list = &ptxservq->sta_pending;
 			if (list_empty(xframe_list))
 				continue;
 
@@ -1444,7 +1444,7 @@ s32 rtw_xmit_classifier(struct adapter *padapter, struct xmit_frame *pxmitframe)
 	if (list_empty(&ptxservq->tx_pending))
 		list_add_tail(&ptxservq->tx_pending, phwxmits[ac_index].sta_list);
 
-	list_add_tail(&pxmitframe->list, get_list_head(&ptxservq->sta_pending));
+	list_add_tail(&pxmitframe->list, &ptxservq->sta_pending);
 	ptxservq->qcnt++;
 	phwxmits[ac_index].accnt++;
 exit:
@@ -1832,21 +1832,21 @@ void stop_sta_xmit(struct adapter *padapter, struct sta_info *psta)
 
 	pstapriv->sta_dz_bitmap |= BIT(psta->aid);
 
-	dequeue_xmitframes_to_sleeping_queue(padapter, psta, get_list_head(&pstaxmitpriv->vo_q.sta_pending));
+	dequeue_xmitframes_to_sleeping_queue(padapter, psta, &pstaxmitpriv->vo_q.sta_pending);
 	list_del_init(&pstaxmitpriv->vo_q.tx_pending);
 
-	dequeue_xmitframes_to_sleeping_queue(padapter, psta, get_list_head(&pstaxmitpriv->vi_q.sta_pending));
+	dequeue_xmitframes_to_sleeping_queue(padapter, psta, &pstaxmitpriv->vi_q.sta_pending);
 	list_del_init(&pstaxmitpriv->vi_q.tx_pending);
 
-	dequeue_xmitframes_to_sleeping_queue(padapter, psta, get_list_head(&pstaxmitpriv->be_q.sta_pending));
+	dequeue_xmitframes_to_sleeping_queue(padapter, psta, &pstaxmitpriv->be_q.sta_pending);
 	list_del_init(&pstaxmitpriv->be_q.tx_pending);
 
-	dequeue_xmitframes_to_sleeping_queue(padapter, psta, get_list_head(&pstaxmitpriv->bk_q.sta_pending));
+	dequeue_xmitframes_to_sleeping_queue(padapter, psta, &pstaxmitpriv->bk_q.sta_pending);
 	list_del_init(&pstaxmitpriv->bk_q.tx_pending);
 
 	/* for BC/MC Frames */
 	pstaxmitpriv = &psta_bmc->sta_xmitpriv;
-	dequeue_xmitframes_to_sleeping_queue(padapter, psta_bmc, get_list_head(&pstaxmitpriv->be_q.sta_pending));
+	dequeue_xmitframes_to_sleeping_queue(padapter, psta_bmc, &pstaxmitpriv->be_q.sta_pending);
 	list_del_init(&pstaxmitpriv->be_q.tx_pending);
 
 	spin_unlock_bh(&pxmitpriv->lock);
diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
index 18557738dbad..5aa33fc4041d 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
@@ -461,7 +461,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt)
 	}
 	spin_lock_bh(&pxmitpriv->lock);
 
-	xmitframe_phead = get_list_head(&ptxservq->sta_pending);
+	xmitframe_phead = &ptxservq->sta_pending;
 	xmitframe_plist = xmitframe_phead->next;
 
 	while (xmitframe_phead != xmitframe_plist) {
@@ -512,7 +512,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt)
 		}
 	} /* end while (aggregate same priority and same DA(AP or STA) frames) */
 
-	if (list_empty(&ptxservq->sta_pending.queue))
+	if (list_empty(&ptxservq->sta_pending))
 		list_del_init(&ptxservq->tx_pending);
 
 	spin_unlock_bh(&pxmitpriv->lock);
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index 8557b311e809..dfdc1c57d5d4 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -221,7 +221,7 @@ struct xmit_frame {
 
 struct tx_servq {
 	struct list_head tx_pending;
-	struct __queue sta_pending;
+	struct list_head sta_pending;
 	int qcnt;
 };
 
-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 5/9] staging: r8188eu: use kernel helper to iterate over a list
  2023-01-30 19:52 [PATCH 0/9] staging: r8188eu: another round of xmit cleanups Martin Kaiser
                   ` (3 preceding siblings ...)
  2023-01-30 19:52 ` [PATCH 4/9] staging: r8188eu: make sta_pending a list_head Martin Kaiser
@ 2023-01-30 19:52 ` Martin Kaiser
  2023-01-30 19:53 ` [PATCH 6/9] staging: r8188eu: legacy_dz is initialised but never used Martin Kaiser
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2023-01-30 19:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

rtw_free_xmitframe_list iterates over the list of xmit_frames and frees
each entry. We can use list_for_each_entry_safe instead of coding this
manually. We need the _safe version as the current pxmitframe will be
removed from the list by rtw_free_xmitframe.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_xmit.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 24cf11e7b4bc..c2b1e6f1d358 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -1327,18 +1327,10 @@ s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitfram
 
 void rtw_free_xmitframe_list(struct xmit_priv *pxmitpriv, struct list_head *xframe_list)
 {
-	struct list_head *plist;
-	struct	xmit_frame	*pxmitframe;
-
-	plist = xframe_list->next;
-
-	while (xframe_list != plist) {
-		pxmitframe = container_of(plist, struct xmit_frame, list);
-
-		plist = plist->next;
+	struct	xmit_frame *pxmitframe, *tmp_xmitframe;
 
+	list_for_each_entry_safe(pxmitframe, tmp_xmitframe, xframe_list, list)
 		rtw_free_xmitframe(pxmitpriv, pxmitframe);
-	}
 }
 
 struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i)
-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 6/9] staging: r8188eu: legacy_dz is initialised but never used
  2023-01-30 19:52 [PATCH 0/9] staging: r8188eu: another round of xmit cleanups Martin Kaiser
                   ` (4 preceding siblings ...)
  2023-01-30 19:52 ` [PATCH 5/9] staging: r8188eu: use kernel helper to iterate over a list Martin Kaiser
@ 2023-01-30 19:53 ` Martin Kaiser
  2023-01-30 19:53 ` [PATCH 7/9] staging: r8188eu: apsd " Martin Kaiser
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2023-01-30 19:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

legacy_dz in struct sta_xmit_priv is initialised but not used. It can be
removed.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_xmit.c    | 1 -
 drivers/staging/r8188eu/include/rtw_xmit.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index c2b1e6f1d358..797e24b852b1 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -29,7 +29,6 @@ void	_rtw_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv)
 	_init_txservq(&psta_xmitpriv->bk_q);
 	_init_txservq(&psta_xmitpriv->vi_q);
 	_init_txservq(&psta_xmitpriv->vo_q);
-	INIT_LIST_HEAD(&psta_xmitpriv->legacy_dz);
 	INIT_LIST_HEAD(&psta_xmitpriv->apsd);
 }
 
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index dfdc1c57d5d4..8566e731514c 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -232,7 +232,6 @@ struct sta_xmit_priv {
 	struct tx_servq	bk_q;			/* priority == 1,2 */
 	struct tx_servq	vi_q;			/* priority == 4,5 */
 	struct tx_servq	vo_q;			/* priority == 6,7 */
-	struct list_head legacy_dz;
 	struct list_head apsd;
 	u16 txseq_tid[16];
 };
-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 7/9] staging: r8188eu: apsd is initialised but never used
  2023-01-30 19:52 [PATCH 0/9] staging: r8188eu: another round of xmit cleanups Martin Kaiser
                   ` (5 preceding siblings ...)
  2023-01-30 19:53 ` [PATCH 6/9] staging: r8188eu: legacy_dz is initialised but never used Martin Kaiser
@ 2023-01-30 19:53 ` Martin Kaiser
  2023-01-30 19:53 ` [PATCH 8/9] staging: r8188eu: option in struct sta_xmit_priv is not used Martin Kaiser
  2023-01-30 19:53 ` [PATCH 9/9] staging: r8188eu: replace switch-case with if Martin Kaiser
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2023-01-30 19:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

apsd in struct sta_xmit_priv is initialised but not used. It can be
removed.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_xmit.c    | 1 -
 drivers/staging/r8188eu/include/rtw_xmit.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 797e24b852b1..91f92ec5ef69 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -29,7 +29,6 @@ void	_rtw_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv)
 	_init_txservq(&psta_xmitpriv->bk_q);
 	_init_txservq(&psta_xmitpriv->vi_q);
 	_init_txservq(&psta_xmitpriv->vo_q);
-	INIT_LIST_HEAD(&psta_xmitpriv->apsd);
 }
 
 static int rtw_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitbuf,
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index 8566e731514c..4c508ab4c870 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -232,7 +232,6 @@ struct sta_xmit_priv {
 	struct tx_servq	bk_q;			/* priority == 1,2 */
 	struct tx_servq	vi_q;			/* priority == 4,5 */
 	struct tx_servq	vo_q;			/* priority == 6,7 */
-	struct list_head apsd;
 	u16 txseq_tid[16];
 };
 
-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 8/9] staging: r8188eu: option in struct sta_xmit_priv is not used
  2023-01-30 19:52 [PATCH 0/9] staging: r8188eu: another round of xmit cleanups Martin Kaiser
                   ` (6 preceding siblings ...)
  2023-01-30 19:53 ` [PATCH 7/9] staging: r8188eu: apsd " Martin Kaiser
@ 2023-01-30 19:53 ` Martin Kaiser
  2023-01-30 19:53 ` [PATCH 9/9] staging: r8188eu: replace switch-case with if Martin Kaiser
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2023-01-30 19:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

The option component in struct sta_xmit_priv is not used, remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/include/rtw_xmit.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index 4c508ab4c870..b332c2a86dbb 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -227,7 +227,6 @@ struct tx_servq {
 
 struct sta_xmit_priv {
 	spinlock_t lock;
-	int	option;
 	struct tx_servq	be_q;			/* priority == 0,3 */
 	struct tx_servq	bk_q;			/* priority == 1,2 */
 	struct tx_servq	vi_q;			/* priority == 4,5 */
-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 9/9] staging: r8188eu: replace switch-case with if
  2023-01-30 19:52 [PATCH 0/9] staging: r8188eu: another round of xmit cleanups Martin Kaiser
                   ` (7 preceding siblings ...)
  2023-01-30 19:53 ` [PATCH 8/9] staging: r8188eu: option in struct sta_xmit_priv is not used Martin Kaiser
@ 2023-01-30 19:53 ` Martin Kaiser
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2023-01-30 19:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Replace a switch-case in rtw_write_port with an if statement and make the
code a bit shorter.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/os_dep/usb_ops_linux.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c
index c9ee1173a1d6..48c96f731ce1 100644
--- a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c
@@ -121,14 +121,8 @@ u32 rtw_write_port(struct adapter *padapter, u32 addr, u32 cnt, u8 *wmem)
 	status = usb_submit_urb(purb, GFP_ATOMIC);
 	if (status) {
 		rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_WRITE_PORT_ERR);
-
-		switch (status) {
-		case -ENODEV:
+		if (status == -ENODEV)
 			padapter->bDriverStopped = true;
-			break;
-		default:
-			break;
-		}
 		goto exit;
 	}
 
-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-01-30 19:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30 19:52 [PATCH 0/9] staging: r8188eu: another round of xmit cleanups Martin Kaiser
2023-01-30 19:52 ` [PATCH 1/9] staging: r8188eu: rtw_free_xmitframe_queue needs no spinlock Martin Kaiser
2023-01-30 19:52 ` [PATCH 2/9] staging: r8188eu: change function param from __queue to list_head Martin Kaiser
2023-01-30 19:52 ` [PATCH 3/9] staging: r8188eu: change another " Martin Kaiser
2023-01-30 19:52 ` [PATCH 4/9] staging: r8188eu: make sta_pending a list_head Martin Kaiser
2023-01-30 19:52 ` [PATCH 5/9] staging: r8188eu: use kernel helper to iterate over a list Martin Kaiser
2023-01-30 19:53 ` [PATCH 6/9] staging: r8188eu: legacy_dz is initialised but never used Martin Kaiser
2023-01-30 19:53 ` [PATCH 7/9] staging: r8188eu: apsd " Martin Kaiser
2023-01-30 19:53 ` [PATCH 8/9] staging: r8188eu: option in struct sta_xmit_priv is not used Martin Kaiser
2023-01-30 19:53 ` [PATCH 9/9] staging: r8188eu: replace switch-case with if Martin Kaiser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®