summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8188eu
diff options
context:
space:
mode:
authorMartin Kaiser <martin@kaiser.cx>2021-04-08 22:56:01 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-09 17:17:24 +0300
commite28a09fc0b9d25cd3dbf662f5aed9e59892899da (patch)
tree7b144a87c343cff58c59787b8d98a10314210042 /drivers/staging/rtl8188eu
parent92d056d6cb023184312837116f65887407defbfe (diff)
downloadlinux-e28a09fc0b9d25cd3dbf662f5aed9e59892899da.tar.xz
staging: rtl8188eu: simplify rtw_cmd_thread's main loop
In rtw_cmd_thread's main loop, we wait until there's a command in the queue. To skip this wait statement in subsequent iterations, the driver uses a label and goto instead of the actual loop. We only get back to the initial wait if the queue is empty when we read it. Basically, all we want to do is check if there's a command in the queue. If yes, we process it. If not, we wait until someone enqueues a command. Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20210408195601.4762-12-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8188eu')
-rw-r--r--drivers/staging/rtl8188eu/core/rtw_cmd.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 9d358dce5296..6728391d39e3 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -188,10 +188,6 @@ int rtw_cmd_thread(void *context)
("start r871x %s !!!!\n", __func__));
while (1) {
- if (wait_for_completion_interruptible(&pcmdpriv->cmd_queue_comp))
- break;
-
-_next:
if (padapter->bDriverStopped ||
padapter->bSurpriseRemoved) {
DBG_88E("%s: DriverStopped(%d) SurpriseRemoved(%d) break at line %d\n",
@@ -201,8 +197,13 @@ _next:
}
pcmd = rtw_dequeue_cmd(&pcmdpriv->cmd_queue);
- if (!pcmd)
+ if (!pcmd) {
+ /* The queue is empty. Wait until someone enqueues a command. */
+ if (wait_for_completion_interruptible(&pcmdpriv->cmd_queue_comp))
+ break;
+
continue;
+ }
if (rtw_cmd_filter(pcmdpriv, pcmd) == _FAIL) {
pcmd->res = H2C_DROPPED;
@@ -239,8 +240,6 @@ _next:
if (signal_pending(current))
flush_signals(current);
-
- goto _next;
}
pcmdpriv->cmdthd_running = false;