Commit f3c1366e authored by Glen Lee's avatar Glen Lee Committed by Greg Kroah-Hartman

staging: wilc1000: mac_open: use netdev private wilc

Use netdev private data member wilc instead of global variable g_linux_wlan.
Signed-off-by: default avatarGlen Lee <glen.lee@atmel.com>
Signed-off-by: default avatarTony Cho <tony.cho@atmel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 38afb390
......@@ -1167,9 +1167,13 @@ int mac_open(struct net_device *ndev)
int ret = 0;
int i = 0;
struct wilc_priv *priv;
struct wilc *wl;
nic = netdev_priv(ndev);
wl = nic->wilc;
#ifdef WILC_SPI
if (!g_linux_wlan || !g_linux_wlan->wilc_spidev) {
if (!wl|| !wl->wilc_spidev) {
netdev_err(ndev, "wilc1000: SPI device not ready\n");
return -ENODEV;
}
......@@ -1200,16 +1204,16 @@ int mac_open(struct net_device *ndev)
PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);
/* loop through the NUM of supported devices and set the MAC address */
for (i = 0; i < g_linux_wlan->vif_num; i++) {
if (ndev == g_linux_wlan->vif[i].ndev) {
memcpy(g_linux_wlan->vif[i].src_addr, mac_add, ETH_ALEN);
g_linux_wlan->vif[i].hif_drv = priv->hWILCWFIDrv;
for (i = 0; i < wl->vif_num; i++) {
if (ndev == wl->vif[i].ndev) {
memcpy(wl->vif[i].src_addr, mac_add, ETH_ALEN);
wl->vif[i].hif_drv = priv->hWILCWFIDrv;
break;
}
}
/* TODO: get MAC address whenever the source is EPROM - hardcoded and copy it to ndev*/
memcpy(ndev->dev_addr, g_linux_wlan->vif[i].src_addr, ETH_ALEN);
memcpy(ndev->dev_addr, wl->vif[i].src_addr, ETH_ALEN);
if (!is_valid_ether_addr(ndev->dev_addr)) {
PRINT_ER("Error: Wrong MAC address\n");
......@@ -1222,13 +1226,13 @@ int mac_open(struct net_device *ndev)
wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, nic->wilc_netdev->ieee80211_ptr,
nic->g_struct_frame_reg[1].frame_type, nic->g_struct_frame_reg[1].reg);
netif_wake_queue(ndev);
g_linux_wlan->open_ifcs++;
wl->open_ifcs++;
nic->mac_opened = 1;
return 0;
_err_:
wilc_deinit_host_int(ndev);
wilc1000_wlan_deinit(g_linux_wlan);
wilc1000_wlan_deinit(wl);
return ret;
}
......
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