aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/led.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-04-08 15:14:40 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-08 16:44:45 -0400
commit2c8dccc77420fb7433da5674818959d3499d35be (patch)
tree2da037732b78a4796254b485f0c591d9625b7d1e /net/mac80211/led.c
parent3b96766f0e643f52ae19e134664df6730c737e87 (diff)
mac80211: rename files
This patch renames all mac80211 files (except ieee80211_i.h) to get rid of the useless ieee80211_ prefix. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/led.c')
-rw-r--r--net/mac80211/led.c161
1 files changed, 161 insertions, 0 deletions
diff --git a/net/mac80211/led.c b/net/mac80211/led.c
new file mode 100644
index 000000000000..162a643f16b6
--- /dev/null
+++ b/net/mac80211/led.c
@@ -0,0 +1,161 @@
1/*
2 * Copyright 2006, Johannes Berg <johannes@sipsolutions.net>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9/* just for IFNAMSIZ */
10#include <linux/if.h>
11#include "led.h"
12
13void ieee80211_led_rx(struct ieee80211_local *local)
14{
15 if (unlikely(!local->rx_led))
16 return;
17 if (local->rx_led_counter++ % 2 == 0)
18 led_trigger_event(local->rx_led, LED_OFF);
19 else
20 led_trigger_event(local->rx_led, LED_FULL);
21}
22
23/* q is 1 if a packet was enqueued, 0 if it has been transmitted */
24void ieee80211_led_tx(struct ieee80211_local *local, int q)
25{
26 if (unlikely(!local->tx_led))
27 return;
28 /* not sure how this is supposed to work ... */
29 local->tx_led_counter += 2*q-1;
30 if (local->tx_led_counter % 2 == 0)
31 led_trigger_event(local->tx_led, LED_OFF);
32 else
33 led_trigger_event(local->tx_led, LED_FULL);
34}
35
36void ieee80211_led_assoc(struct ieee80211_local *local, bool associated)
37{
38 if (unlikely(!local->assoc_led))
39 return;
40 if (associated)
41 led_trigger_event(local->assoc_led, LED_FULL);
42 else
43 led_trigger_event(local->assoc_led, LED_OFF);
44}
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
56void ieee80211_led_init(struct ieee80211_local *local)
57{
58 local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
59 if (local->rx_led) {
60 snprintf(local->rx_led_name, sizeof(local->rx_led_name),
61 "%srx", wiphy_name(local->hw.wiphy));
62 local->rx_led->name = local->rx_led_name;
63 if (led_trigger_register(local->rx_led)) {
64 kfree(local->rx_led);
65 local->rx_led = NULL;
66 }
67 }
68
69 local->tx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
70 if (local->tx_led) {
71 snprintf(local->tx_led_name, sizeof(local->tx_led_name),
72 "%stx", wiphy_name(local->hw.wiphy));
73 local->tx_led->name = local->tx_led_name;
74 if (led_trigger_register(local->tx_led)) {
75 kfree(local->tx_led);
76 local->tx_led = NULL;
77 }
78 }
79
80 local->assoc_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
81 if (local->assoc_led) {
82 snprintf(local->assoc_led_name, sizeof(local->assoc_led_name),
83 "%sassoc", wiphy_name(local->hw.wiphy));
84 local->assoc_led->name = local->assoc_led_name;
85 if (led_trigger_register(local->assoc_led)) {
86 kfree(local->assoc_led);
87 local->assoc_led = NULL;
88 }
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 }
101}
102
103void ieee80211_led_exit(struct ieee80211_local *local)
104{
105 if (local->radio_led) {
106 led_trigger_unregister(local->radio_led);
107 kfree(local->radio_led);
108 }
109 if (local->assoc_led) {
110 led_trigger_unregister(local->assoc_led);
111 kfree(local->assoc_led);
112 }
113 if (local->tx_led) {
114 led_trigger_unregister(local->tx_led);
115 kfree(local->tx_led);
116 }
117 if (local->rx_led) {
118 led_trigger_unregister(local->rx_led);
119 kfree(local->rx_led);
120 }
121}
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
133char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
134{
135 struct ieee80211_local *local = hw_to_local(hw);
136
137 if (local->assoc_led)
138 return local->assoc_led_name;
139 return NULL;
140}
141EXPORT_SYMBOL(__ieee80211_get_assoc_led_name);
142
143char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
144{
145 struct ieee80211_local *local = hw_to_local(hw);
146
147 if (local->tx_led)
148 return local->tx_led_name;
149 return NULL;
150}
151EXPORT_SYMBOL(__ieee80211_get_tx_led_name);
152
153char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw)
154{
155 struct ieee80211_local *local = hw_to_local(hw);
156
157 if (local->rx_led)
158 return local->rx_led_name;
159 return NULL;
160}
161EXPORT_SYMBOL(__ieee80211_get_rx_led_name);