Skip to content

Commit

Permalink
b43: move hwrng registration driver to wireless core initialization
Browse files Browse the repository at this point in the history
...and unregistration to core shutdown.  Previously, the driver
remained registered even when the hardware was shutdown.  That
causes the driver to return -ENODEV if the b43 device is IFF_DOWN.
This change causes the driver to disappear in that case, allowing
/dev/hwrng to still function if another hwrng device is available.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
John W. Linville committed Aug 16, 2010
1 parent 13eb670 commit 84c164a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/net/wireless/b43/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4255,6 +4255,10 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
B43_WARN_ON(dev && b43_status(dev) > B43_STAT_INITIALIZED);
if (!dev || b43_status(dev) != B43_STAT_INITIALIZED)
return;

/* Unregister HW RNG driver */
b43_rng_exit(dev->wl);

b43_set_status(dev, B43_STAT_UNINIT);

/* Stop the microcode PSM. */
Expand Down Expand Up @@ -4384,6 +4388,9 @@ static int b43_wireless_core_init(struct b43_wldev *dev)

b43_set_status(dev, B43_STAT_INITIALIZED);

/* Register HW RNG driver */
b43_rng_init(dev->wl);

out:
return err;

Expand Down Expand Up @@ -4989,7 +4996,6 @@ static int b43_probe(struct ssb_device *dev, const struct ssb_device_id *id)
if (err)
goto err_one_core_detach;
b43_leds_register(wl->current_dev);
b43_rng_init(wl);
}

out:
Expand Down Expand Up @@ -5025,7 +5031,6 @@ static void b43_remove(struct ssb_device *dev)
b43_one_core_detach(dev);

if (list_empty(&wl->devlist)) {
b43_rng_exit(wl);
b43_leds_unregister(wl);
/* Last core on the chip unregistered.
* We can destroy common struct b43_wl.
Expand Down

0 comments on commit 84c164a

Please sign in to comment.