2015-11-25 02:56:22

by Glen Lee

[permalink] [raw]
Subject: [PATCH 01/10] staging: wilc1000: fix rmmod failure

This patch fixes rmmod failure. wilc->firmware needs to be set to NULL because
it is used again to check firmware is released when module exit.

Fixes: 8b8ad7bc90bc ("staging: wilc1000: rename wilc_firmware in the struct wilc")
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 7ccc9b0..92ca072 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -506,6 +506,7 @@ static int wilc1000_firmware_download(struct net_device *dev)
PRINT_D(INIT_DBG, "Freeing FW buffer ...\n");
PRINT_D(INIT_DBG, "Releasing firmware\n");
release_firmware(wilc->firmware);
+ wilc->firmware = NULL;

PRINT_D(INIT_DBG, "Download Succeeded\n");

--
1.9.1



2015-11-25 02:57:20

by Glen Lee

[permalink] [raw]
Subject: [PATCH 10/10] staging: wilc1000: Handle_SetMulticastFilter(): fixes right shifting more than type allows

From: Leo Kim <[email protected]>

This patch fixes the warning reported by smatch.
- Handle_SetMulticastFilter() warn: right shifting more than type allows

That is unnecessary action of boolean type. just assign 0.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index c309deb..3b986cb 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2713,9 +2713,9 @@ static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv,

pu8CurrByte = wid.val;
*pu8CurrByte++ = (strHostIfSetMulti->enabled & 0xFF);
- *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 8) & 0xFF);
- *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 16) & 0xFF);
- *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 24) & 0xFF);
+ *pu8CurrByte++ = 0;
+ *pu8CurrByte++ = 0;
+ *pu8CurrByte++ = 0;

*pu8CurrByte++ = (strHostIfSetMulti->cnt & 0xFF);
*pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF);
--
1.9.1


2015-11-25 02:56:44

by Glen Lee

[permalink] [raw]
Subject: [PATCH 04/10] staging: wilc1000: replace explicit NULL comparisons with !

From: Leo Kim <[email protected]>

This patch replace explicit NULL comparison with ! operator to simplify code.
Reported by checkpatch.pl for Comparison to NULL could be written !XXX" or "XXX".

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 31 ++++++++++++-----------
1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 71038b1..bdc4537 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -463,7 +463,7 @@ static void CfgScanResult(enum scan_event scan_event,

down(&(priv->hSemScanReq));

- if (priv->pstrScanReq != NULL) {
+ if (priv->pstrScanReq) {
cfg80211_scan_done(priv->pstrScanReq, false);
priv->u32RcvdChCount = 0;
priv->bCfgScanning = false;
@@ -474,7 +474,7 @@ static void CfgScanResult(enum scan_event scan_event,
down(&(priv->hSemScanReq));

PRINT_D(CFG80211_DBG, "Scan Aborted\n");
- if (priv->pstrScanReq != NULL) {
+ if (priv->pstrScanReq) {
update_scan_time();
refresh_scan(priv, 1, false);

@@ -645,7 +645,8 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)


for (i = 0; i < request->n_ssids; i++) {
- if (request->ssids[i].ssid != NULL && request->ssids[i].ssid_len != 0) {
+ if (request->ssids[i].ssid &&
+ request->ssids[i].ssid_len != 0) {
strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid = kmalloc(request->ssids[i].ssid_len, GFP_KERNEL);
memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, request->ssids[i].ssid, request->ssids[i].ssid_len);
strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen = request->ssids[i].ssid_len;
@@ -716,7 +717,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
sme->ssid,
sme->ssid_len) == 0) {
PRINT_INFO(CFG80211_DBG, "Network with required SSID is found %s\n", sme->ssid);
- if (sme->bssid == NULL) {
+ if (!sme->bssid) {
PRINT_INFO(CFG80211_DBG, "BSSID is not passed from the user\n");
break;
} else {
@@ -1009,12 +1010,12 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
case WLAN_CIPHER_SUITE_TKIP:
case WLAN_CIPHER_SUITE_CCMP:
if (priv->wdev->iftype == NL80211_IFTYPE_AP || priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
- if (priv->wilc_gtk[key_index] == NULL) {
+ if (!priv->wilc_gtk[key_index]) {
priv->wilc_gtk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
priv->wilc_gtk[key_index]->key = NULL;
priv->wilc_gtk[key_index]->seq = NULL;
}
- if (priv->wilc_ptk[key_index] == NULL) {
+ if (!priv->wilc_ptk[key_index]) {
priv->wilc_ptk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
priv->wilc_ptk[key_index]->key = NULL;
priv->wilc_ptk[key_index]->seq = NULL;
@@ -1828,12 +1829,12 @@ static int mgmt_tx(struct wiphy *wiphy,

if (ieee80211_is_mgmt(mgmt->frame_control)) {
mgmt_tx = kmalloc(sizeof(struct p2p_mgmt_data), GFP_KERNEL);
- if (mgmt_tx == NULL) {
+ if (!mgmt_tx) {
PRINT_ER("Failed to allocate memory for mgmt_tx structure\n");
return -EFAULT;
}
mgmt_tx->buff = kmalloc(buf_len, GFP_KERNEL);
- if (mgmt_tx->buff == NULL) {
+ if (!mgmt_tx->buff) {
PRINT_ER("Failed to allocate memory for mgmt_tx buff\n");
kfree(mgmt_tx);
return -EFAULT;
@@ -2037,11 +2038,11 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,

PRINT_D(CFG80211_DBG, " Power save Enabled= %d , TimeOut = %d\n", enabled, timeout);

- if (wiphy == NULL)
+ if (!wiphy)
return -ENOENT;

priv = wiphy_priv(wiphy);
- if (priv->hWILCWFIDrv == NULL) {
+ if (!priv->hWILCWFIDrv) {
PRINT_ER("Driver is NULL\n");
return -EIO;
}
@@ -2451,7 +2452,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n",
strStaParams.rates_len);

- if (params->ht_capa == NULL) {
+ if (!params->ht_capa) {
strStaParams.ht_supported = false;
} else {
strStaParams.ht_supported = true;
@@ -2511,7 +2512,7 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Deleting station\n");


- if (mac == NULL) {
+ if (!mac) {
PRINT_D(HOSTAPD_DBG, "All associated stations\n");
s32Error = wilc_del_allstation(priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss);
} else {
@@ -2557,7 +2558,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n",
strStaParams.rates_len);

- if (params->ht_capa == NULL) {
+ if (!params->ht_capa) {
strStaParams.ht_supported = false;
} else {
strStaParams.ht_supported = true;
@@ -2622,7 +2623,7 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy,
PRINT_D(HOSTAPD_DBG, "Monitor interface mode: Initializing mon interface virtual device driver\n");
PRINT_D(HOSTAPD_DBG, "Adding monitor interface[%p]\n", nic->wilc_netdev);
new_ifc = WILC_WFI_init_mon_interface(name, nic->wilc_netdev);
- if (new_ifc != NULL) {
+ if (new_ifc) {
PRINT_D(HOSTAPD_DBG, "Setting monitor flag in private structure\n");
nic = netdev_priv(priv->wdev->netdev);
nic->monitor_flag = 1;
@@ -2748,7 +2749,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de
PRINT_D(CFG80211_DBG, "Registering wifi device\n");

wdev = WILC_WFI_CfgAlloc();
- if (wdev == NULL) {
+ if (!wdev) {
PRINT_ER("CfgAlloc Failed\n");
return NULL;
}
--
1.9.1


2015-11-25 02:57:02

by Glen Lee

[permalink] [raw]
Subject: [PATCH 07/10] staging: wilc1000: wilc_deinit(): fixes inconsistent returns

From: Leo Kim <[email protected]>

This patch fixes the warning reported by smatch.
- wilc_deinit() warn: inconsistent returns 'sem:&hif_drv->sem_cfg_values'

This semaphore protect a cfg_values variable but cfg_values variables was not
used here. So, just remove this line.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 3aea6ec..8f27227 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4007,8 +4007,6 @@ s32 wilc_deinit(struct host_if_drv *hif_drv)
wilc_mq_destroy(&hif_msg_q);
}

- down(&hif_drv->sem_cfg_values);
-
ret = remove_handler_in_list(hif_drv);
if (ret)
result = -ENOENT;
--
1.9.1


2015-11-25 02:57:14

by Glen Lee

[permalink] [raw]
Subject: [PATCH 09/10] staging: wilc1000: change if with else if

From: Leo Kim <[email protected]>

The if statement should be else if since it is part of whole if condition.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 0b85640..c309deb 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1764,9 +1764,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
strWIDList, 4,
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
- }
-
- if (pstrHostIFkeyAttr->action & ADDKEY) {
+ } else if (pstrHostIFkeyAttr->action & ADDKEY) {
PRINT_D(HOSTINF_DBG, "Handling WEP key\n");
pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len + 2, GFP_KERNEL);
if (!pu8keybuf) {
@@ -1848,9 +1846,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,

kfree(pu8keybuf);
up(&hif_drv->sem_test_key_block);
- }
-
- if (pstrHostIFkeyAttr->action & ADDKEY) {
+ } else if (pstrHostIFkeyAttr->action & ADDKEY) {
PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n");

pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
@@ -1921,8 +1917,7 @@ _WPARxGtk_end_case_:
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
up(&hif_drv->sem_test_key_block);
- }
- if (pstrHostIFkeyAttr->action & ADDKEY) {
+ } else if (pstrHostIFkeyAttr->action & ADDKEY) {
pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL);
if (!pu8keybuf) {
PRINT_ER("No buffer to send PTK Key\n");
--
1.9.1


2015-11-25 02:56:38

by Glen Lee

[permalink] [raw]
Subject: [PATCH 03/10] staging: wilc1000: fixes blank lines aren't necessary brace

From: Leo Kim <[email protected]>

This patch fixes the checks reported by checkpatch.pl
for Blank lines aren't necessary after an open brace '{' and
Blank lines aren't necessary before a close brace '}'.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 50 -----------------------
1 file changed, 50 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index bfef022..71038b1 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -201,7 +201,6 @@ static void clear_shadow_scan(void)
}
last_scanned_cnt = 0;
}
-
}

static u32 get_rssi_avg(tstrNetworkInfo *network_info)
@@ -250,10 +249,8 @@ static void refresh_scan(void *user_void, u8 all, bool direct_scan)
cfg80211_put_bss(wiphy, bss);
}
}
-
}
}
-
}

static void reset_shadow_found(void)
@@ -347,7 +344,6 @@ static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo,
if (ap_found == -1) {
ap_index = last_scanned_cnt;
last_scanned_cnt++;
-
} else {
ap_index = ap_found;
}
@@ -590,9 +586,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, pstrDisconnectNotifInfo->ie,
pstrDisconnectNotifInfo->ie_len, false,
GFP_KERNEL);
-
}
-
}

static int set_channel(struct wiphy *wiphy,
@@ -646,14 +640,11 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
PRINT_D(CFG80211_DBG, "Number of SSIDs %d\n", request->n_ssids);

if (request->n_ssids >= 1) {
-
-
strHiddenNetwork.pstrHiddenNetworkInfo = kmalloc(request->n_ssids * sizeof(struct hidden_network), GFP_KERNEL);
strHiddenNetwork.u8ssidnum = request->n_ssids;


for (i = 0; i < request->n_ssids; i++) {
-
if (request->ssids[i].ssid != NULL && request->ssids[i].ssid_len != 0) {
strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid = kmalloc(request->ssids[i].ssid_len, GFP_KERNEL);
memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, request->ssids[i].ssid, request->ssids[i].ssid_len);
@@ -675,7 +666,6 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
(const u8 *)request->ie, request->ie_len,
CfgScanResult, (void *)priv, NULL);
}
-
} else {
PRINT_ER("Requested num of scanned channels is greater than the max, supported"
" channels\n");
@@ -835,7 +825,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
u8security = ENCRYPT_ENABLED | WPA | AES;
pcgroup_encrypt_val = "WPA_AES";
pccipher_group = "AES";
-
}
pcwpa_version = "WPA_VERSION_1";

@@ -845,7 +834,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,

goto done;
}
-
}

if ((sme->crypto.wpa_versions & NL80211_WPA_VERSION_1)
@@ -982,7 +970,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
if (priv->wdev->iftype == NL80211_IFTYPE_AP) {
-
priv->WILC_WFI_wep_default = key_index;
priv->WILC_WFI_wep_key_len[key_index] = params->key_len;
memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len);
@@ -1022,12 +1009,10 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
case WLAN_CIPHER_SUITE_TKIP:
case WLAN_CIPHER_SUITE_CCMP:
if (priv->wdev->iftype == NL80211_IFTYPE_AP || priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
-
if (priv->wilc_gtk[key_index] == NULL) {
priv->wilc_gtk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
priv->wilc_gtk[key_index]->key = NULL;
priv->wilc_gtk[key_index]->seq = NULL;
-
}
if (priv->wilc_ptk[key_index] == NULL) {
priv->wilc_ptk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
@@ -1046,7 +1031,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
priv->wilc_groupkey = u8gmode;

if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
-
pu8TxMic = params->key + 24;
pu8RxMic = params->key + 16;
KeyLen = params->key_len - 16;
@@ -1087,7 +1071,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,


if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
-
pu8TxMic = params->key + 24;
pu8RxMic = params->key + 16;
KeyLen = params->key_len - 16;
@@ -1207,7 +1190,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
default:
PRINT_ER("Not supported cipher: Error(%d)\n", s32Error);
s32Error = -ENOTSUPP;
-
}

return s32Error;
@@ -1235,7 +1217,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
g_key_wep_params.key = NULL;

if ((priv->wilc_gtk[key_index]) != NULL) {
-
kfree(priv->wilc_gtk[key_index]->key);
priv->wilc_gtk[key_index]->key = NULL;
kfree(priv->wilc_gtk[key_index]->seq);
@@ -1243,11 +1224,9 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,

kfree(priv->wilc_gtk[key_index]);
priv->wilc_gtk[key_index] = NULL;
-
}

if ((priv->wilc_ptk[key_index]) != NULL) {
-
kfree(priv->wilc_ptk[key_index]->key);
priv->wilc_ptk[key_index]->key = NULL;
kfree(priv->wilc_ptk[key_index]->seq);
@@ -1332,7 +1311,6 @@ static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 ke
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);
}

@@ -1356,12 +1334,10 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_INFO(HOSTAPD_DBG, ": %x%x%x%x%x\n", mac[0], mac[1], mac[2], mac[3], mac[4]);

for (i = 0; i < NUM_STA_ASSOCIATED; i++) {
-
if (!(memcmp(mac, priv->assoc_stainfo.au8Sta_AssociatedBss[i], ETH_ALEN))) {
associatedsta = i;
break;
}
-
}

if (associatedsta == -1) {
@@ -1374,7 +1350,6 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
wilc_get_inactive_time(priv->hWILCWFIDrv, mac, &(inactive_time));
sinfo->inactive_time = 1000 * inactive_time;
PRINT_D(CFG80211_DBG, "Inactive time %d\n", sinfo->inactive_time);
-
}

if (nic->iftype == STATION_MODE) {
@@ -1431,17 +1406,14 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
pstrCfgParamVal.short_retry_limit = priv->dev->ieee80211_ptr->wiphy->retry_short;
}
if (changed & WIPHY_PARAM_RETRY_LONG) {
-
PRINT_D(CFG80211_DBG, "Setting WIPHY_PARAM_RETRY_LONG %d\n", priv->dev->ieee80211_ptr->wiphy->retry_long);
pstrCfgParamVal.flag |= RETRY_LONG;
pstrCfgParamVal.long_retry_limit = priv->dev->ieee80211_ptr->wiphy->retry_long;
-
}
if (changed & WIPHY_PARAM_FRAG_THRESHOLD) {
PRINT_D(CFG80211_DBG, "Setting WIPHY_PARAM_FRAG_THRESHOLD %d\n", priv->dev->ieee80211_ptr->wiphy->frag_threshold);
pstrCfgParamVal.flag |= FRAG_THRESHOLD;
pstrCfgParamVal.frag_threshold = priv->dev->ieee80211_ptr->wiphy->frag_threshold;
-
}

if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
@@ -1449,7 +1421,6 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed)

pstrCfgParamVal.flag |= RTS_THRESHOLD;
pstrCfgParamVal.rts_threshold = priv->dev->ieee80211_ptr->wiphy->rts_threshold;
-
}

PRINT_D(CFG80211_DBG, "Setting CFG params in the host interface\n");
@@ -1504,7 +1475,6 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
struct cfg80211_pmksa *pmksa)
{
-
u32 i;
s32 s32Error = 0;

@@ -1633,7 +1603,6 @@ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftyp

void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size)
{
-
struct wilc_priv *priv;
u32 header, pkt_offset;
struct host_if_drv *pstrWFIDrv;
@@ -1665,7 +1634,6 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size)
return;
}
} else {
-
PRINT_D(GENERIC_DBG, "Rx Frame Type:%x\n", buff[FRAME_TYPE_ID]);

s32Freq = ieee80211_channel_to_frequency(curr_channel, IEEE80211_BAND_2GHZ);
@@ -1678,7 +1646,6 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size)
return;
}
if (buff[ACTION_CAT_ID] == PUB_ACTION_ATTR_ID) {
-
switch (buff[ACTION_SUBTYPE_ID]) {
case GAS_INTIAL_REQ:
PRINT_D(GENERIC_DBG, "GAS INITIAL REQ %x\n", buff[ACTION_SUBTYPE_ID]);
@@ -1952,7 +1919,6 @@ static int mgmt_tx(struct wiphy *wiphy,
break;
}
}
-
}

PRINT_D(GENERIC_DBG, "TX: ACTION FRAME Type:%x : Chan:%d\n", buf[ACTION_SUBTYPE_ID], chan->hw_value);
@@ -1998,7 +1964,6 @@ static int mgmt_tx_cancel_wait(struct wiphy *wiphy,
void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
u16 frame_type, bool reg)
{
-
struct wilc_priv *priv;
perInterface_wlan_t *nic;
struct wilc *wl;
@@ -2030,7 +1995,6 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
{
break;
}
-
}

if (!wl->initialized) {
@@ -2038,8 +2002,6 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
return;
}
wilc_frame_register(priv->hWILCWFIDrv, frame_type, reg);
-
-
}

static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev,
@@ -2047,7 +2009,6 @@ static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev,
{
PRINT_D(CFG80211_DBG, "Setting CQM RSSi Function\n");
return 0;
-
}

static int dump_station(struct wiphy *wiphy, struct net_device *dev,
@@ -2067,7 +2028,6 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev,
wilc_get_rssi(priv->hWILCWFIDrv, &(sinfo->signal));

return 0;
-
}

static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
@@ -2091,7 +2051,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,


return 0;
-
}

static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
@@ -2680,7 +2639,6 @@ static int del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
}

static struct cfg80211_ops wilc_cfg80211_ops = {
-
.set_monitor_channel = set_channel,
.scan = scan,
.connect = connect,
@@ -2719,12 +2677,10 @@ static struct cfg80211_ops wilc_cfg80211_ops = {

int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed)
{
-
struct wilc_priv *priv;

priv = wiphy_priv(wiphy);
switch (changed) {
-
case WILC_WFI_RX_PKT:
{
priv->netstats.rx_packets++;
@@ -2750,7 +2706,6 @@ int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed)

static struct wireless_dev *WILC_WFI_CfgAlloc(void)
{
-
struct wireless_dev *wdev;


@@ -2766,7 +2721,6 @@ static struct wireless_dev *WILC_WFI_CfgAlloc(void)
if (!wdev->wiphy) {
PRINT_ER("Cannot allocate wiphy\n");
goto _fail_mem_;
-
}

WILC_WFI_band_2ghz.ht_cap.ht_supported = 1;
@@ -2783,7 +2737,6 @@ _fail_mem_:
kfree(wdev);
_fail_:
return NULL;
-
}

struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev)
@@ -2836,13 +2789,10 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de

priv->dev = net;
return wdev;
-
-
}

int wilc_init_host_int(struct net_device *net)
{
-
int s32Error = 0;

struct wilc_priv *priv;
--
1.9.1


2015-11-25 02:57:08

by Glen Lee

[permalink] [raw]
Subject: [PATCH 08/10] staging: wilc1000: Handle_AddBASession: remove unused function

From: Leo Kim <[email protected]>

This patch removes unused a function Handle_AddBASession.
And, removes the relation define.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 69 -------------------------------
1 file changed, 69 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 8f27227..0b85640 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -43,7 +43,6 @@
#define HOST_IF_MSG_FLUSH_CONNECT 30
#define HOST_IF_MSG_GET_STATISTICS 31
#define HOST_IF_MSG_SET_MULTICAST_FILTER 32
-#define HOST_IF_MSG_ADD_BA_SESSION 33
#define HOST_IF_MSG_DEL_BA_SESSION 34
#define HOST_IF_MSG_Q_IDLE 35
#define HOST_IF_MSG_DEL_ALL_STA 36
@@ -2741,70 +2740,6 @@ ERRORHANDLER:
kfree(wid.val);
}

-static s32 Handle_AddBASession(struct host_if_drv *hif_drv,
- struct ba_session_info *strHostIfBASessionInfo)
-{
- s32 result = 0;
- struct wid wid;
- int AddbaTimeout = 100;
- char *ptr = NULL;
-
- PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n",
- strHostIfBASessionInfo->bssid[0],
- strHostIfBASessionInfo->bssid[1],
- strHostIfBASessionInfo->bssid[2],
- strHostIfBASessionInfo->buf_size,
- strHostIfBASessionInfo->time_out,
- strHostIfBASessionInfo->tid);
-
- wid.id = (u16)WID_11E_P_ACTION_REQ;
- wid.type = WID_STR;
- wid.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL);
- wid.size = BLOCK_ACK_REQ_SIZE;
- ptr = wid.val;
- *ptr++ = 0x14;
- *ptr++ = 0x3;
- *ptr++ = 0x0;
- memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN);
- ptr += ETH_ALEN;
- *ptr++ = strHostIfBASessionInfo->tid;
- *ptr++ = 1;
- *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF);
- *ptr++ = ((strHostIfBASessionInfo->buf_size >> 16) & 0xFF);
- *ptr++ = (strHostIfBASessionInfo->time_out & 0xFF);
- *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF);
- *ptr++ = (AddbaTimeout & 0xFF);
- *ptr++ = ((AddbaTimeout >> 16) & 0xFF);
- *ptr++ = 8;
- *ptr++ = 0;
-
- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
- if (result)
- PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n");
-
- wid.id = (u16)WID_11E_P_ACTION_REQ;
- wid.type = WID_STR;
- wid.size = 15;
- ptr = wid.val;
- *ptr++ = 15;
- *ptr++ = 7;
- *ptr++ = 0x2;
- memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN);
- ptr += ETH_ALEN;
- *ptr++ = strHostIfBASessionInfo->tid;
- *ptr++ = 8;
- *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF);
- *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF);
- *ptr++ = 3;
- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
-
- kfree(wid.val);
-
- return result;
-}
-
static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv,
struct ba_session_info *strHostIfBASessionInfo)
{
@@ -3035,10 +2970,6 @@ static int hostIFthread(void *pvArg)
Handle_SetMulticastFilter(msg.drv, &msg.body.multicast_info);
break;

- case HOST_IF_MSG_ADD_BA_SESSION:
- Handle_AddBASession(msg.drv, &msg.body.session_info);
- break;
-
case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS:
Handle_DelAllRxBASessions(msg.drv, &msg.body.session_info);
break;
--
1.9.1


2015-11-25 02:56:56

by Glen Lee

[permalink] [raw]
Subject: [PATCH 06/10] staging: wilc1000: wilc_init(): fixes inconsistent returns

From: Leo Kim <[email protected]>

This patch fixes the warning reported by smatch.
- wilc_init() warn: inconsistent returns 'sem:&hif_drv->sem_cfg_values'

No need to up the sema here since down was not called before get here.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index da4f4c6..3aea6ec 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3940,7 +3940,6 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
return result;

_fail_timer_2:
- up(&hif_drv->sem_cfg_values);
del_timer_sync(&hif_drv->connect_timer);
del_timer_sync(&hif_drv->scan_timer);
kthread_stop(hif_thread_handler);
--
1.9.1


2015-11-25 02:56:30

by Glen Lee

[permalink] [raw]
Subject: [PATCH 02/10] staging: wilc1000: wilc_wfi_cfgoperations.c: remove over-commenting

From: Leo Kim <[email protected]>

There are over-commenting in the wilc_wfi_cfgoperations.c file and most of them
are not helpful to explain what the code does and generate 80 ending
line over warnings. So, all of comments are removed in this patch and the
comments will later be added if necessary with the preferred Linux style.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 681 +---------------------
1 file changed, 23 insertions(+), 658 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index bcfddbf..bfef022 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1,20 +1,7 @@
-/*!
- * @file wilc_wfi_cfgopertaions.c
- * @brief CFG80211 Function Implementation functionality
- * @author aabouzaeid
- * mabubakr
- * mdaftedar
- * zsalah
- * @sa wilc_wfi_cfgopertaions.h top level OS wrapper file
- * @date 31 Aug 2010
- * @version 1.0
- */
-
#include "wilc_wfi_cfgoperations.h"
#include "host_interface.h"
#include <linux/errno.h>

-/* The following macros describe the bitfield map used by the firmware to determine its 11i mode */
#define NO_ENCRYPT 0
#define ENCRYPT_ENABLED BIT(0)
#define WEP BIT(1)
@@ -24,13 +11,11 @@
#define AES BIT(5)
#define TKIP BIT(6)

-/*Public action frame index IDs*/
#define FRAME_TYPE_ID 0
#define ACTION_CAT_ID 24
#define ACTION_SUBTYPE_ID 25
#define P2P_PUB_ACTION_SUBTYPE 30

-/*Public action frame Attribute IDs*/
#define ACTION_FRAME 0xd0
#define GO_INTENT_ATTR_ID 0x04
#define CHANLIST_ATTR_ID 0x0b
@@ -38,7 +23,6 @@
#define PUB_ACTION_ATTR_ID 0x04
#define P2PELEM_ATTR_ID 0xdd

-/*Public action subtype values*/
#define GO_NEG_REQ 0x00
#define GO_NEG_RSP 0x01
#define GO_NEG_CONF 0x02
@@ -90,7 +74,6 @@ static const struct ieee80211_txrx_stypes
}
};

-/* Time to stay on the channel */
#define WILC_WFI_DWELL_PASSIVE 100
#define WILC_WFI_DWELL_ACTIVE 40

@@ -123,7 +106,6 @@ u8 wilc_initialized = 1;
.max_power = 30, \
}

-/*Frequency range for channels*/
static struct ieee80211_channel ieee80211_2ghz_channels[] = {
CHAN2G(1, 2412, 0),
CHAN2G(2, 2417, 0),
@@ -147,8 +129,6 @@ static struct ieee80211_channel ieee80211_2ghz_channels[] = {
.flags = (_flags), \
}

-
-/* Table 6 in section 3.2.1.1 */
static struct ieee80211_rate ieee80211_bitrates[] = {
RATETAB_ENT(10, 0, 0),
RATETAB_ENT(20, 1, 0),
@@ -342,7 +322,6 @@ static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo,
mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME));
state = -1;
} else {
- /* Linear search for now */
for (i = 0; i < last_scanned_cnt; i++) {
if (memcmp(last_scanned_shadow[i].au8bssid,
pstrNetworkInfo->au8bssid, 6) == 0) {
@@ -394,7 +373,7 @@ static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo,
if (ap_found != -1)
kfree(last_scanned_shadow[ap_index].pu8IEs);
last_scanned_shadow[ap_index].pu8IEs =
- kmalloc(pstrNetworkInfo->u16IEsLen, GFP_KERNEL); /* will be deallocated by the WILC_WFI_CfgScan() function */
+ kmalloc(pstrNetworkInfo->u16IEsLen, GFP_KERNEL);
memcpy(last_scanned_shadow[ap_index].pu8IEs,
pstrNetworkInfo->pu8IEs, pstrNetworkInfo->u16IEsLen);
last_scanned_shadow[ap_index].u32TimeRcvdInScan = jiffies;
@@ -405,20 +384,6 @@ static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo,
last_scanned_shadow[ap_index].pJoinParams = pJoinParams;
}

-
-/**
- * @brief CfgScanResult
- * @details Callback function which returns the scan results found
- *
- * @param[in] tenuScanEvent enuScanEvent: enum, indicating the scan event triggered, whether that is
- * SCAN_EVENT_NETWORK_FOUND or SCAN_EVENT_DONE
- * tstrNetworkInfo* pstrNetworkInfo: structure holding the scan results information
- * void* pUserVoid: Private structure associated with the wireless interface
- * @return NONE
- * @author mabubakr
- * @date
- * @version 1.0
- */
static void CfgScanResult(enum scan_event scan_event,
tstrNetworkInfo *network_info,
void *user_void,
@@ -457,7 +422,7 @@ static void CfgScanResult(enum scan_event scan_event,
network_info->u16CapInfo, network_info->u16BeaconPeriod);

if (network_info->bNewNetwork) {
- if (priv->u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { /* TODO: mostafa: to be replaced by */
+ if (priv->u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) {
PRINT_D(CFG80211_DBG, "Network %s found\n", network_info->au8ssid);
priv->u32RcvdChCount++;

@@ -465,7 +430,6 @@ static void CfgScanResult(enum scan_event scan_event,
PRINT_INFO(CORECONFIG_DBG, ">> Something really bad happened\n");
add_network_to_shadow(network_info, priv, join_params);

- /*P2P peers are sent to WPA supplicant and added to shadow table*/
if (!(memcmp("DIRECT-", network_info->au8ssid, 7))) {
bss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, network_info->au8bssid, network_info->u64Tsf, network_info->u16CapInfo,
network_info->u16BeaconPeriod, (const u8 *)network_info->pu8IEs,
@@ -479,7 +443,7 @@ static void CfgScanResult(enum scan_event scan_event,
}
} else {
u32 i;
- /* So this network is discovered before, we'll just update its RSSI */
+
for (i = 0; i < priv->u32RcvdChCount; i++) {
if (memcmp(last_scanned_shadow[i].au8bssid, network_info->au8bssid, 6) == 0) {
PRINT_D(CFG80211_DBG, "Update RSSI of %s\n", last_scanned_shadow[i].au8ssid);
@@ -527,21 +491,6 @@ static void CfgScanResult(enum scan_event scan_event,
}
}

-
-/**
- * @brief CfgConnectResult
- * @details
- * @param[in] tenuConnDisconnEvent enuConnDisconnEvent: Type of connection response either
- * connection response or disconnection notification.
- * tstrConnectInfo* pstrConnectInfo: COnnection information.
- * u8 u8MacStatus: Mac Status from firmware
- * tstrDisconnectNotifInfo* pstrDisconnectNotifInfo: Disconnection Notification
- * void* pUserVoid: Private data associated with wireless interface
- * @return NONE
- * @author mabubakr
- * @date 01 MAR 2012
- * @version 1.0
- */
int wilc_connecting;

static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
@@ -566,7 +515,6 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;

if (enuConnDisconnEvent == CONN_DISCONN_EVENT_CONN_RESP) {
- /*Initialization*/
u16 u16ConnectStatus;

u16ConnectStatus = pstrConnectInfo->u16ConnectStatus;
@@ -575,8 +523,6 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,

if ((u8MacStatus == MAC_DISCONNECTED) &&
(pstrConnectInfo->u16ConnectStatus == SUCCESSFUL_STATUSCODE)) {
- /* The case here is that our station was waiting for association response frame and has just received it containing status code
- * = SUCCESSFUL_STATUSCODE, while mac status is MAC_DISCONNECTED (which means something wrong happened) */
u16ConnectStatus = WLAN_STATUS_UNSPECIFIED_FAILURE;
wilc_wlan_set_bssid(priv->dev, NullBssid);
eth_zero_addr(wilc_connected_ssid);
@@ -610,12 +556,8 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
}
}

- if (bNeedScanRefresh) {
- /*Also, refrsh DIRECT- results if */
+ if (bNeedScanRefresh)
refresh_scan(priv, 1, true);
-
- }
-
}


@@ -626,8 +568,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
cfg80211_connect_result(dev, pstrConnectInfo->au8bssid,
pstrConnectInfo->pu8ReqIEs, pstrConnectInfo->ReqIEsLen,
pstrConnectInfo->pu8RespIEs, pstrConnectInfo->u16RespIEsLen,
- u16ConnectStatus, GFP_KERNEL); /* TODO: mostafa: u16ConnectStatus to */
- /* be replaced by pstrConnectInfo->u16ConnectStatus */
+ u16ConnectStatus, GFP_KERNEL);
} else if (enuConnDisconnEvent == CONN_DISCONN_EVENT_DISCONN_NOTIF) {
wilc_optaining_ip = false;
PRINT_ER("Received MAC_DISCONNECTED from firmware with reason %d on dev [%p]\n",
@@ -641,14 +582,9 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,

if (!pstrWFIDrv->p2p_connect)
wlan_channel = 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 == wl->vif[1].ndev)) {
pstrDisconnectNotifInfo->u16reason = 3;
- }
- /*Incase "P2P CLIENT during connection(not connected)" send deauthentication reason by 1 to force the WPA_SUPPLICANT
- * to scan again and retry the connection*/
- else if ((!pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) {
+ } else if ((!pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) {
pstrDisconnectNotifInfo->u16reason = 1;
}
cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, pstrDisconnectNotifInfo->ie,
@@ -659,20 +595,6 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,

}

-
-/**
- * @brief set_channel
- * @details Set channel for a given wireless interface. Some devices
- * may support multi-channel operation (by channel hopping) so cfg80211
- * doesn't verify much. Note, however, that the passed netdev may be
- * %NULL as well if the user requested changing the channel for the
- * device itself, or for a monitor interface.
- * @param[in]
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int set_channel(struct wiphy *wiphy,
struct cfg80211_chan_def *chandef)
{
@@ -694,19 +616,6 @@ static int set_channel(struct wiphy *wiphy,
return result;
}

-/**
- * @brief scan
- * @details Request to do a scan. If returning zero, the scan request is given
- * the driver, and will be valid until passed to cfg80211_scan_done().
- * For scan results, call cfg80211_inform_bss(); you can call this outside
- * the scan/scan_done bracket too.
- * @param[in]
- * @return int : Return 0 on Success
- * @author mabubakr
- * @date 01 MAR 2012
- * @version 1.0
- */
-
static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
{
struct wilc_priv *priv;
@@ -725,8 +634,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
reset_shadow_found();

priv->bCfgScanning = true;
- if (request->n_channels <= MAX_NUM_SCANNED_NETWORKS) { /* TODO: mostafa: to be replaced by */
- /* max_scan_ssids */
+ if (request->n_channels <= MAX_NUM_SCANNED_NETWORKS) {
for (i = 0; i < request->n_channels; i++) {
au8ScanChanList[i] = (u8)ieee80211_frequency_to_channel(request->channels[i]->center_freq);
PRINT_INFO(CFG80211_DBG, "ScanChannel List[%d] = %d,", i, au8ScanChanList[i]);
@@ -781,18 +689,6 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
return s32Error;
}

-/**
- * @brief connect
- * @details Connect to the ESS with the specified parameters. When connected,
- * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
- * If the connection fails for some reason, call cfg80211_connect_result()
- * with the status from the AP.
- * @param[in]
- * @return int : Return 0 on Success
- * @author mabubakr
- * @date 01 MAR 2012
- * @version 1.0
- */
static int connect(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_connect_params *sme)
{
@@ -831,13 +727,9 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
sme->ssid_len) == 0) {
PRINT_INFO(CFG80211_DBG, "Network with required SSID is found %s\n", sme->ssid);
if (sme->bssid == NULL) {
- /* BSSID is not passed from the user, so decision of matching
- * is done by SSID only */
PRINT_INFO(CFG80211_DBG, "BSSID is not passed from the user\n");
break;
} else {
- /* BSSID is also passed from the user, so decision of matching
- * should consider also this passed BSSID */
if (memcmp(last_scanned_shadow[i].au8bssid,
sme->bssid,
ETH_ALEN) == 0) {
@@ -882,8 +774,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
}

if (sme->crypto.cipher_group != NO_ENCRYPT) {
- /* To determine the u8security value, first we check the group cipher suite then {in case of WPA or WPA2}
- * we will add to it the pairwise cipher suite(s) */
pcwpa_version = "Default";
PRINT_D(CORECONFIG_DBG, ">> sme->crypto.wpa_versions: %x\n", sme->crypto.wpa_versions);
if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP40) {
@@ -930,8 +820,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
u8security = ENCRYPT_ENABLED | WPA2 | TKIP;
pcgroup_encrypt_val = "WPA2_TKIP";
pccipher_group = "TKIP";
- } else { /* TODO: mostafa: here we assume that any other encryption type is AES */
- /* tenuSecurity_t = WPA2_AES; */
+ } else {
u8security = ENCRYPT_ENABLED | WPA2 | AES;
pcgroup_encrypt_val = "WPA2_AES";
pccipher_group = "AES";
@@ -942,8 +831,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
u8security = ENCRYPT_ENABLED | WPA | TKIP;
pcgroup_encrypt_val = "WPA_TKIP";
pccipher_group = "TKIP";
- } else { /* TODO: mostafa: here we assume that any other encryption type is AES */
- /* tenuSecurity_t = WPA_AES; */
+ } else {
u8security = ENCRYPT_ENABLED | WPA | AES;
pcgroup_encrypt_val = "WPA_AES";
pccipher_group = "AES";
@@ -960,14 +848,12 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,

}

- /* After we set the u8security value from checking the group cipher suite, {in case of WPA or WPA2} we will
- * add to it the pairwise cipher suite(s) */
if ((sme->crypto.wpa_versions & NL80211_WPA_VERSION_1)
|| (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2)) {
for (i = 0; i < sme->crypto.n_ciphers_pairwise; i++) {
if (sme->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP) {
u8security = u8security | TKIP;
- } else { /* TODO: mostafa: here we assume that any other encryption type is AES */
+ } else {
u8security = u8security | AES;
}
}
@@ -991,8 +877,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(CFG80211_DBG, "Automatic Authentation type = %d\n", sme->auth_type);
}

-
- /* ai: key_mgmt: enterprise case */
if (sme->crypto.n_akm_suites) {
switch (sme->crypto.akm_suites[0]) {
case WLAN_AKM_SUITE_8021X:
@@ -1033,16 +917,6 @@ done:
return s32Error;
}

-
-/**
- * @brief disconnect
- * @details Disconnect from the BSS/ESS.
- * @param[in]
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_code)
{
s32 s32Error = 0;
@@ -1074,16 +948,6 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co
return s32Error;
}

-/**
- * @brief add_key
- * @details Add a key with the given parameters. @mac_addr will be %NULL
- * when adding a group key.
- * @param[in] key : key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key, 8-byte Rx Mic Key
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
bool pairwise,
const u8 *mac_addr, struct key_params *params)
@@ -1187,13 +1051,10 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
pu8RxMic = params->key + 16;
KeyLen = params->key_len - 16;
}
- /* if there has been previous allocation for the same index through its key, free that memory and allocate again*/
kfree(priv->wilc_gtk[key_index]->key);

priv->wilc_gtk[key_index]->key = kmalloc(params->key_len, GFP_KERNEL);
memcpy(priv->wilc_gtk[key_index]->key, params->key, params->key_len);
-
- /* if there has been previous allocation for the same index through its seq, free that memory and allocate again*/
kfree(priv->wilc_gtk[key_index]->seq);

if ((params->seq_len) > 0) {
@@ -1268,13 +1129,11 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
u8mode = 0;
if (!pairwise) {
if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
- /* swap the tx mic by rx mic */
pu8RxMic = params->key + 24;
pu8TxMic = params->key + 16;
KeyLen = params->key_len - 16;
}

- /*save keys only on interface 0 (wifi interface)*/
if (!g_gtk_keys_saved && netdev == wl->vif[0].ndev) {
g_add_gtk_key_params.key_idx = key_index;
g_add_gtk_key_params.pairwise = pairwise;
@@ -1304,13 +1163,11 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, STATION_MODE, u8mode);
} else {
if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
- /* swap the tx mic by rx mic */
pu8RxMic = params->key + 24;
pu8TxMic = params->key + 16;
KeyLen = params->key_len - 16;
}

- /*save keys only on interface 0 (wifi interface)*/
if (!g_ptk_keys_saved && netdev == wl->vif[0].ndev) {
g_add_ptk_key_params.key_idx = key_index;
g_add_ptk_key_params.pairwise = pairwise;
@@ -1356,16 +1213,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
return s32Error;
}

-/**
- * @brief del_key
- * @details Remove a key given the @mac_addr (%NULL for a group key)
- * and @key_index, return -ENOENT if the key doesn't exist.
- * @param[in]
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int del_key(struct wiphy *wiphy, struct net_device *netdev,
u8 key_index,
bool pairwise,
@@ -1379,18 +1226,14 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
nic = netdev_priv(netdev);
wl = nic->wilc;

- /*delete saved keys, if any*/
if (netdev == wl->vif[0].ndev) {
g_ptk_keys_saved = false;
g_gtk_keys_saved = false;
g_wep_keys_saved = false;

- /*Delete saved WEP keys params, if any*/
kfree(g_key_wep_params.key);
g_key_wep_params.key = NULL;

- /*freeing memory allocated by "wilc_gtk" and "wilc_ptk" in "WILC_WIFI_ADD_KEY"*/
-
if ((priv->wilc_gtk[key_index]) != NULL) {

kfree(priv->wilc_gtk[key_index]->key);
@@ -1413,7 +1256,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
priv->wilc_ptk[key_index] = NULL;
}

- /*Delete saved PTK and GTK keys params, if any*/
kfree(g_key_ptk_params.key);
g_key_ptk_params.key = NULL;
kfree(g_key_ptk_params.seq);
@@ -1424,7 +1266,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
kfree(g_key_gtk_params.seq);
g_key_gtk_params.seq = NULL;

- /*Reset WILC_CHANGING_VIR_IF register to allow adding futrue keys to CE H/W*/
wilc_set_machw_change_vir_if(netdev, false);
}

@@ -1442,19 +1283,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
return 0;
}

-/**
- * @brief get_key
- * @details Get information about the key with the given parameters.
- * @mac_addr will be %NULL when requesting information for a group
- * key. All pointers given to the @callback function need not be valid
- * after it returns. This function should return an error if it is
- * not possible to retrieve the key, -ENOENT if it doesn't exist.
- * @param[in]
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
bool pairwise,
const u8 *mac_addr, void *cookie, void (*callback)(void *cookie, struct key_params *))
@@ -1490,18 +1318,9 @@ static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,

callback(cookie, &key_params);

- return 0; /* priv->wilc_gtk->key_len ?0 : -ENOENT; */
+ return 0;
}

-/**
- * @brief set_default_key
- * @details Set the default management frame key on an interface
- * @param[in]
- * @return int : Return 0 on Success.
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
bool unicast, bool multicast)
{
@@ -1520,16 +1339,6 @@ static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 ke
return 0;
}

-/**
- * @brief get_station
- * @details Get station information for the station identified by @mac
- * @param[in] NONE
- * @return int : Return 0 on Success.
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
-
static int get_station(struct wiphy *wiphy, struct net_device *dev,
const u8 *mac, struct station_info *sinfo)
{
@@ -1597,28 +1406,6 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
return 0;
}

-
-/**
- * @brief change_bss
- * @details Modify parameters for a given BSS.
- * @param[in]
- * -use_cts_prot: Whether to use CTS protection
- * (0 = no, 1 = yes, -1 = do not change)
- * -use_short_preamble: Whether the use of short preambles is allowed
- * (0 = no, 1 = yes, -1 = do not change)
- * -use_short_slot_time: Whether the use of short slot time is allowed
- * (0 = no, 1 = yes, -1 = do not change)
- * -basic_rates: basic rates in IEEE 802.11 format
- * (or NULL for no change)
- * -basic_rates_len: number of basic rates
- * -ap_isolate: do not forward packets between connected stations
- * -ht_opmode: HT Operation mode
- * (u16 = opmode, -1 = do not change)
- * @return int : Return 0 on Success.
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int change_bss(struct wiphy *wiphy, struct net_device *dev,
struct bss_parameters *params)
{
@@ -1626,16 +1413,6 @@ static int change_bss(struct wiphy *wiphy, struct net_device *dev,
return 0;
}

-/**
- * @brief set_wiphy_params
- * @details Notify that wiphy parameters have changed;
- * @param[in] Changed bitfield (see &enum wiphy_params_flags) describes which values
- * have changed.
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
{
s32 s32Error = 0;
@@ -1684,17 +1461,6 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
return s32Error;
}

-/**
- * @brief set_pmksa
- * @details Cache a PMKID for a BSSID. This is mostly useful for fullmac
- * devices running firmwares capable of generating the (re) association
- * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
- * @param[in]
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
struct cfg80211_pmksa *pmksa)
{
@@ -1710,7 +1476,6 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
for (i = 0; i < priv->pmkid_list.numpmkid; i++) {
if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid,
ETH_ALEN)) {
- /*If bssid already exists and pmkid value needs to reset*/
flag = PMKID_FOUND;
PRINT_D(CFG80211_DBG, "PMKID already exists\n");
break;
@@ -1736,15 +1501,6 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
return s32Error;
}

-/**
- * @brief del_pmksa
- * @details Delete a cached PMKID.
- * @param[in]
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
struct cfg80211_pmksa *pmksa)
{
@@ -1759,7 +1515,6 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
for (i = 0; i < priv->pmkid_list.numpmkid; i++) {
if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid,
ETH_ALEN)) {
- /*If bssid is found, reset the values*/
PRINT_D(CFG80211_DBG, "Reseting PMKID values\n");
memset(&priv->pmkid_list.pmkidlist[i], 0, sizeof(struct host_if_pmkid));
break;
@@ -1783,42 +1538,17 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
return s32Error;
}

-/**
- * @brief flush_pmksa
- * @details Flush all cached PMKIDs.
- * @param[in]
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int flush_pmksa(struct wiphy *wiphy, struct net_device *netdev)
{
struct wilc_priv *priv = wiphy_priv(wiphy);

PRINT_D(CFG80211_DBG, "Flushing PMKID key values\n");

- /*Get cashed Pmkids and set all with zeros*/
memset(&priv->pmkid_list, 0, sizeof(struct host_if_pmkid_attr));

return 0;
}

-
-/**
- * @brief WILC_WFI_CfgParseRxAction
- * @details Function parses the received frames and modifies the following attributes:
- * -GO Intent
- * -Channel list
- * -Operating Channel
- *
- * @param[in] u8* Buffer, u32 length
- * @return NONE.
- * @author mdaftedar
- * @date 12 DEC 2012
- * @version
- */
-
static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
{
u32 index = 0;
@@ -1836,10 +1566,9 @@ static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
channel_list_attr_index = index;
else if (buf[index] == OPERCHAN_ATTR_ID)
op_channel_attr_index = index;
- index += buf[index + 1] + 3; /* ID,Length byte */
+ index += buf[index + 1] + 3;
}
if (wlan_channel != INVALID_CHANNEL) {
- /*Modify channel list attribute*/
if (channel_list_attr_index) {
PRINT_D(GENERIC_DBG, "Modify channel list attribute\n");
for (i = channel_list_attr_index + 3; i < ((channel_list_attr_index + 3) + buf[channel_list_attr_index + 1]); i++) {
@@ -1851,7 +1580,7 @@ static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
}
}
}
- /*Modify operating channel attribute*/
+
if (op_channel_attr_index) {
PRINT_D(GENERIC_DBG, "Modify operating channel attribute\n");
buf[op_channel_attr_index + 6] = 0x51;
@@ -1860,16 +1589,6 @@ static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
}
}

-/**
- * @brief WILC_WFI_CfgParseTxAction
- * @details Function parses the transmitted action frames and modifies the
- * GO Intent attribute
- * @param[in] u8* Buffer, u32 length, bool bOperChan, u8 iftype
- * @return NONE.
- * @author mdaftedar
- * @date 12 DEC 2012
- * @version
- */
static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftype)
{
u32 index = 0;
@@ -1889,10 +1608,9 @@ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftyp
channel_list_attr_index = index;
else if (buf[index] == OPERCHAN_ATTR_ID)
op_channel_attr_index = index;
- index += buf[index + 1] + 3; /* ID,Length byte */
+ index += buf[index + 1] + 3;
}
if (wlan_channel != INVALID_CHANNEL && bOperChan) {
- /*Modify channel list attribute*/
if (channel_list_attr_index) {
PRINT_D(GENERIC_DBG, "Modify channel list attribute\n");
for (i = channel_list_attr_index + 3; i < ((channel_list_attr_index + 3) + buf[channel_list_attr_index + 1]); i++) {
@@ -1904,7 +1622,7 @@ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftyp
}
}
}
- /*Modify operating channel attribute*/
+
if (op_channel_attr_index) {
PRINT_D(GENERIC_DBG, "Modify operating channel attribute\n");
buf[op_channel_attr_index + 6] = 0x51;
@@ -1913,16 +1631,6 @@ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftyp
}
}

-/* @brief WILC_WFI_p2p_rx
- * @details
- * @param[in]
- *
- * @return None
- * @author Mai Daftedar
- * @date 2 JUN 2013
- * @version 1.0
- */
-
void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size)
{

@@ -1935,11 +1643,8 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size)
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;

- /* Get WILC header */
memcpy(&header, (buff - HOST_HDR_OFFSET), HOST_HDR_OFFSET);

- /* The packet offset field conain info about what type of managment frame */
- /* we are dealing with and ack status */
pkt_offset = GET_PKT_OFFSET(header);

if (pkt_offset & IS_MANAGMEMENT_CALLBACK) {
@@ -1963,7 +1668,6 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size)

PRINT_D(GENERIC_DBG, "Rx Frame Type:%x\n", buff[FRAME_TYPE_ID]);

- /*Upper layer is informed that the frame is received on this freq*/
s32Freq = ieee80211_channel_to_frequency(curr_channel, IEEE80211_BAND_2GHZ);

if (ieee80211_is_action(buff[FRAME_TYPE_ID])) {
@@ -2016,7 +1720,6 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size)

if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP) && (wilc_ie)) {
PRINT_D(GENERIC_DBG, "Sending P2P to host without extra elemnt\n");
- /* extra attribute for sig_dbm: signal strength in mBm, or 0 if unknown */
cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size - 7, 0);
return;
}
@@ -2033,16 +1736,6 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size)
}
}

-/**
- * @brief WILC_WFI_mgmt_tx_complete
- * @details Returns result of writing mgmt frame to VMM (Tx buffers are freed here)
- * @param[in] priv
- * transmitting status
- * @return None
- * @author Amr Abdelmoghny
- * @date 20 MAY 2013
- * @version 1.0
- */
static void WILC_WFI_mgmt_tx_complete(void *priv, int status)
{
struct p2p_mgmt_data *pv_data = (struct p2p_mgmt_data *)priv;
@@ -2052,16 +1745,6 @@ static void WILC_WFI_mgmt_tx_complete(void *priv, int status)
kfree(pv_data);
}

-/**
- * @brief WILC_WFI_RemainOnChannelReady
- * @details Callback function, called from handle_remain_on_channel on being ready on channel
- * @param
- * @return none
- * @author Amr abdelmoghny
- * @date 9 JUNE 2013
- * @version
- */
-
static void WILC_WFI_RemainOnChannelReady(void *pUserVoid)
{
struct wilc_priv *priv;
@@ -2079,16 +1762,6 @@ static void WILC_WFI_RemainOnChannelReady(void *pUserVoid)
GFP_KERNEL);
}

-/**
- * @brief WILC_WFI_RemainOnChannelExpired
- * @details Callback function, called on expiration of remain-on-channel duration
- * @param
- * @return none
- * @author Amr abdelmoghny
- * @date 15 MAY 2013
- * @version
- */
-
static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, u32 u32SessionID)
{
struct wilc_priv *priv;
@@ -2100,7 +1773,6 @@ static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, u32 u32SessionID)

priv->bInP2PlistenState = false;

- /*Inform wpas of remain-on-channel expiration*/
cfg80211_remain_on_channel_expired(priv->wdev,
priv->strRemainOnChanParams.u64ListenCookie,
priv->strRemainOnChanParams.pstrListenChan,
@@ -2111,20 +1783,6 @@ static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, u32 u32SessionID)
}
}

-
-/**
- * @brief remain_on_channel
- * @details Request the driver to remain awake on the specified
- * channel for the specified duration to complete an off-channel
- * operation (e.g., public action frame exchange). When the driver is
- * ready on the requested channel, it must indicate this with an event
- * notification by calling cfg80211_ready_on_channel().
- * @param[in]
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int remain_on_channel(struct wiphy *wiphy,
struct wireless_dev *wdev,
struct ieee80211_channel *chan,
@@ -2145,7 +1803,6 @@ static int remain_on_channel(struct wiphy *wiphy,

curr_channel = chan->hw_value;

- /*Setting params needed by WILC_WFI_RemainOnChannelExpired()*/
priv->strRemainOnChanParams.pstrListenChan = chan;
priv->strRemainOnChanParams.u64ListenCookie = *cookie;
priv->strRemainOnChanParams.u32ListenDuration = duration;
@@ -2162,19 +1819,6 @@ static int remain_on_channel(struct wiphy *wiphy,
return s32Error;
}

-/**
- * @brief cancel_remain_on_channel
- * @details Cancel an on-going remain-on-channel operation.
- * This allows the operation to be terminated prior to timeout based on
- * the duration value.
- * @param[in] struct wiphy *wiphy,
- * @param[in] struct net_device *dev
- * @param[in] u64 cookie,
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int cancel_remain_on_channel(struct wiphy *wiphy,
struct wireless_dev *wdev,
u64 cookie)
@@ -2189,16 +1833,7 @@ static int cancel_remain_on_channel(struct wiphy *wiphy,
s32Error = wilc_listen_state_expired(priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID);
return s32Error;
}
-/**
- * @brief WILC_WFI_mgmt_tx_frame
- * @details
- *
- * @param[in]
- * @return NONE.
- * @author mdaftedar
- * @date 01 JUL 2012
- * @version
- */
+
static int mgmt_tx(struct wiphy *wiphy,
struct wireless_dev *wdev,
struct cfg80211_mgmt_tx_params *params,
@@ -2225,8 +1860,6 @@ static int mgmt_tx(struct wiphy *wiphy,
mgmt = (const struct ieee80211_mgmt *) buf;

if (ieee80211_is_mgmt(mgmt->frame_control)) {
-
- /*mgmt frame allocation*/
mgmt_tx = kmalloc(sizeof(struct p2p_mgmt_data), GFP_KERNEL);
if (mgmt_tx == NULL) {
PRINT_ER("Failed to allocate memory for mgmt_tx structure\n");
@@ -2246,22 +1879,16 @@ static int mgmt_tx(struct wiphy *wiphy,
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);
- /*Save the current channel after we tune to it*/
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);


if (buf[ACTION_CAT_ID] == PUB_ACTION_ATTR_ID) {
- /*Only set the channel, if not a negotiation confirmation frame
- * (If Negotiation confirmation frame, force it
- * to be transmitted on the same negotiation channel)*/
-
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);
- /*Save the current channel after we tune to it*/
curr_channel = chan->hw_value;
}
switch (buf[ACTION_SUBTYPE_ID]) {
@@ -2280,7 +1907,6 @@ static int mgmt_tx(struct wiphy *wiphy,
case PUBLIC_ACT_VENDORSPEC:
{
if (!memcmp(p2p_oui, &buf[ACTION_SUBTYPE_ID + 1], 4)) {
- /*For the connection of two WILC's connection generate a rand number to determine who will be a GO*/
if ((buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP)) {
if (p2p_local_random == 1 && p2p_recv_random < p2p_local_random) {
get_random_bytes(&p2p_local_random, 1);
@@ -2293,14 +1919,10 @@ static int mgmt_tx(struct wiphy *wiphy,
if (p2p_local_random > p2p_recv_random) {
PRINT_D(GENERIC_DBG, "LOCAL WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, p2p_recv_random);

- /*Search for the p2p information information element , after the Public action subtype theres a byte for teh dialog token, skip that*/
for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) {
if (buf[i] == P2PELEM_ATTR_ID && !(memcmp(p2p_oui, &buf[i + 2], 4))) {
if (buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP)
WILC_WFI_CfgParseTxAction(&mgmt_tx->buff[i + 6], len - (i + 6), true, nic->iftype);
-
- /*If using supplicant go intent, no need at all*/
- /*to parse transmitted negotiation frames*/
else
WILC_WFI_CfgParseTxAction(&mgmt_tx->buff[i + 6], len - (i + 6), false, nic->iftype);
break;
@@ -2308,10 +1930,6 @@ static int mgmt_tx(struct wiphy *wiphy,
}

if (buf[P2P_PUB_ACTION_SUBTYPE] != P2P_INV_REQ && buf[P2P_PUB_ACTION_SUBTYPE] != P2P_INV_RSP) {
- /*
- * Adding WILC information element to allow two WILC devices to
- * identify each other and connect
- */
memcpy(&mgmt_tx->buff[len], p2p_vendor_spec, sizeof(p2p_vendor_spec));
mgmt_tx->buff[len + sizeof(p2p_vendor_spec)] = p2p_local_random;
mgmt_tx->size = buf_len;
@@ -2377,17 +1995,6 @@ static int mgmt_tx_cancel_wait(struct wiphy *wiphy,
return 0;
}

-/**
- * @brief wilc_mgmt_frame_register
- * @details Notify driver that a management frame type was
- * registered. Note that this callback may not sleep, and cannot run
- * concurrently with itself.
- * @param[in]
- * @return NONE.
- * @author mdaftedar
- * @date 01 JUL 2012
- * @version
- */
void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
u16 frame_type, bool reg)
{
@@ -2425,7 +2032,7 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
}

}
- /*If mac is closed, then return*/
+
if (!wl->initialized) {
PRINT_D(GENERIC_DBG, "Return since mac is closed\n");
return;
@@ -2435,18 +2042,6 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,

}

-/**
- * @brief set_cqm_rssi_config
- * @details Configure connection quality monitor RSSI threshold.
- * @param[in] struct wiphy *wiphy:
- * @param[in] struct net_device *dev:
- * @param[in] s32 rssi_thold:
- * @param[in] u32 rssi_hyst:
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev,
s32 rssi_thold, u32 rssi_hyst)
{
@@ -2454,19 +2049,7 @@ static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev,
return 0;

}
-/**
- * @brief dump_station
- * @details Configure connection quality monitor RSSI threshold.
- * @param[in] struct wiphy *wiphy:
- * @param[in] struct net_device *dev
- * @param[in] int idx
- * @param[in] u8 *mac
- * @param[in] struct station_info *sinfo
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
+
static int dump_station(struct wiphy *wiphy, struct net_device *dev,
int idx, u8 *mac, struct station_info *sinfo)
{
@@ -2487,16 +2070,6 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev,

}

-
-/**
- * @brief set_power_mgmt
- * @details
- * @param[in]
- * @return int : Return 0 on Success.
- * @author mdaftedar
- * @date 01 JUL 2012
- * @version 1.0
- */
static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
bool enabled, int timeout)
{
@@ -2521,16 +2094,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,

}

-/**
- * @brief change_virtual_intf
- * @details Change type/configuration of virtual interface,
- * keep the struct wireless_dev's iftype updated.
- * @param[in] NONE
- * @return int : Return 0 on Success.
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
enum nl80211_iftype type, u32 *flags, struct vif_params *params)
{
@@ -2553,7 +2116,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wilc_optaining_ip = false;
del_timer(&wilc_during_ip_timer);
PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n");
- /*Set WILC_CHANGING_VIR_IF register to disallow adding futrue keys to CE H/W*/
+
if (g_ptk_keys_saved && g_gtk_keys_saved) {
wilc_set_machw_change_vir_if(dev, true);
}
@@ -2563,15 +2126,11 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wilc_connecting = 0;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_STATION\n");

- /* send delba over wlan interface */
-
-
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
nic->monitor_flag = 0;
nic->iftype = STATION_MODE;

- /*Remove the enteries of the previously connected clients*/
memset(priv->assoc_stainfo.au8Sta_AssociatedBss, 0, MAX_NUM_STA * ETH_ALEN);
interface_type = nic->iftype;
nic->iftype = STATION_MODE;
@@ -2579,10 +2138,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
if (wl->initialized) {
wilc_del_all_rx_ba_session(priv->hWILCWFIDrv,
wl->vif[0].bssid, TID);
- /* ensure that the message Q is empty */
wilc_wait_msg_queue_idle();

- /*Eliminate host interface blocking state*/
up(&wl->cfg_event);

wilc1000_wlan_deinit(dev);
@@ -2590,13 +2147,11 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wilc_initialized = 1;
nic->iftype = interface_type;

- /*Setting interface 1 drv handler and mac address in newly downloaded FW*/
wilc_set_wfi_drv_handler(wl->vif[0].hif_drv);
wilc_set_mac_address(wl->vif[0].hif_drv,
wl->vif[0].src_addr);
wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);

- /*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
wilc_set_wep_default_keyid(wl->vif[0].hif_drv,
g_key_wep_params.key_idx);
@@ -2606,11 +2161,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
g_key_wep_params.key_idx);
}

- /*No matter the driver handler passed here, it will be overwriiten*/
- /*in Handle_FlushConnect() with gu8FlushedJoinReqDrvHandler*/
wilc_flush_join_req(priv->hWILCWFIDrv);

- /*Add saved PTK and GTK keys, if any*/
if (g_ptk_keys_saved && g_gtk_keys_saved) {
PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0],
g_key_ptk_params.key[1],
@@ -2666,7 +2218,6 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,


if (wl->initialized) {
- /* ensure that the message Q is empty */
wilc_wait_msg_queue_idle();

wilc1000_wlan_deinit(dev);
@@ -2678,7 +2229,6 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wl->vif[0].src_addr);
wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);

- /*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
wilc_set_wep_default_keyid(wl->vif[0].hif_drv,
g_key_wep_params.key_idx);
@@ -2688,11 +2238,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
g_key_wep_params.key_idx);
}

- /*No matter the driver handler passed here, it will be overwriiten*/
- /*in Handle_FlushConnect() with gu8FlushedJoinReqDrvHandler*/
wilc_flush_join_req(priv->hWILCWFIDrv);

- /*Add saved PTK and GTK keys, if any*/
if (g_ptk_keys_saved && g_gtk_keys_saved) {
PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0],
g_key_ptk_params.key[1],
@@ -2715,7 +2262,6 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
(struct key_params *)(&g_key_gtk_params));
}

- /*Refresh scan, to refresh the scan results to the wpa_supplicant. Set MachHw to false to enable further key installments*/
refresh_scan(priv, 1, true);
wilc_set_machw_change_vir_if(dev, false);

@@ -2741,7 +2287,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,

PRINT_D(HOSTAPD_DBG, "Downloading AP firmware\n");
wilc_wlan_get_firmware(dev);
- /*If wilc is running, then close-open to actually get new firmware running (serves P2P)*/
+
if (wl->initialized) {
nic->iftype = AP_MODE;
wilc_mac_close(dev);
@@ -2764,10 +2310,6 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
mod_timer(&wilc_during_ip_timer,
jiffies + msecs_to_jiffies(during_ip_time));
wilc_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
- /*Delete block ack has to be the latest config packet*/
- /*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*/
wilc_del_all_rx_ba_session(priv->hWILCWFIDrv,
wl->vif[0].bssid, TID);
wilc_enable_ps = false;
@@ -2782,20 +2324,16 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,

nic->iftype = GO_MODE;

- /* ensure that the message Q is empty */
wilc_wait_msg_queue_idle();
wilc1000_wlan_deinit(dev);
wilc1000_wlan_init(dev, nic);
wilc_initialized = 1;

-
- /*Setting interface 1 drv handler and mac address in newly downloaded FW*/
wilc_set_wfi_drv_handler(wl->vif[0].hif_drv);
wilc_set_mac_address(wl->vif[0].hif_drv,
wl->vif[0].src_addr);
wilc_set_operation_mode(priv->hWILCWFIDrv, AP_MODE);

- /*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
wilc_set_wep_default_keyid(wl->vif[0].hif_drv,
g_key_wep_params.key_idx);
@@ -2805,11 +2343,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
g_key_wep_params.key_idx);
}

- /*No matter the driver handler passed here, it will be overwriiten*/
- /*in Handle_FlushConnect() with gu8FlushedJoinReqDrvHandler*/
wilc_flush_join_req(priv->hWILCWFIDrv);

- /*Add saved PTK and GTK keys, if any*/
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],
g_key_ptk_params.key[1],
@@ -2853,32 +2388,6 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
return 0;
}

-/* (austin.2013-07-23)
- *
- * To support revised cfg80211_ops
- *
- * add_beacon --> start_ap
- * set_beacon --> change_beacon
- * del_beacon --> stop_ap
- *
- * beacon_parameters --> cfg80211_ap_settings
- * cfg80211_beacon_data
- *
- * applicable for linux kernel 3.4+
- */
-
-/**
- * @brief start_ap
- * @details Add a beacon with given parameters, @head, @interval
- * and @dtim_period will be valid, @tail is optional.
- * @param[in] wiphy
- * @param[in] dev The net device structure
- * @param[in] settings cfg80211_ap_settings parameters for the beacon to be added
- * @return int : Return 0 on Success.
- * @author austin
- * @date 23 JUL 2013
- * @version 1.0
- */
static int start_ap(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_ap_settings *settings)
{
@@ -2912,18 +2421,6 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
return s32Error;
}

-/**
- * @brief change_beacon
- * @details Add a beacon with given parameters, @head, @interval
- * and @dtim_period will be valid, @tail is optional.
- * @param[in] wiphy
- * @param[in] dev The net device structure
- * @param[in] beacon cfg80211_beacon_data for the beacon to be changed
- * @return int : Return 0 on Success.
- * @author austin
- * @date 23 JUL 2013
- * @version 1.0
- */
static int change_beacon(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_beacon_data *beacon)
{
@@ -2943,15 +2440,6 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev,
return s32Error;
}

-/**
- * @brief stop_ap
- * @details Remove beacon configuration and stop sending the beacon.
- * @param[in]
- * @return int : Return 0 on Success.
- * @author austin
- * @date 23 JUL 2013
- * @version 1.0
- */
static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
{
s32 s32Error = 0;
@@ -2975,15 +2463,6 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
return s32Error;
}

-/**
- * @brief add_station
- * @details Add a new station.
- * @param[in]
- * @return int : Return 0 on Success.
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int add_station(struct wiphy *wiphy, struct net_device *dev,
const u8 *mac, struct station_parameters *params)
{
@@ -3055,15 +2534,6 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
return s32Error;
}

-/**
- * @brief del_station
- * @details Remove a station; @mac may be NULL to remove all stations.
- * @param[in]
- * @return int : Return 0 on Success.
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int del_station(struct wiphy *wiphy, struct net_device *dev,
struct station_del_parameters *params)
{
@@ -3097,15 +2567,6 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,
return s32Error;
}

-/**
- * @brief change_station
- * @details Modify a given station.
- * @param[in]
- * @return int : Return 0 on Success.
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static int change_station(struct wiphy *wiphy, struct net_device *dev,
const u8 *mac, struct station_parameters *params)
{
@@ -3178,16 +2639,6 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
return s32Error;
}

-
-/**
- * @brief add_virtual_intf
- * @details
- * @param[in]
- * @return int : Return 0 on Success.
- * @author mdaftedar
- * @date 01 JUL 2012
- * @version 1.0
- */
static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy,
const char *name,
unsigned char name_assign_type,
@@ -3222,15 +2673,6 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy,
return priv->wdev;
}

-/**
- * @brief del_virtual_intf
- * @details
- * @param[in]
- * @return int : Return 0 on Success.
- * @author mdaftedar
- * @date 01 JUL 2012
- * @version 1.0
- */
static int del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
{
PRINT_D(HOSTAPD_DBG, "Deleting virtual interface\n");
@@ -3275,19 +2717,6 @@ static struct cfg80211_ops wilc_cfg80211_ops = {

};

-
-
-
-
-/**
- * @brief WILC_WFI_update_stats
- * @details Modify parameters for a given BSS.
- * @param[in]
- * @return int : Return 0 on Success.
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed)
{

@@ -3319,16 +2748,6 @@ int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed)
return 0;
}

-/**
- * @brief WILC_WFI_CfgAlloc
- * @details Allocation of the wireless device structure and assigning it
- * to the cfg80211 operations structure.
- * @param[in] NONE
- * @return wireless_dev : Returns pointer to wireless_dev structure.
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
static struct wireless_dev *WILC_WFI_CfgAlloc(void)
{

@@ -3336,14 +2755,13 @@ static struct wireless_dev *WILC_WFI_CfgAlloc(void)


PRINT_D(CFG80211_DBG, "Allocating wireless device\n");
- /*Allocating the wireless device structure*/
+
wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
if (!wdev) {
PRINT_ER("Cannot allocate wireless device\n");
goto _fail_;
}

- /*Creating a new wiphy, linking wireless structure with the wiphy structure*/
wdev->wiphy = wiphy_new(&wilc_cfg80211_ops, sizeof(struct wilc_priv));
if (!wdev->wiphy) {
PRINT_ER("Cannot allocate wiphy\n");
@@ -3351,14 +2769,12 @@ static struct wireless_dev *WILC_WFI_CfgAlloc(void)

}

- /* enable 802.11n HT */
WILC_WFI_band_2ghz.ht_cap.ht_supported = 1;
WILC_WFI_band_2ghz.ht_cap.cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT);
WILC_WFI_band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff;
WILC_WFI_band_2ghz.ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_8K;
WILC_WFI_band_2ghz.ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE;

- /*wiphy bands*/
wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &WILC_WFI_band_2ghz;

return wdev;
@@ -3369,15 +2785,7 @@ _fail_:
return NULL;

}
-/**
- * @brief wilc_create_wiphy
- * @details Registering of the wiphy structure and interface modes
- * @param[in] NONE
- * @return NONE
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
+
struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev)
{
struct wilc_priv *priv;
@@ -3392,33 +2800,20 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de
return NULL;
}

-
- /*Return hardware description structure (wiphy)'s priv*/
priv = wdev_priv(wdev);
sema_init(&(priv->SemHandleUpdateStats), 1);
-
- /*Link the wiphy with wireless structure*/
priv->wdev = wdev;
-
- /*Maximum number of probed ssid to be added by user for the scan request*/
wdev->wiphy->max_scan_ssids = MAX_NUM_PROBED_SSID;
- /*Maximum number of pmkids to be cashed*/
wdev->wiphy->max_num_pmkids = WILC_MAX_NUM_PMKIDS;
PRINT_INFO(CFG80211_DBG, "Max number of PMKIDs = %d\n", wdev->wiphy->max_num_pmkids);

wdev->wiphy->max_scan_ie_len = 1000;
-
- /*signal strength in mBm (100*dBm) */
wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
-
- /*Set the availaible cipher suites*/
wdev->wiphy->cipher_suites = cipher_suites;
wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
- /*Setting default managment types: for register action frame: */
wdev->wiphy->mgmt_stypes = wilc_wfi_cfg80211_mgmt_types;

wdev->wiphy->max_remain_on_channel_duration = 500;
- /*Setting the wiphy interfcae mode and type before registering the wiphy*/
wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP) | BIT(NL80211_IFTYPE_MONITOR) | BIT(NL80211_IFTYPE_P2P_GO) |
BIT(NL80211_IFTYPE_P2P_CLIENT);
wdev->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
@@ -3432,11 +2827,9 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de

set_wiphy_dev(wdev->wiphy, dev);

- /*Register wiphy structure*/
s32Error = wiphy_register(wdev->wiphy);
if (s32Error) {
PRINT_ER("Cannot register wiphy device\n");
- /*should define what action to be taken in such failure*/
} else {
PRINT_D(CFG80211_DBG, "Successful Registering\n");
}
@@ -3446,15 +2839,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de


}
-/**
- * @brief WILC_WFI_WiphyFree
- * @details Freeing allocation of the wireless device structure
- * @param[in] NONE
- * @return NONE
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
+
int wilc_init_host_int(struct net_device *net)
{

@@ -3486,15 +2871,6 @@ int wilc_init_host_int(struct net_device *net)
return s32Error;
}

-/**
- * @brief WILC_WFI_WiphyFree
- * @details Freeing allocation of the wireless device structure
- * @param[in] NONE
- * @return NONE
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
int wilc_deinit_host_int(struct net_device *net)
{
int s32Error = 0;
@@ -3511,7 +2887,6 @@ int wilc_deinit_host_int(struct net_device *net)

s32Error = wilc_deinit(priv->hWILCWFIDrv);

- /* Clear the Shadow scan */
clear_shadow_scan();
if (op_ifcs == 0) {
PRINT_D(CORECONFIG_DBG, "destroy during ip\n");
@@ -3524,16 +2899,6 @@ int wilc_deinit_host_int(struct net_device *net)
return s32Error;
}

-
-/**
- * @brief WILC_WFI_WiphyFree
- * @details Freeing allocation of the wireless device structure
- * @param[in] NONE
- * @return NONE
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
void wilc_free_wiphy(struct net_device *net)
{
PRINT_D(CFG80211_DBG, "Unregistering wiphy\n");
--
1.9.1


2015-11-25 02:56:51

by Glen Lee

[permalink] [raw]
Subject: [PATCH 05/10] staging: wilc1000: fixes potential null dereference 'wid.val'

From: Leo Kim <[email protected]>

This patch fixes the error reported by smatch.
- Handle_ListenStateExpired() error: potential null dereference 'wid.val'
If kmalloc failed, referenced to a NULL pointer.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index aae5a03..da4f4c6 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2629,8 +2629,10 @@ static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv,
wid.size = 2;
wid.val = kmalloc(wid.size, GFP_KERNEL);

- if (!wid.val)
+ if (!wid.val) {
PRINT_ER("Failed to allocate memory\n");
+ return -ENOMEM;
+ }

wid.val[0] = u8remain_on_chan_flag;
wid.val[1] = FALSE_FRMWR_CHANNEL;
--
1.9.1