diff options
author | Fabio Baltieri <fabio.baltieri@gmail.com> | 2013-07-25 06:00:26 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-08-01 04:48:49 -0400 |
commit | e47f2509e5f182f4df144406de6f2bc78179d57e (patch) | |
tree | a5adb4abee88bce7156d40a627ed47b3b7e1c3a2 /net/mac80211 | |
parent | c82b5a74cc739385db6e4275fe504a0e9469bf01 (diff) |
mac80211: use oneshot blink API for LED triggers
Change mac80211 LED trigger code to use the generic
led_trigger_blink_oneshot() API for transmit and receive activity
indication.
This gives a better feedback to the user, as with the new API each
activity event results in a visible blink, while a constant traffic
results in a continuous blink at constant rate.
Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
[fix LED disabled build error]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/ieee80211_i.h | 1 | ||||
-rw-r--r-- | net/mac80211/led.c | 19 | ||||
-rw-r--r-- | net/mac80211/led.h | 4 | ||||
-rw-r--r-- | net/mac80211/status.c | 2 | ||||
-rw-r--r-- | net/mac80211/tx.c | 1 |
5 files changed, 10 insertions, 17 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 3d32df1fbc6d..d779383c52d2 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1094,7 +1094,6 @@ struct ieee80211_local { | |||
1094 | u32 dot11TransmittedFrameCount; | 1094 | u32 dot11TransmittedFrameCount; |
1095 | 1095 | ||
1096 | #ifdef CONFIG_MAC80211_LEDS | 1096 | #ifdef CONFIG_MAC80211_LEDS |
1097 | int tx_led_counter, rx_led_counter; | ||
1098 | struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led; | 1097 | struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led; |
1099 | struct tpt_led_trigger *tpt_led_trigger; | 1098 | struct tpt_led_trigger *tpt_led_trigger; |
1100 | char tx_led_name[32], rx_led_name[32], | 1099 | char tx_led_name[32], rx_led_name[32], |
diff --git a/net/mac80211/led.c b/net/mac80211/led.c index bcffa6903129..e2b836446af3 100644 --- a/net/mac80211/led.c +++ b/net/mac80211/led.c | |||
@@ -12,27 +12,22 @@ | |||
12 | #include <linux/export.h> | 12 | #include <linux/export.h> |
13 | #include "led.h" | 13 | #include "led.h" |
14 | 14 | ||
15 | #define MAC80211_BLINK_DELAY 50 /* ms */ | ||
16 | |||
15 | void ieee80211_led_rx(struct ieee80211_local *local) | 17 | void ieee80211_led_rx(struct ieee80211_local *local) |
16 | { | 18 | { |
19 | unsigned long led_delay = MAC80211_BLINK_DELAY; | ||
17 | if (unlikely(!local->rx_led)) | 20 | if (unlikely(!local->rx_led)) |
18 | return; | 21 | return; |
19 | if (local->rx_led_counter++ % 2 == 0) | 22 | led_trigger_blink_oneshot(local->rx_led, &led_delay, &led_delay, 0); |
20 | led_trigger_event(local->rx_led, LED_OFF); | ||
21 | else | ||
22 | led_trigger_event(local->rx_led, LED_FULL); | ||
23 | } | 23 | } |
24 | 24 | ||
25 | /* q is 1 if a packet was enqueued, 0 if it has been transmitted */ | 25 | void ieee80211_led_tx(struct ieee80211_local *local) |
26 | void ieee80211_led_tx(struct ieee80211_local *local, int q) | ||
27 | { | 26 | { |
27 | unsigned long led_delay = MAC80211_BLINK_DELAY; | ||
28 | if (unlikely(!local->tx_led)) | 28 | if (unlikely(!local->tx_led)) |
29 | return; | 29 | return; |
30 | /* not sure how this is supposed to work ... */ | 30 | led_trigger_blink_oneshot(local->tx_led, &led_delay, &led_delay, 0); |
31 | local->tx_led_counter += 2*q-1; | ||
32 | if (local->tx_led_counter % 2 == 0) | ||
33 | led_trigger_event(local->tx_led, LED_OFF); | ||
34 | else | ||
35 | led_trigger_event(local->tx_led, LED_FULL); | ||
36 | } | 31 | } |
37 | 32 | ||
38 | void ieee80211_led_assoc(struct ieee80211_local *local, bool associated) | 33 | void ieee80211_led_assoc(struct ieee80211_local *local, bool associated) |
diff --git a/net/mac80211/led.h b/net/mac80211/led.h index e0275d9befa8..89f4344f13b9 100644 --- a/net/mac80211/led.h +++ b/net/mac80211/led.h | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | #ifdef CONFIG_MAC80211_LEDS | 14 | #ifdef CONFIG_MAC80211_LEDS |
15 | void ieee80211_led_rx(struct ieee80211_local *local); | 15 | void ieee80211_led_rx(struct ieee80211_local *local); |
16 | void ieee80211_led_tx(struct ieee80211_local *local, int q); | 16 | void ieee80211_led_tx(struct ieee80211_local *local); |
17 | void ieee80211_led_assoc(struct ieee80211_local *local, | 17 | void ieee80211_led_assoc(struct ieee80211_local *local, |
18 | bool associated); | 18 | bool associated); |
19 | void ieee80211_led_radio(struct ieee80211_local *local, | 19 | void ieee80211_led_radio(struct ieee80211_local *local, |
@@ -27,7 +27,7 @@ void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, | |||
27 | static inline void ieee80211_led_rx(struct ieee80211_local *local) | 27 | static inline void ieee80211_led_rx(struct ieee80211_local *local) |
28 | { | 28 | { |
29 | } | 29 | } |
30 | static inline void ieee80211_led_tx(struct ieee80211_local *local, int q) | 30 | static inline void ieee80211_led_tx(struct ieee80211_local *local) |
31 | { | 31 | { |
32 | } | 32 | } |
33 | static inline void ieee80211_led_assoc(struct ieee80211_local *local, | 33 | static inline void ieee80211_led_assoc(struct ieee80211_local *local, |
diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 6ad4c14385ef..8eabfd96ca36 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c | |||
@@ -564,7 +564,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
564 | 564 | ||
565 | rcu_read_unlock(); | 565 | rcu_read_unlock(); |
566 | 566 | ||
567 | ieee80211_led_tx(local, 0); | 567 | ieee80211_led_tx(local); |
568 | 568 | ||
569 | /* SNMP counters | 569 | /* SNMP counters |
570 | * Fragments are passed to low-level drivers as separate skbs, so these | 570 | * Fragments are passed to low-level drivers as separate skbs, so these |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index be4d3caf4879..f65873f0c89f 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1300,7 +1300,6 @@ static bool __ieee80211_tx(struct ieee80211_local *local, | |||
1300 | txpending); | 1300 | txpending); |
1301 | 1301 | ||
1302 | ieee80211_tpt_led_trig_tx(local, fc, led_len); | 1302 | ieee80211_tpt_led_trig_tx(local, fc, led_len); |
1303 | ieee80211_led_tx(local, 1); | ||
1304 | 1303 | ||
1305 | WARN_ON_ONCE(!skb_queue_empty(skbs)); | 1304 | WARN_ON_ONCE(!skb_queue_empty(skbs)); |
1306 | 1305 | ||