Commit 53dc0cfe authored by Glen Lee's avatar Glen Lee Committed by Greg Kroah-Hartman

staging: wilc1000: wilc1000_wlan_deinit: change argument and use wilc

This patch changes function argument wilc with net_device and use nic->wilc
instead of global variable g_linux_wlan. The null check codes should be placed
before it is used so move it.
Signed-off-by: default avatarGlen Lee <glen.lee@atmel.com>
Signed-off-by: default avatarTony Cho <tony.cho@atmel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 299382cf
...@@ -49,7 +49,6 @@ extern bool g_obtainingIP; ...@@ -49,7 +49,6 @@ extern bool g_obtainingIP;
extern u16 Set_machw_change_vir_if(bool bValue); extern u16 Set_machw_change_vir_if(bool bValue);
extern void resolve_disconnect_aberration(void *drvHandler); extern void resolve_disconnect_aberration(void *drvHandler);
extern u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; extern u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
void wilc1000_wlan_deinit(struct wilc *nic);
extern struct timer_list hDuringIpTimer; extern struct timer_list hDuringIpTimer;
static int linux_wlan_device_power(int on_off) static int linux_wlan_device_power(int on_off)
...@@ -860,16 +859,22 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni ...@@ -860,16 +859,22 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni
} }
/**************************/ /**************************/
void wilc1000_wlan_deinit(struct wilc *nic) void wilc1000_wlan_deinit(struct net_device *dev)
{ {
if (g_linux_wlan->initialized) { perInterface_wlan_t *nic;
printk("Deinitializing wilc1000 ...\n"); struct wilc *wl;
if (nic == NULL) { nic = netdev_priv(dev);
PRINT_ER("nic is NULL\n"); wl = nic->wilc;
if (!wl) {
netdev_err(dev, "wl is NULL\n");
return; return;
} }
if (wl->initialized) {
netdev_info(dev, "Deinitializing wilc1000...\n");
#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31) #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
/* johnny : remove */ /* johnny : remove */
PRINT_D(INIT_DBG, "skip wilc_bus_set_default_speed\n"); PRINT_D(INIT_DBG, "skip wilc_bus_set_default_speed\n");
...@@ -879,18 +884,18 @@ void wilc1000_wlan_deinit(struct wilc *nic) ...@@ -879,18 +884,18 @@ void wilc1000_wlan_deinit(struct wilc *nic)
PRINT_D(INIT_DBG, "Disabling IRQ\n"); PRINT_D(INIT_DBG, "Disabling IRQ\n");
#ifdef WILC_SDIO #ifdef WILC_SDIO
mutex_lock(&g_linux_wlan->hif_cs); mutex_lock(&wl->hif_cs);
disable_sdio_interrupt(); disable_sdio_interrupt();
mutex_unlock(&g_linux_wlan->hif_cs); mutex_unlock(&wl->hif_cs);
#endif #endif
if (&g_linux_wlan->txq_event != NULL) if (&wl->txq_event != NULL)
up(&g_linux_wlan->txq_event); up(&wl->txq_event);
PRINT_D(INIT_DBG, "Deinitializing Threads\n"); PRINT_D(INIT_DBG, "Deinitializing Threads\n");
wlan_deinitialize_threads(nic); wlan_deinitialize_threads(wl);
PRINT_D(INIT_DBG, "Deinitializing IRQ\n"); PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
deinit_irq(g_linux_wlan); deinit_irq(wl);
wilc_wlan_stop(); wilc_wlan_stop();
...@@ -900,18 +905,18 @@ void wilc1000_wlan_deinit(struct wilc *nic) ...@@ -900,18 +905,18 @@ void wilc1000_wlan_deinit(struct wilc *nic)
#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31) #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
PRINT_D(INIT_DBG, "Disabling IRQ 2\n"); PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
mutex_lock(&g_linux_wlan->hif_cs); mutex_lock(&wl->hif_cs);
disable_sdio_interrupt(); disable_sdio_interrupt();
mutex_unlock(&g_linux_wlan->hif_cs); mutex_unlock(&wl->hif_cs);
#endif #endif
#endif #endif
/*De-Initialize locks*/ /*De-Initialize locks*/
PRINT_D(INIT_DBG, "Deinitializing Locks\n"); PRINT_D(INIT_DBG, "Deinitializing Locks\n");
wlan_deinit_locks(g_linux_wlan); wlan_deinit_locks(wl);
/* announce that wilc1000 is not initialized */ /* announce that wilc1000 is not initialized */
g_linux_wlan->initialized = false; wl->initialized = false;
PRINT_D(INIT_DBG, "wilc1000 deinitialization Done\n"); PRINT_D(INIT_DBG, "wilc1000 deinitialization Done\n");
...@@ -1232,7 +1237,7 @@ int mac_open(struct net_device *ndev) ...@@ -1232,7 +1237,7 @@ int mac_open(struct net_device *ndev)
_err_: _err_:
wilc_deinit_host_int(ndev); wilc_deinit_host_int(ndev);
wilc1000_wlan_deinit(wl); wilc1000_wlan_deinit(ndev);
return ret; return ret;
} }
...@@ -1431,7 +1436,7 @@ int mac_close(struct net_device *ndev) ...@@ -1431,7 +1436,7 @@ int mac_close(struct net_device *ndev)
if (wl->open_ifcs == 0) { if (wl->open_ifcs == 0) {
PRINT_D(GENERIC_DBG, "Deinitializing wilc1000\n"); PRINT_D(GENERIC_DBG, "Deinitializing wilc1000\n");
wl->close = 1; wl->close = 1;
wilc1000_wlan_deinit(wl); wilc1000_wlan_deinit(ndev);
WILC_WFI_deinit_mon_interface(); WILC_WFI_deinit_mon_interface();
} }
......
...@@ -2523,7 +2523,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, ...@@ -2523,7 +2523,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
* @date 01 MAR 2012 * @date 01 MAR 2012
* @version 1.0 * @version 1.0
*/ */
void wilc1000_wlan_deinit(struct wilc *nic);
int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_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, 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, ...@@ -2582,7 +2581,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
/*Eliminate host interface blocking state*/ /*Eliminate host interface blocking state*/
up(&wl->cfg_event); up(&wl->cfg_event);
wilc1000_wlan_deinit(wl); wilc1000_wlan_deinit(dev);
wilc1000_wlan_init(dev, nic); wilc1000_wlan_init(dev, nic);
g_wilc_initialized = 1; g_wilc_initialized = 1;
nic->iftype = interface_type; nic->iftype = interface_type;
...@@ -2666,7 +2665,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, ...@@ -2666,7 +2665,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
/* ensure that the message Q is empty */ /* ensure that the message Q is empty */
host_int_wait_msg_queue_idle(); host_int_wait_msg_queue_idle();
wilc1000_wlan_deinit(wl); wilc1000_wlan_deinit(dev);
wilc1000_wlan_init(dev, nic); wilc1000_wlan_init(dev, nic);
g_wilc_initialized = 1; g_wilc_initialized = 1;
...@@ -2780,7 +2779,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, ...@@ -2780,7 +2779,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
/* ensure that the message Q is empty */ /* ensure that the message Q is empty */
host_int_wait_msg_queue_idle(); host_int_wait_msg_queue_idle();
wilc1000_wlan_deinit(wl); wilc1000_wlan_deinit(dev);
wilc1000_wlan_init(dev, nic); wilc1000_wlan_init(dev, nic);
g_wilc_initialized = 1; g_wilc_initialized = 1;
......
...@@ -215,4 +215,5 @@ void linux_wlan_dbg(u8 *buff); ...@@ -215,4 +215,5 @@ void linux_wlan_dbg(u8 *buff);
int linux_wlan_lock_timeout(void *vp, u32 timeout); int linux_wlan_lock_timeout(void *vp, u32 timeout);
void wl_wlan_cleanup(void); void wl_wlan_cleanup(void);
int wilc_netdev_init(struct wilc **wilc); int wilc_netdev_init(struct wilc **wilc);
void wilc1000_wlan_deinit(struct net_device *dev);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment