bcm63xx: Add support for the T-Com Speedport W 500V.
[openwrt.git] / package / mac80211 / patches / 561-led_trigger_names.patch
1 From: Johannes Berg <johannes.berg@intel.com>
2 Subject: [PATCH] mac80211: make LED trigger names available early
3
4 The throughput trigger will require doing LED
5 classdev/trigger handling before register_hw(),
6 so drivers should have access to the trigger
7 names before it. If trigger registration fails,
8 this will still make the trigger name available,
9 but that's not a big problem since the default
10 trigger will the simply not be found.
11
12 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 ---
14 net/mac80211/led.c | 36 ++++++++++++++++--------------------
15 net/mac80211/led.h | 4 ++++
16 net/mac80211/main.c | 2 ++
17 3 files changed, 22 insertions(+), 20 deletions(-)
18
19 --- a/net/mac80211/led.c
20 +++ b/net/mac80211/led.c
21 @@ -54,12 +54,22 @@ void ieee80211_led_radio(struct ieee8021
22 led_trigger_event(local->radio_led, LED_OFF);
23 }
24
25 +void ieee80211_led_names(struct ieee80211_local *local)
26 +{
27 + snprintf(local->rx_led_name, sizeof(local->rx_led_name),
28 + "%srx", wiphy_name(local->hw.wiphy));
29 + snprintf(local->tx_led_name, sizeof(local->tx_led_name),
30 + "%stx", wiphy_name(local->hw.wiphy));
31 + snprintf(local->assoc_led_name, sizeof(local->assoc_led_name),
32 + "%sassoc", wiphy_name(local->hw.wiphy));
33 + snprintf(local->radio_led_name, sizeof(local->radio_led_name),
34 + "%sradio", wiphy_name(local->hw.wiphy));
35 +}
36 +
37 void ieee80211_led_init(struct ieee80211_local *local)
38 {
39 local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
40 if (local->rx_led) {
41 - snprintf(local->rx_led_name, sizeof(local->rx_led_name),
42 - "%srx", wiphy_name(local->hw.wiphy));
43 local->rx_led->name = local->rx_led_name;
44 if (led_trigger_register(local->rx_led)) {
45 kfree(local->rx_led);
46 @@ -69,8 +79,6 @@ void ieee80211_led_init(struct ieee80211
47
48 local->tx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
49 if (local->tx_led) {
50 - snprintf(local->tx_led_name, sizeof(local->tx_led_name),
51 - "%stx", wiphy_name(local->hw.wiphy));
52 local->tx_led->name = local->tx_led_name;
53 if (led_trigger_register(local->tx_led)) {
54 kfree(local->tx_led);
55 @@ -80,8 +88,6 @@ void ieee80211_led_init(struct ieee80211
56
57 local->assoc_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
58 if (local->assoc_led) {
59 - snprintf(local->assoc_led_name, sizeof(local->assoc_led_name),
60 - "%sassoc", wiphy_name(local->hw.wiphy));
61 local->assoc_led->name = local->assoc_led_name;
62 if (led_trigger_register(local->assoc_led)) {
63 kfree(local->assoc_led);
64 @@ -91,8 +97,6 @@ void ieee80211_led_init(struct ieee80211
65
66 local->radio_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
67 if (local->radio_led) {
68 - snprintf(local->radio_led_name, sizeof(local->radio_led_name),
69 - "%sradio", wiphy_name(local->hw.wiphy));
70 local->radio_led->name = local->radio_led_name;
71 if (led_trigger_register(local->radio_led)) {
72 kfree(local->radio_led);
73 @@ -125,9 +129,7 @@ char *__ieee80211_get_radio_led_name(str
74 {
75 struct ieee80211_local *local = hw_to_local(hw);
76
77 - if (local->radio_led)
78 - return local->radio_led_name;
79 - return NULL;
80 + return local->radio_led_name;
81 }
82 EXPORT_SYMBOL(__ieee80211_get_radio_led_name);
83
84 @@ -135,9 +137,7 @@ char *__ieee80211_get_assoc_led_name(str
85 {
86 struct ieee80211_local *local = hw_to_local(hw);
87
88 - if (local->assoc_led)
89 - return local->assoc_led_name;
90 - return NULL;
91 + return local->assoc_led_name;
92 }
93 EXPORT_SYMBOL(__ieee80211_get_assoc_led_name);
94
95 @@ -145,9 +145,7 @@ char *__ieee80211_get_tx_led_name(struct
96 {
97 struct ieee80211_local *local = hw_to_local(hw);
98
99 - if (local->tx_led)
100 - return local->tx_led_name;
101 - return NULL;
102 + return local->tx_led_name;
103 }
104 EXPORT_SYMBOL(__ieee80211_get_tx_led_name);
105
106 @@ -155,8 +153,6 @@ char *__ieee80211_get_rx_led_name(struct
107 {
108 struct ieee80211_local *local = hw_to_local(hw);
109
110 - if (local->rx_led)
111 - return local->rx_led_name;
112 - return NULL;
113 + return local->rx_led_name;
114 }
115 EXPORT_SYMBOL(__ieee80211_get_rx_led_name);
116 --- a/net/mac80211/led.h
117 +++ b/net/mac80211/led.h
118 @@ -18,6 +18,7 @@ extern void ieee80211_led_assoc(struct i
119 bool associated);
120 extern void ieee80211_led_radio(struct ieee80211_local *local,
121 bool enabled);
122 +extern void ieee80211_led_names(struct ieee80211_local *local);
123 extern void ieee80211_led_init(struct ieee80211_local *local);
124 extern void ieee80211_led_exit(struct ieee80211_local *local);
125 #else
126 @@ -35,6 +36,9 @@ static inline void ieee80211_led_radio(s
127 bool enabled)
128 {
129 }
130 +static inline void ieee80211_led_names(struct ieee80211_local *local)
131 +{
132 +}
133 static inline void ieee80211_led_init(struct ieee80211_local *local)
134 {
135 }
136 --- a/net/mac80211/main.c
137 +++ b/net/mac80211/main.c
138 @@ -599,6 +599,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(
139 /* init dummy netdev for use w/ NAPI */
140 init_dummy_netdev(&local->napi_dev);
141
142 + ieee80211_led_names(local);
143 +
144 return local_to_hw(local);
145 }
146 EXPORT_SYMBOL(ieee80211_alloc_hw);
This page took 0.065991 seconds and 5 git commands to generate.