rtl8188eu: Replace semaphore cmd_queue_sema with completion
authorBinoy Jayan <binoy.jayan@linaro.org>
Mon, 6 Jun 2016 04:38:04 +0000 (10:08 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2016 16:14:51 +0000 (18:14 +0200)
The semaphore 'cmd_queue_sema' is used as completion,
so convert it to struct completion.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/core/rtw_cmd.c
drivers/staging/rtl8188eu/include/rtw_cmd.h
drivers/staging/rtl8188eu/os_dep/os_intfs.c

index 77485235c6155f819058ab297d8a098d4d449c98..a2937e7071cf0c4bc578b6ecdeff2d6561fad5e7 100644 (file)
@@ -27,7 +27,7 @@ No irqsave is necessary.
 
 int rtw_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);
 
        _rtw_init_queue(&(pcmdpriv->cmd_queue));
@@ -122,7 +122,7 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
        res = _rtw_enqueue_cmd(&pcmdpriv->cmd_queue, cmd_obj);
 
        if (res == _SUCCESS)
-               up(&pcmdpriv->cmd_queue_sema);
+               complete(&pcmdpriv->cmd_queue_comp);
 
 exit:
 
@@ -167,7 +167,7 @@ int rtw_cmd_thread(void *context)
        RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("start r871x rtw_cmd_thread !!!!\n"));
 
        while (1) {
-               if (_rtw_down_sema(&pcmdpriv->cmd_queue_sema) == _FAIL)
+               if (wait_for_completion_interruptible(&pcmdpriv->cmd_queue_comp))
                        break;
 
                if (padapter->bDriverStopped ||
index 08ca59217cb716bbf908e02c2a0b2d12a8c2f5e8..3532dd162fd50f9abdf2cd7f58eec9d73b453195 100644 (file)
@@ -39,7 +39,7 @@ struct cmd_obj {
 };
 
 struct cmd_priv {
-       struct semaphore cmd_queue_sema;
+       struct completion cmd_queue_comp;
        struct semaphore terminate_cmdthread_sema;
        struct __queue cmd_queue;
        u8 cmdthd_running;
index ae2caff030f16902587334969b9c2f83a9b404dc..a696d2bef6f036e19fceec580976398d0cc883f0 100644 (file)
@@ -772,7 +772,7 @@ void rtw_stop_drv_threads(struct adapter *padapter)
        RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+rtw_stop_drv_threads\n"));
 
        /* Below is to terminate rtw_cmd_thread & event_thread... */
-       up(&padapter->cmdpriv.cmd_queue_sema);
+       complete(&padapter->cmdpriv.cmd_queue_comp);
        if (padapter->cmdThread)
                _rtw_down_sema(&padapter->cmdpriv.terminate_cmdthread_sema);