From patchwork Mon Jun 13 10:37:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 69862 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1472559qgf; Mon, 13 Jun 2016 03:38:43 -0700 (PDT) X-Received: by 10.66.249.161 with SMTP id yv1mr20726632pac.39.1465814323723; Mon, 13 Jun 2016 03:38:43 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s1si17288593pan.105.2016.06.13.03.38.43; Mon, 13 Jun 2016 03:38:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161194AbcFMKiW (ORCPT + 30 others); Mon, 13 Jun 2016 06:38:22 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:33213 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965028AbcFMKiR (ORCPT ); Mon, 13 Jun 2016 06:38:17 -0400 Received: by mail-pf0-f177.google.com with SMTP id y124so45215673pfy.0 for ; Mon, 13 Jun 2016 03:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gyOmKSMkN4ptGEf3xFiUUDENTZkJzeX2d5O3GNFaCQ8=; b=h/KCJwB+OgpcPKf8Wkw4mXrA+8rL2pfHu79UtKJI2bcZSwqlw0Ol/Rd4VdARvIE930 G00VgSYFVUiAJyk2e1CPwqcDGlp1VN22HeNBFfNBYiGSKTJSFRd5tInM/b7HLEDt8qCa c/mOEsLh22xR42flJngeJdXbLkx99YbxBxoJE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gyOmKSMkN4ptGEf3xFiUUDENTZkJzeX2d5O3GNFaCQ8=; b=L3Han4y0xjiaS0stPwES8zxFGXv8Cl9W+OLbk7gvW9sTtY/Y+dZ15WsszLTHKm6OlF VhmeU5rKFfBYC6RtbpkrfPHUAByy+NJC2l5GRM7c+gVa0C9oZIr31fnY9j8DuycV5wR/ USjDYj8ZM1F/1BPG+hATyEiFUjuWuIyWCWsPkH/F3H5FNTeKq0Iskm1wDpd1q0ZhkvvE 1Iplw+hitzHHoZiVtzwhmTItMCm2V3PZ2cMXnfXRPQ+s+srueizRPYiY1cNGDIzFQNni ILfuXp8UljC4Xl6Jk4wAGQnOzg98Mm7vR1c6wKw2jzURMiimQ5iJHhhOpV2NNGVnKTwN P+VA== X-Gm-Message-State: ALyK8tJVSnZQJWGv9U6UW370j6gvhBun4Wul3VGjL6EZpVJnKGTqLsYn9/hEBhNA9o2Z9KnG X-Received: by 10.98.105.138 with SMTP id e132mr20847201pfc.59.1465814296837; Mon, 13 Jun 2016 03:38:16 -0700 (PDT) Received: from localhost.localdomain ([116.68.103.40]) by smtp.gmail.com with ESMTPSA id h6sm24194895pac.46.2016.06.13.03.38.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jun 2016 03:38:16 -0700 (PDT) From: Binoy Jayan To: Greg Kroah-Hartman Cc: Arnd Bergmann , Johnny Kim , Austin Shin , Chris Park , Tony Cho , Glen Lee , Leo Kim , devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Binoy Jayan Subject: [PATCH 3/7] staging: wilc1000: Replace semaphore cfg_event with completion Date: Mon, 13 Jun 2016 16:07:35 +0530 Message-Id: <1465814259-3009-4-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1465814259-3009-1-git-send-email-binoy.jayan@linaro.org> References: <1465814259-3009-1-git-send-email-binoy.jayan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The semaphore 'cfg_event' is used as completion, so convert it to a struct completion type. Signed-off-by: Binoy Jayan --- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- drivers/staging/wilc1000/wilc_wlan.c | 16 +++++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index a933551..81a469a 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -683,7 +683,7 @@ static int wlan_init_locks(struct net_device *dev) init_completion(&wl->txq_event); - sema_init(&wl->cfg_event, 0); + init_completion(&wl->cfg_event); sema_init(&wl->sync_event, 0); init_completion(&wl->txq_thread_started); diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 239cd43..5fbc07c 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -178,7 +178,7 @@ struct wilc { struct mutex rxq_cs; struct mutex hif_cs; - struct semaphore cfg_event; + struct completion cfg_event; struct semaphore sync_event; struct completion txq_event; struct completion txq_thread_started; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 9afbe8d..2d6eb43 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -310,7 +310,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, u8 *buffer, netdev_dbg(vif->ndev, "Adding config packet ...\n"); if (wilc->quit) { netdev_dbg(vif->ndev, "Return due to clear function\n"); - up(&wilc->cfg_event); + complete(&wilc->cfg_event); return 0; } @@ -769,7 +769,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) do { if (wilc->quit) { - up(&wilc->cfg_event); + complete(&wilc->cfg_event); break; } rqe = wilc_wlan_rxq_remove(wilc); @@ -820,7 +820,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) wilc_wlan_cfg_indicate_rx(wilc, &buffer[pkt_offset + offset], pkt_len, &rsp); if (rsp.type == WILC_CFG_RSP) { if (wilc->cfg_seq_no == rsp.seq_no) - up(&wilc->cfg_event); + complete(&wilc->cfg_event); } else if (rsp.type == WILC_CFG_RSP_STATUS) { wilc_mac_indicate(wilc, WILC_MAC_INDICATE_STATUS); @@ -1228,11 +1228,12 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer, if (wilc_wlan_cfg_commit(vif, WILC_CFG_SET, drv_handler)) ret_size = 0; - if (wilc_lock_timeout(wilc, &wilc->cfg_event, - CFG_PKTS_TIMEOUT)) { + if (!wait_for_completion_timeout(&wilc->cfg_event, + msecs_to_jiffies(CFG_PKTS_TIMEOUT))) { netdev_dbg(vif->ndev, "Set Timed Out\n"); ret_size = 0; } + wilc->cfg_frame_in_use = 0; wilc->cfg_frame_offset = 0; wilc->cfg_seq_no += 1; @@ -1246,6 +1247,7 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u16 wid, int commit, { u32 offset; int ret_size; + struct wilc *wilc = vif->wilc; if (wilc->cfg_frame_in_use) @@ -1265,8 +1267,8 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u16 wid, int commit, if (wilc_wlan_cfg_commit(vif, WILC_CFG_QUERY, drv_handler)) ret_size = 0; - if (wilc_lock_timeout(wilc, &wilc->cfg_event, - CFG_PKTS_TIMEOUT)) { + if (!wait_for_completion_timeout(&wilc->cfg_event, + msecs_to_jiffies(CFG_PKTS_TIMEOUT))) { netdev_dbg(vif->ndev, "Get Timed Out\n"); ret_size = 0; }