Make b43 hwrng optional

SVN-Revision: 15070
This commit is contained in:
Michael Büsch 2009-03-29 16:49:23 +00:00
parent 2f26f545cd
commit 21028447f2
2 changed files with 80 additions and 0 deletions

View file

@ -384,6 +384,7 @@ BUILDFLAGS:= \
$(if $(CONFIG_PCI),-DCONFIG_SSB_SPROM) \ $(if $(CONFIG_PCI),-DCONFIG_SSB_SPROM) \
$(if $(CONFIG_LEDS_TRIGGERS), -DCONFIG_MAC80211_LEDS -DCONFIG_LEDS_TRIGGERS -DCONFIG_B43_LEDS -DCONFIG_B43LEGACY_LEDS) \ $(if $(CONFIG_LEDS_TRIGGERS), -DCONFIG_MAC80211_LEDS -DCONFIG_LEDS_TRIGGERS -DCONFIG_B43_LEDS -DCONFIG_B43LEGACY_LEDS) \
$(if $(CONFIG_RFKILL),-DCONFIG_B43_RFKILL -DCONFIG_B43LEGACY_RFKILL) \ $(if $(CONFIG_RFKILL),-DCONFIG_B43_RFKILL -DCONFIG_B43LEGACY_RFKILL) \
$(if $(CONFIG_HW_RANDOM),-DCONFIG_B43_HWRNG) \
$(if $(CONFIG_PCMCIA),-DCONFIG_SSB_PCMCIAHOST_POSSIBLE -DCONFIG_SSB_PCMCIAHOST -DCONFIG_B43_PCMCIA -DCONFIG_B43_PIO) \ $(if $(CONFIG_PCMCIA),-DCONFIG_SSB_PCMCIAHOST_POSSIBLE -DCONFIG_SSB_PCMCIAHOST -DCONFIG_B43_PCMCIA -DCONFIG_B43_PIO) \
$(if $(CONFIG_DEBUG_FS), -DCONFIG_MAC80211_DEBUGFS) \ $(if $(CONFIG_DEBUG_FS), -DCONFIG_MAC80211_DEBUGFS) \
-D__CONFIG_MAC80211_RC_DEFAULT=minstrel \ -D__CONFIG_MAC80211_RC_DEFAULT=minstrel \
@ -412,6 +413,7 @@ MAKE_OPTS:= \
$(if $(CONFIG_RFKILL),CONFIG_B43LEGACY_RFKILL=y,CONFIG_B43LEGACY_RFKILL=n) \ $(if $(CONFIG_RFKILL),CONFIG_B43LEGACY_RFKILL=y,CONFIG_B43LEGACY_RFKILL=n) \
CONFIG_B43LEGACY_LEDS=$(CONFIG_LEDS_TRIGGERS) \ CONFIG_B43LEGACY_LEDS=$(CONFIG_LEDS_TRIGGERS) \
CONFIG_B43_LEDS=$(CONFIG_LEDS_TRIGGERS) \ CONFIG_B43_LEDS=$(CONFIG_LEDS_TRIGGERS) \
$(if $(CONFIG_HW_RANDOM),CONFIG_B43_HWRNG=y,CONFIG_B43_HWRNG=n) \
$(if $(CONFIG_PACKAGE_kmod-b43),CONFIG_B43=m) \ $(if $(CONFIG_PACKAGE_kmod-b43),CONFIG_B43=m) \
$(if $(CONFIG_PACKAGE_kmod-b43legacy),CONFIG_B43LEGACY=m) \ $(if $(CONFIG_PACKAGE_kmod-b43legacy),CONFIG_B43LEGACY=m) \
KLIB_BUILD="$(LINUX_DIR)" \ KLIB_BUILD="$(LINUX_DIR)" \

View file

@ -0,0 +1,78 @@
This patch is submitted upstream and can be removed when it hits compat-wireless.
--mb
Index: compat-wireless-2009-03-24/drivers/net/wireless/b43/b43.h
===================================================================
--- compat-wireless-2009-03-24.orig/drivers/net/wireless/b43/b43.h 2009-03-29 13:27:05.000000000 +0200
+++ compat-wireless-2009-03-24/drivers/net/wireless/b43/b43.h 2009-03-29 13:27:21.000000000 +0200
@@ -624,9 +624,11 @@ struct b43_wl {
/* Stats about the wireless interface */
struct ieee80211_low_level_stats ieee_stats;
+#ifdef CONFIG_B43_HWRNG
struct hwrng rng;
- u8 rng_initialized;
+ bool rng_initialized;
char rng_name[30 + 1];
+#endif /* CONFIG_B43_HWRNG */
/* The RF-kill button */
struct b43_rfkill rfkill;
Index: compat-wireless-2009-03-24/drivers/net/wireless/b43/main.c
===================================================================
--- compat-wireless-2009-03-24.orig/drivers/net/wireless/b43/main.c 2009-03-29 13:27:05.000000000 +0200
+++ compat-wireless-2009-03-24/drivers/net/wireless/b43/main.c 2009-03-29 13:27:21.000000000 +0200
@@ -2982,6 +2982,7 @@ static void b43_security_init(struct b43
b43_clear_keys(dev);
}
+#ifdef CONFIG_B43_HWRNG
static int b43_rng_read(struct hwrng *rng, u32 *data)
{
struct b43_wl *wl = (struct b43_wl *)rng->priv;
@@ -2997,17 +2998,21 @@ static int b43_rng_read(struct hwrng *rn
return (sizeof(u16));
}
+#endif /* CONFIG_B43_HWRNG */
static void b43_rng_exit(struct b43_wl *wl)
{
+#ifdef CONFIG_B43_HWRNG
if (wl->rng_initialized)
hwrng_unregister(&wl->rng);
+#endif /* CONFIG_B43_HWRNG */
}
static int b43_rng_init(struct b43_wl *wl)
{
- int err;
+ int err = 0;
+#ifdef CONFIG_B43_HWRNG
snprintf(wl->rng_name, ARRAY_SIZE(wl->rng_name),
"%s_%s", KBUILD_MODNAME, wiphy_name(wl->hw->wiphy));
wl->rng.name = wl->rng_name;
@@ -3020,6 +3025,7 @@ static int b43_rng_init(struct b43_wl *w
b43err(wl, "Failed to register the random "
"number generator (%d)\n", err);
}
+#endif /* CONFIG_B43_HWRNG */
return err;
}
Index: compat-wireless-2009-03-24/config.mk
===================================================================
--- compat-wireless-2009-03-24.orig/config.mk 2009-03-29 13:28:03.000000000 +0200
+++ compat-wireless-2009-03-24/config.mk 2009-03-29 13:28:32.000000000 +0200
@@ -148,6 +148,7 @@ CONFIG_ATH9K_DEBUG=y
# CONFIG_B43_PIO=y
# CONFIG_B43_LEDS=y
# CONFIG_B43_RFKILL=y
+# CONFIG_B43_HWRNG=y
# CONFIG_B43_DEBUG=y
# CONFIG_B43_FORCE_PIO=y