staging: wilc1000: pass vif to hostIFthread

We will pass vif, which is currently being used as net_device, instead of
hif_dev. This is the first step to use index of vif to pass to the driver.
Add new argument vif to all the functions that send message to hostIFthread and
set vif to msg.vif. As a result, hostIfthread will get vif.
In later patch, we will remove drv of host_if_msg and use vif instead of it.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 87f8d0d..309a0cc 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -595,14 +595,16 @@
 	u32 channelnum = 0;
 	struct wilc_priv *priv;
 	int result = 0;
+	struct wilc_vif *vif;
 
 	priv = wiphy_priv(wiphy);
+	vif = netdev_priv(priv->dev);
 
 	channelnum = ieee80211_frequency_to_channel(chandef->chan->center_freq);
 	PRINT_D(CFG80211_DBG, "Setting channel %d with frequency %d\n", channelnum, chandef->chan->center_freq);
 
 	curr_channel = channelnum;
-	result = wilc_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum);
+	result = wilc_set_mac_chnl_num(vif, priv->hWILCWFIDrv, channelnum);
 
 	if (result != 0)
 		PRINT_ER("Error in setting channel %d\n", channelnum);
@@ -617,14 +619,16 @@
 	s32 s32Error = 0;
 	u8 au8ScanChanList[MAX_NUM_SCANNED_NETWORKS];
 	struct hidden_network strHiddenNetwork;
+	struct wilc_vif *vif;
 
 	priv = wiphy_priv(wiphy);
+	vif = netdev_priv(priv->dev);
 
 	priv->pstrScanReq = request;
 
 	priv->u32RcvdChCount = 0;
 
-	wilc_set_wfi_drv_handler(priv->hWILCWFIDrv);
+	wilc_set_wfi_drv_handler(vif, priv->hWILCWFIDrv);
 	reset_shadow_found();
 
 	priv->bCfgScanning = true;
@@ -656,13 +660,13 @@
 				}
 			}
 			PRINT_D(CFG80211_DBG, "Trigger Scan Request\n");
-			s32Error = wilc_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
+			s32Error = wilc_scan(vif, priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
 						 au8ScanChanList, request->n_channels,
 						 (const u8 *)request->ie, request->ie_len,
 						 CfgScanResult, (void *)priv, &strHiddenNetwork);
 		} else {
 			PRINT_D(CFG80211_DBG, "Trigger Scan Request\n");
-			s32Error = wilc_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
+			s32Error = wilc_scan(vif, priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
 						 au8ScanChanList, request->n_channels,
 						 (const u8 *)request->ie, request->ie_len,
 						 CfgScanResult, (void *)priv, NULL);
@@ -694,13 +698,14 @@
 	struct wilc_priv *priv;
 	struct host_if_drv *pstrWFIDrv;
 	tstrNetworkInfo *pstrNetworkInfo = NULL;
-
+	struct wilc_vif *vif;
 
 	wilc_connecting = 1;
 	priv = wiphy_priv(wiphy);
+	vif = netdev_priv(priv->dev);
 	pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv);
 
-	wilc_set_wfi_drv_handler(priv->hWILCWFIDrv);
+	wilc_set_wfi_drv_handler(vif, priv->hWILCWFIDrv);
 
 	PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv);
 	if (!(strncmp(sme->ssid, "DIRECT-", 7))) {
@@ -787,8 +792,8 @@
 			g_key_wep_params.key_idx = sme->key_idx;
 			g_wep_keys_saved = true;
 
-			wilc_set_wep_default_keyid(priv->hWILCWFIDrv, sme->key_idx);
-			wilc_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
+			wilc_set_wep_default_keyid(vif, priv->hWILCWFIDrv, sme->key_idx);
+			wilc_add_wep_key_bss_sta(vif, priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
 		} else if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP104)   {
 			u8security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
 			pcgroup_encrypt_val = "WEP104";
@@ -804,8 +809,8 @@
 			g_key_wep_params.key_idx = sme->key_idx;
 			g_wep_keys_saved = true;
 
-			wilc_set_wep_default_keyid(priv->hWILCWFIDrv, sme->key_idx);
-			wilc_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
+			wilc_set_wep_default_keyid(vif, priv->hWILCWFIDrv, sme->key_idx);
+			wilc_add_wep_key_bss_sta(vif, priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
 		} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2)   {
 			if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP)	{
 				u8security = ENCRYPT_ENABLED | WPA2 | TKIP;
@@ -890,7 +895,7 @@
 
 	wilc_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid);
 
-	s32Error = wilc_set_join_req(priv->hWILCWFIDrv, pstrNetworkInfo->au8bssid, sme->ssid,
+	s32Error = wilc_set_join_req(vif, priv->hWILCWFIDrv, pstrNetworkInfo->au8bssid, sme->ssid,
 					 sme->ssid_len, sme->ie, sme->ie_len,
 					 CfgConnectResult, (void *)priv, u8security,
 					 tenuAuth_type, pstrNetworkInfo->u8channel,
@@ -911,10 +916,12 @@
 	s32 s32Error = 0;
 	struct wilc_priv *priv;
 	struct host_if_drv *pstrWFIDrv;
+	struct wilc_vif *vif;
 	u8 NullBssid[ETH_ALEN] = {0};
 
 	wilc_connecting = 0;
 	priv = wiphy_priv(wiphy);
+	vif = netdev_priv(priv->dev);
 
 	pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
 	if (!pstrWFIDrv->p2p_connect)
@@ -928,7 +935,7 @@
 	wilc_ie = false;
 	pstrWFIDrv->p2p_timeout = 0;
 
-	s32Error = wilc_disconnect(priv->hWILCWFIDrv, reason_code);
+	s32Error = wilc_disconnect(vif, priv->hWILCWFIDrv, reason_code);
 	if (s32Error != 0) {
 		PRINT_ER("Error in disconnecting: Error(%d)\n", s32Error);
 		s32Error = -EINVAL;
@@ -988,7 +995,7 @@
 			else
 				u8mode = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
 
-			wilc_add_wep_key_bss_ap(priv->hWILCWFIDrv, params->key, params->key_len, key_index, u8mode, tenuAuth_type);
+			wilc_add_wep_key_bss_ap(vif, priv->hWILCWFIDrv, params->key, params->key_len, key_index, u8mode, tenuAuth_type);
 			break;
 		}
 		if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) {
@@ -1002,7 +1009,7 @@
 				for (i = 0; i < params->key_len; i++)
 					PRINT_INFO(CFG80211_DBG, "WEP key value[%d] = %d\n", i, params->key[i]);
 			}
-			wilc_add_wep_key_bss_sta(priv->hWILCWFIDrv, params->key, params->key_len, key_index);
+			wilc_add_wep_key_bss_sta(vif, priv->hWILCWFIDrv, params->key, params->key_len, key_index);
 		}
 
 		break;
@@ -1059,7 +1066,7 @@
 				}
 
 
-				wilc_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen,
+				wilc_add_rx_gtk(vif, priv->hWILCWFIDrv, params->key, KeyLen,
 						    key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, AP_MODE, u8gmode);
 
 			} else {
@@ -1103,7 +1110,7 @@
 				priv->wilc_ptk[key_index]->key_len = params->key_len;
 				priv->wilc_ptk[key_index]->seq_len = params->seq_len;
 
-				wilc_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
+				wilc_add_ptk(vif, priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
 						 pu8RxMic, pu8TxMic, AP_MODE, u8pmode, key_index);
 			}
 			break;
@@ -1143,7 +1150,7 @@
 					g_gtk_keys_saved = true;
 				}
 
-				wilc_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen,
+				wilc_add_rx_gtk(vif, priv->hWILCWFIDrv, params->key, KeyLen,
 						    key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, STATION_MODE, u8mode);
 			} else {
 				if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
@@ -1177,7 +1184,7 @@
 					g_ptk_keys_saved = true;
 				}
 
-				wilc_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
+				wilc_add_ptk(vif, priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
 						 pu8RxMic, pu8TxMic, STATION_MODE, u8mode, key_index);
 				PRINT_D(CFG80211_DBG, "Adding pairwise key\n");
 				if (INFO) {
@@ -1254,7 +1261,7 @@
 		priv->WILC_WFI_wep_key_len[key_index] = 0;
 
 		PRINT_D(CFG80211_DBG, "Removing WEP key with index = %d\n", key_index);
-		wilc_remove_wep_key(priv->hWILCWFIDrv, key_index);
+		wilc_remove_wep_key(vif, priv->hWILCWFIDrv, key_index);
 	} else {
 		PRINT_D(CFG80211_DBG, "Removing all installed keys\n");
 		wilc_remove_key(priv->hWILCWFIDrv, mac_addr);
@@ -1305,14 +1312,15 @@
 			   bool unicast, bool multicast)
 {
 	struct wilc_priv *priv;
-
+	struct wilc_vif *vif;
 
 	priv = wiphy_priv(wiphy);
+	vif = netdev_priv(priv->dev);
 
 	PRINT_D(CFG80211_DBG, "Setting default key with idx = %d\n", key_index);
 
 	if (key_index != priv->WILC_WFI_wep_default) {
-		wilc_set_wep_default_keyid(priv->hWILCWFIDrv, key_index);
+		wilc_set_wep_default_keyid(vif, priv->hWILCWFIDrv, key_index);
 	}
 
 	return 0;
@@ -1348,7 +1356,7 @@
 
 		sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME);
 
-		wilc_get_inactive_time(priv->hWILCWFIDrv, mac, &(inactive_time));
+		wilc_get_inactive_time(vif, priv->hWILCWFIDrv, mac, &(inactive_time));
 		sinfo->inactive_time = 1000 * inactive_time;
 		PRINT_D(CFG80211_DBG, "Inactive time %d\n", sinfo->inactive_time);
 	}
@@ -1356,7 +1364,7 @@
 	if (vif->iftype == STATION_MODE) {
 		struct rf_info strStatistics;
 
-		wilc_get_statistics(priv->hWILCWFIDrv, &strStatistics);
+		wilc_get_statistics(vif, priv->hWILCWFIDrv, &strStatistics);
 
 		sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) |
 						BIT(NL80211_STA_INFO_RX_PACKETS) |
@@ -1394,8 +1402,10 @@
 	s32 s32Error = 0;
 	struct cfg_param_val pstrCfgParamVal;
 	struct wilc_priv *priv;
+	struct wilc_vif *vif;
 
 	priv = wiphy_priv(wiphy);
+	vif = netdev_priv(priv->dev);
 
 	pstrCfgParamVal.flag = 0;
 	PRINT_D(CFG80211_DBG, "Setting Wiphy params\n");
@@ -1425,7 +1435,7 @@
 	}
 
 	PRINT_D(CFG80211_DBG, "Setting CFG params in the host interface\n");
-	s32Error = wilc_hif_set_cfg(priv->hWILCWFIDrv, &pstrCfgParamVal);
+	s32Error = wilc_hif_set_cfg(vif, priv->hWILCWFIDrv, &pstrCfgParamVal);
 	if (s32Error)
 		PRINT_ER("Error in setting WIPHY PARAMS\n");
 
@@ -1439,9 +1449,10 @@
 	u32 i;
 	s32 s32Error = 0;
 	u8 flag = 0;
-
+	struct wilc_vif *vif;
 	struct wilc_priv *priv = wiphy_priv(wiphy);
 
+	vif = netdev_priv(priv->dev);
 	PRINT_D(CFG80211_DBG, "Setting PMKSA\n");
 
 
@@ -1468,7 +1479,7 @@
 
 	if (!s32Error) {
 		PRINT_D(CFG80211_DBG, "Setting pmkid in the host interface\n");
-		s32Error = wilc_set_pmkid_info(priv->hWILCWFIDrv, &priv->pmkid_list);
+		s32Error = wilc_set_pmkid_info(vif, priv->hWILCWFIDrv, &priv->pmkid_list);
 	}
 	return s32Error;
 }
@@ -1758,8 +1769,10 @@
 {
 	s32 s32Error = 0;
 	struct wilc_priv *priv;
+	struct wilc_vif *vif;
 
 	priv = wiphy_priv(wiphy);
+	vif = netdev_priv(priv->dev);
 
 	PRINT_D(GENERIC_DBG, "Remaining on channel %d\n", chan->hw_value);
 
@@ -1776,7 +1789,7 @@
 	priv->strRemainOnChanParams.u32ListenDuration = duration;
 	priv->strRemainOnChanParams.u32ListenSessionID++;
 
-	s32Error = wilc_remain_on_channel(priv->hWILCWFIDrv
+	s32Error = wilc_remain_on_channel(vif, priv->hWILCWFIDrv
 					      , priv->strRemainOnChanParams.u32ListenSessionID
 					      , duration
 					      , chan->hw_value
@@ -1793,12 +1806,14 @@
 {
 	s32 s32Error = 0;
 	struct wilc_priv *priv;
+	struct wilc_vif *vif;
 
 	priv = wiphy_priv(wiphy);
+	vif = netdev_priv(priv->dev);
 
 	PRINT_D(CFG80211_DBG, "Cancel remain on channel\n");
 
-	s32Error = wilc_listen_state_expired(priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID);
+	s32Error = wilc_listen_state_expired(vif, priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID);
 	return s32Error;
 }
 
@@ -1846,7 +1861,7 @@
 		if (ieee80211_is_probe_resp(mgmt->frame_control)) {
 			PRINT_D(GENERIC_DBG, "TX: Probe Response\n");
 			PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value);
-			wilc_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
+			wilc_set_mac_chnl_num(vif, priv->hWILCWFIDrv, chan->hw_value);
 			curr_channel = chan->hw_value;
 		} else if (ieee80211_is_action(mgmt->frame_control))   {
 			PRINT_D(GENERIC_DBG, "ACTION FRAME:%x\n", (u16)mgmt->frame_control);
@@ -1856,7 +1871,7 @@
 				if (buf[ACTION_SUBTYPE_ID] != PUBLIC_ACT_VENDORSPEC ||
 				    buf[P2P_PUB_ACTION_SUBTYPE] != GO_NEG_CONF)	{
 					PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value);
-					wilc_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
+					wilc_set_mac_chnl_num(vif, priv->hWILCWFIDrv, chan->hw_value);
 					curr_channel = chan->hw_value;
 				}
 				switch (buf[ACTION_SUBTYPE_ID])	{
@@ -2002,7 +2017,7 @@
 		PRINT_D(GENERIC_DBG, "Return since mac is closed\n");
 		return;
 	}
-	wilc_frame_register(priv->hWILCWFIDrv, frame_type, reg);
+	wilc_frame_register(vif, priv->hWILCWFIDrv, frame_type, reg);
 }
 
 static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev,
@@ -2016,6 +2031,7 @@
 			int idx, u8 *mac, struct station_info *sinfo)
 {
 	struct wilc_priv *priv;
+	struct wilc_vif *vif;
 
 	PRINT_D(CFG80211_DBG, "Dumping station information\n");
 
@@ -2023,10 +2039,11 @@
 		return -ENOENT;
 
 	priv = wiphy_priv(wiphy);
+	vif = netdev_priv(priv->dev);
 
 	sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
 
-	wilc_get_rssi(priv->hWILCWFIDrv, &(sinfo->signal));
+	wilc_get_rssi(vif, priv->hWILCWFIDrv, &(sinfo->signal));
 
 	return 0;
 }
@@ -2035,6 +2052,7 @@
 			  bool enabled, int timeout)
 {
 	struct wilc_priv *priv;
+	struct wilc_vif *vif;
 
 	PRINT_D(CFG80211_DBG, " Power save Enabled= %d , TimeOut = %d\n", enabled, timeout);
 
@@ -2042,13 +2060,14 @@
 		return -ENOENT;
 
 	priv = wiphy_priv(wiphy);
+	vif = netdev_priv(priv->dev);
 	if (!priv->hWILCWFIDrv) {
 		PRINT_ER("Driver is NULL\n");
 		return -EIO;
 	}
 
 	if (wilc_enable_ps)
-		wilc_set_power_mgmt(priv->hWILCWFIDrv, enabled, timeout);
+		wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, enabled, timeout);
 
 
 	return 0;
@@ -2096,7 +2115,7 @@
 		vif->iftype = STATION_MODE;
 
 		if (wl->initialized) {
-			wilc_del_all_rx_ba_session(priv->hWILCWFIDrv,
+			wilc_del_all_rx_ba_session(vif, priv->hWILCWFIDrv,
 						   wl->vif[0]->bssid, TID);
 			wilc_wait_msg_queue_idle();
 
@@ -2107,21 +2126,21 @@
 			wilc_initialized = 1;
 			vif->iftype = interface_type;
 
-			wilc_set_wfi_drv_handler(wl->vif[0]->hif_drv);
-			wilc_set_mac_address(wl->vif[0]->hif_drv,
+			wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv);
+			wilc_set_mac_address(vif, wl->vif[0]->hif_drv,
 						wl->vif[0]->src_addr);
-			wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
+			wilc_set_operation_mode(vif, priv->hWILCWFIDrv, STATION_MODE);
 
 			if (g_wep_keys_saved) {
-				wilc_set_wep_default_keyid(wl->vif[0]->hif_drv,
+				wilc_set_wep_default_keyid(vif, wl->vif[0]->hif_drv,
 							     g_key_wep_params.key_idx);
-				wilc_add_wep_key_bss_sta(wl->vif[0]->hif_drv,
+				wilc_add_wep_key_bss_sta(vif, wl->vif[0]->hif_drv,
 							     g_key_wep_params.key,
 							     g_key_wep_params.key_len,
 							     g_key_wep_params.key_idx);
 			}
 
-			wilc_flush_join_req(priv->hWILCWFIDrv);
+			wilc_flush_join_req(vif, priv->hWILCWFIDrv);
 
 			if (g_ptk_keys_saved && g_gtk_keys_saved) {
 				PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0],
@@ -2149,24 +2168,24 @@
 				for (i = 0; i < num_reg_frame; i++) {
 					PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
 						vif->g_struct_frame_reg[i].reg);
-					wilc_frame_register(priv->hWILCWFIDrv,
+					wilc_frame_register(vif, priv->hWILCWFIDrv,
 								vif->g_struct_frame_reg[i].frame_type,
 								vif->g_struct_frame_reg[i].reg);
 				}
 			}
 
 			wilc_enable_ps = true;
-			wilc_set_power_mgmt(priv->hWILCWFIDrv, 1, 0);
+			wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, 1, 0);
 		}
 		break;
 
 	case NL80211_IFTYPE_P2P_CLIENT:
 		wilc_enable_ps = false;
-		wilc_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
+		wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, 0, 0);
 		wilc_connecting = 0;
 		PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_P2P_CLIENT\n");
 
-		wilc_del_all_rx_ba_session(priv->hWILCWFIDrv,
+		wilc_del_all_rx_ba_session(vif, priv->hWILCWFIDrv,
 					   wl->vif[0]->bssid, TID);
 
 		dev->ieee80211_ptr->iftype = type;
@@ -2184,21 +2203,21 @@
 			wilc1000_wlan_init(dev, vif);
 			wilc_initialized = 1;
 
-			wilc_set_wfi_drv_handler(wl->vif[0]->hif_drv);
-			wilc_set_mac_address(wl->vif[0]->hif_drv,
+			wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv);
+			wilc_set_mac_address(vif, wl->vif[0]->hif_drv,
 						wl->vif[0]->src_addr);
-			wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
+			wilc_set_operation_mode(vif, priv->hWILCWFIDrv, STATION_MODE);
 
 			if (g_wep_keys_saved) {
-				wilc_set_wep_default_keyid(wl->vif[0]->hif_drv,
+				wilc_set_wep_default_keyid(vif, wl->vif[0]->hif_drv,
 							   g_key_wep_params.key_idx);
-				wilc_add_wep_key_bss_sta(wl->vif[0]->hif_drv,
+				wilc_add_wep_key_bss_sta(vif, wl->vif[0]->hif_drv,
 							 g_key_wep_params.key,
 							 g_key_wep_params.key_len,
 							 g_key_wep_params.key_idx);
 			}
 
-			wilc_flush_join_req(priv->hWILCWFIDrv);
+			wilc_flush_join_req(vif, priv->hWILCWFIDrv);
 
 			if (g_ptk_keys_saved && g_gtk_keys_saved) {
 				PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0],
@@ -2229,7 +2248,7 @@
 				for (i = 0; i < num_reg_frame; i++) {
 					PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
 						vif->g_struct_frame_reg[i].reg);
-					wilc_frame_register(priv->hWILCWFIDrv,
+					wilc_frame_register(vif, priv->hWILCWFIDrv,
 								vif->g_struct_frame_reg[i].frame_type,
 								vif->g_struct_frame_reg[i].reg);
 				}
@@ -2256,7 +2275,7 @@
 			for (i = 0; i < num_reg_frame; i++) {
 				PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
 					vif->g_struct_frame_reg[i].reg);
-				wilc_frame_register(priv->hWILCWFIDrv,
+				wilc_frame_register(vif, priv->hWILCWFIDrv,
 							vif->g_struct_frame_reg[i].frame_type,
 							vif->g_struct_frame_reg[i].reg);
 			}
@@ -2269,8 +2288,8 @@
 		wilc_optaining_ip = true;
 		mod_timer(&wilc_during_ip_timer,
 			  jiffies + msecs_to_jiffies(during_ip_time));
-		wilc_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
-		wilc_del_all_rx_ba_session(priv->hWILCWFIDrv,
+		wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, 0, 0);
+		wilc_del_all_rx_ba_session(vif, priv->hWILCWFIDrv,
 					   wl->vif[0]->bssid, TID);
 		wilc_enable_ps = false;
 		PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n");
@@ -2289,21 +2308,21 @@
 		wilc1000_wlan_init(dev, vif);
 		wilc_initialized = 1;
 
-		wilc_set_wfi_drv_handler(wl->vif[0]->hif_drv);
-		wilc_set_mac_address(wl->vif[0]->hif_drv,
+		wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv);
+		wilc_set_mac_address(vif, wl->vif[0]->hif_drv,
 				     wl->vif[0]->src_addr);
-		wilc_set_operation_mode(priv->hWILCWFIDrv, AP_MODE);
+		wilc_set_operation_mode(vif, priv->hWILCWFIDrv, AP_MODE);
 
 		if (g_wep_keys_saved) {
-			wilc_set_wep_default_keyid(wl->vif[0]->hif_drv,
+			wilc_set_wep_default_keyid(vif, wl->vif[0]->hif_drv,
 						   g_key_wep_params.key_idx);
-			wilc_add_wep_key_bss_sta(wl->vif[0]->hif_drv,
+			wilc_add_wep_key_bss_sta(vif, wl->vif[0]->hif_drv,
 						     g_key_wep_params.key,
 						     g_key_wep_params.key_len,
 						     g_key_wep_params.key_idx);
 		}
 
-		wilc_flush_join_req(priv->hWILCWFIDrv);
+		wilc_flush_join_req(vif, priv->hWILCWFIDrv);
 
 		if (g_ptk_keys_saved && g_gtk_keys_saved) {
 			PRINT_D(CFG80211_DBG, "ptk %x %x %x cipher %x\n", g_key_ptk_params.key[0],
@@ -2333,7 +2352,7 @@
 			for (i = 0; i < num_reg_frame; i++) {
 				PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
 					vif->g_struct_frame_reg[i].reg);
-				wilc_frame_register(priv->hWILCWFIDrv,
+				wilc_frame_register(vif, priv->hWILCWFIDrv,
 							vif->g_struct_frame_reg[i].frame_type,
 							vif->g_struct_frame_reg[i].reg);
 			}
@@ -2372,7 +2391,7 @@
 
 	wilc_wlan_set_bssid(dev, wl->vif[0]->src_addr);
 
-	s32Error = wilc_add_beacon(priv->hWILCWFIDrv,
+	s32Error = wilc_add_beacon(vif, priv->hWILCWFIDrv,
 					settings->beacon_interval,
 					settings->dtim_period,
 					beacon->head_len, (u8 *)beacon->head,
@@ -2385,13 +2404,15 @@
 			 struct cfg80211_beacon_data *beacon)
 {
 	struct wilc_priv *priv;
+	struct wilc_vif *vif;
 	s32 s32Error = 0;
 
 	priv = wiphy_priv(wiphy);
+	vif = netdev_priv(priv->dev);
 	PRINT_D(HOSTAPD_DBG, "Setting beacon\n");
 
 
-	s32Error = wilc_add_beacon(priv->hWILCWFIDrv,
+	s32Error = wilc_add_beacon(vif, priv->hWILCWFIDrv,
 					0,
 					0,
 					beacon->head_len, (u8 *)beacon->head,
@@ -2404,18 +2425,20 @@
 {
 	s32 s32Error = 0;
 	struct wilc_priv *priv;
+	struct wilc_vif *vif;
 	u8 NullBssid[ETH_ALEN] = {0};
 
 	if (!wiphy)
 		return -EFAULT;
 
 	priv = wiphy_priv(wiphy);
+	vif = netdev_priv(priv->dev);
 
 	PRINT_D(HOSTAPD_DBG, "Deleting beacon\n");
 
 	wilc_wlan_set_bssid(dev, NullBssid);
 
-	s32Error = wilc_del_beacon(priv->hWILCWFIDrv);
+	s32Error = wilc_del_beacon(vif, priv->hWILCWFIDrv);
 
 	if (s32Error)
 		PRINT_ER("Host delete beacon fail\n");
@@ -2486,7 +2509,8 @@
 		PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n",
 			strStaParams.flags_set);
 
-		s32Error = wilc_add_station(priv->hWILCWFIDrv, &strStaParams);
+		s32Error = wilc_add_station(vif, priv->hWILCWFIDrv,
+					    &strStaParams);
 		if (s32Error)
 			PRINT_ER("Host add station fail\n");
 	}
@@ -2514,12 +2538,12 @@
 
 		if (!mac) {
 			PRINT_D(HOSTAPD_DBG, "All associated stations\n");
-			s32Error = wilc_del_allstation(priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss);
+			s32Error = wilc_del_allstation(vif, priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss);
 		} else {
 			PRINT_D(HOSTAPD_DBG, "With mac address: %x%x%x%x%x%x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
 		}
 
-		s32Error = wilc_del_station(priv->hWILCWFIDrv, mac);
+		s32Error = wilc_del_station(vif, priv->hWILCWFIDrv, mac);
 
 		if (s32Error)
 			PRINT_ER("Host delete station fail\n");
@@ -2592,7 +2616,8 @@
 		PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n",
 			strStaParams.flags_set);
 
-		s32Error = wilc_edit_station(priv->hWILCWFIDrv, &strStaParams);
+		s32Error = wilc_edit_station(vif, priv->hWILCWFIDrv,
+					     &strStaParams);
 		if (s32Error)
 			PRINT_ER("Host edit station fail\n");
 	}
@@ -2825,10 +2850,11 @@
 int wilc_deinit_host_int(struct net_device *net)
 {
 	int s32Error = 0;
-
+	struct wilc_vif *vif;
 	struct wilc_priv *priv;
 
 	priv = wdev_priv(net->ieee80211_ptr);
+	vif = netdev_priv(priv->dev);
 
 	priv->gbAutoRateAdjusted = false;
 
@@ -2836,7 +2862,7 @@
 
 	op_ifcs--;
 
-	s32Error = wilc_deinit(priv->hWILCWFIDrv);
+	s32Error = wilc_deinit(vif, priv->hWILCWFIDrv);
 
 	clear_shadow_scan();
 	if (op_ifcs == 0) {