diff options
author | Michael Buesch <mb@bu3sch.de> | 2008-01-09 14:15:31 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:10:42 -0500 |
commit | bfe6a50156ab0c33729378fae7038bce3c6c5184 (patch) | |
tree | 4d29fdaa77eef7772eadab31033227e49e67c911 /drivers/net/wireless/b43legacy/phy.c | |
parent | a8bdf29c6cd117644d27677962fe832b33036c77 (diff) |
b43legacy: Remove the PHY spinlock
This fixes a sparse warning about weird locking.
The spinlock is not needed, so simply remove it.
This also adds some sanity checks to the PHY and radio locking
to protect against recursive locking.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43legacy/phy.c')
-rw-r--r-- | drivers/net/wireless/b43legacy/phy.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/drivers/net/wireless/b43legacy/phy.c b/drivers/net/wireless/b43legacy/phy.c index 57c668f575fc..c16febbdbf5d 100644 --- a/drivers/net/wireless/b43legacy/phy.c +++ b/drivers/net/wireless/b43legacy/phy.c | |||
@@ -91,40 +91,36 @@ void b43legacy_voluntary_preempt(void) | |||
91 | #endif /* CONFIG_PREEMPT */ | 91 | #endif /* CONFIG_PREEMPT */ |
92 | } | 92 | } |
93 | 93 | ||
94 | void b43legacy_raw_phy_lock(struct b43legacy_wldev *dev) | 94 | /* Lock the PHY registers against concurrent access from the microcode. |
95 | * This lock is nonrecursive. */ | ||
96 | void b43legacy_phy_lock(struct b43legacy_wldev *dev) | ||
95 | { | 97 | { |
96 | struct b43legacy_phy *phy = &dev->phy; | 98 | #if B43legacy_DEBUG |
99 | B43legacy_WARN_ON(dev->phy.phy_locked); | ||
100 | dev->phy.phy_locked = 1; | ||
101 | #endif | ||
97 | 102 | ||
98 | B43legacy_WARN_ON(!irqs_disabled()); | ||
99 | if (b43legacy_read32(dev, B43legacy_MMIO_STATUS_BITFIELD) == 0) { | ||
100 | phy->locked = 0; | ||
101 | return; | ||
102 | } | ||
103 | if (dev->dev->id.revision < 3) { | 103 | if (dev->dev->id.revision < 3) { |
104 | b43legacy_mac_suspend(dev); | 104 | b43legacy_mac_suspend(dev); |
105 | spin_lock(&phy->lock); | ||
106 | } else { | 105 | } else { |
107 | if (!b43legacy_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) | 106 | if (!b43legacy_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) |
108 | b43legacy_power_saving_ctl_bits(dev, -1, 1); | 107 | b43legacy_power_saving_ctl_bits(dev, -1, 1); |
109 | } | 108 | } |
110 | phy->locked = 1; | ||
111 | } | 109 | } |
112 | 110 | ||
113 | void b43legacy_raw_phy_unlock(struct b43legacy_wldev *dev) | 111 | void b43legacy_phy_unlock(struct b43legacy_wldev *dev) |
114 | { | 112 | { |
115 | struct b43legacy_phy *phy = &dev->phy; | 113 | #if B43legacy_DEBUG |
114 | B43legacy_WARN_ON(!dev->phy.phy_locked); | ||
115 | dev->phy.phy_locked = 0; | ||
116 | #endif | ||
116 | 117 | ||
117 | B43legacy_WARN_ON(!irqs_disabled()); | ||
118 | if (dev->dev->id.revision < 3) { | 118 | if (dev->dev->id.revision < 3) { |
119 | if (phy->locked) { | 119 | b43legacy_mac_enable(dev); |
120 | spin_unlock(&phy->lock); | ||
121 | b43legacy_mac_enable(dev); | ||
122 | } | ||
123 | } else { | 120 | } else { |
124 | if (!b43legacy_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) | 121 | if (!b43legacy_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) |
125 | b43legacy_power_saving_ctl_bits(dev, -1, -1); | 122 | b43legacy_power_saving_ctl_bits(dev, -1, -1); |
126 | } | 123 | } |
127 | phy->locked = 0; | ||
128 | } | 124 | } |
129 | 125 | ||
130 | u16 b43legacy_phy_read(struct b43legacy_wldev *dev, u16 offset) | 126 | u16 b43legacy_phy_read(struct b43legacy_wldev *dev, u16 offset) |
@@ -1789,7 +1785,6 @@ void b43legacy_phy_xmitpower(struct b43legacy_wldev *dev) | |||
1789 | s16 baseband_att_delta; | 1785 | s16 baseband_att_delta; |
1790 | s16 radio_attenuation; | 1786 | s16 radio_attenuation; |
1791 | s16 baseband_attenuation; | 1787 | s16 baseband_attenuation; |
1792 | unsigned long phylock_flags; | ||
1793 | 1788 | ||
1794 | if (phy->savedpctlreg == 0xFFFF) | 1789 | if (phy->savedpctlreg == 0xFFFF) |
1795 | return; | 1790 | return; |
@@ -1944,13 +1939,13 @@ void b43legacy_phy_xmitpower(struct b43legacy_wldev *dev) | |||
1944 | phy->bbatt = baseband_attenuation; | 1939 | phy->bbatt = baseband_attenuation; |
1945 | 1940 | ||
1946 | /* Adjust the hardware */ | 1941 | /* Adjust the hardware */ |
1947 | b43legacy_phy_lock(dev, phylock_flags); | 1942 | b43legacy_phy_lock(dev); |
1948 | b43legacy_radio_lock(dev); | 1943 | b43legacy_radio_lock(dev); |
1949 | b43legacy_radio_set_txpower_bg(dev, baseband_attenuation, | 1944 | b43legacy_radio_set_txpower_bg(dev, baseband_attenuation, |
1950 | radio_attenuation, txpower); | 1945 | radio_attenuation, txpower); |
1951 | b43legacy_phy_lo_mark_current_used(dev); | 1946 | b43legacy_phy_lo_mark_current_used(dev); |
1952 | b43legacy_radio_unlock(dev); | 1947 | b43legacy_radio_unlock(dev); |
1953 | b43legacy_phy_unlock(dev, phylock_flags); | 1948 | b43legacy_phy_unlock(dev); |
1954 | } | 1949 | } |
1955 | 1950 | ||
1956 | static inline | 1951 | static inline |