mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* staging/wilc1000: wrong conversion to completion?
@ 2016-07-11  7:41 Jiri Slaby
  2016-07-11  8:08 ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2016-07-11  7:41 UTC (permalink / raw)
  To: Binoy Jayan; +Cc: Arnd Bergmann, Greg Kroah-Hartman, Linux kernel mailing list

Hi,

while looking at this commit:

commit b27a6d5e636ac80b223a18ca2b3c892f1caef9e3
Author: Binoy Jayan <binoy.jayan@linaro.org>
Date:   Wed Jun 15 11:00:34 2016 +0530

    staging: wilc1000: Replace semaphore txq_event with completion

    The semaphore 'txq_event' is used as completion, so convert it
    to a struct completion type.

    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>

diff --git a/drivers/staging/wilc1000/linux_wlan.c
b/drivers/staging/wilc1000/linux_wlan.c
index 274c390d17cd..baf932681362 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -316,7 +316,7 @@ static int linux_wlan_txq_task(void *vp)

        complete(&wl->txq_thread_started);
        while (1) {
-               down(&wl->txq_event);
+               wait_for_completion(&wl->txq_event);

                if (wl->close) {
                        complete(&wl->txq_thread_started);
@@ -650,7 +650,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
                        mutex_unlock(&wl->hif_cs);
                }
                if (&wl->txq_event)
-                       up(&wl->txq_event);
+                       wait_for_completion(&wl->txq_event);


I wonder: is this correct? Should that be complete() instead?









                wlan_deinitialize_threads(dev);
                deinit_irq(dev);
@@ -681,7 +681,7 @@ static int wlan_init_locks(struct net_device *dev)
        spin_lock_init(&wl->txq_spinlock);
        sema_init(&wl->txq_add_to_head_cs, 1);

-       sema_init(&wl->txq_event, 0);
+       init_completion(&wl->txq_event);

        sema_init(&wl->cfg_event, 0);
        sema_init(&wl->sync_event, 0);
@@ -738,7 +738,7 @@ static void wlan_deinitialize_threads(struct
net_device *dev)
        wl->close = 1;

        if (&wl->txq_event)
-               up(&wl->txq_event);
+               complete(&wl->txq_event);

        if (wl->txq_thread) {
                kthread_stop(wl->txq_thread);

thanks,
-- 
js
suse labs

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

* Re: staging/wilc1000: wrong conversion to completion?
  2016-07-11  7:41 staging/wilc1000: wrong conversion to completion? Jiri Slaby
@ 2016-07-11  8:08 ` Arnd Bergmann
  2016-07-20  4:36   ` Binoy Jayan
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2016-07-11  8:08 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Binoy Jayan, Greg Kroah-Hartman, Linux kernel mailing list

On Monday, July 11, 2016 9:41:15 AM CEST Jiri Slaby wrote:
> Hi,
> 
> while looking at this commit:
> 
> commit b27a6d5e636ac80b223a18ca2b3c892f1caef9e3
> Author: Binoy Jayan <binoy.jayan@linaro.org>
> Date:   Wed Jun 15 11:00:34 2016 +0530
> 
>     staging: wilc1000: Replace semaphore txq_event with completion
> 
>     The semaphore 'txq_event' is used as completion, so convert it
>     to a struct completion type.
> 
>     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>
> 
> diff --git a/drivers/staging/wilc1000/linux_wlan.c
> b/drivers/staging/wilc1000/linux_wlan.c
> index 274c390d17cd..baf932681362 100644
> --- a/drivers/staging/wilc1000/linux_wlan.c
> +++ b/drivers/staging/wilc1000/linux_wlan.c
> @@ -316,7 +316,7 @@ static int linux_wlan_txq_task(void *vp)
> 
>         complete(&wl->txq_thread_started);
>         while (1) {
> -               down(&wl->txq_event);
> +               wait_for_completion(&wl->txq_event);
> 
>                 if (wl->close) {
>                         complete(&wl->txq_thread_started);
> @@ -650,7 +650,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
>                         mutex_unlock(&wl->hif_cs);
>                 }
>                 if (&wl->txq_event)
> -                       up(&wl->txq_event);
> +                       wait_for_completion(&wl->txq_event);
> 
> 
> I wonder: is this correct? Should that be complete() instead?
> 

Yes, I agree, sorry for missing that in my review.

	Arnd

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

* Re: staging/wilc1000: wrong conversion to completion?
  2016-07-11  8:08 ` Arnd Bergmann
@ 2016-07-20  4:36   ` Binoy Jayan
  0 siblings, 0 replies; 3+ messages in thread
From: Binoy Jayan @ 2016-07-20  4:36 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Jiri Slaby, Greg Kroah-Hartman, Linux kernel mailing list

On 11 July 2016 at 13:38, Arnd Bergmann <arnd@arndb.de> wrote:
> On Monday, July 11, 2016 9:41:15 AM CEST Jiri Slaby wrote:
>> Hi,
>>
>> while looking at this commit:
>>
>> commit b27a6d5e636ac80b223a18ca2b3c892f1caef9e3
>> Author: Binoy Jayan <binoy.jayan@linaro.org>
>> Date:   Wed Jun 15 11:00:34 2016 +0530
>>
>>     staging: wilc1000: Replace semaphore txq_event with completion
>>
>>     The semaphore 'txq_event' is used as completion, so convert it
>>     to a struct completion type.
>>
>>     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>
>>
>> diff --git a/drivers/staging/wilc1000/linux_wlan.c
>> b/drivers/staging/wilc1000/linux_wlan.c
>> index 274c390d17cd..baf932681362 100644
>> --- a/drivers/staging/wilc1000/linux_wlan.c
>> +++ b/drivers/staging/wilc1000/linux_wlan.c
>> @@ -316,7 +316,7 @@ static int linux_wlan_txq_task(void *vp)
>>
>>         complete(&wl->txq_thread_started);
>>         while (1) {
>> -               down(&wl->txq_event);
>> +               wait_for_completion(&wl->txq_event);
>>
>>                 if (wl->close) {
>>                         complete(&wl->txq_thread_started);
>> @@ -650,7 +650,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
>>                         mutex_unlock(&wl->hif_cs);
>>                 }
>>                 if (&wl->txq_event)
>> -                       up(&wl->txq_event);
>> +                       wait_for_completion(&wl->txq_event);
>>
>>
>> I wonder: is this correct? Should that be complete() instead?
>>
>
> Yes, I agree, sorry for missing that in my review.
>
>         Arnd

Sorry for the typo. Just saw the email after coming back from
vacation. Will send the patch soon.

Binoy

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

end of thread, other threads:[~2016-07-20  4:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-11  7:41 staging/wilc1000: wrong conversion to completion? Jiri Slaby
2016-07-11  8:08 ` Arnd Bergmann
2016-07-20  4:36   ` Binoy Jayan

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®