diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/net/wireless/b43/Makefile | 1 | ||||
| -rw-r--r-- | drivers/net/wireless/b43/b43.h | 4 | ||||
| -rw-r--r-- | drivers/net/wireless/b43/bus.c | 36 | ||||
| -rw-r--r-- | drivers/net/wireless/b43/bus.h | 17 | ||||
| -rw-r--r-- | drivers/net/wireless/b43/main.c | 30 |
5 files changed, 74 insertions, 14 deletions
diff --git a/drivers/net/wireless/b43/Makefile b/drivers/net/wireless/b43/Makefile index cef334a8c669..95f7c001fda1 100644 --- a/drivers/net/wireless/b43/Makefile +++ b/drivers/net/wireless/b43/Makefile | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | b43-y += main.o | 1 | b43-y += main.o |
| 2 | b43-y += bus.o | ||
| 2 | b43-y += tables.o | 3 | b43-y += tables.o |
| 3 | b43-$(CONFIG_B43_PHY_N) += tables_nphy.o | 4 | b43-$(CONFIG_B43_PHY_N) += tables_nphy.o |
| 4 | b43-$(CONFIG_B43_PHY_N) += radio_2055.o | 5 | b43-$(CONFIG_B43_PHY_N) += radio_2055.o |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index 25a78cfb7d15..bb81ebcf512e 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include "debugfs.h" | 11 | #include "debugfs.h" |
| 12 | #include "leds.h" | 12 | #include "leds.h" |
| 13 | #include "rfkill.h" | 13 | #include "rfkill.h" |
| 14 | #include "bus.h" | ||
| 14 | #include "lo.h" | 15 | #include "lo.h" |
| 15 | #include "phy_common.h" | 16 | #include "phy_common.h" |
| 16 | 17 | ||
| @@ -707,7 +708,8 @@ enum { | |||
| 707 | 708 | ||
| 708 | /* Data structure for one wireless device (802.11 core) */ | 709 | /* Data structure for one wireless device (802.11 core) */ |
| 709 | struct b43_wldev { | 710 | struct b43_wldev { |
| 710 | struct ssb_device *sdev; | 711 | struct ssb_device *sdev; /* TODO: remove when b43_bus_dev is ready */ |
| 712 | struct b43_bus_dev *dev; | ||
| 711 | struct b43_wl *wl; | 713 | struct b43_wl *wl; |
| 712 | 714 | ||
| 713 | /* The device initialization status. | 715 | /* The device initialization status. |
diff --git a/drivers/net/wireless/b43/bus.c b/drivers/net/wireless/b43/bus.c new file mode 100644 index 000000000000..f8ccd2cea3f9 --- /dev/null +++ b/drivers/net/wireless/b43/bus.c | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | /* | ||
| 2 | |||
| 3 | Broadcom B43 wireless driver | ||
| 4 | Bus abstraction layer | ||
| 5 | |||
| 6 | This program is free software; you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation; either version 2 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | This program is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with this program; see the file COPYING. If not, write to | ||
| 18 | the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, | ||
| 19 | Boston, MA 02110-1301, USA. | ||
| 20 | |||
| 21 | */ | ||
| 22 | |||
| 23 | #include "b43.h" | ||
| 24 | #include "bus.h" | ||
| 25 | |||
| 26 | |||
| 27 | /* SSB */ | ||
| 28 | struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev) | ||
| 29 | { | ||
| 30 | struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
| 31 | |||
| 32 | dev->bus_type = B43_BUS_SSB; | ||
| 33 | dev->sdev = sdev; | ||
| 34 | |||
| 35 | return dev; | ||
| 36 | } | ||
diff --git a/drivers/net/wireless/b43/bus.h b/drivers/net/wireless/b43/bus.h new file mode 100644 index 000000000000..68bc00a7458e --- /dev/null +++ b/drivers/net/wireless/b43/bus.h | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #ifndef B43_BUS_H_ | ||
| 2 | #define B43_BUS_H_ | ||
| 3 | |||
| 4 | enum b43_bus_type { | ||
| 5 | B43_BUS_SSB, | ||
| 6 | }; | ||
| 7 | |||
| 8 | struct b43_bus_dev { | ||
| 9 | enum b43_bus_type bus_type; | ||
| 10 | union { | ||
| 11 | struct ssb_device *sdev; | ||
| 12 | }; | ||
| 13 | }; | ||
| 14 | |||
| 15 | struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev); | ||
| 16 | |||
| 17 | #endif /* B43_BUS_H_ */ | ||
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 | ||
| 4848 | static void b43_one_core_detach(struct ssb_device *dev) | 4848 | static 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 | ||
| 4866 | static int b43_one_core_attach(struct ssb_device *dev, struct b43_wl *wl) | 4866 | static 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 | ||
| 4929 | static void b43_wireless_exit(struct ssb_device *dev, struct b43_wl *wl) | 4930 | static 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) | |||
| 4985 | static | 4986 | static |
| 4986 | int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id) | 4987 | int 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 | ||
