aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2009-03-29 07:19:31 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:29 -0400
commit616de35da94df8748771a014ef898360d5f4d0c8 (patch)
tree69c38769384816051cd6dce12b611c49809bc9d8
parenta57e2e84b65d1b89c4b1effeceb27b181226b950 (diff)
b43: Do not "select" HW_RANDOM
Auto-depend on HW_RANDOM, rather than "select"ing it. This way the user has the choice to enable or disable HWRNG support. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/b43/Kconfig8
-rw-r--r--drivers/net/wireless/b43/b43.h4
-rw-r--r--drivers/net/wireless/b43/main.c8
3 files changed, 17 insertions, 3 deletions
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig
index aab71a70ba78..21572e40b79d 100644
--- a/drivers/net/wireless/b43/Kconfig
+++ b/drivers/net/wireless/b43/Kconfig
@@ -3,7 +3,6 @@ config B43
3 depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 && HAS_DMA 3 depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 && HAS_DMA
4 select SSB 4 select SSB
5 select FW_LOADER 5 select FW_LOADER
6 select HW_RANDOM
7 ---help--- 6 ---help---
8 b43 is a driver for the Broadcom 43xx series wireless devices. 7 b43 is a driver for the Broadcom 43xx series wireless devices.
9 8
@@ -106,6 +105,13 @@ config B43_RFKILL
106 depends on B43 && (RFKILL = y || RFKILL = B43) && RFKILL_INPUT && (INPUT_POLLDEV = y || INPUT_POLLDEV = B43) 105 depends on B43 && (RFKILL = y || RFKILL = B43) && RFKILL_INPUT && (INPUT_POLLDEV = y || INPUT_POLLDEV = B43)
107 default y 106 default y
108 107
108# This config option automatically enables b43 HW-RNG support,
109# if the HW-RNG core is enabled.
110config B43_HWRNG
111 bool
112 depends on B43 && (HW_RANDOM = y || HW_RANDOM = B43)
113 default y
114
109config B43_DEBUG 115config B43_DEBUG
110 bool "Broadcom 43xx debugging" 116 bool "Broadcom 43xx debugging"
111 depends on B43 117 depends on B43
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index beaf18d6e8a7..cc1db7e5c664 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -625,9 +625,11 @@ struct b43_wl {
625 /* Stats about the wireless interface */ 625 /* Stats about the wireless interface */
626 struct ieee80211_low_level_stats ieee_stats; 626 struct ieee80211_low_level_stats ieee_stats;
627 627
628#ifdef CONFIG_B43_HWRNG
628 struct hwrng rng; 629 struct hwrng rng;
629 u8 rng_initialized; 630 bool rng_initialized;
630 char rng_name[30 + 1]; 631 char rng_name[30 + 1];
632#endif /* CONFIG_B43_HWRNG */
631 633
632 /* The RF-kill button */ 634 /* The RF-kill button */
633 struct b43_rfkill rfkill; 635 struct b43_rfkill rfkill;
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 79b685e300c7..09e0c60d96df 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2980,6 +2980,7 @@ static void b43_security_init(struct b43_wldev *dev)
2980 b43_clear_keys(dev); 2980 b43_clear_keys(dev);
2981} 2981}
2982 2982
2983#ifdef CONFIG_B43_HWRNG
2983static int b43_rng_read(struct hwrng *rng, u32 *data) 2984static int b43_rng_read(struct hwrng *rng, u32 *data)
2984{ 2985{
2985 struct b43_wl *wl = (struct b43_wl *)rng->priv; 2986 struct b43_wl *wl = (struct b43_wl *)rng->priv;
@@ -2995,17 +2996,21 @@ static int b43_rng_read(struct hwrng *rng, u32 *data)
2995 2996
2996 return (sizeof(u16)); 2997 return (sizeof(u16));
2997} 2998}
2999#endif /* CONFIG_B43_HWRNG */
2998 3000
2999static void b43_rng_exit(struct b43_wl *wl) 3001static void b43_rng_exit(struct b43_wl *wl)
3000{ 3002{
3003#ifdef CONFIG_B43_HWRNG
3001 if (wl->rng_initialized) 3004 if (wl->rng_initialized)
3002 hwrng_unregister(&wl->rng); 3005 hwrng_unregister(&wl->rng);
3006#endif /* CONFIG_B43_HWRNG */
3003} 3007}
3004 3008
3005static int b43_rng_init(struct b43_wl *wl) 3009static int b43_rng_init(struct b43_wl *wl)
3006{ 3010{
3007 int err; 3011 int err = 0;
3008 3012
3013#ifdef CONFIG_B43_HWRNG
3009 snprintf(wl->rng_name, ARRAY_SIZE(wl->rng_name), 3014 snprintf(wl->rng_name, ARRAY_SIZE(wl->rng_name),
3010 "%s_%s", KBUILD_MODNAME, wiphy_name(wl->hw->wiphy)); 3015 "%s_%s", KBUILD_MODNAME, wiphy_name(wl->hw->wiphy));
3011 wl->rng.name = wl->rng_name; 3016 wl->rng.name = wl->rng_name;
@@ -3018,6 +3023,7 @@ static int b43_rng_init(struct b43_wl *wl)
3018 b43err(wl, "Failed to register the random " 3023 b43err(wl, "Failed to register the random "
3019 "number generator (%d)\n", err); 3024 "number generator (%d)\n", err);
3020 } 3025 }
3026#endif /* CONFIG_B43_HWRNG */
3021 3027
3022 return err; 3028 return err;
3023} 3029}