diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-11-27 14:02:59 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-12-22 14:33:37 -0500 |
commit | fe67c913f1ec2a01aaa9176c80ef36eaf87d705d (patch) | |
tree | 4ac91b417d1693ac9b49cf46872bd90c4dceae2b | |
parent | 63e35cd9bd4c8ae085c8b9a70554595b529c4100 (diff) |
mac80211: make LED trigger names available early
The throughput trigger will require doing LED
classdev/trigger handling before register_hw(),
so drivers should have access to the trigger
names before it. If trigger registration fails,
this will still make the trigger name available,
but that's not a big problem since the default
trigger will the simply not be found.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | net/mac80211/led.c | 36 | ||||
-rw-r--r-- | net/mac80211/led.h | 4 | ||||
-rw-r--r-- | net/mac80211/main.c | 2 |
3 files changed, 22 insertions, 20 deletions
diff --git a/net/mac80211/led.c b/net/mac80211/led.c index 063aad944246..740a1d4e0a9c 100644 --- a/net/mac80211/led.c +++ b/net/mac80211/led.c | |||
@@ -54,12 +54,22 @@ void ieee80211_led_radio(struct ieee80211_local *local, bool enabled) | |||
54 | led_trigger_event(local->radio_led, LED_OFF); | 54 | led_trigger_event(local->radio_led, LED_OFF); |
55 | } | 55 | } |
56 | 56 | ||
57 | void ieee80211_led_names(struct ieee80211_local *local) | ||
58 | { | ||
59 | snprintf(local->rx_led_name, sizeof(local->rx_led_name), | ||
60 | "%srx", wiphy_name(local->hw.wiphy)); | ||
61 | snprintf(local->tx_led_name, sizeof(local->tx_led_name), | ||
62 | "%stx", wiphy_name(local->hw.wiphy)); | ||
63 | snprintf(local->assoc_led_name, sizeof(local->assoc_led_name), | ||
64 | "%sassoc", wiphy_name(local->hw.wiphy)); | ||
65 | snprintf(local->radio_led_name, sizeof(local->radio_led_name), | ||
66 | "%sradio", wiphy_name(local->hw.wiphy)); | ||
67 | } | ||
68 | |||
57 | void ieee80211_led_init(struct ieee80211_local *local) | 69 | void ieee80211_led_init(struct ieee80211_local *local) |
58 | { | 70 | { |
59 | local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); | 71 | local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); |
60 | if (local->rx_led) { | 72 | if (local->rx_led) { |
61 | snprintf(local->rx_led_name, sizeof(local->rx_led_name), | ||
62 | "%srx", wiphy_name(local->hw.wiphy)); | ||
63 | local->rx_led->name = local->rx_led_name; | 73 | local->rx_led->name = local->rx_led_name; |
64 | if (led_trigger_register(local->rx_led)) { | 74 | if (led_trigger_register(local->rx_led)) { |
65 | kfree(local->rx_led); | 75 | kfree(local->rx_led); |
@@ -69,8 +79,6 @@ void ieee80211_led_init(struct ieee80211_local *local) | |||
69 | 79 | ||
70 | local->tx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); | 80 | local->tx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); |
71 | if (local->tx_led) { | 81 | if (local->tx_led) { |
72 | snprintf(local->tx_led_name, sizeof(local->tx_led_name), | ||
73 | "%stx", wiphy_name(local->hw.wiphy)); | ||
74 | local->tx_led->name = local->tx_led_name; | 82 | local->tx_led->name = local->tx_led_name; |
75 | if (led_trigger_register(local->tx_led)) { | 83 | if (led_trigger_register(local->tx_led)) { |
76 | kfree(local->tx_led); | 84 | kfree(local->tx_led); |
@@ -80,8 +88,6 @@ void ieee80211_led_init(struct ieee80211_local *local) | |||
80 | 88 | ||
81 | local->assoc_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); | 89 | local->assoc_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); |
82 | if (local->assoc_led) { | 90 | if (local->assoc_led) { |
83 | snprintf(local->assoc_led_name, sizeof(local->assoc_led_name), | ||
84 | "%sassoc", wiphy_name(local->hw.wiphy)); | ||
85 | local->assoc_led->name = local->assoc_led_name; | 91 | local->assoc_led->name = local->assoc_led_name; |
86 | if (led_trigger_register(local->assoc_led)) { | 92 | if (led_trigger_register(local->assoc_led)) { |
87 | kfree(local->assoc_led); | 93 | kfree(local->assoc_led); |
@@ -91,8 +97,6 @@ void ieee80211_led_init(struct ieee80211_local *local) | |||
91 | 97 | ||
92 | local->radio_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); | 98 | local->radio_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); |
93 | if (local->radio_led) { | 99 | if (local->radio_led) { |
94 | snprintf(local->radio_led_name, sizeof(local->radio_led_name), | ||
95 | "%sradio", wiphy_name(local->hw.wiphy)); | ||
96 | local->radio_led->name = local->radio_led_name; | 100 | local->radio_led->name = local->radio_led_name; |
97 | if (led_trigger_register(local->radio_led)) { | 101 | if (led_trigger_register(local->radio_led)) { |
98 | kfree(local->radio_led); | 102 | kfree(local->radio_led); |
@@ -125,9 +129,7 @@ char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw) | |||
125 | { | 129 | { |
126 | struct ieee80211_local *local = hw_to_local(hw); | 130 | struct ieee80211_local *local = hw_to_local(hw); |
127 | 131 | ||
128 | if (local->radio_led) | 132 | return local->radio_led_name; |
129 | return local->radio_led_name; | ||
130 | return NULL; | ||
131 | } | 133 | } |
132 | EXPORT_SYMBOL(__ieee80211_get_radio_led_name); | 134 | EXPORT_SYMBOL(__ieee80211_get_radio_led_name); |
133 | 135 | ||
@@ -135,9 +137,7 @@ char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw) | |||
135 | { | 137 | { |
136 | struct ieee80211_local *local = hw_to_local(hw); | 138 | struct ieee80211_local *local = hw_to_local(hw); |
137 | 139 | ||
138 | if (local->assoc_led) | 140 | return local->assoc_led_name; |
139 | return local->assoc_led_name; | ||
140 | return NULL; | ||
141 | } | 141 | } |
142 | EXPORT_SYMBOL(__ieee80211_get_assoc_led_name); | 142 | EXPORT_SYMBOL(__ieee80211_get_assoc_led_name); |
143 | 143 | ||
@@ -145,9 +145,7 @@ char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw) | |||
145 | { | 145 | { |
146 | struct ieee80211_local *local = hw_to_local(hw); | 146 | struct ieee80211_local *local = hw_to_local(hw); |
147 | 147 | ||
148 | if (local->tx_led) | 148 | return local->tx_led_name; |
149 | return local->tx_led_name; | ||
150 | return NULL; | ||
151 | } | 149 | } |
152 | EXPORT_SYMBOL(__ieee80211_get_tx_led_name); | 150 | EXPORT_SYMBOL(__ieee80211_get_tx_led_name); |
153 | 151 | ||
@@ -155,8 +153,6 @@ char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw) | |||
155 | { | 153 | { |
156 | struct ieee80211_local *local = hw_to_local(hw); | 154 | struct ieee80211_local *local = hw_to_local(hw); |
157 | 155 | ||
158 | if (local->rx_led) | 156 | return local->rx_led_name; |
159 | return local->rx_led_name; | ||
160 | return NULL; | ||
161 | } | 157 | } |
162 | EXPORT_SYMBOL(__ieee80211_get_rx_led_name); | 158 | EXPORT_SYMBOL(__ieee80211_get_rx_led_name); |
diff --git a/net/mac80211/led.h b/net/mac80211/led.h index 77b1e1ba6039..8320cbac61c6 100644 --- a/net/mac80211/led.h +++ b/net/mac80211/led.h | |||
@@ -18,6 +18,7 @@ extern void ieee80211_led_assoc(struct ieee80211_local *local, | |||
18 | bool associated); | 18 | bool associated); |
19 | extern void ieee80211_led_radio(struct ieee80211_local *local, | 19 | extern void ieee80211_led_radio(struct ieee80211_local *local, |
20 | bool enabled); | 20 | bool enabled); |
21 | extern void ieee80211_led_names(struct ieee80211_local *local); | ||
21 | extern void ieee80211_led_init(struct ieee80211_local *local); | 22 | extern void ieee80211_led_init(struct ieee80211_local *local); |
22 | extern void ieee80211_led_exit(struct ieee80211_local *local); | 23 | extern void ieee80211_led_exit(struct ieee80211_local *local); |
23 | #else | 24 | #else |
@@ -35,6 +36,9 @@ static inline void ieee80211_led_radio(struct ieee80211_local *local, | |||
35 | bool enabled) | 36 | bool enabled) |
36 | { | 37 | { |
37 | } | 38 | } |
39 | static inline void ieee80211_led_names(struct ieee80211_local *local) | ||
40 | { | ||
41 | } | ||
38 | static inline void ieee80211_led_init(struct ieee80211_local *local) | 42 | static inline void ieee80211_led_init(struct ieee80211_local *local) |
39 | { | 43 | { |
40 | } | 44 | } |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index a21d049caf19..bbe8e0ac6e52 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -605,6 +605,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | |||
605 | /* init dummy netdev for use w/ NAPI */ | 605 | /* init dummy netdev for use w/ NAPI */ |
606 | init_dummy_netdev(&local->napi_dev); | 606 | init_dummy_netdev(&local->napi_dev); |
607 | 607 | ||
608 | ieee80211_led_names(local); | ||
609 | |||
608 | return local_to_hw(local); | 610 | return local_to_hw(local); |
609 | } | 611 | } |
610 | EXPORT_SYMBOL(ieee80211_alloc_hw); | 612 | EXPORT_SYMBOL(ieee80211_alloc_hw); |