From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758071AbcGKHlW (ORCPT ); Mon, 11 Jul 2016 03:41:22 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36432 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751421AbcGKHlT (ORCPT ); Mon, 11 Jul 2016 03:41:19 -0400 To: Binoy Jayan Cc: Arnd Bergmann , Greg Kroah-Hartman , Linux kernel mailing list From: Jiri Slaby Subject: staging/wilc1000: wrong conversion to completion? Message-ID: Date: Mon, 11 Jul 2016 09:41:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, while looking at this commit: commit b27a6d5e636ac80b223a18ca2b3c892f1caef9e3 Author: Binoy Jayan 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 Reviewed-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman 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