b43: move hwrng registration driver to wireless core initialization

...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>
This commit is contained in:
John W. Linville 2010-08-06 15:31:45 -04:00
parent 13eb670c10
commit 84c164a34f

View File

@ -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. */
@ -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;
@ -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:
@ -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.