Make b43 hwrng optional
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 520-b43-autodepend-on-hwrandom.patch
1 This patch is submitted upstream and can be removed when it hits compat-wireless.
2
3 --mb
4
5
6
7 Index: compat-wireless-2009-03-24/drivers/net/wireless/b43/b43.h
8 ===================================================================
9 --- compat-wireless-2009-03-24.orig/drivers/net/wireless/b43/b43.h 2009-03-29 13:27:05.000000000 +0200
10 +++ compat-wireless-2009-03-24/drivers/net/wireless/b43/b43.h 2009-03-29 13:27:21.000000000 +0200
11 @@ -624,9 +624,11 @@ struct b43_wl {
12 /* Stats about the wireless interface */
13 struct ieee80211_low_level_stats ieee_stats;
14
15 +#ifdef CONFIG_B43_HWRNG
16 struct hwrng rng;
17 - u8 rng_initialized;
18 + bool rng_initialized;
19 char rng_name[30 + 1];
20 +#endif /* CONFIG_B43_HWRNG */
21
22 /* The RF-kill button */
23 struct b43_rfkill rfkill;
24 Index: compat-wireless-2009-03-24/drivers/net/wireless/b43/main.c
25 ===================================================================
26 --- compat-wireless-2009-03-24.orig/drivers/net/wireless/b43/main.c 2009-03-29 13:27:05.000000000 +0200
27 +++ compat-wireless-2009-03-24/drivers/net/wireless/b43/main.c 2009-03-29 13:27:21.000000000 +0200
28 @@ -2982,6 +2982,7 @@ static void b43_security_init(struct b43
29 b43_clear_keys(dev);
30 }
31
32 +#ifdef CONFIG_B43_HWRNG
33 static int b43_rng_read(struct hwrng *rng, u32 *data)
34 {
35 struct b43_wl *wl = (struct b43_wl *)rng->priv;
36 @@ -2997,17 +2998,21 @@ static int b43_rng_read(struct hwrng *rn
37
38 return (sizeof(u16));
39 }
40 +#endif /* CONFIG_B43_HWRNG */
41
42 static void b43_rng_exit(struct b43_wl *wl)
43 {
44 +#ifdef CONFIG_B43_HWRNG
45 if (wl->rng_initialized)
46 hwrng_unregister(&wl->rng);
47 +#endif /* CONFIG_B43_HWRNG */
48 }
49
50 static int b43_rng_init(struct b43_wl *wl)
51 {
52 - int err;
53 + int err = 0;
54
55 +#ifdef CONFIG_B43_HWRNG
56 snprintf(wl->rng_name, ARRAY_SIZE(wl->rng_name),
57 "%s_%s", KBUILD_MODNAME, wiphy_name(wl->hw->wiphy));
58 wl->rng.name = wl->rng_name;
59 @@ -3020,6 +3025,7 @@ static int b43_rng_init(struct b43_wl *w
60 b43err(wl, "Failed to register the random "
61 "number generator (%d)\n", err);
62 }
63 +#endif /* CONFIG_B43_HWRNG */
64
65 return err;
66 }
67 Index: compat-wireless-2009-03-24/config.mk
68 ===================================================================
69 --- compat-wireless-2009-03-24.orig/config.mk 2009-03-29 13:28:03.000000000 +0200
70 +++ compat-wireless-2009-03-24/config.mk 2009-03-29 13:28:32.000000000 +0200
71 @@ -148,6 +148,7 @@ CONFIG_ATH9K_DEBUG=y
72 # CONFIG_B43_PIO=y
73 # CONFIG_B43_LEDS=y
74 # CONFIG_B43_RFKILL=y
75 +# CONFIG_B43_HWRNG=y
76 # CONFIG_B43_DEBUG=y
77 # CONFIG_B43_FORCE_PIO=y
78