diff options
Diffstat (limited to 'drivers/net/wireless/b43legacy/main.c')
-rw-r--r-- | drivers/net/wireless/b43legacy/main.c | 49 |
1 files changed, 10 insertions, 39 deletions
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index 04bc3f6c5e63..069abe5fb8ee 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
@@ -1975,21 +1975,6 @@ static void b43legacy_mgmtframe_txantenna(struct b43legacy_wldev *dev, | |||
1975 | B43legacy_SHM_SH_PRPHYCTL, tmp); | 1975 | B43legacy_SHM_SH_PRPHYCTL, tmp); |
1976 | } | 1976 | } |
1977 | 1977 | ||
1978 | /* Returns TRUE, if the radio is enabled in hardware. */ | ||
1979 | static bool b43legacy_is_hw_radio_enabled(struct b43legacy_wldev *dev) | ||
1980 | { | ||
1981 | if (dev->phy.rev >= 3) { | ||
1982 | if (!(b43legacy_read32(dev, B43legacy_MMIO_RADIO_HWENABLED_HI) | ||
1983 | & B43legacy_MMIO_RADIO_HWENABLED_HI_MASK)) | ||
1984 | return 1; | ||
1985 | } else { | ||
1986 | if (b43legacy_read16(dev, B43legacy_MMIO_RADIO_HWENABLED_LO) | ||
1987 | & B43legacy_MMIO_RADIO_HWENABLED_LO_MASK) | ||
1988 | return 1; | ||
1989 | } | ||
1990 | return 0; | ||
1991 | } | ||
1992 | |||
1993 | /* This is the opposite of b43legacy_chip_init() */ | 1978 | /* This is the opposite of b43legacy_chip_init() */ |
1994 | static void b43legacy_chip_exit(struct b43legacy_wldev *dev) | 1979 | static void b43legacy_chip_exit(struct b43legacy_wldev *dev) |
1995 | { | 1980 | { |
@@ -2146,32 +2131,18 @@ static void b43legacy_periodic_every15sec(struct b43legacy_wldev *dev) | |||
2146 | b43legacy_phy_xmitpower(dev); /* FIXME: unless scanning? */ | 2131 | b43legacy_phy_xmitpower(dev); /* FIXME: unless scanning? */ |
2147 | } | 2132 | } |
2148 | 2133 | ||
2149 | static void b43legacy_periodic_every1sec(struct b43legacy_wldev *dev) | ||
2150 | { | ||
2151 | bool radio_hw_enable; | ||
2152 | |||
2153 | /* check if radio hardware enabled status changed */ | ||
2154 | radio_hw_enable = b43legacy_is_hw_radio_enabled(dev); | ||
2155 | if (unlikely(dev->radio_hw_enable != radio_hw_enable)) { | ||
2156 | dev->radio_hw_enable = radio_hw_enable; | ||
2157 | b43legacy_rfkill_toggled(dev, radio_hw_enable); | ||
2158 | } | ||
2159 | } | ||
2160 | |||
2161 | static void do_periodic_work(struct b43legacy_wldev *dev) | 2134 | static void do_periodic_work(struct b43legacy_wldev *dev) |
2162 | { | 2135 | { |
2163 | unsigned int state; | 2136 | unsigned int state; |
2164 | 2137 | ||
2165 | state = dev->periodic_state; | 2138 | state = dev->periodic_state; |
2166 | if (state % 120 == 0) | 2139 | if (state % 8 == 0) |
2167 | b43legacy_periodic_every120sec(dev); | 2140 | b43legacy_periodic_every120sec(dev); |
2168 | if (state % 60 == 0) | 2141 | if (state % 4 == 0) |
2169 | b43legacy_periodic_every60sec(dev); | 2142 | b43legacy_periodic_every60sec(dev); |
2170 | if (state % 30 == 0) | 2143 | if (state % 2 == 0) |
2171 | b43legacy_periodic_every30sec(dev); | 2144 | b43legacy_periodic_every30sec(dev); |
2172 | if (state % 15 == 0) | 2145 | b43legacy_periodic_every15sec(dev); |
2173 | b43legacy_periodic_every15sec(dev); | ||
2174 | b43legacy_periodic_every1sec(dev); | ||
2175 | } | 2146 | } |
2176 | 2147 | ||
2177 | /* Estimate a "Badness" value based on the periodic work | 2148 | /* Estimate a "Badness" value based on the periodic work |
@@ -2182,13 +2153,11 @@ static int estimate_periodic_work_badness(unsigned int state) | |||
2182 | { | 2153 | { |
2183 | int badness = 0; | 2154 | int badness = 0; |
2184 | 2155 | ||
2185 | if (state % 120 == 0) /* every 120 sec */ | 2156 | if (state % 8 == 0) /* every 120 sec */ |
2186 | badness += 10; | 2157 | badness += 10; |
2187 | if (state % 60 == 0) /* every 60 sec */ | 2158 | if (state % 4 == 0) /* every 60 sec */ |
2188 | badness += 5; | 2159 | badness += 5; |
2189 | if (state % 30 == 0) /* every 30 sec */ | 2160 | if (state % 2 == 0) /* every 30 sec */ |
2190 | badness += 1; | ||
2191 | if (state % 15 == 0) /* every 15 sec */ | ||
2192 | badness += 1; | 2161 | badness += 1; |
2193 | 2162 | ||
2194 | #define BADNESS_LIMIT 4 | 2163 | #define BADNESS_LIMIT 4 |
@@ -2246,7 +2215,7 @@ out_requeue: | |||
2246 | if (b43legacy_debug(dev, B43legacy_DBG_PWORK_FAST)) | 2215 | if (b43legacy_debug(dev, B43legacy_DBG_PWORK_FAST)) |
2247 | delay = msecs_to_jiffies(50); | 2216 | delay = msecs_to_jiffies(50); |
2248 | else | 2217 | else |
2249 | delay = round_jiffies_relative(HZ); | 2218 | delay = round_jiffies_relative(HZ * 15); |
2250 | queue_delayed_work(dev->wl->hw->workqueue, | 2219 | queue_delayed_work(dev->wl->hw->workqueue, |
2251 | &dev->periodic_work, delay); | 2220 | &dev->periodic_work, delay); |
2252 | out: | 2221 | out: |
@@ -3449,6 +3418,7 @@ static int b43legacy_setup_modes(struct b43legacy_wldev *dev, | |||
3449 | 3418 | ||
3450 | static void b43legacy_wireless_core_detach(struct b43legacy_wldev *dev) | 3419 | static void b43legacy_wireless_core_detach(struct b43legacy_wldev *dev) |
3451 | { | 3420 | { |
3421 | b43legacy_rfkill_free(dev); | ||
3452 | /* We release firmware that late to not be required to re-request | 3422 | /* We release firmware that late to not be required to re-request |
3453 | * is all the time when we reinit the core. */ | 3423 | * is all the time when we reinit the core. */ |
3454 | b43legacy_release_firmware(dev); | 3424 | b43legacy_release_firmware(dev); |
@@ -3530,6 +3500,7 @@ static int b43legacy_wireless_core_attach(struct b43legacy_wldev *dev) | |||
3530 | if (!wl->current_dev) | 3500 | if (!wl->current_dev) |
3531 | wl->current_dev = dev; | 3501 | wl->current_dev = dev; |
3532 | INIT_WORK(&dev->restart_work, b43legacy_chip_reset); | 3502 | INIT_WORK(&dev->restart_work, b43legacy_chip_reset); |
3503 | b43legacy_rfkill_alloc(dev); | ||
3533 | 3504 | ||
3534 | b43legacy_radio_turn_off(dev, 1); | 3505 | b43legacy_radio_turn_off(dev, 1); |
3535 | b43legacy_switch_analog(dev, 0); | 3506 | b43legacy_switch_analog(dev, 0); |