aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/led.c
diff options
context:
space:
mode:
authorFabio Baltieri <fabio.baltieri@gmail.com>2013-07-25 06:00:26 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-08-01 04:48:49 -0400
commite47f2509e5f182f4df144406de6f2bc78179d57e (patch)
treea5adb4abee88bce7156d40a627ed47b3b7e1c3a2 /net/mac80211/led.c
parentc82b5a74cc739385db6e4275fe504a0e9469bf01 (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/led.c')
-rw-r--r--net/mac80211/led.c19
1 files changed, 7 insertions, 12 deletions
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
15void ieee80211_led_rx(struct ieee80211_local *local) 17void 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 */ 25void ieee80211_led_tx(struct ieee80211_local *local)
26void 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
38void ieee80211_led_assoc(struct ieee80211_local *local, bool associated) 33void ieee80211_led_assoc(struct ieee80211_local *local, bool associated)