The series of V2 restore the global variable, wl to g_linux_wlan which is its
original name becasue it will be replaced with local structure and deleted.
Tony Cho (12):
staging: wilc1000: change the type of wilc1000_initialized
staging: wilc1000: rename u8NoIfcs in the struct wilc
staging: wilc1000: rename strInterfaceInfo in the sturct wilc
staging: wilc1000: rename aSrcAddress in the struct wilc_vif
staging: wilc1000: rename aBSSID in the sturct wilc_vif
staging: wilc1000: rename drvHandler in the struct wilc_vif
staging: wilc1000: rename wilc_netdev in the struct wilc_vif
staging: wilc1000: move clean up codes into wl_wlan_cleanup function
staging: wilc1000: rename wilc_firmware in the struct wilc
staging: wilc1000: remove COMPLEMENT_BOOT
staging: wilc1000: introduce struct wilc_sdio for sdio data
staging: wilc1000: assign pointer of g_linux_wlan to sdio device data
drivers/staging/wilc1000/linux_wlan.c | 331 +++++++---------------
drivers/staging/wilc1000/linux_wlan_sdio.c | 33 ++-
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 87 +++---
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 19 +-
drivers/staging/wilc1000/wilc_wlan.c | 18 --
5 files changed, 169 insertions(+), 319 deletions(-)
--
1.9.1
This patch renames u8NoIfcs of the struct wilc to the vif_num to avoid
CamelCase naming convention.
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 18 +++++++++---------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 191851b..2bea103 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -366,7 +366,7 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
Bssid = pMacHeader + 10;
Bssid1 = pMacHeader + 4;
- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
+ for (i = 0; i < g_linux_wlan->vif_num; i++) {
if (!memcmp(Bssid1, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN) ||
!memcmp(Bssid, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN)) {
return g_linux_wlan->strInterfaceInfo[i].wilc_netdev;
@@ -377,7 +377,7 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
PRINT_D(INIT_DBG, "%02x ", pMacHeader[i]);
Bssid = pMacHeader + 18;
Bssid1 = pMacHeader + 12;
- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
+ for (i = 0; i < g_linux_wlan->vif_num; i++) {
if (!memcmp(Bssid1, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN) ||
!memcmp(Bssid, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN)) {
PRINT_D(INIT_DBG, "Ctx [%p]\n", g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
@@ -394,7 +394,7 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID)
int ret = -1;
PRINT_D(INIT_DBG, "set bssid on[%p]\n", wilc_netdev);
- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
+ for (i = 0; i < g_linux_wlan->vif_num; i++) {
if (g_linux_wlan->strInterfaceInfo[i].wilc_netdev == wilc_netdev) {
PRINT_D(INIT_DBG, "set bssid [%x][%x][%x]\n", pBSSID[0], pBSSID[1], pBSSID[2]);
memcpy(g_linux_wlan->strInterfaceInfo[i].aBSSID, pBSSID, 6);
@@ -412,7 +412,7 @@ int linux_wlan_get_num_conn_ifcs(void)
u8 null_bssid[6] = {0};
u8 ret_val = 0;
- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
+ for (i = 0; i < g_linux_wlan->vif_num; i++) {
if (memcmp(g_linux_wlan->strInterfaceInfo[i].aBSSID, null_bssid, 6))
ret_val++;
}
@@ -1316,7 +1316,7 @@ 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->u8NoIfcs; i++) {
+ for (i = 0; i < g_linux_wlan->vif_num; i++) {
if (ndev == g_linux_wlan->strInterfaceInfo[i].wilc_netdev) {
memcpy(g_linux_wlan->strInterfaceInfo[i].aSrcAddress, mac_add, ETH_ALEN);
g_linux_wlan->strInterfaceInfo[i].drvHandler = priv->hWILCWFIDrv;
@@ -1687,7 +1687,7 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
/*Pass the frame on the monitor interface, if any.*/
/*Otherwise, pass it on p2p0 netdev, if registered on it*/
- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
+ for (i = 0; i < g_linux_wlan->vif_num; i++) {
nic = netdev_priv(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
if (nic->monitor_flag) {
WILC_WFI_monitor_rx(buff, size);
@@ -1740,10 +1740,10 @@ int wilc_netdev_init(void)
} else
strcpy(ndev->name, "p2p%d");
- nic->u8IfIdx = g_linux_wlan->u8NoIfcs;
+ nic->u8IfIdx = g_linux_wlan->vif_num;
nic->wilc_netdev = ndev;
- g_linux_wlan->strInterfaceInfo[g_linux_wlan->u8NoIfcs].wilc_netdev = ndev;
- g_linux_wlan->u8NoIfcs++;
+ g_linux_wlan->strInterfaceInfo[g_linux_wlan->vif_num].wilc_netdev = 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 863571a..a3f18b5 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -162,7 +162,7 @@ struct wilc {
unsigned short dev_irq_num;
#endif
int close;
- u8 u8NoIfcs;
+ u8 vif_num;
struct wilc_vif strInterfaceInfo[NUM_CONCURRENT_IFC];
u8 open_ifcs;
--
1.9.1
This patch renames wilc_firmware in the struct wilc to the firmware. In
addition, null assignments to the wl->firmware after release_firmware
are removed because it is not necessary.
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 15 +++++++--------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 74b7cc0..16b1d80 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -537,7 +537,7 @@ int linux_wlan_get_firmware(perInterface_wlan_t *p_nic)
goto _fail_;
}
#endif
- g_linux_wlan->wilc_firmware = wilc_firmware;
+ g_linux_wlan->firmware = wilc_firmware;
_fail_:
@@ -594,7 +594,7 @@ static int linux_wlan_firmware_download(struct wilc *p_nic)
int ret = 0;
- if (g_linux_wlan->wilc_firmware == NULL) {
+ if (!g_linux_wlan->firmware) {
PRINT_ER("Firmware buffer is NULL\n");
ret = -ENOBUFS;
goto _FAIL_;
@@ -603,16 +603,15 @@ static int linux_wlan_firmware_download(struct wilc *p_nic)
* do the firmware download
**/
PRINT_D(INIT_DBG, "Downloading Firmware ...\n");
- ret = wilc_wlan_firmware_download(g_linux_wlan->wilc_firmware->data,
- g_linux_wlan->wilc_firmware->size);
+ ret = wilc_wlan_firmware_download(g_linux_wlan->firmware->data,
+ g_linux_wlan->firmware->size);
if (ret < 0)
goto _FAIL_;
/* Freeing FW buffer */
PRINT_D(INIT_DBG, "Freeing FW buffer ...\n");
PRINT_D(INIT_DBG, "Releasing firmware\n");
- release_firmware(g_linux_wlan->wilc_firmware);
- g_linux_wlan->wilc_firmware = NULL;
+ release_firmware(g_linux_wlan->firmware);
PRINT_D(INIT_DBG, "Download Succeeded\n");
@@ -1709,8 +1708,8 @@ void wl_wlan_cleanup(void)
nic[i] = netdev_priv(g_linux_wlan->vif[i].ndev);
}
- if (g_linux_wlan && g_linux_wlan->wilc_firmware)
- release_firmware(g_linux_wlan->wilc_firmware);
+ if (g_linux_wlan && g_linux_wlan->firmware)
+ release_firmware(g_linux_wlan->firmware);
if (g_linux_wlan &&
(g_linux_wlan->vif[0].ndev || g_linux_wlan->vif[1].ndev)) {
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index b410424..74eb7b6 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -182,7 +182,7 @@ struct wilc {
unsigned char eth_src_address[NUM_CONCURRENT_IFC][6];
- const struct firmware *wilc_firmware;
+ const struct firmware *firmware;
#ifdef WILC_SDIO
struct sdio_func *wilc_sdio_func;
--
1.9.1
This patch changes the type of wilc1000_initialized in the struc wilc from int
to bool and also renames it to the initialized. In addition, unnecessary
wilc1000_initialized codes are removed in this patch.
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 13 +++++--------
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 15 +++++++--------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
3 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index b879b8b..191851b 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -884,9 +884,7 @@ _fail_:
/**************************/
void wilc1000_wlan_deinit(struct wilc *nic)
{
-
- if (g_linux_wlan->wilc1000_initialized) {
-
+ if (g_linux_wlan->initialized) {
printk("Deinitializing wilc1000 ...\n");
if (nic == NULL) {
@@ -935,7 +933,7 @@ void wilc1000_wlan_deinit(struct wilc *nic)
wlan_deinit_locks(g_linux_wlan);
/* announce that wilc1000 is not initialized */
- g_linux_wlan->wilc1000_initialized = 0;
+ g_linux_wlan->initialized = false;
PRINT_D(INIT_DBG, "wilc1000 deinitialization Done\n");
@@ -1143,10 +1141,9 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
perInterface_wlan_t *nic = p_nic;
int ret = 0;
- if (!g_linux_wlan->wilc1000_initialized) {
+ if (!g_linux_wlan->initialized) {
g_linux_wlan->mac_status = WILC_MAC_STATUS_INIT;
g_linux_wlan->close = 0;
- g_linux_wlan->wilc1000_initialized = 0;
wlan_init_locks(g_linux_wlan);
@@ -1233,7 +1230,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
goto _fail_fw_start_;
}
- g_linux_wlan->wilc1000_initialized = 1;
+ g_linux_wlan->initialized = true;
return 0; /*success*/
_fail_fw_start_:
@@ -1567,7 +1564,7 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
/* struct iwreq *wrq = (struct iwreq *) req; // tony moved to case SIOCSIWPRIV */
nic = netdev_priv(ndev);
- if (!g_linux_wlan->wilc1000_initialized)
+ if (!g_linux_wlan->initialized)
return 0;
switch (cmd) {
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index bcbf1bd..e463090 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2418,7 +2418,7 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
}
/*If mac is closed, then return*/
- if (!g_linux_wlan->wilc1000_initialized) {
+ if (!g_linux_wlan->initialized) {
PRINT_D(GENERIC_DBG, "Return since mac is closed\n");
return;
}
@@ -2571,7 +2571,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
interface_type = nic->iftype;
nic->iftype = STATION_MODE;
- if (g_linux_wlan->wilc1000_initialized) {
+ if (g_linux_wlan->initialized) {
host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->strInterfaceInfo[0].aBSSID, TID);
/* ensure that the message Q is empty */
host_int_wait_msg_queue_idle();
@@ -2627,7 +2627,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
(struct key_params *)(&g_key_gtk_params));
}
- if (g_linux_wlan->wilc1000_initialized) {
+ if (g_linux_wlan->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);
@@ -2658,7 +2658,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
nic->iftype = CLIENT_MODE;
- if (g_linux_wlan->wilc1000_initialized) {
+ if (g_linux_wlan->initialized) {
/* ensure that the message Q is empty */
host_int_wait_msg_queue_idle();
@@ -2712,7 +2712,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->wilc1000_initialized) {
+ if (g_linux_wlan->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,9 +2735,8 @@ 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->wilc1000_initialized) {
+ if (g_linux_wlan->initialized) {
nic->iftype = AP_MODE;
- g_linux_wlan->wilc1000_initialized = 1;
mac_close(dev);
mac_open(dev);
@@ -2826,7 +2825,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
(struct key_params *)(&g_key_gtk_params));
}
- if (g_linux_wlan->wilc1000_initialized) {
+ if (g_linux_wlan->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);
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index c5061fd..863571a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -157,7 +157,7 @@ struct wilc_vif {
struct wilc {
int mac_status;
- int wilc1000_initialized;
+ bool initialized;
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
unsigned short dev_irq_num;
#endif
--
1.9.1
This patch renames drvHandler in the struct wilc_vif to the hif_drv.
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 2 +-
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 24 +++++++++++------------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 493e02c..11e26fb 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1314,7 +1314,7 @@ int mac_open(struct net_device *ndev)
for (i = 0; i < g_linux_wlan->vif_num; i++) {
if (ndev == g_linux_wlan->vif[i].wilc_netdev) {
memcpy(g_linux_wlan->vif[i].src_addr, mac_add, ETH_ALEN);
- g_linux_wlan->vif[i].drvHandler = priv->hWILCWFIDrv;
+ g_linux_wlan->vif[i].hif_drv = priv->hWILCWFIDrv;
break;
}
}
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index c166d3f..2dfc0fd 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2585,16 +2585,16 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
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].drvHandler);
- host_int_set_MacAddress(g_linux_wlan->vif[0].drvHandler,
+ 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_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].drvHandler,
+ host_int_set_WEPDefaultKeyID(g_linux_wlan->vif[0].hif_drv,
g_key_wep_params.key_idx);
- host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].drvHandler,
+ host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].hif_drv,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
@@ -2666,16 +2666,16 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wilc1000_wlan_init(dev, nic);
g_wilc_initialized = 1;
- host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].drvHandler);
- host_int_set_MacAddress(g_linux_wlan->vif[0].drvHandler,
+ 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_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].drvHandler,
+ host_int_set_WEPDefaultKeyID(g_linux_wlan->vif[0].hif_drv,
g_key_wep_params.key_idx);
- host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].drvHandler,
+ host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].hif_drv,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
@@ -2781,16 +2781,16 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
/*Setting interface 1 drv handler and mac address in newly downloaded FW*/
- host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].drvHandler);
- host_int_set_MacAddress(g_linux_wlan->vif[0].drvHandler,
+ 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_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].drvHandler,
+ host_int_set_WEPDefaultKeyID(g_linux_wlan->vif[0].hif_drv,
g_key_wep_params.key_idx);
- host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].drvHandler,
+ host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].hif_drv,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 6ac9328..521d3cb 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -151,7 +151,7 @@ typedef struct {
struct wilc_vif {
u8 src_addr[ETH_ALEN];
u8 bssid[ETH_ALEN];
- struct host_if_drv *drvHandler;
+ struct host_if_drv *hif_drv;
struct net_device *wilc_netdev;
};
--
1.9.1
This patch moves clean up codes from exit_wilc_driver into the wl_wlan_cleanup
newly introduced in this patch. In addition, it is called by linux_sdio_remove
function.
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 95 ++++++++++++---------------
drivers/staging/wilc1000/linux_wlan_sdio.c | 5 +-
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
3 files changed, 43 insertions(+), 59 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 41a2f09..74b7cc0 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1696,6 +1696,47 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
WILC_WFI_p2p_rx(g_linux_wlan->vif[1].ndev, buff, size);
}
+void wl_wlan_cleanup(void)
+{
+ int i = 0;
+ perInterface_wlan_t *nic[NUM_CONCURRENT_IFC];
+
+ if (g_linux_wlan &&
+ (g_linux_wlan->vif[0].ndev || g_linux_wlan->vif[1].ndev)) {
+ unregister_inetaddr_notifier(&g_dev_notifier);
+
+ for (i = 0; i < NUM_CONCURRENT_IFC; i++)
+ nic[i] = netdev_priv(g_linux_wlan->vif[i].ndev);
+ }
+
+ if (g_linux_wlan && g_linux_wlan->wilc_firmware)
+ release_firmware(g_linux_wlan->wilc_firmware);
+
+ if (g_linux_wlan &&
+ (g_linux_wlan->vif[0].ndev || g_linux_wlan->vif[1].ndev)) {
+ linux_wlan_lock_timeout(&close_exit_sync, 12 * 1000);
+
+ for (i = 0; i < NUM_CONCURRENT_IFC; i++)
+ if (g_linux_wlan->vif[i].ndev)
+ if (nic[i]->mac_opened)
+ mac_close(g_linux_wlan->vif[i].ndev);
+
+ for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
+ unregister_netdev(g_linux_wlan->vif[i].ndev);
+ wilc_free_wiphy(g_linux_wlan->vif[i].ndev);
+ free_netdev(g_linux_wlan->vif[i].ndev);
+ }
+ }
+
+ kfree(g_linux_wlan);
+
+#if defined(WILC_DEBUGFS)
+ wilc_debugfs_remove();
+#endif
+ linux_wlan_device_detection(0);
+ linux_wlan_device_power(0);
+}
+
int wilc_netdev_init(void)
{
@@ -1828,49 +1869,6 @@ late_initcall(init_wilc_driver);
static void __exit exit_wilc_driver(void)
{
- int i = 0;
- perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
- #define CLOSE_TIMEOUT (12 * 1000)
-
- if ((g_linux_wlan != NULL) && (((g_linux_wlan->vif[0].ndev) != NULL)
- || ((g_linux_wlan->vif[1].ndev) != NULL))) {
- unregister_inetaddr_notifier(&g_dev_notifier);
-
- for (i = 0; i < NUM_CONCURRENT_IFC; i++)
- nic[i] = netdev_priv(g_linux_wlan->vif[i].ndev);
- }
-
- if ((g_linux_wlan != NULL) && g_linux_wlan->wilc_firmware != NULL) {
- release_firmware(g_linux_wlan->wilc_firmware);
- g_linux_wlan->wilc_firmware = NULL;
- }
-
- if ((g_linux_wlan != NULL) && (((g_linux_wlan->vif[0].ndev) != NULL)
- || ((g_linux_wlan->vif[1].ndev) != NULL))) {
- PRINT_D(INIT_DBG, "Waiting for mac_close ....\n");
-
- if (linux_wlan_lock_timeout(&close_exit_sync, CLOSE_TIMEOUT) < 0)
- PRINT_D(INIT_DBG, "Closed TimedOUT\n");
- else
- PRINT_D(INIT_DBG, "mac_closed\n");
-
- for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
- /* close all opened interfaces */
- if (g_linux_wlan->vif[i].ndev != NULL) {
- if (nic[i]->mac_opened)
- mac_close(g_linux_wlan->vif[i].ndev);
- }
- }
- for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
- PRINT_D(INIT_DBG, "Unregistering netdev %p\n", g_linux_wlan->vif[i].ndev);
- unregister_netdev(g_linux_wlan->vif[i].ndev);
- PRINT_D(INIT_DBG, "Freeing Wiphy...\n");
- wilc_free_wiphy(g_linux_wlan->vif[i].ndev);
- PRINT_D(INIT_DBG, "Freeing netdev...\n");
- free_netdev(g_linux_wlan->vif[i].ndev);
- }
- }
-
#ifndef WILC_SDIO
PRINT_D(INIT_DBG, "SPI unregsiter...\n");
spi_unregister_driver(&wilc_bus);
@@ -1878,17 +1876,6 @@ static void __exit exit_wilc_driver(void)
PRINT_D(INIT_DBG, "SDIO unregsiter...\n");
sdio_unregister_driver(&wilc_bus);
#endif
-
- kfree(g_linux_wlan);
- g_linux_wlan = NULL;
- printk("Module_exit Done.\n");
-
-#if defined(WILC_DEBUGFS)
- wilc_debugfs_remove();
-#endif
-
- linux_wlan_device_detection(0);
- linux_wlan_device_power(0);
}
module_exit(exit_wilc_driver);
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index ebacd29..e5764fc 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -136,10 +136,7 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
static void linux_sdio_remove(struct sdio_func *func)
{
- /**
- * TODO
- **/
-
+ wl_wlan_cleanup();
}
struct sdio_driver wilc_bus = {
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 429b654..b410424 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -213,5 +213,5 @@ void linux_wlan_mac_indicate(int flag);
void linux_wlan_rx_complete(void);
void linux_wlan_dbg(u8 *buff);
int linux_wlan_lock_timeout(void *vp, u32 timeout);
-
+void wl_wlan_cleanup(void);
#endif
--
1.9.1
This patch removes a preprocessor definition, COMPLEMENT_BOOT which is not used
anymore. This is just workaround to avoid weird issue, which is that 11b core
is not ready after the power is givin to the chip. However, this issue happened
only in the unstable hardware a long time ago and no more seen. In addition,
this patch removes _fail_threads_ statement to avoid the build warning after
removing COMPLEMENT_BOOT conditionals.
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 132 ++---------------------------
drivers/staging/wilc1000/linux_wlan_sdio.c | 9 --
drivers/staging/wilc1000/wilc_wlan.c | 18 ----
3 files changed, 8 insertions(+), 151 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 16b1d80..3cad5b6 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -545,10 +545,6 @@ _fail_:
}
-#ifdef COMPLEMENT_BOOT
-int repeat_power_cycle(perInterface_wlan_t *nic);
-#endif
-
static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
{
@@ -565,18 +561,6 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n");
ret = linux_wlan_lock_timeout(&g_linux_wlan->sync_event, 5000);
if (ret) {
-#ifdef COMPLEMENT_BOOT
- static int timeout = 5;
-
- if (timeout--) {
- PRINT_D(INIT_DBG, "repeat power cycle[%d]", timeout);
- ret = repeat_power_cycle(nic);
- } else {
- timeout = 5;
- ret = -1;
- goto _fail_;
- }
-#endif
PRINT_D(INIT_DBG, "Firmware start timed out");
goto _fail_;
}
@@ -1038,97 +1022,6 @@ static void wlan_deinitialize_threads(struct wilc *nic)
}
}
-#ifdef COMPLEMENT_BOOT
-
-extern volatile int probe;
-extern u8 core_11b_ready(void);
-
-#define READY_CHECK_THRESHOLD 30
-extern void wilc_wlan_global_reset(void);
-u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
-{
- u8 trials = 0;
-
- while ((core_11b_ready() && (READY_CHECK_THRESHOLD > (trials++)))) {
- PRINT_D(INIT_DBG, "11b core not ready yet: %u\n", trials);
- wilc_wlan_cleanup();
- wilc_wlan_global_reset();
- sdio_unregister_driver(&wilc_bus);
-
- linux_wlan_device_detection(0);
-
- mdelay(100);
-
- linux_wlan_device_detection(1);
-
- sdio_register_driver(&wilc_bus);
-
- while (!probe)
- msleep(100);
- probe = 0;
- g_linux_wlan->wilc_sdio_func = local_sdio_func;
- linux_to_wlan(nwi, nic);
- wilc_wlan_init(nwi);
- }
-
- if (READY_CHECK_THRESHOLD <= trials)
- return 1;
- else
- return 0;
-
-}
-
-int repeat_power_cycle(perInterface_wlan_t *nic)
-{
- int ret = 0;
- wilc_wlan_inp_t nwi;
-
- sdio_unregister_driver(&wilc_bus);
-
- linux_wlan_device_detection(0);
- linux_wlan_device_power(0);
- msleep(100);
- linux_wlan_device_power(1);
- msleep(80);
- linux_wlan_device_detection(1);
- msleep(20);
-
- sdio_register_driver(&wilc_bus);
-
- /* msleep(1000); */
- while (!probe)
- msleep(100);
- probe = 0;
- g_linux_wlan->wilc_sdio_func = local_sdio_func;
- linux_to_wlan(&nwi, g_linux_wlan);
- ret = wilc_wlan_init(&nwi);
-
- g_linux_wlan->mac_status = WILC_MAC_STATUS_INIT;
- #if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
- enable_sdio_interrupt();
- #endif
-
- if (linux_wlan_get_firmware(nic)) {
- PRINT_ER("Can't get firmware\n");
- ret = -1;
- goto __fail__;
- }
-
- /*Download firmware*/
- ret = linux_wlan_firmware_download(g_linux_wlan);
- if (ret < 0) {
- PRINT_ER("Failed to download firmware\n");
- goto __fail__;
- }
- /* Start firmware*/
- ret = linux_wlan_start_firmware(nic);
- if (ret < 0)
- PRINT_ER("Failed to start firmware\n");
-__fail__:
- return ret;
-}
-#endif
-
int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
{
wilc_wlan_inp_t nwi;
@@ -1150,29 +1043,21 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
goto _fail_locks_;
}
- ret = wlan_initialize_threads(nic);
- if (ret < 0) {
- PRINT_ER("Initializing Threads FAILED\n");
- ret = -EIO;
- goto _fail_wilc_wlan_;
- }
-
-#if (defined WILC_SDIO) && (defined COMPLEMENT_BOOT)
- if (wilc1000_prepare_11b_core(&nwi, g_linux_wlan)) {
- PRINT_ER("11b Core is not ready\n");
- ret = -EIO;
- goto _fail_threads_;
- }
-#endif
-
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
if (init_irq(g_linux_wlan)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
- goto _fail_threads_;
+ goto _fail_locks_;
}
#endif
+ ret = wlan_initialize_threads(nic);
+ if (ret < 0) {
+ PRINT_ER("Initializing Threads FAILED\n");
+ ret = -EIO;
+ goto _fail_wilc_wlan_;
+ }
+
#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
if (enable_sdio_interrupt()) {
PRINT_ER("couldn't initialize IRQ\n");
@@ -1239,7 +1124,6 @@ _fail_irq_init_:
deinit_irq(g_linux_wlan);
#endif
-_fail_threads_:
wlan_deinitialize_threads(g_linux_wlan);
_fail_wilc_wlan_:
wilc_wlan_cleanup();
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index e5764fc..1bd7f9b 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -110,19 +110,10 @@ int linux_sdio_cmd53(sdio_cmd53_t *cmd)
return 1;
}
-volatile int probe; /* COMPLEMENT_BOOT */
static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
{
PRINT_D(INIT_DBG, "probe function\n");
-#ifdef COMPLEMENT_BOOT
- if (local_sdio_func != NULL) {
- local_sdio_func = func;
- probe = 1;
- PRINT_D(INIT_DBG, "local_sdio_func isn't NULL\n");
- return 0;
- }
-#endif
PRINT_D(INIT_DBG, "Initializing netdev\n");
local_sdio_func = func;
if (wilc_netdev_init()) {
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index c731641..67b0c52 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1919,24 +1919,6 @@ _fail_:
return chipid;
}
-#ifdef COMPLEMENT_BOOT
-u8 core_11b_ready(void)
-{
- u32 reg_val;
-
- acquire_bus(ACQUIRE_ONLY);
- g_wlan.hif_func.hif_write_reg(0x16082c, 1);
- g_wlan.hif_func.hif_write_reg(0x161600, 0x90);
- g_wlan.hif_func.hif_read_reg(0x161600, ®_val);
- release_bus(RELEASE_ONLY);
-
- if (reg_val == 0x90)
- return 0;
- else
- return 1;
-}
-#endif
-
int wilc_wlan_init(wilc_wlan_inp_t *inp)
{
--
1.9.1
Don't resend the series though. Please fix it in a later patch.
regards,
dan carpenter
On Tue, Oct 20, 2015 at 02:26:47PM +0900, Tony Cho wrote:
> This patch renames strInterfaceInfo in the struct wilc to the vif. In
> addition, unnecessary print statements around it are removed in this patch.
>
> Signed-off-by: Tony Cho <[email protected]>
> ---
> drivers/staging/wilc1000/linux_wlan.c | 91 +++++++++++------------
> drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 72 +++++++++---------
> drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
> 3 files changed, 80 insertions(+), 85 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
> index 2bea103..971b99a 100644
> --- a/drivers/staging/wilc1000/linux_wlan.c
> +++ b/drivers/staging/wilc1000/linux_wlan.c
> @@ -366,24 +366,21 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
> Bssid = pMacHeader + 10;
> Bssid1 = pMacHeader + 4;
>
> - for (i = 0; i < g_linux_wlan->vif_num; i++) {
> - if (!memcmp(Bssid1, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN) ||
> - !memcmp(Bssid, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN)) {
> - return g_linux_wlan->strInterfaceInfo[i].wilc_netdev;
> - }
> - }
> + for (i = 0; i < g_linux_wlan->vif_num; i++)
> + if (!memcmp(Bssid1, g_linux_wlan->vif[i].aBSSID, ETH_ALEN) ||
> + !memcmp(Bssid, g_linux_wlan->vif[i].aBSSID, ETH_ALEN))
> + return g_linux_wlan->vif[i].wilc_netdev;
> +
Removing the curly braces was wrong. Multi-line indents get curly
braces for readability even though the compiler does not insist on them.
regards,
dan carpenter
This patch renames aBSSID in the struct wilc_vif to the bssid.
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 14 +++++++-------
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++---
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 9d57962..493e02c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -367,8 +367,8 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
Bssid1 = pMacHeader + 4;
for (i = 0; i < g_linux_wlan->vif_num; i++)
- if (!memcmp(Bssid1, g_linux_wlan->vif[i].aBSSID, ETH_ALEN) ||
- !memcmp(Bssid, g_linux_wlan->vif[i].aBSSID, ETH_ALEN))
+ if (!memcmp(Bssid1, g_linux_wlan->vif[i].bssid, ETH_ALEN) ||
+ !memcmp(Bssid, g_linux_wlan->vif[i].bssid, ETH_ALEN))
return g_linux_wlan->vif[i].wilc_netdev;
PRINT_INFO(INIT_DBG, "Invalide handle\n");
@@ -377,8 +377,8 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
Bssid = pMacHeader + 18;
Bssid1 = pMacHeader + 12;
for (i = 0; i < g_linux_wlan->vif_num; i++)
- if (!memcmp(Bssid1, g_linux_wlan->vif[i].aBSSID, ETH_ALEN) ||
- !memcmp(Bssid, g_linux_wlan->vif[i].aBSSID, ETH_ALEN))
+ if (!memcmp(Bssid1, g_linux_wlan->vif[i].bssid, ETH_ALEN) ||
+ !memcmp(Bssid, g_linux_wlan->vif[i].bssid, ETH_ALEN))
return g_linux_wlan->vif[i].wilc_netdev;
PRINT_INFO(INIT_DBG, "\n");
@@ -392,7 +392,7 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID)
for (i = 0; i < g_linux_wlan->vif_num; i++)
if (g_linux_wlan->vif[i].wilc_netdev == wilc_netdev) {
- memcpy(g_linux_wlan->vif[i].aBSSID, pBSSID, 6);
+ memcpy(g_linux_wlan->vif[i].bssid, pBSSID, 6);
ret = 0;
break;
}
@@ -408,7 +408,7 @@ int linux_wlan_get_num_conn_ifcs(void)
u8 ret_val = 0;
for (i = 0; i < g_linux_wlan->vif_num; i++)
- if (memcmp(g_linux_wlan->vif[i].aBSSID, null_bssid, 6))
+ if (memcmp(g_linux_wlan->vif[i].bssid, null_bssid, 6))
ret_val++;
return ret_val;
@@ -1472,7 +1472,7 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
nic->netstats.tx_packets++;
nic->netstats.tx_bytes += tx_data->size;
- tx_data->pBssid = g_linux_wlan->vif[nic->u8IfIdx].aBSSID;
+ tx_data->pBssid = g_linux_wlan->vif[nic->u8IfIdx].bssid;
QueueCount = wilc_wlan_txq_add_net_pkt((void *)tx_data, tx_data->buff,
tx_data->size,
linux_wlan_tx_complete);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index b39ea18..c166d3f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2572,7 +2572,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
nic->iftype = STATION_MODE;
if (g_linux_wlan->initialized) {
- host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->vif[0].aBSSID, TID);
+ host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->vif[0].bssid, TID);
/* ensure that the message Q is empty */
host_int_wait_msg_queue_idle();
@@ -2648,7 +2648,7 @@ 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].aBSSID, TID);
+ host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->vif[0].bssid, TID);
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
@@ -2760,7 +2760,7 @@ 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].aBSSID, TID);
+ host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->vif[0].bssid, TID);
bEnablePS = false;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n");
dev->ieee80211_ptr->iftype = type;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 3089129..6ac9328 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -150,7 +150,7 @@ typedef struct {
struct wilc_vif {
u8 src_addr[ETH_ALEN];
- u8 aBSSID[ETH_ALEN];
+ u8 bssid[ETH_ALEN];
struct host_if_drv *drvHandler;
struct net_device *wilc_netdev;
};
--
1.9.1
This patch introduces struct wilc_sdio for sdio driver data. The wilc_sdio is
allocated and set as driver data when the sdio is probed and deallocated when
the sdio is removed.
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan_sdio.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 1bd7f9b..9a45871 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -21,6 +21,10 @@
#define MAX_SPEED (6 * 1000000) /* Max 50M */
#endif
+struct wilc_sdio {
+ struct sdio_func *func;
+ struct wilc *wilc;
+};
struct sdio_func *local_sdio_func;
extern int wilc_netdev_init(void);
@@ -112,14 +116,22 @@ int linux_sdio_cmd53(sdio_cmd53_t *cmd)
static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
{
+ struct wilc_sdio *wl_sdio;
+
PRINT_D(INIT_DBG, "probe function\n");
+ wl_sdio = kzalloc(sizeof(struct wilc_sdio), GFP_KERNEL);
+ if (!wl_sdio)
+ return -ENOMEM;
PRINT_D(INIT_DBG, "Initializing netdev\n");
local_sdio_func = func;
if (wilc_netdev_init()) {
PRINT_ER("Couldn't initialize netdev\n");
+ kfree(wl_sdio);
return -1;
}
+ wl_sdio->func = func;
+ sdio_set_drvdata(func, wl_sdio);
printk("Driver Initializing success\n");
return 0;
@@ -127,7 +139,11 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
static void linux_sdio_remove(struct sdio_func *func)
{
+ struct wilc_sdio *wl_sdio;
+
+ wl_sdio = sdio_get_drvdata(func);
wl_wlan_cleanup();
+ kfree(wl_sdio);
}
struct sdio_driver wilc_bus = {
--
1.9.1
Thanks for your review.
I will do it later as you mentioned.
Tony.
On 2015년 10월 22일 20:19, Dan Carpenter wrote:
> Don't resend the series though. Please fix it in a later patch.
>
> regards,
> dan carpenter
This patch renames strInterfaceInfo in the struct wilc to the vif. In
addition, unnecessary print statements around it are removed in this patch.
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 91 +++++++++++------------
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 72 +++++++++---------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
3 files changed, 80 insertions(+), 85 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 2bea103..971b99a 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -366,24 +366,21 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
Bssid = pMacHeader + 10;
Bssid1 = pMacHeader + 4;
- for (i = 0; i < g_linux_wlan->vif_num; i++) {
- if (!memcmp(Bssid1, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN) ||
- !memcmp(Bssid, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN)) {
- return g_linux_wlan->strInterfaceInfo[i].wilc_netdev;
- }
- }
+ for (i = 0; i < g_linux_wlan->vif_num; i++)
+ if (!memcmp(Bssid1, g_linux_wlan->vif[i].aBSSID, ETH_ALEN) ||
+ !memcmp(Bssid, g_linux_wlan->vif[i].aBSSID, ETH_ALEN))
+ return g_linux_wlan->vif[i].wilc_netdev;
+
PRINT_INFO(INIT_DBG, "Invalide handle\n");
for (i = 0; i < 25; i++)
PRINT_D(INIT_DBG, "%02x ", pMacHeader[i]);
Bssid = pMacHeader + 18;
Bssid1 = pMacHeader + 12;
- for (i = 0; i < g_linux_wlan->vif_num; i++) {
- if (!memcmp(Bssid1, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN) ||
- !memcmp(Bssid, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN)) {
- PRINT_D(INIT_DBG, "Ctx [%p]\n", g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
- return g_linux_wlan->strInterfaceInfo[i].wilc_netdev;
- }
- }
+ for (i = 0; i < g_linux_wlan->vif_num; i++)
+ if (!memcmp(Bssid1, g_linux_wlan->vif[i].aBSSID, ETH_ALEN) ||
+ !memcmp(Bssid, g_linux_wlan->vif[i].aBSSID, ETH_ALEN))
+ return g_linux_wlan->vif[i].wilc_netdev;
+
PRINT_INFO(INIT_DBG, "\n");
return NULL;
}
@@ -393,15 +390,13 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID)
int i = 0;
int ret = -1;
- PRINT_D(INIT_DBG, "set bssid on[%p]\n", wilc_netdev);
- for (i = 0; i < g_linux_wlan->vif_num; i++) {
- if (g_linux_wlan->strInterfaceInfo[i].wilc_netdev == wilc_netdev) {
- PRINT_D(INIT_DBG, "set bssid [%x][%x][%x]\n", pBSSID[0], pBSSID[1], pBSSID[2]);
- memcpy(g_linux_wlan->strInterfaceInfo[i].aBSSID, pBSSID, 6);
+ for (i = 0; i < g_linux_wlan->vif_num; i++)
+ if (g_linux_wlan->vif[i].wilc_netdev == wilc_netdev) {
+ memcpy(g_linux_wlan->vif[i].aBSSID, pBSSID, 6);
ret = 0;
break;
}
- }
+
return ret;
}
@@ -412,10 +407,10 @@ int linux_wlan_get_num_conn_ifcs(void)
u8 null_bssid[6] = {0};
u8 ret_val = 0;
- for (i = 0; i < g_linux_wlan->vif_num; i++) {
- if (memcmp(g_linux_wlan->strInterfaceInfo[i].aBSSID, null_bssid, 6))
+ for (i = 0; i < g_linux_wlan->vif_num; i++)
+ if (memcmp(g_linux_wlan->vif[i].aBSSID, null_bssid, 6))
ret_val++;
- }
+
return ret_val;
}
@@ -462,10 +457,10 @@ static int linux_wlan_txq_task(void *vp)
if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD /* && netif_queue_stopped(pd->wilc_netdev)*/) {
PRINT_D(TX_DBG, "Waking up queue\n");
/* netif_wake_queue(pd->wilc_netdev); */
- if (netif_queue_stopped(g_linux_wlan->strInterfaceInfo[0].wilc_netdev))
- netif_wake_queue(g_linux_wlan->strInterfaceInfo[0].wilc_netdev);
- if (netif_queue_stopped(g_linux_wlan->strInterfaceInfo[1].wilc_netdev))
- netif_wake_queue(g_linux_wlan->strInterfaceInfo[1].wilc_netdev);
+ if (netif_queue_stopped(g_linux_wlan->vif[0].wilc_netdev))
+ netif_wake_queue(g_linux_wlan->vif[0].wilc_netdev);
+ if (netif_queue_stopped(g_linux_wlan->vif[1].wilc_netdev))
+ netif_wake_queue(g_linux_wlan->vif[1].wilc_netdev);
}
if (ret == WILC_TX_ERR_NO_BUF) { /* failed to allocate buffers in chip. */
@@ -1317,15 +1312,15 @@ int mac_open(struct net_device *ndev)
/* 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->strInterfaceInfo[i].wilc_netdev) {
- memcpy(g_linux_wlan->strInterfaceInfo[i].aSrcAddress, mac_add, ETH_ALEN);
- g_linux_wlan->strInterfaceInfo[i].drvHandler = priv->hWILCWFIDrv;
+ if (ndev == g_linux_wlan->vif[i].wilc_netdev) {
+ memcpy(g_linux_wlan->vif[i].aSrcAddress, mac_add, ETH_ALEN);
+ g_linux_wlan->vif[i].drvHandler = 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->strInterfaceInfo[i].aSrcAddress, ETH_ALEN);
+ memcpy(ndev->dev_addr, g_linux_wlan->vif[i].aSrcAddress, ETH_ALEN);
if (!is_valid_ether_addr(ndev->dev_addr)) {
PRINT_ER("Error: Wrong MAC address\n");
@@ -1477,14 +1472,14 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
nic->netstats.tx_packets++;
nic->netstats.tx_bytes += tx_data->size;
- tx_data->pBssid = g_linux_wlan->strInterfaceInfo[nic->u8IfIdx].aBSSID;
+ tx_data->pBssid = g_linux_wlan->vif[nic->u8IfIdx].aBSSID;
QueueCount = wilc_wlan_txq_add_net_pkt((void *)tx_data, tx_data->buff,
tx_data->size,
linux_wlan_tx_complete);
if (QueueCount > FLOW_CONTROL_UPPER_THRESHOLD) {
- netif_stop_queue(g_linux_wlan->strInterfaceInfo[0].wilc_netdev);
- netif_stop_queue(g_linux_wlan->strInterfaceInfo[1].wilc_netdev);
+ netif_stop_queue(g_linux_wlan->vif[0].wilc_netdev);
+ netif_stop_queue(g_linux_wlan->vif[1].wilc_netdev);
}
return 0;
@@ -1688,17 +1683,17 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
/*Pass the frame on the monitor interface, if any.*/
/*Otherwise, pass it on p2p0 netdev, if registered on it*/
for (i = 0; i < g_linux_wlan->vif_num; i++) {
- nic = netdev_priv(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
+ nic = netdev_priv(g_linux_wlan->vif[i].wilc_netdev);
if (nic->monitor_flag) {
WILC_WFI_monitor_rx(buff, size);
return;
}
}
- nic = netdev_priv(g_linux_wlan->strInterfaceInfo[1].wilc_netdev); /* p2p0 */
+ nic = netdev_priv(g_linux_wlan->vif[1].wilc_netdev); /* p2p0 */
if ((buff[0] == nic->g_struct_frame_reg[0].frame_type && nic->g_struct_frame_reg[0].reg) ||
(buff[0] == nic->g_struct_frame_reg[1].frame_type && nic->g_struct_frame_reg[1].reg))
- WILC_WFI_p2p_rx(g_linux_wlan->strInterfaceInfo[1].wilc_netdev, buff, size);
+ WILC_WFI_p2p_rx(g_linux_wlan->vif[1].wilc_netdev, buff, size);
}
int wilc_netdev_init(void)
@@ -1742,7 +1737,7 @@ int wilc_netdev_init(void)
nic->u8IfIdx = g_linux_wlan->vif_num;
nic->wilc_netdev = ndev;
- g_linux_wlan->strInterfaceInfo[g_linux_wlan->vif_num].wilc_netdev = ndev;
+ g_linux_wlan->vif[g_linux_wlan->vif_num].wilc_netdev = ndev;
g_linux_wlan->vif_num++;
ndev->netdev_ops = &wilc_netdev_ops;
@@ -1837,12 +1832,12 @@ static void __exit exit_wilc_driver(void)
perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
#define CLOSE_TIMEOUT (12 * 1000)
- if ((g_linux_wlan != NULL) && (((g_linux_wlan->strInterfaceInfo[0].wilc_netdev) != NULL)
- || ((g_linux_wlan->strInterfaceInfo[1].wilc_netdev) != NULL))) {
+ if ((g_linux_wlan != NULL) && (((g_linux_wlan->vif[0].wilc_netdev) != NULL)
+ || ((g_linux_wlan->vif[1].wilc_netdev) != NULL))) {
unregister_inetaddr_notifier(&g_dev_notifier);
for (i = 0; i < NUM_CONCURRENT_IFC; i++)
- nic[i] = netdev_priv(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
+ nic[i] = netdev_priv(g_linux_wlan->vif[i].wilc_netdev);
}
if ((g_linux_wlan != NULL) && g_linux_wlan->wilc_firmware != NULL) {
@@ -1850,8 +1845,8 @@ static void __exit exit_wilc_driver(void)
g_linux_wlan->wilc_firmware = NULL;
}
- if ((g_linux_wlan != NULL) && (((g_linux_wlan->strInterfaceInfo[0].wilc_netdev) != NULL)
- || ((g_linux_wlan->strInterfaceInfo[1].wilc_netdev) != NULL))) {
+ if ((g_linux_wlan != NULL) && (((g_linux_wlan->vif[0].wilc_netdev) != NULL)
+ || ((g_linux_wlan->vif[1].wilc_netdev) != NULL))) {
PRINT_D(INIT_DBG, "Waiting for mac_close ....\n");
if (linux_wlan_lock_timeout(&close_exit_sync, CLOSE_TIMEOUT) < 0)
@@ -1861,18 +1856,18 @@ static void __exit exit_wilc_driver(void)
for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
/* close all opened interfaces */
- if (g_linux_wlan->strInterfaceInfo[i].wilc_netdev != NULL) {
+ if (g_linux_wlan->vif[i].wilc_netdev != NULL) {
if (nic[i]->mac_opened)
- mac_close(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
+ mac_close(g_linux_wlan->vif[i].wilc_netdev);
}
}
for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
- PRINT_D(INIT_DBG, "Unregistering netdev %p\n", g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
- unregister_netdev(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
+ PRINT_D(INIT_DBG, "Unregistering netdev %p\n", g_linux_wlan->vif[i].wilc_netdev);
+ unregister_netdev(g_linux_wlan->vif[i].wilc_netdev);
PRINT_D(INIT_DBG, "Freeing Wiphy...\n");
- wilc_free_wiphy(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
+ wilc_free_wiphy(g_linux_wlan->vif[i].wilc_netdev);
PRINT_D(INIT_DBG, "Freeing netdev...\n");
- free_netdev(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
+ free_netdev(g_linux_wlan->vif[i].wilc_netdev);
}
}
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e463090..f2c8a45 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -624,12 +624,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->strInterfaceInfo[1].wilc_netdev)) {
+ if ((pstrWFIDrv->IFC_UP) && (dev == g_linux_wlan->vif[1].wilc_netdev)) {
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->strInterfaceInfo[1].wilc_netdev)) {
+ else if ((!pstrWFIDrv->IFC_UP) && (dev == g_linux_wlan->vif[1].wilc_netdev)) {
pstrDisconnectNotifInfo->u16reason = 1;
}
cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, pstrDisconnectNotifInfo->ie,
@@ -1255,7 +1255,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->strInterfaceInfo[0].wilc_netdev) {
+ if (!g_gtk_keys_saved && netdev == g_linux_wlan->vif[0].wilc_netdev) {
g_add_gtk_key_params.key_idx = key_index;
g_add_gtk_key_params.pairwise = pairwise;
if (!mac_addr) {
@@ -1291,7 +1291,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->strInterfaceInfo[0].wilc_netdev) {
+ if (!g_ptk_keys_saved && netdev == g_linux_wlan->vif[0].wilc_netdev) {
g_add_ptk_key_params.key_idx = key_index;
g_add_ptk_key_params.pairwise = pairwise;
if (!mac_addr) {
@@ -1356,7 +1356,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
priv = wiphy_priv(wiphy);
/*delete saved keys, if any*/
- if (netdev == g_linux_wlan->strInterfaceInfo[0].wilc_netdev) {
+ if (netdev == g_linux_wlan->vif[0].wilc_netdev) {
g_ptk_keys_saved = false;
g_gtk_keys_saved = false;
g_wep_keys_saved = false;
@@ -2572,7 +2572,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
nic->iftype = STATION_MODE;
if (g_linux_wlan->initialized) {
- host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->strInterfaceInfo[0].aBSSID, TID);
+ host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->vif[0].aBSSID, TID);
/* ensure that the message Q is empty */
host_int_wait_msg_queue_idle();
@@ -2585,16 +2585,16 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
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->strInterfaceInfo[0].drvHandler);
- host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler,
- g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
+ host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].drvHandler);
+ host_int_set_MacAddress(g_linux_wlan->vif[0].drvHandler,
+ g_linux_wlan->vif[0].aSrcAddress);
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->strInterfaceInfo[0].drvHandler,
+ host_int_set_WEPDefaultKeyID(g_linux_wlan->vif[0].drvHandler,
g_key_wep_params.key_idx);
- host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler,
+ host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].drvHandler,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
@@ -2612,15 +2612,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->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
+ add_key(g_linux_wlan->vif[0].wilc_netdev->ieee80211_ptr->wiphy,
+ g_linux_wlan->vif[0].wilc_netdev,
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->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
+ add_key(g_linux_wlan->vif[0].wilc_netdev->ieee80211_ptr->wiphy,
+ g_linux_wlan->vif[0].wilc_netdev,
g_add_gtk_key_params.key_idx,
g_add_gtk_key_params.pairwise,
g_add_gtk_key_params.mac_addr,
@@ -2648,7 +2648,7 @@ 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->strInterfaceInfo[0].aBSSID, TID);
+ host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->vif[0].aBSSID, TID);
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
@@ -2666,16 +2666,16 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wilc1000_wlan_init(dev, nic);
g_wilc_initialized = 1;
- host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler);
- host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler,
- g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
+ host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].drvHandler);
+ host_int_set_MacAddress(g_linux_wlan->vif[0].drvHandler,
+ g_linux_wlan->vif[0].aSrcAddress);
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->strInterfaceInfo[0].drvHandler,
+ host_int_set_WEPDefaultKeyID(g_linux_wlan->vif[0].drvHandler,
g_key_wep_params.key_idx);
- host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler,
+ host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].drvHandler,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
@@ -2693,15 +2693,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->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
+ add_key(g_linux_wlan->vif[0].wilc_netdev->ieee80211_ptr->wiphy,
+ g_linux_wlan->vif[0].wilc_netdev,
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->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
+ add_key(g_linux_wlan->vif[0].wilc_netdev->ieee80211_ptr->wiphy,
+ g_linux_wlan->vif[0].wilc_netdev,
g_add_gtk_key_params.key_idx,
g_add_gtk_key_params.pairwise,
g_add_gtk_key_params.mac_addr,
@@ -2760,7 +2760,7 @@ 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->strInterfaceInfo[0].aBSSID, TID);
+ host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->vif[0].aBSSID, TID);
bEnablePS = false;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n");
dev->ieee80211_ptr->iftype = type;
@@ -2781,16 +2781,16 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
/*Setting interface 1 drv handler and mac address in newly downloaded FW*/
- host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler);
- host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler,
- g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
+ host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].drvHandler);
+ host_int_set_MacAddress(g_linux_wlan->vif[0].drvHandler,
+ g_linux_wlan->vif[0].aSrcAddress);
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->strInterfaceInfo[0].drvHandler,
+ host_int_set_WEPDefaultKeyID(g_linux_wlan->vif[0].drvHandler,
g_key_wep_params.key_idx);
- host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler,
+ host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].drvHandler,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
@@ -2810,15 +2810,15 @@ 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->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
+ add_key(g_linux_wlan->vif[0].wilc_netdev->ieee80211_ptr->wiphy,
+ g_linux_wlan->vif[0].wilc_netdev,
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->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
+ add_key(g_linux_wlan->vif[0].wilc_netdev->ieee80211_ptr->wiphy,
+ g_linux_wlan->vif[0].wilc_netdev,
g_add_gtk_key_params.key_idx,
g_add_gtk_key_params.pairwise,
g_add_gtk_key_params.mac_addr,
@@ -2888,7 +2888,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->strInterfaceInfo[0].aSrcAddress);
+ linux_wlan_set_bssid(dev, g_linux_wlan->vif[0].aSrcAddress);
s32Error = host_int_add_beacon(priv->hWILCWFIDrv,
settings->beacon_interval,
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index a3f18b5..71cd3de 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -163,7 +163,7 @@ struct wilc {
#endif
int close;
u8 vif_num;
- struct wilc_vif strInterfaceInfo[NUM_CONCURRENT_IFC];
+ struct wilc_vif vif[NUM_CONCURRENT_IFC];
u8 open_ifcs;
struct semaphore txq_add_to_head_cs;
--
1.9.1
This patch assigns wl pointer to sdio device data. The global variable
g_linux_wlan will be removed finally.
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 5 +++--
drivers/staging/wilc1000/linux_wlan_sdio.c | 5 +++--
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 +
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 3cad5b6..5701e58 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1620,9 +1620,8 @@ void wl_wlan_cleanup(void)
linux_wlan_device_power(0);
}
-int wilc_netdev_init(void)
+int wilc_netdev_init(struct wilc **wilc)
{
-
int i;
perInterface_wlan_t *nic;
struct net_device *ndev;
@@ -1634,6 +1633,8 @@ int wilc_netdev_init(void)
if (!g_linux_wlan)
return -ENOMEM;
+ *wilc = g_linux_wlan;
+
register_inetaddr_notifier(&g_dev_notifier);
for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 9a45871..1f8d874 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -27,7 +27,6 @@ struct wilc_sdio {
};
struct sdio_func *local_sdio_func;
-extern int wilc_netdev_init(void);
extern void wilc_handle_isr(void);
static unsigned int sdio_default_speed;
@@ -117,6 +116,7 @@ int linux_sdio_cmd53(sdio_cmd53_t *cmd)
static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
{
struct wilc_sdio *wl_sdio;
+ struct wilc *wilc;
PRINT_D(INIT_DBG, "probe function\n");
wl_sdio = kzalloc(sizeof(struct wilc_sdio), GFP_KERNEL);
@@ -125,12 +125,13 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
PRINT_D(INIT_DBG, "Initializing netdev\n");
local_sdio_func = func;
- if (wilc_netdev_init()) {
+ if (wilc_netdev_init(&wilc)) {
PRINT_ER("Couldn't initialize netdev\n");
kfree(wl_sdio);
return -1;
}
wl_sdio->func = func;
+ wl_sdio->wilc = wilc;
sdio_set_drvdata(func, wl_sdio);
printk("Driver Initializing success\n");
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 74eb7b6..e0c66bc 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -214,4 +214,5 @@ void linux_wlan_rx_complete(void);
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);
#endif
--
1.9.1
This patch renames aSrcAddress in the struct wilc_vif to the src_addr.
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 4 ++--
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 ++++----
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 971b99a..9d57962 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1313,14 +1313,14 @@ int mac_open(struct net_device *ndev)
/* 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].wilc_netdev) {
- memcpy(g_linux_wlan->vif[i].aSrcAddress, mac_add, ETH_ALEN);
+ memcpy(g_linux_wlan->vif[i].src_addr, mac_add, ETH_ALEN);
g_linux_wlan->vif[i].drvHandler = 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].aSrcAddress, ETH_ALEN);
+ memcpy(ndev->dev_addr, g_linux_wlan->vif[i].src_addr, ETH_ALEN);
if (!is_valid_ether_addr(ndev->dev_addr)) {
PRINT_ER("Error: Wrong MAC address\n");
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index f2c8a45..b39ea18 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2587,7 +2587,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
/*Setting interface 1 drv handler and mac address in newly downloaded FW*/
host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].drvHandler);
host_int_set_MacAddress(g_linux_wlan->vif[0].drvHandler,
- g_linux_wlan->vif[0].aSrcAddress);
+ g_linux_wlan->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
/*Add saved WEP keys, if any*/
@@ -2668,7 +2668,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].drvHandler);
host_int_set_MacAddress(g_linux_wlan->vif[0].drvHandler,
- g_linux_wlan->vif[0].aSrcAddress);
+ g_linux_wlan->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
/*Add saved WEP keys, if any*/
@@ -2783,7 +2783,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
/*Setting interface 1 drv handler and mac address in newly downloaded FW*/
host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].drvHandler);
host_int_set_MacAddress(g_linux_wlan->vif[0].drvHandler,
- g_linux_wlan->vif[0].aSrcAddress);
+ g_linux_wlan->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, AP_MODE);
/*Add saved WEP keys, if any*/
@@ -2888,7 +2888,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].aSrcAddress);
+ linux_wlan_set_bssid(dev, g_linux_wlan->vif[0].src_addr);
s32Error = host_int_add_beacon(priv->hWILCWFIDrv,
settings->beacon_interval,
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 71cd3de..3089129 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -149,7 +149,7 @@ typedef struct {
} struct_frame_reg;
struct wilc_vif {
- u8 aSrcAddress[ETH_ALEN];
+ u8 src_addr[ETH_ALEN];
u8 aBSSID[ETH_ALEN];
struct host_if_drv *drvHandler;
struct net_device *wilc_netdev;
--
1.9.1
This patch renames wilc_netdev in the struct wilc_vif to the ndev.
Signed-off-by: Tony Cho <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 50 +++++++++++------------
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 34 +++++++--------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
3 files changed, 43 insertions(+), 43 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 11e26fb..41a2f09 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -369,7 +369,7 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
for (i = 0; i < g_linux_wlan->vif_num; i++)
if (!memcmp(Bssid1, g_linux_wlan->vif[i].bssid, ETH_ALEN) ||
!memcmp(Bssid, g_linux_wlan->vif[i].bssid, ETH_ALEN))
- return g_linux_wlan->vif[i].wilc_netdev;
+ return g_linux_wlan->vif[i].ndev;
PRINT_INFO(INIT_DBG, "Invalide handle\n");
for (i = 0; i < 25; i++)
@@ -379,7 +379,7 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
for (i = 0; i < g_linux_wlan->vif_num; i++)
if (!memcmp(Bssid1, g_linux_wlan->vif[i].bssid, ETH_ALEN) ||
!memcmp(Bssid, g_linux_wlan->vif[i].bssid, ETH_ALEN))
- return g_linux_wlan->vif[i].wilc_netdev;
+ return g_linux_wlan->vif[i].ndev;
PRINT_INFO(INIT_DBG, "\n");
return NULL;
@@ -391,7 +391,7 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID)
int ret = -1;
for (i = 0; i < g_linux_wlan->vif_num; i++)
- if (g_linux_wlan->vif[i].wilc_netdev == wilc_netdev) {
+ if (g_linux_wlan->vif[i].ndev == wilc_netdev) {
memcpy(g_linux_wlan->vif[i].bssid, pBSSID, 6);
ret = 0;
break;
@@ -457,10 +457,10 @@ static int linux_wlan_txq_task(void *vp)
if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD /* && netif_queue_stopped(pd->wilc_netdev)*/) {
PRINT_D(TX_DBG, "Waking up queue\n");
/* netif_wake_queue(pd->wilc_netdev); */
- if (netif_queue_stopped(g_linux_wlan->vif[0].wilc_netdev))
- netif_wake_queue(g_linux_wlan->vif[0].wilc_netdev);
- if (netif_queue_stopped(g_linux_wlan->vif[1].wilc_netdev))
- netif_wake_queue(g_linux_wlan->vif[1].wilc_netdev);
+ if (netif_queue_stopped(g_linux_wlan->vif[0].ndev))
+ netif_wake_queue(g_linux_wlan->vif[0].ndev);
+ if (netif_queue_stopped(g_linux_wlan->vif[1].ndev))
+ netif_wake_queue(g_linux_wlan->vif[1].ndev);
}
if (ret == WILC_TX_ERR_NO_BUF) { /* failed to allocate buffers in chip. */
@@ -1312,7 +1312,7 @@ int mac_open(struct net_device *ndev)
/* 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].wilc_netdev) {
+ 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;
break;
@@ -1478,8 +1478,8 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
linux_wlan_tx_complete);
if (QueueCount > FLOW_CONTROL_UPPER_THRESHOLD) {
- netif_stop_queue(g_linux_wlan->vif[0].wilc_netdev);
- netif_stop_queue(g_linux_wlan->vif[1].wilc_netdev);
+ netif_stop_queue(g_linux_wlan->vif[0].ndev);
+ netif_stop_queue(g_linux_wlan->vif[1].ndev);
}
return 0;
@@ -1683,17 +1683,17 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
/*Pass the frame on the monitor interface, if any.*/
/*Otherwise, pass it on p2p0 netdev, if registered on it*/
for (i = 0; i < g_linux_wlan->vif_num; i++) {
- nic = netdev_priv(g_linux_wlan->vif[i].wilc_netdev);
+ nic = netdev_priv(g_linux_wlan->vif[i].ndev);
if (nic->monitor_flag) {
WILC_WFI_monitor_rx(buff, size);
return;
}
}
- nic = netdev_priv(g_linux_wlan->vif[1].wilc_netdev); /* p2p0 */
+ nic = netdev_priv(g_linux_wlan->vif[1].ndev); /* p2p0 */
if ((buff[0] == nic->g_struct_frame_reg[0].frame_type && nic->g_struct_frame_reg[0].reg) ||
(buff[0] == nic->g_struct_frame_reg[1].frame_type && nic->g_struct_frame_reg[1].reg))
- WILC_WFI_p2p_rx(g_linux_wlan->vif[1].wilc_netdev, buff, size);
+ WILC_WFI_p2p_rx(g_linux_wlan->vif[1].ndev, buff, size);
}
int wilc_netdev_init(void)
@@ -1737,7 +1737,7 @@ int wilc_netdev_init(void)
nic->u8IfIdx = g_linux_wlan->vif_num;
nic->wilc_netdev = ndev;
- g_linux_wlan->vif[g_linux_wlan->vif_num].wilc_netdev = ndev;
+ g_linux_wlan->vif[g_linux_wlan->vif_num].ndev = ndev;
g_linux_wlan->vif_num++;
ndev->netdev_ops = &wilc_netdev_ops;
@@ -1832,12 +1832,12 @@ static void __exit exit_wilc_driver(void)
perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
#define CLOSE_TIMEOUT (12 * 1000)
- if ((g_linux_wlan != NULL) && (((g_linux_wlan->vif[0].wilc_netdev) != NULL)
- || ((g_linux_wlan->vif[1].wilc_netdev) != NULL))) {
+ if ((g_linux_wlan != NULL) && (((g_linux_wlan->vif[0].ndev) != NULL)
+ || ((g_linux_wlan->vif[1].ndev) != NULL))) {
unregister_inetaddr_notifier(&g_dev_notifier);
for (i = 0; i < NUM_CONCURRENT_IFC; i++)
- nic[i] = netdev_priv(g_linux_wlan->vif[i].wilc_netdev);
+ nic[i] = netdev_priv(g_linux_wlan->vif[i].ndev);
}
if ((g_linux_wlan != NULL) && g_linux_wlan->wilc_firmware != NULL) {
@@ -1845,8 +1845,8 @@ static void __exit exit_wilc_driver(void)
g_linux_wlan->wilc_firmware = NULL;
}
- if ((g_linux_wlan != NULL) && (((g_linux_wlan->vif[0].wilc_netdev) != NULL)
- || ((g_linux_wlan->vif[1].wilc_netdev) != NULL))) {
+ if ((g_linux_wlan != NULL) && (((g_linux_wlan->vif[0].ndev) != NULL)
+ || ((g_linux_wlan->vif[1].ndev) != NULL))) {
PRINT_D(INIT_DBG, "Waiting for mac_close ....\n");
if (linux_wlan_lock_timeout(&close_exit_sync, CLOSE_TIMEOUT) < 0)
@@ -1856,18 +1856,18 @@ static void __exit exit_wilc_driver(void)
for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
/* close all opened interfaces */
- if (g_linux_wlan->vif[i].wilc_netdev != NULL) {
+ if (g_linux_wlan->vif[i].ndev != NULL) {
if (nic[i]->mac_opened)
- mac_close(g_linux_wlan->vif[i].wilc_netdev);
+ mac_close(g_linux_wlan->vif[i].ndev);
}
}
for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
- PRINT_D(INIT_DBG, "Unregistering netdev %p\n", g_linux_wlan->vif[i].wilc_netdev);
- unregister_netdev(g_linux_wlan->vif[i].wilc_netdev);
+ PRINT_D(INIT_DBG, "Unregistering netdev %p\n", g_linux_wlan->vif[i].ndev);
+ unregister_netdev(g_linux_wlan->vif[i].ndev);
PRINT_D(INIT_DBG, "Freeing Wiphy...\n");
- wilc_free_wiphy(g_linux_wlan->vif[i].wilc_netdev);
+ wilc_free_wiphy(g_linux_wlan->vif[i].ndev);
PRINT_D(INIT_DBG, "Freeing netdev...\n");
- free_netdev(g_linux_wlan->vif[i].wilc_netdev);
+ free_netdev(g_linux_wlan->vif[i].ndev);
}
}
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 2dfc0fd..264fcb9 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -624,12 +624,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].wilc_netdev)) {
+ if ((pstrWFIDrv->IFC_UP) && (dev == g_linux_wlan->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].wilc_netdev)) {
+ else if ((!pstrWFIDrv->IFC_UP) && (dev == g_linux_wlan->vif[1].ndev)) {
pstrDisconnectNotifInfo->u16reason = 1;
}
cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, pstrDisconnectNotifInfo->ie,
@@ -1255,7 +1255,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].wilc_netdev) {
+ if (!g_gtk_keys_saved && netdev == g_linux_wlan->vif[0].ndev) {
g_add_gtk_key_params.key_idx = key_index;
g_add_gtk_key_params.pairwise = pairwise;
if (!mac_addr) {
@@ -1291,7 +1291,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].wilc_netdev) {
+ if (!g_ptk_keys_saved && netdev == g_linux_wlan->vif[0].ndev) {
g_add_ptk_key_params.key_idx = key_index;
g_add_ptk_key_params.pairwise = pairwise;
if (!mac_addr) {
@@ -1356,7 +1356,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
priv = wiphy_priv(wiphy);
/*delete saved keys, if any*/
- if (netdev == g_linux_wlan->vif[0].wilc_netdev) {
+ if (netdev == g_linux_wlan->vif[0].ndev) {
g_ptk_keys_saved = false;
g_gtk_keys_saved = false;
g_wep_keys_saved = false;
@@ -2612,15 +2612,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].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->vif[0].wilc_netdev,
+ add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy,
+ g_linux_wlan->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].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->vif[0].wilc_netdev,
+ add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy,
+ g_linux_wlan->vif[0].ndev,
g_add_gtk_key_params.key_idx,
g_add_gtk_key_params.pairwise,
g_add_gtk_key_params.mac_addr,
@@ -2693,15 +2693,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].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->vif[0].wilc_netdev,
+ add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy,
+ g_linux_wlan->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].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->vif[0].wilc_netdev,
+ add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy,
+ g_linux_wlan->vif[0].ndev,
g_add_gtk_key_params.key_idx,
g_add_gtk_key_params.pairwise,
g_add_gtk_key_params.mac_addr,
@@ -2810,15 +2810,15 @@ 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].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->vif[0].wilc_netdev,
+ add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy,
+ g_linux_wlan->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].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->vif[0].wilc_netdev,
+ add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy,
+ g_linux_wlan->vif[0].ndev,
g_add_gtk_key_params.key_idx,
g_add_gtk_key_params.pairwise,
g_add_gtk_key_params.mac_addr,
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 521d3cb..429b654 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -152,7 +152,7 @@ struct wilc_vif {
u8 src_addr[ETH_ALEN];
u8 bssid[ETH_ALEN];
struct host_if_drv *hif_drv;
- struct net_device *wilc_netdev;
+ struct net_device *ndev;
};
struct wilc {
--
1.9.1