Merge tag 'uml-for-linus-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / net / mac80211 / led.h
blobd25f13346b82daa7e0945853e2c0a56ade9320d4
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright 2006, Johannes Berg <johannes@sipsolutions.net>
4 */
6 #include <linux/list.h>
7 #include <linux/spinlock.h>
8 #include <linux/leds.h>
9 #include "ieee80211_i.h"
11 #define MAC80211_BLINK_DELAY 50 /* ms */
13 static inline void ieee80211_led_rx(struct ieee80211_local *local)
15 #ifdef CONFIG_MAC80211_LEDS
16 if (!atomic_read(&local->rx_led_active))
17 return;
18 led_trigger_blink_oneshot(&local->rx_led, MAC80211_BLINK_DELAY, MAC80211_BLINK_DELAY, 0);
19 #endif
22 static inline void ieee80211_led_tx(struct ieee80211_local *local)
24 #ifdef CONFIG_MAC80211_LEDS
25 if (!atomic_read(&local->tx_led_active))
26 return;
27 led_trigger_blink_oneshot(&local->tx_led, MAC80211_BLINK_DELAY, MAC80211_BLINK_DELAY, 0);
28 #endif
31 #ifdef CONFIG_MAC80211_LEDS
32 void ieee80211_led_assoc(struct ieee80211_local *local,
33 bool associated);
34 void ieee80211_led_radio(struct ieee80211_local *local,
35 bool enabled);
36 void ieee80211_alloc_led_names(struct ieee80211_local *local);
37 void ieee80211_free_led_names(struct ieee80211_local *local);
38 void ieee80211_led_init(struct ieee80211_local *local);
39 void ieee80211_led_exit(struct ieee80211_local *local);
40 void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local,
41 unsigned int types_on, unsigned int types_off);
42 #else
43 static inline void ieee80211_led_assoc(struct ieee80211_local *local,
44 bool associated)
47 static inline void ieee80211_led_radio(struct ieee80211_local *local,
48 bool enabled)
51 static inline void ieee80211_alloc_led_names(struct ieee80211_local *local)
54 static inline void ieee80211_free_led_names(struct ieee80211_local *local)
57 static inline void ieee80211_led_init(struct ieee80211_local *local)
60 static inline void ieee80211_led_exit(struct ieee80211_local *local)
63 static inline void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local,
64 unsigned int types_on,
65 unsigned int types_off)
68 #endif
70 static inline void
71 ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, int bytes)
73 #ifdef CONFIG_MAC80211_LEDS
74 if (atomic_read(&local->tpt_led_active))
75 local->tpt_led_trigger->tx_bytes += bytes;
76 #endif
79 static inline void
80 ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, int bytes)
82 #ifdef CONFIG_MAC80211_LEDS
83 if (atomic_read(&local->tpt_led_active))
84 local->tpt_led_trigger->rx_bytes += bytes;
85 #endif