From patchwork Tue Oct 20 08:13:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Cho X-Patchwork-Id: 7443461 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 EA8F6BEEA4 for ; Tue, 20 Oct 2015 08:14:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 20BD62084A for ; Tue, 20 Oct 2015 08:14:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 327CD20859 for ; Tue, 20 Oct 2015 08:14:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753493AbbJTIOi (ORCPT ); Tue, 20 Oct 2015 04:14:38 -0400 Received: from eusmtp01.atmel.com ([212.144.249.242]:16922 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753337AbbJTIOh (ORCPT ); Tue, 20 Oct 2015 04:14:37 -0400 Received: from tony-itx.corp.atmel.com (10.161.101.13) by eusmtp01.atmel.com (10.161.101.30) with Microsoft SMTP Server id 14.3.235.1; Tue, 20 Oct 2015 10:14:33 +0200 From: Tony Cho To: CC: , , , , , , , , Subject: [PATCH 04/13] staging: wilc1000: mac_open: use netdev private wilc Date: Tue, 20 Oct 2015 17:13:54 +0900 Message-ID: <1445328843-32247-4-git-send-email-tony.cho@atmel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445328843-32247-1-git-send-email-tony.cho@atmel.com> References: <1445328843-32247-1-git-send-email-tony.cho@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 From: Glen Lee Use netdev private data member wilc instead of global variable g_linux_wlan. Signed-off-by: Glen Lee Signed-off-by: Tony Cho --- drivers/staging/wilc1000/linux_wlan.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 5fcbfac..ebedffa 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1167,9 +1167,13 @@ int mac_open(struct net_device *ndev) int ret = 0; int i = 0; struct wilc_priv *priv; + struct wilc *wl; + + nic = netdev_priv(ndev); + wl = nic->wilc; #ifdef WILC_SPI - if (!g_linux_wlan || !g_linux_wlan->wilc_spidev) { + if (!wl|| !wl->wilc_spidev) { netdev_err(ndev, "wilc1000: SPI device not ready\n"); return -ENODEV; } @@ -1200,16 +1204,16 @@ int mac_open(struct net_device *ndev) PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add); /* loop through the NUM of supported devices and set the MAC address */ - for (i = 0; i < g_linux_wlan->vif_num; i++) { - if (ndev == g_linux_wlan->vif[i].ndev) { - memcpy(g_linux_wlan->vif[i].src_addr, mac_add, ETH_ALEN); - g_linux_wlan->vif[i].hif_drv = priv->hWILCWFIDrv; + for (i = 0; i < wl->vif_num; i++) { + if (ndev == wl->vif[i].ndev) { + memcpy(wl->vif[i].src_addr, mac_add, ETH_ALEN); + wl->vif[i].hif_drv = priv->hWILCWFIDrv; break; } } /* TODO: get MAC address whenever the source is EPROM - hardcoded and copy it to ndev*/ - memcpy(ndev->dev_addr, g_linux_wlan->vif[i].src_addr, ETH_ALEN); + memcpy(ndev->dev_addr, wl->vif[i].src_addr, ETH_ALEN); if (!is_valid_ether_addr(ndev->dev_addr)) { PRINT_ER("Error: Wrong MAC address\n"); @@ -1222,13 +1226,13 @@ int mac_open(struct net_device *ndev) wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, nic->wilc_netdev->ieee80211_ptr, nic->g_struct_frame_reg[1].frame_type, nic->g_struct_frame_reg[1].reg); netif_wake_queue(ndev); - g_linux_wlan->open_ifcs++; + wl->open_ifcs++; nic->mac_opened = 1; return 0; _err_: wilc_deinit_host_int(ndev); - wilc1000_wlan_deinit(g_linux_wlan); + wilc1000_wlan_deinit(wl); return ret; }