staging: wilc1000: remove use of unnecessary 'wilc_connected_ssid' variable

'wilc_connected_ssid' actually used to store the BSSID information for
connected BSSID. 'wilc_vif' already has 'bssid' variable to store the
same information. So refactor code to remove 'wilc_connected_ssid' and
instead used 'wilc_vif' struct 'bssid' element.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Ajay Singh 2018-09-25 11:53:35 +05:30 committed by Greg Kroah-Hartman
parent 39996811d5
commit d29ad322e0
3 changed files with 15 additions and 35 deletions

View File

@ -813,7 +813,6 @@ error:
kfree(msg);
}
u8 wilc_connected_ssid[6] = {0};
static void handle_connect(struct work_struct *work)
{
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@ -835,11 +834,6 @@ static void handle_connect(struct work_struct *work)
return;
}
if (memcmp(conn_attr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) {
netdev_err(vif->ndev, "Discard connect request\n");
goto error;
}
bss_param = conn_attr->params;
if (!bss_param) {
netdev_err(vif->ndev, "Required BSSID not found\n");
@ -1019,10 +1013,6 @@ static void handle_connect(struct work_struct *work)
cur_byte = wid_list[wid_cnt].val;
wid_cnt++;
if (conn_attr->bssid)
memcpy(wilc_connected_ssid,
conn_attr->bssid, ETH_ALEN);
result = wilc_send_config_pkt(vif, SET_CFG, wid_list,
wid_cnt,
wilc_get_vif_idx(vif));
@ -1145,8 +1135,6 @@ static void handle_connect_timeout(struct work_struct *work)
kfree(hif_drv->usr_conn_req.ies);
hif_drv->usr_conn_req.ies = NULL;
eth_zero_addr(wilc_connected_ssid);
out:
kfree(msg);
}
@ -1452,16 +1440,6 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
}
}
if (mac_status == MAC_STATUS_CONNECTED &&
conn_info.status != WLAN_STATUS_SUCCESS) {
netdev_err(vif->ndev,
"Received MAC status is MAC_STATUS_CONNECTED, Assoc Resp is not SUCCESS\n");
eth_zero_addr(wilc_connected_ssid);
} else if (mac_status == MAC_STATUS_DISCONNECTED) {
netdev_err(vif->ndev, "Received MAC status is MAC_STATUS_DISCONNECTED\n");
eth_zero_addr(wilc_connected_ssid);
}
if (hif_drv->usr_conn_req.bssid) {
memcpy(conn_info.bssid, hif_drv->usr_conn_req.bssid, 6);
@ -1874,8 +1852,6 @@ static void handle_disconnect(struct work_struct *work)
vif->obtaining_ip = false;
wilc_set_power_mgmt(vif, 0, 0);
eth_zero_addr(wilc_connected_ssid);
result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));

View File

@ -359,6 +359,4 @@ int wilc_get_vif_idx(struct wilc_vif *vif);
int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power);
int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power);
extern u8 wilc_connected_ssid[6];
#endif

View File

@ -478,7 +478,6 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt,
connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
wilc_wlan_set_bssid(priv->dev, null_bssid,
STATION_MODE);
eth_zero_addr(wilc_connected_ssid);
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
@ -521,7 +520,6 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt,
wilc_ie = false;
eth_zero_addr(priv->associated_bss);
wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
eth_zero_addr(wilc_connected_ssid);
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
@ -696,8 +694,12 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
nw_info = &priv->scanned_shadow[sel_bssi_idx];
} else {
ret = -ENOENT;
vif->connecting = false;
return ret;
goto out_error;
}
if (ether_addr_equal_unaligned(vif->bssid, nw_info->bssid)) {
ret = -EALREADY;
goto out_error;
}
memset(priv->wep_key, 0, sizeof(priv->wep_key));
@ -739,8 +741,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
ret = -ENOTSUPP;
netdev_err(dev, "%s: Unsupported cipher\n",
__func__);
vif->connecting = false;
return ret;
goto out_error;
}
}
@ -787,13 +788,18 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
security, auth_type,
nw_info->ch,
nw_info->join_params);
if (ret != 0) {
if (ret) {
u8 null_bssid[ETH_ALEN] = {0};
netdev_err(dev, "wilc_set_join_req(): Error\n");
ret = -ENOENT;
vif->connecting = false;
return ret;
wilc_wlan_set_bssid(dev, null_bssid, STATION_MODE);
goto out_error;
}
return 0;
out_error:
vif->connecting = false;
return ret;
}