Commit 0f89054a authored by Binoy Jayan's avatar Binoy Jayan Committed by Greg Kroah-Hartman

rtl8712: Replace semaphore cmd_queue_sema with completion

The semaphore 'cmd_queue_sema' is used as completion,
so convert it to a struct completion type.
Signed-off-by: default avatarBinoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Tested-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 38bee763
...@@ -243,7 +243,7 @@ static u32 start_drv_threads(struct _adapter *padapter) ...@@ -243,7 +243,7 @@ static u32 start_drv_threads(struct _adapter *padapter)
void r8712_stop_drv_threads(struct _adapter *padapter) void r8712_stop_drv_threads(struct _adapter *padapter)
{ {
/*Below is to terminate r8712_cmd_thread & event_thread...*/ /*Below is to terminate r8712_cmd_thread & event_thread...*/
up(&padapter->cmdpriv.cmd_queue_sema); complete(&padapter->cmdpriv.cmd_queue_comp);
if (padapter->cmdThread) if (padapter->cmdThread)
_down_sema(&padapter->cmdpriv.terminate_cmdthread_sema); _down_sema(&padapter->cmdpriv.terminate_cmdthread_sema);
padapter->cmdpriv.cmd_seq = 1; padapter->cmdpriv.cmd_seq = 1;
......
...@@ -322,7 +322,7 @@ int r8712_cmd_thread(void *context) ...@@ -322,7 +322,7 @@ int r8712_cmd_thread(void *context)
allow_signal(SIGTERM); allow_signal(SIGTERM);
while (1) { while (1) {
if ((_down_sema(&(pcmdpriv->cmd_queue_sema))) == _FAIL) if (wait_for_completion_interruptible(&pcmdpriv->cmd_queue_comp))
break; break;
if (padapter->bDriverStopped || padapter->bSurpriseRemoved) if (padapter->bDriverStopped || padapter->bSurpriseRemoved)
break; break;
......
...@@ -57,7 +57,7 @@ No irqsave is necessary. ...@@ -57,7 +57,7 @@ No irqsave is necessary.
static sint _init_cmd_priv(struct cmd_priv *pcmdpriv) static sint _init_cmd_priv(struct cmd_priv *pcmdpriv)
{ {
sema_init(&(pcmdpriv->cmd_queue_sema), 0); init_completion(&pcmdpriv->cmd_queue_comp);
sema_init(&(pcmdpriv->terminate_cmdthread_sema), 0); sema_init(&(pcmdpriv->terminate_cmdthread_sema), 0);
_init_queue(&(pcmdpriv->cmd_queue)); _init_queue(&(pcmdpriv->cmd_queue));
...@@ -172,7 +172,7 @@ u32 r8712_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj) ...@@ -172,7 +172,7 @@ u32 r8712_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj)
if (pcmdpriv->padapter->eeprompriv.bautoload_fail_flag) if (pcmdpriv->padapter->eeprompriv.bautoload_fail_flag)
return _FAIL; return _FAIL;
res = _enqueue_cmd(&pcmdpriv->cmd_queue, obj); res = _enqueue_cmd(&pcmdpriv->cmd_queue, obj);
up(&pcmdpriv->cmd_queue_sema); complete(&pcmdpriv->cmd_queue_comp);
return res; return res;
} }
...@@ -189,7 +189,7 @@ u32 r8712_enqueue_cmd_ex(struct cmd_priv *pcmdpriv, struct cmd_obj *obj) ...@@ -189,7 +189,7 @@ u32 r8712_enqueue_cmd_ex(struct cmd_priv *pcmdpriv, struct cmd_obj *obj)
spin_lock_irqsave(&queue->lock, irqL); spin_lock_irqsave(&queue->lock, irqL);
list_add_tail(&obj->list, &queue->queue); list_add_tail(&obj->list, &queue->queue);
spin_unlock_irqrestore(&queue->lock, irqL); spin_unlock_irqrestore(&queue->lock, irqL);
up(&pcmdpriv->cmd_queue_sema); complete(&pcmdpriv->cmd_queue_comp);
return _SUCCESS; return _SUCCESS;
} }
......
...@@ -50,7 +50,7 @@ struct cmd_obj { ...@@ -50,7 +50,7 @@ struct cmd_obj {
}; };
struct cmd_priv { struct cmd_priv {
struct semaphore cmd_queue_sema; struct completion cmd_queue_comp;
struct semaphore terminate_cmdthread_sema; struct semaphore terminate_cmdthread_sema;
struct __queue cmd_queue; struct __queue cmd_queue;
u8 cmd_seq; u8 cmd_seq;
......
...@@ -107,7 +107,7 @@ void r8712_cpwm_int_hdl(struct _adapter *padapter, ...@@ -107,7 +107,7 @@ void r8712_cpwm_int_hdl(struct _adapter *padapter,
pwrpriv->cpwm = (preportpwrstate->state) & 0xf; pwrpriv->cpwm = (preportpwrstate->state) & 0xf;
if (pwrpriv->cpwm >= PS_STATE_S2) { if (pwrpriv->cpwm >= PS_STATE_S2) {
if (pwrpriv->alives & CMD_ALIVE) if (pwrpriv->alives & CMD_ALIVE)
up(&(pcmdpriv->cmd_queue_sema)); complete(&(pcmdpriv->cmd_queue_comp));
} }
pwrpriv->cpwm_tog = (preportpwrstate->state) & 0x80; pwrpriv->cpwm_tog = (preportpwrstate->state) & 0x80;
up(&pwrpriv->lock); up(&pwrpriv->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment