diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2011-07-20 14:02:39 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-07-22 09:51:14 -0400 |
commit | 24aad3f4c8a5c0a7514733fb9fa70994e24a5707 (patch) | |
tree | 3a540538cd43c7d1800304e31b17454a60a9bd28 /drivers/net/wireless/b43/main.c | |
parent | eb90e9e85c36dd2dd730d2eacec74db84491033d (diff) |
b43: (un)initialize driver on the BCMA bus
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/main.c')
-rw-r--r-- | drivers/net/wireless/b43/main.c | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 269483a52b3c..d9f53b791b21 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -5235,19 +5235,59 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev) | |||
5235 | static int b43_bcma_probe(struct bcma_device *core) | 5235 | static int b43_bcma_probe(struct bcma_device *core) |
5236 | { | 5236 | { |
5237 | struct b43_bus_dev *dev; | 5237 | struct b43_bus_dev *dev; |
5238 | struct b43_wl *wl; | ||
5239 | int err; | ||
5238 | 5240 | ||
5239 | dev = b43_bus_dev_bcma_init(core); | 5241 | dev = b43_bus_dev_bcma_init(core); |
5240 | if (!dev) | 5242 | if (!dev) |
5241 | return -ENODEV; | 5243 | return -ENODEV; |
5242 | 5244 | ||
5243 | b43err(NULL, "BCMA is not supported yet!"); | 5245 | wl = b43_wireless_init(dev); |
5244 | kfree(dev); | 5246 | if (IS_ERR(wl)) { |
5245 | return -EOPNOTSUPP; | 5247 | err = PTR_ERR(wl); |
5248 | goto bcma_out; | ||
5249 | } | ||
5250 | |||
5251 | err = b43_one_core_attach(dev, wl); | ||
5252 | if (err) | ||
5253 | goto bcma_err_wireless_exit; | ||
5254 | |||
5255 | err = ieee80211_register_hw(wl->hw); | ||
5256 | if (err) | ||
5257 | goto bcma_err_one_core_detach; | ||
5258 | b43_leds_register(wl->current_dev); | ||
5259 | |||
5260 | bcma_out: | ||
5261 | return err; | ||
5262 | |||
5263 | bcma_err_one_core_detach: | ||
5264 | b43_one_core_detach(dev); | ||
5265 | bcma_err_wireless_exit: | ||
5266 | ieee80211_free_hw(wl->hw); | ||
5267 | return err; | ||
5246 | } | 5268 | } |
5247 | 5269 | ||
5248 | static void b43_bcma_remove(struct bcma_device *core) | 5270 | static void b43_bcma_remove(struct bcma_device *core) |
5249 | { | 5271 | { |
5250 | /* TODO */ | 5272 | struct b43_wldev *wldev = bcma_get_drvdata(core); |
5273 | struct b43_wl *wl = wldev->wl; | ||
5274 | |||
5275 | /* We must cancel any work here before unregistering from ieee80211, | ||
5276 | * as the ieee80211 unreg will destroy the workqueue. */ | ||
5277 | cancel_work_sync(&wldev->restart_work); | ||
5278 | |||
5279 | /* Restore the queues count before unregistering, because firmware detect | ||
5280 | * might have modified it. Restoring is important, so the networking | ||
5281 | * stack can properly free resources. */ | ||
5282 | wl->hw->queues = wl->mac80211_initially_registered_queues; | ||
5283 | b43_leds_stop(wldev); | ||
5284 | ieee80211_unregister_hw(wl->hw); | ||
5285 | |||
5286 | b43_one_core_detach(wldev->dev); | ||
5287 | |||
5288 | b43_leds_unregister(wl); | ||
5289 | |||
5290 | ieee80211_free_hw(wl->hw); | ||
5251 | } | 5291 | } |
5252 | 5292 | ||
5253 | static struct bcma_driver b43_bcma_driver = { | 5293 | static struct bcma_driver b43_bcma_driver = { |