aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2011-07-06 09:45:28 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-07-08 11:11:21 -0400
commit74abacb6b5b91141eb8963faa2f22b3f1bd7c68d (patch)
tree22bef5fa0551da97250f20fcc62bf11d6404a11c
parent42c9a458965da2b74e772054fdc4bcdec0351da8 (diff)
b43: bus: add helpers for getting/setting wldev from/in bus core
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/b43/bus.c29
-rw-r--r--drivers/net/wireless/b43/bus.h3
-rw-r--r--drivers/net/wireless/b43/main.c6
3 files changed, 35 insertions, 3 deletions
diff --git a/drivers/net/wireless/b43/bus.c b/drivers/net/wireless/b43/bus.c
index c45c76dc49c7..a5e61a9fb539 100644
--- a/drivers/net/wireless/b43/bus.c
+++ b/drivers/net/wireless/b43/bus.c
@@ -225,3 +225,32 @@ struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev)
225 return dev; 225 return dev;
226} 226}
227#endif /* CONFIG_B43_SSB */ 227#endif /* CONFIG_B43_SSB */
228
229void *b43_bus_get_wldev(struct b43_bus_dev *dev)
230{
231 switch (dev->bus_type) {
232#ifdef CONFIG_B43_BCMA
233 case B43_BUS_BCMA:
234 return bcma_get_drvdata(dev->bdev);
235#endif
236#ifdef CONFIG_B43_SSB
237 case B43_BUS_SSB:
238 return ssb_get_drvdata(dev->sdev);
239#endif
240 }
241 return NULL;
242}
243
244void b43_bus_set_wldev(struct b43_bus_dev *dev, void *wldev)
245{
246 switch (dev->bus_type) {
247#ifdef CONFIG_B43_BCMA
248 case B43_BUS_BCMA:
249 bcma_set_drvdata(dev->bdev, wldev);
250#endif
251#ifdef CONFIG_B43_SSB
252 case B43_BUS_SSB:
253 ssb_set_drvdata(dev->sdev, wldev);
254#endif
255 }
256}
diff --git a/drivers/net/wireless/b43/bus.h b/drivers/net/wireless/b43/bus.h
index f3c30ebc642a..184c95659279 100644
--- a/drivers/net/wireless/b43/bus.h
+++ b/drivers/net/wireless/b43/bus.h
@@ -64,4 +64,7 @@ static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev)
64struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core); 64struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core);
65struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev); 65struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev);
66 66
67void *b43_bus_get_wldev(struct b43_bus_dev *dev);
68void b43_bus_set_wldev(struct b43_bus_dev *dev, void *data);
69
67#endif /* B43_BUS_H_ */ 70#endif /* B43_BUS_H_ */
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index f80a53d23d71..f0b9dd14ea2b 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -5000,13 +5000,13 @@ static void b43_one_core_detach(struct b43_bus_dev *dev)
5000 /* Do not cancel ieee80211-workqueue based work here. 5000 /* Do not cancel ieee80211-workqueue based work here.
5001 * See comment in b43_remove(). */ 5001 * See comment in b43_remove(). */
5002 5002
5003 wldev = ssb_get_drvdata(dev->sdev); 5003 wldev = b43_bus_get_wldev(dev);
5004 wl = wldev->wl; 5004 wl = wldev->wl;
5005 b43_debugfs_remove_device(wldev); 5005 b43_debugfs_remove_device(wldev);
5006 b43_wireless_core_detach(wldev); 5006 b43_wireless_core_detach(wldev);
5007 list_del(&wldev->list); 5007 list_del(&wldev->list);
5008 wl->nr_devs--; 5008 wl->nr_devs--;
5009 ssb_set_drvdata(dev->sdev, NULL); 5009 b43_bus_set_wldev(dev, NULL);
5010 kfree(wldev); 5010 kfree(wldev);
5011} 5011}
5012 5012
@@ -5032,7 +5032,7 @@ static int b43_one_core_attach(struct b43_bus_dev *dev, struct b43_wl *wl)
5032 5032
5033 list_add(&wldev->list, &wl->devlist); 5033 list_add(&wldev->list, &wl->devlist);
5034 wl->nr_devs++; 5034 wl->nr_devs++;
5035 ssb_set_drvdata(dev->sdev, wldev); 5035 b43_bus_set_wldev(dev, wldev);
5036 b43_debugfs_add_device(wldev); 5036 b43_debugfs_add_device(wldev);
5037 5037
5038 out: 5038 out: