From patchwork Tue Oct 20 08:13:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Cho X-Patchwork-Id: 7443481 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 530709F36A for ; Tue, 20 Oct 2015 08:14:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 215F220858 for ; Tue, 20 Oct 2015 08:14:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B13CB2084A for ; Tue, 20 Oct 2015 08:14:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753519AbbJTIOv (ORCPT ); Tue, 20 Oct 2015 04:14:51 -0400 Received: from eusmtp01.atmel.com ([212.144.249.242]:16983 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753501AbbJTIOu (ORCPT ); Tue, 20 Oct 2015 04:14:50 -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:45 +0200 From: Tony Cho To: CC: , , , , , , , , Subject: [PATCH 06/13] staging: wilc1000: chage_virtual_intf: use netdev private wilc Date: Tue, 20 Oct 2015 17:13:56 +0900 Message-ID: <1445328843-32247-6-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/wilc_wfi_cfgoperations.c | 85 ++++++++++++----------- 1 file changed, 45 insertions(+), 40 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 264fcb9..422d462 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -2534,9 +2534,11 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, u8 interface_type; u16 TID = 0; u8 i; + struct wilc *wl; nic = netdev_priv(dev); priv = wiphy_priv(wiphy); + wl = nic->wilc; PRINT_D(HOSTAPD_DBG, "In Change virtual interface function\n"); PRINT_D(HOSTAPD_DBG, "Wireless interface name =%s\n", dev->name); @@ -2571,30 +2573,31 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, interface_type = nic->iftype; nic->iftype = STATION_MODE; - if (g_linux_wlan->initialized) { - host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->vif[0].bssid, TID); + if (wl->initialized) { + host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, + wl->vif[0].bssid, TID); /* ensure that the message Q is empty */ host_int_wait_msg_queue_idle(); /*Eliminate host interface blocking state*/ - up(&g_linux_wlan->cfg_event); + up(&wl->cfg_event); - wilc1000_wlan_deinit(g_linux_wlan); + wilc1000_wlan_deinit(wl); wilc1000_wlan_init(dev, nic); g_wilc_initialized = 1; nic->iftype = interface_type; /*Setting interface 1 drv handler and mac address in newly downloaded FW*/ - host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].hif_drv); - host_int_set_MacAddress(g_linux_wlan->vif[0].hif_drv, - g_linux_wlan->vif[0].src_addr); + host_int_set_wfi_drv_handler(wl->vif[0].hif_drv); + host_int_set_MacAddress(wl->vif[0].hif_drv, + wl->vif[0].src_addr); host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); /*Add saved WEP keys, if any*/ if (g_wep_keys_saved) { - host_int_set_WEPDefaultKeyID(g_linux_wlan->vif[0].hif_drv, + host_int_set_WEPDefaultKeyID(wl->vif[0].hif_drv, g_key_wep_params.key_idx); - host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].hif_drv, + host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); @@ -2612,22 +2615,22 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(CFG80211_DBG, "gtk %x %x %x\n", g_key_gtk_params.key[0], g_key_gtk_params.key[1], g_key_gtk_params.key[2]); - add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy, - g_linux_wlan->vif[0].ndev, + add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy, + wl->vif[0].ndev, g_add_ptk_key_params.key_idx, g_add_ptk_key_params.pairwise, g_add_ptk_key_params.mac_addr, (struct key_params *)(&g_key_ptk_params)); - add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy, - g_linux_wlan->vif[0].ndev, + add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy, + wl->vif[0].ndev, g_add_gtk_key_params.key_idx, g_add_gtk_key_params.pairwise, g_add_gtk_key_params.mac_addr, (struct key_params *)(&g_key_gtk_params)); } - if (g_linux_wlan->initialized) { + if (wl->initialized) { for (i = 0; i < num_reg_frame; i++) { PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type, nic->g_struct_frame_reg[i].reg); @@ -2648,7 +2651,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, connecting = 0; PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_P2P_CLIENT\n"); - host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->vif[0].bssid, TID); + host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, + wl->vif[0].bssid, TID); dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; @@ -2658,24 +2662,24 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, nic->iftype = CLIENT_MODE; - if (g_linux_wlan->initialized) { + if (wl->initialized) { /* ensure that the message Q is empty */ host_int_wait_msg_queue_idle(); - wilc1000_wlan_deinit(g_linux_wlan); + wilc1000_wlan_deinit(wl); wilc1000_wlan_init(dev, nic); g_wilc_initialized = 1; - host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].hif_drv); - host_int_set_MacAddress(g_linux_wlan->vif[0].hif_drv, - g_linux_wlan->vif[0].src_addr); + host_int_set_wfi_drv_handler(wl->vif[0].hif_drv); + host_int_set_MacAddress(wl->vif[0].hif_drv, + wl->vif[0].src_addr); host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); /*Add saved WEP keys, if any*/ if (g_wep_keys_saved) { - host_int_set_WEPDefaultKeyID(g_linux_wlan->vif[0].hif_drv, + host_int_set_WEPDefaultKeyID(wl->vif[0].hif_drv, g_key_wep_params.key_idx); - host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].hif_drv, + host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); @@ -2693,15 +2697,15 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(CFG80211_DBG, "gtk %x %x %x\n", g_key_gtk_params.key[0], g_key_gtk_params.key[1], g_key_gtk_params.key[2]); - add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy, - g_linux_wlan->vif[0].ndev, + add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy, + wl->vif[0].ndev, g_add_ptk_key_params.key_idx, g_add_ptk_key_params.pairwise, g_add_ptk_key_params.mac_addr, (struct key_params *)(&g_key_ptk_params)); - add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy, - g_linux_wlan->vif[0].ndev, + add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy, + wl->vif[0].ndev, g_add_gtk_key_params.key_idx, g_add_gtk_key_params.pairwise, g_add_gtk_key_params.mac_addr, @@ -2712,7 +2716,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, refresh_scan(priv, 1, true); Set_machw_change_vir_if(false); - if (g_linux_wlan->initialized) { + if (wl->initialized) { for (i = 0; i < num_reg_frame; i++) { PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type, nic->g_struct_frame_reg[i].reg); @@ -2735,7 +2739,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Downloading AP firmware\n"); linux_wlan_get_firmware(nic); /*If wilc is running, then close-open to actually get new firmware running (serves P2P)*/ - if (g_linux_wlan->initialized) { + if (wl->initialized) { nic->iftype = AP_MODE; mac_close(dev); mac_open(dev); @@ -2760,7 +2764,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, /*sent before downloading new FW. This is because it blocks on*/ /*hWaitResponse semaphore, which allows previous config*/ /*packets to actually take action on old FW*/ - host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->vif[0].bssid, TID); + host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, + wl->vif[0].bssid, TID); bEnablePS = false; PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n"); dev->ieee80211_ptr->iftype = type; @@ -2775,22 +2780,22 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, /* ensure that the message Q is empty */ host_int_wait_msg_queue_idle(); - wilc1000_wlan_deinit(g_linux_wlan); + wilc1000_wlan_deinit(wl); wilc1000_wlan_init(dev, nic); g_wilc_initialized = 1; /*Setting interface 1 drv handler and mac address in newly downloaded FW*/ - host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].hif_drv); - host_int_set_MacAddress(g_linux_wlan->vif[0].hif_drv, - g_linux_wlan->vif[0].src_addr); + host_int_set_wfi_drv_handler(wl->vif[0].hif_drv); + host_int_set_MacAddress(wl->vif[0].hif_drv, + wl->vif[0].src_addr); host_int_set_operation_mode(priv->hWILCWFIDrv, AP_MODE); /*Add saved WEP keys, if any*/ if (g_wep_keys_saved) { - host_int_set_WEPDefaultKeyID(g_linux_wlan->vif[0].hif_drv, + host_int_set_WEPDefaultKeyID(wl->vif[0].hif_drv, g_key_wep_params.key_idx); - host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].hif_drv, + host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); @@ -2810,22 +2815,22 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, g_key_gtk_params.key[1], g_key_gtk_params.key[2], g_key_gtk_params.cipher); - add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy, - g_linux_wlan->vif[0].ndev, + add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy, + wl->vif[0].ndev, g_add_ptk_key_params.key_idx, g_add_ptk_key_params.pairwise, g_add_ptk_key_params.mac_addr, (struct key_params *)(&g_key_ptk_params)); - add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy, - g_linux_wlan->vif[0].ndev, + add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy, + wl->vif[0].ndev, g_add_gtk_key_params.key_idx, g_add_gtk_key_params.pairwise, g_add_gtk_key_params.mac_addr, (struct key_params *)(&g_key_gtk_params)); } - if (g_linux_wlan->initialized) { + if (wl->initialized) { for (i = 0; i < num_reg_frame; i++) { PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type, nic->g_struct_frame_reg[i].reg);