Linux kernel staging patches
 help / color / mirror / Atom feed
* [PATCH 0/4] staging: rtl8723bs: cleanup rtw_enqueue_cmd flow
@ 2026-05-13 21:37 Hungyu Lin
  2026-05-13 21:37 ` [PATCH 1/4] staging: rtl8723bs: simplify _rtw_enqueue_cmd control flow Hungyu Lin
  0 siblings, 1 reply; 5+ messages in thread
From: Hungyu Lin @ 2026-05-13 21:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Dan Carpenter, linux-staging, linux-kernel, Hungyu Lin

This series cleans up the command enqueue path in rtw_cmd.c.

Patch 1 simplifies the control flow of _rtw_enqueue_cmd() by
removing the goto exit pattern and using direct returns.

Patch 2 limits the scope of _rtw_enqueue_cmd() by making it static
and removing its declaration from the header.

Patch 3 simplifies the control flow of rtw_enqueue_cmd() by removing
the goto exit pattern.

Patch 4 converts the private helper _rtw_enqueue_cmd() to return 0 on
success, while keeping rtw_enqueue_cmd() translating the result to
the existing legacy return convention.

No functional changes intended.

Hungyu Lin (4):
  staging: rtl8723bs: simplify _rtw_enqueue_cmd control flow
  staging: rtl8723bs: make _rtw_enqueue_cmd static
  staging: rtl8723bs: simplify rtw_enqueue_cmd control flow
  staging: rtl8723bs: make _rtw_enqueue_cmd return 0 on success

 drivers/staging/rtl8723bs/core/rtw_cmd.c      | 20 +++++++++----------
 drivers/staging/rtl8723bs/include/cmd_osdep.h |  1 -
 2 files changed, 10 insertions(+), 11 deletions(-)

-- 
2.34.1


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

* [PATCH 1/4] staging: rtl8723bs: simplify _rtw_enqueue_cmd control flow
  2026-05-13 21:37 [PATCH 0/4] staging: rtl8723bs: cleanup rtw_enqueue_cmd flow Hungyu Lin
@ 2026-05-13 21:37 ` Hungyu Lin
  2026-05-13 21:37   ` [PATCH 2/4] staging: rtl8723bs: make _rtw_enqueue_cmd static Hungyu Lin
  0 siblings, 1 reply; 5+ messages in thread
From: Hungyu Lin @ 2026-05-13 21:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Dan Carpenter, linux-staging, linux-kernel, Hungyu Lin

Replace the goto exit pattern with a direct return to simplify
the control flow and improve readability.

No functional change intended.

Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index adc151326feb..654f0aa72263 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -252,7 +252,7 @@ int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj)
 	unsigned long irqL;
 
 	if (!obj)
-		goto exit;
+		return _SUCCESS;
 
 	/* spin_lock_bh(&queue->lock); */
 	spin_lock_irqsave(&queue->lock, irqL);
@@ -262,7 +262,6 @@ int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj)
 	/* spin_unlock_bh(&queue->lock); */
 	spin_unlock_irqrestore(&queue->lock, irqL);
 
-exit:
 	return _SUCCESS;
 }
 
-- 
2.34.1


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

* [PATCH 2/4] staging: rtl8723bs: make _rtw_enqueue_cmd static
  2026-05-13 21:37 ` [PATCH 1/4] staging: rtl8723bs: simplify _rtw_enqueue_cmd control flow Hungyu Lin
@ 2026-05-13 21:37   ` Hungyu Lin
  2026-05-13 21:37     ` [PATCH 3/4] staging: rtl8723bs: simplify rtw_enqueue_cmd control flow Hungyu Lin
  0 siblings, 1 reply; 5+ messages in thread
From: Hungyu Lin @ 2026-05-13 21:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Dan Carpenter, linux-staging, linux-kernel, Hungyu Lin

The function _rtw_enqueue_cmd() is only used within rtw_cmd.c,
so make it static and remove the unnecessary declaration from
the header file.

Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c      | 2 +-
 drivers/staging/rtl8723bs/include/cmd_osdep.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 654f0aa72263..0cf80408b7ab 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -247,7 +247,7 @@ void _rtw_free_cmd_priv(struct	cmd_priv *pcmdpriv)
  *
  */
 
-int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj)
+static int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj)
 {
 	unsigned long irqL;
 
diff --git a/drivers/staging/rtl8723bs/include/cmd_osdep.h b/drivers/staging/rtl8723bs/include/cmd_osdep.h
index 41daa3c339a8..91d933d71945 100644
--- a/drivers/staging/rtl8723bs/include/cmd_osdep.h
+++ b/drivers/staging/rtl8723bs/include/cmd_osdep.h
@@ -11,7 +11,6 @@ int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv);
 int rtw_init_evt_priv(struct evt_priv *pevtpriv);
 extern void _rtw_free_evt_priv(struct	evt_priv *pevtpriv);
 extern void _rtw_free_cmd_priv(struct	cmd_priv *pcmdpriv);
-int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj);
 extern struct	cmd_obj	*_rtw_dequeue_cmd(struct __queue *queue);
 
 #endif
-- 
2.34.1


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

* [PATCH 3/4] staging: rtl8723bs: simplify rtw_enqueue_cmd control flow
  2026-05-13 21:37   ` [PATCH 2/4] staging: rtl8723bs: make _rtw_enqueue_cmd static Hungyu Lin
@ 2026-05-13 21:37     ` Hungyu Lin
  2026-05-13 21:37       ` [PATCH 4/4] staging: rtl8723bs: make _rtw_enqueue_cmd return 0 on success Hungyu Lin
  0 siblings, 1 reply; 5+ messages in thread
From: Hungyu Lin @ 2026-05-13 21:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Dan Carpenter, linux-staging, linux-kernel, Hungyu Lin

Replace the goto exit pattern with direct returns to simplify
the control flow and improve readability.

No functional change intended.

Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 0cf80408b7ab..b0596b52a9fd 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -312,18 +312,18 @@ int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
 
 int rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
 {
-	int res = _FAIL;
+	int res;
 	struct adapter *padapter = pcmdpriv->padapter;
 
 	if (!cmd_obj)
-		goto exit;
+		return _FAIL;
 
 	cmd_obj->padapter = padapter;
 
 	res = rtw_cmd_filter(pcmdpriv, cmd_obj);
 	if (res == _FAIL) {
 		rtw_free_cmd_obj(cmd_obj);
-		goto exit;
+		return _FAIL;
 	}
 
 	res = _rtw_enqueue_cmd(&pcmdpriv->cmd_queue, cmd_obj);
@@ -331,7 +331,6 @@ int rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
 	if (res == _SUCCESS)
 		complete(&pcmdpriv->cmd_queue_comp);
 
-exit:
 	return res;
 }
 
-- 
2.34.1


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

* [PATCH 4/4] staging: rtl8723bs: make _rtw_enqueue_cmd return 0 on success
  2026-05-13 21:37     ` [PATCH 3/4] staging: rtl8723bs: simplify rtw_enqueue_cmd control flow Hungyu Lin
@ 2026-05-13 21:37       ` Hungyu Lin
  0 siblings, 0 replies; 5+ messages in thread
From: Hungyu Lin @ 2026-05-13 21:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Dan Carpenter, linux-staging, linux-kernel, Hungyu Lin

Convert the private helper _rtw_enqueue_cmd() to return 0 on
success instead of the legacy _SUCCESS value.

Keep rtw_enqueue_cmd() translating the result back to the
existing return convention for now.

No functional change intended.

Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index b0596b52a9fd..4205f24a5a06 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -252,7 +252,7 @@ static int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj)
 	unsigned long irqL;
 
 	if (!obj)
-		return _SUCCESS;
+		return 0;
 
 	/* spin_lock_bh(&queue->lock); */
 	spin_lock_irqsave(&queue->lock, irqL);
@@ -262,7 +262,7 @@ static int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj)
 	/* spin_unlock_bh(&queue->lock); */
 	spin_unlock_irqrestore(&queue->lock, irqL);
 
-	return _SUCCESS;
+	return 0;
 }
 
 struct	cmd_obj	*_rtw_dequeue_cmd(struct __queue *queue)
@@ -328,10 +328,12 @@ int rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
 
 	res = _rtw_enqueue_cmd(&pcmdpriv->cmd_queue, cmd_obj);
 
-	if (res == _SUCCESS)
+	if (res == 0) {
 		complete(&pcmdpriv->cmd_queue_comp);
+		return _SUCCESS;
+	}
 
-	return res;
+	return _FAIL;
 }
 
 struct	cmd_obj	*rtw_dequeue_cmd(struct cmd_priv *pcmdpriv)
-- 
2.34.1


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

end of thread, other threads:[~2026-05-13 21:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-13 21:37 [PATCH 0/4] staging: rtl8723bs: cleanup rtw_enqueue_cmd flow Hungyu Lin
2026-05-13 21:37 ` [PATCH 1/4] staging: rtl8723bs: simplify _rtw_enqueue_cmd control flow Hungyu Lin
2026-05-13 21:37   ` [PATCH 2/4] staging: rtl8723bs: make _rtw_enqueue_cmd static Hungyu Lin
2026-05-13 21:37     ` [PATCH 3/4] staging: rtl8723bs: simplify rtw_enqueue_cmd control flow Hungyu Lin
2026-05-13 21:37       ` [PATCH 4/4] staging: rtl8723bs: make _rtw_enqueue_cmd return 0 on success Hungyu Lin

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