aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_led.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-01-07 13:45:24 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:01:04 -0500
commitcdcb006fbe7a74b5f7827f5c5c27e11399a2fab7 (patch)
tree6141a5b4315775bea971d3457191071d36061822 /net/mac80211/ieee80211_led.c
parentdf26e7ea049abe5104062f1f3e9ee7ede9d5104f (diff)
mac80211: Add radio led trigger
Some devices have a seperate LED which indicates if the radio is enabled or not. This adds a LED trigger to mac80211 where drivers can hook into when they are interested in radio status changes. v2: Check hw.conf.radio_enabled when calling start(). Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac80211/ieee80211_led.c')
-rw-r--r--net/mac80211/ieee80211_led.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/net/mac80211/ieee80211_led.c b/net/mac80211/ieee80211_led.c
index 4cf89af9d100..f401484ab6d7 100644
--- a/net/mac80211/ieee80211_led.c
+++ b/net/mac80211/ieee80211_led.c
@@ -43,6 +43,16 @@ void ieee80211_led_assoc(struct ieee80211_local *local, bool associated)
43 led_trigger_event(local->assoc_led, LED_OFF); 43 led_trigger_event(local->assoc_led, LED_OFF);
44} 44}
45 45
46void ieee80211_led_radio(struct ieee80211_local *local, bool enabled)
47{
48 if (unlikely(!local->radio_led))
49 return;
50 if (enabled)
51 led_trigger_event(local->radio_led, LED_FULL);
52 else
53 led_trigger_event(local->radio_led, LED_OFF);
54}
55
46void ieee80211_led_init(struct ieee80211_local *local) 56void ieee80211_led_init(struct ieee80211_local *local)
47{ 57{
48 local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); 58 local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
@@ -77,10 +87,25 @@ void ieee80211_led_init(struct ieee80211_local *local)
77 local->assoc_led = NULL; 87 local->assoc_led = NULL;
78 } 88 }
79 } 89 }
90
91 local->radio_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
92 if (local->radio_led) {
93 snprintf(local->radio_led_name, sizeof(local->radio_led_name),
94 "%sradio", wiphy_name(local->hw.wiphy));
95 local->radio_led->name = local->radio_led_name;
96 if (led_trigger_register(local->radio_led)) {
97 kfree(local->radio_led);
98 local->radio_led = NULL;
99 }
100 }
80} 101}
81 102
82void ieee80211_led_exit(struct ieee80211_local *local) 103void ieee80211_led_exit(struct ieee80211_local *local)
83{ 104{
105 if (local->radio_led) {
106 led_trigger_unregister(local->radio_led);
107 kfree(local->radio_led);
108 }
84 if (local->assoc_led) { 109 if (local->assoc_led) {
85 led_trigger_unregister(local->assoc_led); 110 led_trigger_unregister(local->assoc_led);
86 kfree(local->assoc_led); 111 kfree(local->assoc_led);
@@ -95,6 +120,16 @@ void ieee80211_led_exit(struct ieee80211_local *local)
95 } 120 }
96} 121}
97 122
123char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
124{
125 struct ieee80211_local *local = hw_to_local(hw);
126
127 if (local->radio_led)
128 return local->radio_led_name;
129 return NULL;
130}
131EXPORT_SYMBOL(__ieee80211_get_radio_led_name);
132
98char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw) 133char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
99{ 134{
100 struct ieee80211_local *local = hw_to_local(hw); 135 struct ieee80211_local *local = hw_to_local(hw);