aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/main.c
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2011-05-17 20:06:36 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-06-01 15:10:56 -0400
commit482f05386218a028309a71ad36066ee64b7a820d (patch)
tree9883faaf44a9766cd97b550178018ebd570be60b /drivers/net/wireless/b43/main.c
parentaa63418aa72e4468838eea457a123057b1c7cd11 (diff)
b43: add bus device abstraction layer
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.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 1e81a0d6f543..6356fbc8aec1 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4845,7 +4845,7 @@ err_powerdown:
4845 return err; 4845 return err;
4846} 4846}
4847 4847
4848static void b43_one_core_detach(struct ssb_device *dev) 4848static void b43_one_core_detach(struct b43_bus_dev *dev)
4849{ 4849{
4850 struct b43_wldev *wldev; 4850 struct b43_wldev *wldev;
4851 struct b43_wl *wl; 4851 struct b43_wl *wl;
@@ -4853,17 +4853,17 @@ static void b43_one_core_detach(struct ssb_device *dev)
4853 /* Do not cancel ieee80211-workqueue based work here. 4853 /* Do not cancel ieee80211-workqueue based work here.
4854 * See comment in b43_remove(). */ 4854 * See comment in b43_remove(). */
4855 4855
4856 wldev = ssb_get_drvdata(dev); 4856 wldev = ssb_get_drvdata(dev->sdev);
4857 wl = wldev->wl; 4857 wl = wldev->wl;
4858 b43_debugfs_remove_device(wldev); 4858 b43_debugfs_remove_device(wldev);
4859 b43_wireless_core_detach(wldev); 4859 b43_wireless_core_detach(wldev);
4860 list_del(&wldev->list); 4860 list_del(&wldev->list);
4861 wl->nr_devs--; 4861 wl->nr_devs--;
4862 ssb_set_drvdata(dev, NULL); 4862 ssb_set_drvdata(dev->sdev, NULL);
4863 kfree(wldev); 4863 kfree(wldev);
4864} 4864}
4865 4865
4866static int b43_one_core_attach(struct ssb_device *dev, struct b43_wl *wl) 4866static int b43_one_core_attach(struct b43_bus_dev *dev, struct b43_wl *wl)
4867{ 4867{
4868 struct b43_wldev *wldev; 4868 struct b43_wldev *wldev;
4869 int err = -ENOMEM; 4869 int err = -ENOMEM;
@@ -4873,7 +4873,8 @@ static int b43_one_core_attach(struct ssb_device *dev, struct b43_wl *wl)
4873 goto out; 4873 goto out;
4874 4874
4875 wldev->use_pio = b43_modparam_pio; 4875 wldev->use_pio = b43_modparam_pio;
4876 wldev->sdev = dev; 4876 wldev->dev = dev;
4877 wldev->sdev = dev->sdev; /* TODO: Remove when not needed */
4877 wldev->wl = wl; 4878 wldev->wl = wl;
4878 b43_set_status(wldev, B43_STAT_UNINIT); 4879 b43_set_status(wldev, B43_STAT_UNINIT);
4879 wldev->bad_frames_preempt = modparam_bad_frames_preempt; 4880 wldev->bad_frames_preempt = modparam_bad_frames_preempt;
@@ -4885,7 +4886,7 @@ static int b43_one_core_attach(struct ssb_device *dev, struct b43_wl *wl)
4885 4886
4886 list_add(&wldev->list, &wl->devlist); 4887 list_add(&wldev->list, &wl->devlist);
4887 wl->nr_devs++; 4888 wl->nr_devs++;
4888 ssb_set_drvdata(dev, wldev); 4889 ssb_set_drvdata(dev->sdev, wldev);
4889 b43_debugfs_add_device(wldev); 4890 b43_debugfs_add_device(wldev);
4890 4891
4891 out: 4892 out:
@@ -4926,11 +4927,11 @@ static void b43_sprom_fixup(struct ssb_bus *bus)
4926 } 4927 }
4927} 4928}
4928 4929
4929static void b43_wireless_exit(struct ssb_device *dev, struct b43_wl *wl) 4930static void b43_wireless_exit(struct b43_bus_dev *dev, struct b43_wl *wl)
4930{ 4931{
4931 struct ieee80211_hw *hw = wl->hw; 4932 struct ieee80211_hw *hw = wl->hw;
4932 4933
4933 ssb_set_devtypedata(dev, NULL); 4934 ssb_set_devtypedata(dev->sdev, NULL);
4934 ieee80211_free_hw(hw); 4935 ieee80211_free_hw(hw);
4935} 4936}
4936 4937
@@ -4985,10 +4986,13 @@ static struct b43_wl *b43_wireless_init(struct ssb_device *dev)
4985static 4986static
4986int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id) 4987int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id)
4987{ 4988{
4989 struct b43_bus_dev *dev;
4988 struct b43_wl *wl; 4990 struct b43_wl *wl;
4989 int err; 4991 int err;
4990 int first = 0; 4992 int first = 0;
4991 4993
4994 dev = b43_bus_dev_ssb_init(sdev);
4995
4992 wl = ssb_get_devtypedata(sdev); 4996 wl = ssb_get_devtypedata(sdev);
4993 if (!wl) { 4997 if (!wl) {
4994 /* Probing the first core. Must setup common struct b43_wl */ 4998 /* Probing the first core. Must setup common struct b43_wl */
@@ -5002,7 +5006,7 @@ int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id)
5002 ssb_set_devtypedata(sdev, wl); 5006 ssb_set_devtypedata(sdev, wl);
5003 B43_WARN_ON(ssb_get_devtypedata(sdev) != wl); 5007 B43_WARN_ON(ssb_get_devtypedata(sdev) != wl);
5004 } 5008 }
5005 err = b43_one_core_attach(sdev, wl); 5009 err = b43_one_core_attach(dev, wl);
5006 if (err) 5010 if (err)
5007 goto err_wireless_exit; 5011 goto err_wireless_exit;
5008 5012
@@ -5017,10 +5021,10 @@ int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id)
5017 return err; 5021 return err;
5018 5022
5019 err_one_core_detach: 5023 err_one_core_detach:
5020 b43_one_core_detach(sdev); 5024 b43_one_core_detach(dev);
5021 err_wireless_exit: 5025 err_wireless_exit:
5022 if (first) 5026 if (first)
5023 b43_wireless_exit(sdev, wl); 5027 b43_wireless_exit(dev, wl);
5024 return err; 5028 return err;
5025} 5029}
5026 5030
@@ -5043,14 +5047,14 @@ static void b43_ssb_remove(struct ssb_device *sdev)
5043 ieee80211_unregister_hw(wl->hw); 5047 ieee80211_unregister_hw(wl->hw);
5044 } 5048 }
5045 5049
5046 b43_one_core_detach(sdev); 5050 b43_one_core_detach(wldev->dev);
5047 5051
5048 if (list_empty(&wl->devlist)) { 5052 if (list_empty(&wl->devlist)) {
5049 b43_leds_unregister(wl); 5053 b43_leds_unregister(wl);
5050 /* Last core on the chip unregistered. 5054 /* Last core on the chip unregistered.
5051 * We can destroy common struct b43_wl. 5055 * We can destroy common struct b43_wl.
5052 */ 5056 */
5053 b43_wireless_exit(sdev, wl); 5057 b43_wireless_exit(wldev->dev, wl);
5054 } 5058 }
5055} 5059}
5056 5060