aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/b43/main.c')
-rw-r--r--drivers/net/wireless/b43/main.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 64c154d080d8..ef65c41af00f 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -38,6 +38,7 @@
38#include <linux/wireless.h> 38#include <linux/wireless.h>
39#include <linux/workqueue.h> 39#include <linux/workqueue.h>
40#include <linux/skbuff.h> 40#include <linux/skbuff.h>
41#include <linux/io.h>
41#include <linux/dma-mapping.h> 42#include <linux/dma-mapping.h>
42#include <asm/unaligned.h> 43#include <asm/unaligned.h>
43 44
@@ -2554,10 +2555,10 @@ static int b43_rng_read(struct hwrng *rng, u32 * data)
2554 return (sizeof(u16)); 2555 return (sizeof(u16));
2555} 2556}
2556 2557
2557static void b43_rng_exit(struct b43_wl *wl) 2558static void b43_rng_exit(struct b43_wl *wl, bool suspended)
2558{ 2559{
2559 if (wl->rng_initialized) 2560 if (wl->rng_initialized)
2560 hwrng_unregister(&wl->rng); 2561 __hwrng_unregister(&wl->rng, suspended);
2561} 2562}
2562 2563
2563static int b43_rng_init(struct b43_wl *wl) 2564static int b43_rng_init(struct b43_wl *wl)
@@ -3417,8 +3418,10 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
3417 macctl |= B43_MACCTL_PSM_JMP0; 3418 macctl |= B43_MACCTL_PSM_JMP0;
3418 b43_write32(dev, B43_MMIO_MACCTL, macctl); 3419 b43_write32(dev, B43_MMIO_MACCTL, macctl);
3419 3420
3420 b43_leds_exit(dev); 3421 if (!dev->suspend_in_progress) {
3421 b43_rng_exit(dev->wl); 3422 b43_leds_exit(dev);
3423 b43_rng_exit(dev->wl, false);
3424 }
3422 b43_dma_free(dev); 3425 b43_dma_free(dev);
3423 b43_chip_exit(dev); 3426 b43_chip_exit(dev);
3424 b43_radio_turn_off(dev, 1); 3427 b43_radio_turn_off(dev, 1);
@@ -3534,11 +3537,13 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
3534 ssb_bus_powerup(bus, 1); /* Enable dynamic PCTL */ 3537 ssb_bus_powerup(bus, 1); /* Enable dynamic PCTL */
3535 b43_upload_card_macaddress(dev); 3538 b43_upload_card_macaddress(dev);
3536 b43_security_init(dev); 3539 b43_security_init(dev);
3537 b43_rng_init(wl); 3540 if (!dev->suspend_in_progress)
3541 b43_rng_init(wl);
3538 3542
3539 b43_set_status(dev, B43_STAT_INITIALIZED); 3543 b43_set_status(dev, B43_STAT_INITIALIZED);
3540 3544
3541 b43_leds_init(dev); 3545 if (!dev->suspend_in_progress)
3546 b43_leds_init(dev);
3542out: 3547out:
3543 return err; 3548 return err;
3544 3549
@@ -4135,6 +4140,7 @@ static int b43_suspend(struct ssb_device *dev, pm_message_t state)
4135 b43dbg(wl, "Suspending...\n"); 4140 b43dbg(wl, "Suspending...\n");
4136 4141
4137 mutex_lock(&wl->mutex); 4142 mutex_lock(&wl->mutex);
4143 wldev->suspend_in_progress = true;
4138 wldev->suspend_init_status = b43_status(wldev); 4144 wldev->suspend_init_status = b43_status(wldev);
4139 if (wldev->suspend_init_status >= B43_STAT_STARTED) 4145 if (wldev->suspend_init_status >= B43_STAT_STARTED)
4140 b43_wireless_core_stop(wldev); 4146 b43_wireless_core_stop(wldev);
@@ -4166,15 +4172,17 @@ static int b43_resume(struct ssb_device *dev)
4166 if (wldev->suspend_init_status >= B43_STAT_STARTED) { 4172 if (wldev->suspend_init_status >= B43_STAT_STARTED) {
4167 err = b43_wireless_core_start(wldev); 4173 err = b43_wireless_core_start(wldev);
4168 if (err) { 4174 if (err) {
4175 b43_leds_exit(wldev);
4176 b43_rng_exit(wldev->wl, true);
4169 b43_wireless_core_exit(wldev); 4177 b43_wireless_core_exit(wldev);
4170 b43err(wl, "Resume failed at core start\n"); 4178 b43err(wl, "Resume failed at core start\n");
4171 goto out; 4179 goto out;
4172 } 4180 }
4173 } 4181 }
4174 mutex_unlock(&wl->mutex);
4175
4176 b43dbg(wl, "Device resumed.\n"); 4182 b43dbg(wl, "Device resumed.\n");
4177 out: 4183 out:
4184 wldev->suspend_in_progress = false;
4185 mutex_unlock(&wl->mutex);
4178 return err; 4186 return err;
4179} 4187}
4180 4188