Commit 4e90d5f3 authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

staging: wilc1000: refactor wilc_wlan_set_bssid()

Refactor code by making use of eth_zero_addr() to clear the mac address
value in wilc_wlan_set_bssid().
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 92f6de43
...@@ -198,7 +198,11 @@ void wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode) ...@@ -198,7 +198,11 @@ void wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode)
{ {
struct wilc_vif *vif = netdev_priv(wilc_netdev); struct wilc_vif *vif = netdev_priv(wilc_netdev);
memcpy(vif->bssid, bssid, 6); if (bssid)
ether_addr_copy(vif->bssid, bssid);
else
eth_zero_addr(vif->bssid);
vif->mode = mode; vif->mode = mode;
} }
......
...@@ -390,7 +390,6 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, ...@@ -390,7 +390,6 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt,
struct wilc_vif *vif = netdev_priv(dev); struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wl = vif->wilc; struct wilc *wl = vif->wilc;
struct host_if_drv *wfi_drv = priv->hif_drv; struct host_if_drv *wfi_drv = priv->hif_drv;
u8 null_bssid[ETH_ALEN] = {0};
vif->connecting = false; vif->connecting = false;
...@@ -402,8 +401,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, ...@@ -402,8 +401,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt,
if (mac_status == WILC_MAC_STATUS_DISCONNECTED && if (mac_status == WILC_MAC_STATUS_DISCONNECTED &&
conn_info->status == WLAN_STATUS_SUCCESS) { conn_info->status == WLAN_STATUS_SUCCESS) {
connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE; connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
wilc_wlan_set_bssid(priv->dev, null_bssid, wilc_wlan_set_bssid(priv->dev, NULL, WILC_STATION_MODE);
WILC_STATION_MODE);
if (!wfi_drv->p2p_connect) if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL; wlan_channel = INVALID_CHANNEL;
...@@ -445,7 +443,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, ...@@ -445,7 +443,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt,
priv->p2p.recv_random = 0x00; priv->p2p.recv_random = 0x00;
priv->p2p.is_wilc_ie = false; priv->p2p.is_wilc_ie = false;
eth_zero_addr(priv->associated_bss); eth_zero_addr(priv->associated_bss);
wilc_wlan_set_bssid(priv->dev, null_bssid, WILC_STATION_MODE); wilc_wlan_set_bssid(priv->dev, NULL, WILC_STATION_MODE);
if (!wfi_drv->p2p_connect) if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL; wlan_channel = INVALID_CHANNEL;
...@@ -720,13 +718,11 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, ...@@ -720,13 +718,11 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
nw_info->ch, nw_info->ch,
nw_info->join_params); nw_info->join_params);
if (ret) { if (ret) {
u8 null_bssid[ETH_ALEN] = {0};
netdev_err(dev, "wilc_set_join_req(): Error\n"); netdev_err(dev, "wilc_set_join_req(): Error\n");
ret = -ENOENT; ret = -ENOENT;
if (!wfi_drv->p2p_connect) if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL; wlan_channel = INVALID_CHANNEL;
wilc_wlan_set_bssid(dev, null_bssid, WILC_STATION_MODE); wilc_wlan_set_bssid(dev, NULL, WILC_STATION_MODE);
goto out_error; goto out_error;
} }
return 0; return 0;
...@@ -744,7 +740,6 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, ...@@ -744,7 +740,6 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev,
struct wilc *wilc = vif->wilc; struct wilc *wilc = vif->wilc;
struct host_if_drv *wfi_drv; struct host_if_drv *wfi_drv;
int ret; int ret;
u8 null_bssid[ETH_ALEN] = {0};
vif->connecting = false; vif->connecting = false;
...@@ -760,7 +755,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, ...@@ -760,7 +755,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev,
wfi_drv = (struct host_if_drv *)priv->hif_drv; wfi_drv = (struct host_if_drv *)priv->hif_drv;
if (!wfi_drv->p2p_connect) if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL; wlan_channel = INVALID_CHANNEL;
wilc_wlan_set_bssid(priv->dev, null_bssid, WILC_STATION_MODE); wilc_wlan_set_bssid(priv->dev, NULL, WILC_STATION_MODE);
priv->p2p.local_random = 0x01; priv->p2p.local_random = 0x01;
priv->p2p.recv_random = 0x00; priv->p2p.recv_random = 0x00;
...@@ -1805,9 +1800,8 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev) ...@@ -1805,9 +1800,8 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
int ret; int ret;
struct wilc_priv *priv = wiphy_priv(wiphy); struct wilc_priv *priv = wiphy_priv(wiphy);
struct wilc_vif *vif = netdev_priv(priv->dev); struct wilc_vif *vif = netdev_priv(priv->dev);
u8 null_bssid[ETH_ALEN] = {0};
wilc_wlan_set_bssid(dev, null_bssid, WILC_AP_MODE); wilc_wlan_set_bssid(dev, NULL, WILC_AP_MODE);
ret = wilc_del_beacon(vif); ret = wilc_del_beacon(vif);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment