1 /* SPDX-License-Identifier: GPL-2.0-only */ 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 2 /* 3 * Copyright 2006, Johannes Berg <johannes@sip 3 * Copyright 2006, Johannes Berg <johannes@sipsolutions.net> 4 */ 4 */ 5 5 6 #include <linux/list.h> 6 #include <linux/list.h> 7 #include <linux/spinlock.h> 7 #include <linux/spinlock.h> 8 #include <linux/leds.h> 8 #include <linux/leds.h> 9 #include "ieee80211_i.h" 9 #include "ieee80211_i.h" 10 10 11 #define MAC80211_BLINK_DELAY 50 /* ms */ 11 #define MAC80211_BLINK_DELAY 50 /* ms */ 12 12 13 static inline void ieee80211_led_rx(struct iee 13 static inline void ieee80211_led_rx(struct ieee80211_local *local) 14 { 14 { 15 #ifdef CONFIG_MAC80211_LEDS 15 #ifdef CONFIG_MAC80211_LEDS >> 16 unsigned long led_delay = MAC80211_BLINK_DELAY; >> 17 16 if (!atomic_read(&local->rx_led_active 18 if (!atomic_read(&local->rx_led_active)) 17 return; 19 return; 18 led_trigger_blink_oneshot(&local->rx_l !! 20 led_trigger_blink_oneshot(&local->rx_led, &led_delay, &led_delay, 0); 19 #endif 21 #endif 20 } 22 } 21 23 22 static inline void ieee80211_led_tx(struct iee 24 static inline void ieee80211_led_tx(struct ieee80211_local *local) 23 { 25 { 24 #ifdef CONFIG_MAC80211_LEDS 26 #ifdef CONFIG_MAC80211_LEDS >> 27 unsigned long led_delay = MAC80211_BLINK_DELAY; >> 28 25 if (!atomic_read(&local->tx_led_active 29 if (!atomic_read(&local->tx_led_active)) 26 return; 30 return; 27 led_trigger_blink_oneshot(&local->tx_l !! 31 led_trigger_blink_oneshot(&local->tx_led, &led_delay, &led_delay, 0); 28 #endif 32 #endif 29 } 33 } 30 34 31 #ifdef CONFIG_MAC80211_LEDS 35 #ifdef CONFIG_MAC80211_LEDS 32 void ieee80211_led_assoc(struct ieee80211_loca 36 void ieee80211_led_assoc(struct ieee80211_local *local, 33 bool associated); 37 bool associated); 34 void ieee80211_led_radio(struct ieee80211_loca 38 void ieee80211_led_radio(struct ieee80211_local *local, 35 bool enabled); 39 bool enabled); 36 void ieee80211_alloc_led_names(struct ieee8021 40 void ieee80211_alloc_led_names(struct ieee80211_local *local); 37 void ieee80211_free_led_names(struct ieee80211 41 void ieee80211_free_led_names(struct ieee80211_local *local); 38 void ieee80211_led_init(struct ieee80211_local 42 void ieee80211_led_init(struct ieee80211_local *local); 39 void ieee80211_led_exit(struct ieee80211_local 43 void ieee80211_led_exit(struct ieee80211_local *local); 40 void ieee80211_mod_tpt_led_trig(struct ieee802 44 void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, 41 unsigned int t 45 unsigned int types_on, unsigned int types_off); 42 #else 46 #else 43 static inline void ieee80211_led_assoc(struct 47 static inline void ieee80211_led_assoc(struct ieee80211_local *local, 44 bool as 48 bool associated) 45 { 49 { 46 } 50 } 47 static inline void ieee80211_led_radio(struct 51 static inline void ieee80211_led_radio(struct ieee80211_local *local, 48 bool en 52 bool enabled) 49 { 53 { 50 } 54 } 51 static inline void ieee80211_alloc_led_names(s 55 static inline void ieee80211_alloc_led_names(struct ieee80211_local *local) 52 { 56 { 53 } 57 } 54 static inline void ieee80211_free_led_names(st 58 static inline void ieee80211_free_led_names(struct ieee80211_local *local) 55 { 59 { 56 } 60 } 57 static inline void ieee80211_led_init(struct i 61 static inline void ieee80211_led_init(struct ieee80211_local *local) 58 { 62 { 59 } 63 } 60 static inline void ieee80211_led_exit(struct i 64 static inline void ieee80211_led_exit(struct ieee80211_local *local) 61 { 65 { 62 } 66 } 63 static inline void ieee80211_mod_tpt_led_trig( 67 static inline void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, 64 68 unsigned int types_on, 65 69 unsigned int types_off) 66 { 70 { 67 } 71 } 68 #endif 72 #endif 69 73 70 static inline void 74 static inline void 71 ieee80211_tpt_led_trig_tx(struct ieee80211_loc !! 75 ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, __le16 fc, int bytes) 72 { 76 { 73 #ifdef CONFIG_MAC80211_LEDS 77 #ifdef CONFIG_MAC80211_LEDS 74 if (atomic_read(&local->tpt_led_active !! 78 if (ieee80211_is_data(fc) && atomic_read(&local->tpt_led_active)) 75 local->tpt_led_trigger->tx_byt 79 local->tpt_led_trigger->tx_bytes += bytes; 76 #endif 80 #endif 77 } 81 } 78 82 79 static inline void 83 static inline void 80 ieee80211_tpt_led_trig_rx(struct ieee80211_loc !! 84 ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, __le16 fc, int bytes) 81 { 85 { 82 #ifdef CONFIG_MAC80211_LEDS 86 #ifdef CONFIG_MAC80211_LEDS 83 if (atomic_read(&local->tpt_led_active !! 87 if (ieee80211_is_data(fc) && atomic_read(&local->tpt_led_active)) 84 local->tpt_led_trigger->rx_byt 88 local->tpt_led_trigger->rx_bytes += bytes; 85 #endif 89 #endif 86 } 90 } 87 91
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.