From: Glen Lee <[email protected]>
This patch add wilc to struct perInterface_wlan_t which is netdev private
data to access wilc via netdev_priv function. Assign wilc to nic->wilc.
The global variable g_linux_wlan will be replaced with netdev private data
member wilc step by step.
Signed-off-by: Glen Lee <[email protected]>
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 1 +
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 5701e58..8fa6b7c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1662,6 +1662,7 @@ int wilc_netdev_init(struct wilc **wilc)
nic->u8IfIdx = g_linux_wlan->vif_num;
nic->wilc_netdev = ndev;
+ nic->wilc = *wilc;
g_linux_wlan->vif[g_linux_wlan->vif_num].ndev = ndev;
g_linux_wlan->vif_num++;
ndev->netdev_ops = &wilc_netdev_ops;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index e0c66bc..40a44f8 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -199,7 +199,7 @@ typedef struct {
struct_frame_reg g_struct_frame_reg[num_reg_frame];
struct net_device *wilc_netdev;
struct net_device_stats netstats;
-
+ struct wilc *wilc;
} perInterface_wlan_t;
struct WILC_WFI_mon_priv {
--
1.9.1
From: Glen Lee <[email protected]>
Use netdev private data member wilc instead of global variable g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 8aea4b5..eea7f3b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1360,11 +1360,15 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
const u8 *mac_addr)
{
struct wilc_priv *priv;
+ struct wilc *wl;
+ perInterface_wlan_t *nic;
priv = wiphy_priv(wiphy);
+ nic = netdev_priv(netdev);
+ wl = nic->wilc;
/*delete saved keys, if any*/
- if (netdev == g_linux_wlan->vif[0].ndev) {
+ if (netdev == wl->vif[0].ndev) {
g_ptk_keys_saved = false;
g_gtk_keys_saved = false;
g_wep_keys_saved = false;
--
1.9.1
From: Glen Lee <[email protected]>
This patch changes function argument type wilc with net_device and use
netdev private data member wilc instead of p_nic.
Signed-off-by: Glen Lee <[email protected]>
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 2c4673c..bb5bd81 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -259,10 +259,14 @@ irqreturn_t isr_bh_routine(int irq, void *userdata)
}
#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
-static int init_irq(struct wilc *p_nic)
+static int init_irq(struct net_device *dev)
{
int ret = 0;
- struct wilc *nic = p_nic;
+ perInterface_wlan_t *nic;
+ struct wilc *wl;
+
+ nic = netdev_priv(dev);
+ wl = nic->wilc;
/*initialize GPIO and register IRQ num*/
/*GPIO request*/
@@ -275,23 +279,23 @@ static int init_irq(struct wilc *p_nic)
* ex) nic->dev_irq_num = gpio_to_irq(GPIO_NUM);
*/
#else
- nic->dev_irq_num = gpio_to_irq(GPIO_NUM);
+ wl->dev_irq_num = gpio_to_irq(GPIO_NUM);
#endif
} else {
ret = -1;
PRINT_ER("could not obtain gpio for WILC_INTR\n");
}
- if ((ret != -1) && (request_threaded_irq(nic->dev_irq_num, isr_uh_routine, isr_bh_routine,
+ if ((ret != -1) && (request_threaded_irq(wl->dev_irq_num, isr_uh_routine, isr_bh_routine,
IRQF_TRIGGER_LOW | IRQF_ONESHOT, /*Without IRQF_ONESHOT the uh will remain kicked in and dont gave a chance to bh*/
- "WILC_IRQ", nic)) < 0) {
+ "WILC_IRQ", wl)) < 0) {
PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM);
ret = -1;
} else {
PRINT_D(INIT_DBG, "IRQ request succeeded IRQ-NUM= %d on GPIO: %d\n",
- nic->dev_irq_num, GPIO_NUM);
+ wl->dev_irq_num, GPIO_NUM);
}
return ret;
@@ -1055,7 +1059,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
}
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
- if (init_irq(wl)) {
+ if (init_irq(dev)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_locks_;
--
1.9.1
From: Glen Lee <[email protected]>
Use netdev private data member wilc instead of global variable g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 33a082f..1533804 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -537,11 +537,15 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
struct net_device *dev;
struct host_if_drv *pstrWFIDrv;
u8 NullBssid[ETH_ALEN] = {0};
+ struct wilc *wl;
+ perInterface_wlan_t *nic;
connecting = 0;
priv = (struct wilc_priv *)pUserVoid;
dev = priv->dev;
+ nic = netdev_priv(dev);
+ wl = nic->wilc;
pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
if (enuConnDisconnEvent == CONN_DISCONN_EVENT_CONN_RESP) {
@@ -624,12 +628,12 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
u8WLANChannel = INVALID_CHANNEL;
/*Incase "P2P CLIENT Connected" send deauthentication reason by 3 to force the WPA_SUPPLICANT to directly change
* virtual interface to station*/
- if ((pstrWFIDrv->IFC_UP) && (dev == g_linux_wlan->vif[1].ndev)) {
+ if ((pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) {
pstrDisconnectNotifInfo->u16reason = 3;
}
/*Incase "P2P CLIENT during connection(not connected)" send deauthentication reason by 1 to force the WPA_SUPPLICANT
* to scan again and retry the connection*/
- else if ((!pstrWFIDrv->IFC_UP) && (dev == g_linux_wlan->vif[1].ndev)) {
+ else if ((!pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) {
pstrDisconnectNotifInfo->u16reason = 1;
}
cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, pstrDisconnectNotifInfo->ie,
--
1.9.1
From: Glen Lee <[email protected]>
This patch changes function parameter type wilc with net_device and use netdev
private data member wilc instead of global variable g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 39341a8..5fcbfac 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -920,23 +920,28 @@ void wilc1000_wlan_deinit(struct wilc *nic)
}
}
-int wlan_init_locks(struct wilc *p_nic)
+int wlan_init_locks(struct net_device *dev)
{
+ perInterface_wlan_t *nic;
+ struct wilc *wl;
+
+ nic = netdev_priv(dev);
+ wl = nic->wilc;
PRINT_D(INIT_DBG, "Initializing Locks ...\n");
- mutex_init(&g_linux_wlan->hif_cs);
- mutex_init(&g_linux_wlan->rxq_cs);
+ mutex_init(&wl->hif_cs);
+ mutex_init(&wl->rxq_cs);
- spin_lock_init(&g_linux_wlan->txq_spinlock);
- sema_init(&g_linux_wlan->txq_add_to_head_cs, 1);
+ spin_lock_init(&wl->txq_spinlock);
+ sema_init(&wl->txq_add_to_head_cs, 1);
- sema_init(&g_linux_wlan->txq_event, 0);
+ sema_init(&wl->txq_event, 0);
- sema_init(&g_linux_wlan->cfg_event, 0);
- sema_init(&g_linux_wlan->sync_event, 0);
+ sema_init(&wl->cfg_event, 0);
+ sema_init(&wl->sync_event, 0);
- sema_init(&g_linux_wlan->txq_thread_started, 0);
+ sema_init(&wl->txq_thread_started, 0);
return 0;
}
@@ -1033,7 +1038,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
wl->mac_status = WILC_MAC_STATUS_INIT;
wl->close = 0;
- wlan_init_locks(wl);
+ wlan_init_locks(dev);
linux_to_wlan(&nwi, wl);
--
1.9.1
From: Glen Lee <[email protected]>
This patch use netdev private data member wilc instead of global variable
g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 8fa6b7c..39341a8 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1027,14 +1027,15 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
wilc_wlan_inp_t nwi;
perInterface_wlan_t *nic = p_nic;
int ret = 0;
+ struct wilc *wl = nic->wilc;
- if (!g_linux_wlan->initialized) {
- g_linux_wlan->mac_status = WILC_MAC_STATUS_INIT;
- g_linux_wlan->close = 0;
+ if (!wl->initialized) {
+ wl->mac_status = WILC_MAC_STATUS_INIT;
+ wl->close = 0;
- wlan_init_locks(g_linux_wlan);
+ wlan_init_locks(wl);
- linux_to_wlan(&nwi, g_linux_wlan);
+ linux_to_wlan(&nwi, wl);
ret = wilc_wlan_init(&nwi);
if (ret < 0) {
@@ -1044,7 +1045,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
}
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
- if (init_irq(g_linux_wlan)) {
+ if (init_irq(wl)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_locks_;
@@ -1073,7 +1074,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
}
/*Download firmware*/
- ret = linux_wlan_firmware_download(g_linux_wlan);
+ ret = linux_wlan_firmware_download(wl);
if (ret < 0) {
PRINT_ER("Failed to download firmware\n");
ret = -EIO;
@@ -1101,7 +1102,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
PRINT_D(INIT_DBG, "***** Firmware Ver = %s *******\n", Firmware_ver);
}
/* Initialize firmware with default configuration */
- ret = linux_wlan_init_test_config(dev, g_linux_wlan);
+ ret = linux_wlan_init_test_config(dev, wl);
if (ret < 0) {
PRINT_ER("Failed to configure firmware\n");
@@ -1109,7 +1110,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
goto _fail_fw_start_;
}
- g_linux_wlan->initialized = true;
+ wl->initialized = true;
return 0; /*success*/
_fail_fw_start_:
@@ -1121,14 +1122,14 @@ _fail_irq_enable_:
_fail_irq_init_:
#endif
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
- deinit_irq(g_linux_wlan);
+ deinit_irq(wl);
#endif
- wlan_deinitialize_threads(g_linux_wlan);
+ wlan_deinitialize_threads(wl);
_fail_wilc_wlan_:
wilc_wlan_cleanup();
_fail_locks_:
- wlan_deinit_locks(g_linux_wlan);
+ wlan_deinit_locks(wl);
PRINT_ER("WLAN Iinitialization FAILED\n");
} else {
PRINT_D(INIT_DBG, "wilc1000 already initialized\n");
--
1.9.1
From: Glen Lee <[email protected]>
Use netdev private data member wilc instead of global variable g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
Signed-off-by: Tony Cho <[email protected]>
---
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;
}
--
1.9.1
From: Glen Lee <[email protected]>
Use netdev private data member wilc instead of global variable g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1533804..8aea4b5 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1086,8 +1086,12 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
u8 u8gmode = NO_ENCRYPT;
u8 u8pmode = NO_ENCRYPT;
enum AUTHTYPE tenuAuth_type = ANY;
+ struct wilc *wl;
+ perInterface_wlan_t *nic;
priv = wiphy_priv(wiphy);
+ nic = netdev_priv(netdev);
+ wl = nic->wilc;
PRINT_D(CFG80211_DBG, "Adding key with cipher suite = %x\n", params->cipher);
@@ -1259,7 +1263,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
}
/*save keys only on interface 0 (wifi interface)*/
- if (!g_gtk_keys_saved && netdev == g_linux_wlan->vif[0].ndev) {
+ if (!g_gtk_keys_saved && netdev == wl->vif[0].ndev) {
g_add_gtk_key_params.key_idx = key_index;
g_add_gtk_key_params.pairwise = pairwise;
if (!mac_addr) {
@@ -1295,7 +1299,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
}
/*save keys only on interface 0 (wifi interface)*/
- if (!g_ptk_keys_saved && netdev == g_linux_wlan->vif[0].ndev) {
+ if (!g_ptk_keys_saved && netdev == wl->vif[0].ndev) {
g_add_ptk_key_params.key_idx = key_index;
g_add_ptk_key_params.pairwise = pairwise;
if (!mac_addr) {
--
1.9.1
From: Glen Lee <[email protected]>
Use netdev private data member wilc instead of global variable g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
Signed-off-by: Tony Cho <[email protected]>
---
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);
--
1.9.1
From: Glen Lee <[email protected]>
Use netdev private data member wilc instead of global variable g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 59db1d5..5559aa6 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2891,8 +2891,12 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_beacon_data *beacon = &(settings->beacon);
struct wilc_priv *priv;
s32 s32Error = 0;
+ struct wilc *wl;
+ perInterface_wlan_t *nic;
priv = wiphy_priv(wiphy);
+ nic = netdev_priv(dev);
+ wl = nic->wilc;
PRINT_D(HOSTAPD_DBG, "Starting ap\n");
PRINT_D(HOSTAPD_DBG, "Interval = %d\n DTIM period = %d\n Head length = %zu Tail length = %zu\n",
@@ -2903,7 +2907,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
if (s32Error != 0)
PRINT_ER("Error in setting channel\n");
- linux_wlan_set_bssid(dev, g_linux_wlan->vif[0].src_addr);
+ linux_wlan_set_bssid(dev, wl->vif[0].src_addr);
s32Error = host_int_add_beacon(priv->hWILCWFIDrv,
settings->beacon_interval,
--
1.9.1
From: Glen Lee <[email protected]>
Use netdev private data member wilc instead of global variable g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index ebedffa..93475aa 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1383,6 +1383,7 @@ int mac_close(struct net_device *ndev)
struct wilc_priv *priv;
perInterface_wlan_t *nic;
struct host_if_drv *pstrWFIDrv;
+ struct wilc *wl;
nic = netdev_priv(ndev);
@@ -1392,6 +1393,7 @@ int mac_close(struct net_device *ndev)
}
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
+ wl = nic->wilc;
if (priv == NULL) {
PRINT_ER("priv = NULL\n");
@@ -1402,8 +1404,8 @@ int mac_close(struct net_device *ndev)
PRINT_D(GENERIC_DBG, "Mac close\n");
- if (g_linux_wlan == NULL) {
- PRINT_ER("g_linux_wlan = NULL\n");
+ if (!wl) {
+ PRINT_ER("wl = NULL\n");
return 0;
}
@@ -1412,8 +1414,8 @@ int mac_close(struct net_device *ndev)
return 0;
}
- if ((g_linux_wlan->open_ifcs) > 0) {
- g_linux_wlan->open_ifcs--;
+ if ((wl->open_ifcs) > 0) {
+ wl->open_ifcs--;
} else {
PRINT_ER("ERROR: MAC close called while number of opened interfaces is zero\n");
return 0;
@@ -1426,10 +1428,10 @@ int mac_close(struct net_device *ndev)
wilc_deinit_host_int(nic->wilc_netdev);
}
- if (g_linux_wlan->open_ifcs == 0) {
+ if (wl->open_ifcs == 0) {
PRINT_D(GENERIC_DBG, "Deinitializing wilc1000\n");
- g_linux_wlan->close = 1;
- wilc1000_wlan_deinit(g_linux_wlan);
+ wl->close = 1;
+ wilc1000_wlan_deinit(wl);
WILC_WFI_deinit_mon_interface();
}
--
1.9.1
From: Glen Lee <[email protected]>
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: Glen Lee <[email protected]>
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 45 +++++++++++++----------
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 7 ++--
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 +
3 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 93475aa..2c4673c 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)
@@ -860,15 +859,21 @@ _fail_:
}
/**************************/
-void wilc1000_wlan_deinit(struct wilc *nic)
+void wilc1000_wlan_deinit(struct net_device *dev)
{
- if (g_linux_wlan->initialized) {
- printk("Deinitializing wilc1000 ...\n");
+ perInterface_wlan_t *nic;
+ struct wilc *wl;
- if (nic == NULL) {
- PRINT_ER("nic is NULL\n");
- return;
- }
+ nic = netdev_priv(dev);
+ wl = nic->wilc;
+
+ if (!wl) {
+ netdev_err(dev, "wl is NULL\n");
+ return;
+ }
+
+ if (wl->initialized) {
+ netdev_info(dev, "Deinitializing wilc1000...\n");
#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
/* johnny : remove */
@@ -879,18 +884,18 @@ void wilc1000_wlan_deinit(struct wilc *nic)
PRINT_D(INIT_DBG, "Disabling IRQ\n");
#ifdef WILC_SDIO
- mutex_lock(&g_linux_wlan->hif_cs);
+ mutex_lock(&wl->hif_cs);
disable_sdio_interrupt();
- mutex_unlock(&g_linux_wlan->hif_cs);
+ mutex_unlock(&wl->hif_cs);
#endif
- if (&g_linux_wlan->txq_event != NULL)
- up(&g_linux_wlan->txq_event);
+ if (&wl->txq_event != NULL)
+ 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(g_linux_wlan);
+ deinit_irq(wl);
wilc_wlan_stop();
@@ -900,18 +905,18 @@ void wilc1000_wlan_deinit(struct wilc *nic)
#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
- mutex_lock(&g_linux_wlan->hif_cs);
+ mutex_lock(&wl->hif_cs);
disable_sdio_interrupt();
- mutex_unlock(&g_linux_wlan->hif_cs);
+ mutex_unlock(&wl->hif_cs);
#endif
#endif
/*De-Initialize locks*/
PRINT_D(INIT_DBG, "Deinitializing Locks\n");
- wlan_deinit_locks(g_linux_wlan);
+ wlan_deinit_locks(wl);
/* announce that wilc1000 is not initialized */
- g_linux_wlan->initialized = false;
+ wl->initialized = false;
PRINT_D(INIT_DBG, "wilc1000 deinitialization Done\n");
@@ -1232,7 +1237,7 @@ int mac_open(struct net_device *ndev)
_err_:
wilc_deinit_host_int(ndev);
- wilc1000_wlan_deinit(wl);
+ wilc1000_wlan_deinit(ndev);
return ret;
}
@@ -1431,7 +1436,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 422d462..33a082f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2523,7 +2523,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;
@@ -2666,7 +2665,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;
@@ -2780,7 +2779,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 40a44f8..8aa3355 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
--
1.9.1
From: Glen Lee <[email protected]>
Use netdev private data member wilc instead of global variable g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index eea7f3b..59db1d5 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2397,12 +2397,11 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
struct wilc_priv *priv;
perInterface_wlan_t *nic;
-
+ struct wilc *wl;
priv = wiphy_priv(wiphy);
nic = netdev_priv(priv->wdev->netdev);
-
-
+ wl = nic->wilc;
if (!frame_type)
return;
@@ -2430,7 +2429,7 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
}
/*If mac is closed, then return*/
- if (!g_linux_wlan->initialized) {
+ if (!wl->initialized) {
PRINT_D(GENERIC_DBG, "Return since mac is closed\n");
return;
}
--
1.9.1