]>
Commit | Line | Data |
---|---|---|
d2912cb1 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
f0706e82 JB |
2 | /* |
3 | * Copyright 2006, Johannes Berg <[email protected]> | |
f0706e82 JB |
4 | */ |
5 | ||
6 | #include <linux/list.h> | |
7 | #include <linux/spinlock.h> | |
8 | #include <linux/leds.h> | |
9 | #include "ieee80211_i.h" | |
10 | ||
8d5c2585 JB |
11 | #define MAC80211_BLINK_DELAY 50 /* ms */ |
12 | ||
13 | static inline void ieee80211_led_rx(struct ieee80211_local *local) | |
14 | { | |
15 | #ifdef CONFIG_MAC80211_LEDS | |
8d5c2585 JB |
16 | if (!atomic_read(&local->rx_led_active)) |
17 | return; | |
e298d8a3 | 18 | led_trigger_blink_oneshot(&local->rx_led, MAC80211_BLINK_DELAY, MAC80211_BLINK_DELAY, 0); |
8d5c2585 JB |
19 | #endif |
20 | } | |
21 | ||
22 | static inline void ieee80211_led_tx(struct ieee80211_local *local) | |
23 | { | |
24 | #ifdef CONFIG_MAC80211_LEDS | |
8d5c2585 JB |
25 | if (!atomic_read(&local->tx_led_active)) |
26 | return; | |
e298d8a3 | 27 | led_trigger_blink_oneshot(&local->tx_led, MAC80211_BLINK_DELAY, MAC80211_BLINK_DELAY, 0); |
8d5c2585 JB |
28 | #endif |
29 | } | |
30 | ||
f0706e82 | 31 | #ifdef CONFIG_MAC80211_LEDS |
e1e54068 JB |
32 | void ieee80211_led_assoc(struct ieee80211_local *local, |
33 | bool associated); | |
34 | void ieee80211_led_radio(struct ieee80211_local *local, | |
35 | bool enabled); | |
8d5c2585 JB |
36 | void ieee80211_alloc_led_names(struct ieee80211_local *local); |
37 | void ieee80211_free_led_names(struct ieee80211_local *local); | |
e1e54068 JB |
38 | void ieee80211_led_init(struct ieee80211_local *local); |
39 | void ieee80211_led_exit(struct ieee80211_local *local); | |
67408c8c JB |
40 | void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, |
41 | unsigned int types_on, unsigned int types_off); | |
f0706e82 | 42 | #else |
47f0c502 MB |
43 | static inline void ieee80211_led_assoc(struct ieee80211_local *local, |
44 | bool associated) | |
45 | { | |
46 | } | |
cdcb006f ID |
47 | static inline void ieee80211_led_radio(struct ieee80211_local *local, |
48 | bool enabled) | |
49 | { | |
50 | } | |
8d5c2585 JB |
51 | static inline void ieee80211_alloc_led_names(struct ieee80211_local *local) |
52 | { | |
53 | } | |
54 | static inline void ieee80211_free_led_names(struct ieee80211_local *local) | |
fe67c913 JB |
55 | { |
56 | } | |
f0706e82 JB |
57 | static inline void ieee80211_led_init(struct ieee80211_local *local) |
58 | { | |
59 | } | |
60 | static inline void ieee80211_led_exit(struct ieee80211_local *local) | |
61 | { | |
62 | } | |
67408c8c JB |
63 | static inline void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, |
64 | unsigned int types_on, | |
65 | unsigned int types_off) | |
e1e54068 JB |
66 | { |
67 | } | |
68 | #endif | |
69 | ||
70 | static inline void | |
30f6cf96 | 71 | ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, int bytes) |
e1e54068 JB |
72 | { |
73 | #ifdef CONFIG_MAC80211_LEDS | |
30f6cf96 | 74 | if (atomic_read(&local->tpt_led_active)) |
e1e54068 | 75 | local->tpt_led_trigger->tx_bytes += bytes; |
f0706e82 | 76 | #endif |
e1e54068 JB |
77 | } |
78 | ||
79 | static inline void | |
30f6cf96 | 80 | ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, int bytes) |
e1e54068 JB |
81 | { |
82 | #ifdef CONFIG_MAC80211_LEDS | |
30f6cf96 | 83 | if (atomic_read(&local->tpt_led_active)) |
e1e54068 JB |
84 | local->tpt_led_trigger->rx_bytes += bytes; |
85 | #endif | |
86 | } |