From patchwork Tue Oct 27 09:27:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glen Lee X-Patchwork-Id: 7495041 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DD3DABEEA4 for ; Tue, 27 Oct 2015 09:26:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D084D20460 for ; Tue, 27 Oct 2015 09:26:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC7E42041F for ; Tue, 27 Oct 2015 09:26:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752375AbbJ0J0D (ORCPT ); Tue, 27 Oct 2015 05:26:03 -0400 Received: from eusmtp01.atmel.com ([212.144.249.243]:58026 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751646AbbJ0J0C (ORCPT ); Tue, 27 Oct 2015 05:26:02 -0400 Received: from glen-ubuntu.corp.atmel.com (10.161.101.13) by eusmtp01.atmel.com (10.161.101.31) with Microsoft SMTP Server id 14.3.235.1; Tue, 27 Oct 2015 10:25:58 +0100 From: Glen Lee To: CC: , , , , , , , , Subject: [PATCH V2 10/27] staging: wilc1000: linux_wlan_txq_task: use wilc instead of g_linux_wlan Date: Tue, 27 Oct 2015 18:27:46 +0900 Message-ID: <1445938083-20445-10-git-send-email-glen.lee@atmel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445938083-20445-1-git-send-email-glen.lee@atmel.com> References: <1445938083-20445-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 4e88cbe..5897f35 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -440,7 +440,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) @@ -450,18 +452,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(); @@ -478,10 +483,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. */ @@ -503,7 +508,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; @@ -1024,7 +1029,7 @@ int wlan_initialize_threads(struct net_device *dev) /* create tx task */ PRINT_D(INIT_DBG, "Creating kthread for transmission\n"); - wilc->txq_thread = kthread_run(linux_wlan_txq_task, (void *)wilc, + wilc->txq_thread = kthread_run(linux_wlan_txq_task, (void *)dev, "K_TXQ_TASK"); if (!wilc->txq_thread) { PRINT_ER("couldn't create TXQ thread\n");