From patchwork Fri Oct 16 09:23:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Cho X-Patchwork-Id: 7413011 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 376239F443 for ; Fri, 16 Oct 2015 09:24:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E7BA020A48 for ; Fri, 16 Oct 2015 09:24:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8320B20A1C for ; Fri, 16 Oct 2015 09:24:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753728AbbJPJYC (ORCPT ); Fri, 16 Oct 2015 05:24:02 -0400 Received: from eusmtp01.atmel.com ([212.144.249.242]:34544 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753703AbbJPJYA (ORCPT ); Fri, 16 Oct 2015 05:24:00 -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; Fri, 16 Oct 2015 11:23:53 +0200 From: Tony Cho To: CC: , , , , , , , , Subject: [PATCH 07/13] staging: wilc1000: wilc1000_wlan_deinit: change argument and use nic->wilc Date: Fri, 16 Oct 2015 18:23:03 +0900 Message-ID: <1444987389-14151-7-git-send-email-tony.cho@atmel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444987389-14151-1-git-send-email-tony.cho@atmel.com> References: <1444987389-14151-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, T_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 This patch changes function argument wilc with net_device and use nic->wilc instead of global variable wl. The null check codes should be placed before it is used so move it. Signed-off-by: Glen Lee Signed-off-by: Tony Cho --- drivers/staging/wilc1000/linux_wlan.c | 25 ++++++++++++++--------- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 7 +++---- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 8c98a0c..b32a8ce 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -49,7 +49,6 @@ extern bool g_obtainingIP; extern u16 Set_machw_change_vir_if(bool bValue); extern void resolve_disconnect_aberration(void *drvHandler); extern u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; -void wilc1000_wlan_deinit(struct wilc *nic); extern struct timer_list hDuringIpTimer; static int linux_wlan_device_power(int on_off) @@ -861,16 +860,22 @@ _fail_: } /**************************/ -void wilc1000_wlan_deinit(struct wilc *nic) +void wilc1000_wlan_deinit(struct net_device *dev) { + perInterface_wlan_t *nic; + struct wilc *wl; + + nic = netdev_priv(dev); + wl = nic->wilc; + + if (!wl) { + netdev_err(dev, "wl is NULL\n"); + return; + } + if (wl->initialized) { printk("Deinitializing wilc1000 ...\n"); - if (nic == NULL) { - PRINT_ER("nic is NULL\n"); - return; - } - #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31) /* johnny : remove */ PRINT_D(INIT_DBG, "skip wilc_bus_set_default_speed\n"); @@ -888,7 +893,7 @@ void wilc1000_wlan_deinit(struct wilc *nic) up(&wl->txq_event); PRINT_D(INIT_DBG, "Deinitializing Threads\n"); - wlan_deinitialize_threads(nic); + wlan_deinitialize_threads(wl); PRINT_D(INIT_DBG, "Deinitializing IRQ\n"); deinit_irq(wl); @@ -1226,7 +1231,7 @@ int mac_open(struct net_device *ndev) _err_: wilc_deinit_host_int(ndev); - wilc1000_wlan_deinit(wl); + wilc1000_wlan_deinit(ndev); return ret; } @@ -1425,7 +1430,7 @@ int mac_close(struct net_device *ndev) if (wl->open_ifcs == 0) { PRINT_D(GENERIC_DBG, "Deinitializing wilc1000\n"); wl->close = 1; - wilc1000_wlan_deinit(wl); + wilc1000_wlan_deinit(ndev); WILC_WFI_deinit_mon_interface(); } diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index b34b7d0..270f454 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -2522,7 +2522,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, * @date 01 MAR 2012 * @version 1.0 */ -void wilc1000_wlan_deinit(struct wilc *nic); int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic); static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, @@ -2582,7 +2581,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, /*Eliminate host interface blocking state*/ up(&wl->cfg_event); - wilc1000_wlan_deinit(wl); + wilc1000_wlan_deinit(dev); wilc1000_wlan_init(dev, nic); g_wilc_initialized = 1; nic->iftype = interface_type; @@ -2664,7 +2663,7 @@ 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(wl); + wilc1000_wlan_deinit(dev); wilc1000_wlan_init(dev, nic); g_wilc_initialized = 1; @@ -2778,7 +2777,7 @@ 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(wl); + wilc1000_wlan_deinit(dev); wilc1000_wlan_init(dev, nic); g_wilc_initialized = 1; diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index cb23134..5769359 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -215,4 +215,5 @@ void linux_wlan_dbg(u8 *buff); int linux_wlan_lock_timeout(void *vp, u32 timeout); void wl_wlan_cleanup(void); int wilc_netdev_init(struct wilc **wilc); +void wilc1000_wlan_deinit(struct net_device *dev); #endif