From patchwork Fri Oct 23 05:28:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glen Lee X-Patchwork-Id: 7470221 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EACF69F302 for ; Fri, 23 Oct 2015 05:27:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0C767207B6 for ; Fri, 23 Oct 2015 05:27:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1148B207B4 for ; Fri, 23 Oct 2015 05:27:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751547AbbJWF1A (ORCPT ); Fri, 23 Oct 2015 01:27:00 -0400 Received: from eusmtp01.atmel.com ([212.144.249.242]:51883 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751351AbbJWF1A (ORCPT ); Fri, 23 Oct 2015 01:27:00 -0400 Received: from glen-ubuntu.corp.atmel.com (10.161.101.13) by eusmtp01.atmel.com (10.161.101.30) with Microsoft SMTP Server id 14.3.235.1; Fri, 23 Oct 2015 07:26:52 +0200 From: Glen Lee To: CC: , , , , , , , , Subject: [PATCH 11/28] staging: wilc1000: linux_wlan_txq_task: use wilc instead of g_linux_wlan Date: Fri, 23 Oct 2015 14:28:27 +0900 Message-ID: <1445578124-31486-11-git-send-email-glen.lee@atmel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445578124-31486-1-git-send-email-glen.lee@atmel.com> References: <1445578124-31486-1-git-send-email-glen.lee@atmel.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Pass argument dev instead of wilc from kthread_run and use netdev private data member wilc instead of g_linux_wlan. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/linux_wlan.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index f6862d5..9c4fecb 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -439,7 +439,9 @@ int linux_wlan_get_num_conn_ifcs(void) static int linux_wlan_txq_task(void *vp) { int ret, txq_count; - + perInterface_wlan_t *nic; + struct wilc *wl; + struct net_device *dev = vp; #if defined USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS #define TX_BACKOFF_WEIGHT_INCR_STEP (1) #define TX_BACKOFF_WEIGHT_DECR_STEP (1) @@ -449,18 +451,21 @@ static int linux_wlan_txq_task(void *vp) int backoff_weight = TX_BACKOFF_WEIGHT_MIN; #endif + nic = netdev_priv(dev); + wl = nic->wilc; + /* inform wilc1000_wlan_init that TXQ task is started. */ - up(&g_linux_wlan->txq_thread_started); + up(&wl->txq_thread_started); while (1) { PRINT_D(TX_DBG, "txq_task Taking a nap :)\n"); - down(&g_linux_wlan->txq_event); + down(&wl->txq_event); /* wait_for_completion(&pd->txq_event); */ PRINT_D(TX_DBG, "txq_task Who waked me up :$\n"); - if (g_linux_wlan->close) { + if (wl->close) { /*Unlock the mutex in the mac_close function to indicate the exiting of the TX thread */ - up(&g_linux_wlan->txq_thread_started); + up(&wl->txq_thread_started); while (!kthread_should_stop()) schedule(); @@ -477,10 +482,10 @@ static int linux_wlan_txq_task(void *vp) if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD /* && netif_queue_stopped(pd->wilc_netdev)*/) { PRINT_D(TX_DBG, "Waking up queue\n"); /* netif_wake_queue(pd->wilc_netdev); */ - if (netif_queue_stopped(g_linux_wlan->vif[0].ndev)) - netif_wake_queue(g_linux_wlan->vif[0].ndev); - if (netif_queue_stopped(g_linux_wlan->vif[1].ndev)) - netif_wake_queue(g_linux_wlan->vif[1].ndev); + if (netif_queue_stopped(wl->vif[0].ndev)) + netif_wake_queue(wl->vif[0].ndev); + if (netif_queue_stopped(wl->vif[1].ndev)) + netif_wake_queue(wl->vif[1].ndev); } if (ret == WILC_TX_ERR_NO_BUF) { /* failed to allocate buffers in chip. */ @@ -502,7 +507,7 @@ static int linux_wlan_txq_task(void *vp) } } /*TODO: drop packets after a certain time/number of retry count. */ - } while (ret == WILC_TX_ERR_NO_BUF && !g_linux_wlan->close); /* retry sending packets if no more buffers in chip. */ + } while (ret == WILC_TX_ERR_NO_BUF && !wl->close); /* retry sending packets if no more buffers in chip. */ #endif } return 0; @@ -1023,7 +1028,7 @@ int wlan_initialize_threads(struct net_device *dev) /* create tx task */ PRINT_D(INIT_DBG, "Creating kthread for transmission\n"); - wl->txq_thread = kthread_run(linux_wlan_txq_task, (void *)wl, + wl->txq_thread = kthread_run(linux_wlan_txq_task, (void *)dev, "K_TXQ_TASK"); if (!wl->txq_thread) { PRINT_ER("couldn't create TXQ thread\n");