summaryrefslogtreecommitdiff
path: root/patches/0024-led-blink-api/mac80211.patch
blob: 00a4007cd1ffd7be0d131090464cd8bf8d162d13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1291,6 +1291,7 @@ struct ieee80211_local {
 	struct mutex chanctx_mtx;
 
 #ifdef CONFIG_MAC80211_LEDS
+	int tx_led_counter, rx_led_counter;
 	struct led_trigger tx_led, rx_led, assoc_led, radio_led;
 	struct led_trigger tpt_led;
 	atomic_t tx_led_active, rx_led_active, assoc_led_active;
--- a/net/mac80211/led.h
+++ b/net/mac80211/led.h
@@ -16,22 +16,36 @@
 static inline void ieee80211_led_rx(struct ieee80211_local *local)
 {
 #ifdef CONFIG_MAC80211_LEDS
-	unsigned long led_delay = MAC80211_BLINK_DELAY;
+	unsigned long led_delay __maybe_unused = MAC80211_BLINK_DELAY;
 
 	if (!atomic_read(&local->rx_led_active))
 		return;
+#if LINUX_VERSION_IS_GEQ(3,6,0)
 	led_trigger_blink_oneshot(&local->rx_led, &led_delay, &led_delay, 0);
+#else
+	if (local->rx_led_counter++ % 2 == 0)
+		led_trigger_event(&local->rx_led, LED_OFF);
+	else
+		led_trigger_event(&local->rx_led, LED_FULL);
+#endif
 #endif
 }
 
 static inline void ieee80211_led_tx(struct ieee80211_local *local)
 {
 #ifdef CONFIG_MAC80211_LEDS
-	unsigned long led_delay = MAC80211_BLINK_DELAY;
+	unsigned long led_delay __maybe_unused = MAC80211_BLINK_DELAY;
 
 	if (!atomic_read(&local->tx_led_active))
 		return;
+#if LINUX_VERSION_IS_GEQ(3,6,0)
 	led_trigger_blink_oneshot(&local->tx_led, &led_delay, &led_delay, 0);
+#else
+	if (local->tx_led_counter++ % 2 == 0)
+		led_trigger_event(&local->tx_led, LED_OFF);
+	else
+		led_trigger_event(&local->tx_led, LED_FULL);
+#endif
 #endif
 }