Browse Source

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>
John W. Linville 15 years ago
parent
commit
84c164a34f
1 changed files with 7 additions and 2 deletions
  1. 7 2
      drivers/net/wireless/b43/main.c

+ 7 - 2
drivers/net/wireless/b43/main.c

@@ -4255,6 +4255,10 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
 	B43_WARN_ON(dev && b43_status(dev) > B43_STAT_INITIALIZED);
 	B43_WARN_ON(dev && b43_status(dev) > B43_STAT_INITIALIZED);
 	if (!dev || b43_status(dev) != B43_STAT_INITIALIZED)
 	if (!dev || b43_status(dev) != B43_STAT_INITIALIZED)
 		return;
 		return;
+
+	/* Unregister HW RNG driver */
+	b43_rng_exit(dev->wl);
+
 	b43_set_status(dev, B43_STAT_UNINIT);
 	b43_set_status(dev, B43_STAT_UNINIT);
 
 
 	/* Stop the microcode PSM. */
 	/* 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);
 	b43_set_status(dev, B43_STAT_INITIALIZED);
 
 
+	/* Register HW RNG driver */
+	b43_rng_init(dev->wl);
+
 out:
 out:
 	return err;
 	return err;
 
 
@@ -4989,7 +4996,6 @@ static int b43_probe(struct ssb_device *dev, const struct ssb_device_id *id)
 		if (err)
 		if (err)
 			goto err_one_core_detach;
 			goto err_one_core_detach;
 		b43_leds_register(wl->current_dev);
 		b43_leds_register(wl->current_dev);
-		b43_rng_init(wl);
 	}
 	}
 
 
       out:
       out:
@@ -5025,7 +5031,6 @@ static void b43_remove(struct ssb_device *dev)
 	b43_one_core_detach(dev);
 	b43_one_core_detach(dev);
 
 
 	if (list_empty(&wl->devlist)) {
 	if (list_empty(&wl->devlist)) {
-		b43_rng_exit(wl);
 		b43_leds_unregister(wl);
 		b43_leds_unregister(wl);
 		/* Last core on the chip unregistered.
 		/* Last core on the chip unregistered.
 		 * We can destroy common struct b43_wl.
 		 * We can destroy common struct b43_wl.