ath6kl: Use the other variant of netdev (un)register APIs

Use replace (un)register_netdev() with (un)register_netdevice()
so that the same ath6kl function can be used with
add_virtual_intf()/del_virtual_intf().

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
Vasanthakumar Thiagarajan 2011-10-25 19:34:21 +05:30 committed by Kalle Valo
parent 990bd91519
commit 2792972395
3 changed files with 15 additions and 13 deletions

View File

@ -2099,14 +2099,7 @@ void ath6kl_deinit_if_data(struct ath6kl_vif *vif)
{ {
aggr_module_destroy(vif->aggr_cntxt); aggr_module_destroy(vif->aggr_cntxt);
vif->aggr_cntxt = NULL; unregister_netdevice(vif->ndev);
if (test_bit(NETDEV_REGISTERED, &vif->flags)) {
unregister_netdev(vif->ndev);
clear_bit(NETDEV_REGISTERED, &vif->flags);
}
free_netdev(vif->ndev);
} }
struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name, struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
@ -2138,7 +2131,7 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
if (ath6kl_init_if_data(vif)) if (ath6kl_init_if_data(vif))
goto err; goto err;
if (register_netdev(ndev)) if (register_netdevice(ndev))
goto err; goto err;
vif->sme_state = SME_DISCONNECTED; vif->sme_state = SME_DISCONNECTED;
@ -2153,8 +2146,8 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
return ndev; return ndev;
err: err:
ath6kl_deinit_if_data(vif); aggr_module_destroy(vif->aggr_cntxt);
free_netdev(ndev);
return NULL; return NULL;
} }

View File

@ -1416,8 +1416,13 @@ static int ath6kl_init(struct ath6kl *ar)
goto err_node_cleanup; goto err_node_cleanup;
} }
rtnl_lock();
/* Add an initial station interface */ /* Add an initial station interface */
ndev = ath6kl_interface_add(ar, "wlan%d", NL80211_IFTYPE_STATION, 0); ndev = ath6kl_interface_add(ar, "wlan%d", NL80211_IFTYPE_STATION, 0);
rtnl_unlock();
if (!ndev) { if (!ndev) {
ath6kl_err("Failed to instantiate a network device\n"); ath6kl_err("Failed to instantiate a network device\n");
status = -ENOMEM; status = -ENOMEM;
@ -1523,7 +1528,9 @@ err_rxbuf_cleanup:
err_cleanup_scatter: err_cleanup_scatter:
ath6kl_hif_cleanup_scatter(ar); ath6kl_hif_cleanup_scatter(ar);
err_if_deinit: err_if_deinit:
rtnl_lock();
ath6kl_deinit_if_data(netdev_priv(ndev)); ath6kl_deinit_if_data(netdev_priv(ndev));
rtnl_unlock();
wiphy_unregister(ar->wiphy); wiphy_unregister(ar->wiphy);
err_debug_init: err_debug_init:
ath6kl_debug_cleanup(ar); ath6kl_debug_cleanup(ar);
@ -1622,8 +1629,6 @@ static void ath6kl_cleanup_vif(struct ath6kl_vif *vif, bool wmi_ready)
cfg80211_scan_done(vif->scan_req, true); cfg80211_scan_done(vif->scan_req, true);
vif->scan_req = NULL; vif->scan_req = NULL;
} }
ath6kl_deinit_if_data(vif);
} }
void ath6kl_stop_txrx(struct ath6kl *ar) void ath6kl_stop_txrx(struct ath6kl *ar)
@ -1642,6 +1647,9 @@ void ath6kl_stop_txrx(struct ath6kl *ar)
list_del(&vif->list); list_del(&vif->list);
spin_unlock(&ar->list_lock); spin_unlock(&ar->list_lock);
ath6kl_cleanup_vif(vif, test_bit(WMI_READY, &ar->flag)); ath6kl_cleanup_vif(vif, test_bit(WMI_READY, &ar->flag));
rtnl_lock();
ath6kl_deinit_if_data(vif);
rtnl_unlock();
spin_lock(&ar->list_lock); spin_lock(&ar->list_lock);
} }
spin_unlock(&ar->list_lock); spin_unlock(&ar->list_lock);

View File

@ -1445,6 +1445,7 @@ static struct net_device_ops ath6kl_netdev_ops = {
void init_netdev(struct net_device *dev) void init_netdev(struct net_device *dev)
{ {
dev->netdev_ops = &ath6kl_netdev_ops; dev->netdev_ops = &ath6kl_netdev_ops;
dev->destructor = free_netdev;
dev->watchdog_timeo = ATH6KL_TX_TIMEOUT; dev->watchdog_timeo = ATH6KL_TX_TIMEOUT;
dev->needed_headroom = ETH_HLEN; dev->needed_headroom = ETH_HLEN;