aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwmc3200wifi/netdev.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-07-03 18:13:18 -0400
committerTejun Heo <tj@kernel.org>2009-07-03 18:13:18 -0400
commitc43768cbb7655ea5ff782ae250f6e2ef4297cf98 (patch)
tree3982e41dde3eecaa3739a5d1a8ed18d04bd74f01 /drivers/net/wireless/iwmc3200wifi/netdev.c
parent1a8dd307cc0a2119be4e578c517795464e6dabba (diff)
parent746a99a5af60ee676afa2ba469ccd1373493c7e7 (diff)
Merge branch 'master' into for-next
Pull linus#master to merge PER_CPU_DEF_ATTRIBUTES and alpha build fix changes. As alpha in percpu tree uses 'weak' attribute instead of inline assembly, there's no need for __used attribute. Conflicts: arch/alpha/include/asm/percpu.h arch/mn10300/kernel/vmlinux.lds.S include/linux/percpu-defs.h
Diffstat (limited to 'drivers/net/wireless/iwmc3200wifi/netdev.c')
-rw-r--r--drivers/net/wireless/iwmc3200wifi/netdev.c49
1 files changed, 31 insertions, 18 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/netdev.c b/drivers/net/wireless/iwmc3200wifi/netdev.c
index 68e2c3b6c7a1..aaa20c6885c8 100644
--- a/drivers/net/wireless/iwmc3200wifi/netdev.c
+++ b/drivers/net/wireless/iwmc3200wifi/netdev.c
@@ -114,32 +114,31 @@ void *iwm_if_alloc(int sizeof_bus, struct device *dev,
114 iwm = wdev_to_iwm(wdev); 114 iwm = wdev_to_iwm(wdev);
115 iwm->bus_ops = if_ops; 115 iwm->bus_ops = if_ops;
116 iwm->wdev = wdev; 116 iwm->wdev = wdev;
117 iwm_priv_init(iwm); 117
118 ret = iwm_priv_init(iwm);
119 if (ret) {
120 dev_err(dev, "failed to init iwm_priv\n");
121 goto out_wdev;
122 }
123
118 wdev->iftype = iwm_mode_to_nl80211_iftype(iwm->conf.mode); 124 wdev->iftype = iwm_mode_to_nl80211_iftype(iwm->conf.mode);
119 125
120 ndev = alloc_netdev_mq(0, "wlan%d", ether_setup, 126 ndev = alloc_netdev_mq(0, "wlan%d", ether_setup, IWM_TX_QUEUES);
121 IWM_TX_QUEUES);
122 if (!ndev) { 127 if (!ndev) {
123 dev_err(dev, "no memory for network device instance\n"); 128 dev_err(dev, "no memory for network device instance\n");
124 goto out_wdev; 129 goto out_priv;
125 } 130 }
126 131
127 ndev->netdev_ops = &iwm_netdev_ops; 132 ndev->netdev_ops = &iwm_netdev_ops;
128 ndev->wireless_handlers = &iwm_iw_handler_def; 133 ndev->wireless_handlers = &iwm_iw_handler_def;
129 ndev->ieee80211_ptr = wdev; 134 ndev->ieee80211_ptr = wdev;
130 SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy)); 135 SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy));
131 ret = register_netdev(ndev);
132 if (ret < 0) {
133 dev_err(dev, "Failed to register netdev: %d\n", ret);
134 goto out_ndev;
135 }
136
137 wdev->netdev = ndev; 136 wdev->netdev = ndev;
138 137
139 return iwm; 138 return iwm;
140 139
141 out_ndev: 140 out_priv:
142 free_netdev(ndev); 141 iwm_priv_deinit(iwm);
143 142
144 out_wdev: 143 out_wdev:
145 iwm_wdev_free(iwm); 144 iwm_wdev_free(iwm);
@@ -148,15 +147,29 @@ void *iwm_if_alloc(int sizeof_bus, struct device *dev,
148 147
149void iwm_if_free(struct iwm_priv *iwm) 148void iwm_if_free(struct iwm_priv *iwm)
150{ 149{
151 int i;
152
153 if (!iwm_to_ndev(iwm)) 150 if (!iwm_to_ndev(iwm))
154 return; 151 return;
155 152
156 unregister_netdev(iwm_to_ndev(iwm));
157 free_netdev(iwm_to_ndev(iwm)); 153 free_netdev(iwm_to_ndev(iwm));
158 iwm_wdev_free(iwm); 154 iwm_wdev_free(iwm);
159 destroy_workqueue(iwm->rx_wq); 155 iwm_priv_deinit(iwm);
160 for (i = 0; i < IWM_TX_QUEUES; i++) 156}
161 destroy_workqueue(iwm->txq[i].wq); 157
158int iwm_if_add(struct iwm_priv *iwm)
159{
160 struct net_device *ndev = iwm_to_ndev(iwm);
161 int ret;
162
163 ret = register_netdev(ndev);
164 if (ret < 0) {
165 dev_err(&ndev->dev, "Failed to register netdev: %d\n", ret);
166 return ret;
167 }
168
169 return 0;
170}
171
172void iwm_if_remove(struct iwm_priv *iwm)
173{
174 unregister_netdev(iwm_to_ndev(iwm));
162} 175}